http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/58047a3d/node_modules/winjs/js/ui.js ---------------------------------------------------------------------- diff --git a/node_modules/winjs/js/ui.js b/node_modules/winjs/js/ui.js index 367d5fa..3c7295c 100644 --- a/node_modules/winjs/js/ui.js +++ b/node_modules/winjs/js/ui.js @@ -12,15 +12,15 @@ // amd define(["./base"], factory); } else { - globalObject.msWriteProfilerMark && msWriteProfilerMark('WinJS.4.0 4.0.1.winjs.2015.6.10 ui.js,StartTM'); - if (typeof module !== 'undefined') { + globalObject.msWriteProfilerMark && msWriteProfilerMark('WinJS.4.4 4.4.0.winjs.2015.10.2 ui.js,StartTM'); + if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { // CommonJS factory(require("./base")); } else { // No module system factory(globalObject.WinJS); } - globalObject.msWriteProfilerMark && msWriteProfilerMark('WinJS.4.0 4.0.1.winjs.2015.6.10 ui.js,StopTM'); + globalObject.msWriteProfilerMark && msWriteProfilerMark('WinJS.4.4 4.4.0.winjs.2015.10.2 ui.js,StopTM'); } }(function (WinJS) { @@ -7478,7 +7478,95 @@ define('WinJS/VirtualizedDataSource',[ //wrapper module }); -define('WinJS/_Accents',["require", "exports", "./Core/_Global", "./Core/_WinRT", "./Core/_Base", "./Core/_BaseUtils"], function (require, exports, _Global, _WinRT, _Base, _BaseUtils) { +define('WinJS/Vui',["require", "exports", "./Core/_Global", "./Utilities/_ElementUtilities"], function (require, exports, _Global, _ElementUtilities) { + var Properties = { + vuiData: "_winVuiData" + }; + var ClassNames = { + active: "win-vui-active", + disambiguation: "win-vui-disambiguation", + }; + var EventNames = { + ListeningModeStateChanged: "ListeningStateChanged" + }; + var ListeningModeStates = { + active: "active", + disambiguation: "disambiguation", + inactive: "inactive", + }; + function _handleListeningModeStateChanged(e) { + if (e.defaultPrevented) { + return; + } + var target = e.target; + var transitionHandler = Handlers[target.tagName]; + if (!transitionHandler) { + return; + } + switch (e.state) { + case ListeningModeStates.active: + if (target[Properties.vuiData] || _ElementUtilities.hasClass(target, ClassNames.active)) { + _ElementUtilities.removeClass(target, ClassNames.disambiguation); + transitionHandler.reactivate(target, e.label); + } + else { + _ElementUtilities.addClass(target, ClassNames.active); + transitionHandler.activate(target, e.label); + } + break; + case ListeningModeStates.disambiguation: + _ElementUtilities.addClass(target, ClassNames.active); + _ElementUtilities.addClass(target, ClassNames.disambiguation); + transitionHandler.disambiguate(target, e.label); + break; + case ListeningModeStates.inactive: + _ElementUtilities.removeClass(target, ClassNames.active); + _ElementUtilities.removeClass(target, ClassNames.disambiguation); + transitionHandler.deactivate(target); + break; + } + } + var Handlers; + (function (Handlers) { + Handlers.BUTTON = { + activate: function (element, label) { + var vuiData = { + nodes: [], + width: element.style.width, + height: element.style.height + }; + // Freeze button size + var cs = _ElementUtilities._getComputedStyle(element); + element.style.width = cs.width; + element.style.height = cs.height; + while (element.childNodes.length) { + vuiData.nodes.push(element.removeChild(element.childNodes[0])); + } + element[Properties.vuiData] = vuiData; + element.textContent = label; + }, + disambiguate: function (element, label) { + element.textContent = label; + }, + reactivate: function (element, label) { + element.textContent = label; + }, + deactivate: function (element) { + element.innerHTML = ""; + var vuiData = element[Properties.vuiData]; + element.style.width = vuiData.width; + element.style.height = vuiData.height; + vuiData.nodes.forEach(function (node) { return element.appendChild(node); }); + delete element[Properties.vuiData]; + } + }; + })(Handlers || (Handlers = {})); + if (_Global.document) { + _Global.document.addEventListener(EventNames.ListeningModeStateChanged, _handleListeningModeStateChanged); + } +}); + +define('WinJS/_Accents',["require", "exports", "./Core/_Global", "./Core/_WinRT", "./Core/_Base", "./Core/_BaseUtils", './Utilities/_ElementUtilities'], function (require, exports, _Global, _WinRT, _Base, _BaseUtils, _ElementUtilities) { var Constants = { accentStyleId: "WinJSAccentsStyle", themeDetectionTag: "winjs-themedetection-tag", @@ -7591,8 +7679,8 @@ define('WinJS/_Accents',["require", "exports", "./Core/_Global", "./Core/_WinRT" // Figure out color theme var tag = _Global.document.createElement(Constants.themeDetectionTag); _Global.document.head.appendChild(tag); - var theme = _Global.getComputedStyle(tag).opacity; - isDarkTheme = theme === "0"; + var cs = _ElementUtilities._getComputedStyle(tag); + isDarkTheme = cs.opacity === "0"; tag.parentElement.removeChild(tag); try { UISettings = new _WinRT.Windows.UI.ViewManagement.UISettings(); @@ -7710,6 +7798,235 @@ define('WinJS/Controls/IntrinsicControls',[ [{ name: "background", value: _Accents.ColorTypes.accent }]); }); // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License.txt in the project root for license information. +/// <reference path="../../Core.d.ts" /> +define('WinJS/Controls/ElementResizeInstrument/_ElementResizeInstrument',["require", "exports", "../../Core/_BaseUtils", '../../Core/_Base', '../../Core/_Global', '../../Core/_Log', "../../Core/_ErrorFromName", "../../Core/_Events", '../../Promise', '../../Utilities/_ElementUtilities'], function (require, exports, _BaseUtils, _Base, _Global, _Log, _ErrorFromName, _Events, Promise, _ElementUtilities) { + "use strict"; + // We will style the _ElementResizeInstrument element to have the same height and width as it's nearest positioned ancestor. + var styleText = 'display: block;' + 'position:absolute;' + 'top: 0;' + 'left: 0;' + 'height: 100%;' + 'width: 100%;' + 'overflow: hidden;' + 'pointer-events: none;' + 'z-index: -1;'; + var className = "win-resizeinstrument"; + var objData = "about:blank"; + var eventNames = { + /** + * Fires when the _ElementResizeInstrument has detected a size change in the monitored ancestor element. + **/ + resize: "resize", + /** + * Fires when the internal <object> element has finished loading and we have added our own "resize" listener to its contentWindow. + * Used by unit tests. + **/ + _ready: "_ready", + }; + // Name of the <object> contentWindow event we listen to. + var contentWindowResizeEvent = "resize"; + // Determine if the browser environment is IE or Edge. + // "msHightContrastAdjust" is availble in IE10+ + var isMS = ("msHighContrastAdjust" in document.documentElement.style); + /** + * Creates a hidden <object> instrumentation element that is used to automatically generate and handle "resize" events whenever the nearest + * positioned ancestor element has its size changed. Add the instrumented element to the DOM of the element you want to generate-and-handle + * "resize" events for. The computed style.position of the ancestor element must be positioned and therefore may not be "static". + **/ + var _ElementResizeInstrument = (function () { + function _ElementResizeInstrument() { + var _this = this; + this._disposed = false; + this._elementLoaded = false; + this._running = false; + this._objectWindowResizeHandlerBound = this._objectWindowResizeHandler.bind(this); + var objEl = _Global.document.createElement("OBJECT"); + objEl.setAttribute('style', styleText); + if (isMS) { + // <object> element shows an outline visual that can't be styled away in MS browsers. + // Using visibility hidden everywhere will stop some browsers from sending resize events, + // but we can use is in MS browsers to achieve the visual we want without losing resize events. + objEl.style.visibility = "hidden"; + } + else { + // Some browsers like iOS and Safari will never load the <object> element's content window + // if the <object> element is in the DOM before its data property was set. + // IE and Edge on the other hand are the exact opposite and won't ever load unless you append the + // element to the DOM before the data property was set. We expect a later call to addedToDom() will + // set the data property after the element is in the DOM for IE and Edge. + objEl.data = objData; + } + objEl.type = 'text/html'; + objEl['winControl'] = this; + _ElementUtilities.addClass(objEl, className); + _ElementUtilities.addClass(objEl, "win-disposable"); + this._element = objEl; + this._elementLoadPromise = new Promise(function (c) { + objEl.onload = function () { + if (!_this._disposed) { + _this._elementLoaded = true; + _this._objWindow.addEventListener(contentWindowResizeEvent, _this._objectWindowResizeHandlerBound); + c(); + } + }; + }); + } + Object.defineProperty(_ElementResizeInstrument.prototype, "element", { + get: function () { + return this._element; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(_ElementResizeInstrument.prototype, "_objWindow", { + // Getter for the <object>'s contentWindow. + get: function () { + // Property may be undefined if the element hasn't loaded yet. + // Property may be undefined in Safari if the element has been removed from the DOM. + // https://bugs.webkit.org/show_bug.cgi?id=149251 + // Return the contentWindow if it exists, else null. + // If the <object> element hasn't loaded yet, some browsers will throw an exception if you try to read the contentDocument property. + return this._elementLoaded && this._element.contentDocument && this._element.contentDocument.defaultView || null; + }, + enumerable: true, + configurable: true + }); + _ElementResizeInstrument.prototype.addedToDom = function () { + var _this = this; + // _ElementResizeInstrument should block on firing any events until the Object element has loaded and the _ElementResizeInstrument addedToDom() API has been called. + // The former is required in order to allow us to get a handle to hook the resize event of the <object> element's content window. + // The latter is for cross browser consistency. Some browsers will load the <object> element sync or async as soon as its added to the DOM. + // Other browsers will not load the element until it is added to the DOM and the data property has been set on the <object>. If the element + // hasn't already loaded when addedToDom is called, we can set the data property to kickstart the loading process. The function is only expected to be called once. + if (!this._disposed) { + var objEl = this.element; + if (!_Global.document.body.contains(objEl)) { + throw new _ErrorFromName("WinJS.UI._ElementResizeInstrument", "ElementResizeInstrument initialization failed"); + } + else { + if (_Log.log && _ElementUtilities._getComputedStyle(objEl.parentElement).position === "static") { + // Notify if the parentElement is not positioned. It is expected that the _ElementResizeInstrument will + // be an immediate child of the element it wants to monitor for size changes. + _Log.log("_ElementResizeInstrument can only detect size changes that are made to it's nearest positioned ancestor. " + "Its parent element is not currently positioned."); + } + if (!this._elementLoaded && isMS) { + // If we're in the DOM and the element hasn't loaded yet, some browsers require setting the data property first, + // in order to trigger the <object> load event. We MUST only do this after the element has been added to the DOM, + // otherwise IE10, IE11 & Edge will NEVER fire the load event no matter what else is done to the <object> element + // or its properties. + objEl.data = "about:blank"; + } + this._elementLoadPromise.then(function () { + // Once the element has loaded and addedToDom has been called, we can fire our private "_ready" event. + _this._running = true; + _this.dispatchEvent(eventNames._ready, null); + // The _ElementResizeInstrument uses an <object> element and its contentWindow to detect resize events in whichever element the + // _ElementResizeInstrument is appended to. Some browsers will fire an async "resize" event for the <object> element automatically when + // it gets added to the DOM, others won't. In both cases it is up to the _ElementResizeHandler to make sure that exactly one async "resize" + // is always fired in all browsers. + // If we don't see a resize event from the <object> contentWindow within 50ms, assume this environment won't fire one and dispatch our own. + var initialResizeTimeout = Promise.timeout(50); + var handleInitialResize = function () { + _this.removeEventListener(eventNames.resize, handleInitialResize); + initialResizeTimeout.cancel(); + }; + _this.addEventListener(eventNames.resize, handleInitialResize); + initialResizeTimeout.then(function () { + _this._objectWindowResizeHandler(); + }); + }); + } + } + }; + _ElementResizeInstrument.prototype.dispose = function () { + if (!this._disposed) { + this._disposed = true; + // Cancel loading state + this._elementLoadPromise.cancel(); + // Unhook loaded state + if (this._objWindow) { + // If we had already loaded and can still get a reference to the contentWindow, + // unhook our listener from the <object>'s contentWindow to reduce any future noise. + this._objWindow.removeEventListener.call(this._objWindow, contentWindowResizeEvent, this._objectWindowResizeHandlerBound); + } + // Turn off running state + this._running = false; + } + }; + /** + * Adds an event listener to the control. + * @param type The type (name) of the event. + * @param listener The listener to invoke when the event gets raised. + * @param useCapture If true, initiates capture, otherwise false. + **/ + _ElementResizeInstrument.prototype.addEventListener = function (type, listener, useCapture) { + // Implementation will be provided by _Events.eventMixin + }; + /** + * Raises an event of the specified type and with the specified additional properties. + * @param type The type (name) of the event. + * @param eventProperties The set of additional properties to be attached to the event object when the event is raised. + * @returns true if preventDefault was called on the event. + **/ + _ElementResizeInstrument.prototype.dispatchEvent = function (type, eventProperties) { + // Implementation will be provided by _Events.eventMixin + return false; + }; + /** + * Removes an event listener from the control. + * @param type The type (name) of the event. + * @param listener The listener to remove. + * @param useCapture true if capture is to be initiated, otherwise false. + **/ + _ElementResizeInstrument.prototype.removeEventListener = function (type, listener, useCapture) { + // Implementation will be provided by _Events.eventMixin + }; + _ElementResizeInstrument.prototype._objectWindowResizeHandler = function () { + var _this = this; + if (this._running) { + this._batchResizeEvents(function () { + _this._fireResizeEvent(); + }); + } + }; + _ElementResizeInstrument.prototype._batchResizeEvents = function (handleResizeFn) { + // Use requestAnimationFrame to batch consecutive resize events. + if (this._pendingResizeAnimationFrameId) { + _BaseUtils._cancelAnimationFrame(this._pendingResizeAnimationFrameId); + } + this._pendingResizeAnimationFrameId = _BaseUtils._requestAnimationFrame(function () { + handleResizeFn(); + }); + }; + _ElementResizeInstrument.prototype._fireResizeEvent = function () { + if (!this._disposed) { + this.dispatchEvent(eventNames.resize, null); + } + }; + _ElementResizeInstrument.EventNames = eventNames; + return _ElementResizeInstrument; + })(); + exports._ElementResizeInstrument = _ElementResizeInstrument; + // addEventListener, removeEventListener, dispatchEvent + _Base.Class.mix(_ElementResizeInstrument, _Events.eventMixin); +}); + +// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License.txt in the project root for license information. +/// <reference path="../../../../typings/require.d.ts" /> +define('WinJS/Controls/ElementResizeInstrument',["require", "exports"], function (require, exports) { + var module = null; + function getModule() { + if (!module) { + require(["./ElementResizeInstrument/_ElementResizeInstrument"], function (m) { + module = m; + }); + } + return module._ElementResizeInstrument; + } + var publicMembers = Object.create({}, { + _ElementResizeInstrument: { + get: function () { + return getModule(); + } + } + }); + return publicMembers; +}); + +// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License.txt in the project root for license information. define('WinJS/Controls/ItemContainer/_Constants',[ 'exports', '../../Core/_Base' @@ -7797,7 +8114,7 @@ define('WinJS/Controls/ItemContainer/_Constants',[ var ScrollToPriority = { uninitialized: 0, - low: 1, // used by layoutSite.invalidateLayout, forceLayout, _processReload, _update and _onMSElementResize - operations that preserve the scroll position + low: 1, // used by layoutSite.invalidateLayout, forceLayout, _processReload, _update and _onElementResize - operations that preserve the scroll position medium: 2, // used by dataSource change, layout change and etc - operations that reset the scroll position to 0 high: 3 // used by indexOfFirstVisible, ensureVisible, scrollPosition - operations in which the developer explicitly sets the scroll position }; @@ -7834,50 +8151,8 @@ define('WinJS/Controls/ItemContainer/_ItemEventsHandler',[ var transformNames = _BaseUtils._browserStyleEquivalents["transform"]; - // Returns a CSS transformation to rotate and shrink an element when it is - // pressed. The closer the click is to the center of the item, the more it - // shrinks and the less it rotates. - // *elementRect* should be of the form returned by getBoundingClientRect. All - // of the parameters must be relative to the same coordinate system. - // This function was translated from the Splash implementation. - function tiltTransform(clickX, clickY, elementRect) { - var minSize = 44, - maxSize = 750, - minRotationX = 2, - maxRotationX = 9, - minRotationY = 2.11, - maxRotationY = 13, - sizeRange = maxSize - minSize, - halfWidth = elementRect.width / 2, - halfHeight = elementRect.height / 2; - - var clampedWidth = _ElementUtilities._clamp(elementRect.width, minSize, maxSize); - var clampedHeight = _ElementUtilities._clamp(elementRect.height, minSize, maxSize); - - // The maximum rotation that any element is capable of is calculated by using its width and height and clamping it into the range calculated above. - // minRotationX|Y and maxRotationX|Y are the absolute minimums and maximums that any generic element can be rotated by, but in order to determine - // what the min/max rotations for our current element is (which will be inside of the absolute min/max described above), we need - // to calculate the max rotations for this element by clamping the sizes and doing a linear interpolation: - var maxElementRotationX = maxRotationX - (((clampedHeight - minSize) / sizeRange) * (maxRotationX - minRotationX)); - var maxElementRotationY = maxRotationY - (((clampedWidth - minSize) / sizeRange) * (maxRotationY - minRotationY)); - - // Now we calculate the distance of our current point from the center of our element and normalize it to be in the range of 0 - 1 - var normalizedOffsetX = ((clickX - elementRect.left) - halfWidth) / halfWidth; - var normalizedOffsetY = ((clickY - elementRect.top) - halfHeight) / halfHeight; - - // Finally, we calculate the appropriate rotations and scale for the element by using the normalized click offsets and the - // maximum element rotation. - var rotationX = maxElementRotationX * normalizedOffsetY; - var rotationY = maxElementRotationY * normalizedOffsetX; - var scale = 0.97 + 0.03 * (Math.abs(normalizedOffsetX) + Math.abs(normalizedOffsetY)) / 2.0; - var transform = "perspective(800px) scale(" + scale + ") rotateX(" + -rotationX + "deg) rotateY(" + rotationY + "deg)"; - return transform; - } - _Base.Namespace._moduleDefine(exports, "WinJS.UI", { // Expose these to the unit tests - _tiltTransform: tiltTransform, - _ItemEventsHandler: _Base.Namespace._lazy(function () { var PT_TOUCH = _ElementUtilities._MSPointerEvent.MSPOINTER_TYPE_TOUCH || "touch"; @@ -7956,7 +8231,7 @@ define('WinJS/Controls/ItemContainer/_ItemEventsHandler',[ this._site.pressedContainer = site.containerAtIndex(this._site.pressedEntity.index); this._site.animatedElement = this._site.pressedContainer; this._site.pressedHeader = null; - this._togglePressed(true, false, eventObject); + this._togglePressed(true, eventObject); this._site.pressedContainer.addEventListener('dragstart', this._DragStartBound); if (!touchInput) { // This only works for non touch input because on touch input we set capture which immediately fires the MSPointerOut. @@ -7968,7 +8243,7 @@ define('WinJS/Controls/ItemContainer/_ItemEventsHandler',[ // Interactions with the headers on phone show an animation if (_BaseUtils.isPhone) { this._site.animatedElement = this._site.pressedHeader; - this._togglePressed(true, false, eventObject); + this._togglePressed(true, eventObject); } else { this._site.pressedItemBox = null; this._site.pressedContainer = null; @@ -8016,13 +8291,13 @@ define('WinJS/Controls/ItemContainer/_ItemEventsHandler',[ onPointerEnter: function ItemEventsHandler_onPointerEnter(eventObject) { if (this._site.pressedContainer && this._pointerId === eventObject.pointerId) { - this._togglePressed(true, false, eventObject); + this._togglePressed(true, eventObject); } }, onPointerLeave: function ItemEventsHandler_onPointerLeave(eventObject) { if (this._site.pressedContainer && this._pointerId === eventObject.pointerId) { - this._togglePressed(false, true /* synchronous */, eventObject); + this._togglePressed(false, eventObject); } }, @@ -8270,82 +8545,20 @@ define('WinJS/Controls/ItemContainer/_ItemEventsHandler',[ return (this._selectionAllowed() && containerElement && !this._isInteractive(element)); }, - _togglePressed: function ItemEventsHandler_togglePressed(add, synchronous, eventObject) { - var that = this; + _togglePressed: function ItemEventsHandler_togglePressed(add, eventObject) { var isHeader = this._site.pressedEntity.type === _UI.ObjectType.groupHeader; - this._site.animatedDownPromise && this._site.animatedDownPromise.cancel(); - if (!isHeader && _ElementUtilities.hasClass(this._site.pressedItemBox, _Constants._nonSelectableClass)) { return; } if (!this._staticMode(isHeader)) { if (add) { - if (!_ElementUtilities.hasClass(this._site.animatedElement, _Constants._pressedClass)) { - _WriteProfilerMark("WinJS.UI._ItemEventsHandler:applyPressedUI,info"); - _ElementUtilities.addClass(this._site.animatedElement, _Constants._pressedClass); - - var boundingElement = isHeader ? that._site.pressedHeader : that._site.pressedContainer; - var transform = tiltTransform(eventObject.clientX, eventObject.clientY, boundingElement.getBoundingClientRect()); - // Timeout prevents item from looking like it was pressed down during pans - this._site.animatedDownPromise = Promise.timeout(50).then(function () { - applyDownVisual(transform); - }); - } - } else { - if (_ElementUtilities.hasClass(this._site.animatedElement, _Constants._pressedClass)) { - var element = this._site.animatedElement; - var expectingStyle = this._site.animatedElementScaleTransform; - if (synchronous) { - applyUpVisual(element, expectingStyle); - } else { - // Force removal of the _pressedClass to be asynchronous so that users will see at - // least one frame of the shrunken item when doing a quick tap. - // - // setImmediate is used rather than requestAnimationFrame to ensure that the item - // doesn't get stuck down for too long -- apps are told to put long running invoke - // code behind a setImmediate and togglePressed's async code needs to run first. - _BaseUtils._setImmediate(function () { - if (_ElementUtilities.hasClass(element, _Constants._pressedClass)) { - applyUpVisual(element, expectingStyle); - } - }); - } - } - } - } - - function applyDownVisual(transform) { - if (that._site.isInSelectionMode()) { - return; - } - - if (that._site.animatedElement.style[transformNames.scriptName] === "") { - that._site.animatedElement.style[transformNames.scriptName] = transform; - that._site.animatedElementScaleTransform = that._site.animatedElement.style[transformNames.scriptName]; + _ElementUtilities.addClass(this._site.animatedElement, _Constants._pressedClass); } else { - that._site.animatedElementScaleTransform = ""; + _ElementUtilities.removeClass(this._site.animatedElement, _Constants._pressedClass); } } - - function applyUpVisual(element, expectingStyle) { - _WriteProfilerMark("WinJS.UI._ItemEventsHandler:removePressedUI,info"); - _ElementUtilities.removeClass(element, _Constants._pressedClass); - if (that._containsTransform(element, expectingStyle)) { - _TransitionAnimation.executeTransition(element, { - property: transformNames.cssName, - delay: 150, - duration: 350, - timing: "cubic-bezier(0.17,0.17,0.2,1)", - to: element.style[transformNames.scriptName].replace(expectingStyle, "") - }); - } - } - }, - - _containsTransform: function ItemEventsHandler_containsTransform(element, transform) { - return transform && element.style[transformNames.scriptName].indexOf(transform) !== -1; }, _resetPointerDownStateForPointerId: function ItemEventsHandler_resetPointerDownState(eventObject) { @@ -9346,7 +9559,7 @@ define('WinJS/Controls/ListView/_BrowseMode',[ '../ItemContainer/_Constants', '../ItemContainer/_ItemEventsHandler', './_SelectionManager' - ], function browseModeInit(exports, _Global, _Base, _BaseUtils, Animations, Promise, _ElementUtilities, _UI, _Constants, _ItemEventsHandler, _SelectionManager) { +], function browseModeInit(exports, _Global, _Base, _BaseUtils, Animations, Promise, _ElementUtilities, _UI, _Constants, _ItemEventsHandler, _SelectionManager) { "use strict"; var transformName = _BaseUtils._browserStyleEquivalents["transform"].scriptName; @@ -9380,7 +9593,7 @@ define('WinJS/Controls/ListView/_BrowseMode',[ this._pressedPosition = null; this.initialize(modeSite); - },{ + }, { _dispose: function () { if (this._itemEventsHandler) { this._itemEventsHandler.dispose(); @@ -9443,9 +9656,6 @@ define('WinJS/Controls/ListView/_BrowseMode',[ }, selectRange: function (firstIndex, lastIndex, additive) { return that._selectRange(firstIndex, lastIndex, additive); - }, - isInSelectionMode: function () { - return site._isInSelectionMode(); } }, { pressedEntity: { @@ -10060,7 +10270,7 @@ define('WinJS/Controls/ListView/_BrowseMode',[ } catch (err) { } - var computedStyle = _Global.getComputedStyle(element, null), + var computedStyle = _ElementUtilities._getComputedStyle(element, null), paddingLeft = parseInt(computedStyle["paddingLeft"]), paddingTop = parseInt(computedStyle["paddingTop"]), borderLeft = parseInt(computedStyle["borderLeftWidth"]), @@ -11805,7 +12015,7 @@ define('WinJS/Controls/ListView/_Layouts',[ } function getDimension(element, property) { - return _ElementUtilities.convertToPixels(element, _Global.getComputedStyle(element, null)[property]); + return _ElementUtilities.convertToPixels(element, _ElementUtilities._getComputedStyle(element, null)[property]); } // Returns the sum of the margin, border, and padding for the side of the @@ -19624,6 +19834,7 @@ define('WinJS/Controls/ListView',[ '../Utilities/_TabContainer', '../Utilities/_UI', '../Utilities/_VersionManager', + './ElementResizeInstrument', './ItemContainer/_Constants', './ItemContainer/_ItemEventsHandler', './ListView/_BrowseMode', @@ -19637,7 +19848,7 @@ define('WinJS/Controls/ListView',[ './ListView/_VirtualizeContentsView', 'require-style!less/styles-listview', 'require-style!less/colors-listview' -], function listViewImplInit(_Global, _Base, _BaseUtils, _ErrorFromName, _Events, _Log, _Resources, _WriteProfilerMark, _Accents, Animations, _TransitionAnimation, BindingList, Promise, Scheduler, _Signal, _Control, _Dispose, _ElementUtilities, _Hoverable, _ItemsManager, _SafeHtml, _TabContainer, _UI, _VersionManager, _Constants, _ItemEventsHandler, _BrowseMode, _ErrorMessages, _GroupFocusCache, _GroupsContainer, _Helpers, _ItemsContainer, _Layouts, _SelectionManager, _VirtualizeContentsView) { +], function listViewImplInit(_Global, _Base, _BaseUtils, _ErrorFromName, _Events, _Log, _Resources, _WriteProfilerMark, _Accents, Animations, _TransitionAnimation, BindingList, Promise, Scheduler, _Signal, _Control, _Dispose, _ElementUtilities, _Hoverable, _ItemsManager, _SafeHtml, _TabContainer, _UI, _VersionManager, _ElementResizeInstrument, _Constants, _ItemEventsHandler, _BrowseMode, _ErrorMessages, _GroupFocusCache, _GroupsContainer, _Helpers, _ItemsContainer, _Layouts, _SelectionManager, _VirtualizeContentsView) { "use strict"; _Accents.createAccentRule( @@ -19739,8 +19950,8 @@ define('WinJS/Controls/ListView',[ /// <event name="itemdragleave" bubbles="true" locid="WinJS.UI.ListView_e:itemdragleave">Raised when the user drags outside of the ListView region.</event> /// <event name="itemdragchanged" bubbles="true" locid="WinJS.UI.ListView_e:itemdragchanged">Raised when the items being dragged are changed due to a datasource modification.</event> /// <event name="itemdragdrop" bubbles="true" locid="WinJS.UI.ListView_e:itemdragdrop">Raised when the user drops items into the ListView.</event> - /// <event name="headervisibilitychanged" bubbles="true" locid="WinJS.UI.ListView_e:headervisibilitychanged">Raised when the layout header becomes visible or invisible</event> - /// <event name="footervisibilitychanged" bubbles="true" locid="WinJS.UI.ListView_e:footervisibilitychanged">Raised when the layout footer becomes visible or invisible</event> + /// <event name="headervisibilitychanged" bubbles="true" locid="WinJS.UI.ListView_e:headervisibilitychanged">Raised when the header's visibility property changes. </event> + /// <event name="footervisibilitychanged" bubbles="true" locid="WinJS.UI.ListView_e:footervisibilitychanged">Raised when the footer's visibility property changes. </event> /// <event name="accessibilityannotationcomplete" bubbles="true" locid="WinJS.UI.ListView_e:accessibilityannotationcomplete">Raised when the accessibility attributes have been added to the ListView items.</event> /// <part name="listView" class="win-listview" locid="WinJS.UI.ListView_part:listView">The entire ListView control.</part> /// <part name="viewport" class="win-viewport" locid="WinJS.UI.ListView_part:viewport">The viewport of the ListView. </part> @@ -19750,8 +19961,8 @@ define('WinJS/Controls/ListView',[ /// <part name="selectioncheckmark" class="win-selectioncheckmark" locid="WinJS.UI.ListView_part:selectioncheckmark">A selection checkmark.</part> /// <part name="groupHeader" class="win-groupheader" locid="WinJS.UI.ListView_part:groupHeader">The header of a group.</part> /// <part name="progressbar" class="win-progress" locid="WinJS.UI.ListView_part:progressbar">The progress indicator of the ListView.</part> - /// <resource type="javascript" src="//WinJS.4.0/js/WinJS.js" shared="true" /> - /// <resource type="css" src="//WinJS.4.0/css/ui-dark.css" shared="true" /> + /// <resource type="javascript" src="//WinJS.4.4/js/WinJS.js" shared="true" /> + /// <resource type="css" src="//WinJS.4.4/css/ui-dark.css" shared="true" /> ListView: _Base.Namespace._lazy(function () { var AffectedRange = _Base.Class.define(function () { this.clear(); @@ -21298,24 +21509,22 @@ define('WinJS/Controls/ListView',[ listViewHandler("FocusOut", false, false), modeHandler("KeyDown"), modeHandler("KeyUp"), - listViewHandler("MSElementResize", false, false) ]; elementEvents.forEach(function (eventHandler) { _ElementUtilities._addEventListener(that._element, eventHandler.name, eventHandler.handler, !!eventHandler.capture); }); - this._onMSElementResizeBound = this._onMSElementResize.bind(this); - _ElementUtilities._resizeNotifier.subscribe(this._element, this._onMSElementResizeBound); - - var initiallyParented = _Global.document.body.contains(this._element); - _ElementUtilities._addInsertedNotifier(this._element); - this._element.addEventListener("WinJSNodeInserted", function (event) { - // WinJSNodeInserted fires even if the element is already in the DOM - if (initiallyParented) { - initiallyParented = false; - return; - } - that._onMSElementResizeBound(event); - }, false); + this._onElementResizeBound = this._onElementResize.bind(this); + _ElementUtilities._resizeNotifier.subscribe(this._element, this._onElementResizeBound); + this._elementResizeInstrument = new _ElementResizeInstrument._ElementResizeInstrument(); + this._element.appendChild(this._elementResizeInstrument.element); + this._elementResizeInstrument.addEventListener("resize", this._onElementResizeBound); + + _ElementUtilities._inDom(this.element) + .then(function () { + if (!that._disposed) { + that._elementResizeInstrument.addedToDom(); + } + }); var viewportEvents = [ listViewHandler("MSManipulationStateChanged", true), @@ -21586,6 +21795,7 @@ define('WinJS/Controls/ListView',[ if (index === +index) { that._updater.updateDrag = true; that._updater.selectionChanged = true; + that._updater.changed = true; var firstRange = that._updater.selectionFirst[index], lastRange = that._updater.selectionLast[index], @@ -21594,7 +21804,6 @@ define('WinJS/Controls/ListView',[ if (range && range.oldFirstIndex !== range.oldLastIndex) { delete that._updater.selectionFirst[range.oldFirstIndex]; delete that._updater.selectionLast[range.oldLastIndex]; - that._updater.changed = true; } } that._writeProfilerMark("moved(" + index + "),info"); @@ -22325,9 +22534,9 @@ define('WinJS/Controls/ListView',[ this._viewportHeight = _Constants._UNINITIALIZED; }, - _onMSElementResize: function ListView_onResize() { - this._writeProfilerMark("_onMSElementResize,info"); - Scheduler.schedule(function ListView_async_msElementResize() { + _onElementResize: function ListView_onResize() { + this._writeProfilerMark("_onElementResize,info"); + Scheduler.schedule(function ListView_async_elementResize() { if (this._isZombie()) { return; } // If these values are uninitialized there is already a realization pass pending. if (this._viewportWidth !== _Constants._UNINITIALIZED && this._viewportHeight !== _Constants._UNINITIALIZED) { @@ -22352,7 +22561,7 @@ define('WinJS/Controls/ListView',[ }); } } - }, Scheduler.Priority.max, this, "WinJS.UI.ListView._onMSElementResize"); + }, Scheduler.Priority.max, this, "WinJS.UI.ListView._onElementResize"); }, _onFocusIn: function ListView_onFocusIn(event) { @@ -22790,7 +22999,7 @@ define('WinJS/Controls/ListView',[ _rtl: function ListView_rtl() { if (typeof this._cachedRTL !== "boolean") { - this._cachedRTL = _Global.getComputedStyle(this._element, null).direction === "rtl"; + this._cachedRTL = _ElementUtilities._getComputedStyle(this._element, null).direction === "rtl"; } return this._cachedRTL; }, @@ -23290,7 +23499,8 @@ define('WinJS/Controls/ListView',[ e && (e.textContent = ""); }; - _ElementUtilities._resizeNotifier.unsubscribe(this._element, this._onMSElementResizeBound); + _ElementUtilities._resizeNotifier.unsubscribe(this._element, this._onElementResizeBound); + this._elementResizeInstrument.dispose(); this._batchingViewUpdates && this._batchingViewUpdates.cancel(); @@ -24338,7 +24548,7 @@ define('WinJS/Controls/FlipView/_PageManager',[ } if (dirChanged) { that._cachedStyleDir = element.style.direction; - that._pageManager._rtl = _Global.getComputedStyle(that._pageManager._flipperDiv, null).direction === "rtl"; + that._pageManager._rtl = _ElementUtilities._getComputedStyle(that._pageManager._flipperDiv, null).direction === "rtl"; that._pageManager.resized(); } } @@ -24353,7 +24563,7 @@ define('WinJS/Controls/FlipView/_PageManager',[ this._panningDivContainer = panningDivContainer; this._buttonVisibilityHandler = buttonVisibilityHandler; this._currentPage = null; - this._rtl = _Global.getComputedStyle(this._flipperDiv, null).direction === "rtl"; + this._rtl = _ElementUtilities._getComputedStyle(this._flipperDiv, null).direction === "rtl"; this._itemsManager = itemsManager; this._itemSpacing = itemSpacing; this._tabIndex = _ElementUtilities.getTabIndex(flipperDiv); @@ -26240,11 +26450,12 @@ define('WinJS/Controls/FlipView',[ '../Utilities/_Hoverable', '../Utilities/_ItemsManager', '../Utilities/_UI', + './ElementResizeInstrument', './FlipView/_Constants', './FlipView/_PageManager', 'require-style!less/styles-flipview', 'require-style!less/colors-flipview' -], function flipperInit(_Global, _Base, _BaseUtils, _ErrorFromName, _Events, _Resources, _WriteProfilerMark, Animations, _TransitionAnimation, BindingList, Promise, Scheduler, _Control, _Dispose, _ElementUtilities, _Hoverable, _ItemsManager, _UI, _Constants, _PageManager) { +], function flipperInit(_Global, _Base, _BaseUtils, _ErrorFromName, _Events, _Resources, _WriteProfilerMark, Animations, _TransitionAnimation, BindingList, Promise, Scheduler, _Control, _Dispose, _ElementUtilities, _Hoverable, _ItemsManager, _UI, _ElementResizeInstrument, _Constants, _PageManager) { "use strict"; _Base.Namespace.define("WinJS.UI", { @@ -26266,8 +26477,8 @@ define('WinJS/Controls/FlipView',[ /// <part name="rightNavigationButton" class="win-navright" locid="WinJS.UI.FlipView_part:rightNavigationButton">The right navigation button.</part> /// <part name="topNavigationButton" class="win-navtop" locid="WinJS.UI.FlipView_part:topNavigationButton">The top navigation button.</part> /// <part name="bottomNavigationButton" class="win-navbottom" locid="WinJS.UI.FlipView_part:bottomNavigationButton">The bottom navigation button.</part> - /// <resource type="javascript" src="//WinJS.4.0/js/WinJS.js" shared="true" /> - /// <resource type="css" src="//WinJS.4.0/css/ui-dark.css" shared="true" /> + /// <resource type="javascript" src="//WinJS.4.4/js/WinJS.js" shared="true" /> + /// <resource type="css" src="//WinJS.4.4/css/ui-dark.css" shared="true" /> FlipView: _Base.Namespace._lazy(function () { // Class names @@ -26303,20 +26514,12 @@ define('WinJS/Controls/FlipView',[ } })) { that._cachedStyleDir = that._flipviewDiv.style.direction; - that._rtl = _Global.getComputedStyle(that._flipviewDiv, null).direction === "rtl"; + that._rtl = _ElementUtilities._getComputedStyle(that._flipviewDiv, null).direction === "rtl"; that._setupOrientation(); } } } - function flipviewResized(e) { - var that = e.target && e.target.winControl; - if (that && that instanceof FlipView) { - _WriteProfilerMark("WinJS.UI.FlipView:resize,StartTM"); - that._resize(); - } - } - var strings = { get badAxis() { return "Invalid argument: orientation must be a string, either 'horizontal' or 'vertical'"; }, get badCurrentPage() { return "Invalid argument: currentPage must be a number greater than or equal to zero and be within the bounds of the datasource"; }, @@ -26428,7 +26631,8 @@ define('WinJS/Controls/FlipView',[ _ElementUtilities._globalListener.removeEventListener(this._flipviewDiv, 'wheel', this._windowWheelHandlerBound); _ElementUtilities._globalListener.removeEventListener(this._flipviewDiv, 'mousewheel', this._windowWheelHandlerBound); - _ElementUtilities._resizeNotifier.unsubscribe(this._flipviewDiv, flipviewResized); + _ElementUtilities._resizeNotifier.unsubscribe(this._flipviewDiv, this._resizeHandlerBound); + this._elementResizeInstrument.dispose(); this._disposed = true; @@ -26874,9 +27078,6 @@ define('WinJS/Controls/FlipView',[ new _ElementUtilities._MutationObserver(flipViewPropertyChanged).observe(this._flipviewDiv, { attributes: true, attributeFilter: ["dir", "style"] }); this._cachedStyleDir = this._flipviewDiv.style.direction; - this._flipviewDiv.addEventListener("mselementresize", flipviewResized); - _ElementUtilities._resizeNotifier.subscribe(this._flipviewDiv, flipviewResized); - this._contentDiv.addEventListener("mouseleave", function () { that._mouseInViewport = false; }, false); @@ -26936,20 +27137,37 @@ define('WinJS/Controls/FlipView',[ } }, true); + this._resizeHandlerBound = this._resizeHandler.bind(this); + this._elementResizeInstrument = new _ElementResizeInstrument._ElementResizeInstrument(); + this._flipviewDiv.appendChild(this._elementResizeInstrument.element); + this._elementResizeInstrument.addEventListener("resize", this._resizeHandlerBound); + _ElementUtilities._resizeNotifier.subscribe(this._flipviewDiv, this._resizeHandlerBound); + + var initiallyParented = _Global.document.body.contains(this._flipviewDiv); + if (initiallyParented) { + this._elementResizeInstrument.addedToDom(); + } + // Scroll position isn't maintained when an element is added/removed from // the DOM so every time we are placed back in, let the PageManager // fix the scroll position. - var initiallyParented = _Global.document.body.contains(this._flipviewDiv); _ElementUtilities._addInsertedNotifier(this._flipviewDiv); + var initialTrigger = true; this._flipviewDiv.addEventListener("WinJSNodeInserted", function (event) { - // WinJSNodeInserted fires even if the element is already in the DOM - if (initiallyParented) { - initiallyParented = false; - return; + // WinJSNodeInserted fires even if the element was already in the DOM + if (initialTrigger) { + initialTrigger = false; + if (!initiallyParented) { + that._elementResizeInstrument.addedToDom(); + that._pageManager.resized(); + } + } else { + that._pageManager.resized(); } - that._pageManager.resized(); }, false); + + this._flipviewDiv.addEventListener("keydown", function (event) { if (that._disposed) { return; @@ -27103,6 +27321,11 @@ define('WinJS/Controls/FlipView',[ return false; }, + _resizeHandler: function FlipView_resizeHandler() { + _WriteProfilerMark("WinJS.UI.FlipView:resize,StartTM"); + this._pageManager.resized(); + }, + _refreshHandler: function FlipView_refreshHandler() { var dataSource = this._dataSourceAfterRefresh || this._dataSource, renderer = this._itemRendererAfterRefresh || this._itemRenderer, @@ -27306,10 +27529,6 @@ define('WinJS/Controls/FlipView',[ this._completeJumpPending = false; }, - _resize: function FlipView_resize() { - this._pageManager.resized(); - }, - _setCurrentIndex: function FlipView_setCurrentIndex(index) { return this._pageManager.jumpToIndex(index); }, @@ -27367,7 +27586,7 @@ define('WinJS/Controls/FlipView',[ if (this._isHorizontal) { this._panningDivContainer.style["overflowX"] = (this._environmentSupportsTouch ? "scroll" : "hidden"); this._panningDivContainer.style["overflowY"] = "hidden"; - var rtl = _Global.getComputedStyle(this._flipviewDiv, null).direction === "rtl"; + var rtl = _ElementUtilities._getComputedStyle(this._flipviewDiv, null).direction === "rtl"; this._rtl = rtl; if (rtl) { this._prevButton.className = navButtonClass + " " + navButtonRightClass; @@ -27525,7 +27744,7 @@ define('WinJS/Controls/ItemContainer',[ '../Utilities/_UI', './ItemContainer/_Constants', './ItemContainer/_ItemEventsHandler' - ], function itemContainerInit(exports, _Global, _Base, _BaseUtils, _ErrorFromName, _Events, _Log, _Resources, _WriteProfilerMark, Promise, Scheduler, _Control, _Dispose, _ElementUtilities, _Hoverable, _KeyboardBehavior, _UI, _Constants, _ItemEventsHandler) { +], function itemContainerInit(exports, _Global, _Base, _BaseUtils, _ErrorFromName, _Events, _Log, _Resources, _WriteProfilerMark, Promise, Scheduler, _Control, _Dispose, _ElementUtilities, _Hoverable, _KeyboardBehavior, _UI, _Constants, _ItemEventsHandler) { "use strict"; var createEvent = _Events._createEventProperty; @@ -27553,8 +27772,8 @@ define('WinJS/Controls/ItemContainer',[ /// <part name="selectionbackground" class="win-selectionbackground" locid="WinJS.UI.ItemContainer_part:selectionbackground">The background of a selection checkmark.</part> /// <part name="selectioncheckmark" class="win-selectioncheckmark" locid="WinJS.UI.ItemContainer_part:selectioncheckmark">A selection checkmark.</part> /// <part name="focusedoutline" class="win-focusedoutline" locid="WinJS.UI.ItemContainer_part:focusedoutline">Used to display an outline when the main container has keyboard focus.</part> - /// <resource type="javascript" src="//WinJS.4.0/js/WinJS.js" shared="true" /> - /// <resource type="css" src="//WinJS.4.0/css/ui-dark.css" shared="true" /> + /// <resource type="javascript" src="//WinJS.4.4/js/WinJS.js" shared="true" /> + /// <resource type="css" src="//WinJS.4.4/css/ui-dark.css" shared="true" /> ItemContainer: _Base.Namespace._lazy(function () { var strings = { get duplicateConstruction() { return "Invalid argument: Controls may only be instantiated one time for each DOM element"; }, @@ -28045,7 +28264,7 @@ define('WinJS/Controls/ItemContainer',[ _rtl: function ItemContainer_rtl() { if (typeof this._cachedRTL !== "boolean") { - this._cachedRTL = _Global.getComputedStyle(this.element, null).direction === "rtl"; + this._cachedRTL = _ElementUtilities._getComputedStyle(this.element, null).direction === "rtl"; } return this._cachedRTL; }, @@ -28055,7 +28274,7 @@ define('WinJS/Controls/ItemContainer',[ }, _forceLayout: function ItemContainer_forceLayout() { - this._cachedRTL = _Global.getComputedStyle(this.element, null).direction === "rtl"; + this._cachedRTL = _ElementUtilities._getComputedStyle(this.element, null).direction === "rtl"; this._setDirectionClass(); }, @@ -28288,8 +28507,8 @@ define('WinJS/Controls/Repeater',[ /// <icon src="ui_winjs.ui.repeater.16x16.png" width="16" height="16" /> /// <htmlSnippet><![CDATA[<div data-win-control="WinJS.UI.Repeater"></div>]]></htmlSnippet> /// <part name="repeater" class="win-repeater" locid="WinJS.UI.Repeater_part:repeater">The Repeater control itself</part> - /// <resource type="javascript" src="//WinJS.4.0/js/WinJS.js" shared="true" /> - /// <resource type="css" src="//WinJS.4.0/css/ui-dark.css" shared="true" /> + /// <resource type="javascript" src="//WinJS.4.4/js/WinJS.js" shared="true" /> + /// <resource type="css" src="//WinJS.4.4/css/ui-dark.css" shared="true" /> Repeater: _Base.Namespace._lazy(function () { // Constants @@ -28801,8 +29020,8 @@ define('WinJS/Controls/DatePicker',[ /// <icon src="ui_winjs.ui.datepicker.16x16.png" width="16" height="16" /> /// <htmlSnippet><![CDATA[<div data-win-control="WinJS.UI.DatePicker"></div>]]></htmlSnippet> /// <event name="change" locid="WinJS.UI.DatePicker_e:change">Occurs when the current date changes.</event> - /// <resource type="javascript" src="//WinJS.4.0/js/WinJS.js" shared="true" /> - /// <resource type="css" src="//WinJS.4.0/css/ui-dark.css" shared="true" /> + /// <resource type="javascript" src="//WinJS.4.4/js/WinJS.js" shared="true" /> + /// <resource type="css" src="//WinJS.4.4/css/ui-dark.css" shared="true" /> DatePicker: _Base.Namespace._lazy(function () { // Constants definition var DEFAULT_DAY_PATTERN = 'day', @@ -29557,8 +29776,8 @@ define('WinJS/Controls/TimePicker',[ /// <icon src="ui_winjs.ui.timepicker.16x16.png" width="16" height="16" /> /// <htmlSnippet><![CDATA[<div data-win-control="WinJS.UI.TimePicker"></div>]]></htmlSnippet> /// <event name="change" locid="WinJS.UI.TimePicker_e:change">Occurs when the time changes.</event> - /// <resource type="javascript" src="//WinJS.4.0/js/WinJS.js" shared="true" /> - /// <resource type="css" src="//WinJS.4.0/css/ui-dark.css" shared="true" /> + /// <resource type="javascript" src="//WinJS.4.4/js/WinJS.js" shared="true" /> + /// <resource type="css" src="//WinJS.4.4/css/ui-dark.css" shared="true" /> TimePicker: _Base.Namespace._lazy(function () { // Constants definition var DEFAULT_MINUTE_PATTERN = "{minute.integer(2)}", @@ -30221,8 +30440,8 @@ define('WinJS/Controls/BackButton',[ /// <htmlSnippet><![CDATA[<button data-win-control="WinJS.UI.BackButton"></button>]]></htmlSnippet> /// <part name="BackButton" class="win-navigation-backbutton" locid="WinJS.UI.BackButton_part:BackButton">The BackButton control itself</part> /// <part name="BackArrowGlyph" class="win-back" locid="WinJS.UI.BackButton_part:BackArrowGlyph">The Back Arrow glyph</part> - /// <resource type="javascript" src="//WinJS.4.0/js/WinJS.js" shared="true" /> - /// <resource type="css" src="//WinJS.4.0/css/ui-dark.css" shared="true" /> + /// <resource type="javascript" src="//WinJS.4.4/js/WinJS.js" shared="true" /> + /// <resource type="css" src="//WinJS.4.4/css/ui-dark.css" shared="true" /> BackButton: _Base.Namespace._lazy(function () { // Statics var strings = { @@ -30410,8 +30629,8 @@ define('WinJS/Controls/Tooltip',[ /// <event name="beforeclose" bubbles="false" locid="WinJS.UI.Tooltip_e:beforeclose">Raised when the tooltip is about to become hidden.</event> /// <event name="closed" bubbles="false" locid="WinJS.UI.Tooltip_e:close">Raised when the tooltip is hidden.</event> /// <part name="tooltip" class="win-tooltip" locid="WinJS.UI.Tooltip_e:tooltip">The entire Tooltip control.</part> - /// <resource type="javascript" src="//WinJS.4.0/js/WinJS.js" shared="true" /> - /// <resource type="css" src="//WinJS.4.0/css/ui-dark.css" shared="true" /> + /// <resource type="javascript" src="//WinJS.4.4/js/WinJS.js" shared="true" /> + /// <resource type="css" src="//WinJS.4.4/css/ui-dark.css" shared="true" /> Tooltip: _Base.Namespace._lazy(function () { var lastCloseTime = 0; var Key = _ElementUtilities.Key; @@ -30798,7 +31017,7 @@ define('WinJS/Controls/Tooltip',[ this._domElement.setAttribute("id", id); // Set the direction of tooltip according to anchor element's - var computedStyle = _Global.document.defaultView.getComputedStyle(this._anchorElement, null); + var computedStyle = _ElementUtilities._getComputedStyle(this._anchorElement, null); var elemStyle = this._domElement.style; elemStyle.direction = computedStyle.direction; elemStyle.writingMode = computedStyle["writing-mode"]; // must use CSS name, not JS name @@ -30830,7 +31049,7 @@ define('WinJS/Controls/Tooltip',[ this._phantomDiv.setAttribute("tabindex", -1); _Global.document.body.appendChild(this._phantomDiv); _ElementUtilities.addClass(this._phantomDiv, msTooltipPhantom); - var zIndex = _Global.document.defaultView.getComputedStyle(this._domElement, null).zIndex + 1; + var zIndex = _ElementUtilities._getComputedStyle(this._domElement, null).zIndex + 1; this._phantomDiv.style.zIndex = zIndex; }, @@ -31096,7 +31315,7 @@ define('WinJS/Controls/Tooltip',[ viewport.width = _Global.document.documentElement.clientWidth; viewport.height = _Global.document.documentElement.clientHeight; - if (_Global.document.defaultView.getComputedStyle(_Global.document.body, null)["writing-mode"] === "tb-rl") { + if (_ElementUtilities._getComputedStyle(_Global.document.body, null)["writing-mode"] === "tb-rl") { viewport.width = _Global.document.documentElement.clientHeight; viewport.height = _Global.document.documentElement.clientWidth; } @@ -31375,8 +31594,8 @@ define('WinJS/Controls/Rating',[ /// <part name="tentative-full" class="win-star win-tentative win-full" locid="WinJS.UI.Rating_part:tentative-full">The full star when the Rating control shows the tentative rating.</part> /// <part name="disabled-empty" class="win-star win-disabled win-empty" locid="WinJS.UI.Rating_part:disabled-empty">The empty star when the control is disabled.</part> /// <part name="disabled-full" class="win-star win-disabled win-full" locid="WinJS.UI.Rating_part:disabled-full">The full star when the control is disabled.</part> - /// <resource type="javascript" src="//WinJS.4.0/js/WinJS.js" shared="true" /> - /// <resource type="css" src="//WinJS.4.0/css/ui-dark.css" shared="true" /> + /// <resource type="javascript" src="//WinJS.4.4/js/WinJS.js" shared="true" /> + /// <resource type="css" src="//WinJS.4.4/css/ui-dark.css" shared="true" /> Rating: _Base.Namespace._lazy(function () { var createEvent = _Events._createEventProperty; @@ -31806,7 +32025,7 @@ define('WinJS/Controls/Rating',[ _decrementRating: function () { this._closeTooltip(); var firePreviewChange = true; - if ((this._tentativeRating === 0) || ((this._tentativeRating === -1) && (this._userRating === 0))) { + if (this._tentativeRating <= 0) { firePreviewChange = false; } else { if (this._tentativeRating > 0) { @@ -31889,9 +32108,9 @@ define('WinJS/Controls/Rating',[ if (this._averageRating === 1) { j = 1; } - var style = _Global.getComputedStyle(this._elements[j]); + var style = _ElementUtilities._getComputedStyle(this._elements[j]); this._elementWidth = style.width; - if (_Global.getComputedStyle(this._element).direction === "rtl") { + if (_ElementUtilities._getComputedStyle(this._element).direction === "rtl") { this._elementPadding = style.paddingRight; this._elementBorder = style.borderRight; } else { @@ -31913,7 +32132,7 @@ define('WinJS/Controls/Rating',[ _incrementRating: function () { this._closeTooltip(); var firePreviewChange = true; - if ((this._tentativeRating === this._maxRating) || ((this._tentativeRating === -1) && (this._userRating === this._maxRating))) { + if (this._tentativeRating < 0 || this._tentativeRating >= this._maxRating) { firePreviewChange = false; } @@ -32008,7 +32227,7 @@ define('WinJS/Controls/Rating',[ starNum = _ElementUtilities.data(star).msStarRating || 0; } else { var left = 0, right = this.maxRating; - if (_Global.getComputedStyle(this._element).direction === "rtl") { + if (_ElementUtilities._getComputedStyle(this._element).direction === "rtl") { left = right; right = 0; } @@ -32096,7 +32315,7 @@ define('WinJS/Controls/Rating',[ _onKeyDown: function (eventObject) { var Key = _ElementUtilities.Key; var keyCode = eventObject.keyCode; - var rtlString = _Global.getComputedStyle(this._element).direction; + var rtlString = _ElementUtilities._getComputedStyle(this._element).direction; var handled = true; switch (keyCode) { case Key.enter: // Enter @@ -32115,32 +32334,32 @@ define('WinJS/Controls/Rating',[ break; case Key.leftArrow: // Arrow Left - if (rtlString === "rtl" && this.userRating < this.maxRating - 1) { + if (rtlString === "rtl" && this._tentativeRating < this.maxRating) { this._incrementRating(); - } else if (rtlString !== "rtl" && this.userRating > 0) { + } else if (rtlString !== "rtl" && this._tentativeRating > 0) { this._decrementRating(); } else { handled = false; } break; case Key.upArrow: // Arrow Up - if (this.userRating < this.maxRating - 1) { + if (this._tentativeRating < this.maxRating) { this._incrementRating(); } else { handled = false; } break; case Key.rightArrow: // Arrow Right - if (rtlString === "rtl" && this.userRating > 0) { + if (rtlString === "rtl" && this._tentativeRating > 0) { this._decrementRating(); - } else if (rtlString !== "rtl" && this.userRating < this.maxRating - 1) { + } else if (rtlString !== "rtl" && this._tentativeRating < this.maxRating) { this._incrementRating(); } else { handled = false; } break; case Key.downArrow: // Arrow Down - if (this.userRating > 0) { + if (this._tentativeRating > 0) { this._decrementRating(); } else { handled = false; @@ -32218,7 +32437,7 @@ define('WinJS/Controls/Rating',[ if (this._averageRatingElement.nextSibling !== null) { _ElementUtilities._setFlexStyle(this._averageRatingElement.nextSibling, { grow: 1, shrink: 1 }); var style = this._averageRatingElement.nextSibling.style; - var direction = _Global.getComputedStyle(this._element).direction; + var direction = _ElementUtilities._getComputedStyle(this._element).direction; if (prevState) { if (direction === "rtl") { direction = "ltr"; @@ -32303,7 +32522,7 @@ define('WinJS/Controls/Rating',[ _updateAverageStar: function () { var style = this._averageRatingElement.style; var nextStyle = this._averageRatingElement.nextSibling.style; - if (_Global.getComputedStyle(this._element).direction === "rtl") { + if (_ElementUtilities._getComputedStyle(this._element).direction === "rtl") { style.backgroundPosition = "right"; style.paddingRight = this._elementPadding; style.borderRight = this._elementBorder; @@ -32322,7 +32541,7 @@ define('WinJS/Controls/Rating',[ _ElementUtilities._setFlexStyle(this._averageRatingElement, { grow: this._floatingValue, shrink: this._floatingValue }); style.width = this._resizeStringValue(this._elementWidth, this._floatingValue, style.width); style.backgroundSize = (100 / this._floatingValue) + "% 100%"; - style.display = _Global.getComputedStyle(this._averageRatingElement.nextSibling).display; + style.display = _ElementUtilities._getComputedStyle(this._averageRatingElement.nextSibling).display; this._averageRatingHidden = false; _ElementUtilities._setFlexStyle(this._averageRatingElement.nextSibling, { grow: 1 - this._floatingValue, shrink: 1 - this._floatingValue }); nextStyle.width = this._resizeStringValue(this._elementWidth, 1 - this._floatingValue, nextStyle.width); @@ -32370,7 +32589,7 @@ define('WinJS/Controls/Rating',[ } else if (this._tentativeRating === 0) { this._clearElement = _Global.document.createElement("div"); var distance = this._elements[0].offsetWidth + parseInt(this._elementPadding, 10); - if (_Global.getComputedStyle(this._element).direction === "ltr") { + if (_ElementUtilities._getComputedStyle(this._element).direction === "ltr") { distance *= -1; } this._clearElement.style.cssText = "visiblity:hidden; position:absolute; width:0px; height:100%; left:" + distance + "px; top:0px;"; @@ -32442,10 +32661,10 @@ define('WinJS/Controls/Rating',[ this._element.insertBefore(this._averageRatingElement, this._elements[i]); this._floatingValue = this._averageRating - i; - var elementStyle = _Global.getComputedStyle(this._elements[i]); + var elementStyle = _ElementUtilities._getComputedStyle(this._elements[i]); this._elementWidth = elementStyle.width; - if (_Global.getComputedStyle(this._element).direction === "rtl") { + if (_ElementUtilities._getComputedStyle(this._element).direction === "rtl") { this._elementPadding = elementStyle.paddingRight; this._elementBorder = elementStyle.borderRight; } else { @@ -32516,8 +32735,9 @@ define('WinJS/Controls/ToggleSwitch',[ ], function toggleInit(_Global, _Base, _BaseUtils, _Events, _Resources, _Accents, _Control, _ElementUtilities) { "use strict"; - - _Accents.createAccentRule(".win-toggleswitch-on .win-toggleswitch-track", [{ name: "border-color", value: _Accents.ColorTypes.accent }]); + + _Accents.createAccentRule(".win-toggleswitch-on .win-toggleswitch-track", [{ name: "background-color", value: _Accents.ColorTypes.accent }]); + _Accents.createAccentRule("html.win-hoverable .win-toggleswitch-on:not(.win-toggleswitch-disabled):not(.win-toggleswitch-pressed) .win-toggleswitch-clickregion:hover .win-toggleswitch-track", [{ name: "background-color", value: _Accents.ColorTypes.listSelectPress }]); _Base.Namespace.define("WinJS.UI", { /// <field> @@ -32535,8 +32755,8 @@ define('WinJS/Controls/ToggleSwitch',[ /// <part name="title" class="win-toggleswitch-header" locid="WinJS.UI.ToggleSwitch_part:title">The main text for the ToggleSwitch control.</part> /// <part name="label-on" class="win-toggleswitch-value" locid="WinJS.UI.ToggleSwitch_part:label-on">The text for when the switch is on.</part> /// <part name="label-off" class="win-toggleswitch-value" locid="WinJS.UI.ToggleSwitch_part:label-off:">The text for when the switch is off.</part> - /// <resource type="javascript" src="//WinJS.4.0/js/WinJS.js" shared="true" /> - /// <resource type="css" src="//WinJS.4.0/css/ui-dark.css" shared="true" /> + /// <resource type="javascript" src="//WinJS.4.4/js/WinJS.js" shared="true" /> + /// <resource type="css" src="//WinJS.4.4/css/ui-dark.css" shared="true" /> ToggleSwitch: _Base.Namespace._lazy(function () { // Store some class names @@ -32838,7 +33058,7 @@ define('WinJS/Controls/ToggleSwitch',[ // was closest to var trackRect = this._trackElement.getBoundingClientRect(); var thumbRect = this._thumbElement.getBoundingClientRect(); - var isRTL = _Global.getComputedStyle(this._domElement).direction === 'rtl'; + var isRTL = _ElementUtilities._getComputedStyle(this._domElement).direction === 'rtl'; if (this._dragging) { var maxX = trackRect.width - thumbRect.width; this.checked = isRTL ? this._dragX < maxX / 2 : this._dragX >= maxX / 2; @@ -32930,9 +33150,10 @@ define('WinJS/Controls/SemanticZoom',[ '../Utilities/_ElementUtilities', '../Utilities/_ElementListUtilities', '../Utilities/_Hoverable', + './ElementResizeInstrument', 'require-style!less/styles-semanticzoom', 'require-style!less/colors-semanticzoom' - ], function semanticZoomInit(_Global, _Base, _BaseUtils, _ErrorFromName, _Events, _Resources, _WriteProfilerMark, Animations, _TransitionAnimation, ControlProcessor, Promise, _Control, _Dispose, _ElementUtilities, _ElementListUtilities, _Hoverable) { + ], function semanticZoomInit(_Global, _Base, _BaseUtils, _ErrorFromName, _Events, _Resources, _WriteProfilerMark, Animations, _TransitionAnimation, ControlProcessor, Promise, _Control, _Dispose, _ElementUtilities, _ElementListUtilities, _Hoverable, _ElementResizeInstrument) { "use strict"; _Base.Namespace.define("WinJS.UI", { @@ -32946,8 +33167,8 @@ define('WinJS/Controls/SemanticZoom',[ /// <icon src="ui_winjs.ui.semanticzoom.16x16.png" width="16" height="16" /> /// <htmlSnippet supportsContent="true"><![CDATA[<div data-win-control="WinJS.UI.SemanticZoom"><div class="zoomedInContainer" data-win-control="WinJS.UI.ListView"></div><div class="zoomedOutContainer" data-win-control="WinJS.UI.ListView"></div></div>]]></htmlSnippet> /// <part name="semanticZoom" class="win-semanticzoom" locid="WinJS.UI.SemanticZoom_part:semanticZoom">The entire SemanticZoom control.</part> - /// <resource type="javascript" src="//WinJS.4.0/js/WinJS.js" shared="true" /> - /// <resource type="css" src="//WinJS.4.0/css/ui-dark.css" shared="true" /> + /// <resource type="javascript" src="//WinJS.4.4/js/WinJS.js" shared="true" /> + /// <resource type="css" src="//WinJS.4.4/css/ui-dark.css" shared="true" /> SemanticZoom: _Base.Namespace._lazy(function () { var browserStyleEquivalents = _BaseUtils._browserStyleEquivalents; @@ -33049,13 +33270,6 @@ define('WinJS/Controls/SemanticZoom',[ var origin = { x: 0, y: 0 }; - function onSemanticZoomResize(ev) { - var control = ev.target && ev.target.winControl; - if (control && !control._resizing) { - control._onResize(); - } - } - function onSemanticZoomPropertyChanged(list) { // This will only be called for "aria-checked" changes var control = list[0].target && list[0].target.winControl; @@ -33133,19 +33347,32 @@ define('WinJS/Controls/SemanticZoom',[ this._configure(); // Register event handlers + this._onResizeBound = this._onResize.bind(this); + this._elementResizeInstrument = new _ElementResizeInstrument._ElementResizeInstrument(); + this._element.appendChild(this._elementResizeInstrument.element); + this._elementResizeInstrument.addEventListener("resize", this._onResizeBound); + _ElementUtilities._resizeNotifier.subscribe(this._element, this._onResizeBound); var initiallyParented = _Global.document.body.contains(this._element); + if (initiallyParented) { + this._elementResizeInstrument.addedToDom(); + } + _ElementUtilities._addInsertedNotifier(this._element); + var initialTrigger = true; this._element.addEventListener("WinJSNodeInserted", function (event) { - // WinJSNodeInserted fires even if the element is already in the DOM - if (initiallyParented) { - initiallyParented = false; - return; + // WinJSNodeInserted fires even if the element was already in the DOM + if (initialTrigger) { + initialTrigger = false; + if (!initiallyParented) { + that._elementResizeInstrument.addedToDom(); + that._onResizeBound(); + } + } else { + that._onResizeBound(); } - onSemanticZoomResize(event); }, false); - this._element.addEventListener("mselementresize", onSemanticZoomResize); - _ElementUtilities._resizeNotifier.subscribe(this._element, onSemanticZoomResize); + new _ElementUtilities._MutationObserver(onSemanticZoomPropertyChanged).observe(this._element, { attributes: true, attributeFilter: ["aria-checked"] }); if (!isPhone) { @@ -33231,7 +33458,7 @@ define('WinJS/Controls/SemanticZoom',[ var newValue = _ElementUtilities._clamp(value, minZoomFactor, maxZoomFactor, defaultZoomFactor); if (oldValue !== newValue) { this._zoomFactor = newValue; - this._onResize(); + this.forceLayout(); } } }, @@ -33284,7 +33511,8 @@ define('WinJS/Controls/SemanticZoom',[ } this._disposed = true; - _ElementUtilities._resizeNotifier.unsubscribe(this._element, onSemanticZoomResize); + this._elementResizeInstrument.dispose(); + _ElementUtilities._resizeNotifier.unsubscribe(this._element, this._onResizeBound); _Dispose._disposeElement(this._elementIn); _Dispose._disposeElement(this._elementOut); @@ -33494,7 +33722,7 @@ define('WinJS/Controls/SemanticZoom',[ style.height = height + "px"; }; - var sezoComputedStyle = _Global.getComputedStyle(this._element, null), + var sezoComputedStyle = _ElementUtilities._getComputedStyle(this._element, null), computedWidth = parseFloat(sezoComputedStyle.width), computedHeight = parseFloat(sezoComputedStyle.height), sezoPaddingLeft = getDimension(this._element, sezoComputedStyle["paddingLeft"]), @@ -33544,7 +33772,9 @@ define('WinJS/Controls/SemanticZoom',[ }, _onResize: function () { - this._onResizeImpl(); + if (!this._resizing) { + this._onResizeImpl(); + } }, _onMouseMove: function (ev) { @@ -34059,8 +34289,8 @@ define('WinJS/Controls/SemanticZoom',[ } this._zoomingOut = zoomOut; // Force style resolution - _Global.getComputedStyle(this._canvasIn).opacity; - _Global.getComputedStyle(this._canvasOut).opacity; + _ElementUtilities._getComputedStyle(this._canvasIn).opacity; + _ElementUtilities._getComputedStyle(this._canvasOut).opacity; _WriteProfilerMark("WinJS.UI.SemanticZoom:prepareForZoom,StopTM"); this._startAnimations(zoomOut, customViewAnimationPromise); }, @@ -34387,7 +34617,7 @@ define('WinJS/Controls/SemanticZoom',[ } catch (err) { } // an exception can be thrown if SeZoDiv is no longer available - var sezoComputedStyle = _Global.getComputedStyle(this._element, null), + var sezoComputedStyle = _ElementUtilities._getComputedStyle(this._element, null), sezoPaddingLeft = getDimension(this._element, sezoComputedStyle["paddingLeft"]), sezoPaddingTop = getDimension(this._element, sezoComputedStyle["paddingTop"]), sezoBorderLeft = getDimension(this._element, sezoComputedStyle["borderLeftWidth"]); @@ -34437,7 +34667,7 @@ define('WinJS/Controls/SemanticZoom',[ }, _rtl: function () { - return _Global.getComputedStyle(this._element, null).direction === "rtl"; + return _ElementUtilities._getComputedStyle(this._element, null).direction === "rtl"; }, _pinching: { @@ -34457,38 +34687,32 @@ define('WinJS/Controls/SemanticZoom',[ }); // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License.txt in the project root for license information. -define('WinJS/Controls/Pivot/_Constants',[ - ], function pivotConstantsInit() { - "use strict"; - - var members = { - // Names of classes used by the Pivot. - _ClassName: { - pivot: "win-pivot", - pivotLocked: "win-pivot-locked", - pivotTitle: "win-pivot-title", - pivotHeaderArea: "win-pivot-header-area", - pivotHeaderLeftCustom: "win-pivot-header-leftcustom", - pivotHeaderRightCustom: "win-pivot-header-rightcustom", - pivotHeaderItems: "win-pivot-header-items", - pivotHeaders: "win-pivot-headers", - pivotHeader: "win-pivot-header", - pivotHeaderSelected: "win-pivot-header-selected", - pivotViewport: "win-pivot-viewport", - pivotSurface: "win-pivot-surface", - pivotNoSnap: "win-pivot-nosnap", - pivotNavButton: "win-pivot-navbutton", - pivotNavButtonPrev: "win-pivot-navbutton-prev", - pivotNavButtonNext: "win-pivot-navbutton-next", - pivotShowNavButtons: "win-pivot-shownavbuttons", - pivotInputTypeMouse: "win-pivot-mouse", - pivotInputTypeTouch: "win-pivot-touch", - pivotDisableContentSwipeNavigation: "win-pivot-disablecontentswipenavigation" - } +"use strict"; +define('WinJS/Controls/Pivot/_Constants',["require", "exports"], function (require, exports) { + // Names of classes used by the Pivot. + exports._ClassNames = { + pivot: "win-pivot", + pivotCustomHeaders: "win-pivot-customheaders", + pivotLocked: "win-pivot-locked", + pivotTitle: "win-pivot-title", + pivotHeaderArea: "win-pivot-header-area", + pivotHeaderLeftCustom: "win-pivot-header-leftcustom", + pivotHeaderRightCustom: "win-pivot-header-rightcustom", + pivotHeaderItems: "win-pivot-header-items", + pivotHeaders: "win-pivot-headers", + pivotHeader: "win-pivot-header", + pivotHeaderSelected: "win-pivot-header-selected", + pivotViewport: "win-pivot-viewport", + pivotSurface: "win-pivot-surface", + pivotNoSnap: "win-pivot-nosnap", + pivotNavButton: "win-pivot-navbutton", + pivotNavButtonPrev: "win-pivot-navbutton-prev", + pivotNavButtonNext: "win-pivot-navbutton-next", + pivotShowNavButtons: "win-pivot-shownavbuttons", + pivotInputTypeMouse: "win-pivot-mouse", + pivotInputTypeTouch: "win-pivot-touch", + pivotDisableContentSwipeNavigation: "win-pivot-disablecontentswipenavigation" }; - - return members; - }); // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License.txt in the project root for license information. @@ -34521,8 +34745,8 @@ define('WinJS/Controls/Pivot/_Item',[ /// <htmlSnippet supportsContent="true"><![CDATA[<div data-win-control="WinJS.UI.PivotItem" data-win-options="{header: 'PivotItem Header'}">PivotItem Content</div>]]></htmlSnippet> /// <part name="pivotitem" class="win-pivot-item" locid="WinJS.UI.PivotItem_part:pivotitem">The entire PivotItem control.</part> /// <part name="content" class="win-pivot-item-content" locid="WinJS.UI.PivotItem_part:content">The content region of the PivotItem.</part> - /// <resource type="javascript" src="//WinJS.4.0/js/WinJS.js" shared="true" /> - /// <resource type="css" src="//WinJS.4.0/css/ui-dark.css" shared="true" /> + /// <resource type="javascript" src="//WinJS.4.4/js/WinJS.js" shared="true" /> + /// <resource type="css" src="//WinJS.4.4/css/ui-dark.css" shared="true" /> PivotItem: _Base.Namespace._lazy(function () { var strings = { get duplicateConstruction() { return "Invalid argument: Controls may only be instantiated one time for each DOM element"; } @@ -34610,7 +34834,7 @@ define('WinJS/Controls/Pivot/_Item',[
<TRUNCATED> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
