From e8af98076f90f6eb595d6f3233bde63206e1faa4 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Wed, 20 Aug 2014 17:23:53 -0700 Subject: [PATCH] Update OOjs UI to v0.1.0-pre (944c47c5fe) New changes: 36ae086 Use a pollNode for every transplanted stylesheet, not just external ones a1771ed Support nested style transplantation 8c60d3c Create a combo box widget 944c47c Update oojs to v1.0.12 Change-Id: I800bb36b80d04e165e9fa9b00ed8a5223f2d954b --- resources/lib/oojs-ui/oojs-ui-agora.css | 4 +- resources/lib/oojs-ui/oojs-ui-apex.css | 44 +++- resources/lib/oojs-ui/oojs-ui.js | 261 ++++++++++++++++++++---- resources/lib/oojs-ui/oojs-ui.svg.css | 28 ++- 4 files changed, 291 insertions(+), 46 deletions(-) diff --git a/resources/lib/oojs-ui/oojs-ui-agora.css b/resources/lib/oojs-ui/oojs-ui-agora.css index a4a44150da..e6a6a86ac0 100644 --- a/resources/lib/oojs-ui/oojs-ui-agora.css +++ b/resources/lib/oojs-ui/oojs-ui-agora.css @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.1.0-pre (51f513f9d3) + * OOjs UI v0.1.0-pre (944c47c5fe) * 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-08-20T00:59:55Z + * Date: 2014-08-21T00:23:52Z */ .oo-ui-dialog-content > .oo-ui-window-head, .oo-ui-dialog-content > .oo-ui-window-body, diff --git a/resources/lib/oojs-ui/oojs-ui-apex.css b/resources/lib/oojs-ui/oojs-ui-apex.css index b0b99238ad..88eac979e4 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 (51f513f9d3) + * OOjs UI v0.1.0-pre (944c47c5fe) * 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-08-20T00:59:55Z + * Date: 2014-08-21T00:23:52Z */ .oo-ui-dialog-content > .oo-ui-window-head, .oo-ui-dialog-content > .oo-ui-window-body, @@ -878,6 +878,21 @@ border-bottom-right-radius: 0.3em; } +.oo-ui-comboBoxWidget-handle { + border: solid 1px rgba(0, 0, 0, 0.1); + border-radius: 0.25em; +} + +.oo-ui-comboBoxWidget-handle:hover { + border-color: rgba(0, 0, 0, 0.2); +} + +.oo-ui-comboBoxWidget.oo-ui-widget-disabled .oo-ui-textInputWidget.oo-ui-indicatedElement .oo-ui-indicatedElement-indicator, +.oo-ui-comboBoxWidget-empty .oo-ui-textInputWidget.oo-ui-indicatedElement .oo-ui-indicatedElement-indicator { + cursor: default; + opacity: 0.2; +} + .oo-ui-inlineMenuWidget-handle { border: solid 1px rgba(0, 0, 0, 0.1); border-radius: 0.25em; @@ -1043,6 +1058,31 @@ border-color: #ddd; } +.oo-ui-textInputWidget .oo-ui-iconedElement-icon, +.oo-ui-textInputWidget .oo-ui-indicatedElement-indicator { + opacity: 0.8; +} + +.oo-ui-textInputWidget.oo-ui-iconedElement input, +.oo-ui-textInputWidget.oo-ui-iconedElement textarea { + padding-left: 2em; +} + +.oo-ui-textInputWidget.oo-ui-iconedElement .oo-ui-iconedElement-icon { + width: 2em; + background-position: right center; +} + +.oo-ui-textInputWidget.oo-ui-indicatedElement input, +.oo-ui-textInputWidget.oo-ui-indicatedElement textarea { + padding-right: 1.5em; +} + +.oo-ui-textInputWidget.oo-ui-indicatedElement .oo-ui-indicatedElement-indicator { + width: 1.5em; + background-position: left center; +} + .oo-ui-toggleSwitchWidget { background: #eeeeee; background-image: -webkit-gradient(linear, right top, right bottom, color-stop(0%, #dddddd), color-stop(100%, #ffffff)); diff --git a/resources/lib/oojs-ui/oojs-ui.js b/resources/lib/oojs-ui/oojs-ui.js index a60c879f62..2483c9edc0 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 (51f513f9d3) + * OOjs UI v0.1.0-pre (944c47c5fe) * 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-08-20T00:59:55Z + * Date: 2014-08-21T00:23:52Z */ ( function ( OO ) { @@ -1165,10 +1165,11 @@ OO.ui.Frame.static.tagName = 'iframe'; * @return {jQuery.Promise} Promise resolved when styles have loaded */ OO.ui.Frame.static.transplantStyles = function ( parentDoc, frameDoc, timeout ) { - var i, numSheets, styleNode, newNode, timeoutID, pollNodeId, $pendingPollNodes, + var i, numSheets, styleNode, styleText, newNode, timeoutID, pollNodeId, $pendingPollNodes, $pollNodes = $( [] ), // Fake font-family value fontFamily = 'oo-ui-frame-transplantStyles-loaded', + nextIndex = parentDoc.oouiFrameTransplantStylesNextIndex || 0, deferred = $.Deferred(); for ( i = 0, numSheets = parentDoc.styleSheets.length; i < numSheets; i++ ) { @@ -1176,29 +1177,44 @@ OO.ui.Frame.static.transplantStyles = function ( parentDoc, frameDoc, timeout ) if ( styleNode.disabled ) { continue; } + if ( styleNode.nodeName.toLowerCase() === 'link' ) { - // External stylesheet - // Create a node with a unique ID that we're going to monitor to see when the CSS - // has loaded - pollNodeId = 'oo-ui-frame-transplantStyles-loaded-' + i; - $pollNodes = $pollNodes.add( $( '
', frameDoc ) - .attr( 'id', pollNodeId ) - .appendTo( frameDoc.body ) - ); + // External stylesheet; use @import + styleText = '@import url(' + styleNode.href + ');'; + } else { + // Internal stylesheet; just copy the text + styleText = styleNode.textContent; + } - // Add - // The font-family rule will only take effect once the @import finishes - newNode = frameDoc.createElement( 'style' ); - newNode.textContent = '@import url(' + styleNode.href + ');\n' + - '#' + pollNodeId + ' { font-family: ' + fontFamily + '; }'; + // Create a node with a unique ID that we're going to monitor to see when the CSS + // has loaded + if ( styleNode.oouiFrameTransplantStylesId ) { + // If we're nesting transplantStyles operations and this node already has + // a CSS rule to wait for loading, reuse it + pollNodeId = styleNode.oouiFrameTransplantStylesId; } else { - // Not an external stylesheet, or no polling required; just copy the node over - // Can't use importNode here because that breaks in IE - newNode = frameDoc.createElement( 'style' ); - newNode.textContent = styleNode.textContent; + // Otherwise, create a new ID + pollNodeId = 'oo-ui-frame-transplantStyles-loaded-' + nextIndex; + nextIndex++; + + // Add #pollNodeId { font-family: ... } to the end of the stylesheet / after the @import + // The font-family rule will only take effect once the @import finishes + styleText += '\n' + '#' + pollNodeId + ' { font-family: ' + fontFamily + '; }'; } + + // Create a node with id=pollNodeId + $pollNodes = $pollNodes.add( $( '
', frameDoc ) + .attr( 'id', pollNodeId ) + .appendTo( frameDoc.body ) + ); + + // Add our modified CSS as a