@ui5/webcomponents-base 0.0.0-e7dd012d7 → 0.0.0-e818f286e
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 +314 -0
- package/README.md +53 -7
- package/bundle.esm.js +20 -20
- package/dist/AssetRegistry.js +8 -9
- package/dist/Boot.js +59 -0
- package/dist/CSP.js +59 -0
- package/dist/CustomElementsRegistry.js +60 -4
- package/dist/CustomElementsScope.js +20 -98
- package/dist/CustomElementsScopeUtils.js +108 -0
- package/dist/DOMObserver.js +65 -0
- package/dist/Device.js +71 -773
- package/dist/EventProvider.js +30 -26
- package/dist/FeaturesRegistry.js +4 -1
- package/dist/FontFace.js +7 -95
- package/dist/InitialConfiguration.js +37 -21
- package/dist/Keys.js +98 -0
- package/dist/ManagedStyles.js +83 -0
- package/dist/MediaRange.js +109 -0
- package/dist/{util/parseProperties.js → PropertiesFileFormat.js} +6 -0
- package/dist/Render.js +175 -0
- package/dist/RenderScheduler.js +16 -138
- package/dist/Runtimes.js +107 -0
- package/dist/StaticArea.js +1 -29
- package/dist/StaticAreaItem.js +58 -65
- package/dist/SystemCSSVars.js +4 -25
- package/dist/UI5Element.js +315 -382
- package/dist/UI5ElementMetadata.js +132 -17
- package/dist/asset-registries/Icons.js +117 -14
- package/dist/asset-registries/Illustrations.js +30 -0
- package/dist/asset-registries/LocaleData.js +97 -68
- package/dist/asset-registries/Themes.js +29 -35
- package/dist/asset-registries/i18n.js +62 -49
- package/dist/assets/bundle.esm.81ba431e.js +43 -0
- package/dist/assets-meta/IconCollectionsAlias.js +18 -0
- package/dist/config/Icons.js +52 -0
- package/dist/config/Language.js +18 -20
- 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 +238 -201
- package/dist/delegate/ResizeHandler.js +78 -37
- 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 +41 -6
- 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/i18nBundle.js +38 -4
- package/dist/locale/applyDirection.js +6 -4
- package/dist/locale/directionChange.js +32 -0
- package/dist/locale/getEffectiveDir.js +28 -0
- package/dist/locale/languageChange.js +1 -1
- package/dist/renderer/LitRenderer.js +39 -18
- package/dist/renderer/directives/style-map.js +72 -0
- package/dist/renderer/executeTemplate.js +19 -2
- 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 +25 -5
- package/dist/theming/applyTheme.js +11 -16
- package/dist/theming/getConstructableStyle.js +7 -6
- package/dist/theming/getEffectiveLinksHrefs.js +27 -0
- package/dist/theming/getEffectiveStyle.js +24 -8
- package/dist/theming/getStylesString.js +4 -2
- 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 +4 -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/PopupState.js +1 -1
- package/dist/types/ValueState.js +1 -1
- package/dist/updateShadowRoot.js +29 -0
- package/dist/util/AriaLabelHelper.js +6 -8
- package/dist/util/Caret.js +32 -0
- package/dist/util/ColorConversion.js +398 -0
- package/dist/util/FocusableElements.js +22 -9
- 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/isDefaultSlotProvided.js +11 -0
- package/dist/util/isElementInView.js +15 -0
- package/dist/util/isNodeHidden.js +1 -1
- package/dist/util/isNodeTabbable.js +4 -4
- 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 -13
- package/src/AssetRegistry.js +8 -9
- package/src/Boot.js +59 -0
- package/src/CSP.js +59 -0
- package/src/CustomElementsRegistry.js +60 -4
- package/src/CustomElementsScope.js +20 -98
- package/src/CustomElementsScopeUtils.js +108 -0
- package/src/DOMObserver.js +65 -0
- package/src/Device.js +71 -773
- package/src/EventProvider.js +30 -26
- package/src/FeaturesRegistry.js +4 -1
- package/src/FontFace.js +7 -95
- package/src/InitialConfiguration.js +37 -21
- package/src/Keys.js +98 -0
- package/src/ManagedStyles.js +83 -0
- package/src/MediaRange.js +109 -0
- package/src/{util/parseProperties.js → PropertiesFileFormat.js} +6 -0
- package/src/Render.js +175 -0
- package/src/RenderScheduler.js +16 -138
- package/src/Runtimes.js +107 -0
- package/src/StaticArea.js +1 -29
- package/src/StaticAreaItem.js +58 -65
- package/src/SystemCSSVars.js +4 -25
- package/src/UI5Element.js +315 -382
- package/src/UI5ElementMetadata.js +132 -17
- package/src/asset-registries/Icons.js +117 -14
- package/src/asset-registries/Illustrations.js +30 -0
- package/src/asset-registries/LocaleData.js +97 -68
- package/src/asset-registries/Themes.js +29 -35
- package/src/asset-registries/i18n.js +62 -49
- package/src/assets-meta/IconCollectionsAlias.js +18 -0
- package/src/config/Icons.js +52 -0
- package/src/config/Language.js +18 -20
- 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 +238 -201
- package/src/delegate/ResizeHandler.js +78 -37
- 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 +41 -6
- package/src/i18nBundle.js +38 -4
- package/src/locale/applyDirection.js +6 -4
- package/src/locale/directionChange.js +32 -0
- package/src/locale/getEffectiveDir.js +28 -0
- package/src/locale/languageChange.js +1 -1
- package/src/renderer/LitRenderer.js +39 -18
- package/src/renderer/directives/style-map.js +72 -0
- package/src/renderer/executeTemplate.js +19 -2
- package/src/theming/CustomStyle.js +25 -5
- package/src/theming/applyTheme.js +11 -16
- package/src/theming/getConstructableStyle.js +7 -6
- package/src/theming/getEffectiveLinksHrefs.js +27 -0
- package/src/theming/getEffectiveStyle.js +24 -8
- package/src/theming/getStylesString.js +4 -2
- 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 +4 -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/PopupState.js +1 -1
- package/src/types/ValueState.js +1 -1
- package/src/updateShadowRoot.js +29 -0
- package/src/util/AriaLabelHelper.js +6 -8
- package/src/util/Caret.js +32 -0
- package/src/util/ColorConversion.js +398 -0
- package/src/util/FocusableElements.js +22 -9
- 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/isDefaultSlotProvided.js +11 -0
- package/src/util/isElementInView.js +15 -0
- package/src/util/isNodeHidden.js +1 -1
- package/src/util/isNodeTabbable.js +4 -4
- 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 -73
- package/dist/boot.js +0 -34
- package/dist/compatibility/DOMObserver.js +0 -62
- package/dist/compatibility/patchNodeValue.js +0 -24
- package/dist/compatibility/whenPolyfillLoaded.js +0 -26
- package/dist/config/AssetsPath.js +0 -17
- package/dist/delegate/CustomResize.js +0 -78
- package/dist/delegate/NativeResize.js +0 -45
- package/dist/features/PropertiesFormatSupport.js +0 -8
- package/dist/features/browsersupport/Edge.js +0 -6
- package/dist/features/browsersupport/IE11.js +0 -42
- package/dist/features/browsersupport/IE11WithWebComponentsPolyfill.js +0 -5
- package/dist/renderer/ifDefined.js +0 -21
- package/dist/renderer/scopeHTML.js +0 -32
- 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 -17
- 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/pages/assets/messagebundle_de.properties +0 -1
- package/dist/test-resources/pages/assets/messagebundle_en.properties +0 -1
- package/dist/test-resources/pages/assets/messagebundle_es.properties +0 -1
- package/dist/test-resources/pages/assets/messagebundle_fr.properties +0 -1
- package/dist/test-resources/pages/i18n.html +0 -40
- 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 -96
- 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 -68
- package/dist/theming/adaptCSSForIE.js +0 -95
- package/dist/theming/createComponentStyleTag.js +0 -54
- 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.parseFloat.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/util/EffectiveAssetPath.js +0 -27
- package/dist/util/encodeCSS.js +0 -24
- package/dist/util/findNodeOwner.js +0 -35
- package/dist/util/isSlot.js +0 -3
- 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 -73
- package/src/boot.js +0 -34
- package/src/compatibility/DOMObserver.js +0 -62
- package/src/compatibility/patchNodeValue.js +0 -24
- package/src/compatibility/whenPolyfillLoaded.js +0 -26
- package/src/config/AssetsPath.js +0 -17
- package/src/delegate/CustomResize.js +0 -78
- package/src/delegate/NativeResize.js +0 -45
- package/src/features/PropertiesFormatSupport.js +0 -8
- package/src/features/browsersupport/Edge.js +0 -6
- package/src/features/browsersupport/IE11.js +0 -42
- package/src/features/browsersupport/IE11WithWebComponentsPolyfill.js +0 -5
- package/src/renderer/ifDefined.js +0 -21
- package/src/renderer/scopeHTML.js +0 -32
- package/src/theming/CSSVarsPonyfill.js +0 -68
- package/src/theming/adaptCSSForIE.js +0 -95
- package/src/theming/createComponentStyleTag.js +0 -54
- 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.parseFloat.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
- package/src/util/EffectiveAssetPath.js +0 -27
- package/src/util/encodeCSS.js +0 -24
- package/src/util/findNodeOwner.js +0 -35
- package/src/util/isSlot.js +0 -3
|
@@ -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;
|
|
@@ -15,6 +15,12 @@ const mEscapes = {
|
|
|
15
15
|
"\\t": "\t",
|
|
16
16
|
};
|
|
17
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
|
+
*/
|
|
18
24
|
const parseProperties = sText => {
|
|
19
25
|
const properties = {},
|
|
20
26
|
aLines = sText.split(rLines);
|
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/RenderScheduler.js
CHANGED
|
@@ -1,165 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// Queue for invalidated web components
|
|
8
|
-
const invalidatedWebComponents = new RenderQueue();
|
|
9
|
-
|
|
10
|
-
let renderTaskPromise,
|
|
11
|
-
renderTaskPromiseResolve;
|
|
12
|
-
|
|
13
|
-
let mutationObserverTimer;
|
|
14
|
-
|
|
15
|
-
let queuePromise;
|
|
1
|
+
import {
|
|
2
|
+
renderDeferred,
|
|
3
|
+
renderImmediately,
|
|
4
|
+
renderFinished,
|
|
5
|
+
} from "./Render.js";
|
|
16
6
|
|
|
17
7
|
/**
|
|
18
|
-
*
|
|
19
|
-
* This is always asynchronous
|
|
8
|
+
* @deprecated Use the Render.js module instead
|
|
20
9
|
*/
|
|
21
10
|
class RenderScheduler {
|
|
22
|
-
constructor() {
|
|
23
|
-
throw new Error("Static class");
|
|
24
|
-
}
|
|
25
|
-
|
|
26
11
|
/**
|
|
27
12
|
* Schedules a render task (if not already scheduled) to render the component
|
|
28
13
|
*
|
|
29
14
|
* @param webComponent
|
|
30
15
|
* @returns {Promise}
|
|
16
|
+
* @deprecated Use renderDeferred from the Render.js module instead
|
|
31
17
|
*/
|
|
32
18
|
static async renderDeferred(webComponent) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// Schedule a rendering task
|
|
37
|
-
await RenderScheduler.scheduleRenderTask();
|
|
19
|
+
console.log("RenderScheduler.renderDeferred is deprecated, please use renderDeferred, exported by Render.js instead"); // eslint-disable-line
|
|
20
|
+
await renderDeferred(webComponent);
|
|
38
21
|
}
|
|
39
22
|
|
|
40
23
|
/**
|
|
41
24
|
* Renders a component synchronously
|
|
42
25
|
*
|
|
43
26
|
* @param webComponent
|
|
27
|
+
* @deprecated Use renderImmediately from the Render.js module instead
|
|
44
28
|
*/
|
|
45
29
|
static renderImmediately(webComponent) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Cancels the rendering of a component, added to the queue with renderDeferred
|
|
51
|
-
*
|
|
52
|
-
* @param webComponent
|
|
53
|
-
*/
|
|
54
|
-
static cancelRender(webComponent) {
|
|
55
|
-
invalidatedWebComponents.remove(webComponent);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Schedules a rendering task, if not scheduled already
|
|
60
|
-
*/
|
|
61
|
-
static async scheduleRenderTask() {
|
|
62
|
-
if (!queuePromise) {
|
|
63
|
-
queuePromise = new Promise(resolve => {
|
|
64
|
-
window.requestAnimationFrame(() => {
|
|
65
|
-
// Render all components in the queue
|
|
66
|
-
invalidatedWebComponents.process(component => component._render());
|
|
67
|
-
|
|
68
|
-
// Resolve the promise so that callers of renderDeferred can continue
|
|
69
|
-
queuePromise = null;
|
|
70
|
-
resolve();
|
|
71
|
-
|
|
72
|
-
// Wait for Mutation observer before the render task is considered finished
|
|
73
|
-
if (!mutationObserverTimer) {
|
|
74
|
-
mutationObserverTimer = setTimeout(() => {
|
|
75
|
-
mutationObserverTimer = undefined;
|
|
76
|
-
if (invalidatedWebComponents.isEmpty()) {
|
|
77
|
-
RenderScheduler._resolveTaskPromise();
|
|
78
|
-
}
|
|
79
|
-
}, 200);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
await queuePromise;
|
|
30
|
+
console.log("RenderScheduler.renderImmediately is deprecated, please use renderImmediately, exported by Render.js instead"); // eslint-disable-line
|
|
31
|
+
return renderImmediately(webComponent);
|
|
86
32
|
}
|
|
87
33
|
|
|
88
34
|
/**
|
|
89
|
-
*
|
|
35
|
+
* @deprecated Use renderFinished from the Render.js module instead
|
|
36
|
+
* @returns {Promise<void>}
|
|
90
37
|
*/
|
|
91
|
-
static whenDOMUpdated() {
|
|
92
|
-
if (renderTaskPromise) {
|
|
93
|
-
return renderTaskPromise;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
renderTaskPromise = new Promise(resolve => {
|
|
97
|
-
renderTaskPromiseResolve = resolve;
|
|
98
|
-
window.requestAnimationFrame(() => {
|
|
99
|
-
if (invalidatedWebComponents.isEmpty()) {
|
|
100
|
-
renderTaskPromise = undefined;
|
|
101
|
-
resolve();
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
return renderTaskPromise;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
static whenAllCustomElementsAreDefined() {
|
|
110
|
-
const definedPromises = getAllRegisteredTags().map(tag => customElements.whenDefined(tag));
|
|
111
|
-
return Promise.all(definedPromises);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
38
|
static async whenFinished() {
|
|
115
|
-
|
|
116
|
-
await
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
static _resolveTaskPromise() {
|
|
120
|
-
if (!invalidatedWebComponents.isEmpty()) {
|
|
121
|
-
// More updates are pending. Resolve will be called again
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (renderTaskPromiseResolve) {
|
|
126
|
-
renderTaskPromiseResolve.call(this);
|
|
127
|
-
renderTaskPromiseResolve = undefined;
|
|
128
|
-
renderTaskPromise = undefined;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
static register(element) {
|
|
133
|
-
registeredElements.add(element);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
static deregister(element) {
|
|
137
|
-
registeredElements.delete(element);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Re-renders all UI5 Elements on the page, with the option to specify filters to rerender only some components.
|
|
142
|
-
*
|
|
143
|
-
* Usage:
|
|
144
|
-
* reRenderAllUI5Elements() -> rerenders all components
|
|
145
|
-
* reRenderAllUI5Elements({tag: "ui5-button"}) -> re-renders only instances of ui5-button
|
|
146
|
-
* reRenderAllUI5Elements({rtlAware: true}) -> re-renders only rtlAware components
|
|
147
|
-
* reRenderAllUI5Elements({languageAware: true}) -> re-renders only languageAware components
|
|
148
|
-
* reRenderAllUI5Elements({rtlAware: true, languageAware: true}) -> re-renders components that are rtlAware or languageAware
|
|
149
|
-
* etc...
|
|
150
|
-
*
|
|
151
|
-
* @public
|
|
152
|
-
* @param {Object|undefined} filters - Object with keys that can be "rtlAware" or "languageAware"
|
|
153
|
-
*/
|
|
154
|
-
static reRenderAllUI5Elements(filters) {
|
|
155
|
-
registeredElements.forEach(element => {
|
|
156
|
-
const tag = element.constructor.getMetadata().getTag();
|
|
157
|
-
const rtlAware = isRtlAware(element.constructor);
|
|
158
|
-
const languageAware = element.constructor.getMetadata().isLanguageAware();
|
|
159
|
-
if (!filters || (filters.tag === tag) || (filters.rtlAware && rtlAware) || (filters.languageAware && languageAware)) {
|
|
160
|
-
RenderScheduler.renderDeferred(element);
|
|
161
|
-
}
|
|
162
|
-
});
|
|
39
|
+
console.log("RenderScheduler.whenFinished is deprecated, please use renderFinished, exported by Render.js instead"); // eslint-disable-line
|
|
40
|
+
await renderFinished();
|
|
163
41
|
}
|
|
164
42
|
}
|
|
165
43
|
|
package/dist/Runtimes.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import VersionInfo from "./generated/VersionInfo.js";
|
|
2
|
+
import getSharedResource from "./getSharedResource.js";
|
|
3
|
+
|
|
4
|
+
let currentRuntimeIndex;
|
|
5
|
+
let currentRuntimeAlias = "";
|
|
6
|
+
|
|
7
|
+
const compareCache = new Map();
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Central registry where all runtimes register themselves by pushing an object.
|
|
11
|
+
* The index in the registry servers as an ID for the runtime.
|
|
12
|
+
* @type {*}
|
|
13
|
+
*/
|
|
14
|
+
const Runtimes = getSharedResource("Runtimes", []);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Registers the current runtime in the shared runtimes resource registry
|
|
18
|
+
*/
|
|
19
|
+
const registerCurrentRuntime = () => {
|
|
20
|
+
if (currentRuntimeIndex === undefined) {
|
|
21
|
+
currentRuntimeIndex = Runtimes.length;
|
|
22
|
+
Runtimes.push({
|
|
23
|
+
...VersionInfo,
|
|
24
|
+
alias: currentRuntimeAlias,
|
|
25
|
+
description: `Runtime ${currentRuntimeIndex} - ver ${VersionInfo.version}${currentRuntimeAlias ? ` (${currentRuntimeAlias})` : ""}`,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Returns the index of the current runtime's object in the shared runtimes resource registry
|
|
32
|
+
* @returns {*}
|
|
33
|
+
*/
|
|
34
|
+
const getCurrentRuntimeIndex = () => {
|
|
35
|
+
return currentRuntimeIndex;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Compares two runtimes and returns 1 if the first is of a bigger version, -1 if the second is of a bigger version, and 0 if equal
|
|
40
|
+
* @param index1 The index of the first runtime to compare
|
|
41
|
+
* @param index2 The index of the second runtime to compare
|
|
42
|
+
* @returns {number}
|
|
43
|
+
*/
|
|
44
|
+
const compareRuntimes = (index1, index2) => {
|
|
45
|
+
const cacheIndex = `${index1},${index2}`;
|
|
46
|
+
if (compareCache.has(cacheIndex)) {
|
|
47
|
+
return compareCache.get(cacheIndex);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const runtime1 = Runtimes[index1];
|
|
51
|
+
const runtime2 = Runtimes[index2];
|
|
52
|
+
|
|
53
|
+
if (!runtime1 || !runtime2) {
|
|
54
|
+
throw new Error("Invalid runtime index supplied");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// If any of the two is a next version, bigger buildTime wins
|
|
58
|
+
if (runtime1.isNext || runtime2.isNext) {
|
|
59
|
+
return runtime1.buildTime - runtime2.buildTime;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// If major versions differ, bigger one wins
|
|
63
|
+
const majorDiff = runtime1.major - runtime2.major;
|
|
64
|
+
if (majorDiff) {
|
|
65
|
+
return majorDiff;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// If minor versions differ, bigger one wins
|
|
69
|
+
const minorDiff = runtime1.minor - runtime2.minor;
|
|
70
|
+
if (minorDiff) {
|
|
71
|
+
return minorDiff;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// If patch versions differ, bigger one wins
|
|
75
|
+
const patchDiff = runtime1.patch - runtime2.patch;
|
|
76
|
+
if (patchDiff) {
|
|
77
|
+
return patchDiff;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Bigger suffix wins, f.e. rc10 > rc9
|
|
81
|
+
// Important: suffix is alphanumeric, must use natural compare
|
|
82
|
+
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: "base" });
|
|
83
|
+
const result = collator.compare(runtime1.suffix, runtime2.suffix);
|
|
84
|
+
|
|
85
|
+
compareCache.set(cacheIndex, result);
|
|
86
|
+
return result;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Set an alias for the the current app/library/microfrontend which will appear in debug messages and console warnings
|
|
91
|
+
* @param alias
|
|
92
|
+
*/
|
|
93
|
+
const setRuntimeAlias = alias => {
|
|
94
|
+
currentRuntimeAlias = alias;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const getAllRuntimes = () => {
|
|
98
|
+
return Runtimes;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export {
|
|
102
|
+
getCurrentRuntimeIndex,
|
|
103
|
+
registerCurrentRuntime,
|
|
104
|
+
compareRuntimes,
|
|
105
|
+
setRuntimeAlias,
|
|
106
|
+
getAllRuntimes,
|
|
107
|
+
};
|
package/dist/StaticArea.js
CHANGED
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
import getSingletonElementInstance from "./util/getSingletonElementInstance.js";
|
|
2
|
-
|
|
3
|
-
const getStaticAreaInstance = () => getSingletonElementInstance("ui5-static-area");
|
|
4
|
-
|
|
5
|
-
const removeStaticArea = () => {
|
|
6
|
-
getStaticAreaInstance().destroy();
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
class StaticAreaElement extends HTMLElement {
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
get isUI5Element() {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
destroy() {
|
|
19
|
-
const staticAreaDomRef = document.querySelector(this.tagName.toLowerCase());
|
|
20
|
-
staticAreaDomRef.parentElement.removeChild(staticAreaDomRef);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
1
|
if (!customElements.get("ui5-static-area")) {
|
|
25
|
-
customElements.define("ui5-static-area",
|
|
2
|
+
customElements.define("ui5-static-area", class extends HTMLElement {});
|
|
26
3
|
}
|
|
27
|
-
|
|
28
|
-
export {
|
|
29
|
-
getStaticAreaInstance,
|
|
30
|
-
removeStaticArea,
|
|
31
|
-
};
|