From aad7dad56482567b7848fd70f5912b9f110bb007 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Mon, 15 Sep 2014 15:18:40 -0700 Subject: [PATCH] Update OOjs UI to v0.1.0-pre (49b64bdba7) New changes: c82b429 Work around position: fixed; bug in Safari 9e1432e Split out isPending, pushPending, popPending, etc. into PendingElement Change-Id: Ifd213123adfc9c96de2f16379c8ed3d706c210f8 --- .../lib/oojs-ui/images/icons/help-rtl.png | Bin 578 -> 0 bytes resources/lib/oojs-ui/oojs-ui-apex.css | 20 +- resources/lib/oojs-ui/oojs-ui-minerva.css | 16 +- resources/lib/oojs-ui/oojs-ui.js | 184 ++++++++++-------- resources/lib/oojs-ui/oojs-ui.svg.css | 4 +- 5 files changed, 128 insertions(+), 96 deletions(-) delete mode 100644 resources/lib/oojs-ui/images/icons/help-rtl.png diff --git a/resources/lib/oojs-ui/images/icons/help-rtl.png b/resources/lib/oojs-ui/images/icons/help-rtl.png deleted file mode 100644 index a5a0a6633d8acd831f2a9a3c685bf6e1a31a4f06..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 578 zcmV-I0=@l-P)7tTf)*>@&0$aeh;QFDUurV-@^k-@VGwT4Gz#MQ6 zjDR!X(jhHi3Frb}fWN@5q$DRM>BRv$KmrVbKG29U0k+|op>sMpOhjk`hfZimxmmAz z8F(M%+RixynpFlnUP(W??*TtOmw3z8BTV0OJB0>bMFQ-FZ2>;H;1Ku$dobRg+5!e-n|D`)T!R^?*%z_#bM&Fll^ap|~1gVK=n8#n=GfYoU@MFtbnUbjlH zNB&!7&~lAQnE|A;UKCk>=PL{{Zlyuj%yO-hbSJ4JX{|`vIo(nN--=_>G3%9xBxaW1 zH)-^oI}SH&T;oQNCWZlcI_I3R>FPzAzo>%5;MeSb|&oB*SDx($B Qv;Y7A07*qoM6N<$f}$h%wg3PC diff --git a/resources/lib/oojs-ui/oojs-ui-apex.css b/resources/lib/oojs-ui/oojs-ui-apex.css index c4fbb47392..53e46d6062 100644 --- a/resources/lib/oojs-ui/oojs-ui-apex.css +++ b/resources/lib/oojs-ui/oojs-ui-apex.css @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.1.0-pre (073f37e258) + * OOjs UI v0.1.0-pre (49b64bdba7) * 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: 2014-09-15T15:00:24Z + * Date: 2014-09-15T22:18:37Z */ /* * Blank theme mixins. @@ -1089,6 +1089,9 @@ left: 0.25em; margin-left: 0; } +.oo-ui-actionWidget.oo-ui-pendingElement-pending { + background-image: /* @embed */ url(images/textures/pending.gif); +} .oo-ui-popupWidget-popup { position: absolute; overflow: hidden; @@ -1182,6 +1185,10 @@ -moz-box-sizing: border-box; box-sizing: border-box; } +.oo-ui-textInputWidget.oo-ui-pendingElement-pending input, +.oo-ui-textInputWidget.oo-ui-pendingElement-pending textarea { + background-image: /* @embed */ url(images/textures/pending.gif); +} .oo-ui-textInputWidget > .oo-ui-iconElement-icon, .oo-ui-textInputWidget > .oo-ui-indicatorElement-indicator { position: absolute; @@ -1234,8 +1241,8 @@ color: #777; text-shadow: 0 1px 1px #fff; } -.oo-ui-textInputWidget-pending input, -.oo-ui-textInputWidget-pending textarea { +.oo-ui-textInputWidget.oo-ui-pendingElement-pending input, +.oo-ui-textInputWidget.oo-ui-pendingElement-pending textarea { background-color: transparent; } .oo-ui-textInputWidget.oo-ui-widget-disabled input, @@ -1575,6 +1582,9 @@ z-index: 1; top: 0; } +.oo-ui-dialog-content > .oo-ui-window-head.oo-ui-pendingElement-pending { + background-image: /* @embed */ url(images/textures/pending.gif); +} .oo-ui-dialog-content > .oo-ui-window-body { z-index: 2; top: 0; @@ -1876,7 +1886,7 @@ padding: 1em; } .oo-ui-windowManager-modal > .oo-ui-dialog.oo-ui-window-setup > .oo-ui-window-frame { - position: fixed; + position: absolute; right: 0; left: 0; margin: auto; diff --git a/resources/lib/oojs-ui/oojs-ui-minerva.css b/resources/lib/oojs-ui/oojs-ui-minerva.css index fa8efee46e..e81714288a 100644 --- a/resources/lib/oojs-ui/oojs-ui-minerva.css +++ b/resources/lib/oojs-ui/oojs-ui-minerva.css @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.1.0-pre (073f37e258) + * OOjs UI v0.1.0-pre (49b64bdba7) * 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: 2014-09-15T15:00:24Z + * Date: 2014-09-15T22:18:37Z */ /* * Blank theme mixins. @@ -711,6 +711,9 @@ left: 0.25em; margin-left: 0; } +.oo-ui-actionWidget.oo-ui-pendingElement-pending { + background-image: /* @embed */ url(images/textures/pending.gif); +} .oo-ui-popupWidget-popup { position: absolute; overflow: hidden; @@ -784,6 +787,10 @@ -moz-box-sizing: border-box; box-sizing: border-box; } +.oo-ui-textInputWidget.oo-ui-pendingElement-pending input, +.oo-ui-textInputWidget.oo-ui-pendingElement-pending textarea { + background-image: /* @embed */ url(images/textures/pending.gif); +} .oo-ui-textInputWidget > .oo-ui-iconElement-icon, .oo-ui-textInputWidget > .oo-ui-indicatorElement-indicator { position: absolute; @@ -1038,6 +1045,9 @@ z-index: 1; top: 0; } +.oo-ui-dialog-content > .oo-ui-window-head.oo-ui-pendingElement-pending { + background-image: /* @embed */ url(images/textures/pending.gif); +} .oo-ui-dialog-content > .oo-ui-window-body { z-index: 2; top: 0; @@ -1317,7 +1327,7 @@ padding: 1em; } .oo-ui-windowManager-modal > .oo-ui-dialog.oo-ui-window-setup > .oo-ui-window-frame { - position: fixed; + position: absolute; right: 0; left: 0; margin: auto; diff --git a/resources/lib/oojs-ui/oojs-ui.js b/resources/lib/oojs-ui/oojs-ui.js index 1583fec5a4..a3e2375e4a 100644 --- a/resources/lib/oojs-ui/oojs-ui.js +++ b/resources/lib/oojs-ui/oojs-ui.js @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.1.0-pre (073f37e258) + * OOjs UI v0.1.0-pre (49b64bdba7) * 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: 2014-09-15T15:00:24Z + * Date: 2014-09-15T22:18:37Z */ ( function ( OO ) { @@ -188,6 +188,88 @@ OO.ui.getLocalValue = function ( obj, lang, fallback ) { } )(); +/** + * Element that can be marked as pending. + * + * @abstract + * @class + * + * @constructor + * @param {Object} [config] Configuration options + */ +OO.ui.PendingElement = function OoUiPendingElement( config ) { + // Config initialisation + config = config || {}; + + // Properties + this.pending = 0; + this.$pending = null; + + // Initialisation + this.setPendingElement( config.$pending || this.$element ); +}; + +/* Setup */ + +OO.initClass( OO.ui.PendingElement ); + +/* Methods */ + +/** + * Set the pending element (and clean up any existing one). + * + * @param {jQuery} $pending The element to set to pending. + */ +OO.ui.PendingElement.prototype.setPendingElement = function ( $pending ) { + if ( this.$pending ) { + this.$pending.removeClass( 'oo-ui-pendingElement-pending' ); + } + + this.$pending = $pending; + if ( this.pending > 0 ) { + this.$pending.addClass( 'oo-ui-pendingElement-pending' ); + } +}; + +/** + * Check if input is pending. + * + * @return {boolean} + */ +OO.ui.PendingElement.prototype.isPending = function () { + return !!this.pending; +}; + +/** + * Increase the pending stack. + * + * @chainable + */ +OO.ui.PendingElement.prototype.pushPending = function () { + if ( this.pending === 0 ) { + this.$pending.addClass( 'oo-ui-pendingElement-pending' ); + } + this.pending++; + + return this; +}; + +/** + * Reduce the pending stack. + * + * Clamped at zero. + * + * @chainable + */ +OO.ui.PendingElement.prototype.popPending = function () { + if ( this.pending === 1 ) { + this.$pending.removeClass( 'oo-ui-pendingElement-pending' ); + } + this.pending = Math.max( 0, this.pending - 1 ); + + return this; +}; + /** * List of actions. * @@ -2056,6 +2138,7 @@ OO.ui.Window.prototype.load = function () { * @abstract * @class * @extends OO.ui.Window + * @mixins OO.ui.PendingElement * * @constructor * @param {Object} [config] Configuration options @@ -2064,11 +2147,13 @@ OO.ui.Dialog = function OoUiDialog( config ) { // Parent constructor OO.ui.Dialog.super.call( this, config ); + // Mixin constructors + OO.ui.PendingElement.call( this ); + // Properties this.actions = new OO.ui.ActionSet(); this.attachedActions = []; this.currentAction = null; - this.pending = 0; // Events this.actions.connect( this, { @@ -2086,6 +2171,7 @@ OO.ui.Dialog = function OoUiDialog( config ) { /* Setup */ OO.inheritClass( OO.ui.Dialog, OO.ui.Window ); +OO.mixinClass( OO.ui.Dialog, OO.ui.PendingElement ); /* Static Properties */ @@ -2173,15 +2259,6 @@ OO.ui.Dialog.prototype.onActionsChange = function () { } }; -/** - * Check if input is pending. - * - * @return {boolean} - */ -OO.ui.Dialog.prototype.isPending = function () { - return !!this.pending; -}; - /** * Get set of actions. * @@ -2272,6 +2349,7 @@ OO.ui.Dialog.prototype.initialize = function () { // Initialization this.$content.addClass( 'oo-ui-dialog-content' ); + this.setPendingElement( this.$head ); }; /** @@ -2309,38 +2387,6 @@ OO.ui.Dialog.prototype.executeAction = function ( action ) { .always( OO.ui.bind( this.popPending, this ) ); }; -/** - * Increase the pending stack. - * - * @chainable - */ -OO.ui.Dialog.prototype.pushPending = function () { - if ( this.pending === 0 ) { - this.$content.addClass( 'oo-ui-actionDialog-content-pending' ); - this.$head.addClass( 'oo-ui-texture-pending' ); - } - this.pending++; - - return this; -}; - -/** - * Reduce the pending stack. - * - * Clamped at zero. - * - * @chainable - */ -OO.ui.Dialog.prototype.popPending = function () { - if ( this.pending === 1 ) { - this.$content.removeClass( 'oo-ui-actionDialog-content-pending' ); - this.$head.removeClass( 'oo-ui-texture-pending' ); - } - this.pending = Math.max( 0, this.pending - 1 ); - - return this; -}; - /** * Collection of windows. * @@ -8152,6 +8198,7 @@ OO.ui.ButtonWidget.prototype.setTarget = function ( target ) { * * @class * @extends OO.ui.ButtonWidget + * @mixins OO.ui.PendingElement * * @constructor * @param {Object} [config] Configuration options @@ -8165,6 +8212,9 @@ OO.ui.ActionWidget = function OoUiActionWidget( config ) { // Parent constructor OO.ui.ActionWidget.super.call( this, config ); + // Mixin constructors + OO.ui.PendingElement.call( this, config ); + // Properties this.action = config.action || ''; this.modes = config.modes || []; @@ -8178,6 +8228,7 @@ OO.ui.ActionWidget = function OoUiActionWidget( config ) { /* Setup */ OO.inheritClass( OO.ui.ActionWidget, OO.ui.ButtonWidget ); +OO.mixinClass( OO.ui.ActionWidget, OO.ui.PendingElement ); /* Events */ @@ -8872,6 +8923,7 @@ OO.ui.CheckboxInputWidget.prototype.onEdit = function () { * @extends OO.ui.InputWidget * @mixins OO.ui.IconElement * @mixins OO.ui.IndicatorElement + * @mixins OO.ui.PendingElement * * @constructor * @param {Object} [config] Configuration options @@ -8890,9 +8942,9 @@ OO.ui.TextInputWidget = function OoUiTextInputWidget( config ) { // Mixin constructors OO.ui.IconElement.call( this, config ); OO.ui.IndicatorElement.call( this, config ); + OO.ui.PendingElement.call( this, config ); // Properties - this.pending = 0; this.multiline = !!config.multiline; this.autosize = !!config.autosize; this.maxRows = config.maxRows !== undefined ? config.maxRows : 10; @@ -8918,6 +8970,7 @@ OO.ui.TextInputWidget = function OoUiTextInputWidget( config ) { OO.inheritClass( OO.ui.TextInputWidget, OO.ui.InputWidget ); OO.mixinClass( OO.ui.TextInputWidget, OO.ui.IconElement ); OO.mixinClass( OO.ui.TextInputWidget, OO.ui.IndicatorElement ); +OO.mixinClass( OO.ui.TextInputWidget, OO.ui.PendingElement ); /* Events */ @@ -9080,47 +9133,6 @@ OO.ui.TextInputWidget.prototype.isAutosizing = function () { return !!this.autosize; }; -/** - * Check if input is pending. - * - * @return {boolean} - */ -OO.ui.TextInputWidget.prototype.isPending = function () { - return !!this.pending; -}; - -/** - * Increase the pending stack. - * - * @chainable - */ -OO.ui.TextInputWidget.prototype.pushPending = function () { - if ( this.pending === 0 ) { - this.$element.addClass( 'oo-ui-textInputWidget-pending' ); - this.$input.addClass( 'oo-ui-texture-pending' ); - } - this.pending++; - - return this; -}; - -/** - * Reduce the pending stack. - * - * Clamped at zero. - * - * @chainable - */ -OO.ui.TextInputWidget.prototype.popPending = function () { - if ( this.pending === 1 ) { - this.$element.removeClass( 'oo-ui-textInputWidget-pending' ); - this.$input.removeClass( 'oo-ui-texture-pending' ); - } - this.pending = Math.max( 0, this.pending - 1 ); - - return this; -}; - /** * Select the contents of the input. * diff --git a/resources/lib/oojs-ui/oojs-ui.svg.css b/resources/lib/oojs-ui/oojs-ui.svg.css index aca127ae45..913d5fdd81 100644 --- a/resources/lib/oojs-ui/oojs-ui.svg.css +++ b/resources/lib/oojs-ui/oojs-ui.svg.css @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.1.0-pre (073f37e258) + * OOjs UI v0.1.0-pre (49b64bdba7) * 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: 2014-09-15T15:00:24Z + * Date: 2014-09-15T22:18:37Z */ /* * Blank theme mixins. -- 2.20.1