@ui5/webcomponents-base 0.0.0-354b6d238 → 0.0.0-3790e6927
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/CHANGELOG.md +63 -0
- package/README.md +4 -0
- package/bundle.esm.js +4 -1
- package/dist/EventProvider.js +1 -1
- package/dist/EventProvider.js.map +1 -1
- package/dist/IgnoreCustomElements.d.ts +27 -0
- package/dist/IgnoreCustomElements.js +39 -0
- package/dist/IgnoreCustomElements.js.map +1 -0
- package/dist/InitialConfiguration.js.map +1 -1
- package/dist/ManagedStyles.js +9 -2
- package/dist/ManagedStyles.js.map +1 -1
- package/dist/StaticAreaItem.js +3 -0
- package/dist/StaticAreaItem.js.map +1 -1
- package/dist/UI5Element.d.ts +2 -0
- package/dist/UI5Element.js +17 -4
- package/dist/UI5Element.js.map +1 -1
- package/dist/asset-registries/LocaleData.js.map +1 -1
- package/dist/assets/Boot.c42af4c1.js +9 -0
- package/dist/assets/bundle.esm.5317b298.js +50 -0
- package/dist/config/AnimationMode.d.ts +2 -2
- package/dist/config/AnimationMode.js +1 -1
- package/dist/config/AnimationMode.js.map +1 -1
- package/dist/config/ThemeRoot.d.ts +29 -0
- package/dist/config/ThemeRoot.js +59 -0
- package/dist/config/ThemeRoot.js.map +1 -0
- package/dist/generated/VersionInfo.js +3 -3
- package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.d.ts +4 -0
- package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.js +8 -10
- package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.js.map +1 -0
- package/dist/getSharedResource.js +7 -1
- package/dist/getSharedResource.js.map +1 -1
- package/dist/i18nBundle.js +2 -1
- package/dist/i18nBundle.js.map +1 -1
- package/dist/locale/RTLAwareRegistry.d.ts +1 -1
- package/dist/locale/RTLAwareRegistry.js.map +1 -1
- package/dist/renderer/executeTemplate.js +1 -1
- package/dist/renderer/executeTemplate.js.map +1 -1
- package/dist/theming/applyTheme.js +3 -2
- package/dist/theming/applyTheme.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js.map +1 -1
- package/dist/updateShadowRoot.js +7 -4
- package/dist/updateShadowRoot.js.map +1 -1
- package/dist/util/InvisibleMessage.d.ts +1 -1
- package/dist/util/InvisibleMessage.js.map +1 -1
- package/dist/util/getClassCopy.d.ts +2 -0
- package/dist/util/getSingletonElementInstance.d.ts +10 -1
- package/dist/util/getSingletonElementInstance.js +11 -2
- package/dist/util/getSingletonElementInstance.js.map +1 -1
- package/package-scripts.cjs +1 -1
- package/package.json +2 -2
- package/dist/assets/Boot.68875c9f.js +0 -9
- package/dist/assets/bundle.esm.c0c0e500.js +0 -50
- package/dist/config/ThemeRoots.d.ts +0 -4
- package/dist/config/ThemeRoots.js +0 -28
- package/dist/config/ThemeRoots.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,69 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.14.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.14.0-rc.0...v1.14.0-rc.1) (2023-05-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **framework:** store shared resources as `meta` tag within the `head` ([#7051](https://github.com/SAP/ui5-webcomponents/issues/7051)) ([90722da](https://github.com/SAP/ui5-webcomponents/commit/90722da24600e28f31864e9f2006d18e97c1e596))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **framework:** add `setThemeRoot` public API ([#6970](https://github.com/SAP/ui5-webcomponents/issues/6970)) ([a0ad904](https://github.com/SAP/ui5-webcomponents/commit/a0ad904ea21578ada97dc0c990ec04dbb5072990))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [1.14.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.13.2...v1.14.0-rc.0) (2023-05-18)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **framework:** add `ignoreCustomElements` public API ([#7027](https://github.com/SAP/ui5-webcomponents/issues/7027)) ([776f905](https://github.com/SAP/ui5-webcomponents/commit/776f9058de5b4e37489dd3ef388863edc2627eb3))
|
|
28
|
+
* **framework:** use `template literal notation` for enum types ([#6856](https://github.com/SAP/ui5-webcomponents/issues/6856)) ([0de21e8](https://github.com/SAP/ui5-webcomponents/commit/0de21e8ba37c6a75fd3d2a29a16cc82661619cb1)), closes [#6636](https://github.com/SAP/ui5-webcomponents/issues/6636)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## [1.13.2](https://github.com/SAP/ui5-webcomponents/compare/v1.13.1...v1.13.2) (2023-05-15)
|
|
35
|
+
|
|
36
|
+
**Note:** Version bump only for package @ui5/webcomponents-base
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## [1.13.1](https://github.com/SAP/ui5-webcomponents/compare/v1.13.0-rc.5...v1.13.1) (2023-05-11)
|
|
43
|
+
|
|
44
|
+
**Note:** Version bump only for package @ui5/webcomponents-base
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
# [1.13.0-rc.5](https://github.com/SAP/ui5-webcomponents/compare/v1.13.0-rc.4...v1.13.0-rc.5) (2023-05-11)
|
|
51
|
+
|
|
52
|
+
**Note:** Version bump only for package @ui5/webcomponents-base
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# [1.13.0-rc.4](https://github.com/SAP/ui5-webcomponents/compare/v1.13.0-rc.3...v1.13.0-rc.4) (2023-05-04)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Features
|
|
62
|
+
|
|
63
|
+
* generate TS from HBS templates ([#6558](https://github.com/SAP/ui5-webcomponents/issues/6558)) ([02611b2](https://github.com/SAP/ui5-webcomponents/commit/02611b2e24b2c2a06129b8e60a8bc680d9501e39))
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
6
69
|
# [1.13.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v1.13.0-rc.2...v1.13.0-rc.3) (2023-04-27)
|
|
7
70
|
|
|
8
71
|
|
package/README.md
CHANGED
|
@@ -37,6 +37,10 @@ Contains the base files for all Web Components, most notably `@ui5/webcomponents
|
|
|
37
37
|
- `setCustomElementsScopingRules`
|
|
38
38
|
- `getCustomElementsScopingRules`
|
|
39
39
|
|
|
40
|
+
### `IgnoreCustomElements.js`
|
|
41
|
+
|
|
42
|
+
- `ignoreCustomElements`
|
|
43
|
+
|
|
40
44
|
### `CSP.js`
|
|
41
45
|
- `setPackageCSSRoot`
|
|
42
46
|
- `setUseLinks`
|
package/bundle.esm.js
CHANGED
|
@@ -31,12 +31,13 @@ import { getAnimationMode } from "./dist/config/AnimationMode.js";
|
|
|
31
31
|
import { getLanguage, setLanguage } from "./dist/config/Language.js";
|
|
32
32
|
import { getCalendarType } from "./dist/config/CalendarType.js";
|
|
33
33
|
import { getTheme, setTheme } from "./dist/config/Theme.js";
|
|
34
|
-
import { getThemeRoot } from "./dist/config/
|
|
34
|
+
import { getThemeRoot, setThemeRoot } from "./dist/config/ThemeRoot.js";
|
|
35
35
|
import { getNoConflict, setNoConflict } from "./dist/config/NoConflict.js";
|
|
36
36
|
import { getRTL } from "./dist/config/RTL.js";
|
|
37
37
|
import { getFirstDayOfWeek, getLegacyDateCalendarCustomizing } from "./dist/config/FormatSettings.js";
|
|
38
38
|
import { _getRegisteredNames as getIconNames } from "./dist/asset-registries/Icons.js"
|
|
39
39
|
import applyDirection from "./dist/locale/applyDirection.js";
|
|
40
|
+
import { getCurrentRuntimeIndex } from "./dist/Runtimes.js";
|
|
40
41
|
import LegacyDateFormats from "./dist/features/LegacyDateFormats.js";
|
|
41
42
|
|
|
42
43
|
window["sap-ui-webcomponents-bundle"] = {
|
|
@@ -46,6 +47,7 @@ window["sap-ui-webcomponents-bundle"] = {
|
|
|
46
47
|
setLanguage,
|
|
47
48
|
getTheme,
|
|
48
49
|
getThemeRoot,
|
|
50
|
+
setThemeRoot,
|
|
49
51
|
setTheme,
|
|
50
52
|
getNoConflict,
|
|
51
53
|
setNoConflict,
|
|
@@ -54,6 +56,7 @@ window["sap-ui-webcomponents-bundle"] = {
|
|
|
54
56
|
getFirstDayOfWeek,
|
|
55
57
|
getLegacyDateCalendarCustomizing,
|
|
56
58
|
},
|
|
59
|
+
getCurrentRuntimeIndex,
|
|
57
60
|
getIconNames,
|
|
58
61
|
parseProperties,
|
|
59
62
|
registerI18nLoader,
|
package/dist/EventProvider.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventProvider.js","sourceRoot":"","sources":["../src/EventProvider.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa;IAGlB;QACC,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;IACjC,CAAC;IAED,WAAW,CAAC,SAAiB,EAAE,UAA8D;QAC5F,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,MAAM,cAAc,GAAG,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAEpD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE;YACnC,aAAa,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;YAC3C,OAAO;SACP;QAED,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;YACzC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAChC;IACF,CAAC;IAED,WAAW,CAAC,SAAi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rD,CAAC;IAED,iBAAiB,CAAC,SAAiB,EAAE,UAA8D;QAClG,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,MAAM,cAAc,GAAG,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAEpD,IAAI,CAAC,cAAc,EAAE;YACpB,OAAO,KAAK,CAAC;SACb;QAED,OAAO,cAAc,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC5C,CAAC;IAED,YAAY,CAAC,SAAiB;QAC7B,OAAO,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;CACD;AAED,eAAe,aAAa,CAAC","sourcesContent":["class EventProvider<EventListenerParam, EventListenerReturn> {\n\t_eventRegistry: Map<string, Array<(param: EventListenerParam) => EventListenerReturn>>;\n\n\tconstructor() {\n\t\tthis._eventRegistry = new Map();\n\t}\n\n\tattachEvent(eventName: string, fnFunction: (param: EventListenerParam) => EventListenerReturn) {\n\t\tconst eventRegistry = this._eventRegistry;\n\t\tconst eventListeners = eventRegistry.get(eventName);\n\n\t\tif (!Array.isArray(eventListeners)) {\n\t\t\teventRegistry.set(eventName, [fnFunction]);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!eventListeners.includes(fnFunction)) {\n\t\t\teventListeners.push(fnFunction);\n\t\t}\n\t}\n\n\tdetachEvent(eventName: string, fnFunction: (param: EventListenerParam) => EventListenerReturn) {\n\t\tconst eventRegistry = this._eventRegistry;\n\t\tconst eventListeners = eventRegistry.get(eventName);\n\n\t\tif (!eventListeners) {\n\t\t\treturn;\n\t\t}\n\t\tconst indexOfFnToDetach = eventListeners.indexOf(fnFunction);\n\n\t\tif (indexOfFnToDetach !== -1) {\n\t\t\teventListeners.splice(indexOfFnToDetach, 1);\n\t\t}\n\n\t\tif (eventListeners.length === 0) {\n\t\t\teventRegistry.delete(eventName);\n\t\t}\n\t}\n\n\t/**\n\t * Fires an event and returns the results of all event listeners as an array.\n\t *\n\t * @param eventName the event to fire\n\t * @param data optional data to pass to each event listener\n\t * @returns {Array} an array with the results of all event listeners\n\t */\n\tfireEvent(eventName: string, data: EventListenerParam) {\n\t\tconst eventRegistry = this._eventRegistry;\n\t\tconst eventListeners = eventRegistry.get(eventName);\n\n\t\tif (!eventListeners) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn eventListeners.map(fn => {\n\t\t\treturn fn.call(this, data);\n\t\t});\n\t}\n\n\t/**\n\t * Fires an event and returns a promise that will resolve once all listeners have resolved.\n\t *\n\t * @param eventName the event to fire\n\t * @param data optional data to pass to each event listener\n\t * @returns {Promise} a promise that will resolve when all listeners have resolved\n\t */\n\tfireEventAsync(eventName: string, data: EventListenerParam) {\n\t\treturn Promise.all(this.fireEvent(eventName, data));\n\t}\n\n\tisHandlerAttached(eventName: string, fnFunction: (param: EventListenerParam) => EventListenerReturn) {\n\t\tconst eventRegistry = this._eventRegistry;\n\t\tconst eventListeners = eventRegistry.get(eventName);\n\n\t\tif (!eventListeners) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn eventListeners.includes(fnFunction);\n\t}\n\n\thasListeners(eventName: string) {\n\t\treturn !!this._eventRegistry.get(eventName);\n\t}\n}\n\nexport default EventProvider;\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ignores all custom HTML elements with a given tag prefix to improve the rendering performance of the UI5 Web Components.
|
|
3
|
+
* <br>
|
|
4
|
+
*
|
|
5
|
+
* <b>When used:</b> the UI5 Web Components framework treats all custom HTML elements,
|
|
6
|
+
* starting with the given prefix as if they are standard HTML elements, such as: `div`, `span`, etc, without additional processing.
|
|
7
|
+
* <br>
|
|
8
|
+
*
|
|
9
|
+
* <b>When not used:</b> the framework waits for the slotted children to be defined and registered first,
|
|
10
|
+
* because the state or visual appearance of the parent may rely on the slotted elements/children.
|
|
11
|
+
*
|
|
12
|
+
* <b>Note:</b> We recommend using `ignoreCustomElements` when slotting custom HTML elements (with only semantic purpose)
|
|
13
|
+
* inside UI5 Web Components, to improve the time to render.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
* @since 1.14.0
|
|
17
|
+
* @param { string } tagPrefix
|
|
18
|
+
*/
|
|
19
|
+
declare const ignoreCustomElements: (tagPrefix: string) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Determines whether custom elements with the given tag should be ignored.
|
|
22
|
+
*
|
|
23
|
+
* @private
|
|
24
|
+
* @param { string } tag
|
|
25
|
+
*/
|
|
26
|
+
declare const shouldIgnoreCustomElement: (tag: string) => boolean;
|
|
27
|
+
export { ignoreCustomElements, shouldIgnoreCustomElement, };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tag prefixes to be ignored.
|
|
3
|
+
*/
|
|
4
|
+
const tagPrefixes = [];
|
|
5
|
+
/**
|
|
6
|
+
* Ignores all custom HTML elements with a given tag prefix to improve the rendering performance of the UI5 Web Components.
|
|
7
|
+
* <br>
|
|
8
|
+
*
|
|
9
|
+
* <b>When used:</b> the UI5 Web Components framework treats all custom HTML elements,
|
|
10
|
+
* starting with the given prefix as if they are standard HTML elements, such as: `div`, `span`, etc, without additional processing.
|
|
11
|
+
* <br>
|
|
12
|
+
*
|
|
13
|
+
* <b>When not used:</b> the framework waits for the slotted children to be defined and registered first,
|
|
14
|
+
* because the state or visual appearance of the parent may rely on the slotted elements/children.
|
|
15
|
+
*
|
|
16
|
+
* <b>Note:</b> We recommend using `ignoreCustomElements` when slotting custom HTML elements (with only semantic purpose)
|
|
17
|
+
* inside UI5 Web Components, to improve the time to render.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
* @since 1.14.0
|
|
21
|
+
* @param { string } tagPrefix
|
|
22
|
+
*/
|
|
23
|
+
const ignoreCustomElements = (tagPrefix) => {
|
|
24
|
+
if (typeof tagPrefix !== "string" || !tagPrefix.length) {
|
|
25
|
+
throw new Error("Only string characters for a tag prefix.");
|
|
26
|
+
}
|
|
27
|
+
tagPrefixes.push(tagPrefix);
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Determines whether custom elements with the given tag should be ignored.
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
* @param { string } tag
|
|
34
|
+
*/
|
|
35
|
+
const shouldIgnoreCustomElement = (tag) => {
|
|
36
|
+
return tagPrefixes.some(pref => tag.startsWith(pref));
|
|
37
|
+
};
|
|
38
|
+
export { ignoreCustomElements, shouldIgnoreCustomElement, };
|
|
39
|
+
//# sourceMappingURL=IgnoreCustomElements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IgnoreCustomElements.js","sourceRoot":"","sources":["../src/IgnoreCustomElements.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,GAAkB,EAAE,CAAC;AAEtC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,oBAAoB,GAAG,CAAC,SAAiB,EAAE,EAAE;IAClD,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;QACvD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;KAC5D;IAED,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC7B,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,yBAAyB,GAAG,CAAC,GAAW,EAAW,EAAE;IAC1D,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AACvD,CAAC,CAAC;AAEF,OAAO,EACN,oBAAoB,EACpB,yBAAyB,GACzB,CAAC","sourcesContent":["/**\n * The tag prefixes to be ignored.\n */\nconst tagPrefixes: Array<string> = [];\n\n/**\n * Ignores all custom HTML elements with a given tag prefix to improve the rendering performance of the UI5 Web Components.\n * <br>\n *\n * <b>When used:</b> the UI5 Web Components framework treats all custom HTML elements,\n * starting with the given prefix as if they are standard HTML elements, such as: `div`, `span`, etc, without additional processing.\n * <br>\n *\n * <b>When not used:</b> the framework waits for the slotted children to be defined and registered first,\n * because the state or visual appearance of the parent may rely on the slotted elements/children.\n *\n * <b>Note:</b> We recommend using `ignoreCustomElements` when slotting custom HTML elements (with only semantic purpose)\n * inside UI5 Web Components, to improve the time to render.\n *\n * @public\n * @since 1.14.0\n * @param { string } tagPrefix\n */\nconst ignoreCustomElements = (tagPrefix: string) => {\n\tif (typeof tagPrefix !== \"string\" || !tagPrefix.length) {\n\t\tthrow new Error(\"Only string characters for a tag prefix.\");\n\t}\n\n\ttagPrefixes.push(tagPrefix);\n};\n\n/**\n * Determines whether custom elements with the given tag should be ignored.\n *\n * @private\n * @param { string } tag\n */\nconst shouldIgnoreCustomElement = (tag: string): boolean => {\n\treturn tagPrefixes.some(pref => tag.startsWith(pref));\n};\n\nexport {\n\tignoreCustomElements,\n\tshouldIgnoreCustomElement,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitialConfiguration.js","sourceRoot":"","sources":["../src/InitialConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAGvD,OAAO,aAAa,MAAM,0BAA0B,CAAC;AAGrD,IAAI,WAAW,GAAG,KAAK,CAAC;AAgBxB,IAAI,aAAa,GAAkB;IAClC,aAAa,EAAE,aAAa,CAAC,IAAI;IACjC,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,SAAS;IACpB,GAAG,EAAE,SAAS;IACd,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,YAAY,EAAE,SAAS;IACvB,UAAU,EAAE,KAAK;IACjB,cAAc,EAAE,EAAE;IAClB,oBAA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GAAG,CAAC,EAAE;YACjC,aAAa,CAAC,SAAS,GAAG,4BAA4B,CAAC,KAAK,CAAC,CAAC;SAC9D;KACD;SAAM;QACN,aAAa,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;KAC7B;AACF,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,GAAG,EAAE;IACtC,MAAM,cAAc,GAAG,UAAU,CAAwB,gBAAgB,CAAC,CAAC;IAC3E,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE;QAClD,OAAO;KACP;IAED,MAAM,aAAa,GAAG,cAAc,CAAC,8BAA8B,EAAE,CAAC;IACtE,aAAa,GAAG,KAAK,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC9B,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,WAAW,EAAE;QACnD,OAAO;KACP;IAED,4CAA4C;IAC5C,wBAAwB,EAAE,CAAC;IAE3B,8DAA8D;IAC9D,kBAAkB,EAAE,CAAC;IAErB,yDAAyD;IACzD,yBAAyB,EAAE,CAAC;IAE5B,WAAW,GAAG,IAAI,CAAC;AACpB,CAAC,CAAC;AAEF,OAAO,EACN,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,WAAW,EACX,uBAAuB,EACvB,aAAa,EACb,eAAe,EACf,WAAW,EACX,iBAAiB,GACjB,CAAC","sourcesContent":["import merge from \"./thirdparty/merge.js\";\nimport { getFeature } from \"./FeaturesRegistry.js\";\nimport { DEFAULT_THEME } from \"./generated/AssetParameters.js\";\nimport validateThemeRoot from \"./validateThemeRoot.js\";\nimport type OpenUI5Support from \"./features/OpenUI5Support\";\nimport type { FormatSettings } from \"./config/FormatSettings.js\";\nimport AnimationMode from \"./types/AnimationMode.js\";\nimport CalendarType from \"./types/CalendarType.js\";\n\nlet initialized = false;\n\ntype InitialConfig = {\n\t[key: string]: any,\n\tanimationMode: AnimationMode,\n\ttheme: string,\n\tthemeRoot: string | undefined,\n\trtl: boolean | undefined,\n\tlanguage: string | undefined,\n\ttimezone: string | undefined,\n\tcalendarType: CalendarType | undefined,\n\tnoConflict: boolean,\n\tformatSettings: FormatSettings,\n\tfetchDefaultLanguage: boolean,\n};\n\nlet initialConfig: InitialConfig = {\n\tanimationMode: AnimationMode.Full,\n\ttheme: DEFAULT_THEME,\n\tthemeRoot: undefined,\n\trtl: undefined,\n\tlanguage: undefined,\n\ttimezone: undefined,\n\tcalendarType: undefined,\n\tnoConflict: false, // no URL\n\tformatSettings: {},\n\tfetchDefaultLanguage: false,\n};\n\n/* General settings */\nconst getAnimationMode = () => {\n\tinitConfiguration();\n\treturn initialConfig.animationMode;\n};\n\nconst getTheme = () => {\n\tinitConfiguration();\n\treturn initialConfig.theme;\n};\n\nconst getThemeRoot = () => {\n\tinitConfiguration();\n\treturn initialConfig.themeRoot;\n};\n\nconst getRTL = () => {\n\tinitConfiguration();\n\treturn initialConfig.rtl;\n};\n\nconst getLanguage = () => {\n\tinitConfiguration();\n\treturn initialConfig.language;\n};\n\n/**\n * Returns if the default language, that is inlined at build time,\n * should be fetched over the network instead.\n * @returns {Boolean}\n */\nconst getFetchDefaultLanguage = () => {\n\tinitConfiguration();\n\treturn initialConfig.fetchDefaultLanguage;\n};\n\nconst getNoConflict = () => {\n\tinitConfiguration();\n\treturn initialConfig.noConflict;\n};\n\n/**\n * Get the configured calendar type\n * @returns { String } the name of the configured calendar type\n */\nconst getCalendarType = () => {\n\tinitConfiguration();\n\treturn initialConfig.calendarType;\n};\n\n/**\n * Returns the configured IANA timezone ID.\n * @returns { String } the configured IANA timezone ID, e.g. \"America/New_York\"\n */\nconst getTimezone = () => {\n\tinitConfiguration();\n\treturn initialConfig.timezone;\n};\n\nconst getFormatSettings = () => {\n\tinitConfiguration();\n\treturn initialConfig.formatSettings;\n};\n\nconst booleanMapping = new Map();\nbooleanMapping.set(\"true\", true);\nbooleanMapping.set(\"false\", false);\n\nconst parseConfigurationScript = () => {\n\tconst configScript = document.querySelector(\"[data-ui5-config]\") || document.querySelector(\"[data-id='sap-ui-config']\"); // for backward compatibility\n\n\tlet configJSON;\n\n\tif (configScript) {\n\t\ttry {\n\t\t\tconfigJSON = JSON.parse(configScript.innerHTML);\n\t\t} catch (err) {\n\t\t\tconsole.warn(\"Incorrect data-sap-ui-config format. Please use JSON\"); /* eslint-disable-line */\n\t\t}\n\n\t\tif (configJSON) {\n\t\t\tinitialConfig = merge(initialConfig, configJSON);\n\t\t}\n\t}\n};\n\nconst parseURLParameters = () => {\n\tconst params = new URLSearchParams(window.location.search);\n\n\t// Process \"sap-*\" params first\n\tparams.forEach((value, key) => {\n\t\tconst parts = key.split(\"sap-\").length;\n\t\tif (parts === 0 || parts === key.split(\"sap-ui-\").length) {\n\t\t\treturn;\n\t\t}\n\n\t\tapplyURLParam(key, value, \"sap\");\n\t});\n\n\t// Process \"sap-ui-*\" params\n\tparams.forEach((value, key) => {\n\t\tif (!key.startsWith(\"sap-ui\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tapplyURLParam(key, value, \"sap-ui\");\n\t});\n};\n\nconst normalizeThemeRootParamValue = (value: string) => {\n\tconst themeRoot = value.split(\"@\")[1];\n\n\treturn validateThemeRoot(themeRoot);\n};\n\nconst normalizeThemeParamValue = (param: string, value: string) => {\n\tif (param === \"theme\" && value.includes(\"@\")) { // the theme parameter might have @<URL-TO-THEME> in the value - strip this\n\t\treturn value.split(\"@\")[0];\n\t}\n\n\treturn value;\n};\n\nconst applyURLParam = (key: string, value: string, paramType: string) => {\n\tconst lowerCaseValue = value.toLowerCase();\n\tconst param = key.split(`${paramType}-`)[1];\n\n\tif (booleanMapping.has(value)) {\n\t\tvalue = booleanMapping.get(lowerCaseValue);\n\t}\n\n\tif (param === \"theme\") {\n\t\tinitialConfig.theme = normalizeThemeParamValue(param, value);\n\n\t\tif (value && value.includes(\"@\")) {\n\t\t\tinitialConfig.themeRoot = normalizeThemeRootParamValue(value);\n\t\t}\n\t} else {\n\t\tinitialConfig[param] = value;\n\t}\n};\n\nconst applyOpenUI5Configuration = () => {\n\tconst openUI5Support = getFeature<typeof OpenUI5Support>(\"OpenUI5Support\");\n\tif (!openUI5Support || !openUI5Support.isLoaded()) {\n\t\treturn;\n\t}\n\n\tconst OpenUI5Config = openUI5Support.getConfigurationSettingsObject();\n\tinitialConfig = merge(initialConfig, OpenUI5Config);\n};\n\nconst initConfiguration = () => {\n\tif (typeof document === \"undefined\" || initialized) {\n\t\treturn;\n\t}\n\n\t// 1. Lowest priority - configuration script\n\tparseConfigurationScript();\n\n\t// 2. URL parameters overwrite configuration script parameters\n\tparseURLParameters();\n\n\t// 3. If OpenUI5 is detected, it has the highest priority\n\tapplyOpenUI5Configuration();\n\n\tinitialized = true;\n};\n\nexport {\n\tgetAnimationMode,\n\tgetTheme,\n\tgetThemeRoot,\n\tgetRTL,\n\tgetLanguage,\n\tgetFetchDefaultLanguage,\n\tgetNoConflict,\n\tgetCalendarType,\n\tgetTimezone,\n\tgetFormatSettings,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"InitialConfiguration.js","sourceRoot":"","sources":["../src/InitialConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAGvD,OAAO,aAAa,MAAM,0BAA0B,CAAC;AAGrD,IAAI,WAAW,GAAG,KAAK,CAAC;AAgBxB,IAAI,aAAa,GAAkB;IAClC,aAAa,EAAE,aAAa,CAAC,IAAI;IACjC,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,SAAS;IACpB,GAAG,EAAE,SAAS;IACd,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,YAAY,EAAE,SAAS;IACv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AAC;QAE7D,IAAI,KAAK,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACjC,aAAa,CAAC,SAAS,GAAG,4BAA4B,CAAC,KAAK,CAAC,CAAC;SAC9D;KACD;SAAM;QACN,aAAa,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;KAC7B;AACF,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,GAAG,EAAE;IACtC,MAAM,cAAc,GAAG,UAAU,CAAwB,gBAAgB,CAAC,CAAC;IAC3E,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE;QAClD,OAAO;KACP;IAED,MAAM,aAAa,GAAG,cAAc,CAAC,8BAA8B,EAAE,CAAC;IACtE,aAAa,GAAG,KAAK,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC9B,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,WAAW,EAAE;QACnD,OAAO;KACP;IAED,4CAA4C;IAC5C,wBAAwB,EAAE,CAAC;IAE3B,8DAA8D;IAC9D,kBAAkB,EAAE,CAAC;IAErB,yDAAyD;IACzD,yBAAyB,EAAE,CAAC;IAE5B,WAAW,GAAG,IAAI,CAAC;AACpB,CAAC,CAAC;AAEF,OAAO,EACN,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,WAAW,EACX,uBAAuB,EACvB,aAAa,EACb,eAAe,EACf,WAAW,EACX,iBAAiB,GACjB,CAAC","sourcesContent":["import merge from \"./thirdparty/merge.js\";\nimport { getFeature } from \"./FeaturesRegistry.js\";\nimport { DEFAULT_THEME } from \"./generated/AssetParameters.js\";\nimport validateThemeRoot from \"./validateThemeRoot.js\";\nimport type OpenUI5Support from \"./features/OpenUI5Support.js\";\nimport type { FormatSettings } from \"./config/FormatSettings.js\";\nimport AnimationMode from \"./types/AnimationMode.js\";\nimport CalendarType from \"./types/CalendarType.js\";\n\nlet initialized = false;\n\ntype InitialConfig = {\n\t[key: string]: any,\n\tanimationMode: AnimationMode,\n\ttheme: string,\n\tthemeRoot: string | undefined,\n\trtl: boolean | undefined,\n\tlanguage: string | undefined,\n\tcalendarType: CalendarType | undefined,\n\ttimezone: string | undefined,\n\tnoConflict: boolean,\n\tformatSettings: FormatSettings,\n\tfetchDefaultLanguage: boolean,\n};\n\nlet initialConfig: InitialConfig = {\n\tanimationMode: AnimationMode.Full,\n\ttheme: DEFAULT_THEME,\n\tthemeRoot: undefined,\n\trtl: undefined,\n\tlanguage: undefined,\n\ttimezone: undefined,\n\tcalendarType: undefined,\n\tnoConflict: false, // no URL\n\tformatSettings: {},\n\tfetchDefaultLanguage: false,\n};\n\n/* General settings */\nconst getAnimationMode = () => {\n\tinitConfiguration();\n\treturn initialConfig.animationMode;\n};\n\nconst getTheme = () => {\n\tinitConfiguration();\n\treturn initialConfig.theme;\n};\n\nconst getThemeRoot = () => {\n\tinitConfiguration();\n\treturn initialConfig.themeRoot;\n};\n\nconst getRTL = () => {\n\tinitConfiguration();\n\treturn initialConfig.rtl;\n};\n\nconst getLanguage = () => {\n\tinitConfiguration();\n\treturn initialConfig.language;\n};\n\n/**\n * Returns if the default language, that is inlined at build time,\n * should be fetched over the network instead.\n * @returns {Boolean}\n */\nconst getFetchDefaultLanguage = () => {\n\tinitConfiguration();\n\treturn initialConfig.fetchDefaultLanguage;\n};\n\nconst getNoConflict = () => {\n\tinitConfiguration();\n\treturn initialConfig.noConflict;\n};\n\n/**\n * Get the configured calendar type\n * @returns { String } the name of the configured calendar type\n */\nconst getCalendarType = () => {\n\tinitConfiguration();\n\treturn initialConfig.calendarType;\n};\n\n/**\n * Returns the configured IANA timezone ID.\n * @returns { String } the configured IANA timezone ID, e.g. \"America/New_York\"\n */\nconst getTimezone = () => {\n\tinitConfiguration();\n\treturn initialConfig.timezone;\n};\n\nconst getFormatSettings = () => {\n\tinitConfiguration();\n\treturn initialConfig.formatSettings;\n};\n\nconst booleanMapping = new Map();\nbooleanMapping.set(\"true\", true);\nbooleanMapping.set(\"false\", false);\n\nconst parseConfigurationScript = () => {\n\tconst configScript = document.querySelector(\"[data-ui5-config]\") || document.querySelector(\"[data-id='sap-ui-config']\"); // for backward compatibility\n\n\tlet configJSON;\n\n\tif (configScript) {\n\t\ttry {\n\t\t\tconfigJSON = JSON.parse(configScript.innerHTML);\n\t\t} catch (err) {\n\t\t\tconsole.warn(\"Incorrect data-sap-ui-config format. Please use JSON\"); /* eslint-disable-line */\n\t\t}\n\n\t\tif (configJSON) {\n\t\t\tinitialConfig = merge(initialConfig, configJSON);\n\t\t}\n\t}\n};\n\nconst parseURLParameters = () => {\n\tconst params = new URLSearchParams(window.location.search);\n\n\t// Process \"sap-*\" params first\n\tparams.forEach((value, key) => {\n\t\tconst parts = key.split(\"sap-\").length;\n\t\tif (parts === 0 || parts === key.split(\"sap-ui-\").length) {\n\t\t\treturn;\n\t\t}\n\n\t\tapplyURLParam(key, value, \"sap\");\n\t});\n\n\t// Process \"sap-ui-*\" params\n\tparams.forEach((value, key) => {\n\t\tif (!key.startsWith(\"sap-ui\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tapplyURLParam(key, value, \"sap-ui\");\n\t});\n};\n\nconst normalizeThemeRootParamValue = (value: string) => {\n\tconst themeRoot = value.split(\"@\")[1];\n\n\treturn validateThemeRoot(themeRoot);\n};\n\nconst normalizeThemeParamValue = (param: string, value: string) => {\n\tif (param === \"theme\" && value.includes(\"@\")) { // the theme parameter might have @<URL-TO-THEME> in the value - strip this\n\t\treturn value.split(\"@\")[0];\n\t}\n\n\treturn value;\n};\n\nconst applyURLParam = (key: string, value: string, paramType: string) => {\n\tconst lowerCaseValue = value.toLowerCase();\n\tconst param = key.split(`${paramType}-`)[1];\n\n\tif (booleanMapping.has(value)) {\n\t\tvalue = booleanMapping.get(lowerCaseValue);\n\t}\n\n\tif (param === \"theme\") {\n\t\tinitialConfig.theme = normalizeThemeParamValue(param, value);\n\n\t\tif (value && value.includes(\"@\")) {\n\t\t\tinitialConfig.themeRoot = normalizeThemeRootParamValue(value);\n\t\t}\n\t} else {\n\t\tinitialConfig[param] = value;\n\t}\n};\n\nconst applyOpenUI5Configuration = () => {\n\tconst openUI5Support = getFeature<typeof OpenUI5Support>(\"OpenUI5Support\");\n\tif (!openUI5Support || !openUI5Support.isLoaded()) {\n\t\treturn;\n\t}\n\n\tconst OpenUI5Config = openUI5Support.getConfigurationSettingsObject();\n\tinitialConfig = merge(initialConfig, OpenUI5Config);\n};\n\nconst initConfiguration = () => {\n\tif (typeof document === \"undefined\" || initialized) {\n\t\treturn;\n\t}\n\n\t// 1. Lowest priority - configuration script\n\tparseConfigurationScript();\n\n\t// 2. URL parameters overwrite configuration script parameters\n\tparseURLParameters();\n\n\t// 3. If OpenUI5 is detected, it has the highest priority\n\tapplyOpenUI5Configuration();\n\n\tinitialized = true;\n};\n\nexport {\n\tgetAnimationMode,\n\tgetTheme,\n\tgetThemeRoot,\n\tgetRTL,\n\tgetLanguage,\n\tgetFetchDefaultLanguage,\n\tgetNoConflict,\n\tgetCalendarType,\n\tgetTimezone,\n\tgetFormatSettings,\n};\n"]}
|
package/dist/ManagedStyles.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import createStyleInHead from "./util/createStyleInHead.js";
|
|
2
2
|
import createLinkInHead from "./util/createLinkInHead.js";
|
|
3
3
|
import { shouldUseLinks, getUrl } from "./CSP.js";
|
|
4
|
+
import { getCurrentRuntimeIndex } from "./Runtimes.js";
|
|
4
5
|
const getStyleId = (name, value) => {
|
|
5
6
|
return value ? `${name}|${value}` : name;
|
|
6
7
|
};
|
|
7
8
|
const createStyle = (data, name, value = "") => {
|
|
8
|
-
|
|
9
|
+
let content = typeof data === "string" ? data : data.content;
|
|
10
|
+
if (content.includes("[_ui5host]")) {
|
|
11
|
+
content = content.replaceAll("[_ui5host]", `[_ui5rt${getCurrentRuntimeIndex()}]`);
|
|
12
|
+
}
|
|
9
13
|
if (shouldUseLinks()) {
|
|
10
14
|
const attributes = {};
|
|
11
15
|
attributes[name] = value;
|
|
@@ -25,7 +29,10 @@ const createStyle = (data, name, value = "") => {
|
|
|
25
29
|
}
|
|
26
30
|
};
|
|
27
31
|
const updateStyle = (data, name, value = "") => {
|
|
28
|
-
|
|
32
|
+
let content = typeof data === "string" ? data : data.content;
|
|
33
|
+
if (content.includes("[_ui5host]")) {
|
|
34
|
+
content = content.replaceAll("[_ui5host]", `[_ui5rt${getCurrentRuntimeIndex()}]`);
|
|
35
|
+
}
|
|
29
36
|
if (shouldUseLinks()) {
|
|
30
37
|
const link = document.querySelector(`head>link[${name}="${value}"]`);
|
|
31
38
|
link.href = getUrl(data.packageName, data.fileName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManagedStyles.js","sourceRoot":"","sources":["../src/ManagedStyles.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAC5D,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"ManagedStyles.js","sourceRoot":"","sources":["../src/ManagedStyles.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAC5D,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,KAAa,EAAE,EAAE;IAClD,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,IAAe,EAAE,IAAY,EAAE,KAAK,GAAG,EA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Head from \"./util/createStyleInHead.js\";\nimport createLinkInHead from \"./util/createLinkInHead.js\";\nimport { shouldUseLinks, getUrl } from \"./CSP.js\";\nimport { StyleData, StyleDataCSP } from \"./types.js\";\nimport { getCurrentRuntimeIndex } from \"./Runtimes.js\";\n\nconst getStyleId = (name: string, value: string) => {\n\treturn value ? `${name}|${value}` : name;\n};\n\nconst createStyle = (data: StyleData, name: string, value = \"\") => {\n\tlet content = typeof data === \"string\" ? data : data.content;\n\n\tif (content.includes(\"[_ui5host]\")) {\n\t\tcontent = content.replaceAll(\"[_ui5host]\", `[_ui5rt${getCurrentRuntimeIndex()}]`);\n\t}\n\n\tif (shouldUseLinks()) {\n\t\tconst attributes = {} as Record<string, any>;\n\t\tattributes[name] = value;\n\t\tconst href = getUrl((data as StyleDataCSP).packageName, (data as StyleDataCSP).fileName);\n\t\tcreateLinkInHead(href, attributes);\n\t} else if (document.adoptedStyleSheets) {\n\t\tconst stylesheet = new CSSStyleSheet();\n\t\tstylesheet.replaceSync(content);\n\t\t(stylesheet as Record<string, any>)._ui5StyleId = getStyleId(name, value); // set an id so that we can find the style later\n\t\tdocument.adoptedStyleSheets = [...document.adoptedStyleSheets, stylesheet];\n\t} else {\n\t\tconst attributes = {} as Record<string, any>;\n\t\tattributes[name] = value;\n\t\tcreateStyleInHead(content, attributes);\n\t}\n};\n\nconst updateStyle = (data: StyleData, name: string, value = \"\") => {\n\tlet content = typeof data === \"string\" ? data : data.content;\n\n\tif (content.includes(\"[_ui5host]\")) {\n\t\tcontent = content.replaceAll(\"[_ui5host]\", `[_ui5rt${getCurrentRuntimeIndex()}]`);\n\t}\n\n\tif (shouldUseLinks()) {\n\t\tconst link = document.querySelector(`head>link[${name}=\"${value}\"]`) as HTMLLinkElement;\n\t\tlink.href = getUrl((data as StyleDataCSP).packageName, (data as StyleDataCSP).fileName);\n\t} else if (document.adoptedStyleSheets) {\n\t\tconst stylesheet = document.adoptedStyleSheets.find(sh => (sh as Record<string, any>)._ui5StyleId === getStyleId(name, value));\n\t\tif (stylesheet) {\n\t\t\tstylesheet.replaceSync(content || \"\");\n\t\t}\n\t} else {\n\t\tconst style = document.querySelector(`head>style[${name}=\"${value}\"]`);\n\t\tif (style) {\n\t\t\tstyle.textContent = content || \"\";\n\t\t}\n\t}\n};\n\nconst hasStyle = (name: string, value = \"\") => {\n\tif (shouldUseLinks()) {\n\t\treturn !!document.querySelector(`head>link[${name}=\"${value}\"]`);\n\t}\n\n\tif (document.adoptedStyleSheets) {\n\t\treturn !!document.adoptedStyleSheets.find(sh => (sh as Record<string, any>)._ui5StyleId === getStyleId(name, value));\n\t}\n\n\treturn !!document.querySelector(`head>style[${name}=\"${value}\"]`);\n};\n\nconst removeStyle = (name: string, value = \"\") => {\n\tif (shouldUseLinks()) {\n\t\tconst linkElement = document.querySelector(`head>link[${name}=\"${value}\"]`);\n\t\tlinkElement?.parentElement?.removeChild(linkElement);\n\t} else if (document.adoptedStyleSheets) {\n\t\tdocument.adoptedStyleSheets = document.adoptedStyleSheets.filter(sh => (sh as Record<string, any>)._ui5StyleId !== getStyleId(name, value));\n\t} else {\n\t\tconst styleElement = document.querySelector(`head > style[${name}=\"${value}\"]`);\n\t\tstyleElement?.parentElement?.removeChild(styleElement);\n\t}\n};\n\nconst createOrUpdateStyle = (data: StyleData, name: string, value = \"\") => {\n\tif (hasStyle(name, value)) {\n\t\tupdateStyle(data, name, value);\n\t} else {\n\t\tcreateStyle(data, name, value);\n\t}\n};\n\nexport {\n\tcreateStyle,\n\thasStyle,\n\tupdateStyle,\n\tremoveStyle,\n\tcreateOrUpdateStyle,\n};\n\nexport type {\n\tStyleData,\n\tStyleDataCSP,\n};\n"]}
|
package/dist/StaticAreaItem.js
CHANGED
|
@@ -4,6 +4,7 @@ import { renderFinished } from "./Render.js";
|
|
|
4
4
|
import getEffectiveContentDensity from "./util/getEffectiveContentDensity.js";
|
|
5
5
|
import { getEffectiveScopingSuffixForTag } from "./CustomElementsScopeUtils.js";
|
|
6
6
|
import getEffectiveDir from "./locale/getEffectiveDir.js";
|
|
7
|
+
import { getCurrentRuntimeIndex } from "./Runtimes.js";
|
|
7
8
|
const pureTagName = "ui5-static-area-item";
|
|
8
9
|
const popupIntegrationAttr = "data-sap-ui-integration-popup-content";
|
|
9
10
|
/**
|
|
@@ -65,6 +66,8 @@ class StaticAreaItem extends HTMLElement {
|
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
_updateAdditionalAttrs() {
|
|
69
|
+
this.setAttribute(`_ui5rt${getCurrentRuntimeIndex()}`, "");
|
|
70
|
+
this.setAttribute("_ui5host", "");
|
|
68
71
|
this.setAttribute(pureTagName, "");
|
|
69
72
|
this.setAttribute(popupIntegrationAttr, "");
|
|
70
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticAreaItem.js","sourceRoot":"","sources":["../src/StaticAreaItem.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AACzB,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,0BAA0B,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,eAAe,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"StaticAreaItem.js","sourceRoot":"","sources":["../src/StaticAreaItem.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAC;AACzB,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,0BAA0B,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,WAAW,GAAG,sBAAsB,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YACjD,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,cAAc,CAAC,CAAC;SAC/D;QAED,OAAO,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,CAAmB,CAAC;IAChE,CAAC;CACD;AAED,eAAe,cAAc,CAAC","sourcesContent":["import \"./StaticArea.js\";\nimport updateShadowRoot from \"./updateShadowRoot.js\";\nimport { renderFinished } from \"./Render.js\";\nimport getEffectiveContentDensity from \"./util/getEffectiveContentDensity.js\";\nimport { getEffectiveScopingSuffixForTag } from \"./CustomElementsScopeUtils.js\";\nimport getEffectiveDir from \"./locale/getEffectiveDir.js\";\nimport type UI5Element from \"./UI5Element.js\";\nimport { getCurrentRuntimeIndex } from \"./Runtimes.js\";\n\nconst pureTagName = \"ui5-static-area-item\";\nconst popupIntegrationAttr = \"data-sap-ui-integration-popup-content\";\n\n/**\n *\n * @class\n * @author SAP SE\n * @private\n */\nclass StaticAreaItem extends HTMLElement {\n\t_rendered: boolean;\n\townerElement?: UI5Element;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis._rendered = false;\n\t\tthis.attachShadow({ mode: \"open\" });\n\t}\n\n\t/**\n\t * @param {UI5Element} ownerElement the UI5Element instance that owns this static area item\n\t */\n\tsetOwnerElement(ownerElement: UI5Element) {\n\t\tthis.ownerElement = ownerElement;\n\t\tthis.classList.add(this.ownerElement._id); // used for getting the popover in the tests\n\t\tif (this.ownerElement.hasAttribute(\"data-ui5-static-stable\")) {\n\t\t\tthis.setAttribute(\"data-ui5-stable\", this.ownerElement.getAttribute(\"data-ui5-static-stable\")!); // stable selector\n\t\t}\n\t}\n\n\t/**\n\t * Updates the shadow root of the static area item with the latest state, if rendered\n\t */\n\tupdate() {\n\t\tif (this._rendered) {\n\t\t\tthis._updateAdditionalAttrs();\n\t\t\tthis._updateContentDensity();\n\t\t\tthis._updateDirection();\n\t\t\tupdateShadowRoot(this.ownerElement!, true);\n\t\t}\n\t}\n\n\t/**\n\t * Sets the correct content density based on the owner element's state\n\t * @private\n\t */\n\t_updateContentDensity() {\n\t\tif (getEffectiveContentDensity(this.ownerElement!) === \"compact\") {\n\t\t\tthis.classList.add(\"sapUiSizeCompact\");\n\t\t\tthis.classList.add(\"ui5-content-density-compact\");\n\t\t} else {\n\t\t\tthis.classList.remove(\"sapUiSizeCompact\");\n\t\t\tthis.classList.remove(\"ui5-content-density-compact\");\n\t\t}\n\t}\n\n\t_updateDirection() {\n\t\tif (this.ownerElement) {\n\t\t\tconst dir = getEffectiveDir(this.ownerElement);\n\t\t\tif (dir) {\n\t\t\t\tthis.setAttribute(\"dir\", dir);\n\t\t\t} else {\n\t\t\t\tthis.removeAttribute(\"dir\");\n\t\t\t}\n\t\t}\n\t}\n\n\t_updateAdditionalAttrs() {\n\t\tthis.setAttribute(`_ui5rt${getCurrentRuntimeIndex()}`, \"\");\n\t\tthis.setAttribute(\"_ui5host\", \"\");\n\t\tthis.setAttribute(pureTagName, \"\");\n\t\tthis.setAttribute(popupIntegrationAttr, \"\");\n\t}\n\n\t/**\n\t * @protected\n\t * Returns reference to the DOM element where the current fragment is added.\n\t */\n\tasync getDomRef() {\n\t\tthis._updateContentDensity();\n\t\tif (!this._rendered) {\n\t\t\tthis._rendered = true;\n\t\t\tupdateShadowRoot(this.ownerElement!, true);\n\t\t}\n\t\tawait renderFinished(); // Wait for the content of the ui5-static-area-item to be rendered\n\t\treturn this.shadowRoot;\n\t}\n\n\tstatic getTag() {\n\t\tconst suffix = getEffectiveScopingSuffixForTag(pureTagName);\n\t\tif (!suffix) {\n\t\t\treturn pureTagName;\n\t\t}\n\n\t\treturn `${pureTagName}-${suffix}`;\n\t}\n\n\tstatic createInstance() {\n\t\tif (!customElements.get(StaticAreaItem.getTag())) {\n\t\t\tcustomElements.define(StaticAreaItem.getTag(), StaticAreaItem);\n\t\t}\n\n\t\treturn document.createElement(this.getTag()) as StaticAreaItem;\n\t}\n}\n\nexport default StaticAreaItem;\n"]}
|
package/dist/UI5Element.d.ts
CHANGED
package/dist/UI5Element.js
CHANGED
|
@@ -5,6 +5,7 @@ import EventProvider from "./EventProvider.js";
|
|
|
5
5
|
import getSingletonElementInstance from "./util/getSingletonElementInstance.js";
|
|
6
6
|
import StaticAreaItem from "./StaticAreaItem.js";
|
|
7
7
|
import updateShadowRoot from "./updateShadowRoot.js";
|
|
8
|
+
import { shouldIgnoreCustomElement } from "./IgnoreCustomElements.js";
|
|
8
9
|
import { renderDeferred, renderImmediately, cancelRender } from "./Render.js";
|
|
9
10
|
import { registerTag, isTagRegistered, recordTagRegistrationFailure } from "./CustomElementsRegistry.js";
|
|
10
11
|
import { observeDOMNode, unobserveDOMNode } from "./DOMObserver.js";
|
|
@@ -16,6 +17,8 @@ import { getSlotName, getSlottedNodesList } from "./util/SlotsHelper.js";
|
|
|
16
17
|
import arraysAreEqual from "./util/arraysAreEqual.js";
|
|
17
18
|
import { markAsRtlAware } from "./locale/RTLAwareRegistry.js";
|
|
18
19
|
import preloadLinks from "./theming/preloadLinks.js";
|
|
20
|
+
import executeTemplate from "./renderer/executeTemplate.js";
|
|
21
|
+
import { getCurrentRuntimeIndex } from "./Runtimes.js";
|
|
19
22
|
let autoId = 0;
|
|
20
23
|
const elementTimeouts = new Map();
|
|
21
24
|
const uniqueDependenciesCache = new Map();
|
|
@@ -81,12 +84,22 @@ class UI5Element extends HTMLElement {
|
|
|
81
84
|
}
|
|
82
85
|
return this.__id;
|
|
83
86
|
}
|
|
87
|
+
render() {
|
|
88
|
+
const template = this.constructor.template;
|
|
89
|
+
return executeTemplate(template, this);
|
|
90
|
+
}
|
|
91
|
+
renderStatic() {
|
|
92
|
+
const template = this.constructor.staticAreaTemplate;
|
|
93
|
+
return executeTemplate(template, this);
|
|
94
|
+
}
|
|
84
95
|
/**
|
|
85
96
|
* Do not call this method from derivatives of UI5Element, use "onEnterDOM" only
|
|
86
97
|
* @private
|
|
87
98
|
*/
|
|
88
99
|
async connectedCallback() {
|
|
89
100
|
const ctor = this.constructor;
|
|
101
|
+
this.setAttribute(`_ui5rt${getCurrentRuntimeIndex()}`, "");
|
|
102
|
+
this.setAttribute("_ui5host", "");
|
|
90
103
|
this.setAttribute(ctor.getMetadata().getPureTag(), "");
|
|
91
104
|
if (ctor.getMetadata().supportsF6FastNavigation()) {
|
|
92
105
|
this.setAttribute("data-sap-ui-fastnavgroup", "true");
|
|
@@ -219,8 +232,8 @@ class UI5Element extends HTMLElement {
|
|
|
219
232
|
// Await for not-yet-defined custom elements
|
|
220
233
|
if (child instanceof HTMLElement) {
|
|
221
234
|
const localName = child.localName;
|
|
222
|
-
const
|
|
223
|
-
if (
|
|
235
|
+
const shouldWaitForCustomElement = localName.includes("-") && !shouldIgnoreCustomElement(localName);
|
|
236
|
+
if (shouldWaitForCustomElement) {
|
|
224
237
|
const isDefined = window.customElements.get(localName);
|
|
225
238
|
if (!isDefined) {
|
|
226
239
|
const whenDefinedPromise = window.customElements.whenDefined(localName); // Class registered, but instances not upgraded yet
|
|
@@ -717,13 +730,13 @@ class UI5Element extends HTMLElement {
|
|
|
717
730
|
* @private
|
|
718
731
|
*/
|
|
719
732
|
static _needsShadowDOM() {
|
|
720
|
-
return !!this.template;
|
|
733
|
+
return !!this.template || Object.prototype.hasOwnProperty.call(this.prototype, "render");
|
|
721
734
|
}
|
|
722
735
|
/**
|
|
723
736
|
* @private
|
|
724
737
|
*/
|
|
725
738
|
static _needsStaticArea() {
|
|
726
|
-
return !!this.staticAreaTemplate;
|
|
739
|
+
return !!this.staticAreaTemplate || Object.prototype.hasOwnProperty.call(this.prototype, "renderStatic");
|
|
727
740
|
}
|
|
728
741
|
/**
|
|
729
742
|
* @public
|