@ui5/webcomponents-base 2.21.0-rc.4 → 2.22.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,6 @@
1
1
  import merge from "./thirdparty/merge.js";
2
2
  import { getFeature } from "./FeaturesRegistry.js";
3
3
  import { DEFAULT_THEME } from "./generated/AssetParameters.js";
4
- import validateThemeRoot from "./validateThemeRoot.js";
5
4
  import AnimationMode from "./types/AnimationMode.js";
6
5
  import { resetConfiguration as resetConfigurationFn } from "./config/ConfigurationReset.js";
7
6
  import { getLocationSearch } from "./Location.js";
@@ -32,13 +31,6 @@ const getTheme = () => {
32
31
  };
33
32
  const getThemeRoot = () => {
34
33
  initConfiguration();
35
- if (initialConfig.themeRoot === undefined) {
36
- return;
37
- }
38
- if (!validateThemeRoot(initialConfig.themeRoot)) {
39
- console.warn(`The ${initialConfig.themeRoot} is not valid. Check the allowed origins as suggested in the "setThemeRoot" description.`); // eslint-disable-line
40
- return;
41
- }
42
34
  return initialConfig.themeRoot;
43
35
  };
44
36
  const getLanguage = () => {
@@ -128,7 +120,7 @@ const parseURLParameters = () => {
128
120
  };
129
121
  const normalizeThemeRootParamValue = (value) => {
130
122
  const themeRoot = value.split("@")[1];
131
- return validateThemeRoot(themeRoot);
123
+ return themeRoot;
132
124
  };
133
125
  const normalizeThemeParamValue = (param, value) => {
134
126
  if (param === "theme" && value.includes("@")) { // the theme parameter might have @<URL-TO-THEME> in the value - strip this
@@ -1 +1 @@
1
- {"version":3,"file":"InitialConfiguration.js","sourceRoot":"","sources":["../src/InitialConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAGvD,OAAO,aAAa,MAAM,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AAC;SAAM,CAAC;QACP,aAAa,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IAC9B,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,GAAG,EAAE;IACtC,MAAM,cAAc,GAAG,UAAU,CAAwB,gBAAgB,CAAC,CAAC;IAC3E,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,EAAE,CAAC;QAC5D,OAAO;IACR,CAAC;IAED,MAAM,aAAa,GAAG,cAAc,CAAC,8BAA8B,EAAE,CAAC;IACtE,aAAa,GAAG,KAAK,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC9B,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,WAAW,EAAE,CAAC;QACpD,OAAO;IACR,CAAC;IAED,kBAAkB,EAAE,CAAC;IAErB,WAAW,GAAG,IAAI,CAAC;AACpB,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,kBAAkB,GAAG,CAAC,OAAiB,EAAE,EAAE;IAChD,IAAI,OAAO,EAAE,CAAC;QACb,oBAAoB,EAAE,CAAC;IACxB,CAAC;IACD,4CAA4C;IAC5C,wBAAwB,EAAE,CAAC;IAE3B,8DAA8D;IAC9D,kBAAkB,EAAE,CAAC;IAErB,yDAAyD;IACzD,yBAAyB,EAAE,CAAC;AAC7B,CAAC,CAAC;AAEF,OAAO,EACN,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,uBAAuB,EACvB,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,WAAW,EACX,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,wBAAwB,GACxB,CAAC","sourcesContent":["import merge from \"./thirdparty/merge.js\";\nimport { getFeature } from \"./FeaturesRegistry.js\";\nimport { DEFAULT_THEME } from \"./generated/AssetParameters.js\";\nimport validateThemeRoot from \"./validateThemeRoot.js\";\nimport type OpenUI5Support from \"./features/OpenUI5Support.js\";\nimport type { FormatSettings } from \"./config/FormatSettings.js\";\nimport AnimationMode from \"./types/AnimationMode.js\";\nimport type CalendarType from \"./types/CalendarType.js\";\nimport { resetConfiguration as resetConfigurationFn } from \"./config/ConfigurationReset.js\";\nimport { getLocationSearch } from \"./Location.js\";\n\nlet initialized = false;\n\ntype InitialConfig = {\n\t[key: string]: any,\n\tanimationMode: AnimationMode,\n\ttheme: string,\n\tthemeRoot: string | undefined,\n\tlanguage: string | undefined,\n\tcalendarType: CalendarType | undefined,\n\tsecondaryCalendarType: CalendarType | undefined,\n\ttimezone: string | undefined,\n\tnoConflict: boolean,\n\tformatSettings: FormatSettings,\n\tfetchDefaultLanguage: boolean,\n\tdefaultFontLoading: boolean,\n\tenableDefaultTooltips: boolean,\n};\n\nlet initialConfig: InitialConfig = {\n\tanimationMode: AnimationMode.Full,\n\ttheme: DEFAULT_THEME,\n\tthemeRoot: undefined,\n\trtl: undefined,\n\tlanguage: undefined,\n\ttimezone: undefined,\n\tcalendarType: undefined,\n\tsecondaryCalendarType: undefined,\n\tnoConflict: false, // no URL\n\tformatSettings: {},\n\tfetchDefaultLanguage: false,\n\tdefaultFontLoading: true,\n\tenableDefaultTooltips: true,\n};\n\n/* General settings */\nconst getAnimationMode = () => {\n\tinitConfiguration();\n\treturn initialConfig.animationMode;\n};\n\nconst getTheme = () => {\n\tinitConfiguration();\n\treturn initialConfig.theme;\n};\n\nconst getThemeRoot = () => {\n\tinitConfiguration();\n\n\tif (initialConfig.themeRoot === undefined) {\n\t\treturn;\n\t}\n\n\tif (!validateThemeRoot(initialConfig.themeRoot)) {\n\t\tconsole.warn(`The ${initialConfig.themeRoot} is not valid. Check the allowed origins as suggested in the \"setThemeRoot\" description.`); // eslint-disable-line\n\t\treturn;\n\t}\n\n\treturn initialConfig.themeRoot;\n};\n\nconst getLanguage = () => {\n\tinitConfiguration();\n\treturn initialConfig.language;\n};\n\n/**\n * Returns if the default language, that is inlined at build time,\n * should be fetched over the network instead.\n * @returns {Boolean}\n */\nconst getFetchDefaultLanguage = () => {\n\tinitConfiguration();\n\treturn initialConfig.fetchDefaultLanguage;\n};\n\nconst getNoConflict = () => {\n\tinitConfiguration();\n\treturn initialConfig.noConflict;\n};\n\nconst getDefaultFontLoading = () => {\n\tinitConfiguration();\n\treturn initialConfig.defaultFontLoading;\n};\n\nconst getEnableDefaultTooltips = () => {\n\tinitConfiguration();\n\treturn initialConfig.enableDefaultTooltips;\n};\n\n/**\n * Get the configured calendar type\n * @returns { String } the name of the configured calendar type\n */\nconst getCalendarType = () => {\n\tinitConfiguration();\n\treturn initialConfig.calendarType;\n};\n\nconst getSecondaryCalendarType = () => {\n\tinitConfiguration();\n\treturn initialConfig.secondaryCalendarType;\n};\n\n/**\n * Returns the configured IANA timezone ID.\n * @returns { String } the configured IANA timezone ID, e.g. \"America/New_York\"\n */\nconst getTimezone = () => {\n\tinitConfiguration();\n\treturn initialConfig.timezone;\n};\n\nconst getFormatSettings = () => {\n\tinitConfiguration();\n\treturn initialConfig.formatSettings;\n};\n\nconst booleanMapping = new Map();\nbooleanMapping.set(\"true\", true);\nbooleanMapping.set(\"false\", false);\n\nconst parseConfigurationScript = () => {\n\tconst configScript = document.querySelector(\"[data-ui5-config]\") || document.querySelector(\"[data-id='sap-ui-config']\"); // for backward compatibility\n\n\tlet configJSON;\n\n\tif (configScript) {\n\t\ttry {\n\t\t\tconfigJSON = JSON.parse(configScript.innerHTML);\n\t\t} catch (err) {\n\t\t\tconsole.warn(\"Incorrect data-sap-ui-config format. Please use JSON\"); /* eslint-disable-line */\n\t\t}\n\n\t\tif (configJSON) {\n\t\t\tinitialConfig = merge(initialConfig, configJSON);\n\t\t}\n\t}\n};\n\nconst parseURLParameters = () => {\n\tconst params = new URLSearchParams(getLocationSearch());\n\n\t// Process \"sap-*\" params first\n\tparams.forEach((value, key) => {\n\t\tconst parts = key.split(\"sap-\").length;\n\t\tif (parts === 0 || parts === key.split(\"sap-ui-\").length) {\n\t\t\treturn;\n\t\t}\n\n\t\tapplyURLParam(key, value, \"sap\");\n\t});\n\n\t// Process \"sap-ui-*\" params\n\tparams.forEach((value, key) => {\n\t\tif (!key.startsWith(\"sap-ui\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tapplyURLParam(key, value, \"sap-ui\");\n\t});\n};\n\nconst normalizeThemeRootParamValue = (value: string) => {\n\tconst themeRoot = value.split(\"@\")[1];\n\n\treturn validateThemeRoot(themeRoot);\n};\n\nconst normalizeThemeParamValue = (param: string, value: string) => {\n\tif (param === \"theme\" && value.includes(\"@\")) { // the theme parameter might have @<URL-TO-THEME> in the value - strip this\n\t\treturn value.split(\"@\")[0];\n\t}\n\n\treturn value;\n};\n\nconst applyURLParam = (key: string, value: string, paramType: string) => {\n\tconst lowerCaseValue = value.toLowerCase();\n\tconst param = key.split(`${paramType}-`)[1];\n\n\tif (booleanMapping.has(value)) {\n\t\tvalue = booleanMapping.get(lowerCaseValue);\n\t}\n\n\tif (param === \"theme\") {\n\t\tinitialConfig.theme = normalizeThemeParamValue(param, value);\n\n\t\tif (value && value.includes(\"@\")) {\n\t\t\tinitialConfig.themeRoot = normalizeThemeRootParamValue(value);\n\t\t}\n\t} else {\n\t\tinitialConfig[param] = value;\n\t}\n};\n\nconst applyOpenUI5Configuration = () => {\n\tconst openUI5Support = getFeature<typeof OpenUI5Support>(\"OpenUI5Support\");\n\tif (!openUI5Support || !openUI5Support.isOpenUI5Detected()) {\n\t\treturn;\n\t}\n\n\tconst OpenUI5Config = openUI5Support.getConfigurationSettingsObject();\n\tinitialConfig = merge(initialConfig, OpenUI5Config);\n};\n\nconst initConfiguration = () => {\n\tif (typeof document === \"undefined\" || initialized) {\n\t\treturn;\n\t}\n\n\tresetConfiguration();\n\n\tinitialized = true;\n};\n\n/**\n * Internaly exposed method to enable configurations in tests.\n * @private\n */\nconst resetConfiguration = (testEnv?: boolean) => {\n\tif (testEnv) {\n\t\tresetConfigurationFn();\n\t}\n\t// 1. Lowest priority - configuration script\n\tparseConfigurationScript();\n\n\t// 2. URL parameters overwrite configuration script parameters\n\tparseURLParameters();\n\n\t// 3. If OpenUI5 is detected, it has the highest priority\n\tapplyOpenUI5Configuration();\n};\n\nexport {\n\tgetAnimationMode,\n\tgetTheme,\n\tgetThemeRoot,\n\tgetLanguage,\n\tgetFetchDefaultLanguage,\n\tgetNoConflict,\n\tgetCalendarType,\n\tgetSecondaryCalendarType,\n\tgetTimezone,\n\tgetFormatSettings,\n\tgetDefaultFontLoading,\n\tresetConfiguration,\n\tgetEnableDefaultTooltips,\n};\n"]}
1
+ {"version":3,"file":"InitialConfiguration.js","sourceRoot":"","sources":["../src/InitialConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG/D,OAAO,aAAa,MAAM,0BAA0B,CAAC;AAErD,OAAO,EAAE,kBAAkB,IAAI,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,IAAI,WAAW,GAAG,KAAK,CAAC;AAkBxB,IAAI,aAAa,GAAkB;IAClC,aAAa,EAAE,aAAa,CAAC,IAAI;IACjC,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,SAAS;IACpB,GAAG,EAAE,SAAS;IACd,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,YAAY,EAAE,SAAS;IACvB,qBAAqB,EAAE,SAAS;IAChC,UAAU,EAAE,KAAK,EAAE,SAAS;IAC5B,cAAc,EAAE,EAAE;IAClB,oBAAoB,EAAE,KAAK;IAC3B,kBAAkB,EAAE,IAAI;IACxB,qBAAqB,EAAE,IAAI;CAC3B,CAAC;AAEF,sBAAsB;AACtB,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC7B,iBA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OAAO,EACN,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,uBAAuB,EACvB,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,WAAW,EACX,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,wBAAwB,GACxB,CAAC","sourcesContent":["import merge from \"./thirdparty/merge.js\";\nimport { getFeature } from \"./FeaturesRegistry.js\";\nimport { DEFAULT_THEME } from \"./generated/AssetParameters.js\";\nimport type OpenUI5Support from \"./features/OpenUI5Support.js\";\nimport type { FormatSettings } from \"./config/FormatSettings.js\";\nimport AnimationMode from \"./types/AnimationMode.js\";\nimport type CalendarType from \"./types/CalendarType.js\";\nimport { resetConfiguration as resetConfigurationFn } from \"./config/ConfigurationReset.js\";\nimport { getLocationSearch } from \"./Location.js\";\n\nlet initialized = false;\n\ntype InitialConfig = {\n\t[key: string]: any,\n\tanimationMode: AnimationMode,\n\ttheme: string,\n\tthemeRoot: string | undefined,\n\tlanguage: string | undefined,\n\tcalendarType: CalendarType | undefined,\n\tsecondaryCalendarType: CalendarType | undefined,\n\ttimezone: string | undefined,\n\tnoConflict: boolean,\n\tformatSettings: FormatSettings,\n\tfetchDefaultLanguage: boolean,\n\tdefaultFontLoading: boolean,\n\tenableDefaultTooltips: boolean,\n};\n\nlet initialConfig: InitialConfig = {\n\tanimationMode: AnimationMode.Full,\n\ttheme: DEFAULT_THEME,\n\tthemeRoot: undefined,\n\trtl: undefined,\n\tlanguage: undefined,\n\ttimezone: undefined,\n\tcalendarType: undefined,\n\tsecondaryCalendarType: undefined,\n\tnoConflict: false, // no URL\n\tformatSettings: {},\n\tfetchDefaultLanguage: false,\n\tdefaultFontLoading: true,\n\tenableDefaultTooltips: true,\n};\n\n/* General settings */\nconst getAnimationMode = () => {\n\tinitConfiguration();\n\treturn initialConfig.animationMode;\n};\n\nconst getTheme = () => {\n\tinitConfiguration();\n\treturn initialConfig.theme;\n};\n\nconst getThemeRoot = () => {\n\tinitConfiguration();\n\treturn initialConfig.themeRoot;\n};\n\nconst getLanguage = () => {\n\tinitConfiguration();\n\treturn initialConfig.language;\n};\n\n/**\n * Returns if the default language, that is inlined at build time,\n * should be fetched over the network instead.\n * @returns {Boolean}\n */\nconst getFetchDefaultLanguage = () => {\n\tinitConfiguration();\n\treturn initialConfig.fetchDefaultLanguage;\n};\n\nconst getNoConflict = () => {\n\tinitConfiguration();\n\treturn initialConfig.noConflict;\n};\n\nconst getDefaultFontLoading = () => {\n\tinitConfiguration();\n\treturn initialConfig.defaultFontLoading;\n};\n\nconst getEnableDefaultTooltips = () => {\n\tinitConfiguration();\n\treturn initialConfig.enableDefaultTooltips;\n};\n\n/**\n * Get the configured calendar type\n * @returns { String } the name of the configured calendar type\n */\nconst getCalendarType = () => {\n\tinitConfiguration();\n\treturn initialConfig.calendarType;\n};\n\nconst getSecondaryCalendarType = () => {\n\tinitConfiguration();\n\treturn initialConfig.secondaryCalendarType;\n};\n\n/**\n * Returns the configured IANA timezone ID.\n * @returns { String } the configured IANA timezone ID, e.g. \"America/New_York\"\n */\nconst getTimezone = () => {\n\tinitConfiguration();\n\treturn initialConfig.timezone;\n};\n\nconst getFormatSettings = () => {\n\tinitConfiguration();\n\treturn initialConfig.formatSettings;\n};\n\nconst booleanMapping = new Map();\nbooleanMapping.set(\"true\", true);\nbooleanMapping.set(\"false\", false);\n\nconst parseConfigurationScript = () => {\n\tconst configScript = document.querySelector(\"[data-ui5-config]\") || document.querySelector(\"[data-id='sap-ui-config']\"); // for backward compatibility\n\n\tlet configJSON;\n\n\tif (configScript) {\n\t\ttry {\n\t\t\tconfigJSON = JSON.parse(configScript.innerHTML);\n\t\t} catch (err) {\n\t\t\tconsole.warn(\"Incorrect data-sap-ui-config format. Please use JSON\"); /* eslint-disable-line */\n\t\t}\n\n\t\tif (configJSON) {\n\t\t\tinitialConfig = merge(initialConfig, configJSON);\n\t\t}\n\t}\n};\n\nconst parseURLParameters = () => {\n\tconst params = new URLSearchParams(getLocationSearch());\n\n\t// Process \"sap-*\" params first\n\tparams.forEach((value, key) => {\n\t\tconst parts = key.split(\"sap-\").length;\n\t\tif (parts === 0 || parts === key.split(\"sap-ui-\").length) {\n\t\t\treturn;\n\t\t}\n\n\t\tapplyURLParam(key, value, \"sap\");\n\t});\n\n\t// Process \"sap-ui-*\" params\n\tparams.forEach((value, key) => {\n\t\tif (!key.startsWith(\"sap-ui\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tapplyURLParam(key, value, \"sap-ui\");\n\t});\n};\n\nconst normalizeThemeRootParamValue = (value: string) => {\n\tconst themeRoot = value.split(\"@\")[1];\n\n\treturn themeRoot;\n};\n\nconst normalizeThemeParamValue = (param: string, value: string) => {\n\tif (param === \"theme\" && value.includes(\"@\")) { // the theme parameter might have @<URL-TO-THEME> in the value - strip this\n\t\treturn value.split(\"@\")[0];\n\t}\n\n\treturn value;\n};\n\nconst applyURLParam = (key: string, value: string, paramType: string) => {\n\tconst lowerCaseValue = value.toLowerCase();\n\tconst param = key.split(`${paramType}-`)[1];\n\n\tif (booleanMapping.has(value)) {\n\t\tvalue = booleanMapping.get(lowerCaseValue);\n\t}\n\n\tif (param === \"theme\") {\n\t\tinitialConfig.theme = normalizeThemeParamValue(param, value);\n\n\t\tif (value && value.includes(\"@\")) {\n\t\t\tinitialConfig.themeRoot = normalizeThemeRootParamValue(value);\n\t\t}\n\t} else {\n\t\tinitialConfig[param] = value;\n\t}\n};\n\nconst applyOpenUI5Configuration = () => {\n\tconst openUI5Support = getFeature<typeof OpenUI5Support>(\"OpenUI5Support\");\n\tif (!openUI5Support || !openUI5Support.isOpenUI5Detected()) {\n\t\treturn;\n\t}\n\n\tconst OpenUI5Config = openUI5Support.getConfigurationSettingsObject();\n\tinitialConfig = merge(initialConfig, OpenUI5Config);\n};\n\nconst initConfiguration = () => {\n\tif (typeof document === \"undefined\" || initialized) {\n\t\treturn;\n\t}\n\n\tresetConfiguration();\n\n\tinitialized = true;\n};\n\n/**\n * Internaly exposed method to enable configurations in tests.\n * @private\n */\nconst resetConfiguration = (testEnv?: boolean) => {\n\tif (testEnv) {\n\t\tresetConfigurationFn();\n\t}\n\t// 1. Lowest priority - configuration script\n\tparseConfigurationScript();\n\n\t// 2. URL parameters overwrite configuration script parameters\n\tparseURLParameters();\n\n\t// 3. If OpenUI5 is detected, it has the highest priority\n\tapplyOpenUI5Configuration();\n};\n\nexport {\n\tgetAnimationMode,\n\tgetTheme,\n\tgetThemeRoot,\n\tgetLanguage,\n\tgetFetchDefaultLanguage,\n\tgetNoConflict,\n\tgetCalendarType,\n\tgetSecondaryCalendarType,\n\tgetTimezone,\n\tgetFormatSettings,\n\tgetDefaultFontLoading,\n\tresetConfiguration,\n\tgetEnableDefaultTooltips,\n};\n"]}
@@ -43,21 +43,26 @@ const setThemeRoot = (themeRoot) => {
43
43
  return;
44
44
  }
45
45
  currThemeRoot = themeRoot;
46
- if (!validateThemeRoot(themeRoot)) {
47
- console.warn(`The ${themeRoot} is not valid. Check the allowed origins as suggested in the "setThemeRoot" description.`); // eslint-disable-line
48
- return;
49
- }
50
46
  return attachCustomThemeStylesToHead(getTheme());
51
47
  };
52
- const formatThemeLink = (theme) => {
53
- return `${getThemeRoot()}Base/baseLib/${theme}/css_variables.css`; // theme root is always set at this point.
48
+ const formatThemeLink = (theme, validatedThemeRoot) => {
49
+ return `${validatedThemeRoot}Base/baseLib/${theme}/css_variables.css`;
54
50
  };
55
51
  const attachCustomThemeStylesToHead = async (theme) => {
56
52
  const link = document.querySelector(`[sap-ui-webcomponents-theme="${theme}"]`);
57
53
  if (link) {
58
54
  document.head.removeChild(link);
59
55
  }
60
- await createLinkInHead(formatThemeLink(theme), { "sap-ui-webcomponents-theme": theme });
56
+ const themeRoot = getThemeRoot();
57
+ if (!themeRoot) {
58
+ return;
59
+ }
60
+ const validatedThemeRoot = validateThemeRoot(themeRoot);
61
+ if (!validatedThemeRoot) {
62
+ console.warn(`The ${themeRoot} is not valid. Check the allowed origins as suggested in the "setThemeRoot" description.`); // eslint-disable-line
63
+ return;
64
+ }
65
+ await createLinkInHead(formatThemeLink(theme, validatedThemeRoot), { "sap-ui-webcomponents-theme": theme });
61
66
  };
62
67
  export { getThemeRoot, setThemeRoot, attachCustomThemeStylesToHead, };
63
68
  //# sourceMappingURL=ThemeRoot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeRoot.js","sourceRoot":"","sources":["../../src/config/ThemeRoot.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,6BAA6B,CAAC;AAC3D,OAAO,iBAAiB,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,IAAI,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,IAAI,aAAiC,CAAC;AAEtC,wBAAwB,CAAC,GAAG,EAAE;IAC7B,aAAa,GAAG,SAAS,CAAC;AAC3B,CAAC,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,YAAY,GAAG,GAAuB,EAAE;IAC7C,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QACjC,aAAa,GAAG,sBAAsB,EAAE,CAAC;IAC1C,CAAC;IAED,OAAO,aAAa,CAAC;AACtB,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,YAAY,GAAG,CAAC,SAAiB,EAA6B,EAAE;IACrE,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO;IACR,CAAC;IAED,aAAa,GAAG,SAAS,CAAC;IAE1B,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,CAAC;QACnC,OAAO,CAAC,IAAI,CAAC,OAAO,SAAS,0FAA0F,CAAC,CAAC,CAAC,sBAAsB;QAChJ,OAAO;IACR,CAAC;IAED,OAAO,6BAA6B,CAAC,QAAQ,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,EAAE;IACzC,OAAO,GAAG,YAAY,EAAG,gBAAgB,KAAK,oBAAoB,CAAC,CAAC,0CAA0C;AAC/G,CAAC,CAAC;AAEF,MAAM,6BAA6B,GAAG,KAAK,EAAE,KAAa,EAAiB,EAAE;IAC5E,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,gCAAgC,KAAK,IAAI,CAAC,CAAC;IAE/E,IAAI,IAAI,EAAE,CAAC;QACV,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,gBAAgB,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,EAAE,4BAA4B,EAAE,KAAK,EAAE,CAAC,CAAC;AACzF,CAAC,CAAC;AAEF,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,6BAA6B,GAC7B,CAAC","sourcesContent":["import createLinkInHead from \"../util/createLinkInHead.js\";\nimport validateThemeRoot from \"../validateThemeRoot.js\";\nimport { getThemeRoot as getConfiguredThemeRoot } from \"../InitialConfiguration.js\";\nimport { getTheme } from \"./Theme.js\";\nimport { attachConfigurationReset } from \"./ConfigurationReset.js\";\n\nlet currThemeRoot: string | undefined;\n\nattachConfigurationReset(() => {\n\tcurrThemeRoot = undefined;\n});\n\n/**\n * Returns the current theme root.\n *\n * @public\n * @since 1.14.0\n * @returns { string } the current theme root\n */\nconst getThemeRoot = (): string | undefined => {\n\tif (currThemeRoot === undefined) {\n\t\tcurrThemeRoot = getConfiguredThemeRoot();\n\t}\n\n\treturn currThemeRoot;\n};\n\n/**\n * Sets theme root for the current theme.\n * When set, the framework will validate the theme root and fetch the theme styles (CSS variables) from this location.\n *\n * **Note:** The feature is specific to custom themes, created with the `UI Theme Designer`.\n * The provided theme root is used only as a base to construct the actual location of the theme styles: `{themeRoot}/.../css_variables.css`.\n *\n * **Note:** Certain security restrictions will apply before fetching the theme assets.\n * Absolute URLs to a different origin than the current page will result in using the current page as an origin.\n *\n * **Important:** To use this feature you must explicitly allow specific origins by using &lt;meta name=\"sap-allowed-theme-origins\" content=\"https://my-example-host.com/\"&gt; tag inside the &lt;head&gt; of the page.\n * Failing to do so will result in a warning in the console and the theme root will not be set.\n *\n * @public\n * @since 1.14.0\n * @param { string } themeRoot the new theme root\n * @returns { Promise<void> }\n */\nconst setThemeRoot = (themeRoot: string): Promise<void> | undefined => {\n\tif (currThemeRoot === themeRoot) {\n\t\treturn;\n\t}\n\n\tcurrThemeRoot = themeRoot;\n\n\tif (!validateThemeRoot(themeRoot)) {\n\t\tconsole.warn(`The ${themeRoot} is not valid. Check the allowed origins as suggested in the \"setThemeRoot\" description.`); // eslint-disable-line\n\t\treturn;\n\t}\n\n\treturn attachCustomThemeStylesToHead(getTheme());\n};\n\nconst formatThemeLink = (theme: string) => {\n\treturn `${getThemeRoot()!}Base/baseLib/${theme}/css_variables.css`; // theme root is always set at this point.\n};\n\nconst attachCustomThemeStylesToHead = async (theme: string): Promise<void> => {\n\tconst link = document.querySelector(`[sap-ui-webcomponents-theme=\"${theme}\"]`);\n\n\tif (link) {\n\t\tdocument.head.removeChild(link);\n\t}\n\n\tawait createLinkInHead(formatThemeLink(theme), { \"sap-ui-webcomponents-theme\": theme });\n};\n\nexport {\n\tgetThemeRoot,\n\tsetThemeRoot,\n\tattachCustomThemeStylesToHead,\n};\n"]}
1
+ {"version":3,"file":"ThemeRoot.js","sourceRoot":"","sources":["../../src/config/ThemeRoot.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,6BAA6B,CAAC;AAC3D,OAAO,iBAAiB,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,IAAI,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,IAAI,aAAiC,CAAC;AAEtC,wBAAwB,CA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AAE,kBAAkB,CAAC,EAAE,EAAE,4BAA4B,EAAE,KAAK,EAAE,CAAC,CAAC;AAC7G,CAAC,CAAC;AAEF,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,6BAA6B,GAC7B,CAAC","sourcesContent":["import createLinkInHead from \"../util/createLinkInHead.js\";\nimport validateThemeRoot from \"../validateThemeRoot.js\";\nimport { getThemeRoot as getConfiguredThemeRoot } from \"../InitialConfiguration.js\";\nimport { getTheme } from \"./Theme.js\";\nimport { attachConfigurationReset } from \"./ConfigurationReset.js\";\n\nlet currThemeRoot: string | undefined;\n\nattachConfigurationReset(() => {\n\tcurrThemeRoot = undefined;\n});\n\n/**\n * Returns the current theme root.\n *\n * @public\n * @since 1.14.0\n * @returns { string } the current theme root\n */\nconst getThemeRoot = (): string | undefined => {\n\tif (currThemeRoot === undefined) {\n\t\tcurrThemeRoot = getConfiguredThemeRoot();\n\t}\n\n\treturn currThemeRoot;\n};\n\n/**\n * Sets theme root for the current theme.\n * When set, the framework will validate the theme root and fetch the theme styles (CSS variables) from this location.\n *\n * **Note:** The feature is specific to custom themes, created with the `UI Theme Designer`.\n * The provided theme root is used only as a base to construct the actual location of the theme styles: `{themeRoot}/.../css_variables.css`.\n *\n * **Note:** Certain security restrictions will apply before fetching the theme assets.\n * Absolute URLs to a different origin than the current page will result in using the current page as an origin.\n *\n * **Important:** To use this feature you must explicitly allow specific origins by using &lt;meta name=\"sap-allowed-theme-origins\" content=\"https://my-example-host.com/\"&gt; tag inside the &lt;head&gt; of the page.\n * Failing to do so will result in a warning in the console and the theme root will not be set.\n *\n * @public\n * @since 1.14.0\n * @param { string } themeRoot the new theme root\n * @returns { Promise<void> }\n */\nconst setThemeRoot = (themeRoot: string): Promise<void> | undefined => {\n\tif (currThemeRoot === themeRoot) {\n\t\treturn;\n\t}\n\n\tcurrThemeRoot = themeRoot;\n\n\treturn attachCustomThemeStylesToHead(getTheme());\n};\n\nconst formatThemeLink = (theme: string, validatedThemeRoot: string) => {\n\treturn `${validatedThemeRoot}Base/baseLib/${theme}/css_variables.css`;\n};\n\nconst attachCustomThemeStylesToHead = async (theme: string): Promise<void> => {\n\tconst link = document.querySelector(`[sap-ui-webcomponents-theme=\"${theme}\"]`);\n\n\tif (link) {\n\t\tdocument.head.removeChild(link);\n\t}\n\n\tconst themeRoot = getThemeRoot();\n\n\tif (!themeRoot) {\n\t\treturn;\n\t}\n\n\tconst validatedThemeRoot = validateThemeRoot(themeRoot);\n\n\tif (!validatedThemeRoot) {\n\t\tconsole.warn(`The ${themeRoot} is not valid. Check the allowed origins as suggested in the \"setThemeRoot\" description.`); // eslint-disable-line\n\t\treturn;\n\t}\n\n\tawait createLinkInHead(formatThemeLink(theme, validatedThemeRoot), { \"sap-ui-webcomponents-theme\": theme });\n};\n\nexport {\n\tgetThemeRoot,\n\tsetThemeRoot,\n\tattachCustomThemeStylesToHead,\n};\n"]}
@@ -1,3 +1,16 @@
1
+ /**
2
+ * Gets the associated form for an element.
3
+ * If the element has a `form` attribute, it looks up the form by ID.
4
+ * Otherwise, it falls back to the form associated via ElementInternals.
5
+ */
6
+ const getAssociatedForm = (element) => {
7
+ const formAttribute = element.getAttribute("form");
8
+ if (formAttribute) {
9
+ const form = document.getElementById(formAttribute);
10
+ return form instanceof HTMLFormElement ? form : null;
11
+ }
12
+ return element._internals?.form ?? null;
13
+ };
1
14
  const updateFormValue = (element) => {
2
15
  if (isInputElement(element)) {
3
16
  setFormValue(element);
@@ -29,12 +42,17 @@ const setFormValidity = async (element) => {
29
42
  }
30
43
  };
31
44
  const submitForm = async (element) => {
32
- const elements = [...(element._internals?.form?.elements ?? [])];
45
+ const form = getAssociatedForm(element);
46
+ if (!form) {
47
+ return;
48
+ }
49
+ const elements = [...form.elements];
33
50
  await Promise.all(elements.map(el => { return isInputElement(el) ? setFormValidity(el) : Promise.resolve(); }));
34
- element._internals?.form?.requestSubmit();
51
+ form.requestSubmit();
35
52
  };
36
53
  const resetForm = (element) => {
37
- element._internals?.form?.reset();
54
+ const form = getAssociatedForm(element);
55
+ form?.reset();
38
56
  };
39
57
  const isInputElement = (element) => {
40
58
  return "formFormattedValue" in element && "name" in element;
@@ -1 +1 @@
1
- {"version":3,"file":"InputElementsFormSupport.js","sourceRoot":"","sources":["../../src/features/InputElementsFormSupport.ts"],"names":[],"mappings":"AAUA,MAAM,eAAe,GAAG,CAAC,OAAuC,EAAE,EAAE;IACnE,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,YAAY,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,OAA0B,EAAE,EAAE;IACnD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;QAC/B,OAAO;IACR,CAAC;IAED,eAAe,CAAC,OAAO,CAAC,CAAC;IAEzB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;QACvC,OAAO;IACR,CAAC;IAED,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC7D,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,KAAK,EAAE,OAA0B,EAAE,EAAE;IAC5D,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;QACxD,OAAO;IACR,CAAC;IAED,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,sEAAsE;IAClI,MAAM,OAAO,CAAC,aAAa,CAAC;IAE5B,IAAI,OAAO,CAAC,YAAY,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;QAChF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;QACrD,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;IAC7F,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,KAAK,EAAE,OAAmB,EAAE,EAAE;IAChD,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,IAAI,EAAE,CAAC,CAA0C,CAAC;IAE1G,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,OAAO,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhH,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,OAAmB,EAAE,EAAE;IACzC,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,OAAuC,EAAgC,EAAE;IAChG,OAAO,oBAAoB,IAAI,OAAO,IAAI,MAAM,IAAI,OAAO,CAAC;AAC7D,CAAC,CAAC;AAEF,OAAO,EACN,eAAe,EACf,YAAY,EACZ,eAAe,EACf,UAAU,EACV,SAAS,GACT,CAAC","sourcesContent":["import type UI5Element from \"../UI5Element.js\";\n\ninterface IFormInputElement extends UI5Element {\n\tname?: string;\n\tformFormattedValue: FormData | string | null;\n\tformValidityMessage?: string;\n\tformValidity?: ValidityStateFlags;\n\tformElementAnchor?: () => HTMLElement | undefined | Promise<HTMLElement | undefined>;\n}\n\nconst updateFormValue = (element: IFormInputElement | UI5Element) => {\n\tif (isInputElement(element)) {\n\t\tsetFormValue(element);\n\t}\n};\n\nconst setFormValue = (element: IFormInputElement) => {\n\tif (!element._internals?.form) {\n\t\treturn;\n\t}\n\n\tsetFormValidity(element);\n\n\tif (!element.name) {\n\t\telement._internals?.setFormValue(null);\n\t\treturn;\n\t}\n\n\telement._internals.setFormValue(element.formFormattedValue);\n};\n\nconst setFormValidity = async (element: IFormInputElement) => {\n\tif (!element.isUI5Element || !element._internals?.form) {\n\t\treturn;\n\t}\n\n\telement._internals.setValidity({ customError: true }, \" \"); // treat the form as invalid until CLDR and message bundles are loaded\n\tawait element.definePromise;\n\n\tif (element.formValidity && Object.keys(element.formValidity).some(key => key)) {\n\t\tconst focusRef = await element.formElementAnchor?.();\n\t\telement._internals.setValidity(element.formValidity, element.formValidityMessage, focusRef);\n\t} else {\n\t\telement._internals.setValidity({});\n\t}\n};\n\nconst submitForm = async (element: UI5Element) => {\n\tconst elements = [...(element._internals?.form?.elements ?? [])] as Array<IFormInputElement | UI5Element>;\n\n\tawait Promise.all(elements.map(el => { return isInputElement(el) ? setFormValidity(el) : Promise.resolve(); }));\n\n\telement._internals?.form?.requestSubmit();\n};\n\nconst resetForm = (element: UI5Element) => {\n\telement._internals?.form?.reset();\n};\n\nconst isInputElement = (element: IFormInputElement | UI5Element): element is IFormInputElement => {\n\treturn \"formFormattedValue\" in element && \"name\" in element;\n};\n\nexport {\n\tupdateFormValue,\n\tsetFormValue,\n\tsetFormValidity,\n\tsubmitForm,\n\tresetForm,\n};\n\nexport type {\n\tIFormInputElement,\n};\n"]}
1
+ {"version":3,"file":"InputElementsFormSupport.js","sourceRoot":"","sources":["../../src/features/InputElementsFormSupport.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,CAAC,OAAmB,EAA0B,EAAE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7D,CAAC,CAAC;AAEF,OAAO,EACN,eAAe,EACf,YAAY,EACZ,eAAe,EACf,UAAU,EACV,SAAS,GACT,CAAC","sourcesContent":["import type UI5Element from \"../UI5Element.js\";\n\ninterface IFormInputElement extends UI5Element {\n\tname?: string;\n\tformFormattedValue: FormData | string | null;\n\tformValidityMessage?: string;\n\tformValidity?: ValidityStateFlags;\n\tformElementAnchor?: () => HTMLElement | undefined | Promise<HTMLElement | undefined>;\n}\n\n/**\n * Gets the associated form for an element.\n * If the element has a `form` attribute, it looks up the form by ID.\n * Otherwise, it falls back to the form associated via ElementInternals.\n */\nconst getAssociatedForm = (element: UI5Element): HTMLFormElement | null => {\n\tconst formAttribute = element.getAttribute(\"form\");\n\n\tif (formAttribute) {\n\t\tconst form = document.getElementById(formAttribute);\n\t\treturn form instanceof HTMLFormElement ? form : null;\n\t}\n\n\treturn element._internals?.form ?? null;\n};\n\nconst updateFormValue = (element: IFormInputElement | UI5Element) => {\n\tif (isInputElement(element)) {\n\t\tsetFormValue(element);\n\t}\n};\n\nconst setFormValue = (element: IFormInputElement) => {\n\tif (!element._internals?.form) {\n\t\treturn;\n\t}\n\n\tsetFormValidity(element);\n\n\tif (!element.name) {\n\t\telement._internals?.setFormValue(null);\n\t\treturn;\n\t}\n\n\telement._internals.setFormValue(element.formFormattedValue);\n};\n\nconst setFormValidity = async (element: IFormInputElement) => {\n\tif (!element.isUI5Element || !element._internals?.form) {\n\t\treturn;\n\t}\n\n\telement._internals.setValidity({ customError: true }, \" \"); // treat the form as invalid until CLDR and message bundles are loaded\n\tawait element.definePromise;\n\n\tif (element.formValidity && Object.keys(element.formValidity).some(key => key)) {\n\t\tconst focusRef = await element.formElementAnchor?.();\n\t\telement._internals.setValidity(element.formValidity, element.formValidityMessage, focusRef);\n\t} else {\n\t\telement._internals.setValidity({});\n\t}\n};\n\nconst submitForm = async (element: UI5Element) => {\n\tconst form = getAssociatedForm(element);\n\n\tif (!form) {\n\t\treturn;\n\t}\n\n\tconst elements = [...form.elements] as Array<IFormInputElement | UI5Element>;\n\n\tawait Promise.all(elements.map(el => { return isInputElement(el) ? setFormValidity(el) : Promise.resolve(); }));\n\n\tform.requestSubmit();\n};\n\nconst resetForm = (element: UI5Element) => {\n\tconst form = getAssociatedForm(element);\n\tform?.reset();\n};\n\nconst isInputElement = (element: IFormInputElement | UI5Element): element is IFormInputElement => {\n\treturn \"formFormattedValue\" in element && \"name\" in element;\n};\n\nexport {\n\tupdateFormValue,\n\tsetFormValue,\n\tsetFormValidity,\n\tsubmitForm,\n\tresetForm,\n};\n\nexport type {\n\tIFormInputElement,\n};\n"]}
@@ -1,11 +1,11 @@
1
1
  const VersionInfo = {
2
- version: "2.21.0-rc.4",
2
+ version: "2.22.0-rc.0",
3
3
  major: 2,
4
- minor: 21,
4
+ minor: 22,
5
5
  patch: 0,
6
- suffix: "-rc.4",
6
+ suffix: "-rc.0",
7
7
  isNext: false,
8
- buildTime: 1775118131,
8
+ buildTime: 1775723527,
9
9
  };
10
10
  export default VersionInfo;
11
11
  //# sourceMappingURL=VersionInfo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VersionInfo.js","sourceRoot":"","sources":["../../src/generated/VersionInfo.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IACnB,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,UAAU;CACrB,CAAC;AACF,eAAe,WAAW,CAAC","sourcesContent":["const VersionInfo = {\n\tversion: \"2.21.0-rc.4\",\n\tmajor: 2,\n\tminor: 21,\n\tpatch: 0,\n\tsuffix: \"-rc.4\",\n\tisNext: false,\n\tbuildTime: 1775118131,\n};\nexport default VersionInfo;"]}
1
+ {"version":3,"file":"VersionInfo.js","sourceRoot":"","sources":["../../src/generated/VersionInfo.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IACnB,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,UAAU;CACrB,CAAC;AACF,eAAe,WAAW,CAAC","sourcesContent":["const VersionInfo = {\n\tversion: \"2.22.0-rc.0\",\n\tmajor: 2,\n\tminor: 22,\n\tpatch: 0,\n\tsuffix: \"-rc.0\",\n\tisNext: false,\n\tbuildTime: 1775723527,\n};\nexport default VersionInfo;"]}
@@ -1,2 +1,2 @@
1
- "use strict";import f from"./thirdparty/merge.js";import{getFeature as c}from"./FeaturesRegistry.js";import{DEFAULT_THEME as d}from"./generated/AssetParameters.js";import u from"./validateThemeRoot.js";import m from"./types/AnimationMode.js";import{resetConfiguration as h}from"./config/ConfigurationReset.js";import{getLocationSearch as y}from"./Location.js";let p=!1,t={animationMode:m.Full,theme:d,themeRoot:void 0,rtl:void 0,language:void 0,timezone:void 0,calendarType:void 0,secondaryCalendarType:void 0,noConflict:!1,formatSettings:{},fetchDefaultLanguage:!1,defaultFontLoading:!0,enableDefaultTooltips:!0};const C=()=>(o(),t.animationMode),T=()=>(o(),t.theme),S=()=>{if(o(),t.themeRoot!==void 0){if(!u(t.themeRoot)){console.warn(`The ${t.themeRoot} is not valid. Check the allowed origins as suggested in the "setThemeRoot" description.`);return}return t.themeRoot}},L=()=>(o(),t.language),R=()=>(o(),t.fetchDefaultLanguage),F=()=>(o(),t.noConflict),U=()=>(o(),t.defaultFontLoading),b=()=>(o(),t.enableDefaultTooltips),D=()=>(o(),t.calendarType),I=()=>(o(),t.secondaryCalendarType),O=()=>(o(),t.timezone),M=()=>(o(),t.formatSettings),i=new Map;i.set("true",!0),i.set("false",!1);const w=()=>{const n=document.querySelector("[data-ui5-config]")||document.querySelector("[data-id='sap-ui-config']");let e;if(n){try{e=JSON.parse(n.innerHTML)}catch{console.warn("Incorrect data-sap-ui-config format. Please use JSON")}e&&(t=f(t,e))}},z=()=>{const n=new URLSearchParams(y());n.forEach((e,r)=>{const a=r.split("sap-").length;a===0||a===r.split("sap-ui-").length||g(r,e,"sap")}),n.forEach((e,r)=>{r.startsWith("sap-ui")&&g(r,e,"sap-ui")})},E=n=>{const e=n.split("@")[1];return u(e)},P=(n,e)=>n==="theme"&&e.includes("@")?e.split("@")[0]:e,g=(n,e,r)=>{const a=e.toLowerCase(),s=n.split(`${r}-`)[1];i.has(e)&&(e=i.get(a)),s==="theme"?(t.theme=P(s,e),e&&e.includes("@")&&(t.themeRoot=E(e))):t[s]=e},j=()=>{const n=c("OpenUI5Support");if(!n||!n.isOpenUI5Detected())return;const e=n.getConfigurationSettingsObject();t=f(t,e)},o=()=>{typeof document>"u"||p||(l(),p=!0)},l=n=>{n&&h(),w(),z(),j()};export{C as getAnimationMode,T as getTheme,S as getThemeRoot,L as getLanguage,R as getFetchDefaultLanguage,F as getNoConflict,D as getCalendarType,I as getSecondaryCalendarType,O as getTimezone,M as getFormatSettings,U as getDefaultFontLoading,l as resetConfiguration,b as getEnableDefaultTooltips};
1
+ "use strict";import f from"./thirdparty/merge.js";import{getFeature as l}from"./FeaturesRegistry.js";import{DEFAULT_THEME as c}from"./generated/AssetParameters.js";import m from"./types/AnimationMode.js";import{resetConfiguration as d}from"./config/ConfigurationReset.js";import{getLocationSearch as h}from"./Location.js";let u=!1,t={animationMode:m.Full,theme:c,themeRoot:void 0,rtl:void 0,language:void 0,timezone:void 0,calendarType:void 0,secondaryCalendarType:void 0,noConflict:!1,formatSettings:{},fetchDefaultLanguage:!1,defaultFontLoading:!0,enableDefaultTooltips:!0};const y=()=>(o(),t.animationMode),C=()=>(o(),t.theme),T=()=>(o(),t.themeRoot),S=()=>(o(),t.language),L=()=>(o(),t.fetchDefaultLanguage),F=()=>(o(),t.noConflict),U=()=>(o(),t.defaultFontLoading),b=()=>(o(),t.enableDefaultTooltips),D=()=>(o(),t.calendarType),I=()=>(o(),t.secondaryCalendarType),O=()=>(o(),t.timezone),R=()=>(o(),t.formatSettings),i=new Map;i.set("true",!0),i.set("false",!1);const M=()=>{const n=document.querySelector("[data-ui5-config]")||document.querySelector("[data-id='sap-ui-config']");let e;if(n){try{e=JSON.parse(n.innerHTML)}catch{console.warn("Incorrect data-sap-ui-config format. Please use JSON")}e&&(t=f(t,e))}},z=()=>{const n=new URLSearchParams(h());n.forEach((e,a)=>{const r=a.split("sap-").length;r===0||r===a.split("sap-ui-").length||p(a,e,"sap")}),n.forEach((e,a)=>{a.startsWith("sap-ui")&&p(a,e,"sap-ui")})},E=n=>n.split("@")[1],P=(n,e)=>n==="theme"&&e.includes("@")?e.split("@")[0]:e,p=(n,e,a)=>{const r=e.toLowerCase(),s=n.split(`${a}-`)[1];i.has(e)&&(e=i.get(r)),s==="theme"?(t.theme=P(s,e),e&&e.includes("@")&&(t.themeRoot=E(e))):t[s]=e},w=()=>{const n=l("OpenUI5Support");if(!n||!n.isOpenUI5Detected())return;const e=n.getConfigurationSettingsObject();t=f(t,e)},o=()=>{typeof document>"u"||u||(g(),u=!0)},g=n=>{n&&d(),M(),z(),w()};export{y as getAnimationMode,C as getTheme,T as getThemeRoot,S as getLanguage,L as getFetchDefaultLanguage,F as getNoConflict,D as getCalendarType,I as getSecondaryCalendarType,O as getTimezone,R as getFormatSettings,U as getDefaultFontLoading,g as resetConfiguration,b as getEnableDefaultTooltips};
2
2
  //# sourceMappingURL=InitialConfiguration.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/InitialConfiguration.ts"],
4
- "sourcesContent": ["import merge from \"./thirdparty/merge.js\";\nimport { getFeature } from \"./FeaturesRegistry.js\";\nimport { DEFAULT_THEME } from \"./generated/AssetParameters.js\";\nimport validateThemeRoot from \"./validateThemeRoot.js\";\nimport type OpenUI5Support from \"./features/OpenUI5Support.js\";\nimport type { FormatSettings } from \"./config/FormatSettings.js\";\nimport AnimationMode from \"./types/AnimationMode.js\";\nimport type CalendarType from \"./types/CalendarType.js\";\nimport { resetConfiguration as resetConfigurationFn } from \"./config/ConfigurationReset.js\";\nimport { getLocationSearch } from \"./Location.js\";\n\nlet initialized = false;\n\ntype InitialConfig = {\n\t[key: string]: any,\n\tanimationMode: AnimationMode,\n\ttheme: string,\n\tthemeRoot: string | undefined,\n\tlanguage: string | undefined,\n\tcalendarType: CalendarType | undefined,\n\tsecondaryCalendarType: CalendarType | undefined,\n\ttimezone: string | undefined,\n\tnoConflict: boolean,\n\tformatSettings: FormatSettings,\n\tfetchDefaultLanguage: boolean,\n\tdefaultFontLoading: boolean,\n\tenableDefaultTooltips: boolean,\n};\n\nlet initialConfig: InitialConfig = {\n\tanimationMode: AnimationMode.Full,\n\ttheme: DEFAULT_THEME,\n\tthemeRoot: undefined,\n\trtl: undefined,\n\tlanguage: undefined,\n\ttimezone: undefined,\n\tcalendarType: undefined,\n\tsecondaryCalendarType: undefined,\n\tnoConflict: false, // no URL\n\tformatSettings: {},\n\tfetchDefaultLanguage: false,\n\tdefaultFontLoading: true,\n\tenableDefaultTooltips: true,\n};\n\n/* General settings */\nconst getAnimationMode = () => {\n\tinitConfiguration();\n\treturn initialConfig.animationMode;\n};\n\nconst getTheme = () => {\n\tinitConfiguration();\n\treturn initialConfig.theme;\n};\n\nconst getThemeRoot = () => {\n\tinitConfiguration();\n\n\tif (initialConfig.themeRoot === undefined) {\n\t\treturn;\n\t}\n\n\tif (!validateThemeRoot(initialConfig.themeRoot)) {\n\t\tconsole.warn(`The ${initialConfig.themeRoot} is not valid. Check the allowed origins as suggested in the \"setThemeRoot\" description.`); // eslint-disable-line\n\t\treturn;\n\t}\n\n\treturn initialConfig.themeRoot;\n};\n\nconst getLanguage = () => {\n\tinitConfiguration();\n\treturn initialConfig.language;\n};\n\n/**\n * Returns if the default language, that is inlined at build time,\n * should be fetched over the network instead.\n * @returns {Boolean}\n */\nconst getFetchDefaultLanguage = () => {\n\tinitConfiguration();\n\treturn initialConfig.fetchDefaultLanguage;\n};\n\nconst getNoConflict = () => {\n\tinitConfiguration();\n\treturn initialConfig.noConflict;\n};\n\nconst getDefaultFontLoading = () => {\n\tinitConfiguration();\n\treturn initialConfig.defaultFontLoading;\n};\n\nconst getEnableDefaultTooltips = () => {\n\tinitConfiguration();\n\treturn initialConfig.enableDefaultTooltips;\n};\n\n/**\n * Get the configured calendar type\n * @returns { String } the name of the configured calendar type\n */\nconst getCalendarType = () => {\n\tinitConfiguration();\n\treturn initialConfig.calendarType;\n};\n\nconst getSecondaryCalendarType = () => {\n\tinitConfiguration();\n\treturn initialConfig.secondaryCalendarType;\n};\n\n/**\n * Returns the configured IANA timezone ID.\n * @returns { String } the configured IANA timezone ID, e.g. \"America/New_York\"\n */\nconst getTimezone = () => {\n\tinitConfiguration();\n\treturn initialConfig.timezone;\n};\n\nconst getFormatSettings = () => {\n\tinitConfiguration();\n\treturn initialConfig.formatSettings;\n};\n\nconst booleanMapping = new Map();\nbooleanMapping.set(\"true\", true);\nbooleanMapping.set(\"false\", false);\n\nconst parseConfigurationScript = () => {\n\tconst configScript = document.querySelector(\"[data-ui5-config]\") || document.querySelector(\"[data-id='sap-ui-config']\"); // for backward compatibility\n\n\tlet configJSON;\n\n\tif (configScript) {\n\t\ttry {\n\t\t\tconfigJSON = JSON.parse(configScript.innerHTML);\n\t\t} catch (err) {\n\t\t\tconsole.warn(\"Incorrect data-sap-ui-config format. Please use JSON\"); /* eslint-disable-line */\n\t\t}\n\n\t\tif (configJSON) {\n\t\t\tinitialConfig = merge(initialConfig, configJSON);\n\t\t}\n\t}\n};\n\nconst parseURLParameters = () => {\n\tconst params = new URLSearchParams(getLocationSearch());\n\n\t// Process \"sap-*\" params first\n\tparams.forEach((value, key) => {\n\t\tconst parts = key.split(\"sap-\").length;\n\t\tif (parts === 0 || parts === key.split(\"sap-ui-\").length) {\n\t\t\treturn;\n\t\t}\n\n\t\tapplyURLParam(key, value, \"sap\");\n\t});\n\n\t// Process \"sap-ui-*\" params\n\tparams.forEach((value, key) => {\n\t\tif (!key.startsWith(\"sap-ui\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tapplyURLParam(key, value, \"sap-ui\");\n\t});\n};\n\nconst normalizeThemeRootParamValue = (value: string) => {\n\tconst themeRoot = value.split(\"@\")[1];\n\n\treturn validateThemeRoot(themeRoot);\n};\n\nconst normalizeThemeParamValue = (param: string, value: string) => {\n\tif (param === \"theme\" && value.includes(\"@\")) { // the theme parameter might have @<URL-TO-THEME> in the value - strip this\n\t\treturn value.split(\"@\")[0];\n\t}\n\n\treturn value;\n};\n\nconst applyURLParam = (key: string, value: string, paramType: string) => {\n\tconst lowerCaseValue = value.toLowerCase();\n\tconst param = key.split(`${paramType}-`)[1];\n\n\tif (booleanMapping.has(value)) {\n\t\tvalue = booleanMapping.get(lowerCaseValue);\n\t}\n\n\tif (param === \"theme\") {\n\t\tinitialConfig.theme = normalizeThemeParamValue(param, value);\n\n\t\tif (value && value.includes(\"@\")) {\n\t\t\tinitialConfig.themeRoot = normalizeThemeRootParamValue(value);\n\t\t}\n\t} else {\n\t\tinitialConfig[param] = value;\n\t}\n};\n\nconst applyOpenUI5Configuration = () => {\n\tconst openUI5Support = getFeature<typeof OpenUI5Support>(\"OpenUI5Support\");\n\tif (!openUI5Support || !openUI5Support.isOpenUI5Detected()) {\n\t\treturn;\n\t}\n\n\tconst OpenUI5Config = openUI5Support.getConfigurationSettingsObject();\n\tinitialConfig = merge(initialConfig, OpenUI5Config);\n};\n\nconst initConfiguration = () => {\n\tif (typeof document === \"undefined\" || initialized) {\n\t\treturn;\n\t}\n\n\tresetConfiguration();\n\n\tinitialized = true;\n};\n\n/**\n * Internaly exposed method to enable configurations in tests.\n * @private\n */\nconst resetConfiguration = (testEnv?: boolean) => {\n\tif (testEnv) {\n\t\tresetConfigurationFn();\n\t}\n\t// 1. Lowest priority - configuration script\n\tparseConfigurationScript();\n\n\t// 2. URL parameters overwrite configuration script parameters\n\tparseURLParameters();\n\n\t// 3. If OpenUI5 is detected, it has the highest priority\n\tapplyOpenUI5Configuration();\n};\n\nexport {\n\tgetAnimationMode,\n\tgetTheme,\n\tgetThemeRoot,\n\tgetLanguage,\n\tgetFetchDefaultLanguage,\n\tgetNoConflict,\n\tgetCalendarType,\n\tgetSecondaryCalendarType,\n\tgetTimezone,\n\tgetFormatSettings,\n\tgetDefaultFontLoading,\n\tresetConfiguration,\n\tgetEnableDefaultTooltips,\n};\n"],
5
- "mappings": "aAAA,OAAOA,MAAW,wBAClB,OAAS,cAAAC,MAAkB,wBAC3B,OAAS,iBAAAC,MAAqB,iCAC9B,OAAOC,MAAuB,yBAG9B,OAAOC,MAAmB,2BAE1B,OAAS,sBAAsBC,MAA4B,iCAC3D,OAAS,qBAAAC,MAAyB,gBAElC,IAAIC,EAAc,GAkBdC,EAA+B,CAClC,cAAeJ,EAAc,KAC7B,MAAOF,EACP,UAAW,OACX,IAAK,OACL,SAAU,OACV,SAAU,OACV,aAAc,OACd,sBAAuB,OACvB,WAAY,GACZ,eAAgB,CAAC,EACjB,qBAAsB,GACtB,mBAAoB,GACpB,sBAAuB,EACxB,EAGA,MAAMO,EAAmB,KACxBC,EAAkB,EACXF,EAAc,eAGhBG,EAAW,KAChBD,EAAkB,EACXF,EAAc,OAGhBI,EAAe,IAAM,CAG1B,GAFAF,EAAkB,EAEdF,EAAc,YAAc,OAIhC,IAAI,CAACL,EAAkBK,EAAc,SAAS,EAAG,CAChD,QAAQ,KAAK,OAAOA,EAAc,SAAS,0FAA0F,EACrI,MACD,CAEA,OAAOA,EAAc,UACtB,EAEMK,EAAc,KACnBH,EAAkB,EACXF,EAAc,UAQhBM,EAA0B,KAC/BJ,EAAkB,EACXF,EAAc,sBAGhBO,EAAgB,KACrBL,EAAkB,EACXF,EAAc,YAGhBQ,EAAwB,KAC7BN,EAAkB,EACXF,EAAc,oBAGhBS,EAA2B,KAChCP,EAAkB,EACXF,EAAc,uBAOhBU,EAAkB,KACvBR,EAAkB,EACXF,EAAc,cAGhBW,EAA2B,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,IAAIM,CAAK,IAC3BA,EAAQN,EAAe,IAAIe,CAAc,GAGtCF,IAAU,SACb3B,EAAc,MAAQ0B,EAAyBC,EAAOP,CAAK,EAEvDA,GAASA,EAAM,SAAS,GAAG,IAC9BpB,EAAc,UAAYwB,EAA6BJ,CAAK,IAG7DpB,EAAc2B,CAAK,EAAIP,CAEzB,EAEMU,EAA4B,IAAM,CACvC,MAAMC,EAAiBtC,EAAkC,gBAAgB,EACzE,GAAI,CAACsC,GAAkB,CAACA,EAAe,kBAAkB,EACxD,OAGD,MAAMC,EAAgBD,EAAe,+BAA+B,EACpE/B,EAAgBR,EAAMQ,EAAegC,CAAa,CACnD,EAEM9B,EAAoB,IAAM,CAC3B,OAAO,SAAa,KAAeH,IAIvCkC,EAAmB,EAEnBlC,EAAc,GACf,EAMMkC,EAAsBC,GAAsB,CAC7CA,GACHrC,EAAqB,EAGtBkB,EAAyB,EAGzBG,EAAmB,EAGnBY,EAA0B,CAC3B,EAEA,OACC7B,KAAA,iBACAE,KAAA,SACAC,KAAA,aACAC,KAAA,YACAC,KAAA,wBACAC,KAAA,cACAG,KAAA,gBACAC,KAAA,yBACAC,KAAA,YACAC,KAAA,kBACAL,KAAA,sBACAyB,KAAA,mBACAxB,KAAA",
6
- "names": ["merge", "getFeature", "DEFAULT_THEME", "validateThemeRoot", "AnimationMode", "resetConfigurationFn", "getLocationSearch", "initialized", "initialConfig", "getAnimationMode", "initConfiguration", "getTheme", "getThemeRoot", "getLanguage", "getFetchDefaultLanguage", "getNoConflict", "getDefaultFontLoading", "getEnableDefaultTooltips", "getCalendarType", "getSecondaryCalendarType", "getTimezone", "getFormatSettings", "booleanMapping", "parseConfigurationScript", "configScript", "configJSON", "parseURLParameters", "params", "value", "key", "parts", "applyURLParam", "normalizeThemeRootParamValue", "themeRoot", "normalizeThemeParamValue", "param", "paramType", "lowerCaseValue", "applyOpenUI5Configuration", "openUI5Support", "OpenUI5Config", "resetConfiguration", "testEnv"]
4
+ "sourcesContent": ["import merge from \"./thirdparty/merge.js\";\nimport { getFeature } from \"./FeaturesRegistry.js\";\nimport { DEFAULT_THEME } from \"./generated/AssetParameters.js\";\nimport type OpenUI5Support from \"./features/OpenUI5Support.js\";\nimport type { FormatSettings } from \"./config/FormatSettings.js\";\nimport AnimationMode from \"./types/AnimationMode.js\";\nimport type CalendarType from \"./types/CalendarType.js\";\nimport { resetConfiguration as resetConfigurationFn } from \"./config/ConfigurationReset.js\";\nimport { getLocationSearch } from \"./Location.js\";\n\nlet initialized = false;\n\ntype InitialConfig = {\n\t[key: string]: any,\n\tanimationMode: AnimationMode,\n\ttheme: string,\n\tthemeRoot: string | undefined,\n\tlanguage: string | undefined,\n\tcalendarType: CalendarType | undefined,\n\tsecondaryCalendarType: CalendarType | undefined,\n\ttimezone: string | undefined,\n\tnoConflict: boolean,\n\tformatSettings: FormatSettings,\n\tfetchDefaultLanguage: boolean,\n\tdefaultFontLoading: boolean,\n\tenableDefaultTooltips: boolean,\n};\n\nlet initialConfig: InitialConfig = {\n\tanimationMode: AnimationMode.Full,\n\ttheme: DEFAULT_THEME,\n\tthemeRoot: undefined,\n\trtl: undefined,\n\tlanguage: undefined,\n\ttimezone: undefined,\n\tcalendarType: undefined,\n\tsecondaryCalendarType: undefined,\n\tnoConflict: false, // no URL\n\tformatSettings: {},\n\tfetchDefaultLanguage: false,\n\tdefaultFontLoading: true,\n\tenableDefaultTooltips: true,\n};\n\n/* General settings */\nconst getAnimationMode = () => {\n\tinitConfiguration();\n\treturn initialConfig.animationMode;\n};\n\nconst getTheme = () => {\n\tinitConfiguration();\n\treturn initialConfig.theme;\n};\n\nconst getThemeRoot = () => {\n\tinitConfiguration();\n\treturn initialConfig.themeRoot;\n};\n\nconst getLanguage = () => {\n\tinitConfiguration();\n\treturn initialConfig.language;\n};\n\n/**\n * Returns if the default language, that is inlined at build time,\n * should be fetched over the network instead.\n * @returns {Boolean}\n */\nconst getFetchDefaultLanguage = () => {\n\tinitConfiguration();\n\treturn initialConfig.fetchDefaultLanguage;\n};\n\nconst getNoConflict = () => {\n\tinitConfiguration();\n\treturn initialConfig.noConflict;\n};\n\nconst getDefaultFontLoading = () => {\n\tinitConfiguration();\n\treturn initialConfig.defaultFontLoading;\n};\n\nconst getEnableDefaultTooltips = () => {\n\tinitConfiguration();\n\treturn initialConfig.enableDefaultTooltips;\n};\n\n/**\n * Get the configured calendar type\n * @returns { String } the name of the configured calendar type\n */\nconst getCalendarType = () => {\n\tinitConfiguration();\n\treturn initialConfig.calendarType;\n};\n\nconst getSecondaryCalendarType = () => {\n\tinitConfiguration();\n\treturn initialConfig.secondaryCalendarType;\n};\n\n/**\n * Returns the configured IANA timezone ID.\n * @returns { String } the configured IANA timezone ID, e.g. \"America/New_York\"\n */\nconst getTimezone = () => {\n\tinitConfiguration();\n\treturn initialConfig.timezone;\n};\n\nconst getFormatSettings = () => {\n\tinitConfiguration();\n\treturn initialConfig.formatSettings;\n};\n\nconst booleanMapping = new Map();\nbooleanMapping.set(\"true\", true);\nbooleanMapping.set(\"false\", false);\n\nconst parseConfigurationScript = () => {\n\tconst configScript = document.querySelector(\"[data-ui5-config]\") || document.querySelector(\"[data-id='sap-ui-config']\"); // for backward compatibility\n\n\tlet configJSON;\n\n\tif (configScript) {\n\t\ttry {\n\t\t\tconfigJSON = JSON.parse(configScript.innerHTML);\n\t\t} catch (err) {\n\t\t\tconsole.warn(\"Incorrect data-sap-ui-config format. Please use JSON\"); /* eslint-disable-line */\n\t\t}\n\n\t\tif (configJSON) {\n\t\t\tinitialConfig = merge(initialConfig, configJSON);\n\t\t}\n\t}\n};\n\nconst parseURLParameters = () => {\n\tconst params = new URLSearchParams(getLocationSearch());\n\n\t// Process \"sap-*\" params first\n\tparams.forEach((value, key) => {\n\t\tconst parts = key.split(\"sap-\").length;\n\t\tif (parts === 0 || parts === key.split(\"sap-ui-\").length) {\n\t\t\treturn;\n\t\t}\n\n\t\tapplyURLParam(key, value, \"sap\");\n\t});\n\n\t// Process \"sap-ui-*\" params\n\tparams.forEach((value, key) => {\n\t\tif (!key.startsWith(\"sap-ui\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tapplyURLParam(key, value, \"sap-ui\");\n\t});\n};\n\nconst normalizeThemeRootParamValue = (value: string) => {\n\tconst themeRoot = value.split(\"@\")[1];\n\n\treturn themeRoot;\n};\n\nconst normalizeThemeParamValue = (param: string, value: string) => {\n\tif (param === \"theme\" && value.includes(\"@\")) { // the theme parameter might have @<URL-TO-THEME> in the value - strip this\n\t\treturn value.split(\"@\")[0];\n\t}\n\n\treturn value;\n};\n\nconst applyURLParam = (key: string, value: string, paramType: string) => {\n\tconst lowerCaseValue = value.toLowerCase();\n\tconst param = key.split(`${paramType}-`)[1];\n\n\tif (booleanMapping.has(value)) {\n\t\tvalue = booleanMapping.get(lowerCaseValue);\n\t}\n\n\tif (param === \"theme\") {\n\t\tinitialConfig.theme = normalizeThemeParamValue(param, value);\n\n\t\tif (value && value.includes(\"@\")) {\n\t\t\tinitialConfig.themeRoot = normalizeThemeRootParamValue(value);\n\t\t}\n\t} else {\n\t\tinitialConfig[param] = value;\n\t}\n};\n\nconst applyOpenUI5Configuration = () => {\n\tconst openUI5Support = getFeature<typeof OpenUI5Support>(\"OpenUI5Support\");\n\tif (!openUI5Support || !openUI5Support.isOpenUI5Detected()) {\n\t\treturn;\n\t}\n\n\tconst OpenUI5Config = openUI5Support.getConfigurationSettingsObject();\n\tinitialConfig = merge(initialConfig, OpenUI5Config);\n};\n\nconst initConfiguration = () => {\n\tif (typeof document === \"undefined\" || initialized) {\n\t\treturn;\n\t}\n\n\tresetConfiguration();\n\n\tinitialized = true;\n};\n\n/**\n * Internaly exposed method to enable configurations in tests.\n * @private\n */\nconst resetConfiguration = (testEnv?: boolean) => {\n\tif (testEnv) {\n\t\tresetConfigurationFn();\n\t}\n\t// 1. Lowest priority - configuration script\n\tparseConfigurationScript();\n\n\t// 2. URL parameters overwrite configuration script parameters\n\tparseURLParameters();\n\n\t// 3. If OpenUI5 is detected, it has the highest priority\n\tapplyOpenUI5Configuration();\n};\n\nexport {\n\tgetAnimationMode,\n\tgetTheme,\n\tgetThemeRoot,\n\tgetLanguage,\n\tgetFetchDefaultLanguage,\n\tgetNoConflict,\n\tgetCalendarType,\n\tgetSecondaryCalendarType,\n\tgetTimezone,\n\tgetFormatSettings,\n\tgetDefaultFontLoading,\n\tresetConfiguration,\n\tgetEnableDefaultTooltips,\n};\n"],
5
+ "mappings": "aAAA,OAAOA,MAAW,wBAClB,OAAS,cAAAC,MAAkB,wBAC3B,OAAS,iBAAAC,MAAqB,iCAG9B,OAAOC,MAAmB,2BAE1B,OAAS,sBAAsBC,MAA4B,iCAC3D,OAAS,qBAAAC,MAAyB,gBAElC,IAAIC,EAAc,GAkBdC,EAA+B,CAClC,cAAeJ,EAAc,KAC7B,MAAOD,EACP,UAAW,OACX,IAAK,OACL,SAAU,OACV,SAAU,OACV,aAAc,OACd,sBAAuB,OACvB,WAAY,GACZ,eAAgB,CAAC,EACjB,qBAAsB,GACtB,mBAAoB,GACpB,sBAAuB,EACxB,EAGA,MAAMM,EAAmB,KACxBC,EAAkB,EACXF,EAAc,eAGhBG,EAAW,KAChBD,EAAkB,EACXF,EAAc,OAGhBI,EAAe,KACpBF,EAAkB,EACXF,EAAc,WAGhBK,EAAc,KACnBH,EAAkB,EACXF,EAAc,UAQhBM,EAA0B,KAC/BJ,EAAkB,EACXF,EAAc,sBAGhBO,EAAgB,KACrBL,EAAkB,EACXF,EAAc,YAGhBQ,EAAwB,KAC7BN,EAAkB,EACXF,EAAc,oBAGhBS,EAA2B,KAChCP,EAAkB,EACXF,EAAc,uBAOhBU,EAAkB,KACvBR,EAAkB,EACXF,EAAc,cAGhBW,EAA2B,KAChCT,EAAkB,EACXF,EAAc,uBAOhBY,EAAc,KACnBV,EAAkB,EACXF,EAAc,UAGhBa,EAAoB,KACzBX,EAAkB,EACXF,EAAc,gBAGhBc,EAAiB,IAAI,IAC3BA,EAAe,IAAI,OAAQ,EAAI,EAC/BA,E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,CACvC,MAAMC,EAAiBpC,EAAkC,gBAAgB,EACzE,GAAI,CAACoC,GAAkB,CAACA,EAAe,kBAAkB,EACxD,OAGD,MAAMC,EAAgBD,EAAe,+BAA+B,EACpE9B,EAAgBP,EAAMO,EAAe+B,CAAa,CACnD,EAEM7B,EAAoB,IAAM,CAC3B,OAAO,SAAa,KAAeH,IAIvCiC,EAAmB,EAEnBjC,EAAc,GACf,EAMMiC,EAAsBC,GAAsB,CAC7CA,GACHpC,EAAqB,EAGtBkB,EAAyB,EAGzBG,EAAmB,EAGnBW,EAA0B,CAC3B,EAEA,OACC5B,KAAA,iBACAE,KAAA,SACAC,KAAA,aACAC,KAAA,YACAC,KAAA,wBACAC,KAAA,cACAG,KAAA,gBACAC,KAAA,yBACAC,KAAA,YACAC,KAAA,kBACAL,KAAA,sBACAwB,KAAA,mBACAvB,KAAA",
6
+ "names": ["merge", "getFeature", "DEFAULT_THEME", "AnimationMode", "resetConfigurationFn", "getLocationSearch", "initialized", "initialConfig", "getAnimationMode", "initConfiguration", "getTheme", "getThemeRoot", "getLanguage", "getFetchDefaultLanguage", "getNoConflict", "getDefaultFontLoading", "getEnableDefaultTooltips", "getCalendarType", "getSecondaryCalendarType", "getTimezone", "getFormatSettings", "booleanMapping", "parseConfigurationScript", "configScript", "configJSON", "parseURLParameters", "params", "value", "key", "parts", "applyURLParam", "normalizeThemeRootParamValue", "normalizeThemeParamValue", "param", "paramType", "lowerCaseValue", "applyOpenUI5Configuration", "openUI5Support", "OpenUI5Config", "resetConfiguration", "testEnv"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";import r from"../util/createLinkInHead.js";import s from"../validateThemeRoot.js";import{getThemeRoot as a}from"../InitialConfiguration.js";import{getTheme as m}from"./Theme.js";import{attachConfigurationReset as d}from"./ConfigurationReset.js";let t;d(()=>{t=void 0});const n=()=>(t===void 0&&(t=a()),t),c=e=>{if(t!==e){if(t=e,!s(e)){console.warn(`The ${e} is not valid. Check the allowed origins as suggested in the "setThemeRoot" description.`);return}return i(m())}},u=e=>`${n()}Base/baseLib/${e}/css_variables.css`,i=async e=>{const o=document.querySelector(`[sap-ui-webcomponents-theme="${e}"]`);o&&document.head.removeChild(o),await r(u(e),{"sap-ui-webcomponents-theme":e})};export{n as getThemeRoot,c as setThemeRoot,i as attachCustomThemeStylesToHead};
1
+ "use strict";import m from"../util/createLinkInHead.js";import a from"../validateThemeRoot.js";import{getThemeRoot as d}from"../InitialConfiguration.js";import{getTheme as c}from"./Theme.js";import{attachConfigurationReset as u}from"./ConfigurationReset.js";let t;u(()=>{t=void 0});const r=()=>(t===void 0&&(t=d()),t),h=e=>{if(t!==e)return t=e,s(c())},f=(e,o)=>`${o}Base/baseLib/${e}/css_variables.css`,s=async e=>{const o=document.querySelector(`[sap-ui-webcomponents-theme="${e}"]`);o&&document.head.removeChild(o);const n=r();if(!n)return;const i=a(n);if(!i){console.warn(`The ${n} is not valid. Check the allowed origins as suggested in the "setThemeRoot" description.`);return}await m(f(e,i),{"sap-ui-webcomponents-theme":e})};export{r as getThemeRoot,h as setThemeRoot,s as attachCustomThemeStylesToHead};
2
2
  //# sourceMappingURL=ThemeRoot.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/config/ThemeRoot.ts"],
4
- "sourcesContent": ["import createLinkInHead from \"../util/createLinkInHead.js\";\nimport validateThemeRoot from \"../validateThemeRoot.js\";\nimport { getThemeRoot as getConfiguredThemeRoot } from \"../InitialConfiguration.js\";\nimport { getTheme } from \"./Theme.js\";\nimport { attachConfigurationReset } from \"./ConfigurationReset.js\";\n\nlet currThemeRoot: string | undefined;\n\nattachConfigurationReset(() => {\n\tcurrThemeRoot = undefined;\n});\n\n/**\n * Returns the current theme root.\n *\n * @public\n * @since 1.14.0\n * @returns { string } the current theme root\n */\nconst getThemeRoot = (): string | undefined => {\n\tif (currThemeRoot === undefined) {\n\t\tcurrThemeRoot = getConfiguredThemeRoot();\n\t}\n\n\treturn currThemeRoot;\n};\n\n/**\n * Sets theme root for the current theme.\n * When set, the framework will validate the theme root and fetch the theme styles (CSS variables) from this location.\n *\n * **Note:** The feature is specific to custom themes, created with the `UI Theme Designer`.\n * The provided theme root is used only as a base to construct the actual location of the theme styles: `{themeRoot}/.../css_variables.css`.\n *\n * **Note:** Certain security restrictions will apply before fetching the theme assets.\n * Absolute URLs to a different origin than the current page will result in using the current page as an origin.\n *\n * **Important:** To use this feature you must explicitly allow specific origins by using &lt;meta name=\"sap-allowed-theme-origins\" content=\"https://my-example-host.com/\"&gt; tag inside the &lt;head&gt; of the page.\n * Failing to do so will result in a warning in the console and the theme root will not be set.\n *\n * @public\n * @since 1.14.0\n * @param { string } themeRoot the new theme root\n * @returns { Promise<void> }\n */\nconst setThemeRoot = (themeRoot: string): Promise<void> | undefined => {\n\tif (currThemeRoot === themeRoot) {\n\t\treturn;\n\t}\n\n\tcurrThemeRoot = themeRoot;\n\n\tif (!validateThemeRoot(themeRoot)) {\n\t\tconsole.warn(`The ${themeRoot} is not valid. Check the allowed origins as suggested in the \"setThemeRoot\" description.`); // eslint-disable-line\n\t\treturn;\n\t}\n\n\treturn attachCustomThemeStylesToHead(getTheme());\n};\n\nconst formatThemeLink = (theme: string) => {\n\treturn `${getThemeRoot()!}Base/baseLib/${theme}/css_variables.css`; // theme root is always set at this point.\n};\n\nconst attachCustomThemeStylesToHead = async (theme: string): Promise<void> => {\n\tconst link = document.querySelector(`[sap-ui-webcomponents-theme=\"${theme}\"]`);\n\n\tif (link) {\n\t\tdocument.head.removeChild(link);\n\t}\n\n\tawait createLinkInHead(formatThemeLink(theme), { \"sap-ui-webcomponents-theme\": theme });\n};\n\nexport {\n\tgetThemeRoot,\n\tsetThemeRoot,\n\tattachCustomThemeStylesToHead,\n};\n"],
5
- "mappings": "aAAA,OAAOA,MAAsB,8BAC7B,OAAOC,MAAuB,0BAC9B,OAAS,gBAAgBC,MAA8B,6BACvD,OAAS,YAAAC,MAAgB,aACzB,OAAS,4BAAAC,MAAgC,0BAEzC,IAAIC,EAEJD,EAAyB,IAAM,CAC9BC,EAAgB,MACjB,CAAC,EASD,MAAMC,EAAe,KAChBD,IAAkB,SACrBA,EAAgBH,EAAuB,GAGjCG,GAqBFE,EAAgBC,GAAiD,CACtE,GAAIH,IAAkBG,EAMtB,IAFAH,EAAgBG,EAEZ,CAACP,EAAkBO,CAAS,EAAG,CAClC,QAAQ,KAAK,OAAOA,CAAS,0FAA0F,EACvH,MACD,CAEA,OAAOC,EAA8BN,EAAS,CAAC,EAChD,EAEMO,EAAmBC,GACjB,GAAGL,EAAa,CAAE,gBAAgBK,CAAK,qBAGzCF,EAAgC,MAAOE,GAAiC,CAC7E,MAAMC,EAAO,SAAS,cAAc,gCAAgCD,CAAK,IAAI,EAEzEC,GACH,SAAS,KAAK,YAAYA,CAAI,EAG/B,MAAMZ,EAAiBU,EAAgBC,CAAK,EAAG,CAAE,6BAA8BA,CAAM,CAAC,CACvF,EAEA,OACCL,KAAA,aACAC,KAAA,aACAE,KAAA",
6
- "names": ["createLinkInHead", "validateThemeRoot", "getConfiguredThemeRoot", "getTheme", "attachConfigurationReset", "currThemeRoot", "getThemeRoot", "setThemeRoot", "themeRoot", "attachCustomThemeStylesToHead", "formatThemeLink", "theme", "link"]
4
+ "sourcesContent": ["import createLinkInHead from \"../util/createLinkInHead.js\";\nimport validateThemeRoot from \"../validateThemeRoot.js\";\nimport { getThemeRoot as getConfiguredThemeRoot } from \"../InitialConfiguration.js\";\nimport { getTheme } from \"./Theme.js\";\nimport { attachConfigurationReset } from \"./ConfigurationReset.js\";\n\nlet currThemeRoot: string | undefined;\n\nattachConfigurationReset(() => {\n\tcurrThemeRoot = undefined;\n});\n\n/**\n * Returns the current theme root.\n *\n * @public\n * @since 1.14.0\n * @returns { string } the current theme root\n */\nconst getThemeRoot = (): string | undefined => {\n\tif (currThemeRoot === undefined) {\n\t\tcurrThemeRoot = getConfiguredThemeRoot();\n\t}\n\n\treturn currThemeRoot;\n};\n\n/**\n * Sets theme root for the current theme.\n * When set, the framework will validate the theme root and fetch the theme styles (CSS variables) from this location.\n *\n * **Note:** The feature is specific to custom themes, created with the `UI Theme Designer`.\n * The provided theme root is used only as a base to construct the actual location of the theme styles: `{themeRoot}/.../css_variables.css`.\n *\n * **Note:** Certain security restrictions will apply before fetching the theme assets.\n * Absolute URLs to a different origin than the current page will result in using the current page as an origin.\n *\n * **Important:** To use this feature you must explicitly allow specific origins by using &lt;meta name=\"sap-allowed-theme-origins\" content=\"https://my-example-host.com/\"&gt; tag inside the &lt;head&gt; of the page.\n * Failing to do so will result in a warning in the console and the theme root will not be set.\n *\n * @public\n * @since 1.14.0\n * @param { string } themeRoot the new theme root\n * @returns { Promise<void> }\n */\nconst setThemeRoot = (themeRoot: string): Promise<void> | undefined => {\n\tif (currThemeRoot === themeRoot) {\n\t\treturn;\n\t}\n\n\tcurrThemeRoot = themeRoot;\n\n\treturn attachCustomThemeStylesToHead(getTheme());\n};\n\nconst formatThemeLink = (theme: string, validatedThemeRoot: string) => {\n\treturn `${validatedThemeRoot}Base/baseLib/${theme}/css_variables.css`;\n};\n\nconst attachCustomThemeStylesToHead = async (theme: string): Promise<void> => {\n\tconst link = document.querySelector(`[sap-ui-webcomponents-theme=\"${theme}\"]`);\n\n\tif (link) {\n\t\tdocument.head.removeChild(link);\n\t}\n\n\tconst themeRoot = getThemeRoot();\n\n\tif (!themeRoot) {\n\t\treturn;\n\t}\n\n\tconst validatedThemeRoot = validateThemeRoot(themeRoot);\n\n\tif (!validatedThemeRoot) {\n\t\tconsole.warn(`The ${themeRoot} is not valid. Check the allowed origins as suggested in the \"setThemeRoot\" description.`); // eslint-disable-line\n\t\treturn;\n\t}\n\n\tawait createLinkInHead(formatThemeLink(theme, validatedThemeRoot), { \"sap-ui-webcomponents-theme\": theme });\n};\n\nexport {\n\tgetThemeRoot,\n\tsetThemeRoot,\n\tattachCustomThemeStylesToHead,\n};\n"],
5
+ "mappings": "aAAA,OAAOA,MAAsB,8BAC7B,OAAOC,MAAuB,0BAC9B,OAAS,gBAAgBC,MAA8B,6BACvD,OAAS,YAAAC,MAAgB,aACzB,OAAS,4BAAAC,MAAgC,0BAEzC,IAAIC,EAEJD,EAAyB,IAAM,CAC9BC,EAAgB,MACjB,CAAC,EASD,MAAMC,EAAe,KAChBD,IAAkB,SACrBA,EAAgBH,EAAuB,GAGjCG,GAqBFE,EAAgBC,GAAiD,CACtE,GAAIH,IAAkBG,EAItB,OAAAH,EAAgBG,EAETC,EAA8BN,EAAS,CAAC,CAChD,EAEMO,EAAkB,CAACC,EAAeC,IAChC,GAAGA,CAAkB,gBAAgBD,CAAK,qBAG5CF,EAAgC,MAAOE,GAAiC,CAC7E,MAAME,EAAO,SAAS,cAAc,gCAAgCF,CAAK,IAAI,EAEzEE,GACH,SAAS,KAAK,YAAYA,CAAI,EAG/B,MAAML,EAAYF,EAAa,EAE/B,GAAI,CAACE,EACJ,OAGD,MAAMI,EAAqBX,EAAkBO,CAAS,EAEtD,GAAI,CAACI,EAAoB,CACxB,QAAQ,KAAK,OAAOJ,CAAS,0FAA0F,EACvH,MACD,CAEA,MAAMR,EAAiBU,EAAgBC,EAAOC,CAAkB,EAAG,CAAE,6BAA8BD,CAAM,CAAC,CAC3G,EAEA,OACCL,KAAA,aACAC,KAAA,aACAE,KAAA",
6
+ "names": ["createLinkInHead", "validateThemeRoot", "getConfiguredThemeRoot", "getTheme", "attachConfigurationReset", "currThemeRoot", "getThemeRoot", "setThemeRoot", "themeRoot", "attachCustomThemeStylesToHead", "formatThemeLink", "theme", "validatedThemeRoot", "link"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";const s=t=>{o(t)&&i(t)},i=t=>{if(t._internals?.form){if(e(t),!t.name){t._internals?.setFormValue(null);return}t._internals.setFormValue(t.formFormattedValue)}},e=async t=>{if(!(!t.isUI5Element||!t._internals?.form))if(t._internals.setValidity({customError:!0}," "),await t.definePromise,t.formValidity&&Object.keys(t.formValidity).some(r=>r)){const r=await t.formElementAnchor?.();t._internals.setValidity(t.formValidity,t.formValidityMessage,r)}else t._internals.setValidity({})},m=async t=>{const r=[...t._internals?.form?.elements??[]];await Promise.all(r.map(n=>o(n)?e(n):Promise.resolve())),t._internals?.form?.requestSubmit()},a=t=>{t._internals?.form?.reset()},o=t=>"formFormattedValue"in t&&"name"in t;export{s as updateFormValue,i as setFormValue,e as setFormValidity,m as submitForm,a as resetForm};
1
+ "use strict";const m=t=>{const r=t.getAttribute("form");if(r){const e=document.getElementById(r);return e instanceof HTMLFormElement?e:null}return t._internals?.form??null},a=t=>{s(t)&&i(t)},i=t=>{if(t._internals?.form){if(n(t),!t.name){t._internals?.setFormValue(null);return}t._internals.setFormValue(t.formFormattedValue)}},n=async t=>{if(!(!t.isUI5Element||!t._internals?.form))if(t._internals.setValidity({customError:!0}," "),await t.definePromise,t.formValidity&&Object.keys(t.formValidity).some(r=>r)){const r=await t.formElementAnchor?.();t._internals.setValidity(t.formValidity,t.formValidityMessage,r)}else t._internals.setValidity({})},l=async t=>{const r=m(t);if(!r)return;const e=[...r.elements];await Promise.all(e.map(o=>s(o)?n(o):Promise.resolve())),r.requestSubmit()},u=t=>{m(t)?.reset()},s=t=>"formFormattedValue"in t&&"name"in t;export{a as updateFormValue,i as setFormValue,n as setFormValidity,l as submitForm,u as resetForm};
2
2
  //# sourceMappingURL=InputElementsFormSupport.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/features/InputElementsFormSupport.ts"],
4
- "sourcesContent": ["import type UI5Element from \"../UI5Element.js\";\n\ninterface IFormInputElement extends UI5Element {\n\tname?: string;\n\tformFormattedValue: FormData | string | null;\n\tformValidityMessage?: string;\n\tformValidity?: ValidityStateFlags;\n\tformElementAnchor?: () => HTMLElement | undefined | Promise<HTMLElement | undefined>;\n}\n\nconst updateFormValue = (element: IFormInputElement | UI5Element) => {\n\tif (isInputElement(element)) {\n\t\tsetFormValue(element);\n\t}\n};\n\nconst setFormValue = (element: IFormInputElement) => {\n\tif (!element._internals?.form) {\n\t\treturn;\n\t}\n\n\tsetFormValidity(element);\n\n\tif (!element.name) {\n\t\telement._internals?.setFormValue(null);\n\t\treturn;\n\t}\n\n\telement._internals.setFormValue(element.formFormattedValue);\n};\n\nconst setFormValidity = async (element: IFormInputElement) => {\n\tif (!element.isUI5Element || !element._internals?.form) {\n\t\treturn;\n\t}\n\n\telement._internals.setValidity({ customError: true }, \" \"); // treat the form as invalid until CLDR and message bundles are loaded\n\tawait element.definePromise;\n\n\tif (element.formValidity && Object.keys(element.formValidity).some(key => key)) {\n\t\tconst focusRef = await element.formElementAnchor?.();\n\t\telement._internals.setValidity(element.formValidity, element.formValidityMessage, focusRef);\n\t} else {\n\t\telement._internals.setValidity({});\n\t}\n};\n\nconst submitForm = async (element: UI5Element) => {\n\tconst elements = [...(element._internals?.form?.elements ?? [])] as Array<IFormInputElement | UI5Element>;\n\n\tawait Promise.all(elements.map(el => { return isInputElement(el) ? setFormValidity(el) : Promise.resolve(); }));\n\n\telement._internals?.form?.requestSubmit();\n};\n\nconst resetForm = (element: UI5Element) => {\n\telement._internals?.form?.reset();\n};\n\nconst isInputElement = (element: IFormInputElement | UI5Element): element is IFormInputElement => {\n\treturn \"formFormattedValue\" in element && \"name\" in element;\n};\n\nexport {\n\tupdateFormValue,\n\tsetFormValue,\n\tsetFormValidity,\n\tsubmitForm,\n\tresetForm,\n};\n\nexport type {\n\tIFormInputElement,\n};\n"],
5
- "mappings": "aAUA,MAAMA,EAAmBC,GAA4C,CAChEC,EAAeD,CAAO,GACzBE,EAAaF,CAAO,CAEtB,EAEME,EAAgBF,GAA+B,CACpD,GAAKA,EAAQ,YAAY,KAMzB,IAFAG,EAAgBH,CAAO,EAEnB,CAACA,EAAQ,KAAM,CAClBA,EAAQ,YAAY,aAAa,IAAI,EACrC,MACD,CAEAA,EAAQ,WAAW,aAAaA,EAAQ,kBAAkB,EAC3D,EAEMG,EAAkB,MAAOH,GAA+B,CAC7D,GAAI,GAACA,EAAQ,cAAgB,CAACA,EAAQ,YAAY,MAOlD,GAHAA,EAAQ,WAAW,YAAY,CAAE,YAAa,EAAK,EAAG,GAAG,EACzD,MAAMA,EAAQ,cAEVA,EAAQ,cAAgB,OAAO,KAAKA,EAAQ,YAAY,EAAE,KAAKI,GAAOA,CAAG,EAAG,CAC/E,MAAMC,EAAW,MAAML,EAAQ,oBAAoB,EACnDA,EAAQ,WAAW,YAAYA,EAAQ,aAAcA,EAAQ,oBAAqBK,CAAQ,CAC3F,MACCL,EAAQ,WAAW,YAAY,CAAC,CAAC,CAEnC,EAEMM,EAAa,MAAON,GAAwB,CACjD,MAAMO,EAAW,CAAC,GAAIP,EAAQ,YAAY,MAAM,UAAY,CAAC,CAAE,EAE/D,MAAM,QAAQ,IAAIO,EAAS,IAAIC,GAAeP,EAAeO,CAAE,EAAIL,EAAgBK,CAAE,EAAI,QAAQ,QAAQ,CAAI,CAAC,EAE9GR,EAAQ,YAAY,MAAM,cAAc,CACzC,EAEMS,EAAaT,GAAwB,CAC1CA,EAAQ,YAAY,MAAM,MAAM,CACjC,EAEMC,EAAkBD,GAChB,uBAAwBA,GAAW,SAAUA,EAGrD,OACCD,KAAA,gBACAG,KAAA,aACAC,KAAA,gBACAG,KAAA,WACAG,KAAA",
6
- "names": ["updateFormValue", "element", "isInputElement", "setFormValue", "setFormValidity", "key", "focusRef", "submitForm", "elements", "el", "resetForm"]
4
+ "sourcesContent": ["import type UI5Element from \"../UI5Element.js\";\n\ninterface IFormInputElement extends UI5Element {\n\tname?: string;\n\tformFormattedValue: FormData | string | null;\n\tformValidityMessage?: string;\n\tformValidity?: ValidityStateFlags;\n\tformElementAnchor?: () => HTMLElement | undefined | Promise<HTMLElement | undefined>;\n}\n\n/**\n * Gets the associated form for an element.\n * If the element has a `form` attribute, it looks up the form by ID.\n * Otherwise, it falls back to the form associated via ElementInternals.\n */\nconst getAssociatedForm = (element: UI5Element): HTMLFormElement | null => {\n\tconst formAttribute = element.getAttribute(\"form\");\n\n\tif (formAttribute) {\n\t\tconst form = document.getElementById(formAttribute);\n\t\treturn form instanceof HTMLFormElement ? form : null;\n\t}\n\n\treturn element._internals?.form ?? null;\n};\n\nconst updateFormValue = (element: IFormInputElement | UI5Element) => {\n\tif (isInputElement(element)) {\n\t\tsetFormValue(element);\n\t}\n};\n\nconst setFormValue = (element: IFormInputElement) => {\n\tif (!element._internals?.form) {\n\t\treturn;\n\t}\n\n\tsetFormValidity(element);\n\n\tif (!element.name) {\n\t\telement._internals?.setFormValue(null);\n\t\treturn;\n\t}\n\n\telement._internals.setFormValue(element.formFormattedValue);\n};\n\nconst setFormValidity = async (element: IFormInputElement) => {\n\tif (!element.isUI5Element || !element._internals?.form) {\n\t\treturn;\n\t}\n\n\telement._internals.setValidity({ customError: true }, \" \"); // treat the form as invalid until CLDR and message bundles are loaded\n\tawait element.definePromise;\n\n\tif (element.formValidity && Object.keys(element.formValidity).some(key => key)) {\n\t\tconst focusRef = await element.formElementAnchor?.();\n\t\telement._internals.setValidity(element.formValidity, element.formValidityMessage, focusRef);\n\t} else {\n\t\telement._internals.setValidity({});\n\t}\n};\n\nconst submitForm = async (element: UI5Element) => {\n\tconst form = getAssociatedForm(element);\n\n\tif (!form) {\n\t\treturn;\n\t}\n\n\tconst elements = [...form.elements] as Array<IFormInputElement | UI5Element>;\n\n\tawait Promise.all(elements.map(el => { return isInputElement(el) ? setFormValidity(el) : Promise.resolve(); }));\n\n\tform.requestSubmit();\n};\n\nconst resetForm = (element: UI5Element) => {\n\tconst form = getAssociatedForm(element);\n\tform?.reset();\n};\n\nconst isInputElement = (element: IFormInputElement | UI5Element): element is IFormInputElement => {\n\treturn \"formFormattedValue\" in element && \"name\" in element;\n};\n\nexport {\n\tupdateFormValue,\n\tsetFormValue,\n\tsetFormValidity,\n\tsubmitForm,\n\tresetForm,\n};\n\nexport type {\n\tIFormInputElement,\n};\n"],
5
+ "mappings": "aAeA,MAAMA,EAAqBC,GAAgD,CAC1E,MAAMC,EAAgBD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ACCG,KAAA,gBACAE,KAAA,aACAC,KAAA,gBACAG,KAAA,WACAG,KAAA",
6
+ "names": ["getAssociatedForm", "element", "formAttribute", "form", "updateFormValue", "isInputElement", "setFormValue", "setFormValidity", "key", "focusRef", "submitForm", "elements", "el", "resetForm"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";const e={version:"2.21.0-rc.4",major:2,minor:21,patch:0,suffix:"-rc.4",isNext:!1,buildTime:1775118131};export default e;
1
+ "use strict";const e={version:"2.22.0-rc.0",major:2,minor:22,patch:0,suffix:"-rc.0",isNext:!1,buildTime:1775723527};export default e;
2
2
  //# sourceMappingURL=VersionInfo.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/generated/VersionInfo.ts"],
4
- "sourcesContent": ["const VersionInfo = {\n\tversion: \"2.21.0-rc.4\",\n\tmajor: 2,\n\tminor: 21,\n\tpatch: 0,\n\tsuffix: \"-rc.4\",\n\tisNext: false,\n\tbuildTime: 1775118131,\n};\nexport default VersionInfo;"],
4
+ "sourcesContent": ["const VersionInfo = {\n\tversion: \"2.22.0-rc.0\",\n\tmajor: 2,\n\tminor: 22,\n\tpatch: 0,\n\tsuffix: \"-rc.0\",\n\tisNext: false,\n\tbuildTime: 1775723527,\n};\nexport default VersionInfo;"],
5
5
  "mappings": "aAAA,MAAMA,EAAc,CACnB,QAAS,cACT,MAAO,EACP,MAAO,GACP,MAAO,EACP,OAAQ,QACR,OAAQ,GACR,UAAW,UACZ,EACA,eAAeA",
6
6
  "names": ["VersionInfo"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";import{getLocationHref as i}from"./Location.js";const s=e=>{const t=document.querySelector(`META[name="${e}"]`);return t&&t.getAttribute("content")},o=e=>{const t=s("sap-allowed-theme-origins")??s("sap-allowedThemeOrigins");return t?t.split(",").some(n=>n==="*"||e===n.trim()):!1},a=(e,t)=>{const n=new URL(e).pathname;return new URL(n,t).toString()},g=e=>{let t;try{if(e.startsWith(".")||e.startsWith("/"))t=new URL(e,i()).toString();else{const n=new URL(e),r=n.origin;r&&o(r)?t=n.toString():t=a(n.toString(),i())}return t.endsWith("/")||(t=`${t}/`),`${t}UI5/`}catch{}};export default g;
1
+ "use strict";import{getLocationHref as s}from"./Location.js";const a=e=>{const t=document.querySelector(`META[name="${e}"]`);return t&&t.getAttribute("content")},g=(e,t=!1)=>{const n=a("sap-allowed-theme-origins")??a("sap-allowedThemeOrigins");return n?t?!0:n.split(",").some(r=>r==="*"||e===r.trim()):!1},l=e=>{let t,n=!1;try{if(e.startsWith(".")||e.startsWith("/"))t=new URL(e,s()).toString(),n=!0;else{const r=new URL(e),i=r.origin,o=new URL(s()).origin;if(n=i===o,i&&g(i,n))t=r.toString();else return}return t.endsWith("/")||(t=`${t}/`),`${t}UI5/`}catch{return}};export default l;
2
2
  //# sourceMappingURL=validateThemeRoot.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/validateThemeRoot.ts"],
4
- "sourcesContent": ["import { getLocationHref } from \"./Location.js\";\n\nconst getMetaTagValue = (metaTagName: string) => {\n\tconst metaTag = document.querySelector(`META[name=\"${metaTagName}\"]`),\n\t\tmetaTagContent = metaTag && metaTag.getAttribute(\"content\");\n\n\treturn metaTagContent;\n};\n\nconst validateThemeOrigin = (origin: string) => {\n\tconst allowedOrigins = getMetaTagValue(\"sap-allowed-theme-origins\") ?? getMetaTagValue(\"sap-allowedThemeOrigins\"); // Prioritize the new meta tag name\n\n\t// If no allowed origins are specified, block.\n\tif (!allowedOrigins) {\n\t\treturn false;\n\t}\n\n\treturn allowedOrigins.split(\",\").some(allowedOrigin => {\n\t\treturn allowedOrigin === \"*\" || origin === allowedOrigin.trim();\n\t});\n};\n\nconst buildCorrectUrl = (oldUrl: string, newOrigin: string) => {\n\tconst oldUrlPath = new URL(oldUrl).pathname;\n\n\treturn new URL(oldUrlPath, newOrigin).toString();\n};\n\nconst validateThemeRoot = (themeRoot: string) => {\n\tlet resultUrl;\n\n\ttry {\n\t\tif (themeRoot.startsWith(\".\") || themeRoot.startsWith(\"/\")) {\n\t\t\t// Handle relative url\n\t\t\t// new URL(\"/newExmPath\", \"http://example.com/exmPath\") => http://example.com/newExmPath\n\t\t\t// new URL(\"./newExmPath\", \"http://example.com/exmPath\") => http://example.com/exmPath/newExmPath\n\t\t\t// new URL(\"../newExmPath\", \"http://example.com/exmPath\") => http://example.com/newExmPath\n\t\t\tresultUrl = new URL(themeRoot, getLocationHref()).toString();\n\t\t} else {\n\t\t\tconst themeRootURL = new URL(themeRoot);\n\t\t\tconst origin = themeRootURL.origin;\n\n\t\t\tif (origin && validateThemeOrigin(origin)) {\n\t\t\t\t// If origin is allowed, use it\n\t\t\t\tresultUrl = themeRootURL.toString();\n\t\t\t} else {\n\t\t\t\t// If origin is not allow and the URL is not relative, we have to replace the origin\n\t\t\t\t// with current location\n\t\t\t\tresultUrl = buildCorrectUrl(themeRootURL.toString(), getLocationHref());\n\t\t\t}\n\t\t}\n\n\t\tif (!resultUrl.endsWith(\"/\")) {\n\t\t\tresultUrl = `${resultUrl}/`;\n\t\t}\n\n\t\treturn `${resultUrl}UI5/`;\n\t} catch (e) {\n\t\t// Catch if URL is not correct\n\t}\n};\n\nexport default validateThemeRoot;\n"],
5
- "mappings": "aAAA,OAAS,mBAAAA,MAAuB,gBAEhC,MAAMC,EAAmBC,GAAwB,CAChD,MAAMC,EAAU,SAAS,cAAc,cAAcD,CAAW,IAAI,EAGpE,OAFkBC,GAAWA,EAAQ,aAAa,SAAS,CAG5D,EAEMC,EAAuBC,GAAmB,CAC/C,MAAMC,EAAiBL,EAAgB,2BAA2B,GAAKA,EAAgB,yBAAyB,EAGhH,OAAKK,EAIEA,EAAe,MAAM,GAAG,EAAE,KAAKC,GAC9BA,IAAkB,KAAOF,IAAWE,EAAc,KAAK,CAC9D,EALO,EAMT,EAEMC,EAAkB,CAACC,EAAgBC,IAAsB,CAC9D,MAAMC,EAAa,IAAI,IAAIF,CAAM,EAAE,SAEnC,OAAO,IAAI,IAAIE,EAAYD,CAAS,EAAE,SAAS,CAChD,EAEME,EAAqBC,GAAsB,CAChD,IAAIC,EAEJ,GAAI,CACH,GAAID,EAAU,WAAW,GAAG,GAAKA,EAAU,WAAW,GAAG,EAKxDC,EAAY,IAAI,IAAID,EAAWb,EAAgB,CAAC,EAAE,SAAS,MACrD,CACN,MAAMe,EAAe,IAAI,IAAIF,CAAS,EAChCR,EAASU,EAAa,OAExBV,GAAUD,EAAoBC,CAAM,EAEvCS,EAAYC,EAAa,SAAS,EAIlCD,EAAYN,EAAgBO,EAAa,SAAS,EAAGf,EAAgB,CAAC,CAExE,CAEA,OAAKc,EAAU,SAAS,GAAG,IAC1BA,EAAY,GAAGA,CAAS,KAGlB,GAAGA,CAAS,MACpB,MAAY,CAEZ,CACD,EAEA,eAAeF",
6
- "names": ["getLocationHref", "getMetaTagValue", "metaTagName", "metaTag", "validateThemeOrigin", "origin", "allowedOrigins", "allowedOrigin", "buildCorrectUrl", "oldUrl", "newOrigin", "oldUrlPath", "validateThemeRoot", "themeRoot", "resultUrl", "themeRootURL"]
4
+ "sourcesContent": ["import { getLocationHref } from \"./Location.js\";\n\nconst getMetaTagValue = (metaTagName: string) => {\n\tconst metaTag = document.querySelector(`META[name=\"${metaTagName}\"]`),\n\t\tmetaTagContent = metaTag && metaTag.getAttribute(\"content\");\n\n\treturn metaTagContent;\n};\n\nconst validateThemeOrigin = (origin: string, isSameOrigin: boolean = false) => {\n\tconst allowedOrigins = getMetaTagValue(\"sap-allowed-theme-origins\") ?? getMetaTagValue(\"sap-allowedThemeOrigins\"); // Prioritize the new meta tag name\n\n\t// If no allowed origins are specified, block.\n\tif (!allowedOrigins) {\n\t\treturn false;\n\t}\n\n\t// If it's same-origin (relative URL resolved to current page), allow it when there's any meta tag present\n\t// The presence of the meta tag indicates the user wants to use theme roots\n\tif (isSameOrigin) {\n\t\treturn true;\n\t}\n\n\treturn allowedOrigins.split(\",\").some(allowedOrigin => {\n\t\treturn allowedOrigin === \"*\" || origin === allowedOrigin.trim();\n\t});\n};\n\nconst validateThemeRoot = (themeRoot: string) => {\n\tlet resultUrl;\n\tlet isSameOrigin = false;\n\n\ttry {\n\t\tif (themeRoot.startsWith(\".\") || themeRoot.startsWith(\"/\")) {\n\t\t\t// Handle relative url\n\t\t\t// new URL(\"/newExmPath\", \"http://example.com/exmPath\") => http://example.com/newExmPath\n\t\t\t// new URL(\"./newExmPath\", \"http://example.com/exmPath\") => http://example.com/exmPath/newExmPath\n\t\t\t// new URL(\"../newExmPath\", \"http://example.com/exmPath\") => http://example.com/newExmPath\n\t\t\tresultUrl = new URL(themeRoot, getLocationHref()).toString();\n\t\t\tisSameOrigin = true;\n\t\t} else {\n\t\t\tconst themeRootURL = new URL(themeRoot);\n\t\t\tconst origin = themeRootURL.origin;\n\t\t\tconst currentOrigin = new URL(getLocationHref()).origin;\n\n\t\t\t// Check if the absolute URL is same-origin\n\t\t\tisSameOrigin = origin === currentOrigin;\n\n\t\t\tif (origin && validateThemeOrigin(origin, isSameOrigin)) {\n\t\t\t\t// If origin is allowed, use it\n\t\t\t\tresultUrl = themeRootURL.toString();\n\t\t\t} else {\n\t\t\t\t// If origin is not allowed, return undefined to indicate validation failed\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\tif (!resultUrl.endsWith(\"/\")) {\n\t\t\tresultUrl = `${resultUrl}/`;\n\t\t}\n\n\t\treturn `${resultUrl}UI5/`;\n\t} catch (e) {\n\t\t// Catch if URL is not correct\n\t\treturn undefined;\n\t}\n};\n\nexport default validateThemeRoot;\n"],
5
+ "mappings": "aAAA,OAAS,mBAAAA,MAAuB,gBAEhC,MAAMC,EAAmBC,GAAwB,CAChD,MAAMC,EAAU,SAAS,cAAc,cAAcD,CAAW,IAAI,EAGpE,OAFkBC,GAAWA,EAAQ,aAAa,SAAS,CAG5D,EAEMC,EAAsB,CAACC,EAAgBC,EAAwB,KAAU,CAC9E,MAAMC,EAAiBN,EAAgB,2BAA2B,GAAKA,EAAgB,yBAAyB,EAGhH,OAAKM,EAMDD,EACI,GAGDC,EAAe,MAAM,GAAG,EAAE,KAAKC,GAC9BA,IAAkB,KAAOH,IAAWG,EAAc,KAAK,CAC9D,EAXO,EAYT,EAEMC,EAAqBC,GAAsB,CAChD,IAAIC,EACAL,EAAe,GAEnB,GAAI,CACH,GAAII,EAAU,WAAW,GAAG,GAAKA,EAAU,WAAW,GAAG,EAKxDC,EAAY,IAAI,IAAID,EAAWV,EAAgB,CAAC,EAAE,SAAS,EAC3DM,EAAe,OACT,CACN,MAAMM,EAAe,IAAI,IAAIF,CAAS,EAChCL,EAASO,EAAa,OACtBC,EAAgB,IAAI,IAAIb,EAAgB,CAAC,EAAE,OAKjD,GAFAM,EAAeD,IAAWQ,EAEtBR,GAAUD,EAAoBC,EAAQC,CAAY,EAErDK,EAAYC,EAAa,SAAS,MAGlC,OAEF,CAEA,OAAKD,EAAU,SAAS,GAAG,IAC1BA,EAAY,GAAGA,CAAS,KAGlB,GAAGA,CAAS,MACpB,MAAY,CAEX,MACD,CACD,EAEA,eAAeF",
6
+ "names": ["getLocationHref", "getMetaTagValue", "metaTagName", "metaTag", "validateThemeOrigin", "origin", "isSameOrigin", "allowedOrigins", "allowedOrigin", "validateThemeRoot", "themeRoot", "resultUrl", "themeRootURL", "currentOrigin"]
7
7
  }
@@ -3,22 +3,24 @@ const getMetaTagValue = (metaTagName) => {
3
3
  const metaTag = document.querySelector(`META[name="${metaTagName}"]`), metaTagContent = metaTag && metaTag.getAttribute("content");
4
4
  return metaTagContent;
5
5
  };
6
- const validateThemeOrigin = (origin) => {
6
+ const validateThemeOrigin = (origin, isSameOrigin = false) => {
7
7
  const allowedOrigins = getMetaTagValue("sap-allowed-theme-origins") ?? getMetaTagValue("sap-allowedThemeOrigins"); // Prioritize the new meta tag name
8
8
  // If no allowed origins are specified, block.
9
9
  if (!allowedOrigins) {
10
10
  return false;
11
11
  }
12
+ // If it's same-origin (relative URL resolved to current page), allow it when there's any meta tag present
13
+ // The presence of the meta tag indicates the user wants to use theme roots
14
+ if (isSameOrigin) {
15
+ return true;
16
+ }
12
17
  return allowedOrigins.split(",").some(allowedOrigin => {
13
18
  return allowedOrigin === "*" || origin === allowedOrigin.trim();
14
19
  });
15
20
  };
16
- const buildCorrectUrl = (oldUrl, newOrigin) => {
17
- const oldUrlPath = new URL(oldUrl).pathname;
18
- return new URL(oldUrlPath, newOrigin).toString();
19
- };
20
21
  const validateThemeRoot = (themeRoot) => {
21
22
  let resultUrl;
23
+ let isSameOrigin = false;
22
24
  try {
23
25
  if (themeRoot.startsWith(".") || themeRoot.startsWith("/")) {
24
26
  // Handle relative url
@@ -26,18 +28,21 @@ const validateThemeRoot = (themeRoot) => {
26
28
  // new URL("./newExmPath", "http://example.com/exmPath") => http://example.com/exmPath/newExmPath
27
29
  // new URL("../newExmPath", "http://example.com/exmPath") => http://example.com/newExmPath
28
30
  resultUrl = new URL(themeRoot, getLocationHref()).toString();
31
+ isSameOrigin = true;
29
32
  }
30
33
  else {
31
34
  const themeRootURL = new URL(themeRoot);
32
35
  const origin = themeRootURL.origin;
33
- if (origin && validateThemeOrigin(origin)) {
36
+ const currentOrigin = new URL(getLocationHref()).origin;
37
+ // Check if the absolute URL is same-origin
38
+ isSameOrigin = origin === currentOrigin;
39
+ if (origin && validateThemeOrigin(origin, isSameOrigin)) {
34
40
  // If origin is allowed, use it
35
41
  resultUrl = themeRootURL.toString();
36
42
  }
37
43
  else {
38
- // If origin is not allow and the URL is not relative, we have to replace the origin
39
- // with current location
40
- resultUrl = buildCorrectUrl(themeRootURL.toString(), getLocationHref());
44
+ // If origin is not allowed, return undefined to indicate validation failed
45
+ return undefined;
41
46
  }
42
47
  }
43
48
  if (!resultUrl.endsWith("/")) {
@@ -47,6 +52,7 @@ const validateThemeRoot = (themeRoot) => {
47
52
  }
48
53
  catch (e) {
49
54
  // Catch if URL is not correct
55
+ return undefined;
50
56
  }
51
57
  };
52
58
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,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5D,sBAAsB;YACtB,wFAAwF;YACxF,iGAAiG;YACjG,0FAA0F;YAC1F,SAAS,GAAG,IAAI,GAAG,CAAC,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC9D,CAAC;aAAM,CAAC;YACP,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;YACxC,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;YAEnC,IAAI,MAAM,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC3C,+BAA+B;gBAC/B,SAAS,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;YACrC,CAAC;iBAAM,CAAC;gBACP,oFAAoF;gBACpF,wBAAwB;gBACxB,SAAS,GAAG,eAAe,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,eAAe,EAAE,CAAC,CAAC;YACzE,CAAC;QACF,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,SAAS,GAAG,GAAG,SAAS,GAAG,CAAC;QAC7B,CAAC;QAED,OAAO,GAAG,SAAS,MAAM,CAAC;IAC3B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACZ,8BAA8B;IAC/B,CAAC;AACF,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { getLocationHref } from \"./Location.js\";\n\nconst getMetaTagValue = (metaTagName: string) => {\n\tconst metaTag = document.querySelector(`META[name=\"${metaTagName}\"]`),\n\t\tmetaTagContent = metaTag && metaTag.getAttribute(\"content\");\n\n\treturn metaTagContent;\n};\n\nconst validateThemeOrigin = (origin: string) => {\n\tconst allowedOrigins = getMetaTagValue(\"sap-allowed-theme-origins\") ?? getMetaTagValue(\"sap-allowedThemeOrigins\"); // Prioritize the new meta tag name\n\n\t// If no allowed origins are specified, block.\n\tif (!allowedOrigins) {\n\t\treturn false;\n\t}\n\n\treturn allowedOrigins.split(\",\").some(allowedOrigin => {\n\t\treturn allowedOrigin === \"*\" || origin === allowedOrigin.trim();\n\t});\n};\n\nconst buildCorrectUrl = (oldUrl: string, newOrigin: string) => {\n\tconst oldUrlPath = new URL(oldUrl).pathname;\n\n\treturn new URL(oldUrlPath, newOrigin).toString();\n};\n\nconst validateThemeRoot = (themeRoot: string) => {\n\tlet resultUrl;\n\n\ttry {\n\t\tif (themeRoot.startsWith(\".\") || themeRoot.startsWith(\"/\")) {\n\t\t\t// Handle relative url\n\t\t\t// new URL(\"/newExmPath\", \"http://example.com/exmPath\") => http://example.com/newExmPath\n\t\t\t// new URL(\"./newExmPath\", \"http://example.com/exmPath\") => http://example.com/exmPath/newExmPath\n\t\t\t// new URL(\"../newExmPath\", \"http://example.com/exmPath\") => http://example.com/newExmPath\n\t\t\tresultUrl = new URL(themeRoot, getLocationHref()).toString();\n\t\t} else {\n\t\t\tconst themeRootURL = new URL(themeRoot);\n\t\t\tconst origin = themeRootURL.origin;\n\n\t\t\tif (origin && validateThemeOrigin(origin)) {\n\t\t\t\t// If origin is allowed, use it\n\t\t\t\tresultUrl = themeRootURL.toString();\n\t\t\t} else {\n\t\t\t\t// If origin is not allow and the URL is not relative, we have to replace the origin\n\t\t\t\t// with current location\n\t\t\t\tresultUrl = buildCorrectUrl(themeRootURL.toString(), getLocationHref());\n\t\t\t}\n\t\t}\n\n\t\tif (!resultUrl.endsWith(\"/\")) {\n\t\t\tresultUrl = `${resultUrl}/`;\n\t\t}\n\n\t\treturn `${resultUrl}UI5/`;\n\t} catch (e) {\n\t\t// Catch if URL is not correct\n\t}\n};\n\nexport default validateThemeRoot;\n"]}
1
+ {"version":3,"file":"validateThemeRoot.js","sourceRoot":"","sources":["../src/validateThemeRoot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,eAAe,GAAG,CAAC,WAAmB,EAAE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G,CAAC,SAAS,CAAC,CAAC;YACxC,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;YACnC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC;YAExD,2CAA2C;YAC3C,YAAY,GAAG,MAAM,KAAK,aAAa,CAAC;YAExC,IAAI,MAAM,IAAI,mBAAmB,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC;gBACzD,+BAA+B;gBAC/B,SAAS,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;YACrC,CAAC;iBAAM,CAAC;gBACP,2EAA2E;gBAC3E,OAAO,SAAS,CAAC;YAClB,CAAC;QACF,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,SAAS,GAAG,GAAG,SAAS,GAAG,CAAC;QAC7B,CAAC;QAED,OAAO,GAAG,SAAS,MAAM,CAAC;IAC3B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACZ,8BAA8B;QAC9B,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { getLocationHref } from \"./Location.js\";\n\nconst getMetaTagValue = (metaTagName: string) => {\n\tconst metaTag = document.querySelector(`META[name=\"${metaTagName}\"]`),\n\t\tmetaTagContent = metaTag && metaTag.getAttribute(\"content\");\n\n\treturn metaTagContent;\n};\n\nconst validateThemeOrigin = (origin: string, isSameOrigin: boolean = false) => {\n\tconst allowedOrigins = getMetaTagValue(\"sap-allowed-theme-origins\") ?? getMetaTagValue(\"sap-allowedThemeOrigins\"); // Prioritize the new meta tag name\n\n\t// If no allowed origins are specified, block.\n\tif (!allowedOrigins) {\n\t\treturn false;\n\t}\n\n\t// If it's same-origin (relative URL resolved to current page), allow it when there's any meta tag present\n\t// The presence of the meta tag indicates the user wants to use theme roots\n\tif (isSameOrigin) {\n\t\treturn true;\n\t}\n\n\treturn allowedOrigins.split(\",\").some(allowedOrigin => {\n\t\treturn allowedOrigin === \"*\" || origin === allowedOrigin.trim();\n\t});\n};\n\nconst validateThemeRoot = (themeRoot: string) => {\n\tlet resultUrl;\n\tlet isSameOrigin = false;\n\n\ttry {\n\t\tif (themeRoot.startsWith(\".\") || themeRoot.startsWith(\"/\")) {\n\t\t\t// Handle relative url\n\t\t\t// new URL(\"/newExmPath\", \"http://example.com/exmPath\") => http://example.com/newExmPath\n\t\t\t// new URL(\"./newExmPath\", \"http://example.com/exmPath\") => http://example.com/exmPath/newExmPath\n\t\t\t// new URL(\"../newExmPath\", \"http://example.com/exmPath\") => http://example.com/newExmPath\n\t\t\tresultUrl = new URL(themeRoot, getLocationHref()).toString();\n\t\t\tisSameOrigin = true;\n\t\t} else {\n\t\t\tconst themeRootURL = new URL(themeRoot);\n\t\t\tconst origin = themeRootURL.origin;\n\t\t\tconst currentOrigin = new URL(getLocationHref()).origin;\n\n\t\t\t// Check if the absolute URL is same-origin\n\t\t\tisSameOrigin = origin === currentOrigin;\n\n\t\t\tif (origin && validateThemeOrigin(origin, isSameOrigin)) {\n\t\t\t\t// If origin is allowed, use it\n\t\t\t\tresultUrl = themeRootURL.toString();\n\t\t\t} else {\n\t\t\t\t// If origin is not allowed, return undefined to indicate validation failed\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\tif (!resultUrl.endsWith(\"/\")) {\n\t\t\tresultUrl = `${resultUrl}/`;\n\t\t}\n\n\t\treturn `${resultUrl}UI5/`;\n\t} catch (e) {\n\t\t// Catch if URL is not correct\n\t\treturn undefined;\n\t}\n};\n\nexport default validateThemeRoot;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-base",
3
- "version": "2.21.0-rc.4",
3
+ "version": "2.22.0-rc.0",
4
4
  "description": "UI5 Web Components: webcomponents.base",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -66,7 +66,7 @@
66
66
  "@openui5/sap.ui.core": "1.146.0",
67
67
  "@sap-theming/theming-base-content": "11.34.1",
68
68
  "@ui5/cypress-internal": "0.1.0",
69
- "@ui5/webcomponents-tools": "2.21.0-rc.4",
69
+ "@ui5/webcomponents-tools": "2.22.0-rc.0",
70
70
  "clean-css": "^5.2.2",
71
71
  "cypress": "15.9.0",
72
72
  "mocha": "^11.7.2",
@@ -85,5 +85,5 @@
85
85
  }
86
86
  },
87
87
  "customElements": "dist/custom-elements.json",
88
- "gitHead": "3afe33f1a00c7174d9da5e232b0744f970a4caea"
88
+ "gitHead": "8b8cd84a2bf81d5b7affa6233f990e85c455b931"
89
89
  }