@ui5/webcomponents-base 1.23.0-rc.5 → 1.23.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/Boot.d.ts +1 -1
  4. package/dist/Boot.js +1 -1
  5. package/dist/Boot.js.map +1 -1
  6. package/dist/CSP.d.ts +9 -6
  7. package/dist/CSP.js +9 -6
  8. package/dist/CSP.js.map +1 -1
  9. package/dist/IgnoreCustomElements.d.ts +3 -5
  10. package/dist/IgnoreCustomElements.js +3 -5
  11. package/dist/IgnoreCustomElements.js.map +1 -1
  12. package/dist/MediaRange.d.ts +6 -6
  13. package/dist/MediaRange.js +16 -16
  14. package/dist/MediaRange.js.map +1 -1
  15. package/dist/UI5ElementMetadata.d.ts +2 -2
  16. package/dist/UI5ElementMetadata.js +2 -2
  17. package/dist/UI5ElementMetadata.js.map +1 -1
  18. package/dist/asset-registries/Illustrations.d.ts +1 -0
  19. package/dist/asset-registries/Illustrations.js +1 -0
  20. package/dist/asset-registries/Illustrations.js.map +1 -1
  21. package/dist/asset-registries/i18n.d.ts +2 -2
  22. package/dist/asset-registries/i18n.js +2 -2
  23. package/dist/asset-registries/i18n.js.map +1 -1
  24. package/dist/asset-registries/util/IconCollectionsByTheme.d.ts +1 -1
  25. package/dist/asset-registries/util/IconCollectionsByTheme.js +1 -1
  26. package/dist/asset-registries/util/IconCollectionsByTheme.js.map +1 -1
  27. package/dist/config/Icons.d.ts +7 -7
  28. package/dist/config/Icons.js +7 -7
  29. package/dist/config/Icons.js.map +1 -1
  30. package/dist/config/Language.d.ts +1 -1
  31. package/dist/config/Language.js +1 -1
  32. package/dist/config/Language.js.map +1 -1
  33. package/dist/config/Theme.d.ts +1 -1
  34. package/dist/config/Theme.js +1 -1
  35. package/dist/config/Theme.js.map +1 -1
  36. package/dist/config/ThemeRoot.d.ts +2 -4
  37. package/dist/config/ThemeRoot.js +2 -4
  38. package/dist/config/ThemeRoot.js.map +1 -1
  39. package/dist/config/Timezone.d.ts +1 -1
  40. package/dist/config/Timezone.js +1 -1
  41. package/dist/config/Timezone.js.map +1 -1
  42. package/dist/custom-elements-internal.json +17 -17
  43. package/dist/custom-elements.json +17 -17
  44. package/dist/generated/VersionInfo.js +3 -3
  45. package/dist/generated/VersionInfo.js.map +1 -1
  46. package/dist/locale/applyDirection.d.ts +3 -2
  47. package/dist/locale/applyDirection.js +3 -2
  48. package/dist/locale/applyDirection.js.map +1 -1
  49. package/dist/types/DOMReference.d.ts +1 -1
  50. package/dist/types/DOMReference.js +1 -1
  51. package/dist/types/DOMReference.js.map +1 -1
  52. package/dist/util/createLinkInHead.d.ts +1 -1
  53. package/dist/util/createLinkInHead.js +1 -1
  54. package/dist/util/createLinkInHead.js.map +1 -1
  55. package/dist/util/createStyleInHead.d.ts +1 -1
  56. package/dist/util/createStyleInHead.js +1 -1
  57. package/dist/util/createStyleInHead.js.map +1 -1
  58. package/package.json +3 -3
package/dist/Boot.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  declare const isBooted: () => boolean;
2
2
  /**
3
3
  * Attaches a callback that will be executed after boot finishes.
4
- * <b>Note:</b> If the framework already booted, the callback will be immediately executed.
4
+ * **Note:** If the framework already booted, the callback will be immediately executed.
5
5
  * @public
6
6
  * @param { Function } listener
7
7
  */
package/dist/Boot.js CHANGED
@@ -15,7 +15,7 @@ const isBooted = () => {
15
15
  };
16
16
  /**
17
17
  * Attaches a callback that will be executed after boot finishes.
18
- * <b>Note:</b> If the framework already booted, the callback will be immediately executed.
18
+ * **Note:** If the framework already booted, the callback will be immediately executed.
19
19
  * @public
20
20
  * @param { Function } listener
21
21
  */
package/dist/Boot.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Boot.js","sourceRoot":"","sources":["../src/Boot.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO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AK,CAAC;QACpF,MAAM,YAAY,GAAG,UAAU,CAAsB,cAAc,CAAC,CAAC;QAErE,IAAI,cAAc,EAAE;YACnB,MAAM,cAAc,CAAC,IAAI,EAAE,CAAC;SAC5B;QAED,IAAI,YAAY,IAAI,CAAC,eAAe,EAAE;YACrC,YAAY,CAAC,IAAI,EAAE,CAAC;SACpB;QAED,MAAM,YAAY,EAAE,CAAC;QACrB,MAAM,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC7B,cAAc,IAAI,cAAc,CAAC,eAAe,EAAE,CAAC;QACnD,cAAc,EAAE,CAAC;QACjB,mBAAmB,EAAE,CAAC;QAEtB,OAAO,EAAE,CAAC;QAEV,MAAM,GAAG,IAAI,CAAC;QACd,MAAM,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC,CAAC;IAEF,WAAW,GAAG,IAAI,OAAO,CAAC,YAAiD,CAAC,CAAC;IAC7E,OAAO,WAAW,CAAC;AACpB,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,EAAE;IAC3C,MAAM,YAAY,GAAG,QAAQ,EAAE,CAAC;IAChC,IAAI,MAAM,IAAI,KAAK,KAAK,YAAY,EAAE;QACrC,UAAU,CAAC,YAAY,CAAC,CAAC;KACzB;AACF,CAAC,CAAC;AAEF,OAAO,EACN,IAAI,EACJ,UAAU,EACV,QAAQ,GACR,CAAC","sourcesContent":["import whenDOMReady from \"./util/whenDOMReady.js\";\nimport EventProvider from \"./EventProvider.js\";\nimport insertFontFace from \"./FontFace.js\";\nimport insertSystemCSSVars from \"./SystemCSSVars.js\";\nimport { getTheme } from \"./config/Theme.js\";\nimport applyTheme from \"./theming/applyTheme.js\";\nimport { registerCurrentRuntime } from \"./Runtimes.js\";\nimport { getFeature } from \"./FeaturesRegistry.js\";\nimport type OpenUI5Support from \"./features/OpenUI5Support.js\";\nimport type F6Navigation from \"./features/F6Navigation.js\";\nimport { PromiseResolve } from \"./types.js\";\nimport { attachThemeRegistered } from \"./theming/ThemeRegistered.js\";\n\nlet booted = false;\nlet bootPromise: Promise<void>;\nconst eventProvider = new EventProvider<void, void>();\n\nconst isBooted = (): boolean => {\n\treturn booted;\n};\n\n/**\n * Attaches a callback that will be executed after boot finishes.\n * <b>Note:</b> If the framework already booted, the callback will be immediately executed.\n * @public\n * @param { Function } listener\n */\nconst attachBoot = (listener: () => void) => {\n\tif (!booted) {\n\t\teventProvider.attachEvent(\"boot\", listener);\n\t\treturn;\n\t}\n\n\tlistener();\n};\n\nconst boot = async (): Promise<void> => {\n\tif (bootPromise !== undefined) {\n\t\treturn bootPromise;\n\t}\n\n\tconst bootExecutor = async (resolve: PromiseResolve) => {\n\t\tif (typeof document === \"undefined\") {\n\t\t\tresolve();\n\t\t\treturn;\n\t\t}\n\n\t\tattachThemeRegistered(onThemeRegistered);\n\n\t\tregisterCurrentRuntime();\n\n\t\tconst openUI5Support = getFeature<typeof OpenUI5Support>(\"OpenUI5Support\");\n\t\tconst isOpenUI5Loaded = openUI5Support ? openUI5Support.isOpenUI5Detected() : false;\n\t\tconst f6Navigation = getFeature<typeof F6Navigation>(\"F6Navigation\");\n\n\t\tif (openUI5Support) {\n\t\t\tawait openUI5Support.init();\n\t\t}\n\n\t\tif (f6Navigation && !isOpenUI5Loaded) {\n\t\t\tf6Navigation.init();\n\t\t}\n\n\t\tawait whenDOMReady();\n\t\tawait applyTheme(getTheme());\n\t\topenUI5Support && openUI5Support.attachListeners();\n\t\tinsertFontFace();\n\t\tinsertSystemCSSVars();\n\n\t\tresolve();\n\n\t\tbooted = true;\n\t\tawait eventProvider.fireEventAsync(\"boot\");\n\t};\n\n\tbootPromise = new Promise(bootExecutor as (resolve: PromiseResolve) => void);\n\treturn bootPromise;\n};\n\n/**\n * Callback, executed after theme properties registration\n * to apply the newly registered theme.\n * @private\n * @param { string } theme\n */\nconst onThemeRegistered = (theme: string) => {\n\tconst currentTheme = getTheme();\n\tif (booted && theme === currentTheme) {\n\t\tapplyTheme(currentTheme);\n\t}\n};\n\nexport {\n\tboot,\n\tattachBoot,\n\tisBooted,\n};\n"]}
1
+ {"version":3,"file":"Boot.js","sourceRoot":"","sources":["../src/Boot.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,cAAc,MAAM,eAAe,CAAC;AAC3C,OAAO,mBAAmB,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,UAAU,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,IAAI,MAAM,GAAG,KAAK,CAAC;AACnB,IAAI,WAA0B,CAAC;AAC/B,MAAM,aAAa,GAAG,IAAI,aAAa,EAAc,CAAC;AAEtD,MAAM,QAAQ,GAAG,GAAY,EAAE;IAC9B,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,GAAG,CAAC,QAAoB,EAAE,EAAE;IAC3C,IAAI,CAAC,MAAM,EAAE;QACZ,aAAa,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC5C,OAAO;KACP;IAED,QAAQ,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;IACtC,IAAI,WAAW,KAAK,SAAS,EAAE;QAC9B,OAAO,WAAW,CAAC;KACnB;IAED,MAAM,YAAY,GAAG,KAAK,EAAE,OAAuB,EAAE,EAAE;QACtD,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;YACpC,OAAO,EAAE,CAAC;YACV,OAAO;SACP;QAED,qBAAqB,CAAC,iBAAiB,CAAC,CAAC;QAEzC,sBAAsB,EAAE,CAAC;QAEzB,MAAM,cAAc,GAAG,UAAU,CAAwB,gBAAgB,CAAC,CAAC;QAC3E,MAAM,eAAe,GAAG,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QACpF,MAAM,YAAY,GAAG,UAAU,CAAsB,cAAc,CAAC,CAAC;QAErE,IAAI,cAAc,EAAE;YACnB,MAAM,cAAc,CAAC,IAAI,EAAE,CAAC;SAC5B;QAED,IAAI,YAAY,IAAI,CAAC,eAAe,EAAE;YACrC,YAAY,CAAC,IAAI,EAAE,CAAC;SACpB;QAED,MAAM,YAAY,EAAE,CAAC;QACrB,MAAM,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC7B,cAAc,IAAI,cAAc,CAAC,eAAe,EAAE,CAAC;QACnD,cAAc,EAAE,CAAC;QACjB,mBAAmB,EAAE,CAAC;QAEtB,OAAO,EAAE,CAAC;QAEV,MAAM,GAAG,IAAI,CAAC;QACd,MAAM,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC,CAAC;IAEF,WAAW,GAAG,IAAI,OAAO,CAAC,YAAiD,CAAC,CAAC;IAC7E,OAAO,WAAW,CAAC;AACpB,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,EAAE;IAC3C,MAAM,YAAY,GAAG,QAAQ,EAAE,CAAC;IAChC,IAAI,MAAM,IAAI,KAAK,KAAK,YAAY,EAAE;QACrC,UAAU,CAAC,YAAY,CAAC,CAAC;KACzB;AACF,CAAC,CAAC;AAEF,OAAO,EACN,IAAI,EACJ,UAAU,EACV,QAAQ,GACR,CAAC","sourcesContent":["import whenDOMReady from \"./util/whenDOMReady.js\";\nimport EventProvider from \"./EventProvider.js\";\nimport insertFontFace from \"./FontFace.js\";\nimport insertSystemCSSVars from \"./SystemCSSVars.js\";\nimport { getTheme } from \"./config/Theme.js\";\nimport applyTheme from \"./theming/applyTheme.js\";\nimport { registerCurrentRuntime } from \"./Runtimes.js\";\nimport { getFeature } from \"./FeaturesRegistry.js\";\nimport type OpenUI5Support from \"./features/OpenUI5Support.js\";\nimport type F6Navigation from \"./features/F6Navigation.js\";\nimport { PromiseResolve } from \"./types.js\";\nimport { attachThemeRegistered } from \"./theming/ThemeRegistered.js\";\n\nlet booted = false;\nlet bootPromise: Promise<void>;\nconst eventProvider = new EventProvider<void, void>();\n\nconst isBooted = (): boolean => {\n\treturn booted;\n};\n\n/**\n * Attaches a callback that will be executed after boot finishes.\n * **Note:** If the framework already booted, the callback will be immediately executed.\n * @public\n * @param { Function } listener\n */\nconst attachBoot = (listener: () => void) => {\n\tif (!booted) {\n\t\teventProvider.attachEvent(\"boot\", listener);\n\t\treturn;\n\t}\n\n\tlistener();\n};\n\nconst boot = async (): Promise<void> => {\n\tif (bootPromise !== undefined) {\n\t\treturn bootPromise;\n\t}\n\n\tconst bootExecutor = async (resolve: PromiseResolve) => {\n\t\tif (typeof document === \"undefined\") {\n\t\t\tresolve();\n\t\t\treturn;\n\t\t}\n\n\t\tattachThemeRegistered(onThemeRegistered);\n\n\t\tregisterCurrentRuntime();\n\n\t\tconst openUI5Support = getFeature<typeof OpenUI5Support>(\"OpenUI5Support\");\n\t\tconst isOpenUI5Loaded = openUI5Support ? openUI5Support.isOpenUI5Detected() : false;\n\t\tconst f6Navigation = getFeature<typeof F6Navigation>(\"F6Navigation\");\n\n\t\tif (openUI5Support) {\n\t\t\tawait openUI5Support.init();\n\t\t}\n\n\t\tif (f6Navigation && !isOpenUI5Loaded) {\n\t\t\tf6Navigation.init();\n\t\t}\n\n\t\tawait whenDOMReady();\n\t\tawait applyTheme(getTheme());\n\t\topenUI5Support && openUI5Support.attachListeners();\n\t\tinsertFontFace();\n\t\tinsertSystemCSSVars();\n\n\t\tresolve();\n\n\t\tbooted = true;\n\t\tawait eventProvider.fireEventAsync(\"boot\");\n\t};\n\n\tbootPromise = new Promise(bootExecutor as (resolve: PromiseResolve) => void);\n\treturn bootPromise;\n};\n\n/**\n * Callback, executed after theme properties registration\n * to apply the newly registered theme.\n * @private\n * @param { string } theme\n */\nconst onThemeRegistered = (theme: string) => {\n\tconst currentTheme = getTheme();\n\tif (booted && theme === currentTheme) {\n\t\tapplyTheme(currentTheme);\n\t}\n};\n\nexport {\n\tboot,\n\tattachBoot,\n\tisBooted,\n};\n"]}
package/dist/CSP.d.ts CHANGED
@@ -8,18 +8,21 @@
8
8
  declare const setPackageCSSRoot: (packageName: string, root: string) => void;
9
9
  declare const getUrl: (packageName: string, path: string) => string;
10
10
  /**
11
- * Call this function to enable or disable the usage of <link> tags instead of <style> tags to achieve CSP compliance
12
- * Example: "setUseLinks(true)" will unconditionally use <link> tags for all browsers;
13
- * Example: "setUseLinks(!document.adoptedStyleSheets) will only enable the usage of <link> tags for browsers that do not support constructable stylesheets.
11
+ * Call this function to enable or disable the usage of `<link>` tags instead of `<style>` tags to achieve CSP compliance
12
+ *
13
+ * Example: "setUseLinks(true)" will unconditionally use `<link>` tags for all browsers.
14
+ *
15
+ * Example: "setUseLinks(!document.adoptedStyleSheets) will only enable the usage of `<link>` tags for browsers that do not support constructable stylesheets.
14
16
  *
15
17
  * @public
16
18
  * @param use whether links will be used
17
19
  */
18
20
  declare const setUseLinks: (use: boolean) => void;
19
21
  /**
20
- * Call this function to enable or disable the preloading of <link> tags.
21
- * Note: only taken into account when <link> tags are being used.
22
- * Note: links are being preloaded by default, so call "setPreloadLinks(false)" to opt out of this.
22
+ * Call this function to enable or disable the preloading of `<link>` tags.
23
+ *
24
+ * **Note:** only taken into account when `<link>` tags are being used.
25
+ * **Note:** links are being preloaded by default, so call "setPreloadLinks(false)" to opt out of this.
23
26
  *
24
27
  * @public
25
28
  * @param preload
package/dist/CSP.js CHANGED
@@ -20,9 +20,11 @@ const getUrl = (packageName, path) => {
20
20
  return `${packageCSSRoot}${path}`;
21
21
  };
22
22
  /**
23
- * Call this function to enable or disable the usage of <link> tags instead of <style> tags to achieve CSP compliance
24
- * Example: "setUseLinks(true)" will unconditionally use <link> tags for all browsers;
25
- * Example: "setUseLinks(!document.adoptedStyleSheets) will only enable the usage of <link> tags for browsers that do not support constructable stylesheets.
23
+ * Call this function to enable or disable the usage of `<link>` tags instead of `<style>` tags to achieve CSP compliance
24
+ *
25
+ * Example: "setUseLinks(true)" will unconditionally use `<link>` tags for all browsers.
26
+ *
27
+ * Example: "setUseLinks(!document.adoptedStyleSheets) will only enable the usage of `<link>` tags for browsers that do not support constructable stylesheets.
26
28
  *
27
29
  * @public
28
30
  * @param use whether links will be used
@@ -31,9 +33,10 @@ const setUseLinks = (use) => {
31
33
  useLinks = use;
32
34
  };
33
35
  /**
34
- * Call this function to enable or disable the preloading of <link> tags.
35
- * Note: only taken into account when <link> tags are being used.
36
- * Note: links are being preloaded by default, so call "setPreloadLinks(false)" to opt out of this.
36
+ * Call this function to enable or disable the preloading of `<link>` tags.
37
+ *
38
+ * **Note:** only taken into account when `<link>` tags are being used.
39
+ * **Note:** links are being preloaded by default, so call "setPreloadLinks(false)" to opt out of this.
37
40
  *
38
41
  * @public
39
42
  * @param preload
package/dist/CSP.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"CSP.js","sourceRoot":"","sources":["../src/CSP.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;AACxC,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,IAAI,YAAY,GAAG,IAAI,CAAC;AAExB;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,CAAC,WAAmB,EAAE,IAAY,EAAE,EAAE;IAC/D,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,WAAmB,EAAE,IAAY,EAAE,EAAE;IACpD,MAAM,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAE9C,IAAI,CAAC,cAAc,EAAE;QACpB,OAAO,CAAC,IAAI,CAAC,kCAAkC,WAAW,8DAA8D,CAAC,CAAC,CAAC,sBAAsB;QACjJ,OAAO,EAAE,CAAC;KACV;IAED,OAAO,GAAG,cAAc,GAAG,IAAI,EAAE,CAAC;AACnC,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,WAAW,GAAG,CAAC,GAAY,EAAE,EAAE;IACpC,QAAQ,GAAG,GAAG,CAAC;AAChB,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC5C,YAAY,GAAG,OAAO,CAAC;AACxB,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,GAAG,EAAE;IAC3B,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,GAAG,EAAE;IAC/B,OAAO,YAAY,CAAC;AACrB,CAAC,CAAC;AAEF,OAAO,EACN,iBAAiB,EACjB,MAAM,EACN,WAAW,EACX,eAAe,EACf,cAAc,EACd,kBAAkB,GAClB,CAAC","sourcesContent":["const roots = new Map<string, string>();\nlet useLinks = false;\nlet preloadLinks = true;\n\n/**\n * Use this function to provide the path to the directory where the css resources for the given package will be served from.\n *\n * @public\n * @param packageName name of the package that is being configured\n * @param root path, accessible by the server that will serve the css resources\n */\nconst setPackageCSSRoot = (packageName: string, root: string) => {\n\troots.set(packageName, root);\n};\n\nconst getUrl = (packageName: string, path: string) => {\n\tconst packageCSSRoot = roots.get(packageName);\n\n\tif (!packageCSSRoot) {\n\t\tconsole.warn(`Root path to the CSS resources ${packageName} not provided - use \"setPackageCSSRoot\" to provide the root.`); // eslint-disable-line\n\t\treturn \"\";\n\t}\n\n\treturn `${packageCSSRoot}${path}`;\n};\n\n/**\n * Call this function to enable or disable the usage of <link> tags instead of <style> tags to achieve CSP compliance\n * Example: \"setUseLinks(true)\" will unconditionally use <link> tags for all browsers;\n * Example: \"setUseLinks(!document.adoptedStyleSheets) will only enable the usage of <link> tags for browsers that do not support constructable stylesheets.\n *\n * @public\n * @param use whether links will be used\n */\nconst setUseLinks = (use: boolean) => {\n\tuseLinks = use;\n};\n\n/**\n * Call this function to enable or disable the preloading of <link> tags.\n * Note: only taken into account when <link> tags are being used.\n * Note: links are being preloaded by default, so call \"setPreloadLinks(false)\" to opt out of this.\n *\n * @public\n * @param preload\n */\nconst setPreloadLinks = (preload: boolean) => {\n\tpreloadLinks = preload;\n};\n\nconst shouldUseLinks = () => {\n\treturn useLinks;\n};\n\nconst shouldPreloadLinks = () => {\n\treturn preloadLinks;\n};\n\nexport {\n\tsetPackageCSSRoot,\n\tgetUrl,\n\tsetUseLinks,\n\tsetPreloadLinks,\n\tshouldUseLinks,\n\tshouldPreloadLinks,\n};\n"]}
1
+ {"version":3,"file":"CSP.js","sourceRoot":"","sources":["../src/CSP.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;AACxC,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,IAAI,YAAY,GAAG,IAAI,CAAC;AAExB;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,CAAC,WAAmB,EAAE,IAAY,EAAE,EAAE;IAC/D,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,WAAmB,EAAE,IAAY,EAAE,EAAE;IACpD,MAAM,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAE9C,IAAI,CAAC,cAAc,EAAE;QACpB,OAAO,CAAC,IAAI,CAAC,kCAAkC,WAAW,8DAA8D,CAAC,CAAC,CAAC,sBAAsB;QACjJ,OAAO,EAAE,CAAC;KACV;IAED,OAAO,GAAG,cAAc,GAAG,IAAI,EAAE,CAAC;AACnC,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,WAAW,GAAG,CAAC,GAAY,EAAE,EAAE;IACpC,QAAQ,GAAG,GAAG,CAAC;AAChB,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC5C,YAAY,GAAG,OAAO,CAAC;AACxB,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,GAAG,EAAE;IAC3B,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,GAAG,EAAE;IAC/B,OAAO,YAAY,CAAC;AACrB,CAAC,CAAC;AAEF,OAAO,EACN,iBAAiB,EACjB,MAAM,EACN,WAAW,EACX,eAAe,EACf,cAAc,EACd,kBAAkB,GAClB,CAAC","sourcesContent":["const roots = new Map<string, string>();\nlet useLinks = false;\nlet preloadLinks = true;\n\n/**\n * Use this function to provide the path to the directory where the css resources for the given package will be served from.\n *\n * @public\n * @param packageName name of the package that is being configured\n * @param root path, accessible by the server that will serve the css resources\n */\nconst setPackageCSSRoot = (packageName: string, root: string) => {\n\troots.set(packageName, root);\n};\n\nconst getUrl = (packageName: string, path: string) => {\n\tconst packageCSSRoot = roots.get(packageName);\n\n\tif (!packageCSSRoot) {\n\t\tconsole.warn(`Root path to the CSS resources ${packageName} not provided - use \"setPackageCSSRoot\" to provide the root.`); // eslint-disable-line\n\t\treturn \"\";\n\t}\n\n\treturn `${packageCSSRoot}${path}`;\n};\n\n/**\n * Call this function to enable or disable the usage of `<link>` tags instead of `<style>` tags to achieve CSP compliance\n *\n * Example: \"setUseLinks(true)\" will unconditionally use `<link>` tags for all browsers.\n *\n * Example: \"setUseLinks(!document.adoptedStyleSheets) will only enable the usage of `<link>` tags for browsers that do not support constructable stylesheets.\n *\n * @public\n * @param use whether links will be used\n */\nconst setUseLinks = (use: boolean) => {\n\tuseLinks = use;\n};\n\n/**\n * Call this function to enable or disable the preloading of `<link>` tags.\n *\n * **Note:** only taken into account when `<link>` tags are being used.\n * **Note:** links are being preloaded by default, so call \"setPreloadLinks(false)\" to opt out of this.\n *\n * @public\n * @param preload\n */\nconst setPreloadLinks = (preload: boolean) => {\n\tpreloadLinks = preload;\n};\n\nconst shouldUseLinks = () => {\n\treturn useLinks;\n};\n\nconst shouldPreloadLinks = () => {\n\treturn preloadLinks;\n};\n\nexport {\n\tsetPackageCSSRoot,\n\tgetUrl,\n\tsetUseLinks,\n\tsetPreloadLinks,\n\tshouldUseLinks,\n\tshouldPreloadLinks,\n};\n"]}
@@ -1,15 +1,13 @@
1
1
  /**
2
2
  * Ignores all custom HTML elements with a given tag prefix to improve the rendering performance of the UI5 Web Components.
3
- * <br>
4
3
  *
5
- * <b>When used:</b> the UI5 Web Components framework treats all custom HTML elements,
4
+ * **When used:** the UI5 Web Components framework treats all custom HTML elements,
6
5
  * starting with the given prefix as if they are standard HTML elements, such as: `div`, `span`, etc, without additional processing.
7
- * <br>
8
6
  *
9
- * <b>When not used:</b> the framework waits for the slotted children to be defined and registered first,
7
+ * **When not used:** the framework waits for the slotted children to be defined and registered first,
10
8
  * because the state or visual appearance of the parent may rely on the slotted elements/children.
11
9
  *
12
- * <b>Note:</b> We recommend using `ignoreCustomElements` when slotting custom HTML elements (with only semantic purpose)
10
+ * **Note:** We recommend using `ignoreCustomElements` when slotting custom HTML elements (with only semantic purpose)
13
11
  * inside UI5 Web Components, to improve the time to render.
14
12
  *
15
13
  * @public
@@ -4,16 +4,14 @@
4
4
  const tagPrefixes = [];
5
5
  /**
6
6
  * Ignores all custom HTML elements with a given tag prefix to improve the rendering performance of the UI5 Web Components.
7
- * <br>
8
7
  *
9
- * <b>When used:</b> the UI5 Web Components framework treats all custom HTML elements,
8
+ * **When used:** the UI5 Web Components framework treats all custom HTML elements,
10
9
  * starting with the given prefix as if they are standard HTML elements, such as: `div`, `span`, etc, without additional processing.
11
- * <br>
12
10
  *
13
- * <b>When not used:</b> the framework waits for the slotted children to be defined and registered first,
11
+ * **When not used:** the framework waits for the slotted children to be defined and registered first,
14
12
  * because the state or visual appearance of the parent may rely on the slotted elements/children.
15
13
  *
16
- * <b>Note:</b> We recommend using `ignoreCustomElements` when slotting custom HTML elements (with only semantic purpose)
14
+ * **Note:** We recommend using `ignoreCustomElements` when slotting custom HTML elements (with only semantic purpose)
17
15
  * inside UI5 Web Components, to improve the time to render.
18
16
  *
19
17
  * @public
@@ -1 +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
+ {"version":3,"file":"IgnoreCustomElements.js","sourceRoot":"","sources":["../src/IgnoreCustomElements.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,GAAkB,EAAE,CAAC;AAEtC;;;;;;;;;;;;;;;GAeG;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 *\n * **When used:** 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 *\n * **When not used:** 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 * **Note:** 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"]}
@@ -9,12 +9,12 @@ declare enum RANGESETS {
9
9
  * A 4-step range set (S-M-L-XL).
10
10
  *
11
11
  * The ranges of this set are:
12
- * <ul>
13
- * <li><code>"S"</code>: For screens smaller than 600 pixels.</li>
14
- * <li><code>"M"</code>: For screens greater than or equal to 600 pixels and smaller than 1024 pixels.</li>
15
- * <li><code>"L"</code>: For screens greater than or equal to 1024 pixels and smaller than 1440 pixels.</li>
16
- * <li><code>"XL"</code>: For screens greater than or equal to 1440 pixels.</li>
17
- * </ul>
12
+ *
13
+ * - `"S"`: For screens smaller than 600 pixels.
14
+ * - `"M"`: For screens greater than or equal to 600 pixels and smaller than 1024 pixels.
15
+ * - `"L"`: For screens greater than or equal to 1024 pixels and smaller than 1440 pixels.
16
+ * - `"XL"`: For screens greater than or equal to 1440 pixels.
17
+ *
18
18
  *
19
19
  * @public
20
20
  */
@@ -15,12 +15,12 @@ var RANGESETS;
15
15
  * A 4-step range set (S-M-L-XL).
16
16
  *
17
17
  * The ranges of this set are:
18
- * <ul>
19
- * <li><code>"S"</code>: For screens smaller than 600 pixels.</li>
20
- * <li><code>"M"</code>: For screens greater than or equal to 600 pixels and smaller than 1024 pixels.</li>
21
- * <li><code>"L"</code>: For screens greater than or equal to 1024 pixels and smaller than 1440 pixels.</li>
22
- * <li><code>"XL"</code>: For screens greater than or equal to 1440 pixels.</li>
23
- * </ul>
18
+ *
19
+ * - `"S"`: For screens smaller than 600 pixels.
20
+ * - `"M"`: For screens greater than or equal to 600 pixels and smaller than 1024 pixels.
21
+ * - `"L"`: For screens greater than or equal to 1024 pixels and smaller than 1440 pixels.
22
+ * - `"XL"`: For screens greater than or equal to 1440 pixels.
23
+ *
24
24
  *
25
25
  * @public
26
26
  */
@@ -29,18 +29,18 @@ var RANGESETS;
29
29
  /**
30
30
  * Initializes a screen width media query range set.
31
31
  *
32
- * This initialization step makes the range set ready to be used for one of the other functions in namespace <code>MediaRange</code>.
32
+ * This initialization step makes the range set ready to be used for one of the other functions in namespace `MediaRange`.
33
33
  *
34
34
  * A range set can be defined as shown in the following example:
35
- * <pre>
35
+ * ```
36
36
  * MediaRange.initRangeSet("MyRangeSet", [200, 400], ["Small", "Medium", "Large"]);
37
- * </pre>
37
+ * ```
38
38
  * This example defines the following named ranges:
39
- * <ul>
40
- * <li><code>"Small"</code>: For screens smaller than 200 pixels.</li>
41
- * <li><code>"Medium"</code>: For screens greater than or equal to 200 pixels and smaller than 400 pixels.</li>
42
- * <li><code>"Large"</code>: For screens greater than or equal to 400 pixels.</li>
43
- * </ul>
39
+ *
40
+ * - `"Small"`: For screens smaller than 200 pixels.
41
+ * - `"Medium"`: For screens greater than or equal to 200 pixels and smaller than 400 pixels.
42
+ * - `"Large"`: For screens greater than or equal to 400 pixels.
43
+ *
44
44
  *
45
45
  * @param name The name of the range set to be initialized.
46
46
  * The name must be a valid id and consist only of letters and numeric digits.
@@ -52,12 +52,12 @@ const initRangeSet = (name, range) => {
52
52
  /**
53
53
  * Returns information about the current active range of the range set with the given name.
54
54
  *
55
- * If the optional parameter <code>width</code> is given, the active range will be determined for that width,
55
+ * If the optional parameter `width` is given, the active range will be determined for that width,
56
56
  * otherwise it is determined for the current window size.
57
57
  *
58
58
  * @param name The name of the range set. The range set must be initialized beforehand ({@link MediaRange.initRangeSet})
59
59
  * @param [width] An optional width, based on which the range should be determined;
60
- * If <code>width</code> is not provided, the window size will be used.
60
+ * If `width` is not provided, the window size will be used.
61
61
  * @returns The name of the current active interval of the range set.
62
62
  * @public
63
63
  */
@@ -1 +1 @@
1
- {"version":3,"file":"MediaRange.js","sourceRoot":"","sources":["../src/MediaRange.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG,IAAI,GAAG,EAAiB,CAAC;AAE7C,MAAM,iBAAiB,GAAU,IAAI,GAAG,EAAyB,CAAC;AAClE,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACrC,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AACxC,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AACzC,iBAAiB,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE9C;;;;GAIG;AACF,IAAK,SAeL;AAfA,WAAK,SAAS;IACd;;;;;;;;;;;;OAYG;IACH,mCAAsB,CAAA;AACvB,CAAC,EAfK,SAAS,KAAT,SAAS,QAed;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,KAAY,EAAE,EAAE;IACnD,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,KAAK,GAAG,MAAM,CAAC,UAAU,EAAU,EAAE;IAC3E,IAAI,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAErC,IAAI,CAAC,QAAQ,EAAE;QACd,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,YAAY,CAAE,CAAC;KACpD;IAED,IAAI,gBAAgB,CAAC;IACrB,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEzC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAC/B,IAAI,cAAc,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,cAAc,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE;YAC7D,gBAAgB,GAAG,GAAG,CAAC;SACvB;IACF,CAAC,CAAC,CAAC;IAEH,OAAO,gBAAgB,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,GAAG;IAClB,SAAS;IACT,YAAY;IACZ,eAAe;CACf,CAAC;AAEF,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;AAE9E,eAAe,UAAU,CAAC","sourcesContent":["type Range = Map<string, Array<number>>;\n\nconst mediaRanges = new Map<string, Range>();\n\nconst DEAFULT_RANGE_SET: Range = new Map<string, Array<number>>();\nDEAFULT_RANGE_SET.set(\"S\", [0, 599]);\nDEAFULT_RANGE_SET.set(\"M\", [600, 1023]);\nDEAFULT_RANGE_SET.set(\"L\", [1024, 1439]);\nDEAFULT_RANGE_SET.set(\"XL\", [1440, Infinity]);\n\n/**\n * Enumeration containing the names and settings of predefined screen width media query range sets.\n *\n * @public\n */\n enum RANGESETS {\n\t/**\n\t * A 4-step range set (S-M-L-XL).\n\t *\n\t * The ranges of this set are:\n\t * <ul>\n\t * <li><code>\"S\"</code>: For screens smaller than 600 pixels.</li>\n\t * <li><code>\"M\"</code>: For screens greater than or equal to 600 pixels and smaller than 1024 pixels.</li>\n\t * <li><code>\"L\"</code>: For screens greater than or equal to 1024 pixels and smaller than 1440 pixels.</li>\n\t * <li><code>\"XL\"</code>: For screens greater than or equal to 1440 pixels.</li>\n\t * </ul>\n\t *\n\t * @public\n\t */\n\tRANGE_4STEPS = \"4Step\",\n}\n\n/**\n * Initializes a screen width media query range set.\n *\n * This initialization step makes the range set ready to be used for one of the other functions in namespace <code>MediaRange</code>.\n *\n * A range set can be defined as shown in the following example:\n * <pre>\n * MediaRange.initRangeSet(\"MyRangeSet\", [200, 400], [\"Small\", \"Medium\", \"Large\"]);\n * </pre>\n * This example defines the following named ranges:\n * <ul>\n * <li><code>\"Small\"</code>: For screens smaller than 200 pixels.</li>\n * <li><code>\"Medium\"</code>: For screens greater than or equal to 200 pixels and smaller than 400 pixels.</li>\n * <li><code>\"Large\"</code>: For screens greater than or equal to 400 pixels.</li>\n * </ul>\n *\n * @param name The name of the range set to be initialized.\n * The name must be a valid id and consist only of letters and numeric digits.\n * @param range The given range set.\n */\nconst initRangeSet = (name: string, range: Range) => {\n\tmediaRanges.set(name, range);\n};\n\n/**\n * Returns information about the current active range of the range set with the given name.\n *\n * If the optional parameter <code>width</code> is given, the active range will be determined for that width,\n * otherwise it is determined for the current window size.\n *\n * @param name The name of the range set. The range set must be initialized beforehand ({@link MediaRange.initRangeSet})\n * @param [width] An optional width, based on which the range should be determined;\n * If <code>width</code> is not provided, the window size will be used.\n * @returns The name of the current active interval of the range set.\n * @public\n */\nconst getCurrentRange = (name: string, width = window.innerWidth): string => {\n\tlet rangeSet = mediaRanges.get(name);\n\n\tif (!rangeSet) {\n\t\trangeSet = mediaRanges.get(RANGESETS.RANGE_4STEPS)!;\n\t}\n\n\tlet currentRangeName;\n\tconst effectiveWidth = Math.floor(width);\n\n\trangeSet.forEach((value, key) => {\n\t\tif (effectiveWidth >= value[0] && effectiveWidth <= value[1]) {\n\t\t\tcurrentRangeName = key;\n\t\t}\n\t});\n\n\treturn currentRangeName || [...rangeSet.keys()][0];\n};\n\n/**\n * API for screen width changes.\n */\nconst MediaRange = {\n\tRANGESETS,\n\tinitRangeSet,\n\tgetCurrentRange,\n};\n\nMediaRange.initRangeSet(MediaRange.RANGESETS.RANGE_4STEPS, DEAFULT_RANGE_SET);\n\nexport default MediaRange;\n"]}
1
+ {"version":3,"file":"MediaRange.js","sourceRoot":"","sources":["../src/MediaRange.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG,IAAI,GAAG,EAAiB,CAAC;AAE7C,MAAM,iBAAiB,GAAU,IAAI,GAAG,EAAyB,CAAC;AAClE,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AACrC,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AACxC,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AACzC,iBAAiB,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE9C;;;;GAIG;AACF,IAAK,SAeL;AAfA,WAAK,SAAS;IACd;;;;;;;;;;;;OAYG;IACH,mCAAsB,CAAA;AACvB,CAAC,EAfK,SAAS,KAAT,SAAS,QAed;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,KAAY,EAAE,EAAE;IACnD,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,KAAK,GAAG,MAAM,CAAC,UAAU,EAAU,EAAE;IAC3E,IAAI,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAErC,IAAI,CAAC,QAAQ,EAAE;QACd,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,YAAY,CAAE,CAAC;KACpD;IAED,IAAI,gBAAgB,CAAC;IACrB,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEzC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAC/B,IAAI,cAAc,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,cAAc,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE;YAC7D,gBAAgB,GAAG,GAAG,CAAC;SACvB;IACF,CAAC,CAAC,CAAC;IAEH,OAAO,gBAAgB,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,GAAG;IAClB,SAAS;IACT,YAAY;IACZ,eAAe;CACf,CAAC;AAEF,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;AAE9E,eAAe,UAAU,CAAC","sourcesContent":["type Range = Map<string, Array<number>>;\n\nconst mediaRanges = new Map<string, Range>();\n\nconst DEAFULT_RANGE_SET: Range = new Map<string, Array<number>>();\nDEAFULT_RANGE_SET.set(\"S\", [0, 599]);\nDEAFULT_RANGE_SET.set(\"M\", [600, 1023]);\nDEAFULT_RANGE_SET.set(\"L\", [1024, 1439]);\nDEAFULT_RANGE_SET.set(\"XL\", [1440, Infinity]);\n\n/**\n * Enumeration containing the names and settings of predefined screen width media query range sets.\n *\n * @public\n */\n enum RANGESETS {\n\t/**\n\t * A 4-step range set (S-M-L-XL).\n\t *\n\t * The ranges of this set are:\n\t *\n\t * - `\"S\"`: For screens smaller than 600 pixels.\n\t * - `\"M\"`: For screens greater than or equal to 600 pixels and smaller than 1024 pixels.\n\t * - `\"L\"`: For screens greater than or equal to 1024 pixels and smaller than 1440 pixels.\n\t * - `\"XL\"`: For screens greater than or equal to 1440 pixels.\n\t *\n\t *\n\t * @public\n\t */\n\tRANGE_4STEPS = \"4Step\",\n}\n\n/**\n * Initializes a screen width media query range set.\n *\n * This initialization step makes the range set ready to be used for one of the other functions in namespace `MediaRange`.\n *\n * A range set can be defined as shown in the following example:\n * ```\n * MediaRange.initRangeSet(\"MyRangeSet\", [200, 400], [\"Small\", \"Medium\", \"Large\"]);\n * ```\n * This example defines the following named ranges:\n *\n * - `\"Small\"`: For screens smaller than 200 pixels.\n * - `\"Medium\"`: For screens greater than or equal to 200 pixels and smaller than 400 pixels.\n * - `\"Large\"`: For screens greater than or equal to 400 pixels.\n *\n *\n * @param name The name of the range set to be initialized.\n * The name must be a valid id and consist only of letters and numeric digits.\n * @param range The given range set.\n */\nconst initRangeSet = (name: string, range: Range) => {\n\tmediaRanges.set(name, range);\n};\n\n/**\n * Returns information about the current active range of the range set with the given name.\n *\n * If the optional parameter `width` is given, the active range will be determined for that width,\n * otherwise it is determined for the current window size.\n *\n * @param name The name of the range set. The range set must be initialized beforehand ({@link MediaRange.initRangeSet})\n * @param [width] An optional width, based on which the range should be determined;\n * If `width` is not provided, the window size will be used.\n * @returns The name of the current active interval of the range set.\n * @public\n */\nconst getCurrentRange = (name: string, width = window.innerWidth): string => {\n\tlet rangeSet = mediaRanges.get(name);\n\n\tif (!rangeSet) {\n\t\trangeSet = mediaRanges.get(RANGESETS.RANGE_4STEPS)!;\n\t}\n\n\tlet currentRangeName;\n\tconst effectiveWidth = Math.floor(width);\n\n\trangeSet.forEach((value, key) => {\n\t\tif (effectiveWidth >= value[0] && effectiveWidth <= value[1]) {\n\t\t\tcurrentRangeName = key;\n\t\t}\n\t});\n\n\treturn currentRangeName || [...rangeSet.keys()][0];\n};\n\n/**\n * API for screen width changes.\n */\nconst MediaRange = {\n\tRANGESETS,\n\tinitRangeSet,\n\tgetCurrentRange,\n};\n\nMediaRange.initRangeSet(MediaRange.RANGESETS.RANGE_4STEPS, DEAFULT_RANGE_SET);\n\nexport default MediaRange;\n"]}
@@ -45,14 +45,14 @@ declare class UI5ElementMetadata {
45
45
  /**
46
46
  * Validates the property's value and returns it if correct
47
47
  * or returns the default value if not.
48
- * <b>Note:</b> Only intended for use by UI5Element.js
48
+ * **Note:** Only intended for use by UI5Element.js
49
49
  * @public
50
50
  */
51
51
  static validatePropertyValue(value: PropertyValue, propData: Property): PropertyValue;
52
52
  /**
53
53
  * Validates the slot's value and returns it if correct
54
54
  * or throws an exception if not.
55
- * <b>Note:</b> Only intended for use by UI5Element.js
55
+ * **Note:** Only intended for use by UI5Element.js
56
56
  * @public
57
57
  */
58
58
  static validateSlotValue(value: Node, slotData: Slot): Node;
@@ -63,7 +63,7 @@ class UI5ElementMetadata {
63
63
  /**
64
64
  * Validates the property's value and returns it if correct
65
65
  * or returns the default value if not.
66
- * <b>Note:</b> Only intended for use by UI5Element.js
66
+ * **Note:** Only intended for use by UI5Element.js
67
67
  * @public
68
68
  */
69
69
  static validatePropertyValue(value, propData) {
@@ -76,7 +76,7 @@ class UI5ElementMetadata {
76
76
  /**
77
77
  * Validates the slot's value and returns it if correct
78
78
  * or throws an exception if not.
79
- * <b>Note:</b> Only intended for use by UI5Element.js
79
+ * **Note:** Only intended for use by UI5Element.js
80
80
  * @public
81
81
  */
82
82
  static validateSlotValue(value, slotData) {
@@ -1 +1 @@
1
- {"version":3,"file":"UI5ElementMetadata.js","sourceRoot":"","sources":["../src/UI5ElementMetadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AA4ChF;;;GAGG;AACH,MAAM,kBAAkB;IAIvB,YAAY,QAAkB;QAC7B,IAAI,CA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EAAE,EAAE;IAC1D,KAAK,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QAC5C,IAAI,CAAC,CAAC,EAAE,YAAY,QAAQ,CAAC,IAAI,CAAC,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;SAC1E;IACF,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import DataType from \"./types/DataType.js\";\nimport { camelToKebabCase } from \"./util/StringHelper.js\";\nimport { getSlottedNodes } from \"./util/SlotsHelper.js\";\nimport { getEffectiveScopingSuffixForTag } from \"./CustomElementsScopeUtils.js\";\n\ntype SlotInvalidation = {\n\tproperties: boolean | Array<string>,\n\tslots: boolean | Array<string>,\n}\n\ntype Slot = {\n\ttype: typeof Node | typeof HTMLElement,\n\tdefault?: boolean,\n\tpropertyName?: string,\n\tindividualSlots?: boolean,\n\tinvalidateOnChildChange?: boolean | SlotInvalidation,\n\tcloned?: boolean,\n};\n\ntype SlotValue = Node;\n\ntype Property = {\n\ttype?: BooleanConstructor | StringConstructor | ObjectConstructor | DataType\n\tvalidator?: DataType,\n\tdefaultValue?: PropertyValue,\n\tnoAttribute?: boolean,\n\tmultiple?: boolean,\n\tcompareValues?: boolean,\n}\n\ntype PropertyValue = boolean | number | string | object | undefined | null | DataType;\n\ntype EventData = Record<string, object>;\n\ntype Metadata = {\n\ttag?: string,\n\tmanagedSlots?: boolean,\n\tproperties?: Record<string, Property>,\n\tslots?: Record<string, Slot>,\n\tevents?: EventData,\n\tfastNavigation?: boolean,\n\tthemeAware?: boolean,\n\tlanguageAware?: boolean,\n};\n\ntype State = Record<string, PropertyValue | Array<SlotValue>>;\n\n/**\n * @class\n * @public\n */\nclass UI5ElementMetadata {\n\tmetadata: Metadata;\n\t_initialState: State | undefined;\n\n\tconstructor(metadata: Metadata) {\n\t\tthis.metadata = metadata;\n\t}\n\n\tgetInitialState() {\n\t\tif (Object.prototype.hasOwnProperty.call(this, \"_initialState\")) {\n\t\t\treturn this._initialState!;\n\t\t}\n\t\tconst initialState: State = {};\n\t\tconst slotsAreManaged = this.slotsAreManaged();\n\n\t\t// Initialize properties\n\t\tconst props = this.getProperties();\n\t\tfor (const propName in props) { // eslint-disable-line\n\t\t\tconst propType = props[propName].type;\n\t\t\tconst propDefaultValue = props[propName].defaultValue;\n\n\t\t\tif (propType === Boolean) {\n\t\t\t\tinitialState[propName] = false;\n\n\t\t\t\tif (propDefaultValue !== undefined) {\n\t\t\t\t\tconsole.warn(\"The 'defaultValue' metadata key is ignored for all booleans properties, they would be initialized with 'false' by default\"); // eslint-disable-line\n\t\t\t\t}\n\t\t\t} else if (props[propName].multiple) {\n\t\t\t\tObject.defineProperty(initialState, propName, {\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tget() {\n\t\t\t\t\t return [];\n\t\t\t\t\t},\n\t\t\t\t });\n\t\t\t} else if (propType === Object) {\n\t\t\t\tObject.defineProperty(initialState, propName, {\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tget() {\n\t\t\t\t\t return \"defaultValue\" in props[propName] ? props[propName].defaultValue : {};\n\t\t\t\t\t},\n\t\t\t\t });\n\t\t\t} else if (propType === String) {\n\t\t\t\tinitialState[propName] = \"defaultValue\" in props[propName] ? props[propName].defaultValue : \"\";\n\t\t\t} else {\n\t\t\t\tinitialState[propName] = propDefaultValue;\n\t\t\t}\n\t\t}\n\n\t\t// Initialize slots\n\t\tif (slotsAreManaged) {\n\t\t\tconst slots = this.getSlots();\n\t\t\tfor (const [slotName, slotData] of Object.entries<Slot>(slots)) { // eslint-disable-line\n\t\t\t\tconst propertyName = slotData.propertyName || slotName;\n\t\t\t\tinitialState[propertyName] = [];\n\t\t\t}\n\t\t}\n\n\t\tthis._initialState = initialState;\n\t\treturn initialState;\n\t}\n\n\t/**\n\t * Validates the property's value and returns it if correct\n\t * or returns the default value if not.\n\t * <b>Note:</b> Only intended for use by UI5Element.js\n\t * @public\n\t */\n\tstatic validatePropertyValue(value: PropertyValue, propData: Property): PropertyValue {\n\t\tconst isMultiple = propData.multiple;\n\t\tif (isMultiple && value) {\n\t\t\treturn (value as Array<PropertyValue>).map((propValue: PropertyValue) => validateSingleProperty(propValue, propData));\n\t\t}\n\t\treturn validateSingleProperty(value, propData);\n\t}\n\n\t/**\n\t * Validates the slot's value and returns it if correct\n\t * or throws an exception if not.\n\t * <b>Note:</b> Only intended for use by UI5Element.js\n\t * @public\n\t */\n\tstatic validateSlotValue(value: Node, slotData: Slot): Node {\n\t\treturn validateSingleSlot(value, slotData);\n\t}\n\n\t/**\n\t * Returns the tag of the UI5 Element without the scope\n\t * @public\n\t */\n\tgetPureTag(): string {\n\t\treturn this.metadata.tag || \"\";\n\t}\n\n\t/**\n\t * Returns the tag of the UI5 Element\n\t * @public\n\t */\n\tgetTag(): string {\n\t\tconst pureTag = this.metadata.tag;\n\n\t\tif (!pureTag) {\n\t\t\treturn \"\";\n\t\t}\n\n\t\tconst suffix = getEffectiveScopingSuffixForTag(pureTag);\n\t\tif (!suffix) {\n\t\t\treturn pureTag;\n\t\t}\n\n\t\treturn `${pureTag}-${suffix}`;\n\t}\n\n\t/**\n\t * Determines whether a property should have an attribute counterpart\n\t * @public\n\t * @param propName\n\t */\n\thasAttribute(propName: string): boolean {\n\t\tconst propData = this.getProperties()[propName];\n\t\treturn propData.type !== Object && !propData.noAttribute && !propData.multiple;\n\t}\n\n\t/**\n\t * Returns an array with the properties of the UI5 Element (in camelCase)\n\t * @public\n\t */\n\tgetPropertiesList(): Array<string> {\n\t\treturn Object.keys(this.getProperties());\n\t}\n\n\t/**\n\t * Returns an array with the attributes of the UI5 Element (in kebab-case)\n\t * @public\n\t */\n\tgetAttributesList(): Array<string> {\n\t\treturn this.getPropertiesList().filter(this.hasAttribute.bind(this)).map(camelToKebabCase);\n\t}\n\n\t/**\n\t * Determines whether this UI5 Element has a default slot of type Node, therefore can slot text\n\t */\n\tcanSlotText() {\n\t\treturn (this.getSlots().default)?.type === Node;\n\t}\n\n\t/**\n\t * Determines whether this UI5 Element supports any slots\n\t * @public\n\t */\n\thasSlots(): boolean {\n\t\treturn !!Object.entries(this.getSlots()).length;\n\t}\n\n\t/**\n\t * Determines whether this UI5 Element supports any slots with \"individualSlots: true\"\n\t * @public\n\t */\n\thasIndividualSlots(): boolean {\n\t\treturn this.slotsAreManaged() && Object.values(this.getSlots()).some(slotData => slotData.individualSlots);\n\t}\n\n\t/**\n\t * Determines whether this UI5 Element needs to invalidate if children are added/removed/changed\n\t * @public\n\t */\n\tslotsAreManaged(): boolean {\n\t\treturn !!this.metadata.managedSlots;\n\t}\n\n\t/**\n\t * Determines whether this control supports F6 fast navigation\n\t * @public\n\t */\n\tsupportsF6FastNavigation(): boolean {\n\t\treturn !!this.metadata.fastNavigation;\n\t}\n\n\t/**\n\t * Returns an object with key-value pairs of properties and their metadata definitions\n\t * @public\n\t */\n\tgetProperties(): Record<string, Property> {\n\t\tif (!this.metadata.properties) {\n\t\t\tthis.metadata.properties = {};\n\t\t}\n\t\treturn this.metadata.properties;\n\t}\n\n\t/**\n\t * Returns an object with key-value pairs of events and their metadata definitions\n\t * @public\n\t */\n\tgetEvents(): EventData {\n\t\tif (!this.metadata.events) {\n\t\t\tthis.metadata.events = {};\n\t\t}\n\t\treturn this.metadata.events;\n\t}\n\n\t/**\n\t * Returns an object with key-value pairs of slots and their metadata definitions\n\t * @public\n\t */\n\t getSlots(): Record<string, Slot> {\n\t\tif (!this.metadata.slots) {\n\t\t\tthis.metadata.slots = {};\n\t\t}\n\t\treturn this.metadata.slots;\n\t}\n\n\t/**\n\t * Determines whether this UI5 Element has any translatable texts (needs to be invalidated upon language change)\n\t */\n\tisLanguageAware(): boolean {\n\t\treturn !!this.metadata.languageAware;\n\t}\n\n\t/**\n\t * Determines whether this UI5 Element has any theme dependant carachteristics.\n\t */\n\t isThemeAware(): boolean {\n\t\treturn !!this.metadata.themeAware;\n\t}\n\n\t/**\n\t * Matches a changed entity (property/slot) with the given name against the \"invalidateOnChildChange\" configuration\n\t * and determines whether this should cause and invalidation\n\t *\n\t * @param slotName the name of the slot in which a child was changed\n\t * @param type the type of change in the child: \"property\" or \"slot\"\n\t * @param name the name of the property/slot that changed\n\t */\n\tshouldInvalidateOnChildChange(slotName: string, type: \"property\" | \"slot\", name: string): boolean {\n\t\tconst config = this.getSlots()[slotName].invalidateOnChildChange;\n\n\t\t// invalidateOnChildChange was not set in the slot metadata - by default child changes do not affect the component\n\t\tif (config === undefined) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// The simple format was used: invalidateOnChildChange: true/false;\n\t\tif (typeof config === \"boolean\") {\n\t\t\treturn config;\n\t\t}\n\n\t\t// The complex format was used: invalidateOnChildChange: { properties, slots }\n\t\tif (typeof config === \"object\") {\n\t\t\t// A property was changed\n\t\t\tif (type === \"property\") {\n\t\t\t\t// The config object does not have a properties field\n\t\t\t\tif (config.properties === undefined) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// The config object has the short format: properties: true/false\n\t\t\t\tif (typeof config.properties === \"boolean\") {\n\t\t\t\t\treturn config.properties;\n\t\t\t\t}\n\n\t\t\t\t// The config object has the complex format: properties: [...]\n\t\t\t\tif (Array.isArray(config.properties)) {\n\t\t\t\t\treturn config.properties.includes(name);\n\t\t\t\t}\n\n\t\t\t\tthrow new Error(\"Wrong format for invalidateOnChildChange.properties: boolean or array is expected\");\n\t\t\t}\n\n\t\t\t// A slot was changed\n\t\t\tif (type === \"slot\") {\n\t\t\t\t// The config object does not have a slots field\n\t\t\t\tif (config.slots === undefined) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// The config object has the short format: slots: true/false\n\t\t\t\tif (typeof config.slots === \"boolean\") {\n\t\t\t\t\treturn config.slots;\n\t\t\t\t}\n\n\t\t\t\t// The config object has the complex format: slots: [...]\n\t\t\t\tif (Array.isArray(config.slots)) {\n\t\t\t\t\treturn config.slots.includes(name);\n\t\t\t\t}\n\n\t\t\t\tthrow new Error(\"Wrong format for invalidateOnChildChange.slots: boolean or array is expected\");\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error(\"Wrong format for invalidateOnChildChange: boolean or object is expected\");\n\t}\n}\n\nconst validateSingleProperty = (value: PropertyValue, propData: Property) => {\n\tconst propertyType = propData.type;\n\tlet propertyValidator = propData.validator;\n\n\tif (propertyType && (propertyType as typeof DataType).isDataTypeClass) {\n\t\tpropertyValidator = propertyType as typeof DataType;\n\t}\n\n\tif (propertyValidator) {\n\t\treturn (propertyValidator as typeof DataType).isValid(value) ? value : propData.defaultValue;\n\t}\n\n\tif (!propertyType || propertyType === String) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string -- if an object is passed as a value to a string property, this was an error so displaying [object Object] will indicate the issue to the developer\n\t\treturn (typeof value === \"string\" || typeof value === \"undefined\" || value === null) ? value : value.toString();\n\t}\n\n\tif (propertyType === Boolean) {\n\t\treturn typeof value === \"boolean\" ? value : false;\n\t}\n\n\tif (propertyType === Object) {\n\t\treturn typeof value === \"object\" ? value : propData.defaultValue;\n\t}\n\n\t// Check if \"value\" is part of the enum (propertyType) values and return the defaultValue if not found.\n\treturn value as string in propertyType ? value : propData.defaultValue;\n};\n\nconst validateSingleSlot = (value: Node, slotData: Slot) => {\n\tvalue && getSlottedNodes(value).forEach(el => {\n\t\tif (!(el instanceof slotData.type)) {\n\t\t\tthrow new Error(`The element is not of type ${slotData.type.toString()}`);\n\t\t}\n\t});\n\n\treturn value;\n};\n\nexport default UI5ElementMetadata;\nexport type {\n\tProperty,\n\tPropertyValue,\n\tSlot,\n\tSlotValue,\n\tEventData,\n\tState,\n\tMetadata,\n};\n"]}
1
+ {"version":3,"file":"UI5ElementMetadata.js","sourceRoot":"","sources":["../src/UI5ElementMetadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,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CAAC,YAAY,CAAC;KACjE;IAED,uGAAuG;IACvG,OAAO,KAAe,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC;AACxE,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,KAAW,EAAE,QAAc,EAAE,EAAE;IAC1D,KAAK,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QAC5C,IAAI,CAAC,CAAC,EAAE,YAAY,QAAQ,CAAC,IAAI,CAAC,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;SAC1E;IACF,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import DataType from \"./types/DataType.js\";\nimport { camelToKebabCase } from \"./util/StringHelper.js\";\nimport { getSlottedNodes } from \"./util/SlotsHelper.js\";\nimport { getEffectiveScopingSuffixForTag } from \"./CustomElementsScopeUtils.js\";\n\ntype SlotInvalidation = {\n\tproperties: boolean | Array<string>,\n\tslots: boolean | Array<string>,\n}\n\ntype Slot = {\n\ttype: typeof Node | typeof HTMLElement,\n\tdefault?: boolean,\n\tpropertyName?: string,\n\tindividualSlots?: boolean,\n\tinvalidateOnChildChange?: boolean | SlotInvalidation,\n\tcloned?: boolean,\n};\n\ntype SlotValue = Node;\n\ntype Property = {\n\ttype?: BooleanConstructor | StringConstructor | ObjectConstructor | DataType\n\tvalidator?: DataType,\n\tdefaultValue?: PropertyValue,\n\tnoAttribute?: boolean,\n\tmultiple?: boolean,\n\tcompareValues?: boolean,\n}\n\ntype PropertyValue = boolean | number | string | object | undefined | null | DataType;\n\ntype EventData = Record<string, object>;\n\ntype Metadata = {\n\ttag?: string,\n\tmanagedSlots?: boolean,\n\tproperties?: Record<string, Property>,\n\tslots?: Record<string, Slot>,\n\tevents?: EventData,\n\tfastNavigation?: boolean,\n\tthemeAware?: boolean,\n\tlanguageAware?: boolean,\n};\n\ntype State = Record<string, PropertyValue | Array<SlotValue>>;\n\n/**\n * @class\n * @public\n */\nclass UI5ElementMetadata {\n\tmetadata: Metadata;\n\t_initialState: State | undefined;\n\n\tconstructor(metadata: Metadata) {\n\t\tthis.metadata = metadata;\n\t}\n\n\tgetInitialState() {\n\t\tif (Object.prototype.hasOwnProperty.call(this, \"_initialState\")) {\n\t\t\treturn this._initialState!;\n\t\t}\n\t\tconst initialState: State = {};\n\t\tconst slotsAreManaged = this.slotsAreManaged();\n\n\t\t// Initialize properties\n\t\tconst props = this.getProperties();\n\t\tfor (const propName in props) { // eslint-disable-line\n\t\t\tconst propType = props[propName].type;\n\t\t\tconst propDefaultValue = props[propName].defaultValue;\n\n\t\t\tif (propType === Boolean) {\n\t\t\t\tinitialState[propName] = false;\n\n\t\t\t\tif (propDefaultValue !== undefined) {\n\t\t\t\t\tconsole.warn(\"The 'defaultValue' metadata key is ignored for all booleans properties, they would be initialized with 'false' by default\"); // eslint-disable-line\n\t\t\t\t}\n\t\t\t} else if (props[propName].multiple) {\n\t\t\t\tObject.defineProperty(initialState, propName, {\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tget() {\n\t\t\t\t\t return [];\n\t\t\t\t\t},\n\t\t\t\t });\n\t\t\t} else if (propType === Object) {\n\t\t\t\tObject.defineProperty(initialState, propName, {\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tget() {\n\t\t\t\t\t return \"defaultValue\" in props[propName] ? props[propName].defaultValue : {};\n\t\t\t\t\t},\n\t\t\t\t });\n\t\t\t} else if (propType === String) {\n\t\t\t\tinitialState[propName] = \"defaultValue\" in props[propName] ? props[propName].defaultValue : \"\";\n\t\t\t} else {\n\t\t\t\tinitialState[propName] = propDefaultValue;\n\t\t\t}\n\t\t}\n\n\t\t// Initialize slots\n\t\tif (slotsAreManaged) {\n\t\t\tconst slots = this.getSlots();\n\t\t\tfor (const [slotName, slotData] of Object.entries<Slot>(slots)) { // eslint-disable-line\n\t\t\t\tconst propertyName = slotData.propertyName || slotName;\n\t\t\t\tinitialState[propertyName] = [];\n\t\t\t}\n\t\t}\n\n\t\tthis._initialState = initialState;\n\t\treturn initialState;\n\t}\n\n\t/**\n\t * Validates the property's value and returns it if correct\n\t * or returns the default value if not.\n\t * **Note:** Only intended for use by UI5Element.js\n\t * @public\n\t */\n\tstatic validatePropertyValue(value: PropertyValue, propData: Property): PropertyValue {\n\t\tconst isMultiple = propData.multiple;\n\t\tif (isMultiple && value) {\n\t\t\treturn (value as Array<PropertyValue>).map((propValue: PropertyValue) => validateSingleProperty(propValue, propData));\n\t\t}\n\t\treturn validateSingleProperty(value, propData);\n\t}\n\n\t/**\n\t * Validates the slot's value and returns it if correct\n\t * or throws an exception if not.\n\t * **Note:** Only intended for use by UI5Element.js\n\t * @public\n\t */\n\tstatic validateSlotValue(value: Node, slotData: Slot): Node {\n\t\treturn validateSingleSlot(value, slotData);\n\t}\n\n\t/**\n\t * Returns the tag of the UI5 Element without the scope\n\t * @public\n\t */\n\tgetPureTag(): string {\n\t\treturn this.metadata.tag || \"\";\n\t}\n\n\t/**\n\t * Returns the tag of the UI5 Element\n\t * @public\n\t */\n\tgetTag(): string {\n\t\tconst pureTag = this.metadata.tag;\n\n\t\tif (!pureTag) {\n\t\t\treturn \"\";\n\t\t}\n\n\t\tconst suffix = getEffectiveScopingSuffixForTag(pureTag);\n\t\tif (!suffix) {\n\t\t\treturn pureTag;\n\t\t}\n\n\t\treturn `${pureTag}-${suffix}`;\n\t}\n\n\t/**\n\t * Determines whether a property should have an attribute counterpart\n\t * @public\n\t * @param propName\n\t */\n\thasAttribute(propName: string): boolean {\n\t\tconst propData = this.getProperties()[propName];\n\t\treturn propData.type !== Object && !propData.noAttribute && !propData.multiple;\n\t}\n\n\t/**\n\t * Returns an array with the properties of the UI5 Element (in camelCase)\n\t * @public\n\t */\n\tgetPropertiesList(): Array<string> {\n\t\treturn Object.keys(this.getProperties());\n\t}\n\n\t/**\n\t * Returns an array with the attributes of the UI5 Element (in kebab-case)\n\t * @public\n\t */\n\tgetAttributesList(): Array<string> {\n\t\treturn this.getPropertiesList().filter(this.hasAttribute.bind(this)).map(camelToKebabCase);\n\t}\n\n\t/**\n\t * Determines whether this UI5 Element has a default slot of type Node, therefore can slot text\n\t */\n\tcanSlotText() {\n\t\treturn (this.getSlots().default)?.type === Node;\n\t}\n\n\t/**\n\t * Determines whether this UI5 Element supports any slots\n\t * @public\n\t */\n\thasSlots(): boolean {\n\t\treturn !!Object.entries(this.getSlots()).length;\n\t}\n\n\t/**\n\t * Determines whether this UI5 Element supports any slots with \"individualSlots: true\"\n\t * @public\n\t */\n\thasIndividualSlots(): boolean {\n\t\treturn this.slotsAreManaged() && Object.values(this.getSlots()).some(slotData => slotData.individualSlots);\n\t}\n\n\t/**\n\t * Determines whether this UI5 Element needs to invalidate if children are added/removed/changed\n\t * @public\n\t */\n\tslotsAreManaged(): boolean {\n\t\treturn !!this.metadata.managedSlots;\n\t}\n\n\t/**\n\t * Determines whether this control supports F6 fast navigation\n\t * @public\n\t */\n\tsupportsF6FastNavigation(): boolean {\n\t\treturn !!this.metadata.fastNavigation;\n\t}\n\n\t/**\n\t * Returns an object with key-value pairs of properties and their metadata definitions\n\t * @public\n\t */\n\tgetProperties(): Record<string, Property> {\n\t\tif (!this.metadata.properties) {\n\t\t\tthis.metadata.properties = {};\n\t\t}\n\t\treturn this.metadata.properties;\n\t}\n\n\t/**\n\t * Returns an object with key-value pairs of events and their metadata definitions\n\t * @public\n\t */\n\tgetEvents(): EventData {\n\t\tif (!this.metadata.events) {\n\t\t\tthis.metadata.events = {};\n\t\t}\n\t\treturn this.metadata.events;\n\t}\n\n\t/**\n\t * Returns an object with key-value pairs of slots and their metadata definitions\n\t * @public\n\t */\n\t getSlots(): Record<string, Slot> {\n\t\tif (!this.metadata.slots) {\n\t\t\tthis.metadata.slots = {};\n\t\t}\n\t\treturn this.metadata.slots;\n\t}\n\n\t/**\n\t * Determines whether this UI5 Element has any translatable texts (needs to be invalidated upon language change)\n\t */\n\tisLanguageAware(): boolean {\n\t\treturn !!this.metadata.languageAware;\n\t}\n\n\t/**\n\t * Determines whether this UI5 Element has any theme dependant carachteristics.\n\t */\n\t isThemeAware(): boolean {\n\t\treturn !!this.metadata.themeAware;\n\t}\n\n\t/**\n\t * Matches a changed entity (property/slot) with the given name against the \"invalidateOnChildChange\" configuration\n\t * and determines whether this should cause and invalidation\n\t *\n\t * @param slotName the name of the slot in which a child was changed\n\t * @param type the type of change in the child: \"property\" or \"slot\"\n\t * @param name the name of the property/slot that changed\n\t */\n\tshouldInvalidateOnChildChange(slotName: string, type: \"property\" | \"slot\", name: string): boolean {\n\t\tconst config = this.getSlots()[slotName].invalidateOnChildChange;\n\n\t\t// invalidateOnChildChange was not set in the slot metadata - by default child changes do not affect the component\n\t\tif (config === undefined) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// The simple format was used: invalidateOnChildChange: true/false;\n\t\tif (typeof config === \"boolean\") {\n\t\t\treturn config;\n\t\t}\n\n\t\t// The complex format was used: invalidateOnChildChange: { properties, slots }\n\t\tif (typeof config === \"object\") {\n\t\t\t// A property was changed\n\t\t\tif (type === \"property\") {\n\t\t\t\t// The config object does not have a properties field\n\t\t\t\tif (config.properties === undefined) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// The config object has the short format: properties: true/false\n\t\t\t\tif (typeof config.properties === \"boolean\") {\n\t\t\t\t\treturn config.properties;\n\t\t\t\t}\n\n\t\t\t\t// The config object has the complex format: properties: [...]\n\t\t\t\tif (Array.isArray(config.properties)) {\n\t\t\t\t\treturn config.properties.includes(name);\n\t\t\t\t}\n\n\t\t\t\tthrow new Error(\"Wrong format for invalidateOnChildChange.properties: boolean or array is expected\");\n\t\t\t}\n\n\t\t\t// A slot was changed\n\t\t\tif (type === \"slot\") {\n\t\t\t\t// The config object does not have a slots field\n\t\t\t\tif (config.slots === undefined) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t// The config object has the short format: slots: true/false\n\t\t\t\tif (typeof config.slots === \"boolean\") {\n\t\t\t\t\treturn config.slots;\n\t\t\t\t}\n\n\t\t\t\t// The config object has the complex format: slots: [...]\n\t\t\t\tif (Array.isArray(config.slots)) {\n\t\t\t\t\treturn config.slots.includes(name);\n\t\t\t\t}\n\n\t\t\t\tthrow new Error(\"Wrong format for invalidateOnChildChange.slots: boolean or array is expected\");\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error(\"Wrong format for invalidateOnChildChange: boolean or object is expected\");\n\t}\n}\n\nconst validateSingleProperty = (value: PropertyValue, propData: Property) => {\n\tconst propertyType = propData.type;\n\tlet propertyValidator = propData.validator;\n\n\tif (propertyType && (propertyType as typeof DataType).isDataTypeClass) {\n\t\tpropertyValidator = propertyType as typeof DataType;\n\t}\n\n\tif (propertyValidator) {\n\t\treturn (propertyValidator as typeof DataType).isValid(value) ? value : propData.defaultValue;\n\t}\n\n\tif (!propertyType || propertyType === String) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string -- if an object is passed as a value to a string property, this was an error so displaying [object Object] will indicate the issue to the developer\n\t\treturn (typeof value === \"string\" || typeof value === \"undefined\" || value === null) ? value : value.toString();\n\t}\n\n\tif (propertyType === Boolean) {\n\t\treturn typeof value === \"boolean\" ? value : false;\n\t}\n\n\tif (propertyType === Object) {\n\t\treturn typeof value === \"object\" ? value : propData.defaultValue;\n\t}\n\n\t// Check if \"value\" is part of the enum (propertyType) values and return the defaultValue if not found.\n\treturn value as string in propertyType ? value : propData.defaultValue;\n};\n\nconst validateSingleSlot = (value: Node, slotData: Slot) => {\n\tvalue && getSlottedNodes(value).forEach(el => {\n\t\tif (!(el instanceof slotData.type)) {\n\t\t\tthrow new Error(`The element is not of type ${slotData.type.toString()}`);\n\t\t}\n\t});\n\n\treturn value;\n};\n\nexport default UI5ElementMetadata;\nexport type {\n\tProperty,\n\tPropertyValue,\n\tSlot,\n\tSlotValue,\n\tEventData,\n\tState,\n\tMetadata,\n};\n"]}
@@ -4,6 +4,7 @@ type IllustrationProperties = {
4
4
  dialogSvg: string;
5
5
  sceneSvg: string;
6
6
  spotSvg: string;
7
+ dotSvg: string;
7
8
  title: I18nText;
8
9
  subtitle: I18nText;
9
10
  };
@@ -44,6 +44,7 @@ const registerIllustration = (name, data) => {
44
44
  dialogSvg: data.dialogSvg,
45
45
  sceneSvg: data.sceneSvg,
46
46
  spotSvg: data.spotSvg,
47
+ dotSvg: data.dotSvg,
47
48
  title: data.title,
48
49
  subtitle: data.subtitle,
49
50
  });
@@ -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;AAiB9C,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,oBAAoB,GAAG,iBAAiB,CAAyC,0BAA0B,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;AAE9H,MAAM,aAAa,GAAG,GAAG,EAAE;IAC1B,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,IAAI,uBAAuB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QACvC,OAAO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,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\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\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,oB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AE,CAAC;QACpD,oBAAoB,CAAC,GAAG,CAAC,WAAW,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;KACtE;IACD,OAAO,oBAAoB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,gBAAwB,EAAE,EAAE;IAC5D,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC,gBAAgB,CAAC,CAAC;IACtD,OAAO,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAClC,CAAC,CAAC;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"]}
@@ -14,8 +14,8 @@ declare const getI18nBundleData: (packageName: string) => I18nData | null | unde
14
14
  * This method preforms the asynchronous task of fetching the actual text resources. It will fetch
15
15
  * each text resource over the network once (even for multiple calls to the same method).
16
16
  * It should be fully finished before the i18nBundle class is created in the webcomponents.
17
- * This method uses the bundle URLs that are populated by the <code>registerI18nBundle</code> method.
18
- * To simplify the usage, the synchronization of both methods happens internally for the same <code>bundleId</code>
17
+ * This method uses the bundle URLs that are populated by the `registerI18nBundle` method.
18
+ * To simplify the usage, the synchronization of both methods happens internally for the same `bundleId`
19
19
  * @param {packageName} packageName the NPM package name
20
20
  * @public
21
21
  */
@@ -55,8 +55,8 @@ const useFallbackBundle = (packageName, localeId) => {
55
55
  * This method preforms the asynchronous task of fetching the actual text resources. It will fetch
56
56
  * each text resource over the network once (even for multiple calls to the same method).
57
57
  * It should be fully finished before the i18nBundle class is created in the webcomponents.
58
- * This method uses the bundle URLs that are populated by the <code>registerI18nBundle</code> method.
59
- * To simplify the usage, the synchronization of both methods happens internally for the same <code>bundleId</code>
58
+ * This method uses the bundle URLs that are populated by the `registerI18nBundle` method.
59
+ * To simplify the usage, the synchronization of both methods happens internally for the same `bundleId`
60
60
  * @param {packageName} packageName the NPM package name
61
61
  * @public
62
62
  */
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/asset-registries/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,kBAAkB,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAKhE,8DAA8D;AAC9D,MAAM,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;AAC/B,MAAM,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;AAEjC,MAAM,UAAU,GAAG,IAAI,GAAG,EAA2B,CAAC;AACtD,MAAM,cAAc,GAAG,IAAI,GAAG,EAA6B,CAAC;AAC5D,MAAM,OAAO,GAAG,IAAI,GAAG,EAAsB,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,kBAAkB,GAAG,CAAC,WAAmB,EAAE,QAAgB,EAAE,MAAkB,EAAE,EAAE;IACxF,yBAAyB;IACzB,MAAM,SAAS,GAAG,GAAG,WAAW,IAAI,QAAQ,EAAE,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,WAAmB,EAAE,IAAqB,EAAE,EAAE;IACzE,UAAU,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,WAAmB,EAAE,EAAE;IACjD,OAAO,UAAU,CAAC,GAAG,CAAC,WAAW,C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cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YAC9B,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,yBAAyB;SACnD;KACD;AACF,CAAC,CAAC;AAEF,8GAA8G;AAC9G,oBAAoB,CAAC,CAAC,IAAY,CAAC,yBAAyB,EAAE,EAAE;IAC/D,MAAM,WAAW,GAAG,CAAC,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3C,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC,CAAC;AAEH,OAAO,EACN,kBAAkB,EAClB,eAAe,EACf,iBAAiB,GACjB,CAAC","sourcesContent":["import getLocale from \"../locale/getLocale.js\";\nimport { attachLanguageChange } from \"../locale/languageChange.js\";\nimport normalizeLocale from \"../locale/normalizeLocale.js\";\nimport nextFallbackLocale from \"../locale/nextFallbackLocale.js\";\nimport { DEFAULT_LANGUAGE } from \"../generated/AssetParameters.js\";\nimport { getFetchDefaultLanguage } from \"../config/Language.js\";\n\ntype I18nLoader = (localeId: string) => Promise<I18nData>;\ntype I18nData = Record<string, string>;\n\n// contains package names for which the warning has been shown\nconst warningShown = new Set();\nconst reportedErrors = new Set();\n\nconst bundleData = new Map<string, I18nData | null>();\nconst bundlePromises = new Map<string, Promise<I18nData>>();\nconst loaders = new Map<string, I18nLoader>();\n\n/**\n * Registers i18n loader function for given package and locale.\n *\n * @public\n * @param {string} packageName for which package this loader can fetch data\n * @param {string} localeId locale that this loader can handle\n * @param {function} loader async function that will be passed a localeId and should return a JSON object\n */\nconst registerI18nLoader = (packageName: string, localeId: string, loader: I18nLoader) => {\n\t// register loader by key\n\tconst bundleKey = `${packageName}/${localeId}`;\n\tloaders.set(bundleKey, loader);\n};\n\nconst _setI18nBundleData = (packageName: string, data: I18nData | null) => {\n\tbundleData.set(packageName, data);\n};\n\nconst getI18nBundleData = (packageName: string) => {\n\treturn bundleData.get(packageName);\n};\n\nconst _hasLoader = (packageName: string, localeId: string) => {\n\tconst bundleKey = `${packageName}/${localeId}`;\n\treturn loaders.has(bundleKey);\n};\n\n// load bundle over the network once\nconst _loadMessageBundleOnce = (packageName: string, localeId: string) => {\n\tconst bundleKey = `${packageName}/${localeId}`;\n\tconst loadMessageBundle = loaders.get(bundleKey);\n\n\tif (loadMessageBundle && !bundlePromises.get(bundleKey)) {\n\t\tbundlePromises.set(bundleKey, loadMessageBundle(localeId));\n\t}\n\n\treturn bundlePromises.get(bundleKey)!; // Investigate if i18n loader exists and this won't return undefined.\n};\n\nconst _showAssetsWarningOnce = (packageName: string) => {\n\tif (!warningShown.has(packageName)) {\n\t\tconsole.warn(`[${packageName}]: Message bundle assets are not configured. Falling back to English texts.`, /* eslint-disable-line */\n\t\t\t` Add \\`import \"${packageName}/dist/Assets.js\"\\` in your bundle and make sure your build tool supports dynamic imports and JSON imports. See section \"Assets\" in the documentation for more information.`); /* eslint-disable-line */\n\t\twarningShown.add(packageName);\n\t}\n};\n\nconst useFallbackBundle = (packageName: string, localeId: string) => {\n\treturn localeId !== DEFAULT_LANGUAGE && !_hasLoader(packageName, localeId);\n};\n\n/**\n * This method preforms the asynchronous task of fetching the actual text resources. It will fetch\n * each text resource over the network once (even for multiple calls to the same method).\n * It should be fully finished before the i18nBundle class is created in the webcomponents.\n * This method uses the bundle URLs that are populated by the <code>registerI18nBundle</code> method.\n * To simplify the usage, the synchronization of both methods happens internally for the same <code>bundleId</code>\n * @param {packageName} packageName the NPM package name\n * @public\n */\nconst fetchI18nBundle = async (packageName: string) => {\n\tconst language = getLocale().getLanguage();\n\tconst region = getLocale().getRegion();\n\tconst variant = getLocale().getVariant();\n\tlet localeId = language + (region ? `-${region}` : ``) + (variant ? `-${variant}` : ``);\n\n\tif (useFallbackBundle(packageName, localeId)) {\n\t\tlocaleId = normalizeLocale(localeId);\n\n\t\twhile (useFallbackBundle(packageName, localeId)) {\n\t\t\tlocaleId = nextFallbackLocale(localeId);\n\t\t}\n\t}\n\n\t// use default language unless configured to always fetch it from the network\n\tconst fetchDefaultLanguage = getFetchDefaultLanguage();\n\tif (localeId === DEFAULT_LANGUAGE && !fetchDefaultLanguage) {\n\t\t_setI18nBundleData(packageName, null); // reset for the default language (if data was set for a previous language)\n\t\treturn;\n\t}\n\n\tif (!_hasLoader(packageName, localeId)) {\n\t\t_showAssetsWarningOnce(packageName);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst data = await _loadMessageBundleOnce(packageName, localeId);\n\t\t_setI18nBundleData(packageName, data);\n\t} catch (error: unknown) {\n\t\tconst e = error as Error;\n\t\tif (!reportedErrors.has(e.message)) {\n\t\t\treportedErrors.add(e.message);\n\t\t\tconsole.error(e.message); /* eslint-disable-line */\n\t\t}\n\t}\n};\n\n// When the language changes dynamically (the user calls setLanguage), re-fetch all previously fetched bundles\nattachLanguageChange((lang: string /* eslint-disable-line */) => {\n\tconst allPackages = [...bundleData.keys()];\n\treturn Promise.all(allPackages.map(fetchI18nBundle));\n});\n\nexport {\n\tregisterI18nLoader,\n\tfetchI18nBundle,\n\tgetI18nBundleData,\n};\n"]}
1
+ {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/asset-registries/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,kBAAkB,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAKhE,8DAA8D;AAC9D,MAAM,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;AAC/B,MAAM,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;AAEjC,MAAM,UAAU,GAAG,IAAI,GAA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;KACD;IAED,6EAA6E;IAC7E,MAAM,oBAAoB,GAAG,uBAAuB,EAAE,CAAC;IACvD,IAAI,QAAQ,KAAK,gBAAgB,IAAI,CAAC,oBAAoB,EAAE;QAC3D,kBAAkB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,2EAA2E;QAClH,OAAO;KACP;IAED,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE;QACvC,sBAAsB,CAAC,WAAW,CAAC,CAAC;QACpC,OAAO;KACP;IAED,IAAI;QACH,MAAM,IAAI,GAAG,MAAM,sBAAsB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACjE,kBAAkB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;KACtC;IAAC,OAAO,KAAc,EAAE;QACxB,MAAM,CAAC,GAAG,KAAc,CAAC;QACzB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE;YACnC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YAC9B,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,yBAAyB;SACnD;KACD;AACF,CAAC,CAAC;AAEF,8GAA8G;AAC9G,oBAAoB,CAAC,CAAC,IAAY,CAAC,yBAAyB,EAAE,EAAE;IAC/D,MAAM,WAAW,GAAG,CAAC,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3C,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC,CAAC;AAEH,OAAO,EACN,kBAAkB,EAClB,eAAe,EACf,iBAAiB,GACjB,CAAC","sourcesContent":["import getLocale from \"../locale/getLocale.js\";\nimport { attachLanguageChange } from \"../locale/languageChange.js\";\nimport normalizeLocale from \"../locale/normalizeLocale.js\";\nimport nextFallbackLocale from \"../locale/nextFallbackLocale.js\";\nimport { DEFAULT_LANGUAGE } from \"../generated/AssetParameters.js\";\nimport { getFetchDefaultLanguage } from \"../config/Language.js\";\n\ntype I18nLoader = (localeId: string) => Promise<I18nData>;\ntype I18nData = Record<string, string>;\n\n// contains package names for which the warning has been shown\nconst warningShown = new Set();\nconst reportedErrors = new Set();\n\nconst bundleData = new Map<string, I18nData | null>();\nconst bundlePromises = new Map<string, Promise<I18nData>>();\nconst loaders = new Map<string, I18nLoader>();\n\n/**\n * Registers i18n loader function for given package and locale.\n *\n * @public\n * @param {string} packageName for which package this loader can fetch data\n * @param {string} localeId locale that this loader can handle\n * @param {function} loader async function that will be passed a localeId and should return a JSON object\n */\nconst registerI18nLoader = (packageName: string, localeId: string, loader: I18nLoader) => {\n\t// register loader by key\n\tconst bundleKey = `${packageName}/${localeId}`;\n\tloaders.set(bundleKey, loader);\n};\n\nconst _setI18nBundleData = (packageName: string, data: I18nData | null) => {\n\tbundleData.set(packageName, data);\n};\n\nconst getI18nBundleData = (packageName: string) => {\n\treturn bundleData.get(packageName);\n};\n\nconst _hasLoader = (packageName: string, localeId: string) => {\n\tconst bundleKey = `${packageName}/${localeId}`;\n\treturn loaders.has(bundleKey);\n};\n\n// load bundle over the network once\nconst _loadMessageBundleOnce = (packageName: string, localeId: string) => {\n\tconst bundleKey = `${packageName}/${localeId}`;\n\tconst loadMessageBundle = loaders.get(bundleKey);\n\n\tif (loadMessageBundle && !bundlePromises.get(bundleKey)) {\n\t\tbundlePromises.set(bundleKey, loadMessageBundle(localeId));\n\t}\n\n\treturn bundlePromises.get(bundleKey)!; // Investigate if i18n loader exists and this won't return undefined.\n};\n\nconst _showAssetsWarningOnce = (packageName: string) => {\n\tif (!warningShown.has(packageName)) {\n\t\tconsole.warn(`[${packageName}]: Message bundle assets are not configured. Falling back to English texts.`, /* eslint-disable-line */\n\t\t\t` Add \\`import \"${packageName}/dist/Assets.js\"\\` in your bundle and make sure your build tool supports dynamic imports and JSON imports. See section \"Assets\" in the documentation for more information.`); /* eslint-disable-line */\n\t\twarningShown.add(packageName);\n\t}\n};\n\nconst useFallbackBundle = (packageName: string, localeId: string) => {\n\treturn localeId !== DEFAULT_LANGUAGE && !_hasLoader(packageName, localeId);\n};\n\n/**\n * This method preforms the asynchronous task of fetching the actual text resources. It will fetch\n * each text resource over the network once (even for multiple calls to the same method).\n * It should be fully finished before the i18nBundle class is created in the webcomponents.\n * This method uses the bundle URLs that are populated by the `registerI18nBundle` method.\n * To simplify the usage, the synchronization of both methods happens internally for the same `bundleId`\n * @param {packageName} packageName the NPM package name\n * @public\n */\nconst fetchI18nBundle = async (packageName: string) => {\n\tconst language = getLocale().getLanguage();\n\tconst region = getLocale().getRegion();\n\tconst variant = getLocale().getVariant();\n\tlet localeId = language + (region ? `-${region}` : ``) + (variant ? `-${variant}` : ``);\n\n\tif (useFallbackBundle(packageName, localeId)) {\n\t\tlocaleId = normalizeLocale(localeId);\n\n\t\twhile (useFallbackBundle(packageName, localeId)) {\n\t\t\tlocaleId = nextFallbackLocale(localeId);\n\t\t}\n\t}\n\n\t// use default language unless configured to always fetch it from the network\n\tconst fetchDefaultLanguage = getFetchDefaultLanguage();\n\tif (localeId === DEFAULT_LANGUAGE && !fetchDefaultLanguage) {\n\t\t_setI18nBundleData(packageName, null); // reset for the default language (if data was set for a previous language)\n\t\treturn;\n\t}\n\n\tif (!_hasLoader(packageName, localeId)) {\n\t\t_showAssetsWarningOnce(packageName);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst data = await _loadMessageBundleOnce(packageName, localeId);\n\t\t_setI18nBundleData(packageName, data);\n\t} catch (error: unknown) {\n\t\tconst e = error as Error;\n\t\tif (!reportedErrors.has(e.message)) {\n\t\t\treportedErrors.add(e.message);\n\t\t\tconsole.error(e.message); /* eslint-disable-line */\n\t\t}\n\t}\n};\n\n// When the language changes dynamically (the user calls setLanguage), re-fetch all previously fetched bundles\nattachLanguageChange((lang: string /* eslint-disable-line */) => {\n\tconst allPackages = [...bundleData.keys()];\n\treturn Promise.all(allPackages.map(fetchI18nBundle));\n});\n\nexport {\n\tregisterI18nLoader,\n\tfetchI18nBundle,\n\tgetI18nBundleData,\n};\n"]}
@@ -11,7 +11,7 @@ type ThemeToCollectionMap = {
11
11
  };
12
12
  /**
13
13
  * Registers collection version per theme.
14
- * </b>For exmaple:</b> registerIconCollectionForTheme("my-custom-icons", {"sap_horizon": "my-custom-icons-v5"})
14
+ * **For exmaple:** registerIconCollectionForTheme("my-custom-icons", {"sap_horizon": "my-custom-icons-v5"})
15
15
  * @param { string } collectionName
16
16
  * @param { ThemeToCollectionMap } themeCollectionMap
17
17
  */
@@ -23,7 +23,7 @@ iconCollections.set("business-suite", {
23
23
  });
24
24
  /**
25
25
  * Registers collection version per theme.
26
- * </b>For exmaple:</b> registerIconCollectionForTheme("my-custom-icons", {"sap_horizon": "my-custom-icons-v5"})
26
+ * **For exmaple:** registerIconCollectionForTheme("my-custom-icons", {"sap_horizon": "my-custom-icons-v5"})
27
27
  * @param { string } collectionName
28
28
  * @param { ThemeToCollectionMap } themeCollectionMap
29
29
  */
@@ -1 +1 @@
1
- {"version":3,"file":"IconCollectionsByTheme.js","sourceRoot":"","sources":["../../../src/asset-registries/util/IconCollectionsByTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,IAAK,wBAOJ;AAPD,WAAK,wBAAwB;IAC5B,uDAA2B,CAAA;IAC3B,uDAA2B,CAAA;IAC3B,oDAAwB,CAAA;IACxB,oDAAwB,CAAA;IACxB,8DAAkC,CAAA;IAClC,8DAAkC,CAAA;AACnC,CAAC,EAPI,wBAAwB,KAAxB,wBAAwB,QAO5B;AAID,MAAM,eAAe,GAAG,IAAI,GAAG,EAAgC,CAAC;AAChE,eAAe,CAAC,GAAG,CAAC,WAAW,EAAE;IAChC,QAAQ,EAAE,wBAAwB,CAAC,UAAU;IAC7C,aAAa,EAAE,wBAAwB,CAAC,UAAU;CAClD,CAAC,CAAC;AACH,eAAe,CAAC,GAAG,CAAC,KAAK,EAAE;IAC1B,QAAQ,EAAE,wBAAwB,CAAC,aAAa;IAChD,aAAa,EAAE,wBAAwB,CAAC,aAAa;CACrD,CAAC,CAAC;AACH,eAAe,CAAC,GAAG,CAAC,gBAAgB,EAAE;IACrC,QAAQ,EAAE,wBAAwB,CAAC,YAAY;IAC/C,aAAa,EAAE,wBAAwB,CAAC,YAAY;CACpD,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,8BAA8B,GAAG,CAAC,cAAsB,EAAE,kBAAwC,EAAE,EAAE;IAC3G,IAAI,eAAe,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE;QACxC,eAAe,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,GAAG,kBAAkB,EAAE,GAAG,eAAe,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;QACvG,OAAO;KACP;IACD,eAAe,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;AACzD,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,CAAC,cAAsB,EAAE,EAAE;IAC5D,MAAM,WAAW,GAAG,mBAAmB,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC;IACrE,OAAO,eAAe,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,cAAc,CAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;AACjH,CAAC,CAAC;AAEF,OAAO,EACN,8BAA8B,EAC9B,yBAAyB,EACzB,wBAAwB,GACxB,CAAC","sourcesContent":["import { isLegacyThemeFamily } from \"../../config/Theme.js\";\n\nenum RegisteredIconCollection {\n\tSAPIconsV4 = \"SAP-icons-v4\",\n\tSAPIconsV5 = \"SAP-icons-v5\",\n\tSAPIconsTNTV2 = \"tnt-v2\",\n\tSAPIconsTNTV3 = \"tnt-v3\",\n\tSAPBSIconsV1 = \"business-suite-v1\",\n\tSAPBSIconsV2 = \"business-suite-v2\",\n}\n\ntype ThemeToCollectionMap = {[x: string]: string; };\n\nconst iconCollections = new Map<string, ThemeToCollectionMap>();\niconCollections.set(\"SAP-icons\", {\n\t\"legacy\": RegisteredIconCollection.SAPIconsV4,\n\t\"sap_horizon\": RegisteredIconCollection.SAPIconsV5,\n});\niconCollections.set(\"tnt\", {\n\t\"legacy\": RegisteredIconCollection.SAPIconsTNTV2,\n\t\"sap_horizon\": RegisteredIconCollection.SAPIconsTNTV3,\n});\niconCollections.set(\"business-suite\", {\n\t\"legacy\": RegisteredIconCollection.SAPBSIconsV1,\n\t\"sap_horizon\": RegisteredIconCollection.SAPBSIconsV2,\n});\n\n/**\n * Registers collection version per theme.\n * </b>For exmaple:</b> registerIconCollectionForTheme(\"my-custom-icons\", {\"sap_horizon\": \"my-custom-icons-v5\"})\n * @param { string } collectionName\n * @param { ThemeToCollectionMap } themeCollectionMap\n */\nconst registerIconCollectionForTheme = (collectionName: string, themeCollectionMap: ThemeToCollectionMap) => {\n\tif (iconCollections.has(collectionName)) {\n\t\ticonCollections.set(collectionName, { ...themeCollectionMap, ...iconCollections.get(collectionName) });\n\t\treturn;\n\t}\n\ticonCollections.set(collectionName, themeCollectionMap);\n};\n\nconst getIconCollectionForTheme = (collectionName: string) => {\n\tconst themeFamily = isLegacyThemeFamily() ? \"legacy\" : \"sap_horizon\";\n\treturn iconCollections.has(collectionName) ? iconCollections.get(collectionName)![themeFamily] : collectionName;\n};\n\nexport {\n\tregisterIconCollectionForTheme,\n\tgetIconCollectionForTheme,\n\tRegisteredIconCollection,\n};\n"]}
1
+ {"version":3,"file":"IconCollectionsByTheme.js","sourceRoot":"","sources":["../../../src/asset-registries/util/IconCollectionsByTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,IAAK,wBAOJ;AAPD,WAAK,wBAAwB;IAC5B,uDAA2B,CAAA;IAC3B,uD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W,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;AACjH,CAAC,CAAC;AAEF,OAAO,EACN,8BAA8B,EAC9B,yBAAyB,EACzB,wBAAwB,GACxB,CAAC","sourcesContent":["import { isLegacyThemeFamily } from \"../../config/Theme.js\";\n\nenum RegisteredIconCollection {\n\tSAPIconsV4 = \"SAP-icons-v4\",\n\tSAPIconsV5 = \"SAP-icons-v5\",\n\tSAPIconsTNTV2 = \"tnt-v2\",\n\tSAPIconsTNTV3 = \"tnt-v3\",\n\tSAPBSIconsV1 = \"business-suite-v1\",\n\tSAPBSIconsV2 = \"business-suite-v2\",\n}\n\ntype ThemeToCollectionMap = {[x: string]: string; };\n\nconst iconCollections = new Map<string, ThemeToCollectionMap>();\niconCollections.set(\"SAP-icons\", {\n\t\"legacy\": RegisteredIconCollection.SAPIconsV4,\n\t\"sap_horizon\": RegisteredIconCollection.SAPIconsV5,\n});\niconCollections.set(\"tnt\", {\n\t\"legacy\": RegisteredIconCollection.SAPIconsTNTV2,\n\t\"sap_horizon\": RegisteredIconCollection.SAPIconsTNTV3,\n});\niconCollections.set(\"business-suite\", {\n\t\"legacy\": RegisteredIconCollection.SAPBSIconsV1,\n\t\"sap_horizon\": RegisteredIconCollection.SAPBSIconsV2,\n});\n\n/**\n * Registers collection version per theme.\n * **For exmaple:** registerIconCollectionForTheme(\"my-custom-icons\", {\"sap_horizon\": \"my-custom-icons-v5\"})\n * @param { string } collectionName\n * @param { ThemeToCollectionMap } themeCollectionMap\n */\nconst registerIconCollectionForTheme = (collectionName: string, themeCollectionMap: ThemeToCollectionMap) => {\n\tif (iconCollections.has(collectionName)) {\n\t\ticonCollections.set(collectionName, { ...themeCollectionMap, ...iconCollections.get(collectionName) });\n\t\treturn;\n\t}\n\ticonCollections.set(collectionName, themeCollectionMap);\n};\n\nconst getIconCollectionForTheme = (collectionName: string) => {\n\tconst themeFamily = isLegacyThemeFamily() ? \"legacy\" : \"sap_horizon\";\n\treturn iconCollections.has(collectionName) ? iconCollections.get(collectionName)![themeFamily] : collectionName;\n};\n\nexport {\n\tregisterIconCollectionForTheme,\n\tgetIconCollectionForTheme,\n\tRegisteredIconCollection,\n};\n"]}