From: James D. Forrester Date: Thu, 6 Mar 2014 00:08:51 +0000 (-0800) Subject: Update OOjs UI to v0.1.0-pre (e4f6ce0156) X-Git-Tag: 1.31.0-rc.0~16724 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=a50721943e72ca6d2847c9c56a958f0fe9daa63e;p=lhc%2Fweb%2Fwiklou.git Update OOjs UI to v0.1.0-pre (e4f6ce0156) New changes: b19e296 Localisation updates from https://translatewiki.net. 4813d30 WindowSet: Add support for overriding the creation a window 218d29f Localisation updates from https://translatewiki.net. 50fd396 Add more dialog sizes and make them switchable 22f405e Make it possible to toggle the outline in a booklet layout e4f6ce0 Hack for preventing opacity-related rendering glitches Change-Id: If55568c69333d4749b285408d27fa6e9e42a7f37 --- diff --git a/resources/oojs-ui/i18n/ast.json b/resources/oojs-ui/i18n/ast.json index 959ea231b9..fe6ea0a201 100644 --- a/resources/oojs-ui/i18n/ast.json +++ b/resources/oojs-ui/i18n/ast.json @@ -9,5 +9,6 @@ "ooui-dialog-action-close": "Zarrar", "ooui-outline-control-move-down": "Mover abaxo l'elementu", "ooui-outline-control-move-up": "Mover arriba l'elementu", + "ooui-outline-control-remove": "Desaniciar elementu", "ooui-toolbar-more": "Más" } \ No newline at end of file diff --git a/resources/oojs-ui/i18n/hy.json b/resources/oojs-ui/i18n/hy.json index f6cb90b48a..4cb88214ac 100644 --- a/resources/oojs-ui/i18n/hy.json +++ b/resources/oojs-ui/i18n/hy.json @@ -8,5 +8,6 @@ "ooui-dialog-action-close": "Փակել", "ooui-outline-control-move-down": "Իջեցնել կետը", "ooui-outline-control-move-up": "Բարձրացնել կետը", + "ooui-outline-control-remove": "Հեռացնել տարրը", "ooui-toolbar-more": "Ավելին" } \ No newline at end of file diff --git a/resources/oojs-ui/i18n/is.json b/resources/oojs-ui/i18n/is.json index efe0e679fe..fbdb5d1e52 100644 --- a/resources/oojs-ui/i18n/is.json +++ b/resources/oojs-ui/i18n/is.json @@ -6,7 +6,7 @@ ] }, "ooui-dialog-action-close": "Loka", - "ooui-outline-control-move-down": "Færa atriða niður", - "ooui-outline-control-move-up": "Færa atriða upp", + "ooui-outline-control-move-down": "Færa atriði niður", + "ooui-outline-control-move-up": "Færa atriði upp", "ooui-toolbar-more": "Fleira" } \ No newline at end of file diff --git a/resources/oojs-ui/i18n/ko.json b/resources/oojs-ui/i18n/ko.json index f1f61df989..25749ce181 100644 --- a/resources/oojs-ui/i18n/ko.json +++ b/resources/oojs-ui/i18n/ko.json @@ -11,5 +11,6 @@ "ooui-dialog-action-close": "닫기", "ooui-outline-control-move-down": "항목을 아래로 옮기기", "ooui-outline-control-move-up": "항목을 위로 옮기기", + "ooui-outline-control-remove": "항목 지우기", "ooui-toolbar-more": "더 보기" } \ No newline at end of file diff --git a/resources/oojs-ui/i18n/lb.json b/resources/oojs-ui/i18n/lb.json index a18894e418..6359026c43 100644 --- a/resources/oojs-ui/i18n/lb.json +++ b/resources/oojs-ui/i18n/lb.json @@ -13,5 +13,6 @@ "ooui-dialog-action-close": "Zoumaachen", "ooui-outline-control-move-down": "Element erof réckelen", "ooui-outline-control-move-up": "Element erop réckelen", + "ooui-outline-control-remove": "Element ewechhuelen", "ooui-toolbar-more": "Méi" } \ No newline at end of file diff --git a/resources/oojs-ui/i18n/lt.json b/resources/oojs-ui/i18n/lt.json index b3a16e85b5..db679bca92 100644 --- a/resources/oojs-ui/i18n/lt.json +++ b/resources/oojs-ui/i18n/lt.json @@ -2,8 +2,10 @@ "@metadata": { "authors": [ "Audriusa", - "Eitvys200" + "Eitvys200", + "Mantak111" ] }, - "ooui-dialog-action-close": "Uždaryti" + "ooui-dialog-action-close": "Uždaryti", + "ooui-outline-control-remove": "Šalinti elementus" } \ No newline at end of file diff --git a/resources/oojs-ui/i18n/nl.json b/resources/oojs-ui/i18n/nl.json index 75db0a75a5..549fad2046 100644 --- a/resources/oojs-ui/i18n/nl.json +++ b/resources/oojs-ui/i18n/nl.json @@ -15,11 +15,13 @@ "Saruman", "Siebrand", "Southparkfan", - "सरोज कुमार ढकाल" + "सरोज कुमार ढकाल", + "Sjoerddebruin" ] }, "ooui-dialog-action-close": "Sluiten", "ooui-outline-control-move-down": "Item omlaag verplaatsen", "ooui-outline-control-move-up": "Item omhoog verplaatsen", + "ooui-outline-control-remove": "Item verwijderen", "ooui-toolbar-more": "Meer" } \ No newline at end of file diff --git a/resources/oojs-ui/i18n/sq.json b/resources/oojs-ui/i18n/sq.json index 424f1be827..6c31c93afe 100644 --- a/resources/oojs-ui/i18n/sq.json +++ b/resources/oojs-ui/i18n/sq.json @@ -1,11 +1,13 @@ { "@metadata": { "authors": [ - "Euriditi" + "Euriditi", + "Kushtrim" ] }, "ooui-dialog-action-close": "Mbylle", "ooui-outline-control-move-down": "Zhvendose artikullin më poshtë", "ooui-outline-control-move-up": "Zhvendose artikullin më lart", + "ooui-outline-control-remove": "Largoje artikullin", "ooui-toolbar-more": "Më tepër..." } \ No newline at end of file diff --git a/resources/oojs-ui/i18n/sv.json b/resources/oojs-ui/i18n/sv.json index 74d654bbb2..f7d6f04892 100644 --- a/resources/oojs-ui/i18n/sv.json +++ b/resources/oojs-ui/i18n/sv.json @@ -10,11 +10,13 @@ "Per", "Sendelbach", "Skalman", - "WikiPhoenix" + "WikiPhoenix", + "Lokal Profil" ] }, "ooui-dialog-action-close": "Stäng", "ooui-outline-control-move-down": "Flytta ned objekt", "ooui-outline-control-move-up": "Flytta upp objekt", + "ooui-outline-control-remove": "Ta bort objekt", "ooui-toolbar-more": "Mer" } \ No newline at end of file diff --git a/resources/oojs-ui/i18n/uk.json b/resources/oojs-ui/i18n/uk.json index 9a47ad7868..42487c94ef 100644 --- a/resources/oojs-ui/i18n/uk.json +++ b/resources/oojs-ui/i18n/uk.json @@ -20,5 +20,6 @@ "ooui-dialog-action-close": "Закрити", "ooui-outline-control-move-down": "Перемістити елемент униз", "ooui-outline-control-move-up": "Перемістити елемент вгору", + "ooui-outline-control-remove": "Видалити елемент", "ooui-toolbar-more": "Більше" } \ No newline at end of file diff --git a/resources/oojs-ui/oojs-ui-apex.css b/resources/oojs-ui/oojs-ui-apex.css index 468c78aefd..7144ecb9e5 100644 --- a/resources/oojs-ui/oojs-ui-apex.css +++ b/resources/oojs-ui/oojs-ui-apex.css @@ -260,6 +260,14 @@ box-shadow: none; } +.oo-ui-bookletLayout > .oo-ui-gridLayout > .oo-ui-panelLayout { + -webkit-transition: width 250ms ease-in-out, height 250ms ease-in-out, top 250ms ease-in-out, left 250ms ease-in-out; + -moz-transition: width 250ms ease-in-out, height 250ms ease-in-out, top 250ms ease-in-out, left 250ms ease-in-out; + -ms-transition: width 250ms ease-in-out, height 250ms ease-in-out, top 250ms ease-in-out, left 250ms ease-in-out; + -o-transition: width 250ms ease-in-out, height 250ms ease-in-out, top 250ms ease-in-out, left 250ms ease-in-out; + transition: width 250ms ease-in-out, height 250ms ease-in-out, top 250ms ease-in-out, left 250ms ease-in-out; +} + .oo-ui-bookletLayout-outlinePanel { border-right: solid 1px #ddd; } diff --git a/resources/oojs-ui/oojs-ui.js b/resources/oojs-ui/oojs-ui.js index 39406bbc8e..58785f0fab 100644 --- a/resources/oojs-ui/oojs-ui.js +++ b/resources/oojs-ui/oojs-ui.js @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.1.0-pre (8ac38a5c31) + * OOjs UI v0.1.0-pre (e4f6ce0156) * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2014 OOjs Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: Tue Mar 04 2014 11:26:29 GMT-0800 (PST) + * Date: Wed Mar 05 2014 16:08:46 GMT-0800 (PST) */ ( function () { @@ -1454,12 +1454,22 @@ OO.ui.WindowSet.prototype.getWindow = function ( name ) { throw new Error( 'Unknown window: ' + name ); } if ( !( name in this.windows ) ) { - win = this.windows[name] = this.factory.create( name, this, { '$': this.$ } ); + win = this.windows[name] = this.createWindow( name ); this.addWindow( win ); } return this.windows[name]; }; +/** + * Create a window for use in this window set. + * + * @param {string} name Symbolic name of window + * @return {OO.ui.Window} Window with specified name + */ +OO.ui.WindowSet.prototype.createWindow = function ( name ) { + return this.factory.create( name, { '$': this.$ } ); +}; + /** * Add a given window to this window set. * @@ -1493,11 +1503,11 @@ OO.ui.WindowSet.prototype.addWindow = function ( win ) { * @constructor * @param {Object} [config] Configuration options * @cfg {boolean} [footless] Hide foot - * @cfg {boolean} [small] Make the dialog small + * @cfg {string} [size='large'] Symbolic name of dialog size, `small`, `medium` or `large` */ OO.ui.Dialog = function OoUiDialog( config ) { // Configuration initialization - config = config || {}; + config = $.extend( { 'size': 'large' }, config ); // Parent constructor OO.ui.Window.call( this, config ); @@ -1505,7 +1515,7 @@ OO.ui.Dialog = function OoUiDialog( config ) { // Properties this.visible = false; this.footless = !!config.footless; - this.small = !!config.small; + this.size = null; this.onWindowMouseWheelHandler = OO.ui.bind( this.onWindowMouseWheel, this ); this.onDocumentKeyDownHandler = OO.ui.bind( this.onDocumentKeyDown, this ); @@ -1515,6 +1525,7 @@ OO.ui.Dialog = function OoUiDialog( config ) { // Initialization this.$element.addClass( 'oo-ui-dialog' ); + this.setSize( config.size ); }; /* Inheritance */ @@ -1533,6 +1544,18 @@ OO.inheritClass( OO.ui.Dialog, OO.ui.Window ); */ OO.ui.Dialog.static.name = ''; +/** + * Map of symbolic size names and CSS classes. + * + * @static + * @property {Object} + */ +OO.ui.Dialog.static.sizeCssClasses = { + 'small': 'oo-ui-dialog-small', + 'medium': 'oo-ui-dialog-medium', + 'large': 'oo-ui-dialog-large' +}; + /* Methods */ /** @@ -1593,6 +1616,29 @@ OO.ui.Dialog.prototype.onOpening = function () { this.$element.addClass( 'oo-ui-dialog-open' ); }; +/** + * Set dialog size. + * + * @param {string} [size='large'] Symbolic name of dialog size, `small`, `medium` or `large` + */ +OO.ui.Dialog.prototype.setSize = function ( size ) { + var name, state, cssClass, + sizeCssClasses = OO.ui.Dialog.static.sizeCssClasses; + + if ( !sizeCssClasses[size] ) { + size = 'large'; + } + this.size = size; + for ( name in sizeCssClasses ) { + state = name === size; + cssClass = sizeCssClasses[name]; + this.$element.toggleClass( cssClass, state ); + if ( this.frame.$content ) { + this.frame.$content.toggleClass( cssClass, state ); + } + } +}; + /** * @inheritdoc */ @@ -1617,9 +1663,6 @@ OO.ui.Dialog.prototype.initialize = function () { if ( this.footless ) { this.frame.$content.addClass( 'oo-ui-dialog-content-footless' ); } - if ( this.small ) { - this.$frame.addClass( 'oo-ui-window-frame-small' ); - } this.closeButton.$element.addClass( 'oo-ui-window-closeButton' ); this.$head.append( this.closeButton.$element ); }; @@ -3842,6 +3885,7 @@ OO.ui.BookletLayout = function OoUiBookletLayout( config ) { this.ignoreFocus = false; this.stackLayout = new OO.ui.StackLayout( { '$': this.$, 'continuous': !!config.continuous } ); this.autoFocus = !!config.autoFocus; + this.outlineVisible = false; this.outlined = !!config.outlined; if ( this.outlined ) { this.editable = !!config.editable; @@ -3852,6 +3896,7 @@ OO.ui.BookletLayout = function OoUiBookletLayout( config ) { this.gridLayout = new OO.ui.GridLayout( [this.outlinePanel, this.stackLayout], { '$': this.$, 'widths': [1, 2] } ); + this.outlineVisible = true; if ( this.editable ) { this.outlineControlsWidget = new OO.ui.OutlineControlsWidget( this.outlineWidget, @@ -3986,6 +4031,32 @@ OO.ui.BookletLayout.prototype.isEditable = function () { return this.editable; }; +/** + * Check if booklet has editing controls. + * + * @method + * @returns {boolean} Booklet is outlined + */ +OO.ui.BookletLayout.prototype.isOutlineVisible = function () { + return this.outlined && this.outlineVisible; +}; + +/** + * Hide or show the outline. + * + * @param {boolean} [show] Show outline, omit to invert current state + * @chainable + */ +OO.ui.BookletLayout.prototype.toggleOutline = function ( show ) { + if ( this.outlined ) { + show = show === undefined ? !this.outlineVisible : !!show; + this.outlineVisible = show; + this.gridLayout.layout( show ? [ 1, 2 ] : [ 0, 1 ], [ 1 ] ); + } + + return this; +}; + /** * Get the outline widget. * diff --git a/resources/oojs-ui/oojs-ui.svg.css b/resources/oojs-ui/oojs-ui.svg.css index 5609496d2f..8cf4f646c7 100644 --- a/resources/oojs-ui/oojs-ui.svg.css +++ b/resources/oojs-ui/oojs-ui.svg.css @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.1.0-pre (8ac38a5c31) + * OOjs UI v0.1.0-pre (e4f6ce0156) * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2014 OOjs Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: Tue Mar 04 2014 11:26:29 GMT-0800 (PST) + * Date: Wed Mar 05 2014 16:08:46 GMT-0800 (PST) */ /* Textures */ @@ -41,6 +41,16 @@ left: 0; padding: 1em; line-height: 1em; + /* Fix for strange opacity-related rendering issues. + CAUTION: -webkit-backface-visibility: hidden; is EXTREMELY DANGEROUS. + If applied to a VE surface directly, it will break selection of + FocusableNodes, and in the past it's caused transparent PNGs to + render as opaque black images. For some reason applying it to the dialog + wrapper in the main document fixes opacity-related behavior in the iframe + document, but doesn't break the surface inside the iframe. */ + + -webkit-backface-visibility: hidden; + backface-visibility: hidden; } .oo-ui-dialog .oo-ui-window-frame { @@ -49,18 +59,26 @@ right: 0; bottom: 1em; left: 0; - width: 800px; - max-height: 600px; min-height: 12em; margin: auto; overflow: hidden; } -.oo-ui-dialog .oo-ui-window-frame-small { - max-width: 600px; +.oo-ui-dialog-small .oo-ui-window-frame { + width: 400px; + max-height: 200px; +} + +.oo-ui-dialog-medium .oo-ui-window-frame { + width: 600px; max-height: 400px; } +.oo-ui-dialog-large .oo-ui-window-frame { + width: 800px; + max-height: 600px; +} + .oo-ui-dialog .oo-ui-frame { width: 100%; height: 100%;