@ui5/webcomponents-base 0.0.0-9195c41b8 → 0.0.0-9c26e8e4f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +3 -0
- package/CHANGELOG.md +362 -0
- package/README.md +53 -7
- package/bundle.esm.js +23 -16
- package/dist/AssetRegistry.js +8 -6
- package/dist/Boot.js +59 -0
- package/dist/CSP.js +59 -0
- package/dist/CustomElementsRegistry.js +79 -7
- package/dist/CustomElementsScope.js +30 -0
- package/dist/CustomElementsScopeUtils.js +108 -0
- package/dist/DOMObserver.js +65 -0
- package/dist/Device.js +71 -773
- package/dist/EventProvider.js +38 -26
- package/dist/FeaturesRegistry.js +4 -1
- package/dist/FontFace.js +19 -62
- package/dist/InitialConfiguration.js +43 -8
- package/dist/Keys.js +136 -2
- package/dist/ManagedStyles.js +83 -0
- package/dist/MediaRange.js +109 -0
- package/dist/PropertiesFileFormat.js +95 -0
- package/dist/Render.js +175 -0
- package/dist/RenderQueue.js +41 -17
- package/dist/RenderScheduler.js +24 -126
- package/dist/Runtimes.js +107 -0
- package/dist/StaticArea.js +1 -39
- package/dist/StaticAreaItem.js +58 -62
- package/dist/SystemCSSVars.js +10 -0
- package/dist/Theming.js +2 -1
- package/dist/UI5Element.js +435 -300
- package/dist/UI5ElementMetadata.js +173 -19
- package/dist/asset-registries/Icons.js +125 -14
- package/dist/asset-registries/Illustrations.js +30 -0
- package/dist/asset-registries/LocaleData.js +105 -66
- package/dist/asset-registries/Themes.js +30 -35
- package/dist/asset-registries/i18n.js +73 -29
- package/dist/assets/bundle.esm.eb35c35a.js +43 -0
- package/dist/assets-meta/IconCollectionsAlias.js +18 -0
- package/dist/config/AnimationMode.js +11 -1
- package/dist/config/Icons.js +52 -0
- package/dist/config/Language.js +58 -2
- package/dist/config/Theme.js +25 -0
- package/dist/css/BusyIndicator.css +80 -0
- package/dist/css/FontFace.css +75 -0
- package/dist/css/OverrideFontFace.css +32 -0
- package/dist/css/SystemCSSVars.css +17 -0
- package/dist/delegate/ItemNavigation.js +249 -171
- package/dist/delegate/ResizeHandler.js +78 -38
- package/dist/delegate/ScrollEnablement.js +49 -20
- package/dist/features/F6Navigation.js +110 -0
- package/dist/features/OpenUI5Enablement.js +119 -0
- package/dist/features/OpenUI5Support.js +42 -7
- package/dist/generated/AssetParameters.js +1 -1
- package/dist/generated/VersionInfo.js +10 -0
- package/dist/generated/css/BusyIndicator.css.js +5 -0
- package/dist/generated/css/FontFace.css.js +5 -0
- package/dist/generated/css/OverrideFontFace.css.js +5 -0
- package/dist/generated/css/SystemCSSVars.css.js +5 -0
- package/dist/getSharedResource.js +30 -0
- package/dist/i18nBundle.js +58 -5
- package/dist/locale/RTLAwareRegistry.js +14 -0
- package/dist/locale/applyDirection.js +17 -0
- package/dist/locale/directionChange.js +32 -0
- package/dist/locale/getEffectiveDir.js +28 -0
- package/dist/locale/getLocale.js +12 -2
- package/dist/locale/languageChange.js +22 -0
- package/dist/renderer/LitRenderer.js +44 -7
- package/dist/renderer/directives/style-map.js +72 -0
- package/dist/renderer/executeTemplate.js +34 -0
- package/dist/sap/base/Log.js +241 -0
- package/dist/sap/base/assert.js +8 -0
- package/dist/sap/base/security/URLListValidator.js +148 -0
- package/dist/sap/base/security/encodeCSS.js +14 -0
- package/dist/sap/base/security/encodeXML.js +23 -0
- package/dist/sap/base/security/sanitizeHTML.js +16 -0
- package/dist/sap/base/strings/toHex.js +8 -0
- package/dist/sap/base/util/now.js +7 -0
- package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +3585 -0
- package/dist/theming/CustomStyle.js +47 -6
- package/dist/theming/ThemeLoaded.js +22 -0
- package/dist/theming/applyTheme.js +13 -15
- package/dist/theming/getConstructableStyle.js +15 -10
- package/dist/theming/getEffectiveLinksHrefs.js +27 -0
- package/dist/theming/getEffectiveStyle.js +32 -8
- package/dist/theming/getStylesString.js +15 -0
- package/dist/theming/getThemeDesignerTheme.js +25 -5
- package/dist/theming/preloadLinks.js +23 -0
- package/dist/types/CSSColor.js +9 -0
- package/dist/types/CalendarType.js +1 -1
- package/dist/types/DataType.js +13 -1
- package/dist/types/Float.js +14 -0
- package/dist/types/Integer.js +4 -0
- package/dist/types/InvisibleMessageMode.js +30 -0
- package/dist/types/ItemNavigationBehavior.js +2 -7
- package/dist/types/NavigationMode.js +1 -0
- package/dist/types/PopupState.js +1 -1
- package/dist/types/ValueState.js +1 -1
- package/dist/updateShadowRoot.js +29 -0
- package/dist/util/AriaLabelHelper.js +41 -0
- package/dist/util/Caret.js +32 -0
- package/dist/util/ColorConversion.js +398 -0
- package/dist/util/FocusableElements.js +30 -11
- package/dist/util/HTMLSanitizer.js +7 -0
- package/dist/util/InvisibleMessage.js +69 -0
- package/dist/util/PopupUtils.js +93 -0
- package/dist/util/SlotsHelper.js +43 -0
- package/dist/util/TabbableElements.js +5 -1
- package/dist/util/arraysAreEqual.js +15 -0
- package/dist/util/clamp.js +12 -0
- package/dist/util/createLinkInHead.js +19 -0
- package/dist/util/debounce.js +17 -0
- package/dist/util/escapeRegex.js +10 -0
- package/dist/util/generateHighlightedMarkup.js +42 -0
- package/dist/util/getActiveElement.js +11 -0
- package/dist/util/getClassCopy.js +10 -0
- package/dist/util/getEffectiveContentDensity.js +5 -0
- package/dist/util/getNormalizedTarget.js +16 -0
- package/dist/util/getSingletonElementInstance.js +13 -0
- package/dist/util/isDefaultSlotProvided.js +11 -0
- package/dist/util/isElementInView.js +15 -0
- package/dist/util/isNodeHidden.js +1 -5
- package/dist/util/isNodeTabbable.js +4 -4
- package/dist/util/isValidPropertyName.js +9 -3
- package/dist/util/setToArray.js +10 -0
- package/hash.txt +1 -0
- package/index.js +1 -1
- package/lib/generate-asset-parameters/index.js +8 -5
- package/lib/generate-styles/index.js +26 -0
- package/lib/generate-version-info/index.js +32 -0
- package/package-scripts.js +37 -28
- package/package.json +20 -12
- package/src/AssetRegistry.js +8 -6
- package/src/Boot.js +59 -0
- package/src/CSP.js +59 -0
- package/src/CustomElementsRegistry.js +79 -7
- package/src/CustomElementsScope.js +30 -0
- package/src/CustomElementsScopeUtils.js +108 -0
- package/src/DOMObserver.js +65 -0
- package/src/Device.js +71 -773
- package/src/EventProvider.js +38 -26
- package/src/FeaturesRegistry.js +4 -1
- package/src/FontFace.js +19 -62
- package/src/InitialConfiguration.js +43 -8
- package/src/Keys.js +136 -2
- package/src/ManagedStyles.js +83 -0
- package/src/MediaRange.js +109 -0
- package/src/PropertiesFileFormat.js +95 -0
- package/src/Render.js +175 -0
- package/src/RenderQueue.js +41 -17
- package/src/RenderScheduler.js +24 -126
- package/src/Runtimes.js +107 -0
- package/src/StaticArea.js +1 -39
- package/src/StaticAreaItem.js +58 -62
- package/src/SystemCSSVars.js +10 -0
- package/src/Theming.js +2 -1
- package/src/UI5Element.js +435 -300
- package/src/UI5ElementMetadata.js +173 -19
- package/src/asset-registries/Icons.js +125 -14
- package/src/asset-registries/Illustrations.js +30 -0
- package/src/asset-registries/LocaleData.js +105 -66
- package/src/asset-registries/Themes.js +30 -35
- package/src/asset-registries/i18n.js +73 -29
- package/src/assets-meta/IconCollectionsAlias.js +18 -0
- package/src/config/AnimationMode.js +11 -1
- package/src/config/Icons.js +52 -0
- package/src/config/Language.js +58 -2
- package/src/config/Theme.js +25 -0
- package/src/css/BusyIndicator.css +80 -0
- package/src/css/FontFace.css +75 -0
- package/src/css/OverrideFontFace.css +32 -0
- package/src/css/SystemCSSVars.css +17 -0
- package/src/delegate/ItemNavigation.js +249 -171
- package/src/delegate/ResizeHandler.js +78 -38
- package/src/delegate/ScrollEnablement.js +49 -20
- package/src/features/F6Navigation.js +110 -0
- package/src/features/OpenUI5Enablement.js +119 -0
- package/src/features/OpenUI5Support.js +42 -7
- package/src/getSharedResource.js +30 -0
- package/src/i18nBundle.js +58 -5
- package/src/locale/RTLAwareRegistry.js +14 -0
- package/src/locale/applyDirection.js +17 -0
- package/src/locale/directionChange.js +32 -0
- package/src/locale/getEffectiveDir.js +28 -0
- package/src/locale/getLocale.js +12 -2
- package/src/locale/languageChange.js +22 -0
- package/src/renderer/LitRenderer.js +44 -7
- package/src/renderer/directives/style-map.js +72 -0
- package/src/renderer/executeTemplate.js +34 -0
- package/src/theming/CustomStyle.js +47 -6
- package/src/theming/ThemeLoaded.js +22 -0
- package/src/theming/applyTheme.js +13 -15
- package/src/theming/getConstructableStyle.js +15 -10
- package/src/theming/getEffectiveLinksHrefs.js +27 -0
- package/src/theming/getEffectiveStyle.js +32 -8
- package/src/theming/getStylesString.js +15 -0
- package/src/theming/getThemeDesignerTheme.js +25 -5
- package/src/theming/preloadLinks.js +23 -0
- package/src/types/CSSColor.js +9 -0
- package/src/types/CalendarType.js +1 -1
- package/src/types/DataType.js +13 -1
- package/src/types/Float.js +14 -0
- package/src/types/Integer.js +4 -0
- package/src/types/InvisibleMessageMode.js +30 -0
- package/src/types/ItemNavigationBehavior.js +2 -7
- package/src/types/NavigationMode.js +1 -0
- package/src/types/PopupState.js +1 -1
- package/src/types/ValueState.js +1 -1
- package/src/updateShadowRoot.js +29 -0
- package/src/util/AriaLabelHelper.js +41 -0
- package/src/util/Caret.js +32 -0
- package/src/util/ColorConversion.js +398 -0
- package/src/util/FocusableElements.js +30 -11
- package/src/util/HTMLSanitizer.js +7 -0
- package/src/util/InvisibleMessage.js +69 -0
- package/src/util/PopupUtils.js +93 -0
- package/src/util/SlotsHelper.js +43 -0
- package/src/util/TabbableElements.js +5 -1
- package/src/util/arraysAreEqual.js +15 -0
- package/src/util/clamp.js +12 -0
- package/src/util/createLinkInHead.js +19 -0
- package/src/util/debounce.js +17 -0
- package/src/util/escapeRegex.js +10 -0
- package/src/util/generateHighlightedMarkup.js +42 -0
- package/src/util/getActiveElement.js +11 -0
- package/src/util/getClassCopy.js +10 -0
- package/src/util/getEffectiveContentDensity.js +5 -0
- package/src/util/getNormalizedTarget.js +16 -0
- package/src/util/getSingletonElementInstance.js +13 -0
- package/src/util/isDefaultSlotProvided.js +11 -0
- package/src/util/isElementInView.js +15 -0
- package/src/util/isNodeHidden.js +1 -5
- package/src/util/isNodeTabbable.js +4 -4
- package/src/util/isValidPropertyName.js +9 -3
- package/src/util/setToArray.js +10 -0
- package/used-modules.txt +10 -0
- package/bundle.es5.js +0 -28
- package/config/.eslintrc.js +0 -3
- package/config/rollup.config.js +0 -1
- package/dist/SVGIconRegistry.js +0 -60
- package/dist/boot.js +0 -32
- package/dist/compatibility/DOMObserver.js +0 -62
- package/dist/compatibility/patchNodeValue.js +0 -24
- package/dist/compatibility/whenPolyfillLoaded.js +0 -26
- package/dist/delegate/CustomResize.js +0 -78
- package/dist/delegate/NativeResize.js +0 -44
- package/dist/features/browsersupport/Edge.js +0 -6
- package/dist/features/browsersupport/IE11.js +0 -41
- package/dist/features/browsersupport/IE11WithWebComponentsPolyfill.js +0 -5
- package/dist/renderer/ifDefined.js +0 -21
- package/dist/resources/bundle.es5.js +0 -212
- package/dist/resources/bundle.es5.js.map +0 -1
- package/dist/resources/bundle.esm.js +0 -129
- package/dist/resources/bundle.esm.js.map +0 -1
- package/dist/test-resources/assets/Themes.js +0 -13
- package/dist/test-resources/elements/Child.js +0 -35
- package/dist/test-resources/elements/Generic.js +0 -84
- package/dist/test-resources/elements/GenericExt.js +0 -26
- package/dist/test-resources/elements/NoShadowDOM.js +0 -13
- package/dist/test-resources/elements/Parent.js +0 -37
- package/dist/test-resources/elements/WithStaticArea.js +0 -76
- package/dist/test-resources/pages/AllTestElements.html +0 -42
- package/dist/test-resources/pages/Configuration.html +0 -20
- package/dist/test-resources/pages/ConfigurationScript.html +0 -36
- package/dist/test-resources/specs/ConfigurationChange.spec.js +0 -25
- package/dist/test-resources/specs/ConfigurationScript.spec.js +0 -61
- package/dist/test-resources/specs/ConfigurationURL.spec.js +0 -45
- package/dist/test-resources/specs/CustomTheme.spec.js +0 -25
- package/dist/test-resources/specs/StaticArea.spec.js +0 -34
- package/dist/test-resources/specs/Theming.spec.js +0 -31
- package/dist/test-resources/specs/UI5ElementInvalidation.js +0 -258
- package/dist/test-resources/specs/UI5ElementLifecycle.js +0 -93
- package/dist/test-resources/specs/UI5ElementListenForChildPropChanges.spec.js +0 -101
- package/dist/test-resources/specs/UI5ElementMetadataExt.js +0 -40
- package/dist/test-resources/specs/UI5ElementPropertyValidation.js +0 -12
- package/dist/test-resources/specs/UI5ElementPropsAndAttrs.spec.js +0 -65
- package/dist/test-resources/specs/UI5ElementShadowDOM.js +0 -22
- package/dist/test-resources/specs/UI5ElementSlots.js +0 -34
- package/dist/theming/CSSVarsPonyfill.js +0 -24
- package/dist/theming/adaptCSSForIE.js +0 -90
- package/dist/theming/createComponentStyleTag.js +0 -49
- package/dist/theming/createThemePropertiesStyleTag.js +0 -20
- package/dist/thirdparty/Array.from.js +0 -16
- package/dist/thirdparty/Array.prototype.fill.js +0 -44
- package/dist/thirdparty/Array.prototype.find.js +0 -46
- package/dist/thirdparty/Array.prototype.includes.js +0 -51
- package/dist/thirdparty/Element.prototype.closest.js +0 -11
- package/dist/thirdparty/Element.prototype.matches.js +0 -6
- package/dist/thirdparty/Map.prototype.keys.js +0 -9
- package/dist/thirdparty/Number.isInteger.js +0 -5
- package/dist/thirdparty/Number.isNaN.js +0 -1
- package/dist/thirdparty/Number.parseInt.js +0 -1
- package/dist/thirdparty/Object.assign.js +0 -31
- package/dist/thirdparty/Object.entries.js +0 -11
- package/dist/thirdparty/Symbol.js +0 -2
- package/dist/thirdparty/WeakSet.js +0 -27
- package/dist/thirdparty/es6-string-methods.js +0 -182
- package/dist/thirdparty/events-polyfills.js +0 -89
- package/dist/thirdparty/fetch.js +0 -1
- package/dist/thirdparty/template.js +0 -600
- package/dist/thirdparty/webcomponents-sd-ce-pf.js +0 -318
- package/dist/webcomponentsjs/LICENSE.md +0 -19
- package/dist/webcomponentsjs/README.md +0 -229
- package/dist/webcomponentsjs/bundles/webcomponents-ce.js +0 -63
- package/dist/webcomponentsjs/bundles/webcomponents-ce.js.map +0 -1
- package/dist/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js +0 -297
- package/dist/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js.map +0 -1
- package/dist/webcomponentsjs/bundles/webcomponents-sd-ce.js +0 -208
- package/dist/webcomponentsjs/bundles/webcomponents-sd-ce.js.map +0 -1
- package/dist/webcomponentsjs/bundles/webcomponents-sd.js +0 -166
- package/dist/webcomponentsjs/bundles/webcomponents-sd.js.map +0 -1
- package/dist/webcomponentsjs/custom-elements-es5-adapter.js +0 -15
- package/dist/webcomponentsjs/package.json +0 -46
- package/dist/webcomponentsjs/src/entrypoints/custom-elements-es5-adapter-index.js +0 -16
- package/dist/webcomponentsjs/src/entrypoints/webcomponents-bundle-index.js +0 -53
- package/dist/webcomponentsjs/src/entrypoints/webcomponents-ce-index.js +0 -17
- package/dist/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-index.js +0 -19
- package/dist/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-pf-index.js +0 -28
- package/dist/webcomponentsjs/src/entrypoints/webcomponents-sd-index.js +0 -18
- package/dist/webcomponentsjs/webcomponents-bundle.js +0 -298
- package/dist/webcomponentsjs/webcomponents-bundle.js.map +0 -1
- package/dist/webcomponentsjs/webcomponents-loader.js +0 -185
- package/src/SVGIconRegistry.js +0 -60
- package/src/boot.js +0 -32
- package/src/compatibility/DOMObserver.js +0 -62
- package/src/compatibility/patchNodeValue.js +0 -24
- package/src/compatibility/whenPolyfillLoaded.js +0 -26
- package/src/delegate/CustomResize.js +0 -78
- package/src/delegate/NativeResize.js +0 -44
- package/src/features/browsersupport/Edge.js +0 -6
- package/src/features/browsersupport/IE11.js +0 -41
- package/src/features/browsersupport/IE11WithWebComponentsPolyfill.js +0 -5
- package/src/renderer/ifDefined.js +0 -21
- package/src/theming/CSSVarsPonyfill.js +0 -24
- package/src/theming/adaptCSSForIE.js +0 -90
- package/src/theming/createComponentStyleTag.js +0 -49
- package/src/theming/createThemePropertiesStyleTag.js +0 -20
- package/src/thirdparty/Array.from.js +0 -16
- package/src/thirdparty/Array.prototype.fill.js +0 -44
- package/src/thirdparty/Array.prototype.find.js +0 -46
- package/src/thirdparty/Array.prototype.includes.js +0 -51
- package/src/thirdparty/Element.prototype.closest.js +0 -11
- package/src/thirdparty/Element.prototype.matches.js +0 -6
- package/src/thirdparty/Map.prototype.keys.js +0 -9
- package/src/thirdparty/Number.isInteger.js +0 -5
- package/src/thirdparty/Number.isNaN.js +0 -1
- package/src/thirdparty/Number.parseInt.js +0 -1
- package/src/thirdparty/Object.assign.js +0 -31
- package/src/thirdparty/Object.entries.js +0 -11
- package/src/thirdparty/Symbol.js +0 -2
- package/src/thirdparty/WeakSet.js +0 -27
- package/src/thirdparty/es6-string-methods.js +0 -182
- package/src/thirdparty/events-polyfills.js +0 -89
- package/src/thirdparty/fetch.js +0 -1
- package/src/thirdparty/template.js +0 -600
- package/src/thirdparty/webcomponents-sd-ce-pf.js +0 -318
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const querySets = {};
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Initializes a screen width media query range set.
|
|
5
|
+
*
|
|
6
|
+
* This initialization step makes the range set ready to be used for one of the other functions in namespace <code>MediaRange</code>.
|
|
7
|
+
*
|
|
8
|
+
* A range set can be defined as shown in the following example:
|
|
9
|
+
* <pre>
|
|
10
|
+
* MediaRange.initRangeSet("MyRangeSet", [200, 400], ["Small", "Medium", "Large"]);
|
|
11
|
+
* </pre>
|
|
12
|
+
* This example defines the following named ranges:
|
|
13
|
+
* <ul>
|
|
14
|
+
* <li><code>"Small"</code>: For screens smaller than 200 pixels.</li>
|
|
15
|
+
* <li><code>"Medium"</code>: For screens greater than or equal to 200 pixels and smaller than 400 pixels.</li>
|
|
16
|
+
* <li><code>"Large"</code>: For screens greater than or equal to 400 pixels.</li>
|
|
17
|
+
* </ul>
|
|
18
|
+
*
|
|
19
|
+
* @param {string} name The name of the range set to be initialized.
|
|
20
|
+
* The name must be a valid id and consist only of letters and numeric digits.
|
|
21
|
+
*
|
|
22
|
+
* @param {int[]} [borders] The range borders
|
|
23
|
+
*
|
|
24
|
+
* @param {string[]} [names] The names of the ranges. The names must be a valid id and consist only of letters and digits.
|
|
25
|
+
*
|
|
26
|
+
* @name MediaRange.initRangeSet
|
|
27
|
+
* @function
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
const _initRangeSet = (name, borders, names) => {
|
|
31
|
+
querySets[name] = {
|
|
32
|
+
borders,
|
|
33
|
+
names,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Returns information about the current active range of the range set with the given name.
|
|
39
|
+
*
|
|
40
|
+
* If the optional parameter <code>width</code> is given, the active range will be determined for that width,
|
|
41
|
+
* otherwise it is determined for the current window size.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} name The name of the range set. The range set must be initialized beforehand ({@link MediaRange.initRangeSet})
|
|
44
|
+
* @param {int} [width] An optional width, based on which the range should be determined;
|
|
45
|
+
* If <code>width</code> is not provided, the window size will be used.
|
|
46
|
+
* @returns {string} The name of the current active interval of the range set.
|
|
47
|
+
*
|
|
48
|
+
* @name MediaRange.getCurrentRange
|
|
49
|
+
* @function
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
const _getCurrentRange = (name, width = window.innerWidth) => {
|
|
53
|
+
const querySet = querySets[name];
|
|
54
|
+
let i = 0;
|
|
55
|
+
|
|
56
|
+
if (!querySet) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
for (; i < querySet.borders.length; i++) {
|
|
61
|
+
if (width < querySet.borders[i]) {
|
|
62
|
+
return querySet.names[i];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return querySet.names[i];
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Enumeration containing the names and settings of predefined screen width media query range sets.
|
|
71
|
+
*
|
|
72
|
+
* @namespace
|
|
73
|
+
* @name MediaRange.RANGESETS
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
const RANGESETS = {
|
|
77
|
+
/**
|
|
78
|
+
* A 4-step range set (S-M-L-XL).
|
|
79
|
+
*
|
|
80
|
+
* The ranges of this set are:
|
|
81
|
+
* <ul>
|
|
82
|
+
* <li><code>"S"</code>: For screens smaller than 600 pixels.</li>
|
|
83
|
+
* <li><code>"M"</code>: For screens greater than or equal to 600 pixels and smaller than 1024 pixels.</li>
|
|
84
|
+
* <li><code>"L"</code>: For screens greater than or equal to 1024 pixels and smaller than 1440 pixels.</li>
|
|
85
|
+
* <li><code>"XL"</code>: For screens greater than or equal to 1440 pixels.</li>
|
|
86
|
+
* </ul>
|
|
87
|
+
*
|
|
88
|
+
* @name MediaRange.RANGESETS.RANGE_4STEPS
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
RANGE_4STEPS: "4Step",
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* API for screen width changes.
|
|
96
|
+
*
|
|
97
|
+
* @namespace
|
|
98
|
+
* @name MediaRange
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
const MediaRange = {
|
|
102
|
+
RANGESETS,
|
|
103
|
+
initRangeSet: _initRangeSet,
|
|
104
|
+
getCurrentRange: _getCurrentRange,
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
MediaRange.initRangeSet(MediaRange.RANGESETS.RANGE_4STEPS, [600, 1024, 1440], ["S", "M", "L", "XL"]);
|
|
108
|
+
|
|
109
|
+
export default MediaRange;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
const flatstr = typeof chrome === "object" || typeof v8 === "object" ? (s, iConcatOps) => {
|
|
2
|
+
if (iConcatOps > 2 && 40 * iConcatOps > s.length) {
|
|
3
|
+
Number(s);
|
|
4
|
+
}
|
|
5
|
+
return s;
|
|
6
|
+
} : s => s;
|
|
7
|
+
|
|
8
|
+
const rLines = /(?:\r\n|\r|\n|^)[ \t\f]*/;
|
|
9
|
+
const rEscapesOrSeparator = /(\\u[0-9a-fA-F]{0,4})|(\\.)|(\\$)|([ \t\f]*[ \t\f:=][ \t\f]*)/g;
|
|
10
|
+
const rEscapes = /(\\u[0-9a-fA-F]{0,4})|(\\.)|(\\$)/g;
|
|
11
|
+
const mEscapes = {
|
|
12
|
+
"\\f": "\f",
|
|
13
|
+
"\\n": "\n",
|
|
14
|
+
"\\r": "\r",
|
|
15
|
+
"\\t": "\t",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Parses a .properties format
|
|
20
|
+
* @param {string} sText the contents a of a .properties file
|
|
21
|
+
* @returns a object with key/value pairs parsed from the .properties file format
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
const parseProperties = sText => {
|
|
25
|
+
const properties = {},
|
|
26
|
+
aLines = sText.split(rLines);
|
|
27
|
+
|
|
28
|
+
let sLine,
|
|
29
|
+
rMatcher,
|
|
30
|
+
sKey,
|
|
31
|
+
sValue,
|
|
32
|
+
i,
|
|
33
|
+
m,
|
|
34
|
+
iLastIndex,
|
|
35
|
+
iConcatOps;
|
|
36
|
+
|
|
37
|
+
const append = s => {
|
|
38
|
+
if (sValue) {
|
|
39
|
+
sValue = `${sValue}${s}`;
|
|
40
|
+
iConcatOps++;
|
|
41
|
+
} else {
|
|
42
|
+
sValue = s;
|
|
43
|
+
iConcatOps = 0;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
for (i = 0; i < aLines.length; i++) {
|
|
48
|
+
sLine = aLines[i];
|
|
49
|
+
const skipLine = sLine === "" || sLine.charAt(0) === "#" || sLine.charAt(0) === "!";
|
|
50
|
+
|
|
51
|
+
if (!skipLine) {
|
|
52
|
+
rMatcher = rEscapesOrSeparator;
|
|
53
|
+
iLastIndex = 0;
|
|
54
|
+
rMatcher.lastIndex = iLastIndex;
|
|
55
|
+
sKey = null;
|
|
56
|
+
sValue = "";
|
|
57
|
+
m = rMatcher.exec(sLine);
|
|
58
|
+
while (m !== null) {
|
|
59
|
+
if (iLastIndex < m.index) {
|
|
60
|
+
append(sLine.slice(iLastIndex, m.index));
|
|
61
|
+
}
|
|
62
|
+
iLastIndex = rMatcher.lastIndex;
|
|
63
|
+
if (m[1]) {
|
|
64
|
+
if (m[1].length !== 6) {
|
|
65
|
+
throw new Error(`Incomplete Unicode Escape '${m[1]}'`);
|
|
66
|
+
}
|
|
67
|
+
append(String.fromCharCode(parseInt(m[1].slice(2), 16)));
|
|
68
|
+
} else if (m[2]) {
|
|
69
|
+
append(mEscapes[m[2]] || m[2].slice(1));
|
|
70
|
+
} else if (m[3]) {
|
|
71
|
+
sLine = aLines[++i];
|
|
72
|
+
iLastIndex = 0;
|
|
73
|
+
rMatcher.lastIndex = iLastIndex;
|
|
74
|
+
} else if (m[4]) {
|
|
75
|
+
sKey = sValue;
|
|
76
|
+
sValue = "";
|
|
77
|
+
rMatcher = rEscapes;
|
|
78
|
+
rMatcher.lastIndex = iLastIndex;
|
|
79
|
+
}
|
|
80
|
+
m = rMatcher.exec(sLine);
|
|
81
|
+
}
|
|
82
|
+
if (iLastIndex < sLine.length) {
|
|
83
|
+
append(sLine.slice(iLastIndex));
|
|
84
|
+
}
|
|
85
|
+
if (sKey == null) {
|
|
86
|
+
sKey = sValue;
|
|
87
|
+
sValue = "";
|
|
88
|
+
}
|
|
89
|
+
properties[sKey] = flatstr(sValue, sValue ? iConcatOps : 0);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return properties;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export default parseProperties;
|
package/dist/Render.js
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import EventProvider from "./EventProvider.js";
|
|
2
|
+
import RenderQueue from "./RenderQueue.js";
|
|
3
|
+
import { getAllRegisteredTags } from "./CustomElementsRegistry.js";
|
|
4
|
+
import { isRtlAware } from "./locale/RTLAwareRegistry.js";
|
|
5
|
+
|
|
6
|
+
const registeredElements = new Set();
|
|
7
|
+
const eventProvider = new EventProvider();
|
|
8
|
+
|
|
9
|
+
const invalidatedWebComponents = new RenderQueue(); // Queue for invalidated web components
|
|
10
|
+
|
|
11
|
+
let renderTaskPromise,
|
|
12
|
+
renderTaskPromiseResolve;
|
|
13
|
+
|
|
14
|
+
let mutationObserverTimer;
|
|
15
|
+
|
|
16
|
+
let queuePromise;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Schedules a render task (if not already scheduled) to render the component
|
|
20
|
+
*
|
|
21
|
+
* @param webComponent
|
|
22
|
+
* @returns {Promise}
|
|
23
|
+
*/
|
|
24
|
+
const renderDeferred = async webComponent => {
|
|
25
|
+
// Enqueue the web component
|
|
26
|
+
invalidatedWebComponents.add(webComponent);
|
|
27
|
+
|
|
28
|
+
// Schedule a rendering task
|
|
29
|
+
await scheduleRenderTask();
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Renders a component synchronously and adds it to the registry of rendered components
|
|
34
|
+
*
|
|
35
|
+
* @param webComponent
|
|
36
|
+
*/
|
|
37
|
+
const renderImmediately = webComponent => {
|
|
38
|
+
eventProvider.fireEvent("beforeComponentRender", webComponent);
|
|
39
|
+
registeredElements.add(webComponent);
|
|
40
|
+
webComponent._render();
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Cancels the rendering of a component, if awaiting to be rendered, and removes it from the registry of rendered components
|
|
45
|
+
*
|
|
46
|
+
* @param webComponent
|
|
47
|
+
*/
|
|
48
|
+
const cancelRender = webComponent => {
|
|
49
|
+
invalidatedWebComponents.remove(webComponent);
|
|
50
|
+
registeredElements.delete(webComponent);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Schedules a rendering task, if not scheduled already
|
|
55
|
+
*/
|
|
56
|
+
const scheduleRenderTask = async () => {
|
|
57
|
+
if (!queuePromise) {
|
|
58
|
+
queuePromise = new Promise(resolve => {
|
|
59
|
+
window.requestAnimationFrame(() => {
|
|
60
|
+
// Render all components in the queue
|
|
61
|
+
|
|
62
|
+
// console.log(`--------------------RENDER TASK START------------------------------`); // eslint-disable-line
|
|
63
|
+
invalidatedWebComponents.process(renderImmediately);
|
|
64
|
+
// console.log(`--------------------RENDER TASK END------------------------------`); // eslint-disable-line
|
|
65
|
+
|
|
66
|
+
// Resolve the promise so that callers of renderDeferred can continue
|
|
67
|
+
queuePromise = null;
|
|
68
|
+
resolve();
|
|
69
|
+
|
|
70
|
+
// Wait for Mutation observer before the render task is considered finished
|
|
71
|
+
if (!mutationObserverTimer) {
|
|
72
|
+
mutationObserverTimer = setTimeout(() => {
|
|
73
|
+
mutationObserverTimer = undefined;
|
|
74
|
+
if (invalidatedWebComponents.isEmpty()) {
|
|
75
|
+
_resolveTaskPromise();
|
|
76
|
+
}
|
|
77
|
+
}, 200);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
await queuePromise;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* return a promise that will be resolved once all invalidated web components are rendered
|
|
88
|
+
*/
|
|
89
|
+
const whenDOMUpdated = () => {
|
|
90
|
+
if (renderTaskPromise) {
|
|
91
|
+
return renderTaskPromise;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
renderTaskPromise = new Promise(resolve => {
|
|
95
|
+
renderTaskPromiseResolve = resolve;
|
|
96
|
+
window.requestAnimationFrame(() => {
|
|
97
|
+
if (invalidatedWebComponents.isEmpty()) {
|
|
98
|
+
renderTaskPromise = undefined;
|
|
99
|
+
resolve();
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
return renderTaskPromise;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const whenAllCustomElementsAreDefined = () => {
|
|
108
|
+
const definedPromises = getAllRegisteredTags().map(tag => customElements.whenDefined(tag));
|
|
109
|
+
return Promise.all(definedPromises);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const renderFinished = async () => {
|
|
113
|
+
await whenAllCustomElementsAreDefined();
|
|
114
|
+
await whenDOMUpdated();
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const _resolveTaskPromise = () => {
|
|
118
|
+
if (!invalidatedWebComponents.isEmpty()) {
|
|
119
|
+
// More updates are pending. Resolve will be called again
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (renderTaskPromiseResolve) {
|
|
124
|
+
renderTaskPromiseResolve();
|
|
125
|
+
renderTaskPromiseResolve = undefined;
|
|
126
|
+
renderTaskPromise = undefined;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Re-renders all UI5 Elements on the page, with the option to specify filters to rerender only some components.
|
|
132
|
+
*
|
|
133
|
+
* Usage:
|
|
134
|
+
* reRenderAllUI5Elements() -> re-renders all components
|
|
135
|
+
* reRenderAllUI5Elements({tag: "ui5-button"}) -> re-renders only instances of ui5-button
|
|
136
|
+
* reRenderAllUI5Elements({rtlAware: true}) -> re-renders only rtlAware components
|
|
137
|
+
* reRenderAllUI5Elements({languageAware: true}) -> re-renders only languageAware components
|
|
138
|
+
* reRenderAllUI5Elements({themeAware: true}) -> re-renders only themeAware components
|
|
139
|
+
* reRenderAllUI5Elements({rtlAware: true, languageAware: true}) -> re-renders components that are rtlAware or languageAware
|
|
140
|
+
* etc...
|
|
141
|
+
*
|
|
142
|
+
* @public
|
|
143
|
+
* @param {Object|undefined} filters - Object with keys that can be "rtlAware" or "languageAware"
|
|
144
|
+
* @returns {Promise<void>}
|
|
145
|
+
*/
|
|
146
|
+
const reRenderAllUI5Elements = async filters => {
|
|
147
|
+
registeredElements.forEach(element => {
|
|
148
|
+
const tag = element.constructor.getMetadata().getTag();
|
|
149
|
+
const rtlAware = isRtlAware(element.constructor);
|
|
150
|
+
const languageAware = element.constructor.getMetadata().isLanguageAware();
|
|
151
|
+
const themeAware = element.constructor.getMetadata().isThemeAware();
|
|
152
|
+
if (!filters || (filters.tag === tag) || (filters.rtlAware && rtlAware) || (filters.languageAware && languageAware) || (filters.themeAware && themeAware)) {
|
|
153
|
+
renderDeferred(element);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
await renderFinished();
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const attachBeforeComponentRender = listener => {
|
|
160
|
+
eventProvider.attachEvent("beforeComponentRender", listener);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const detachBeforeComponentRender = listener => {
|
|
164
|
+
eventProvider.detachEvent("beforeComponentRender", listener);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export {
|
|
168
|
+
renderDeferred,
|
|
169
|
+
renderImmediately,
|
|
170
|
+
cancelRender,
|
|
171
|
+
renderFinished,
|
|
172
|
+
reRenderAllUI5Elements,
|
|
173
|
+
attachBeforeComponentRender,
|
|
174
|
+
detachBeforeComponentRender,
|
|
175
|
+
};
|
package/dist/RenderQueue.js
CHANGED
|
@@ -1,41 +1,65 @@
|
|
|
1
|
+
const MAX_PROCESS_COUNT = 10;
|
|
2
|
+
|
|
1
3
|
class RenderQueue {
|
|
2
4
|
constructor() {
|
|
3
5
|
this.list = []; // Used to store the web components in order
|
|
4
|
-
this.
|
|
6
|
+
this.lookup = new Set(); // Used for faster search
|
|
5
7
|
}
|
|
6
8
|
|
|
7
9
|
add(webComponent) {
|
|
8
|
-
if (this.
|
|
9
|
-
return
|
|
10
|
+
if (this.lookup.has(webComponent)) {
|
|
11
|
+
return;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
let deferredResolve;
|
|
13
|
-
const promise = new Promise(resolve => {
|
|
14
|
-
deferredResolve = resolve;
|
|
15
|
-
});
|
|
16
|
-
promise._deferredResolve = deferredResolve;
|
|
17
|
-
|
|
18
14
|
this.list.push(webComponent);
|
|
19
|
-
this.
|
|
15
|
+
this.lookup.add(webComponent);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
remove(webComponent) {
|
|
19
|
+
if (!this.lookup.has(webComponent)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
this.list = this.list.filter(item => item !== webComponent);
|
|
24
|
+
this.lookup.delete(webComponent);
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
shift() {
|
|
25
28
|
const webComponent = this.list.shift();
|
|
26
29
|
if (webComponent) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return { webComponent, promise };
|
|
30
|
+
this.lookup.delete(webComponent);
|
|
31
|
+
return webComponent;
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
return this.list;
|
|
35
|
+
isEmpty() {
|
|
36
|
+
return this.list.length === 0;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
isAdded(webComponent) {
|
|
38
|
-
return this.
|
|
40
|
+
return this.lookup.has(webComponent);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Processes the whole queue by executing the callback on each component,
|
|
45
|
+
* while also imposing restrictions on how many times a component may be processed.
|
|
46
|
+
*
|
|
47
|
+
* @param callback - function with one argument (the web component to be processed)
|
|
48
|
+
*/
|
|
49
|
+
process(callback) {
|
|
50
|
+
let webComponent;
|
|
51
|
+
const stats = new Map();
|
|
52
|
+
|
|
53
|
+
webComponent = this.shift();
|
|
54
|
+
while (webComponent) {
|
|
55
|
+
const timesProcessed = stats.get(webComponent) || 0;
|
|
56
|
+
if (timesProcessed > MAX_PROCESS_COUNT) {
|
|
57
|
+
throw new Error(`Web component processed too many times this task, max allowed is: ${MAX_PROCESS_COUNT}`);
|
|
58
|
+
}
|
|
59
|
+
callback(webComponent);
|
|
60
|
+
stats.set(webComponent, timesProcessed + 1);
|
|
61
|
+
webComponent = this.shift();
|
|
62
|
+
}
|
|
39
63
|
}
|
|
40
64
|
}
|
|
41
65
|
|
package/dist/RenderScheduler.js
CHANGED
|
@@ -1,145 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// Tells whether a render task is currently scheduled
|
|
7
|
-
let renderTaskId;
|
|
8
|
-
|
|
9
|
-
// Queue for invalidated web components
|
|
10
|
-
const invalidatedWebComponents = new RenderQueue();
|
|
11
|
-
|
|
12
|
-
let renderTaskPromise,
|
|
13
|
-
renderTaskPromiseResolve,
|
|
14
|
-
taskResult;
|
|
15
|
-
|
|
16
|
-
let mutationObserverTimer;
|
|
1
|
+
import {
|
|
2
|
+
renderDeferred,
|
|
3
|
+
renderImmediately,
|
|
4
|
+
renderFinished,
|
|
5
|
+
} from "./Render.js";
|
|
17
6
|
|
|
18
7
|
/**
|
|
19
|
-
*
|
|
20
|
-
* This is always asynchronous
|
|
8
|
+
* @deprecated Use the Render.js module instead
|
|
21
9
|
*/
|
|
22
10
|
class RenderScheduler {
|
|
23
|
-
constructor() {
|
|
24
|
-
throw new Error("Static class");
|
|
25
|
-
}
|
|
26
|
-
|
|
27
11
|
/**
|
|
28
|
-
*
|
|
12
|
+
* Schedules a render task (if not already scheduled) to render the component
|
|
13
|
+
*
|
|
29
14
|
* @param webComponent
|
|
15
|
+
* @returns {Promise}
|
|
16
|
+
* @deprecated Use renderDeferred from the Render.js module instead
|
|
30
17
|
*/
|
|
31
|
-
static renderDeferred(webComponent) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// Schedule a rendering task
|
|
36
|
-
RenderScheduler.scheduleRenderTask();
|
|
37
|
-
return res;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
static renderImmediately(webComponent) {
|
|
41
|
-
// Enqueue the web component
|
|
42
|
-
const res = invalidatedWebComponents.add(webComponent);
|
|
43
|
-
|
|
44
|
-
// Immediately start a render task
|
|
45
|
-
RenderScheduler.runRenderTask();
|
|
46
|
-
return res;
|
|
18
|
+
static async renderDeferred(webComponent) {
|
|
19
|
+
console.log("RenderScheduler.renderDeferred is deprecated, please use renderDeferred, exported by Render.js instead"); // eslint-disable-line
|
|
20
|
+
await renderDeferred(webComponent);
|
|
47
21
|
}
|
|
48
22
|
|
|
49
23
|
/**
|
|
50
|
-
*
|
|
24
|
+
* Renders a component synchronously
|
|
25
|
+
*
|
|
26
|
+
* @param webComponent
|
|
27
|
+
* @deprecated Use renderImmediately from the Render.js module instead
|
|
51
28
|
*/
|
|
52
|
-
static
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
// renderTaskId = Promise.resolve().then(RenderScheduler.renderWebComponents); // Micro task
|
|
56
|
-
renderTaskId = window.requestAnimationFrame(RenderScheduler.renderWebComponents); // AF
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
static runRenderTask() {
|
|
61
|
-
if (!renderTaskId) {
|
|
62
|
-
renderTaskId = 1; // prevent another rendering task from being scheduled, all web components should use this task
|
|
63
|
-
RenderScheduler.renderWebComponents();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
static renderWebComponents() {
|
|
68
|
-
// console.log("------------- NEW RENDER TASK ---------------");
|
|
69
|
-
|
|
70
|
-
let webComponentInfo,
|
|
71
|
-
webComponent,
|
|
72
|
-
promise;
|
|
73
|
-
const renderStats = new Map();
|
|
74
|
-
while (webComponentInfo = invalidatedWebComponents.shift()) { // eslint-disable-line
|
|
75
|
-
webComponent = webComponentInfo.webComponent;
|
|
76
|
-
promise = webComponentInfo.promise;
|
|
77
|
-
|
|
78
|
-
const timesRerendered = renderStats.get(webComponent) || 0;
|
|
79
|
-
if (timesRerendered > MAX_RERENDER_COUNT) {
|
|
80
|
-
// console.warn("WARNING RERENDER", webComponent);
|
|
81
|
-
throw new Error(`Web component re-rendered too many times this task, max allowed is: ${MAX_RERENDER_COUNT}`);
|
|
82
|
-
}
|
|
83
|
-
webComponent._render();
|
|
84
|
-
promise._deferredResolve();
|
|
85
|
-
renderStats.set(webComponent, timesRerendered + 1);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// wait for Mutation observer just in case
|
|
89
|
-
if (!mutationObserverTimer) {
|
|
90
|
-
mutationObserverTimer = setTimeout(() => {
|
|
91
|
-
mutationObserverTimer = undefined;
|
|
92
|
-
if (invalidatedWebComponents.getList().length === 0) {
|
|
93
|
-
RenderScheduler._resolveTaskPromise();
|
|
94
|
-
}
|
|
95
|
-
}, 200);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
renderTaskId = undefined;
|
|
29
|
+
static renderImmediately(webComponent) {
|
|
30
|
+
console.log("RenderScheduler.renderImmediately is deprecated, please use renderImmediately, exported by Render.js instead"); // eslint-disable-line
|
|
31
|
+
return renderImmediately(webComponent);
|
|
99
32
|
}
|
|
100
33
|
|
|
101
34
|
/**
|
|
102
|
-
*
|
|
35
|
+
* @deprecated Use renderFinished from the Render.js module instead
|
|
36
|
+
* @returns {Promise<void>}
|
|
103
37
|
*/
|
|
104
|
-
static whenDOMUpdated() {
|
|
105
|
-
if (renderTaskPromise) {
|
|
106
|
-
return renderTaskPromise;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
renderTaskPromise = new Promise(resolve => {
|
|
110
|
-
renderTaskPromiseResolve = resolve;
|
|
111
|
-
window.requestAnimationFrame(() => {
|
|
112
|
-
if (invalidatedWebComponents.getList().length === 0) {
|
|
113
|
-
renderTaskPromise = undefined;
|
|
114
|
-
resolve();
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
return renderTaskPromise;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
static whenAllCustomElementsAreDefined() {
|
|
123
|
-
const definedPromises = getAllRegisteredTags().map(tag => customElements.whenDefined(tag));
|
|
124
|
-
return Promise.all(definedPromises);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
38
|
static async whenFinished() {
|
|
128
|
-
|
|
129
|
-
await
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
static _resolveTaskPromise() {
|
|
133
|
-
if (invalidatedWebComponents.getList().length > 0) {
|
|
134
|
-
// More updates are pending. Resolve will be called again
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (renderTaskPromiseResolve) {
|
|
139
|
-
renderTaskPromiseResolve.call(this, taskResult);
|
|
140
|
-
renderTaskPromiseResolve = undefined;
|
|
141
|
-
renderTaskPromise = undefined;
|
|
142
|
-
}
|
|
39
|
+
console.log("RenderScheduler.whenFinished is deprecated, please use renderFinished, exported by Render.js instead"); // eslint-disable-line
|
|
40
|
+
await renderFinished();
|
|
143
41
|
}
|
|
144
42
|
}
|
|
145
43
|
|