@ui5/webcomponents-base 2.1.0-rc.1 → 2.1.0-rc.3
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 +22 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/FeaturesRegistry.d.ts +10 -1
- package/dist/FeaturesRegistry.js +37 -1
- package/dist/FeaturesRegistry.js.map +1 -1
- package/dist/FontFace.js +6 -1
- package/dist/FontFace.js.map +1 -1
- package/dist/InitialConfiguration.d.ts +2 -1
- package/dist/InitialConfiguration.js +6 -1
- package/dist/InitialConfiguration.js.map +1 -1
- package/dist/UI5Element.d.ts +1 -0
- package/dist/UI5Element.js +13 -2
- package/dist/UI5Element.js.map +1 -1
- package/dist/UI5ElementMetadata.d.ts +6 -0
- package/dist/UI5ElementMetadata.js +7 -0
- package/dist/UI5ElementMetadata.js.map +1 -1
- package/dist/config/Fonts.d.ts +16 -0
- package/dist/config/Fonts.js +26 -0
- package/dist/config/Fonts.js.map +1 -0
- package/dist/custom-elements-internal.json +6 -0
- package/dist/custom-elements.json +6 -0
- package/dist/decorators/customElement.d.ts +1 -0
- package/dist/decorators/customElement.js +4 -1
- package/dist/decorators/customElement.js.map +1 -1
- package/dist/generated/VersionInfo.js +3 -3
- package/dist/generated/VersionInfo.js.map +1 -1
- package/dist/prod/FeaturesRegistry.js +1 -1
- package/dist/prod/FeaturesRegistry.js.map +3 -3
- package/dist/prod/FontFace.js +1 -1
- package/dist/prod/FontFace.js.map +3 -3
- package/dist/prod/InitialConfiguration.js +1 -1
- package/dist/prod/InitialConfiguration.js.map +3 -3
- package/dist/prod/UI5Element.js +1 -1
- package/dist/prod/UI5Element.js.map +3 -3
- package/dist/prod/UI5ElementMetadata.js +1 -1
- package/dist/prod/UI5ElementMetadata.js.map +2 -2
- package/dist/prod/config/Fonts.js +2 -0
- package/dist/prod/config/Fonts.js.map +7 -0
- package/dist/prod/decorators/customElement.js +1 -1
- package/dist/prod/decorators/customElement.js.map +3 -3
- package/dist/prod/generated/VersionInfo.js +1 -1
- package/dist/prod/generated/VersionInfo.js.map +1 -1
- package/dist/util/getClassCopy.d.ts +1 -0
- package/package.json +4 -4
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import type UI5Element from "./UI5Element.js";
|
|
2
|
+
declare abstract class ComponentFeature {
|
|
3
|
+
constructor(...args: any[]);
|
|
4
|
+
static define?: () => Promise<void>;
|
|
5
|
+
static dependencies?: Array<typeof UI5Element>;
|
|
6
|
+
}
|
|
1
7
|
declare const registerFeature: (name: string, feature: object) => void;
|
|
2
8
|
declare const getFeature: <T>(name: string) => T;
|
|
3
|
-
|
|
9
|
+
declare const registerComponentFeature: (name: string, feature: typeof ComponentFeature) => Promise<void>;
|
|
10
|
+
declare const getComponentFeature: <T>(name: string) => T;
|
|
11
|
+
declare const subscribeForFeatureLoad: (name: string, klass: typeof UI5Element, callback: () => void) => void;
|
|
12
|
+
export { registerFeature, getFeature, registerComponentFeature, getComponentFeature, subscribeForFeatureLoad, ComponentFeature, };
|
package/dist/FeaturesRegistry.js
CHANGED
|
@@ -1,9 +1,45 @@
|
|
|
1
|
+
import EventProvider from "./EventProvider.js";
|
|
2
|
+
class ComponentFeature {
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-empty-function
|
|
4
|
+
constructor(...args) { }
|
|
5
|
+
}
|
|
1
6
|
const features = new Map();
|
|
7
|
+
const componentFeatures = new Map();
|
|
8
|
+
const subscribers = new Map();
|
|
9
|
+
const EVENT_NAME = "componentFeatureLoad";
|
|
10
|
+
const eventProvider = new EventProvider();
|
|
11
|
+
const featureLoadEventName = (name) => `${EVENT_NAME}_${name}`;
|
|
2
12
|
const registerFeature = (name, feature) => {
|
|
3
13
|
features.set(name, feature);
|
|
4
14
|
};
|
|
5
15
|
const getFeature = (name) => {
|
|
6
16
|
return features.get(name);
|
|
7
17
|
};
|
|
8
|
-
|
|
18
|
+
const registerComponentFeature = async (name, feature) => {
|
|
19
|
+
await Promise.all(feature.dependencies?.map(dep => dep.define()) || []);
|
|
20
|
+
await feature.define?.();
|
|
21
|
+
componentFeatures.set(name, feature);
|
|
22
|
+
notifyForFeatureLoad(name);
|
|
23
|
+
};
|
|
24
|
+
const getComponentFeature = (name) => {
|
|
25
|
+
return componentFeatures.get(name);
|
|
26
|
+
};
|
|
27
|
+
const subscribeForFeatureLoad = (name, klass, callback) => {
|
|
28
|
+
const subscriber = subscribers.get(klass);
|
|
29
|
+
const isSubscribed = subscriber?.includes(name);
|
|
30
|
+
if (isSubscribed) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (!subscriber) {
|
|
34
|
+
subscribers.set(klass, [name]);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
subscriber.push(name);
|
|
38
|
+
}
|
|
39
|
+
eventProvider.attachEvent(featureLoadEventName(name), callback);
|
|
40
|
+
};
|
|
41
|
+
const notifyForFeatureLoad = (name) => {
|
|
42
|
+
eventProvider.fireEvent(featureLoadEventName(name), undefined);
|
|
43
|
+
};
|
|
44
|
+
export { registerFeature, getFeature, registerComponentFeature, getComponentFeature, subscribeForFeatureLoad, ComponentFeature, };
|
|
9
45
|
//# sourceMappingURL=FeaturesRegistry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeaturesRegistry.js","sourceRoot":"","sources":["../src/FeaturesRegistry.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"FeaturesRegistry.js","sourceRoot":"","sources":["../src/FeaturesRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAG/C,MAAe,gBAAgB;IAC9B,gFAAgF;IAChF,YAAY,GAAG,IAAW,IAAG,CAAC;CAG9B;AAED,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAe,CAAC;AACxC,MAAM,iBAAiB,GAAG,IAAI,GAAG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,CAAC;IAEhD,IAAI,YAAY,EAAE;QACjB,OAAO;KACP;IAED,IAAI,CAAC,UAAU,EAAE;QAChB,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;KAC/B;SAAM;QACN,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACtB;IAED,aAAa,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAE,EAAE;IAC7C,aAAa,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF,OAAO,EACN,eAAe,EACf,UAAU,EACV,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,GAChB,CAAC","sourcesContent":["import EventProvider from \"./EventProvider.js\";\nimport type UI5Element from \"./UI5Element.js\";\n\nabstract class ComponentFeature {\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-empty-function\n\tconstructor(...args: any[]) {}\n\tstatic define?: () => Promise<void>;\n\tstatic dependencies?: Array<typeof UI5Element>\n}\n\nconst features = new Map<string, any>();\nconst componentFeatures = new Map<string, ComponentFeature>();\nconst subscribers = new Map<typeof UI5Element, Array<string>>();\n\nconst EVENT_NAME = \"componentFeatureLoad\";\nconst eventProvider = new EventProvider<undefined, void>();\n\nconst featureLoadEventName = (name: string) => `${EVENT_NAME}_${name}`;\n\nconst registerFeature = (name: string, feature: object) => {\n\tfeatures.set(name, feature);\n};\n\nconst getFeature = <T>(name: string): T => {\n\treturn features.get(name) as T;\n};\n\nconst registerComponentFeature = async (name: string, feature: typeof ComponentFeature) => {\n\tawait Promise.all(feature.dependencies?.map(dep => dep.define()) || []);\n\tawait feature.define?.();\n\n\tcomponentFeatures.set(name, feature);\n\tnotifyForFeatureLoad(name);\n};\n\nconst getComponentFeature = <T>(name: string): T => {\n\treturn componentFeatures.get(name) as T;\n};\n\nconst subscribeForFeatureLoad = (name: string, klass: typeof UI5Element, callback: () => void) => {\n\tconst subscriber = subscribers.get(klass);\n\tconst isSubscribed = subscriber?.includes(name);\n\n\tif (isSubscribed) {\n\t\treturn;\n\t}\n\n\tif (!subscriber) {\n\t\tsubscribers.set(klass, [name]);\n\t} else {\n\t\tsubscriber.push(name);\n\t}\n\n\teventProvider.attachEvent(featureLoadEventName(name), callback);\n};\n\nconst notifyForFeatureLoad = (name: string) => {\n\teventProvider.fireEvent(featureLoadEventName(name), undefined);\n};\n\nexport {\n\tregisterFeature,\n\tgetFeature,\n\tregisterComponentFeature,\n\tgetComponentFeature,\n\tsubscribeForFeatureLoad,\n\tComponentFeature,\n};\n"]}
|
package/dist/FontFace.js
CHANGED
|
@@ -2,16 +2,21 @@ import { hasStyle, createStyle } from "./ManagedStyles.js";
|
|
|
2
2
|
import { getFeature } from "./FeaturesRegistry.js";
|
|
3
3
|
import fontFaceCSS from "./generated/css/FontFace.css.js";
|
|
4
4
|
import overrideFontFaceCSS from "./generated/css/OverrideFontFace.css.js";
|
|
5
|
+
import { getDefaultFontLoading } from "./config/Fonts.js";
|
|
5
6
|
const insertFontFace = () => {
|
|
6
7
|
const openUI5Support = getFeature("OpenUI5Support");
|
|
7
8
|
// Only set the main font if there is no OpenUI5 support, or there is, but OpenUI5 is not loaded
|
|
8
|
-
if (!openUI5Support || !openUI5Support.isOpenUI5Detected()) {
|
|
9
|
+
if ((!openUI5Support || !openUI5Support.isOpenUI5Detected())) {
|
|
9
10
|
insertMainFontFace();
|
|
10
11
|
}
|
|
11
12
|
// Always set the override font - OpenUI5 in CSS Vars mode does not set it, unlike the main font
|
|
12
13
|
insertOverrideFontFace();
|
|
13
14
|
};
|
|
14
15
|
const insertMainFontFace = () => {
|
|
16
|
+
const hasFontStyles = document.querySelector("head>style[data-ui5-font-face]");
|
|
17
|
+
if (!getDefaultFontLoading() || hasFontStyles) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
15
20
|
if (!hasStyle("data-ui5-font-face")) {
|
|
16
21
|
createStyle(fontFaceCSS, "data-ui5-font-face");
|
|
17
22
|
}
|
package/dist/FontFace.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FontFace.js","sourceRoot":"","sources":["../src/FontFace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,WAAW,MAAM,iCAAiC,CAAC;AAC1D,OAAO,mBAAmB,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"FontFace.js","sourceRoot":"","sources":["../src/FontFace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,WAAW,MAAM,iCAAiC,CAAC;AAC1D,OAAO,mBAAmB,MAAM,yCAAyC,CAAC;AAE1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,cAAc,GAAG,GAAG,EAAE;IAC3B,MAAM,cAAc,GAAG,UAAU,CAAwB,gBAAgB,CAAC,CAAC;IAE3E,gGAAgG;IAChG,IAAI,CAAC,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAC,EAAE;QAC7D,kBAAkB,EAAE,CAAC;KACrB;IAED,gGAAgG;IAChG,sBAAsB,EAAE,CAAC;AAC1B,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,GAAG,EAAE;IAC/B,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,gCAAgC,CAAC,CAAC;IAE/E,IAAI,CAAC,qBAAqB,EAAE,IAAI,aAAa,EAAE;QAC9C,OAAO;KACP;IAED,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE;QACpC,WAAW,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;KAC/C;AACF,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,GAAG,EAAE;IACnC,IAAI,CAAC,QAAQ,CAAC,6BAA6B,CAAC,EAAE;QAC7C,WAAW,CAAC,mBAAmB,EAAE,6BAA6B,CAAC,CAAC;KAChE;AACF,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { hasStyle, createStyle } from \"./ManagedStyles.js\";\nimport { getFeature } from \"./FeaturesRegistry.js\";\nimport fontFaceCSS from \"./generated/css/FontFace.css.js\";\nimport overrideFontFaceCSS from \"./generated/css/OverrideFontFace.css.js\";\nimport type OpenUI5Support from \"./features/OpenUI5Support.js\";\nimport { getDefaultFontLoading } from \"./config/Fonts.js\";\n\nconst insertFontFace = () => {\n\tconst openUI5Support = getFeature<typeof OpenUI5Support>(\"OpenUI5Support\");\n\n\t// Only set the main font if there is no OpenUI5 support, or there is, but OpenUI5 is not loaded\n\tif ((!openUI5Support || !openUI5Support.isOpenUI5Detected())) {\n\t\tinsertMainFontFace();\n\t}\n\n\t// Always set the override font - OpenUI5 in CSS Vars mode does not set it, unlike the main font\n\tinsertOverrideFontFace();\n};\n\nconst insertMainFontFace = () => {\n\tconst hasFontStyles = document.querySelector(\"head>style[data-ui5-font-face]\");\n\n\tif (!getDefaultFontLoading() || hasFontStyles) {\n\t\treturn;\n\t}\n\n\tif (!hasStyle(\"data-ui5-font-face\")) {\n\t\tcreateStyle(fontFaceCSS, \"data-ui5-font-face\");\n\t}\n};\n\nconst insertOverrideFontFace = () => {\n\tif (!hasStyle(\"data-ui5-font-face-override\")) {\n\t\tcreateStyle(overrideFontFaceCSS, \"data-ui5-font-face-override\");\n\t}\n};\n\nexport default insertFontFace;\n"]}
|
|
@@ -12,6 +12,7 @@ declare const getLanguage: () => string | undefined;
|
|
|
12
12
|
*/
|
|
13
13
|
declare const getFetchDefaultLanguage: () => boolean;
|
|
14
14
|
declare const getNoConflict: () => boolean;
|
|
15
|
+
declare const getDefaultFontLoading: () => boolean;
|
|
15
16
|
/**
|
|
16
17
|
* Get the configured calendar type
|
|
17
18
|
* @returns { String } the name of the configured calendar type
|
|
@@ -24,4 +25,4 @@ declare const getSecondaryCalendarType: () => CalendarType | undefined;
|
|
|
24
25
|
*/
|
|
25
26
|
declare const getTimezone: () => string | undefined;
|
|
26
27
|
declare const getFormatSettings: () => FormatSettings;
|
|
27
|
-
export { getAnimationMode, getTheme, getThemeRoot, getLanguage, getFetchDefaultLanguage, getNoConflict, getCalendarType, getSecondaryCalendarType, getTimezone, getFormatSettings, };
|
|
28
|
+
export { getAnimationMode, getTheme, getThemeRoot, getLanguage, getFetchDefaultLanguage, getNoConflict, getCalendarType, getSecondaryCalendarType, getTimezone, getFormatSettings, getDefaultFontLoading, };
|
|
@@ -16,6 +16,7 @@ let initialConfig = {
|
|
|
16
16
|
noConflict: false,
|
|
17
17
|
formatSettings: {},
|
|
18
18
|
fetchDefaultLanguage: false,
|
|
19
|
+
defaultFontLoading: true,
|
|
19
20
|
};
|
|
20
21
|
/* General settings */
|
|
21
22
|
const getAnimationMode = () => {
|
|
@@ -47,6 +48,10 @@ const getNoConflict = () => {
|
|
|
47
48
|
initConfiguration();
|
|
48
49
|
return initialConfig.noConflict;
|
|
49
50
|
};
|
|
51
|
+
const getDefaultFontLoading = () => {
|
|
52
|
+
initConfiguration();
|
|
53
|
+
return initialConfig.defaultFontLoading;
|
|
54
|
+
};
|
|
50
55
|
/**
|
|
51
56
|
* Get the configured calendar type
|
|
52
57
|
* @returns { String } the name of the configured calendar type
|
|
@@ -153,5 +158,5 @@ const initConfiguration = () => {
|
|
|
153
158
|
applyOpenUI5Configuration();
|
|
154
159
|
initialized = true;
|
|
155
160
|
};
|
|
156
|
-
export { getAnimationMode, getTheme, getThemeRoot, getLanguage, getFetchDefaultLanguage, getNoConflict, getCalendarType, getSecondaryCalendarType, getTimezone, getFormatSettings, };
|
|
161
|
+
export { getAnimationMode, getTheme, getThemeRoot, getLanguage, getFetchDefaultLanguage, getNoConflict, getCalendarType, getSecondaryCalendarType, getTimezone, getFormatSettings, getDefaultFontLoading, };
|
|
157
162
|
//# sourceMappingURL=InitialConfiguration.js.map
|
|
@@ -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,qBAAqB,EAAE,SAAS;IAChC,UAAU,EAAE,KAAK;IACjB,cAAc,EAAE,EAAE;IAClB,oBAAoB,EAAE,KAAK;CAC3B,CAAC;AAEF,sBAAsB;AACtB,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC7B,iBAAiB,EAAE,CAAC;IACpB,OAAO,aAAa,CAAC,aAAa,CAAC;AACpC,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,GAAG,EAAE;IACrB,iBAAiB,EAAE,CAAC;IACpB,OAAO,aAAa,CAAC,KAAK,CAAC;AAC5B,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,GAAG,EAAE;IACzB,iBAAiB,EAAE,CAAC;IACpB,OAAO,aAAa,CA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AM,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,WAAW,EACX,uBAAuB,EACvB,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,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 type 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\tlanguage: string | undefined,\n\tcalendarType: CalendarType | undefined,\n\tsecondaryCalendarType: 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\tsecondaryCalendarType: 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 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\nconst getSecondaryCalendarType = () => {\n\tinitConfiguration();\n\treturn initialConfig.secondaryCalendarType;\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.isOpenUI5Detected()) {\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\tgetLanguage,\n\tgetFetchDefaultLanguage,\n\tgetNoConflict,\n\tgetCalendarType,\n\tgetSecondaryCalendarType,\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;AAiBxB,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,qBAAqB,EAAE,SAAS;IAChC,UAAU,EAAE,KAAK;IACjB,cAAc,EAAE,EAAE;IAClB,oBAAoB,EAAE,KAAK;IAC3B,kBAAkB,EAAE,IAAI;CACxB,CAAC;AAEF,sBAAsB;AACtB,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC7B,iBAAiB,EAAE,CAAC;IACpB,OAAO,aAAa,CAAC,aAAa,CAAC;AACpC,CAAC,CAAC;AAEF,MAAM,QA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A4B,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,iBAAiB,EAAE,EAAE;QAC3D,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,WAAW,EACX,uBAAuB,EACvB,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,WAAW,EACX,iBAAiB,EACjB,qBAAqB,GACrB,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 type 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\tlanguage: string | undefined,\n\tcalendarType: CalendarType | undefined,\n\tsecondaryCalendarType: CalendarType | undefined,\n\ttimezone: string | undefined,\n\tnoConflict: boolean,\n\tformatSettings: FormatSettings,\n\tfetchDefaultLanguage: boolean,\n\tdefaultFontLoading: 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\tsecondaryCalendarType: undefined,\n\tnoConflict: false, // no URL\n\tformatSettings: {},\n\tfetchDefaultLanguage: false,\n\tdefaultFontLoading: true,\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 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\nconst getDefaultFontLoading = () => {\n\tinitConfiguration();\n\treturn initialConfig.defaultFontLoading;\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\nconst getSecondaryCalendarType = () => {\n\tinitConfiguration();\n\treturn initialConfig.secondaryCalendarType;\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.isOpenUI5Detected()) {\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\tgetLanguage,\n\tgetFetchDefaultLanguage,\n\tgetNoConflict,\n\tgetCalendarType,\n\tgetSecondaryCalendarType,\n\tgetTimezone,\n\tgetFormatSettings,\n\tgetDefaultFontLoading,\n};\n"]}
|
package/dist/UI5Element.d.ts
CHANGED
|
@@ -337,6 +337,7 @@ declare abstract class UI5Element extends HTMLElement {
|
|
|
337
337
|
* @protected
|
|
338
338
|
*/
|
|
339
339
|
static get dependencies(): Array<typeof UI5Element>;
|
|
340
|
+
static cacheUniqueDependencies(this: typeof UI5Element): void;
|
|
340
341
|
/**
|
|
341
342
|
* Returns a list of the unique dependencies for this UI5 Web Component
|
|
342
343
|
*
|
package/dist/UI5Element.js
CHANGED
|
@@ -18,6 +18,7 @@ import arraysAreEqual from "./util/arraysAreEqual.js";
|
|
|
18
18
|
import { markAsRtlAware } from "./locale/RTLAwareRegistry.js";
|
|
19
19
|
import executeTemplate, { getTagsToScope } from "./renderer/executeTemplate.js";
|
|
20
20
|
import { attachFormElementInternals, setFormValue } from "./features/InputElementsFormSupport.js";
|
|
21
|
+
import { getComponentFeature, subscribeForFeatureLoad } from "./FeaturesRegistry.js";
|
|
21
22
|
const DEV_MODE = true;
|
|
22
23
|
let autoId = 0;
|
|
23
24
|
const elementTimeouts = new Map();
|
|
@@ -947,6 +948,10 @@ class UI5Element extends HTMLElement {
|
|
|
947
948
|
static get dependencies() {
|
|
948
949
|
return [];
|
|
949
950
|
}
|
|
951
|
+
static cacheUniqueDependencies() {
|
|
952
|
+
const filtered = this.dependencies.filter((dep, index, deps) => deps.indexOf(dep) === index);
|
|
953
|
+
uniqueDependenciesCache.set(this, filtered);
|
|
954
|
+
}
|
|
950
955
|
/**
|
|
951
956
|
* Returns a list of the unique dependencies for this UI5 Web Component
|
|
952
957
|
*
|
|
@@ -954,8 +959,7 @@ class UI5Element extends HTMLElement {
|
|
|
954
959
|
*/
|
|
955
960
|
static getUniqueDependencies() {
|
|
956
961
|
if (!uniqueDependenciesCache.has(this)) {
|
|
957
|
-
|
|
958
|
-
uniqueDependenciesCache.set(this, filtered);
|
|
962
|
+
this.cacheUniqueDependencies();
|
|
959
963
|
}
|
|
960
964
|
return uniqueDependenciesCache.get(this) || [];
|
|
961
965
|
}
|
|
@@ -984,6 +988,13 @@ class UI5Element extends HTMLElement {
|
|
|
984
988
|
this.onDefine(),
|
|
985
989
|
]);
|
|
986
990
|
const tag = this.getMetadata().getTag();
|
|
991
|
+
const features = this.getMetadata().getFeatures();
|
|
992
|
+
features.forEach(feature => {
|
|
993
|
+
if (getComponentFeature(feature)) {
|
|
994
|
+
this.cacheUniqueDependencies();
|
|
995
|
+
}
|
|
996
|
+
subscribeForFeatureLoad(feature, this, this.cacheUniqueDependencies.bind(this));
|
|
997
|
+
});
|
|
987
998
|
const definedLocally = isTagRegistered(tag);
|
|
988
999
|
const definedGlobally = customElements.get(tag);
|
|
989
1000
|
if (definedGlobally && !definedLocally) {
|