@ui5/webcomponents-base 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/bundle.esm.js +1 -0
  2. package/dist/InitialConfiguration.js +23 -3
  3. package/dist/StaticAreaItem.js +7 -1
  4. package/dist/api.json +1 -0
  5. package/dist/asset-registries/Illustrations.js +30 -1
  6. package/dist/assets/bundle.esm.2e764f3c.js +55 -0
  7. package/dist/config/ThemeRoots.js +39 -0
  8. package/dist/features/F6Navigation.js +22 -25
  9. package/dist/features/OpenUI5Support.js +1 -0
  10. package/dist/generated/VersionInfo.js +3 -3
  11. package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.js +11 -0
  12. package/dist/theming/applyTheme.js +7 -2
  13. package/dist/types/CSSColor.js +11 -0
  14. package/dist/types/CSSSize.js +11 -0
  15. package/dist/types/CalendarType.js +37 -0
  16. package/dist/types/DOMReference.js +4 -0
  17. package/dist/types/DataType.js +6 -0
  18. package/dist/types/Float.js +11 -0
  19. package/dist/types/Integer.js +11 -0
  20. package/dist/types/InvisibleMessageMode.js +17 -1
  21. package/dist/types/PopupState.js +20 -0
  22. package/dist/types/ValueState.js +43 -1
  23. package/dist/util/AriaLabelHelper.js +17 -0
  24. package/dist/util/createLinkInHead.js +6 -1
  25. package/dist/validateThemeRoot.js +58 -0
  26. package/package-scripts.js +3 -1
  27. package/package.json +3 -3
  28. package/src/InitialConfiguration.js +23 -3
  29. package/src/StaticAreaItem.js +7 -1
  30. package/src/asset-registries/Illustrations.js +30 -1
  31. package/src/config/ThemeRoots.js +39 -0
  32. package/src/features/F6Navigation.js +22 -25
  33. package/src/features/OpenUI5Support.js +1 -0
  34. package/src/theming/applyTheme.js +7 -2
  35. package/src/types/CSSColor.js +11 -0
  36. package/src/types/CSSSize.js +11 -0
  37. package/src/types/CalendarType.js +37 -0
  38. package/src/types/DOMReference.js +4 -0
  39. package/src/types/DataType.js +6 -0
  40. package/src/types/Float.js +11 -0
  41. package/src/types/Integer.js +11 -0
  42. package/src/types/InvisibleMessageMode.js +17 -1
  43. package/src/types/PopupState.js +20 -0
  44. package/src/types/ValueState.js +43 -1
  45. package/src/util/AriaLabelHelper.js +17 -0
  46. package/src/util/createLinkInHead.js +6 -1
  47. package/src/validateThemeRoot.js +58 -0
  48. package/dist/assets/bundle.esm.62217b93.js +0 -43
  49. package/hash.txt +0 -1
@@ -54,24 +54,20 @@ class F6Navigation {
54
54
  const nextIndex = this.groups.indexOf(this.selectedGroup);
55
55
  let nextElement = null;
56
56
 
57
- if (nextIndex > -1) {
58
- if (nextIndex - 1 < 0) {
59
- nextElement = this.groups[this.groups.length - 1];
60
- } else {
61
- // Handle the situation where the first focusable element of two neighbor groups is the same
62
- // For example:
63
- // <ui5-flexible-column-layout>
64
- // <ui5-list>
65
- // <ui5-li>List Item</ui5-li>
66
- // </ui5-list>
67
- // </ui5-flexible-column-layout>
68
- // Here for both FCL & List the firstFoccusableElement is the same (the ui5-li)
69
-
70
- const firstFocusable = await getFirstFocusableElement(this.groups[nextIndex - 1], true);
71
- const shouldSkipParent = firstFocusable === await getFirstFocusableElement(this.groups[nextIndex], true);
72
-
73
- nextElement = this.groups[shouldSkipParent ? nextIndex - 2 : nextIndex - 1];
74
- }
57
+ if (nextIndex > 0) {
58
+ // Handle the situation where the first focusable element of two neighbor groups is the same
59
+ // For example:
60
+ // <ui5-flexible-column-layout>
61
+ // <ui5-list>
62
+ // <ui5-li>List Item</ui5-li>
63
+ // </ui5-list>
64
+ // </ui5-flexible-column-layout>
65
+ // Here for both FCL & List the firstFoccusableElement is the same (the ui5-li)
66
+
67
+ const firstFocusable = await getFirstFocusableElement(this.groups[nextIndex - 1], true);
68
+ const shouldSkipParent = firstFocusable === await getFirstFocusableElement(this.groups[nextIndex], true);
69
+
70
+ nextElement = this.groups[shouldSkipParent ? nextIndex - 2 : nextIndex - 1];
75
71
  } else {
76
72
  nextElement = this.groups[this.groups.length - 1];
77
73
  }
@@ -86,26 +82,27 @@ class F6Navigation {
86
82
  }
87
83
 
88
84
  updateGroups() {
89
- this.setSelectedGroup(document.activeElement);
85
+ this.setSelectedGroup();
90
86
  this.groups = getFastNavigationGroups(document.body);
91
87
  }
92
88
 
93
- setSelectedGroup(element) {
89
+ setSelectedGroup(element = document) {
90
+ const htmlElement = document.querySelector("html");
94
91
  element = this.deepActive(element);
95
92
 
96
- while (element && element.getAttribute("data-sap-ui-fastnavgroup") !== "true" && element !== document.querySelector("html")) {
93
+ while (element && element.getAttribute("data-sap-ui-fastnavgroup") !== "true" && element !== htmlElement) {
97
94
  element = element.parentElement ? element.parentNode : element.parentNode.host;
98
95
  }
99
96
 
100
97
  this.selectedGroup = element;
101
98
  }
102
99
 
103
- deepActive(element) {
104
- if (element.shadowRoot) {
105
- return this.deepActive(element.shadowRoot);
100
+ deepActive(root) {
101
+ if (root.activeElement && root.activeElement.shadowRoot) {
102
+ return this.deepActive(root.activeElement.shadowRoot);
106
103
  }
107
104
 
108
- return element.activeElement;
105
+ return root.activeElement;
109
106
  }
110
107
 
111
108
  destroy() {
@@ -41,6 +41,7 @@ const getConfigurationSettingsObject = () => {
41
41
  animationMode: config.getAnimationMode(),
42
42
  language: config.getLanguage(),
43
43
  theme: config.getTheme(),
44
+ themeRoot: config.getThemeRoot(),
44
45
  rtl: config.getRTL(),
45
46
  calendarType: config.getCalendarType(),
46
47
  formatSettings: {
@@ -3,6 +3,7 @@ import { removeStyle, createOrUpdateStyle } from "../ManagedStyles.js";
3
3
  import getThemeDesignerTheme from "./getThemeDesignerTheme.js";
4
4
  import { fireThemeLoaded } from "./ThemeLoaded.js";
5
5
  import { getFeature } from "../FeaturesRegistry.js";
6
+ import { attachCustomThemeStylesToHead, getThemeRoot } from "../config/ThemeRoots.js";
6
7
 
7
8
  const BASE_THEME_PACKAGE = "@ui5/webcomponents-theming";
8
9
 
@@ -40,7 +41,7 @@ const loadComponentPackages = async theme => {
40
41
  });
41
42
  };
42
43
 
43
- const detectExternalTheme = () => {
44
+ const detectExternalTheme = async theme => {
44
45
  // If theme designer theme is detected, use this
45
46
  const extTheme = getThemeDesignerTheme();
46
47
  if (extTheme) {
@@ -56,11 +57,15 @@ const detectExternalTheme = () => {
56
57
  themeName: OpenUI5Support.getConfigurationSettingsObject().theme, // just themeName, baseThemeName is only relevant for custom themes
57
58
  };
58
59
  }
60
+ } else if (getThemeRoot()) {
61
+ await attachCustomThemeStylesToHead(theme);
62
+
63
+ return getThemeDesignerTheme();
59
64
  }
60
65
  };
61
66
 
62
67
  const applyTheme = async theme => {
63
- const extTheme = detectExternalTheme();
68
+ const extTheme = await detectExternalTheme(theme);
64
69
 
65
70
  // Only load theme_base properties if there is no externally loaded theme, or there is, but it is not being loaded
66
71
  if (!extTheme || theme !== extTheme.themeName) {
@@ -1,5 +1,16 @@
1
1
  import DataType from "./DataType.js";
2
2
 
3
+ /**
4
+ * @class
5
+ * CSSColor data type.
6
+ *
7
+ * @extends sap.ui.webcomponents.base.types.DataType
8
+ * @constructor
9
+ * @author SAP SE
10
+ * @alias sap.ui.webcomponents.base.types.CSSColor
11
+ * @public
12
+ * @enum {string}
13
+ */
3
14
  class CSSColor extends DataType {
4
15
  static isValid(value) {
5
16
  return /^(#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})|rgb\(\s*((1?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))|([0-9]?[0-9](\.[0-9]+)?|100(\.0+)?)%)\s*(,\s*((1?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))|([0-9]?[0-9](\.[0-9]+)?|100(\.0+)?)%)\s*){2}\)|rgba\((\s*((1?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))|([0-9]?[0-9](\.[0-9]+)?|100(\.0+)?)%)\s*,){3}\s*(0(\.[0-9]+)?|1(\.0+)?)\s*\)|hsl\(\s*([0-2]?[0-9]?[0-9]|3([0-5][0-9]|60))\s*(,\s*(([0-9]?[0-9](\.[0-9]+)?|100(\.0+)?)%)\s*){2}\)|hsla\(\s*([0-2]?[0-9]?[0-9]|3([0-5][0-9]|60))\s*,(\s*(([0-9]?[0-9](\.[0-9]+)?|100(\.0+)?)%)\s*,){2}\s*(0(\.[0-9]+)?|1(\.0+)?)\s*\)|aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgrey|darkgreen|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|grey|green|greenyellow|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgrey|lightgreen|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silverskyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen|transparent|inherit|)$/.test(value ); // eslint-disable-line
@@ -1,5 +1,16 @@
1
1
  import DataType from "./DataType.js";
2
2
 
3
+ /**
4
+ * @class
5
+ * CSSSize data type.
6
+ *
7
+ * @extends sap.ui.webcomponents.base.types.DataType
8
+ * @constructor
9
+ * @author SAP SE
10
+ * @alias sap.ui.webcomponents.base.types.CSSSize
11
+ * @public
12
+ * @enum {string}
13
+ */
3
14
  class CSSSize extends DataType {
4
15
  static isValid(value) {
5
16
  return /^(auto|inherit|[-+]?(0*|([0-9]+|[0-9]*\.[0-9]+)([rR][eE][mM]|[eE][mM]|[eE][xX]|[pP][xX]|[cC][mM]|[mM][mM]|[iI][nN]|[pP][tT]|[pP][cC]|%))|calc\(\s*(\(\s*)*[-+]?(([0-9]+|[0-9]*\.[0-9]+)([rR][eE][mM]|[eE][mM]|[eE][xX]|[pP][xX]|[cC][mM]|[mM][mM]|[iI][nN]|[pP][tT]|[pP][cC]|%)?)(\s*(\)\s*)*(\s[-+]\s|[*\/])\s*(\(\s*)*([-+]?(([0-9]+|[0-9]*\.[0-9]+)([rR][eE][mM]|[eE][mM]|[eE][xX]|[pP][xX]|[cC][mM]|[mM][mM]|[iI][nN]|[pP][tT]|[pP][cC]|%)?)))*\s*(\)\s*)*\))$/.test(value); // eslint-disable-line
@@ -2,15 +2,52 @@ import DataType from "./DataType.js";
2
2
 
3
3
  /**
4
4
  * Different calendar types.
5
+ * @lends sap.ui.webcomponents.base.types.CalendarType.prototype
6
+ * @public
5
7
  */
6
8
  const CalendarTypes = {
9
+ /**
10
+ * @public
11
+ * @type {Gregorian}
12
+ */
7
13
  Gregorian: "Gregorian",
14
+
15
+ /**
16
+ * @public
17
+ * @type {Islamic}
18
+ */
8
19
  Islamic: "Islamic",
20
+
21
+ /**
22
+ * @public
23
+ * @type {Japanese}
24
+ */
9
25
  Japanese: "Japanese",
26
+
27
+ /**
28
+ * @public
29
+ * @type {Buddhist}
30
+ */
10
31
  Buddhist: "Buddhist",
32
+
33
+ /**
34
+ * @public
35
+ * @type {Persian}
36
+ */
11
37
  Persian: "Persian",
12
38
  };
13
39
 
40
+ /**
41
+ * @class
42
+ * Different calendar types.
43
+ *
44
+ * @extends sap.ui.webcomponents.base.types.DataType
45
+ * @constructor
46
+ * @author SAP SE
47
+ * @alias sap.ui.webcomponents.base.types.CalendarType
48
+ * @public
49
+ * @enum {string}
50
+ */
14
51
  class CalendarType extends DataType {
15
52
  static isValid(value) {
16
53
  return !!CalendarTypes[value];
@@ -5,6 +5,10 @@ import DataType from "./DataType.js";
5
5
  * DOM Element reference or ID.
6
6
  * <b>Note:</b> If an ID is passed, it is expected to be part of the same <code>document</code> element as the consuming component.
7
7
  *
8
+ * @constructor
9
+ * @extends sap.ui.webcomponents.base.types.DataType
10
+ * @author SAP SE
11
+ * @alias sap.ui.webcomponents.base.types.DOMReference
8
12
  * @public
9
13
  */
10
14
  class DOMReference extends DataType {
@@ -8,6 +8,12 @@
8
8
  * @public
9
9
  */
10
10
  class DataType {
11
+ /**
12
+ * Checks if the value is valid for its data type.
13
+ * @public
14
+ * @abstract
15
+ * @returns {Boolean}
16
+ */
11
17
  static isValid(value) {
12
18
  }
13
19
 
@@ -1,5 +1,16 @@
1
1
  import DataType from "./DataType.js";
2
2
 
3
+ /**
4
+ * @class
5
+ * Float data type.
6
+ *
7
+ * @constructor
8
+ * @extends sap.ui.webcomponents.base.types.DataType
9
+ * @author SAP SE
10
+ * @alias sap.ui.webcomponents.base.types.Float
11
+ * @public
12
+ * @enum {number}
13
+ */
3
14
  class Float extends DataType {
4
15
  static isValid(value) {
5
16
  // Assuming that integers are floats as well!
@@ -1,5 +1,16 @@
1
1
  import DataType from "./DataType.js";
2
2
 
3
+ /**
4
+ * @class
5
+ * Integer data type.
6
+ *
7
+ * @constructor
8
+ * @extends sap.ui.webcomponents.base.types.DataType
9
+ * @author SAP SE
10
+ * @alias sap.ui.webcomponents.base.types.Integer
11
+ * @public
12
+ * @enum {number}
13
+ */
3
14
  class Integer extends DataType {
4
15
  static isValid(value) {
5
16
  return Number.isInteger(value);
@@ -2,23 +2,39 @@ import DataType from "./DataType.js";
2
2
 
3
3
  /**
4
4
  * Enumeration for different mode behaviors of the <code>InvisibleMessage</code>.
5
- * @private
5
+ * @lends sap.ui.webcomponents.base.types.InvisibleMessageMode.prototype
6
+ * @public
6
7
  */
7
8
  const InvisibleMessageModes = {
8
9
 
9
10
  /**
10
11
  * Indicates that updates to the region should be presented at the next graceful opportunity,
11
12
  * such as at the end of reading the current sentence, or when the user pauses typing.
13
+ * @public
14
+ * @type {Polite}
12
15
  */
13
16
  Polite: "Polite",
14
17
 
15
18
  /**
16
19
  * Indicates that updates to the region have the highest priority and should be presented to the user immediately.
20
+ * @public
21
+ * @type {Assertive}
17
22
  */
18
23
  Assertive: "Assertive",
19
24
 
20
25
  };
21
26
 
27
+ /**
28
+ * @class
29
+ * Different types of InvisibleMessageMode.
30
+ *
31
+ * @extends sap.ui.webcomponents.base.types.DataType
32
+ * @constructor
33
+ * @author SAP SE
34
+ * @alias sap.ui.webcomponents.base.types.InvisibleMessageMode
35
+ * @public
36
+ * @enum {string}
37
+ */
22
38
  class InvisibleMessageMode extends DataType {
23
39
  static isValid(value) {
24
40
  return !!InvisibleMessageModes[value];
@@ -1,31 +1,51 @@
1
1
  import DataType from "./DataType.js";
2
2
 
3
+ /**
4
+ * Different types of PopupStates.
5
+ * @lends sap.ui.webcomponents.base.types.PopupState.prototype
6
+ * @public
7
+ */
3
8
  const PopupStates = {
4
9
  /**
5
10
  * Open and currently not changing states.
6
11
  * @public
12
+ * @type {OPEN}
7
13
  */
8
14
  OPEN: "OPEN",
9
15
 
10
16
  /**
11
17
  * Closed and currently not changing states.
12
18
  * @public
19
+ * @type {CLOSED}
13
20
  */
14
21
  CLOSED: "CLOSED",
15
22
 
16
23
  /**
17
24
  * Already left the CLOSED state, is not OPEN yet, but in the process of getting OPEN.
18
25
  * @public
26
+ * @type {OPENING}
19
27
  */
20
28
  OPENING: "OPENING",
21
29
 
22
30
  /**
23
31
  * Still open, but in the process of going to the CLOSED state.
24
32
  * @public
33
+ * @type {CLOSING}
25
34
  */
26
35
  CLOSING: "CLOSING",
27
36
  };
28
37
 
38
+ /**
39
+ * @class
40
+ * Different types of PopupState.
41
+ *
42
+ * @extends sap.ui.webcomponents.base.types.DataType
43
+ * @constructor
44
+ * @author SAP SE
45
+ * @alias sap.ui.webcomponents.base.types.PopupState
46
+ * @public
47
+ * @enum {string}
48
+ */
29
49
  class PopupState extends DataType {
30
50
  static isValid(value) {
31
51
  return !!PopupStates[value];
@@ -1,16 +1,58 @@
1
1
  import DataType from "./DataType.js";
2
2
 
3
3
  /**
4
- * Different states.
4
+ * Different types of ValueStates.
5
+ * @lends sap.ui.webcomponents.base.types.ValueState.prototype
6
+ * @public
5
7
  */
6
8
  const ValueStates = {
9
+ /**
10
+ *
11
+ * @public
12
+ * @type {None}
13
+ */
7
14
  None: "None",
15
+
16
+ /**
17
+ *
18
+ * @public
19
+ * @type {Success}
20
+ */
8
21
  Success: "Success",
22
+
23
+ /**
24
+ *
25
+ * @public
26
+ * @type {Warning}
27
+ */
9
28
  Warning: "Warning",
29
+
30
+ /**
31
+ *
32
+ * @public
33
+ * @type {Error}
34
+ */
10
35
  Error: "Error",
36
+
37
+ /**
38
+ *
39
+ * @public
40
+ * @type {Information}
41
+ */
11
42
  Information: "Information",
12
43
  };
13
44
 
45
+ /**
46
+ * @class
47
+ * Different types of ValueState.
48
+ *
49
+ * @extends sap.ui.webcomponents.base.types.DataType
50
+ * @constructor
51
+ * @author SAP SE
52
+ * @alias sap.ui.webcomponents.base.types.ValueState
53
+ * @public
54
+ * @enum {string}
55
+ */
14
56
  class ValueState extends DataType {
15
57
  static isValid(value) {
16
58
  return !!ValueStates[value];
@@ -33,7 +33,24 @@ const getAriaLabelledByTexts = (el, ownerDocument, readyIds = "") => {
33
33
  return result;
34
34
  };
35
35
 
36
+ /**
37
+ * @param {HTMLElement} el Defines the HTMLElement, for which you need to get all related "label for" texts
38
+ */
39
+ const getAssociatedLabelForTexts = el => {
40
+ const results = [];
41
+ const labels = el.getRootNode().querySelectorAll(`[ui5-label][for="${el.id}"],label[for="${el.id}"]`);
42
+
43
+ labels.forEach(label => results.push(label.textContent));
44
+
45
+ if (results.length) {
46
+ return results.join(" ");
47
+ }
48
+
49
+ return undefined;
50
+ };
51
+
36
52
  export {
37
53
  getEffectiveAriaLabelText,
38
54
  getAriaLabelledByTexts,
55
+ getAssociatedLabelForTexts,
39
56
  };
@@ -12,8 +12,13 @@ const createLinkInHead = (href, attributes = {}) => {
12
12
  Object.entries(attributes).forEach(pair => link.setAttribute(...pair));
13
13
 
14
14
  link.href = href;
15
+
15
16
  document.head.appendChild(link);
16
- return link;
17
+
18
+ return new Promise(resolve => {
19
+ link.addEventListener("load", resolve);
20
+ link.addEventListener("error", resolve);
21
+ });
17
22
  };
18
23
 
19
24
  export default createLinkInHead;
@@ -0,0 +1,58 @@
1
+ const getMetaTagValue = metaTagName => {
2
+ const metaTag = document.querySelector(`META[name="${metaTagName}"]`),
3
+ metaTagContent = metaTag && metaTag.getAttribute("content");
4
+
5
+ return metaTagContent;
6
+ };
7
+
8
+ const validateThemeOrigin = origin => {
9
+ const allowedOrigins = getMetaTagValue("sap-allowedThemeOrigins");
10
+
11
+ return allowedOrigins && allowedOrigins.split(",").some(allowedOrigin => {
12
+ return allowedOrigin === "*" || origin === allowedOrigin.trim();
13
+ });
14
+ };
15
+
16
+ const buildCorrectUrl = (oldUrl, newOrigin) => {
17
+ const oldUrlPath = new URL(oldUrl).pathname;
18
+
19
+ return new URL(oldUrlPath, newOrigin).toString();
20
+ };
21
+
22
+ const validateThemeRoot = themeRoot => {
23
+ let themeRootURL,
24
+ resultUrl;
25
+
26
+ try {
27
+ themeRootURL = new URL(themeRoot);
28
+
29
+ const origin = themeRootURL.origin;
30
+
31
+ themeRootURL = themeRootURL.toString();
32
+
33
+ if (themeRootURL.startsWith(".") || themeRootURL.startsWith("/")) {
34
+ // Handle relative url
35
+ // new URL("/newExmPath", "http://example.com/exmPath") => http://example.com/newExmPath
36
+ // new URL("./newExmPath", "http://example.com/exmPath") => http://example.com/exmPath/newExmPath
37
+ // new URL("../newExmPath", "http://example.com/exmPath") => http://example.com/newExmPath
38
+ resultUrl = new URL(themeRootURL, window.location.href).toString();
39
+ } else if (origin && validateThemeOrigin(origin)) {
40
+ // If origin is allowed, use it
41
+ resultUrl = themeRootURL.toString();
42
+ } else {
43
+ // If origin is not allow and the URL is not relative, we have to replace the origin
44
+ // with current location
45
+ resultUrl = buildCorrectUrl(themeRootURL, window.location.href);
46
+ }
47
+
48
+ if (!resultUrl.endsWith("/")) {
49
+ resultUrl = `${resultUrl}/`;
50
+ }
51
+
52
+ return `${resultUrl}UI5/`;
53
+ } catch (e) {
54
+ // Catch if URL is not correct
55
+ }
56
+ };
57
+
58
+ export default validateThemeRoot;