@ui5/webcomponents-base 2.16.1-rc.0 → 2.17.0-rc.0
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 +11 -0
- package/dist/.tsbuildinfobuild +1 -1
- package/dist/asset-registries/Illustrations.d.ts +133 -8
- package/dist/asset-registries/Illustrations.js +82 -1
- package/dist/asset-registries/Illustrations.js.map +1 -1
- package/dist/generated/VersionInfo.js +4 -4
- package/dist/generated/VersionInfo.js.map +1 -1
- package/dist/prod/asset-registries/Illustrations.js +1 -1
- package/dist/prod/asset-registries/Illustrations.js.map +3 -3
- package/dist/prod/generated/VersionInfo.js +1 -1
- package/dist/prod/generated/VersionInfo.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,19 +1,144 @@
|
|
|
1
1
|
import type { I18nText } from "../i18nBundle.js";
|
|
2
|
-
type
|
|
3
|
-
|
|
2
|
+
import type { TemplateFunction } from "../renderer/executeTemplate.js";
|
|
3
|
+
/**
|
|
4
|
+
* Loader function for lazy-loading illustration data.
|
|
5
|
+
*/
|
|
6
|
+
type IllustrationLoader = (illustrationName: string) => Promise<UnsafeIllustrationData>;
|
|
7
|
+
/**
|
|
8
|
+
* Database properties shared by all illustration types.
|
|
9
|
+
*/
|
|
10
|
+
type IllustrationDatabase = {
|
|
11
|
+
/** The illustration title text (supports i18n) */
|
|
12
|
+
title: I18nText;
|
|
13
|
+
/** The illustration subtitle text (supports i18n) */
|
|
14
|
+
subtitle: I18nText;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Illustration properties using template functions (recommended).
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
type IllustrationProperties = IllustrationDatabase & {
|
|
22
|
+
/** Template function for the medium variant (M breakpoint, ≤ 681px) */
|
|
23
|
+
dialogTemplate?: TemplateFunction;
|
|
24
|
+
/** Template function for the large variant (L breakpoint, > 681px) */
|
|
25
|
+
sceneTemplate?: TemplateFunction;
|
|
26
|
+
/** Template function for the small variant (S breakpoint, ≤ 360px) */
|
|
27
|
+
spotTemplate?: TemplateFunction;
|
|
28
|
+
/** Template function for the extra small variant (XS breakpoint, ≤ 260px) */
|
|
29
|
+
dotTemplate?: TemplateFunction;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Illustration properties using raw SVG strings (unsafe).
|
|
33
|
+
*
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
type UnsafeIllustrationProperties = IllustrationDatabase & {
|
|
37
|
+
/** SVG content for the medium variant (M breakpoint, ≤ 681px) */
|
|
4
38
|
dialogSvg: string;
|
|
39
|
+
/** SVG content for the large variant (L breakpoint, > 681px) */
|
|
5
40
|
sceneSvg: string;
|
|
41
|
+
/** SVG content for the small variant (S breakpoint, ≤ 360px) */
|
|
6
42
|
spotSvg: string;
|
|
43
|
+
/** SVG content for the extra small variant (XS breakpoint, ≤ 260px) */
|
|
7
44
|
dotSvg: string;
|
|
8
|
-
title: I18nText;
|
|
9
|
-
subtitle: I18nText;
|
|
10
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Complete illustration data for registration (recommended).
|
|
48
|
+
*
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
11
51
|
type IllustrationData = IllustrationProperties & {
|
|
52
|
+
/** The illustration set identifier (e.g., "custom") */
|
|
53
|
+
set: string;
|
|
54
|
+
/** Collection identifier (defaults to "V4") */
|
|
55
|
+
collection?: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Complete unsafe illustration data for registration.
|
|
59
|
+
*
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
type UnsafeIllustrationData = UnsafeIllustrationProperties & {
|
|
63
|
+
/** The illustration set identifier (e.g., "custom") */
|
|
12
64
|
set: string;
|
|
13
|
-
|
|
65
|
+
/** Collection identifier (defaults to "V4") */
|
|
66
|
+
collection?: string;
|
|
14
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* Registers a custom illustration in the global registry using template functions.
|
|
70
|
+
*
|
|
71
|
+
* This is the recommended way to register illustrations as it accepts template functions
|
|
72
|
+
* instead of raw SVG strings, preventing XSS vulnerabilities.
|
|
73
|
+
*
|
|
74
|
+
* @param name - The name of the illustration (without set prefix)
|
|
75
|
+
* @param data - The illustration data (see {@link IllustrationData})
|
|
76
|
+
*
|
|
77
|
+
* @public
|
|
78
|
+
* @since 2.17.0
|
|
79
|
+
* @example
|
|
80
|
+
* ```js
|
|
81
|
+
* import { registerIllustration } from "@ui5/webcomponents-base/dist/asset-registries/Illustrations.js";
|
|
82
|
+
*
|
|
83
|
+
* registerIllustration("EmptyCart", {
|
|
84
|
+
* sceneTemplate: (component) => <svg>...</svg>,
|
|
85
|
+
* dialogTemplate: (component) => <svg>...</svg>,
|
|
86
|
+
* spotTemplate: (component) => <svg>...</svg>,
|
|
87
|
+
* dotTemplate: (component) => <svg>...</svg>,
|
|
88
|
+
* title: "Your cart is empty",
|
|
89
|
+
* subtitle: "Add items to get started",
|
|
90
|
+
* set: "custom"
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
15
94
|
declare const registerIllustration: (name: string, data: IllustrationData) => void;
|
|
95
|
+
/**
|
|
96
|
+
* Registers a custom illustration in the global registry.
|
|
97
|
+
*
|
|
98
|
+
* <b>Note:</b> This method is unsafe as it allows the SVG content to be passed as raw strings
|
|
99
|
+
* through the `dialogSvg`, `sceneSvg`, `spotSvg`, and `dotSvg` properties of the `data`.
|
|
100
|
+
* Ensure that the SVG content is properly validated.
|
|
101
|
+
* Improperly sanitized SVG strings can lead to security vulnerabilities such as XSS (Cross-Site Scripting).
|
|
102
|
+
*
|
|
103
|
+
* @param name - The name of the illustration (without set prefix)
|
|
104
|
+
* @param data - The illustration data (see {@link UnsafeIllustrationData})
|
|
105
|
+
*
|
|
106
|
+
* @public
|
|
107
|
+
* @since 2.17.0
|
|
108
|
+
* @example
|
|
109
|
+
* ```js
|
|
110
|
+
* import { unsafeRegisterIllustration } from "@ui5/webcomponents-base/dist/asset-registries/Illustrations.js";
|
|
111
|
+
*
|
|
112
|
+
* unsafeRegisterIllustration("EmptyCart", {
|
|
113
|
+
* sceneSvg: "<svg>...</svg>",
|
|
114
|
+
* dialogSvg: "<svg>...</svg>",
|
|
115
|
+
* spotSvg: "<svg>...</svg>",
|
|
116
|
+
* dotSvg: "<svg>...</svg>",
|
|
117
|
+
* title: "Your cart is empty",
|
|
118
|
+
* subtitle: "Add items to get started",
|
|
119
|
+
* set: "custom"
|
|
120
|
+
* });
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
declare const unsafeRegisterIllustration: (name: string, data: UnsafeIllustrationData) => void;
|
|
16
124
|
declare const registerIllustrationLoader: (illustrationName: string, loader: IllustrationLoader) => void;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Synchronously retrieves illustration data from the registry.
|
|
127
|
+
*
|
|
128
|
+
* @param illustrationName - The illustration identifier in format "set/name"
|
|
129
|
+
* @returns The illustration properties or undefined if not available
|
|
130
|
+
*
|
|
131
|
+
* @public
|
|
132
|
+
*/
|
|
133
|
+
declare const getIllustrationDataSync: (illustrationName: string) => UnsafeIllustrationProperties | IllustrationProperties | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Asynchronously retrieves illustration data, loading it if necessary.
|
|
136
|
+
*
|
|
137
|
+
* @param illustrationName - The illustration identifier in format "set/name"
|
|
138
|
+
* @returns Promise resolving to illustration properties or undefined
|
|
139
|
+
*
|
|
140
|
+
* @public
|
|
141
|
+
*/
|
|
142
|
+
declare const getIllustrationData: (illustrationName: string) => Promise<UnsafeIllustrationProperties | IllustrationProperties | undefined>;
|
|
143
|
+
export { getIllustrationDataSync, registerIllustration, unsafeRegisterIllustration, registerIllustrationLoader, getIllustrationData, };
|
|
144
|
+
export type { IllustrationData, UnsafeIllustrationData, IllustrationProperties, UnsafeIllustrationProperties, };
|
|
@@ -38,7 +38,72 @@ const processName = (name) => {
|
|
|
38
38
|
collection,
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* Registers a custom illustration in the global registry using template functions.
|
|
43
|
+
*
|
|
44
|
+
* This is the recommended way to register illustrations as it accepts template functions
|
|
45
|
+
* instead of raw SVG strings, preventing XSS vulnerabilities.
|
|
46
|
+
*
|
|
47
|
+
* @param name - The name of the illustration (without set prefix)
|
|
48
|
+
* @param data - The illustration data (see {@link IllustrationData})
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
* @since 2.17.0
|
|
52
|
+
* @example
|
|
53
|
+
* ```js
|
|
54
|
+
* import { registerIllustration } from "@ui5/webcomponents-base/dist/asset-registries/Illustrations.js";
|
|
55
|
+
*
|
|
56
|
+
* registerIllustration("EmptyCart", {
|
|
57
|
+
* sceneTemplate: (component) => <svg>...</svg>,
|
|
58
|
+
* dialogTemplate: (component) => <svg>...</svg>,
|
|
59
|
+
* spotTemplate: (component) => <svg>...</svg>,
|
|
60
|
+
* dotTemplate: (component) => <svg>...</svg>,
|
|
61
|
+
* title: "Your cart is empty",
|
|
62
|
+
* subtitle: "Add items to get started",
|
|
63
|
+
* set: "custom"
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
41
67
|
const registerIllustration = (name, data) => {
|
|
68
|
+
const collection = data.collection || FALLBACK_COLLECTION;
|
|
69
|
+
registry.set(`${data.set}/${collection}/${name}`, {
|
|
70
|
+
dialogTemplate: data.dialogTemplate,
|
|
71
|
+
sceneTemplate: data.sceneTemplate,
|
|
72
|
+
spotTemplate: data.spotTemplate,
|
|
73
|
+
dotTemplate: data.dotTemplate,
|
|
74
|
+
title: data.title,
|
|
75
|
+
subtitle: data.subtitle,
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Registers a custom illustration in the global registry.
|
|
80
|
+
*
|
|
81
|
+
* <b>Note:</b> This method is unsafe as it allows the SVG content to be passed as raw strings
|
|
82
|
+
* through the `dialogSvg`, `sceneSvg`, `spotSvg`, and `dotSvg` properties of the `data`.
|
|
83
|
+
* Ensure that the SVG content is properly validated.
|
|
84
|
+
* Improperly sanitized SVG strings can lead to security vulnerabilities such as XSS (Cross-Site Scripting).
|
|
85
|
+
*
|
|
86
|
+
* @param name - The name of the illustration (without set prefix)
|
|
87
|
+
* @param data - The illustration data (see {@link UnsafeIllustrationData})
|
|
88
|
+
*
|
|
89
|
+
* @public
|
|
90
|
+
* @since 2.17.0
|
|
91
|
+
* @example
|
|
92
|
+
* ```js
|
|
93
|
+
* import { unsafeRegisterIllustration } from "@ui5/webcomponents-base/dist/asset-registries/Illustrations.js";
|
|
94
|
+
*
|
|
95
|
+
* unsafeRegisterIllustration("EmptyCart", {
|
|
96
|
+
* sceneSvg: "<svg>...</svg>",
|
|
97
|
+
* dialogSvg: "<svg>...</svg>",
|
|
98
|
+
* spotSvg: "<svg>...</svg>",
|
|
99
|
+
* dotSvg: "<svg>...</svg>",
|
|
100
|
+
* title: "Your cart is empty",
|
|
101
|
+
* subtitle: "Add items to get started",
|
|
102
|
+
* set: "custom"
|
|
103
|
+
* });
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
const unsafeRegisterIllustration = (name, data) => {
|
|
42
107
|
const collection = data.collection || FALLBACK_COLLECTION;
|
|
43
108
|
registry.set(`${data.set}/${collection}/${name}`, {
|
|
44
109
|
dialogSvg: data.dialogSvg,
|
|
@@ -64,14 +129,30 @@ const _loadIllustrationOnce = (illustrationName) => {
|
|
|
64
129
|
}
|
|
65
130
|
return illustrationPromises.get(registryKey);
|
|
66
131
|
};
|
|
132
|
+
/**
|
|
133
|
+
* Synchronously retrieves illustration data from the registry.
|
|
134
|
+
*
|
|
135
|
+
* @param illustrationName - The illustration identifier in format "set/name"
|
|
136
|
+
* @returns The illustration properties or undefined if not available
|
|
137
|
+
*
|
|
138
|
+
* @public
|
|
139
|
+
*/
|
|
67
140
|
const getIllustrationDataSync = (illustrationName) => {
|
|
68
141
|
const { registryKey } = processName(illustrationName);
|
|
69
142
|
return registry.get(registryKey);
|
|
70
143
|
};
|
|
144
|
+
/**
|
|
145
|
+
* Asynchronously retrieves illustration data, loading it if necessary.
|
|
146
|
+
*
|
|
147
|
+
* @param illustrationName - The illustration identifier in format "set/name"
|
|
148
|
+
* @returns Promise resolving to illustration properties or undefined
|
|
149
|
+
*
|
|
150
|
+
* @public
|
|
151
|
+
*/
|
|
71
152
|
const getIllustrationData = async (illustrationName) => {
|
|
72
153
|
const { registryKey } = processName(illustrationName);
|
|
73
154
|
await _loadIllustrationOnce(illustrationName);
|
|
74
155
|
return registry.get(registryKey);
|
|
75
156
|
};
|
|
76
|
-
export { getIllustrationDataSync, registerIllustration, registerIllustrationLoader, getIllustrationData, };
|
|
157
|
+
export { getIllustrationDataSync, registerIllustration, unsafeRegisterIllustration, registerIllustrationLoader, getIllustrationData, };
|
|
77
158
|
//# sourceMappingURL=Illustrations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Illustrations.js","sourceRoot":"","sources":["../../src/asset-registries/Illustrations.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAkB9C,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC;IACvC,CAAC,aAAa,EAAE,IAAI,CAAC;IACrB,CAAC,kBAAkB,EAAE,IAAI,CAAC;IAC1B,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAC5B,CAAC,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC,MAAM,OAAO,GAAG,IAAI,GAAG,EAA8B,CAAC;AACtD,MAAM,QAAQ,GAAG,iBAAiB,CAAsC,0BAA0B,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;AAC/G,MAAM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AAEF,MAAM,mBAAmB,GAAG,KAAK,EAAE,gBAAwB,EAAE,EAAE;IAC9D,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAEtD,MAAM,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;IAC9C,OAAO,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAClC,CAAC,CAAC;AAEF,OAAO,EACN,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,GACnB,CAAC","sourcesContent":["import getSharedResource from \"../getSharedResource.js\";\nimport type { I18nText } from \"../i18nBundle.js\";\nimport { getTheme } from \"../config/Theme.js\";\n\ntype IllustrationLoader = (illustrationName: string) => Promise<IllustrationData>;\n\ntype IllustrationProperties = {\n\tdialogSvg: string,\n\tsceneSvg: string,\n\tspotSvg: string,\n\tdotSvg: string,\n\ttitle: I18nText,\n\tsubtitle: I18nText,\n};\n\ntype IllustrationData = IllustrationProperties & {\n\tset: string,\n\tcollection: string,\n};\n\nconst IllustrationCollections = new Map([\n\t[\"sap_horizon\", \"V5\"],\n\t[\"sap_horizon_dark\", \"V5\"],\n\t[\"sap_horizon_hcb\", \"V5/HC\"],\n\t[\"sap_horizon_hcw\", \"V5/HC\"],\n]);\n\nconst FALLBACK_COLLECTION = \"V4\";\n\nconst loaders = new Map<string, IllustrationLoader>();\nconst registry = getSharedResource<Map<string, IllustrationProperties>>(\"SVGIllustration.registry\", new Map());\nconst illustrationPromises = getSharedResource<Map<string, Promise<IllustrationData>>>(\"SVGIllustration.promises\", new Map());\n\nconst getCollection = () => {\n\tconst theme = getTheme();\n\n\tif (IllustrationCollections.has(theme)) {\n\t\treturn IllustrationCollections.get(theme);\n\t}\n\n\treturn FALLBACK_COLLECTION;\n};\n\n/**\n * Processes the name of the illustration\n * The name is used to generate the registry key and the loader key\n * The registry key is used to store and get the illustration data from the registry\n * The loader key is used to store and get the illustration loader from the loaders map\n * The function generates the correct registry key and loader key based on whether an loader exists for the illustration\n * If there is no loader registered for the collection, it falls back to the default collection\n */\nconst processName = (name: string) => {\n\tlet collection = getCollection();\n\tconst [set, illustrationName] = name.split(\"/\");\n\tlet registryKey = `${set}/${collection}/${illustrationName}`;\n\n\tif (!loaders.has(registryKey) && collection !== FALLBACK_COLLECTION) {\n\t\tcollection = FALLBACK_COLLECTION;\n\t\tregistryKey = `${set}/${collection}/${illustrationName}`;\n\t}\n\n\treturn {\n\t\tregistryKey,\n\t\tcollection,\n\t};\n};\n\nconst registerIllustration = (name: string, data: IllustrationData) => {\n\tconst collection = data.collection || FALLBACK_COLLECTION;\n\tregistry.set(`${data.set}/${collection}/${name}`, {\n\t\tdialogSvg: data.dialogSvg,\n\t\tsceneSvg: data.sceneSvg,\n\t\tspotSvg: data.spotSvg,\n\t\tdotSvg: data.dotSvg,\n\t\ttitle: data.title,\n\t\tsubtitle: data.subtitle,\n\t});\n};\n\nconst registerIllustrationLoader = (illustrationName: string, loader: IllustrationLoader) => {\n\tloaders.set(illustrationName, loader);\n};\n\nconst _loadIllustrationOnce = (illustrationName: string) => {\n\tconst { registryKey } = processName(illustrationName);\n\tif (!illustrationPromises.has(registryKey)) {\n\t\tif (!loaders.has(registryKey)) {\n\t\t\tconst illustrationPath = illustrationName.startsWith(\"fiori/\") ? illustrationName.replace(\"fiori/\", \"\") : illustrationName;\n\t\t\tthrow new Error(`No loader registered for the ${illustrationName} illustration. Probably you forgot to import the \"@ui5/webcomponents-fiori/dist/illustrations/${illustrationPath}.js\" module. Or you can import the \"@ui5/webcomponents-fiori/dist/illustrations/AllIllustrations.js\" module that will make all illustrations available, but fetch only the ones used.`);\n\t\t}\n\n\t\tconst loadIllustrations = loaders.get(registryKey)!;\n\t\tillustrationPromises.set(registryKey, loadIllustrations(registryKey));\n\t}\n\treturn illustrationPromises.get(registryKey);\n};\n\nconst getIllustrationDataSync = (illustrationName: string) => {\n\tconst { registryKey } = processName(illustrationName);\n\treturn registry.get(registryKey);\n};\n\nconst getIllustrationData = async (illustrationName: string) => {\n\tconst { registryKey } = processName(illustrationName);\n\n\tawait _loadIllustrationOnce(illustrationName);\n\treturn registry.get(registryKey);\n};\n\nexport {\n\tgetIllustrationDataSync,\n\tregisterIllustration,\n\tregisterIllustrationLoader,\n\tgetIllustrationData,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Illustrations.js","sourceRoot":"","sources":["../../src/asset-registries/Illustrations.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AA0E9C,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC;IACvC,CAAC,aAAa,EAAE,IAAI,CAAC;IACrB,CAAC,kBAAkB,EAAE,IAAI,CAAC;IAC1B,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAC5B,CAAC,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC,MAAM,OAAO,GAAG,IAAI,GAAG,EAA8B,CAAC;AACtD,MAAM,QAAQ,GAAG,iBAAiB,CAAqE,0BAA0B,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;AAC9I,MAAM,oBAAoB,GAAG,iBAAiB,CAA+C,0BAA0B,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;AAEpI,MAAM,aAAa,GAAG,GAAG,EAAE;IAC1B,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,IAAI,uBAAuB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACxC,OAAO,uBAAuB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,mBAAmB,CAAC;AAC5B,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE;IACpC,IAAI,UAAU,GAAG,aAAa,EAAE,CAAC;IACjC,MAAM,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AAW,EAAE,GAAG,WAAW,CAAC,gBAAgB,CAAC,CAAC;IACtD,OAAO,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAClC,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,mBAAmB,GAAG,KAAK,EAAE,gBAAwB,EAAE,EAAE;IAC9D,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAEtD,MAAM,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;IAC9C,OAAO,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAClC,CAAC,CAAC;AAEF,OAAO,EACN,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,mBAAmB,GACnB,CAAC","sourcesContent":["import getSharedResource from \"../getSharedResource.js\";\nimport type { I18nText } from \"../i18nBundle.js\";\nimport { getTheme } from \"../config/Theme.js\";\nimport type { TemplateFunction } from \"../renderer/executeTemplate.js\";\n\n/**\n * Loader function for lazy-loading illustration data.\n */\ntype IllustrationLoader = (illustrationName: string) => Promise<UnsafeIllustrationData>;\n\n/**\n * Database properties shared by all illustration types.\n */\ntype IllustrationDatabase = {\n\t/** The illustration title text (supports i18n) */\n\ttitle: I18nText,\n\t/** The illustration subtitle text (supports i18n) */\n\tsubtitle: I18nText,\n};\n\n/**\n * Illustration properties using template functions (recommended).\n *\n * @public\n */\ntype IllustrationProperties = IllustrationDatabase & {\n\t/** Template function for the medium variant (M breakpoint, ≤ 681px) */\n\tdialogTemplate?: TemplateFunction,\n\t/** Template function for the large variant (L breakpoint, > 681px) */\n\tsceneTemplate?: TemplateFunction,\n\t/** Template function for the small variant (S breakpoint, ≤ 360px) */\n\tspotTemplate?: TemplateFunction,\n\t/** Template function for the extra small variant (XS breakpoint, ≤ 260px) */\n\tdotTemplate?: TemplateFunction,\n};\n\n/**\n * Illustration properties using raw SVG strings (unsafe).\n *\n * @public\n */\ntype UnsafeIllustrationProperties = IllustrationDatabase & {\n\t/** SVG content for the medium variant (M breakpoint, ≤ 681px) */\n\tdialogSvg: string,\n\t/** SVG content for the large variant (L breakpoint, > 681px) */\n\tsceneSvg: string,\n\t/** SVG content for the small variant (S breakpoint, ≤ 360px) */\n\tspotSvg: string,\n\t/** SVG content for the extra small variant (XS breakpoint, ≤ 260px) */\n\tdotSvg: string,\n};\n\n/**\n * Complete illustration data for registration (recommended).\n *\n * @public\n */\ntype IllustrationData = IllustrationProperties & {\n\t/** The illustration set identifier (e.g., \"custom\") */\n\tset: string,\n\t/** Collection identifier (defaults to \"V4\") */\n\tcollection?: string,\n};\n\n/**\n * Complete unsafe illustration data for registration.\n *\n * @public\n */\ntype UnsafeIllustrationData = UnsafeIllustrationProperties & {\n\t/** The illustration set identifier (e.g., \"custom\") */\n\tset: string,\n\t/** Collection identifier (defaults to \"V4\") */\n\tcollection?: string,\n};\n\nconst IllustrationCollections = new Map([\n\t[\"sap_horizon\", \"V5\"],\n\t[\"sap_horizon_dark\", \"V5\"],\n\t[\"sap_horizon_hcb\", \"V5/HC\"],\n\t[\"sap_horizon_hcw\", \"V5/HC\"],\n]);\n\nconst FALLBACK_COLLECTION = \"V4\";\n\nconst loaders = new Map<string, IllustrationLoader>();\nconst registry = getSharedResource<Map<string, IllustrationProperties | UnsafeIllustrationProperties>>(\"SVGIllustration.registry\", new Map());\nconst illustrationPromises = getSharedResource<Map<string, Promise<UnsafeIllustrationData>>>(\"SVGIllustration.promises\", new Map());\n\nconst getCollection = () => {\n\tconst theme = getTheme();\n\n\tif (IllustrationCollections.has(theme)) {\n\t\treturn IllustrationCollections.get(theme);\n\t}\n\n\treturn FALLBACK_COLLECTION;\n};\n\n/**\n * Processes the name of the illustration\n * The name is used to generate the registry key and the loader key\n * The registry key is used to store and get the illustration data from the registry\n * The loader key is used to store and get the illustration loader from the loaders map\n * The function generates the correct registry key and loader key based on whether an loader exists for the illustration\n * If there is no loader registered for the collection, it falls back to the default collection\n */\nconst processName = (name: string) => {\n\tlet collection = getCollection();\n\tconst [set, illustrationName] = name.split(\"/\");\n\tlet registryKey = `${set}/${collection}/${illustrationName}`;\n\n\tif (!loaders.has(registryKey) && collection !== FALLBACK_COLLECTION) {\n\t\tcollection = FALLBACK_COLLECTION;\n\t\tregistryKey = `${set}/${collection}/${illustrationName}`;\n\t}\n\n\treturn {\n\t\tregistryKey,\n\t\tcollection,\n\t};\n};\n\n/**\n * Registers a custom illustration in the global registry using template functions.\n *\n * This is the recommended way to register illustrations as it accepts template functions\n * instead of raw SVG strings, preventing XSS vulnerabilities.\n *\n * @param name - The name of the illustration (without set prefix)\n * @param data - The illustration data (see {@link IllustrationData})\n *\n * @public\n * @since 2.17.0\n * @example\n * ```js\n * import { registerIllustration } from \"@ui5/webcomponents-base/dist/asset-registries/Illustrations.js\";\n *\n * registerIllustration(\"EmptyCart\", {\n * sceneTemplate: (component) => <svg>...</svg>,\n * dialogTemplate: (component) => <svg>...</svg>,\n * spotTemplate: (component) => <svg>...</svg>,\n * dotTemplate: (component) => <svg>...</svg>,\n * title: \"Your cart is empty\",\n * subtitle: \"Add items to get started\",\n * set: \"custom\"\n * });\n * ```\n */\nconst registerIllustration = (name: string, data: IllustrationData) => {\n\tconst collection = data.collection || FALLBACK_COLLECTION;\n\tregistry.set(`${data.set}/${collection}/${name}`, {\n\t\tdialogTemplate: data.dialogTemplate,\n\t\tsceneTemplate: data.sceneTemplate,\n\t\tspotTemplate: data.spotTemplate,\n\t\tdotTemplate: data.dotTemplate,\n\t\ttitle: data.title,\n\t\tsubtitle: data.subtitle,\n\t});\n};\n\n/**\n * Registers a custom illustration in the global registry.\n *\n * <b>Note:</b> This method is unsafe as it allows the SVG content to be passed as raw strings\n * through the `dialogSvg`, `sceneSvg`, `spotSvg`, and `dotSvg` properties of the `data`.\n * Ensure that the SVG content is properly validated.\n * Improperly sanitized SVG strings can lead to security vulnerabilities such as XSS (Cross-Site Scripting).\n *\n * @param name - The name of the illustration (without set prefix)\n * @param data - The illustration data (see {@link UnsafeIllustrationData})\n *\n * @public\n * @since 2.17.0\n * @example\n * ```js\n * import { unsafeRegisterIllustration } from \"@ui5/webcomponents-base/dist/asset-registries/Illustrations.js\";\n *\n * unsafeRegisterIllustration(\"EmptyCart\", {\n * sceneSvg: \"<svg>...</svg>\",\n * dialogSvg: \"<svg>...</svg>\",\n * spotSvg: \"<svg>...</svg>\",\n * dotSvg: \"<svg>...</svg>\",\n * title: \"Your cart is empty\",\n * subtitle: \"Add items to get started\",\n * set: \"custom\"\n * });\n * ```\n */\nconst unsafeRegisterIllustration = (name: string, data: UnsafeIllustrationData) => {\n\tconst collection = data.collection || FALLBACK_COLLECTION;\n\tregistry.set(`${data.set}/${collection}/${name}`, {\n\t\tdialogSvg: data.dialogSvg,\n\t\tsceneSvg: data.sceneSvg,\n\t\tspotSvg: data.spotSvg,\n\t\tdotSvg: data.dotSvg,\n\t\ttitle: data.title,\n\t\tsubtitle: data.subtitle,\n\t});\n};\n\nconst registerIllustrationLoader = (illustrationName: string, loader: IllustrationLoader) => {\n\tloaders.set(illustrationName, loader);\n};\n\nconst _loadIllustrationOnce = (illustrationName: string) => {\n\tconst { registryKey } = processName(illustrationName);\n\tif (!illustrationPromises.has(registryKey)) {\n\t\tif (!loaders.has(registryKey)) {\n\t\t\tconst illustrationPath = illustrationName.startsWith(\"fiori/\") ? illustrationName.replace(\"fiori/\", \"\") : illustrationName;\n\t\t\tthrow new Error(`No loader registered for the ${illustrationName} illustration. Probably you forgot to import the \"@ui5/webcomponents-fiori/dist/illustrations/${illustrationPath}.js\" module. Or you can import the \"@ui5/webcomponents-fiori/dist/illustrations/AllIllustrations.js\" module that will make all illustrations available, but fetch only the ones used.`);\n\t\t}\n\n\t\tconst loadIllustrations = loaders.get(registryKey)!;\n\t\tillustrationPromises.set(registryKey, loadIllustrations(registryKey));\n\t}\n\treturn illustrationPromises.get(registryKey);\n};\n\n/**\n * Synchronously retrieves illustration data from the registry.\n *\n * @param illustrationName - The illustration identifier in format \"set/name\"\n * @returns The illustration properties or undefined if not available\n *\n * @public\n */\nconst getIllustrationDataSync = (illustrationName: string) => {\n\tconst { registryKey } = processName(illustrationName);\n\treturn registry.get(registryKey);\n};\n\n/**\n * Asynchronously retrieves illustration data, loading it if necessary.\n *\n * @param illustrationName - The illustration identifier in format \"set/name\"\n * @returns Promise resolving to illustration properties or undefined\n *\n * @public\n */\nconst getIllustrationData = async (illustrationName: string) => {\n\tconst { registryKey } = processName(illustrationName);\n\n\tawait _loadIllustrationOnce(illustrationName);\n\treturn registry.get(registryKey);\n};\n\nexport {\n\tgetIllustrationDataSync,\n\tregisterIllustration,\n\tunsafeRegisterIllustration,\n\tregisterIllustrationLoader,\n\tgetIllustrationData,\n};\n\nexport type {\n\tIllustrationData,\n\tUnsafeIllustrationData,\n\tIllustrationProperties,\n\tUnsafeIllustrationProperties,\n};\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const VersionInfo = {
|
|
2
|
-
version: "2.
|
|
2
|
+
version: "2.17.0-rc.0",
|
|
3
3
|
major: 2,
|
|
4
|
-
minor:
|
|
5
|
-
patch:
|
|
4
|
+
minor: 17,
|
|
5
|
+
patch: 0,
|
|
6
6
|
suffix: "-rc.0",
|
|
7
7
|
isNext: false,
|
|
8
|
-
buildTime:
|
|
8
|
+
buildTime: 1762450078,
|
|
9
9
|
};
|
|
10
10
|
export default VersionInfo;
|
|
11
11
|
//# sourceMappingURL=VersionInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VersionInfo.js","sourceRoot":"","sources":["../../src/generated/VersionInfo.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IACnB,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,UAAU;CACrB,CAAC;AACF,eAAe,WAAW,CAAC","sourcesContent":["const VersionInfo = {\n\tversion: \"2.
|
|
1
|
+
{"version":3,"file":"VersionInfo.js","sourceRoot":"","sources":["../../src/generated/VersionInfo.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IACnB,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,UAAU;CACrB,CAAC;AACF,eAAe,WAAW,CAAC","sourcesContent":["const VersionInfo = {\n\tversion: \"2.17.0-rc.0\",\n\tmajor: 2,\n\tminor: 17,\n\tpatch: 0,\n\tsuffix: \"-rc.0\",\n\tisNext: false,\n\tbuildTime: 1762450078,\n};\nexport default VersionInfo;"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import u from"../getSharedResource.js";import{getTheme as g}from"../config/Theme.js";const c=new Map([["sap_horizon","V5"],["sap_horizon_dark","V5"],["sap_horizon_hcb","V5/HC"],["sap_horizon_hcw","V5/HC"]]),o="V4",l=new Map,n=u("SVGIllustration.registry",new Map),a=u("SVGIllustration.promises",new Map),m=()=>{const e=g();return c.has(e)?c.get(e):o},p=e=>{let t=m();const[s,r]=e.split("/");let i=`${s}/${t}/${r}`;return!l.has(i)&&t!==o&&(t=o,i=`${s}/${t}/${r}`),{registryKey:i,collection:t}},I=(e,t)=>{const s=t.collection||o;n.set(`${t.set}/${s}/${e}`,{dialogTemplate:t.dialogTemplate,sceneTemplate:t.sceneTemplate,spotTemplate:t.spotTemplate,dotTemplate:t.dotTemplate,title:t.title,subtitle:t.subtitle})},f=(e,t)=>{const s=t.collection||o;n.set(`${t.set}/${s}/${e}`,{dialogSvg:t.dialogSvg,sceneSvg:t.sceneSvg,spotSvg:t.spotSvg,dotSvg:t.dotSvg,title:t.title,subtitle:t.subtitle})},y=(e,t)=>{l.set(e,t)},T=e=>{const{registryKey:t}=p(e);if(!a.has(t)){if(!l.has(t)){const r=e.startsWith("fiori/")?e.replace("fiori/",""):e;throw new Error(`No loader registered for the ${e} illustration. Probably you forgot to import the "@ui5/webcomponents-fiori/dist/illustrations/${r}.js" module. Or you can import the "@ui5/webcomponents-fiori/dist/illustrations/AllIllustrations.js" module that will make all illustrations available, but fetch only the ones used.`)}const s=l.get(t);a.set(t,s(t))}return a.get(t)},h=e=>{const{registryKey:t}=p(e);return n.get(t)},d=async e=>{const{registryKey:t}=p(e);return await T(e),n.get(t)};export{h as getIllustrationDataSync,I as registerIllustration,f as unsafeRegisterIllustration,y as registerIllustrationLoader,d as getIllustrationData};
|
|
2
2
|
//# sourceMappingURL=Illustrations.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/asset-registries/Illustrations.ts"],
|
|
4
|
-
"sourcesContent": ["import getSharedResource from \"../getSharedResource.js\";\nimport type { I18nText } from \"../i18nBundle.js\";\nimport { getTheme } from \"../config/Theme.js\";\n\ntype IllustrationLoader = (illustrationName: string) => Promise<
|
|
5
|
-
"mappings": "aAAA,OAAOA,MAAuB,0BAE9B,OAAS,YAAAC,MAAgB,
|
|
6
|
-
"names": ["getSharedResource", "getTheme", "IllustrationCollections", "FALLBACK_COLLECTION", "loaders", "registry", "illustrationPromises", "getCollection", "theme", "processName", "name", "collection", "set", "illustrationName", "registryKey", "registerIllustration", "data", "registerIllustrationLoader", "loader", "_loadIllustrationOnce", "illustrationPath", "loadIllustrations", "getIllustrationDataSync", "getIllustrationData"]
|
|
4
|
+
"sourcesContent": ["import getSharedResource from \"../getSharedResource.js\";\nimport type { I18nText } from \"../i18nBundle.js\";\nimport { getTheme } from \"../config/Theme.js\";\nimport type { TemplateFunction } from \"../renderer/executeTemplate.js\";\n\n/**\n * Loader function for lazy-loading illustration data.\n */\ntype IllustrationLoader = (illustrationName: string) => Promise<UnsafeIllustrationData>;\n\n/**\n * Database properties shared by all illustration types.\n */\ntype IllustrationDatabase = {\n\t/** The illustration title text (supports i18n) */\n\ttitle: I18nText,\n\t/** The illustration subtitle text (supports i18n) */\n\tsubtitle: I18nText,\n};\n\n/**\n * Illustration properties using template functions (recommended).\n *\n * @public\n */\ntype IllustrationProperties = IllustrationDatabase & {\n\t/** Template function for the medium variant (M breakpoint, \u2264 681px) */\n\tdialogTemplate?: TemplateFunction,\n\t/** Template function for the large variant (L breakpoint, > 681px) */\n\tsceneTemplate?: TemplateFunction,\n\t/** Template function for the small variant (S breakpoint, \u2264 360px) */\n\tspotTemplate?: TemplateFunction,\n\t/** Template function for the extra small variant (XS breakpoint, \u2264 260px) */\n\tdotTemplate?: TemplateFunction,\n};\n\n/**\n * Illustration properties using raw SVG strings (unsafe).\n *\n * @public\n */\ntype UnsafeIllustrationProperties = IllustrationDatabase & {\n\t/** SVG content for the medium variant (M breakpoint, \u2264 681px) */\n\tdialogSvg: string,\n\t/** SVG content for the large variant (L breakpoint, > 681px) */\n\tsceneSvg: string,\n\t/** SVG content for the small variant (S breakpoint, \u2264 360px) */\n\tspotSvg: string,\n\t/** SVG content for the extra small variant (XS breakpoint, \u2264 260px) */\n\tdotSvg: string,\n};\n\n/**\n * Complete illustration data for registration (recommended).\n *\n * @public\n */\ntype IllustrationData = IllustrationProperties & {\n\t/** The illustration set identifier (e.g., \"custom\") */\n\tset: string,\n\t/** Collection identifier (defaults to \"V4\") */\n\tcollection?: string,\n};\n\n/**\n * Complete unsafe illustration data for registration.\n *\n * @public\n */\ntype UnsafeIllustrationData = UnsafeIllustrationProperties & {\n\t/** The illustration set identifier (e.g., \"custom\") */\n\tset: string,\n\t/** Collection identifier (defaults to \"V4\") */\n\tcollection?: string,\n};\n\nconst IllustrationCollections = new Map([\n\t[\"sap_horizon\", \"V5\"],\n\t[\"sap_horizon_dark\", \"V5\"],\n\t[\"sap_horizon_hcb\", \"V5/HC\"],\n\t[\"sap_horizon_hcw\", \"V5/HC\"],\n]);\n\nconst FALLBACK_COLLECTION = \"V4\";\n\nconst loaders = new Map<string, IllustrationLoader>();\nconst registry = getSharedResource<Map<string, IllustrationProperties | UnsafeIllustrationProperties>>(\"SVGIllustration.registry\", new Map());\nconst illustrationPromises = getSharedResource<Map<string, Promise<UnsafeIllustrationData>>>(\"SVGIllustration.promises\", new Map());\n\nconst getCollection = () => {\n\tconst theme = getTheme();\n\n\tif (IllustrationCollections.has(theme)) {\n\t\treturn IllustrationCollections.get(theme);\n\t}\n\n\treturn FALLBACK_COLLECTION;\n};\n\n/**\n * Processes the name of the illustration\n * The name is used to generate the registry key and the loader key\n * The registry key is used to store and get the illustration data from the registry\n * The loader key is used to store and get the illustration loader from the loaders map\n * The function generates the correct registry key and loader key based on whether an loader exists for the illustration\n * If there is no loader registered for the collection, it falls back to the default collection\n */\nconst processName = (name: string) => {\n\tlet collection = getCollection();\n\tconst [set, illustrationName] = name.split(\"/\");\n\tlet registryKey = `${set}/${collection}/${illustrationName}`;\n\n\tif (!loaders.has(registryKey) && collection !== FALLBACK_COLLECTION) {\n\t\tcollection = FALLBACK_COLLECTION;\n\t\tregistryKey = `${set}/${collection}/${illustrationName}`;\n\t}\n\n\treturn {\n\t\tregistryKey,\n\t\tcollection,\n\t};\n};\n\n/**\n * Registers a custom illustration in the global registry using template functions.\n *\n * This is the recommended way to register illustrations as it accepts template functions\n * instead of raw SVG strings, preventing XSS vulnerabilities.\n *\n * @param name - The name of the illustration (without set prefix)\n * @param data - The illustration data (see {@link IllustrationData})\n *\n * @public\n * @since 2.17.0\n * @example\n * ```js\n * import { registerIllustration } from \"@ui5/webcomponents-base/dist/asset-registries/Illustrations.js\";\n *\n * registerIllustration(\"EmptyCart\", {\n * sceneTemplate: (component) => <svg>...</svg>,\n * dialogTemplate: (component) => <svg>...</svg>,\n * spotTemplate: (component) => <svg>...</svg>,\n * dotTemplate: (component) => <svg>...</svg>,\n * title: \"Your cart is empty\",\n * subtitle: \"Add items to get started\",\n * set: \"custom\"\n * });\n * ```\n */\nconst registerIllustration = (name: string, data: IllustrationData) => {\n\tconst collection = data.collection || FALLBACK_COLLECTION;\n\tregistry.set(`${data.set}/${collection}/${name}`, {\n\t\tdialogTemplate: data.dialogTemplate,\n\t\tsceneTemplate: data.sceneTemplate,\n\t\tspotTemplate: data.spotTemplate,\n\t\tdotTemplate: data.dotTemplate,\n\t\ttitle: data.title,\n\t\tsubtitle: data.subtitle,\n\t});\n};\n\n/**\n * Registers a custom illustration in the global registry.\n *\n * <b>Note:</b> This method is unsafe as it allows the SVG content to be passed as raw strings\n * through the `dialogSvg`, `sceneSvg`, `spotSvg`, and `dotSvg` properties of the `data`.\n * Ensure that the SVG content is properly validated.\n * Improperly sanitized SVG strings can lead to security vulnerabilities such as XSS (Cross-Site Scripting).\n *\n * @param name - The name of the illustration (without set prefix)\n * @param data - The illustration data (see {@link UnsafeIllustrationData})\n *\n * @public\n * @since 2.17.0\n * @example\n * ```js\n * import { unsafeRegisterIllustration } from \"@ui5/webcomponents-base/dist/asset-registries/Illustrations.js\";\n *\n * unsafeRegisterIllustration(\"EmptyCart\", {\n * sceneSvg: \"<svg>...</svg>\",\n * dialogSvg: \"<svg>...</svg>\",\n * spotSvg: \"<svg>...</svg>\",\n * dotSvg: \"<svg>...</svg>\",\n * title: \"Your cart is empty\",\n * subtitle: \"Add items to get started\",\n * set: \"custom\"\n * });\n * ```\n */\nconst unsafeRegisterIllustration = (name: string, data: UnsafeIllustrationData) => {\n\tconst collection = data.collection || FALLBACK_COLLECTION;\n\tregistry.set(`${data.set}/${collection}/${name}`, {\n\t\tdialogSvg: data.dialogSvg,\n\t\tsceneSvg: data.sceneSvg,\n\t\tspotSvg: data.spotSvg,\n\t\tdotSvg: data.dotSvg,\n\t\ttitle: data.title,\n\t\tsubtitle: data.subtitle,\n\t});\n};\n\nconst registerIllustrationLoader = (illustrationName: string, loader: IllustrationLoader) => {\n\tloaders.set(illustrationName, loader);\n};\n\nconst _loadIllustrationOnce = (illustrationName: string) => {\n\tconst { registryKey } = processName(illustrationName);\n\tif (!illustrationPromises.has(registryKey)) {\n\t\tif (!loaders.has(registryKey)) {\n\t\t\tconst illustrationPath = illustrationName.startsWith(\"fiori/\") ? illustrationName.replace(\"fiori/\", \"\") : illustrationName;\n\t\t\tthrow new Error(`No loader registered for the ${illustrationName} illustration. Probably you forgot to import the \"@ui5/webcomponents-fiori/dist/illustrations/${illustrationPath}.js\" module. Or you can import the \"@ui5/webcomponents-fiori/dist/illustrations/AllIllustrations.js\" module that will make all illustrations available, but fetch only the ones used.`);\n\t\t}\n\n\t\tconst loadIllustrations = loaders.get(registryKey)!;\n\t\tillustrationPromises.set(registryKey, loadIllustrations(registryKey));\n\t}\n\treturn illustrationPromises.get(registryKey);\n};\n\n/**\n * Synchronously retrieves illustration data from the registry.\n *\n * @param illustrationName - The illustration identifier in format \"set/name\"\n * @returns The illustration properties or undefined if not available\n *\n * @public\n */\nconst getIllustrationDataSync = (illustrationName: string) => {\n\tconst { registryKey } = processName(illustrationName);\n\treturn registry.get(registryKey);\n};\n\n/**\n * Asynchronously retrieves illustration data, loading it if necessary.\n *\n * @param illustrationName - The illustration identifier in format \"set/name\"\n * @returns Promise resolving to illustration properties or undefined\n *\n * @public\n */\nconst getIllustrationData = async (illustrationName: string) => {\n\tconst { registryKey } = processName(illustrationName);\n\n\tawait _loadIllustrationOnce(illustrationName);\n\treturn registry.get(registryKey);\n};\n\nexport {\n\tgetIllustrationDataSync,\n\tregisterIllustration,\n\tunsafeRegisterIllustration,\n\tregisterIllustrationLoader,\n\tgetIllustrationData,\n};\n\nexport type {\n\tIllustrationData,\n\tUnsafeIllustrationData,\n\tIllustrationProperties,\n\tUnsafeIllustrationProperties,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OAAOA,MAAuB,0BAE9B,OAAS,YAAAC,MAAgB,qBA0EzB,MAAMC,EAA0B,IAAI,IAAI,CACvC,CAAC,cAAe,IAAI,EACpB,CAAC,mBAAoB,IAAI,EACzB,CAAC,kBAAmB,OAAO,EAC3B,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C,EAAyBP,GAA6B,CAC3D,KAAM,CAAE,YAAAC,CAAY,EAAIL,EAAYI,CAAgB,EACpD,GAAI,CAACP,EAAqB,IAAIQ,CAAW,EAAG,CAC3C,GAAI,CAACV,EAAQ,IAAIU,CAAW,EAAG,CAC9B,MAAMO,EAAmBR,EAAiB,WAAW,QAAQ,EAAIA,EAAiB,QAAQ,SAAU,EAAE,EAAIA,EAC1G,MAAM,IAAI,MAAM,gCAAgCA,CAAgB,iGAAiGQ,CAAgB,uLAAuL,CACzW,CAEA,MAAMC,EAAoBlB,EAAQ,IAAIU,CAAW,EACjDR,EAAqB,IAAIQ,EAAaQ,EAAkBR,CAAW,CAAC,CACrE,CACA,OAAOR,EAAqB,IAAIQ,CAAW,CAC5C,EAUMS,EAA2BV,GAA6B,CAC7D,KAAM,CAAE,YAAAC,CAAY,EAAIL,EAAYI,CAAgB,EACpD,OAAOR,EAAS,IAAIS,CAAW,CAChC,EAUMU,EAAsB,MAAOX,GAA6B,CAC/D,KAAM,CAAE,YAAAC,CAAY,EAAIL,EAAYI,CAAgB,EAEpD,aAAMO,EAAsBP,CAAgB,EACrCR,EAAS,IAAIS,CAAW,CAChC,EAEA,OACCS,KAAA,wBACAR,KAAA,qBACAE,KAAA,2BACAC,KAAA,2BACAM,KAAA",
|
|
6
|
+
"names": ["getSharedResource", "getTheme", "IllustrationCollections", "FALLBACK_COLLECTION", "loaders", "registry", "illustrationPromises", "getCollection", "theme", "processName", "name", "collection", "set", "illustrationName", "registryKey", "registerIllustration", "data", "unsafeRegisterIllustration", "registerIllustrationLoader", "loader", "_loadIllustrationOnce", "illustrationPath", "loadIllustrations", "getIllustrationDataSync", "getIllustrationData"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e={version:"2.
|
|
1
|
+
"use strict";const e={version:"2.17.0-rc.0",major:2,minor:17,patch:0,suffix:"-rc.0",isNext:!1,buildTime:1762450078};export default e;
|
|
2
2
|
//# sourceMappingURL=VersionInfo.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/generated/VersionInfo.ts"],
|
|
4
|
-
"sourcesContent": ["const VersionInfo = {\n\tversion: \"2.
|
|
4
|
+
"sourcesContent": ["const VersionInfo = {\n\tversion: \"2.17.0-rc.0\",\n\tmajor: 2,\n\tminor: 17,\n\tpatch: 0,\n\tsuffix: \"-rc.0\",\n\tisNext: false,\n\tbuildTime: 1762450078,\n};\nexport default VersionInfo;"],
|
|
5
5
|
"mappings": "aAAA,MAAMA,EAAc,CACnB,QAAS,cACT,MAAO,EACP,MAAO,GACP,MAAO,EACP,OAAQ,QACR,OAAQ,GACR,UAAW,UACZ,EACA,eAAeA",
|
|
6
6
|
"names": ["VersionInfo"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/webcomponents-base",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.17.0-rc.0",
|
|
4
4
|
"description": "UI5 Web Components: webcomponents.base",
|
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@openui5/sap.ui.core": "1.120.17",
|
|
65
65
|
"@sap-theming/theming-base-content": "11.29.3",
|
|
66
66
|
"@ui5/cypress-internal": "0.1.0",
|
|
67
|
-
"@ui5/webcomponents-tools": "2.
|
|
67
|
+
"@ui5/webcomponents-tools": "2.17.0-rc.0",
|
|
68
68
|
"chokidar-cli": "^3.0.0",
|
|
69
69
|
"clean-css": "^5.2.2",
|
|
70
70
|
"cypress": "^15.3.0",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"vite": "5.4.21"
|
|
79
79
|
},
|
|
80
80
|
"customElements": "dist/custom-elements.json",
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "72216c34fa3b5ecbad90836884677ca5d4edef7d"
|
|
82
82
|
}
|