@ui5/webcomponents-base 0.0.0-1b568f22b → 0.0.0-1e08ebdef
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 +179 -0
- package/README.md +26 -2
- package/bundle.esm.js +16 -7
- package/dist/AssetRegistry.js +8 -7
- package/dist/Boot.js +43 -0
- package/dist/CSP.js +59 -0
- package/dist/CustomElementsScope.js +108 -0
- package/dist/DOMObserver.js +65 -0
- package/dist/Device.js +66 -776
- package/dist/EventProvider.js +30 -26
- package/dist/FontFace.js +19 -62
- package/dist/InitialConfiguration.js +43 -8
- package/dist/Keys.js +78 -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/RenderQueue.js +41 -17
- package/dist/RenderScheduler.js +24 -158
- package/dist/StaticArea.js +1 -39
- package/dist/StaticAreaItem.js +56 -63
- package/dist/SystemCSSVars.js +4 -25
- package/dist/Theming.js +2 -1
- package/dist/UI5Element.js +391 -351
- package/dist/UI5ElementMetadata.js +157 -17
- package/dist/asset-registries/Icons.js +129 -14
- package/dist/asset-registries/Illustrations.js +30 -0
- package/dist/asset-registries/LocaleData.js +99 -65
- package/dist/asset-registries/Themes.js +23 -32
- package/dist/asset-registries/i18n.js +63 -48
- package/dist/assets-meta/IconCollectionsAlias.js +18 -0
- package/dist/config/AnimationMode.js +11 -1
- package/dist/config/Language.js +33 -6
- package/dist/config/Theme.js +14 -0
- package/dist/css/FontFace.css +45 -0
- package/dist/css/OverrideFontFace.css +32 -0
- package/dist/css/SystemCSSVars.css +17 -0
- package/dist/delegate/ItemNavigation.js +239 -170
- package/dist/delegate/ResizeHandler.js +78 -37
- package/dist/delegate/ScrollEnablement.js +49 -20
- package/dist/features/OpenUI5Support.js +42 -7
- package/dist/generated/AssetParameters.js +1 -1
- 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/isLegacyBrowser.js +3 -0
- package/dist/locale/applyDirection.js +6 -4
- 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 +1 -1
- package/dist/renderer/LitRenderer.js +26 -7
- package/dist/renderer/directives/style-map.js +72 -0
- package/dist/renderer/executeTemplate.js +17 -0
- package/dist/resources/bundle.esm.js +17 -109
- package/dist/resources/bundle.esm.js.map +1 -1
- 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/test-resources/assets/Themes.js +10 -6
- package/dist/test-resources/elements/Parent.js +6 -2
- package/dist/test-resources/elements/WithStaticArea.js +2 -1
- package/dist/test-resources/pages/AllTestElements.html +3 -3
- package/dist/test-resources/pages/Configuration.html +0 -2
- package/dist/test-resources/pages/ConfigurationScript.html +0 -2
- package/dist/test-resources/pages/assets/messagebundle_de.properties +1 -0
- package/dist/test-resources/pages/assets/messagebundle_en.properties +1 -0
- package/dist/test-resources/pages/assets/messagebundle_es.properties +1 -0
- package/dist/test-resources/pages/assets/messagebundle_fr.properties +1 -0
- package/dist/test-resources/pages/i18n.html +33 -0
- package/dist/test-resources/specs/ConfigurationChange.spec.js +10 -8
- package/dist/test-resources/specs/ConfigurationScript.spec.js +25 -23
- package/dist/test-resources/specs/ConfigurationURL.spec.js +65 -17
- package/dist/test-resources/specs/CustomTheme.spec.js +9 -7
- package/dist/test-resources/specs/EventProvider.spec.js +63 -0
- package/dist/test-resources/specs/StaticArea.spec.js +56 -12
- package/dist/test-resources/specs/Theming.spec.js +12 -10
- package/dist/test-resources/specs/UI5ElementInvalidation.js +54 -70
- package/dist/test-resources/specs/UI5ElementLifecycle.js +19 -14
- package/dist/test-resources/specs/UI5ElementListenForChildPropChanges.spec.js +25 -51
- package/dist/test-resources/specs/UI5ElementMetadataExt.js +9 -7
- package/dist/test-resources/specs/UI5ElementPropertyValidation.js +7 -5
- package/dist/test-resources/specs/UI5ElementPropsAndAttrs.spec.js +37 -35
- package/dist/test-resources/specs/UI5ElementShadowDOM.js +10 -8
- package/dist/test-resources/specs/UI5ElementSlots.js +10 -8
- 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 +20 -0
- package/dist/theming/getEffectiveStyle.js +23 -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 +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 +30 -0
- package/dist/util/AriaLabelHelper.js +41 -0
- package/dist/util/Caret.js +45 -0
- package/dist/util/ColorConversion.js +370 -0
- package/dist/util/FocusableElements.js +25 -7
- package/dist/util/HTMLSanitizer.js +7 -0
- package/dist/util/InvisibleMessage.js +58 -0
- package/dist/util/PopupUtils.js +93 -0
- package/dist/util/SlotsHelper.js +43 -0
- package/dist/util/TabbableElements.js +1 -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/getSingletonElementInstance.js +13 -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/hash.txt +1 -0
- package/index.js +1 -1
- package/lib/generate-asset-parameters/index.js +0 -1
- package/lib/generate-styles/index.js +18 -0
- package/package-scripts.js +37 -19
- package/package.json +20 -13
- package/src/AssetRegistry.js +8 -7
- package/src/Boot.js +43 -0
- package/src/CSP.js +59 -0
- package/src/CustomElementsScope.js +108 -0
- package/src/DOMObserver.js +65 -0
- package/src/Device.js +66 -776
- package/src/EventProvider.js +30 -26
- package/src/FontFace.js +19 -62
- package/src/InitialConfiguration.js +43 -8
- package/src/Keys.js +78 -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/RenderQueue.js +41 -17
- package/src/RenderScheduler.js +24 -158
- package/src/StaticArea.js +1 -39
- package/src/StaticAreaItem.js +56 -63
- package/src/SystemCSSVars.js +4 -25
- package/src/Theming.js +2 -1
- package/src/UI5Element.js +391 -351
- package/src/UI5ElementMetadata.js +157 -17
- package/src/asset-registries/Icons.js +129 -14
- package/src/asset-registries/Illustrations.js +30 -0
- package/src/asset-registries/LocaleData.js +99 -65
- package/src/asset-registries/Themes.js +23 -32
- package/src/asset-registries/i18n.js +63 -48
- package/src/assets-meta/IconCollectionsAlias.js +18 -0
- package/src/config/AnimationMode.js +11 -1
- package/src/config/Language.js +33 -6
- package/src/config/Theme.js +14 -0
- package/src/css/FontFace.css +45 -0
- package/src/css/OverrideFontFace.css +32 -0
- package/src/css/SystemCSSVars.css +17 -0
- package/src/delegate/ItemNavigation.js +239 -170
- package/src/delegate/ResizeHandler.js +78 -37
- package/src/delegate/ScrollEnablement.js +49 -20
- package/src/features/OpenUI5Support.js +42 -7
- package/src/getSharedResource.js +30 -0
- package/src/i18nBundle.js +58 -5
- package/src/isLegacyBrowser.js +3 -0
- package/src/locale/applyDirection.js +6 -4
- 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 +1 -1
- package/src/renderer/LitRenderer.js +26 -7
- package/src/renderer/directives/style-map.js +72 -0
- package/src/renderer/executeTemplate.js +17 -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 +20 -0
- package/src/theming/getEffectiveStyle.js +23 -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 +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 +30 -0
- package/src/util/AriaLabelHelper.js +41 -0
- package/src/util/Caret.js +45 -0
- package/src/util/ColorConversion.js +370 -0
- package/src/util/FocusableElements.js +25 -7
- package/src/util/HTMLSanitizer.js +7 -0
- package/src/util/InvisibleMessage.js +58 -0
- package/src/util/PopupUtils.js +93 -0
- package/src/util/SlotsHelper.js +43 -0
- package/src/util/TabbableElements.js +1 -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/getSingletonElementInstance.js +13 -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/used-modules.txt +10 -0
- package/bundle.es5.js +0 -28
- package/dist/SVGIconRegistry.js +0 -60
- 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/delegate/CustomResize.js +0 -78
- package/dist/delegate/NativeResize.js +0 -44
- package/dist/features/PropertiesFormatSupport.js +0 -8
- 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/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/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 -60
- 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/delegate/CustomResize.js +0 -78
- package/src/delegate/NativeResize.js +0 -44
- package/src/features/PropertiesFormatSupport.js +0 -8
- 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
- package/src/util/isSlot.js +0 -3
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,177 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const registeredElements = new Set();
|
|
7
|
-
|
|
8
|
-
// Tells whether a render task is currently scheduled
|
|
9
|
-
let renderTaskId;
|
|
10
|
-
|
|
11
|
-
// Queue for invalidated web components
|
|
12
|
-
const invalidatedWebComponents = new RenderQueue();
|
|
13
|
-
|
|
14
|
-
let renderTaskPromise,
|
|
15
|
-
renderTaskPromiseResolve,
|
|
16
|
-
taskResult;
|
|
17
|
-
|
|
18
|
-
let mutationObserverTimer;
|
|
1
|
+
import {
|
|
2
|
+
renderDeferred,
|
|
3
|
+
renderImmediately,
|
|
4
|
+
renderFinished,
|
|
5
|
+
} from "./Render.js";
|
|
19
6
|
|
|
20
7
|
/**
|
|
21
|
-
*
|
|
22
|
-
* This is always asynchronous
|
|
8
|
+
* @deprecated Use the Render.js module instead
|
|
23
9
|
*/
|
|
24
10
|
class RenderScheduler {
|
|
25
|
-
constructor() {
|
|
26
|
-
throw new Error("Static class");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
11
|
/**
|
|
30
|
-
*
|
|
12
|
+
* Schedules a render task (if not already scheduled) to render the component
|
|
13
|
+
*
|
|
31
14
|
* @param webComponent
|
|
15
|
+
* @returns {Promise}
|
|
16
|
+
* @deprecated Use renderDeferred from the Render.js module instead
|
|
32
17
|
*/
|
|
33
|
-
static renderDeferred(webComponent) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// Schedule a rendering task
|
|
38
|
-
RenderScheduler.scheduleRenderTask();
|
|
39
|
-
return res;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
static renderImmediately(webComponent) {
|
|
43
|
-
// Enqueue the web component
|
|
44
|
-
const res = invalidatedWebComponents.add(webComponent);
|
|
45
|
-
|
|
46
|
-
// Immediately start a render task
|
|
47
|
-
RenderScheduler.runRenderTask();
|
|
48
|
-
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);
|
|
49
21
|
}
|
|
50
22
|
|
|
51
23
|
/**
|
|
52
|
-
*
|
|
24
|
+
* Renders a component synchronously
|
|
25
|
+
*
|
|
26
|
+
* @param webComponent
|
|
27
|
+
* @deprecated Use renderImmediately from the Render.js module instead
|
|
53
28
|
*/
|
|
54
|
-
static
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// renderTaskId = Promise.resolve().then(RenderScheduler.renderWebComponents); // Micro task
|
|
58
|
-
renderTaskId = window.requestAnimationFrame(RenderScheduler.renderWebComponents); // AF
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
static runRenderTask() {
|
|
63
|
-
if (!renderTaskId) {
|
|
64
|
-
renderTaskId = 1; // prevent another rendering task from being scheduled, all web components should use this task
|
|
65
|
-
RenderScheduler.renderWebComponents();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
static renderWebComponents() {
|
|
70
|
-
// console.log("------------- NEW RENDER TASK ---------------");
|
|
71
|
-
|
|
72
|
-
let webComponentInfo,
|
|
73
|
-
webComponent,
|
|
74
|
-
promise;
|
|
75
|
-
const renderStats = new Map();
|
|
76
|
-
while (webComponentInfo = invalidatedWebComponents.shift()) { // eslint-disable-line
|
|
77
|
-
webComponent = webComponentInfo.webComponent;
|
|
78
|
-
promise = webComponentInfo.promise;
|
|
79
|
-
|
|
80
|
-
const timesRerendered = renderStats.get(webComponent) || 0;
|
|
81
|
-
if (timesRerendered > MAX_RERENDER_COUNT) {
|
|
82
|
-
// console.warn("WARNING RERENDER", webComponent);
|
|
83
|
-
throw new Error(`Web component re-rendered too many times this task, max allowed is: ${MAX_RERENDER_COUNT}`);
|
|
84
|
-
}
|
|
85
|
-
webComponent._render();
|
|
86
|
-
promise._deferredResolve();
|
|
87
|
-
renderStats.set(webComponent, timesRerendered + 1);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// wait for Mutation observer just in case
|
|
91
|
-
if (!mutationObserverTimer) {
|
|
92
|
-
mutationObserverTimer = setTimeout(() => {
|
|
93
|
-
mutationObserverTimer = undefined;
|
|
94
|
-
if (invalidatedWebComponents.getList().length === 0) {
|
|
95
|
-
RenderScheduler._resolveTaskPromise();
|
|
96
|
-
}
|
|
97
|
-
}, 200);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
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);
|
|
101
32
|
}
|
|
102
33
|
|
|
103
34
|
/**
|
|
104
|
-
*
|
|
35
|
+
* @deprecated Use renderFinished from the Render.js module instead
|
|
36
|
+
* @returns {Promise<void>}
|
|
105
37
|
*/
|
|
106
|
-
static whenDOMUpdated() {
|
|
107
|
-
if (renderTaskPromise) {
|
|
108
|
-
return renderTaskPromise;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
renderTaskPromise = new Promise(resolve => {
|
|
112
|
-
renderTaskPromiseResolve = resolve;
|
|
113
|
-
window.requestAnimationFrame(() => {
|
|
114
|
-
if (invalidatedWebComponents.getList().length === 0) {
|
|
115
|
-
renderTaskPromise = undefined;
|
|
116
|
-
resolve();
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
return renderTaskPromise;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
static whenAllCustomElementsAreDefined() {
|
|
125
|
-
const definedPromises = getAllRegisteredTags().map(tag => customElements.whenDefined(tag));
|
|
126
|
-
return Promise.all(definedPromises);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
38
|
static async whenFinished() {
|
|
130
|
-
|
|
131
|
-
await
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
static _resolveTaskPromise() {
|
|
135
|
-
if (invalidatedWebComponents.getList().length > 0) {
|
|
136
|
-
// More updates are pending. Resolve will be called again
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (renderTaskPromiseResolve) {
|
|
141
|
-
renderTaskPromiseResolve.call(this, taskResult);
|
|
142
|
-
renderTaskPromiseResolve = undefined;
|
|
143
|
-
renderTaskPromise = undefined;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
static register(element) {
|
|
148
|
-
registeredElements.add(element);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
static deregister(element) {
|
|
152
|
-
registeredElements.delete(element);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Re-renders all UI5 Elements on the page, with the option to specify filters to rerender only some components.
|
|
157
|
-
*
|
|
158
|
-
* Usage:
|
|
159
|
-
* reRenderAllUI5Elements() -> rerenders all components
|
|
160
|
-
* reRenderAllUI5Elements({rtlAware: true}) -> re-renders only rtlAware components
|
|
161
|
-
* reRenderAllUI5Elements({languageAware: true}) -> re-renders only languageAware components
|
|
162
|
-
* reRenderAllUI5Elements({rtlAware: true, languageAware: true}) -> re-renders components that are rtlAware or languageAware
|
|
163
|
-
*
|
|
164
|
-
* @public
|
|
165
|
-
* @param {Object|undefined} filters - Object with keys that can be "rtlAware" or "languageAware"
|
|
166
|
-
*/
|
|
167
|
-
static reRenderAllUI5Elements(filters) {
|
|
168
|
-
registeredElements.forEach(element => {
|
|
169
|
-
const rtlAware = isRtlAware(element.constructor);
|
|
170
|
-
const languageAware = element.constructor.getMetadata().isLanguageAware();
|
|
171
|
-
if (!filters || (filters.rtlAware && rtlAware) || (filters.languageAware && languageAware)) {
|
|
172
|
-
RenderScheduler.renderDeferred(element);
|
|
173
|
-
}
|
|
174
|
-
});
|
|
39
|
+
console.log("RenderScheduler.whenFinished is deprecated, please use renderFinished, exported by Render.js instead"); // eslint-disable-line
|
|
40
|
+
await renderFinished();
|
|
175
41
|
}
|
|
176
42
|
}
|
|
177
43
|
|
package/dist/StaticArea.js
CHANGED
|
@@ -1,41 +1,3 @@
|
|
|
1
|
-
const getStaticAreaInstance = () => {
|
|
2
|
-
let staticArea = document.querySelector("ui5-static-area");
|
|
3
|
-
|
|
4
|
-
if (staticArea) {
|
|
5
|
-
return staticArea;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// Create static area if it is not present
|
|
9
|
-
const bodyElement = document.body;
|
|
10
|
-
staticArea = document.createElement("ui5-static-area");
|
|
11
|
-
|
|
12
|
-
return bodyElement.insertBefore(staticArea, bodyElement.firstChild);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const removeStaticArea = () => {
|
|
16
|
-
getStaticAreaInstance().destroy();
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
class StaticAreaElement extends HTMLElement {
|
|
20
|
-
constructor() {
|
|
21
|
-
super();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
get isUI5Element() {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
destroy() {
|
|
29
|
-
const staticAreaDomRef = document.querySelector(this.tagName.toLowerCase());
|
|
30
|
-
staticAreaDomRef.parentElement.removeChild(staticAreaDomRef);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
1
|
if (!customElements.get("ui5-static-area")) {
|
|
35
|
-
customElements.define("ui5-static-area",
|
|
2
|
+
customElements.define("ui5-static-area", class extends HTMLElement {});
|
|
36
3
|
}
|
|
37
|
-
|
|
38
|
-
export {
|
|
39
|
-
getStaticAreaInstance,
|
|
40
|
-
removeStaticArea,
|
|
41
|
-
};
|
package/dist/StaticAreaItem.js
CHANGED
|
@@ -1,77 +1,64 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "./StaticArea.js";
|
|
2
|
+
import updateShadowRoot from "./updateShadowRoot.js";
|
|
3
|
+
import { renderFinished } from "./Render.js";
|
|
4
|
+
import getEffectiveContentDensity from "./util/getEffectiveContentDensity.js";
|
|
5
|
+
import { getEffectiveScopingSuffixForTag } from "./CustomElementsScope.js";
|
|
6
|
+
import getEffectiveDir from "./locale/getEffectiveDir.js";
|
|
3
7
|
|
|
4
8
|
/**
|
|
9
|
+
*
|
|
5
10
|
* @class
|
|
6
11
|
* @author SAP SE
|
|
7
12
|
* @private
|
|
8
|
-
* Defines and takes care of ui5-static-are-item items
|
|
9
13
|
*/
|
|
10
|
-
class StaticAreaItem {
|
|
11
|
-
constructor(
|
|
12
|
-
|
|
14
|
+
class StaticAreaItem extends HTMLElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
13
17
|
this._rendered = false;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
isRendered() {
|
|
17
|
-
return this._rendered;
|
|
18
|
+
this.attachShadow({ mode: "open" });
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* @protected
|
|
23
|
+
* @param ownerElement The UI5Element instance that owns this static area item
|
|
22
24
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (!this.staticAreaItemDomRef) {
|
|
28
|
-
// Initial rendering of fragment
|
|
29
|
-
|
|
30
|
-
this.staticAreaItemDomRef = document.createElement("ui5-static-area-item");
|
|
31
|
-
this.staticAreaItemDomRef.attachShadow({ mode: "open" });
|
|
32
|
-
this.staticAreaItemDomRef.classList.add(this.ui5ElementContext._id); // used for getting the popover in the tests
|
|
33
|
-
|
|
34
|
-
getStaticAreaInstance().appendChild(this.staticAreaItemDomRef);
|
|
35
|
-
this._rendered = true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
this.ui5ElementContext.constructor.render(renderResult, this.staticAreaItemDomRef.shadowRoot, stylesToAdd, { eventContext: this.ui5ElementContext });
|
|
25
|
+
setOwnerElement(ownerElement) {
|
|
26
|
+
this.ownerElement = ownerElement;
|
|
27
|
+
this.classList.add(this.ownerElement._id); // used for getting the popover in the tests
|
|
39
28
|
}
|
|
40
29
|
|
|
41
30
|
/**
|
|
31
|
+
* Updates the shadow root of the static area item with the latest state, if rendered
|
|
42
32
|
* @protected
|
|
43
33
|
*/
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const staticArea = getStaticAreaInstance();
|
|
50
|
-
|
|
51
|
-
staticArea.removeChild(this.staticAreaItemDomRef);
|
|
52
|
-
|
|
53
|
-
this.staticAreaItemDomRef = null;
|
|
54
|
-
|
|
55
|
-
// remove static area
|
|
56
|
-
if (staticArea.childElementCount < 1) {
|
|
57
|
-
removeStaticArea();
|
|
34
|
+
update() {
|
|
35
|
+
if (this._rendered) {
|
|
36
|
+
this._updateContentDensity();
|
|
37
|
+
this._updateDirection();
|
|
38
|
+
updateShadowRoot(this.ownerElement, true);
|
|
58
39
|
}
|
|
59
40
|
}
|
|
60
41
|
|
|
61
42
|
/**
|
|
62
|
-
*
|
|
43
|
+
* Sets the correct content density based on the owner element's state
|
|
44
|
+
* @private
|
|
63
45
|
*/
|
|
64
|
-
_updateContentDensity(
|
|
65
|
-
if (
|
|
66
|
-
|
|
46
|
+
_updateContentDensity() {
|
|
47
|
+
if (getEffectiveContentDensity(this.ownerElement) === "compact") {
|
|
48
|
+
this.classList.add("sapUiSizeCompact");
|
|
49
|
+
this.classList.add("ui5-content-density-compact");
|
|
50
|
+
} else {
|
|
51
|
+
this.classList.remove("sapUiSizeCompact");
|
|
52
|
+
this.classList.remove("ui5-content-density-compact");
|
|
67
53
|
}
|
|
54
|
+
}
|
|
68
55
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
56
|
+
_updateDirection() {
|
|
57
|
+
const dir = getEffectiveDir(this.ownerElement);
|
|
58
|
+
if (dir) {
|
|
59
|
+
this.setAttribute("dir", dir);
|
|
72
60
|
} else {
|
|
73
|
-
this.
|
|
74
|
-
this.staticAreaItemDomRef.classList.remove("ui5-content-density-compact");
|
|
61
|
+
this.removeAttribute("dir");
|
|
75
62
|
}
|
|
76
63
|
}
|
|
77
64
|
|
|
@@ -80,26 +67,32 @@ class StaticAreaItem {
|
|
|
80
67
|
* Returns reference to the DOM element where the current fragment is added.
|
|
81
68
|
*/
|
|
82
69
|
async getDomRef() {
|
|
83
|
-
|
|
84
|
-
|
|
70
|
+
this._updateContentDensity();
|
|
71
|
+
if (!this._rendered) {
|
|
72
|
+
this._rendered = true;
|
|
73
|
+
updateShadowRoot(this.ownerElement, true);
|
|
85
74
|
}
|
|
86
|
-
await
|
|
87
|
-
return this.
|
|
75
|
+
await renderFinished(); // Wait for the content of the ui5-static-area-item to be rendered
|
|
76
|
+
return this.shadowRoot;
|
|
88
77
|
}
|
|
89
|
-
}
|
|
90
78
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
79
|
+
static getTag() {
|
|
80
|
+
const pureTag = "ui5-static-area-item";
|
|
81
|
+
const suffix = getEffectiveScopingSuffixForTag(pureTag);
|
|
82
|
+
if (!suffix) {
|
|
83
|
+
return pureTag;
|
|
84
|
+
}
|
|
95
85
|
|
|
96
|
-
|
|
97
|
-
return true;
|
|
86
|
+
return `${pureTag}-${suffix}`;
|
|
98
87
|
}
|
|
99
|
-
}
|
|
100
88
|
|
|
101
|
-
|
|
102
|
-
|
|
89
|
+
static createInstance() {
|
|
90
|
+
if (!customElements.get(StaticAreaItem.getTag())) {
|
|
91
|
+
customElements.define(StaticAreaItem.getTag(), StaticAreaItem);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return document.createElement(this.getTag());
|
|
95
|
+
}
|
|
103
96
|
}
|
|
104
97
|
|
|
105
98
|
export default StaticAreaItem;
|
package/dist/SystemCSSVars.js
CHANGED
|
@@ -1,31 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const systemCSSVars = `
|
|
4
|
-
:root {
|
|
5
|
-
--_ui5_content_density:cozy;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
[data-ui5-compact-size],
|
|
9
|
-
.ui5-content-density-compact,
|
|
10
|
-
.sapUiSizeCompact {
|
|
11
|
-
--_ui5_content_density:compact;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
[dir="rtl"] {
|
|
15
|
-
--_ui5_dir:rtl;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
[dir="ltr"] {
|
|
19
|
-
--_ui5_dir:ltr;
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
1
|
+
import { hasStyle, createStyle } from "./ManagedStyles.js";
|
|
2
|
+
import systemCSSVars from "./generated/css/SystemCSSVars.css.js";
|
|
22
3
|
|
|
23
4
|
const insertSystemCSSVars = () => {
|
|
24
|
-
if (
|
|
25
|
-
|
|
5
|
+
if (!hasStyle("data-ui5-system-css-vars")) {
|
|
6
|
+
createStyle(systemCSSVars, "data-ui5-system-css-vars");
|
|
26
7
|
}
|
|
27
|
-
|
|
28
|
-
createStyleInHead(systemCSSVars, { "data-ui5-system-css-vars": "" });
|
|
29
8
|
};
|
|
30
9
|
|
|
31
10
|
export default insertSystemCSSVars;
|