@ui5/webcomponents-base 0.0.0-4180fe799 → 0.0.0-453158269

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 (92) hide show
  1. package/.eslintignore +1 -1
  2. package/CHANGELOG.md +211 -0
  3. package/dist/Boot.js +34 -18
  4. package/dist/CustomElementsRegistry.js +60 -4
  5. package/dist/CustomElementsScope.js +20 -98
  6. package/dist/CustomElementsScopeUtils.js +108 -0
  7. package/dist/Device.js +15 -1
  8. package/dist/FeaturesRegistry.js +4 -1
  9. package/dist/Keys.js +47 -0
  10. package/dist/Runtimes.js +107 -0
  11. package/dist/StaticAreaItem.js +4 -1
  12. package/dist/UI5Element.js +18 -3
  13. package/dist/UI5ElementMetadata.js +9 -1
  14. package/dist/asset-registries/Icons.js +3 -7
  15. package/dist/asset-registries/LocaleData.js +6 -1
  16. package/dist/asset-registries/Themes.js +6 -2
  17. package/dist/config/Icons.js +52 -0
  18. package/dist/config/Theme.js +11 -0
  19. package/dist/css/BusyIndicator.css +80 -0
  20. package/dist/css/FontFace.css +38 -8
  21. package/dist/features/F6Navigation.js +106 -0
  22. package/dist/features/OpenUI5Enablement.js +119 -0
  23. package/dist/generated/AssetParameters.js +1 -1
  24. package/dist/generated/VersionInfo.js +10 -0
  25. package/dist/generated/css/BusyIndicator.css.js +5 -0
  26. package/dist/generated/css/FontFace.css.js +1 -1
  27. package/dist/renderer/LitRenderer.js +29 -11
  28. package/dist/renderer/executeTemplate.js +19 -2
  29. package/dist/resources/bundle.esm.js +8 -13
  30. package/dist/resources/bundle.esm.js.map +1 -1
  31. package/dist/sap/base/security/encodeCSS.js +14 -0
  32. package/dist/sap/base/security/encodeXML.js +23 -0
  33. package/dist/sap/base/strings/toHex.js +8 -0
  34. package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +1 -1
  35. package/dist/test-resources/specs/Theming.spec.js +11 -0
  36. package/dist/theming/CustomStyle.js +23 -3
  37. package/dist/theming/applyTheme.js +8 -4
  38. package/dist/theming/getEffectiveLinksHrefs.js +7 -0
  39. package/dist/theming/getEffectiveStyle.js +9 -0
  40. package/dist/theming/getThemeDesignerTheme.js +24 -5
  41. package/dist/updateShadowRoot.js +1 -1
  42. package/dist/util/FocusableElements.js +8 -6
  43. package/dist/util/InvisibleMessage.js +11 -9
  44. package/dist/util/TabbableElements.js +4 -0
  45. package/dist/util/escapeRegex.js +10 -0
  46. package/dist/util/generateHighlightedMarkup.js +42 -0
  47. package/dist/util/getNormalizedTarget.js +16 -0
  48. package/dist/util/isNodeHidden.js +1 -1
  49. package/hash.txt +1 -1
  50. package/lib/generate-asset-parameters/index.js +8 -4
  51. package/lib/generate-styles/index.js +17 -9
  52. package/lib/generate-version-info/index.js +32 -0
  53. package/package-scripts.js +5 -12
  54. package/package.json +6 -6
  55. package/src/Boot.js +34 -18
  56. package/src/CustomElementsRegistry.js +60 -4
  57. package/src/CustomElementsScope.js +20 -98
  58. package/src/CustomElementsScopeUtils.js +108 -0
  59. package/src/Device.js +15 -1
  60. package/src/FeaturesRegistry.js +4 -1
  61. package/src/Keys.js +47 -0
  62. package/src/Runtimes.js +107 -0
  63. package/src/StaticAreaItem.js +4 -1
  64. package/src/UI5Element.js +18 -3
  65. package/src/UI5ElementMetadata.js +9 -1
  66. package/src/asset-registries/Icons.js +3 -7
  67. package/src/asset-registries/LocaleData.js +6 -1
  68. package/src/asset-registries/Themes.js +6 -2
  69. package/src/config/Icons.js +52 -0
  70. package/src/config/Theme.js +11 -0
  71. package/src/css/BusyIndicator.css +80 -0
  72. package/src/css/FontFace.css +38 -8
  73. package/src/features/F6Navigation.js +106 -0
  74. package/src/features/OpenUI5Enablement.js +119 -0
  75. package/src/renderer/LitRenderer.js +29 -11
  76. package/src/renderer/executeTemplate.js +19 -2
  77. package/src/theming/CustomStyle.js +23 -3
  78. package/src/theming/applyTheme.js +8 -4
  79. package/src/theming/getEffectiveLinksHrefs.js +7 -0
  80. package/src/theming/getEffectiveStyle.js +9 -0
  81. package/src/theming/getThemeDesignerTheme.js +24 -5
  82. package/src/updateShadowRoot.js +1 -1
  83. package/src/util/FocusableElements.js +8 -6
  84. package/src/util/InvisibleMessage.js +11 -9
  85. package/src/util/TabbableElements.js +4 -0
  86. package/src/util/escapeRegex.js +10 -0
  87. package/src/util/generateHighlightedMarkup.js +42 -0
  88. package/src/util/getNormalizedTarget.js +16 -0
  89. package/src/util/isNodeHidden.js +1 -1
  90. package/used-modules.txt +4 -1
  91. package/dist/util/encodeCSS.js +0 -24
  92. package/src/util/encodeCSS.js +0 -24
package/dist/Keys.js CHANGED
@@ -111,6 +111,8 @@ const isSpace = event => (event.key ? (event.key === "Spacebar" || event.key ===
111
111
 
112
112
  const isSpaceShift = event => (event.key ? (event.key === "Spacebar" || event.key === " ") : event.keyCode === KeyCodes.SPACE) && checkModifierKeys(event, false, false, true);
113
113
 
114
+ const isSpaceCtrl = event => (event.key ? (event.key === "Spacebar" || event.key === " ") : event.keyCode === KeyCodes.SPACE) && checkModifierKeys(event, true, false, false);
115
+
114
116
  const isLeft = event => (event.key ? (event.key === "ArrowLeft" || event.key === "Left") : event.keyCode === KeyCodes.ARROW_LEFT) && !hasModifierKeys(event);
115
117
 
116
118
  const isRight = event => (event.key ? (event.key === "ArrowRight" || event.key === "Right") : event.keyCode === KeyCodes.ARROW_RIGHT) && !hasModifierKeys(event);
@@ -131,10 +133,18 @@ const isUpShift = event => (event.key ? (event.key === "ArrowUp" || event.key ==
131
133
 
132
134
  const isDownShift = event => (event.key ? (event.key === "ArrowDown" || event.key === "Down") : event.keyCode === KeyCodes.ARROW_DOWN) && checkModifierKeys(event, false, false, true);
133
135
 
136
+ const isUpAlt = event => (event.key ? (event.key === "ArrowUp" || event.key === "Up") : event.keyCode === KeyCodes.ARROW_UP) && checkModifierKeys(event, false, true, false);
137
+
138
+ const isDownAlt = event => (event.key ? (event.key === "ArrowDown" || event.key === "Down") : event.keyCode === KeyCodes.ARROW_DOWN) && checkModifierKeys(event, false, true, false);
139
+
134
140
  const isLeftShift = event => (event.key ? (event.key === "ArrowLeft" || event.key === "Left") : event.keyCode === KeyCodes.ARROW_LEFT) && checkModifierKeys(event, false, false, true);
135
141
 
136
142
  const isRightShift = event => (event.key ? (event.key === "ArrowRight" || event.key === "Right") : event.keyCode === KeyCodes.ARROW_RIGHT) && checkModifierKeys(event, false, false, true);
137
143
 
144
+ const isLeftShiftCtrl = event => (event.key ? (event.key === "ArrowLeft" || event.key === "Left") : event.keyCode === KeyCodes.ARROW_LEFT) && checkModifierKeys(event, true, false, true);
145
+
146
+ const isRightShiftCtrl = event => (event.key ? (event.key === "ArrowRight" || event.key === "Right") : event.keyCode === KeyCodes.ARROW_RIGHT) && checkModifierKeys(event, true, false, true);
147
+
138
148
  const isUpShiftCtrl = event => (event.key ? (event.key === "ArrowUp" || event.key === "Up") : event.keyCode === KeyCodes.ARROW_UP) && checkModifierKeys(event, true, false, true);
139
149
 
140
150
  const isDownShiftCtrl = event => (event.key ? (event.key === "ArrowDown" || event.key === "Down") : event.keyCode === KeyCodes.ARROW_DOWN) && checkModifierKeys(event, true, false, true);
@@ -145,8 +155,12 @@ const isEnd = event => (event.key ? event.key === "End" : event.keyCode === KeyC
145
155
 
146
156
  const isHomeCtrl = event => (event.key ? event.key === "Home" : event.keyCode === KeyCodes.HOME) && checkModifierKeys(event, true, false, false);
147
157
 
158
+ const isHomeShift = event => (event.key ? event.key === "Home" : event.keyCode === KeyCodes.HOME) && checkModifierKeys(event, false, false, true);
159
+
148
160
  const isEndCtrl = event => (event.key ? event.key === "End" : event.keyCode === KeyCodes.END) && checkModifierKeys(event, true, false, false);
149
161
 
162
+ const isEndShift = event => (event.key ? event.key === "End" : event.keyCode === KeyCodes.END) && checkModifierKeys(event, false, false, true);
163
+
150
164
  const isEscape = event => (event.key ? event.key === "Escape" || event.key === "Esc" : event.keyCode === KeyCodes.ESCAPE) && !hasModifierKeys(event);
151
165
 
152
166
  const isTabNext = event => (event.key ? event.key === "Tab" : event.keyCode === KeyCodes.TAB) && !hasModifierKeys(event);
@@ -157,6 +171,12 @@ const isBackSpace = event => (event.key ? event.key === "Backspace" : event.keyC
157
171
 
158
172
  const isDelete = event => (event.key ? event.key === "Delete" : event.keyCode === KeyCodes.DELETE) && !hasModifierKeys(event);
159
173
 
174
+ const isDeleteShift = event => (event.key ? event.key === "Delete" : event.keyCode === KeyCodes.DELETE) && checkModifierKeys(event, false, false, true);
175
+
176
+ const isInsertShift = event => (event.key ? event.key === "Insert" : event.keyCode === KeyCodes.DELETE) && checkModifierKeys(event, false, false, true);
177
+
178
+ const isInsertCtrl = event => (event.key ? event.key === "Insert" : event.keyCode === KeyCodes.DELETE) && checkModifierKeys(event, true, false, false);
179
+
160
180
  const isPageUp = event => (event.key ? event.key === "PageUp" : event.keyCode === KeyCodes.PAGE_UP) && !hasModifierKeys(event);
161
181
 
162
182
  const isPageDown = event => (event.key ? event.key === "PageDown" : event.keyCode === KeyCodes.PAGE_DOWN) && !hasModifierKeys(event);
@@ -191,12 +211,24 @@ const isF4 = event => {
191
211
 
192
212
  const isF4Shift = event => (event.key ? event.key === "F4" : event.keyCode === KeyCodes.F4) && checkModifierKeys(event, false, false, true);
193
213
 
214
+ const isF6Next = event => ((event.key ? event.key === "F6" : event.keyCode === KeyCodes.F6) && checkModifierKeys(event, false, false, false))
215
+ || ((event.key ? (event.key === "ArrowDown" || event.key === "Down") : event.keyCode === KeyCodes.ARROW_DOWN) && checkModifierKeys(event, true, true, false));
216
+
217
+ const isF6Previous = event => ((event.key ? event.key === "F6" : event.keyCode === KeyCodes.F6) && checkModifierKeys(event, false, false, true))
218
+ || ((event.key ? (event.key === "ArrowUp" || event.key === "Up") : event.keyCode === KeyCodes.ARROW_Up) && checkModifierKeys(event, true, true, false));
219
+
194
220
  const isF7 = event => (event.key ? event.key === "F7" : event.keyCode === KeyCodes.F7) && !hasModifierKeys(event);
195
221
 
196
222
  const isShowByArrows = event => {
197
223
  return ((event.key === "ArrowDown" || event.key === "Down") || (event.key === "ArrowUp" || event.key === "Up")) && checkModifierKeys(event, /* Ctrl */ false, /* Alt */ true, /* Shift */ false);
198
224
  };
199
225
 
226
+ const isShift = event => event.key === "Shift" || event.keyCode === KeyCodes.SHIFT;
227
+
228
+ const isCtrlA = event => ((event.key === "A" || event.key === "a") || event.which === KeyCodes.A) && checkModifierKeys(event, true, false, false);
229
+
230
+ const isCtrlV = event => ((event.key === "V" || event.key === "v") || event.which === KeyCodes.V) && checkModifierKeys(event, true, false, false);
231
+
200
232
  const hasModifierKeys = event => event.shiftKey || event.altKey || getCtrlKey(event);
201
233
 
202
234
  const getCtrlKey = event => !!(event.metaKey || event.ctrlKey); // double negation doesn't have effect on boolean but ensures null and undefined are equivalent to false.
@@ -208,6 +240,7 @@ export {
208
240
  isEnterShift,
209
241
  isSpace,
210
242
  isSpaceShift,
243
+ isSpaceCtrl,
211
244
  isLeft,
212
245
  isRight,
213
246
  isUp,
@@ -218,8 +251,12 @@ export {
218
251
  isDownCtrl,
219
252
  isUpShift,
220
253
  isDownShift,
254
+ isUpAlt,
255
+ isDownAlt,
221
256
  isLeftShift,
222
257
  isRightShift,
258
+ isLeftShiftCtrl,
259
+ isRightShiftCtrl,
223
260
  isUpShiftCtrl,
224
261
  isDownShiftCtrl,
225
262
  isHome,
@@ -228,6 +265,8 @@ export {
228
265
  isMinus,
229
266
  isHomeCtrl,
230
267
  isEndCtrl,
268
+ isHomeShift,
269
+ isEndShift,
231
270
  isEscape,
232
271
  isTabNext,
233
272
  isTabPrevious,
@@ -236,6 +275,8 @@ export {
236
275
  isShow,
237
276
  isF4,
238
277
  isF4Shift,
278
+ isF6Previous,
279
+ isF6Next,
239
280
  isF7,
240
281
  isPageUp,
241
282
  isPageDown,
@@ -245,4 +286,10 @@ export {
245
286
  isPageDownAlt,
246
287
  isPageUpShiftCtrl,
247
288
  isPageDownShiftCtrl,
289
+ isShift,
290
+ isCtrlA,
291
+ isCtrlV,
292
+ isDeleteShift,
293
+ isInsertShift,
294
+ isInsertCtrl,
248
295
  };
@@ -0,0 +1,107 @@
1
+ import VersionInfo from "./generated/VersionInfo.js";
2
+ import getSharedResource from "./getSharedResource.js";
3
+
4
+ let currentRuntimeIndex;
5
+ let currentRuntimeAlias = "";
6
+
7
+ const compareCache = new Map();
8
+
9
+ /**
10
+ * Central registry where all runtimes register themselves by pushing an object.
11
+ * The index in the registry servers as an ID for the runtime.
12
+ * @type {*}
13
+ */
14
+ const Runtimes = getSharedResource("Runtimes", []);
15
+
16
+ /**
17
+ * Registers the current runtime in the shared runtimes resource registry
18
+ */
19
+ const registerCurrentRuntime = () => {
20
+ if (currentRuntimeIndex === undefined) {
21
+ currentRuntimeIndex = Runtimes.length;
22
+ Runtimes.push({
23
+ ...VersionInfo,
24
+ alias: currentRuntimeAlias,
25
+ description: `Runtime ${currentRuntimeIndex} - ver ${VersionInfo.version}${currentRuntimeAlias ? ` (${currentRuntimeAlias})` : ""}`,
26
+ });
27
+ }
28
+ };
29
+
30
+ /**
31
+ * Returns the index of the current runtime's object in the shared runtimes resource registry
32
+ * @returns {*}
33
+ */
34
+ const getCurrentRuntimeIndex = () => {
35
+ return currentRuntimeIndex;
36
+ };
37
+
38
+ /**
39
+ * Compares two runtimes and returns 1 if the first is of a bigger version, -1 if the second is of a bigger version, and 0 if equal
40
+ * @param index1 The index of the first runtime to compare
41
+ * @param index2 The index of the second runtime to compare
42
+ * @returns {number}
43
+ */
44
+ const compareRuntimes = (index1, index2) => {
45
+ const cacheIndex = `${index1},${index2}`;
46
+ if (compareCache.has(cacheIndex)) {
47
+ return compareCache.get(cacheIndex);
48
+ }
49
+
50
+ const runtime1 = Runtimes[index1];
51
+ const runtime2 = Runtimes[index2];
52
+
53
+ if (!runtime1 || !runtime2) {
54
+ throw new Error("Invalid runtime index supplied");
55
+ }
56
+
57
+ // If any of the two is a next version, bigger buildTime wins
58
+ if (runtime1.isNext || runtime2.isNext) {
59
+ return runtime1.buildTime - runtime2.buildTime;
60
+ }
61
+
62
+ // If major versions differ, bigger one wins
63
+ const majorDiff = runtime1.major - runtime2.major;
64
+ if (majorDiff) {
65
+ return majorDiff;
66
+ }
67
+
68
+ // If minor versions differ, bigger one wins
69
+ const minorDiff = runtime1.minor - runtime2.minor;
70
+ if (minorDiff) {
71
+ return minorDiff;
72
+ }
73
+
74
+ // If patch versions differ, bigger one wins
75
+ const patchDiff = runtime1.patch - runtime2.patch;
76
+ if (patchDiff) {
77
+ return patchDiff;
78
+ }
79
+
80
+ // Bigger suffix wins, f.e. rc10 > rc9
81
+ // Important: suffix is alphanumeric, must use natural compare
82
+ const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: "base" });
83
+ const result = collator.compare(runtime1.suffix, runtime2.suffix);
84
+
85
+ compareCache.set(cacheIndex, result);
86
+ return result;
87
+ };
88
+
89
+ /**
90
+ * Set an alias for the the current app/library/microfrontend which will appear in debug messages and console warnings
91
+ * @param alias
92
+ */
93
+ const setRuntimeAlias = alias => {
94
+ currentRuntimeAlias = alias;
95
+ };
96
+
97
+ const getAllRuntimes = () => {
98
+ return Runtimes;
99
+ };
100
+
101
+ export {
102
+ getCurrentRuntimeIndex,
103
+ registerCurrentRuntime,
104
+ compareRuntimes,
105
+ setRuntimeAlias,
106
+ getAllRuntimes,
107
+ };
@@ -2,7 +2,7 @@ import "./StaticArea.js";
2
2
  import updateShadowRoot from "./updateShadowRoot.js";
3
3
  import { renderFinished } from "./Render.js";
4
4
  import getEffectiveContentDensity from "./util/getEffectiveContentDensity.js";
5
- import { getEffectiveScopingSuffixForTag } from "./CustomElementsScope.js";
5
+ import { getEffectiveScopingSuffixForTag } from "./CustomElementsScopeUtils.js";
6
6
  import getEffectiveDir from "./locale/getEffectiveDir.js";
7
7
 
8
8
  /**
@@ -25,6 +25,9 @@ class StaticAreaItem extends HTMLElement {
25
25
  setOwnerElement(ownerElement) {
26
26
  this.ownerElement = ownerElement;
27
27
  this.classList.add(this.ownerElement._id); // used for getting the popover in the tests
28
+ if (this.ownerElement.hasAttribute("data-ui5-static-stable")) {
29
+ this.setAttribute("data-ui5-stable", this.ownerElement.getAttribute("data-ui5-static-stable")); // stable selector
30
+ }
28
31
  }
29
32
 
30
33
  /**
@@ -46,6 +46,8 @@ function _invalidate(changeInfo) {
46
46
  this._eventProvider.fireEvent("invalidate", { ...changeInfo, target: this });
47
47
  }
48
48
 
49
+ let metadata = {};
50
+
49
51
  /**
50
52
  * Base class for all UI5 Web Components
51
53
  *
@@ -101,6 +103,9 @@ class UI5Element extends HTMLElement {
101
103
  */
102
104
  async connectedCallback() {
103
105
  this.setAttribute(this.constructor.getMetadata().getPureTag(), "");
106
+ if (this.constructor.getMetadata().supportsF6FastNavigation()) {
107
+ this.setAttribute("data-sap-ui-fastnavgroup", "true");
108
+ }
104
109
 
105
110
  const slotsAreManaged = this.constructor.getMetadata().slotsAreManaged();
106
111
 
@@ -251,7 +256,8 @@ class UI5Element extends HTMLElement {
251
256
 
252
257
  // Listen for any invalidation on the child if invalidateOnChildChange is true or an object (ignore when false or not set)
253
258
  if (child.isUI5Element && slotData.invalidateOnChildChange) {
254
- child.attachInvalidate(this._getChildChangeListener(slotName));
259
+ const method = (child.attachInvalidate || child._attachChange).bind(child);
260
+ method(this._getChildChangeListener(slotName));
255
261
  }
256
262
 
257
263
  // Listen for the slotchange event if the child is a slot itself
@@ -311,7 +317,8 @@ class UI5Element extends HTMLElement {
311
317
 
312
318
  children.forEach(child => {
313
319
  if (child && child.isUI5Element) {
314
- child.detachInvalidate(this._getChildChangeListener(slotName));
320
+ const method = (child.detachInvalidate || child._detachChange).bind(child);
321
+ method(this._getChildChangeListener(slotName));
315
322
  }
316
323
 
317
324
  if (isSlot(child)) {
@@ -891,7 +898,15 @@ class UI5Element extends HTMLElement {
891
898
  * @protected
892
899
  */
893
900
  static get metadata() {
894
- return {};
901
+ return metadata;
902
+ }
903
+
904
+ /**
905
+ * Sets a new metadata object for this UI5 Web Component Class
906
+ * @protected
907
+ */
908
+ static set metadata(newMetadata) {
909
+ metadata = newMetadata;
895
910
  }
896
911
 
897
912
  /**
@@ -2,7 +2,7 @@ import DataType from "./types/DataType.js";
2
2
  import isDescendantOf from "./util/isDescendantOf.js";
3
3
  import { camelToKebabCase } from "./util/StringHelper.js";
4
4
  import { getSlottedElements } from "./util/SlotsHelper.js";
5
- import { getEffectiveScopingSuffixForTag } from "./CustomElementsScope.js";
5
+ import { getEffectiveScopingSuffixForTag } from "./CustomElementsScopeUtils.js";
6
6
 
7
7
  /**
8
8
  *
@@ -188,6 +188,14 @@ class UI5ElementMetadata {
188
188
  return !!this.metadata.managedSlots;
189
189
  }
190
190
 
191
+ /**
192
+ * Determines whether this control supports F6 fast navigation
193
+ * @public
194
+ */
195
+ supportsF6FastNavigation() {
196
+ return !!this.metadata.fastNavigation;
197
+ }
198
+
191
199
  /**
192
200
  * Returns an object with key-value pairs of properties and their metadata definitions
193
201
  * @public
@@ -1,6 +1,6 @@
1
1
  import getSharedResource from "../getSharedResource.js";
2
2
  import IconCollectionsAlias from "../assets-meta/IconCollectionsAlias.js";
3
- import { isTheme } from "../config/Theme.js";
3
+ import { getEffectiveDefaultIconCollection } from "../config/Icons.js";
4
4
 
5
5
  const loaders = new Map();
6
6
  const registry = getSharedResource("SVGIcons.registry", new Map());
@@ -48,7 +48,7 @@ const _fillRegistry = bundleData => {
48
48
  // set
49
49
  const registerIcon = (name, { pathData, ltr, accData, collection, packageName } = {}) => { // eslint-disable-line
50
50
  if (!collection) {
51
- collection = _getDefaultCollection();
51
+ collection = getEffectiveDefaultIconCollection();
52
52
  }
53
53
 
54
54
  const key = `${collection}/${name}`;
@@ -68,7 +68,7 @@ const _parseName = name => {
68
68
 
69
69
  let collection;
70
70
  [name, collection] = name.split("/").reverse();
71
- collection = collection || _getDefaultCollection();
71
+ collection = collection || getEffectiveDefaultIconCollection();
72
72
 
73
73
  // Normalize collection name.
74
74
  // - resolve `SAP-icons-TNT` to `tnt`.
@@ -117,10 +117,6 @@ const _getRegisteredNames = async () => {
117
117
  return Array.from(registry.keys());
118
118
  };
119
119
 
120
- const _getDefaultCollection = () => {
121
- return isTheme("sap_horizon") ? "SAP-icons-v5" : "SAP-icons";
122
- };
123
-
124
120
  const _normalizeCollection = collectionName => {
125
121
  if (IconCollectionsAlias[collectionName]) {
126
122
  return IconCollectionsAlias[collectionName];
@@ -13,7 +13,6 @@ const M_ISO639_OLD_TO_NEW = {
13
13
  "iw": "he",
14
14
  "ji": "yi",
15
15
  "in": "id",
16
- "sh": "sr",
17
16
  };
18
17
 
19
18
  const DEV_MODE = false;
@@ -48,6 +47,12 @@ const calcLocale = (language, region, script) => {
48
47
  }
49
48
  }
50
49
 
50
+ // Special case 3: for Serbian, there are cyrillic and latin scripts, "sh" and "sr-latn" map to "latin", "sr" maps to cyrillic.
51
+ if (language === "sh" || (language === "sr" && script === "Latn")) {
52
+ language = "sr";
53
+ region = "Latn";
54
+ }
55
+
51
56
  // try language + region
52
57
  let localeId = `${language}_${region}`;
53
58
  if (SUPPORTED_LOCALES.includes(localeId)) {
@@ -38,10 +38,14 @@ const getThemeProperties = async (packageName, themeName) => {
38
38
 
39
39
  if (!registeredThemes.has(themeName)) {
40
40
  const regThemesStr = [...registeredThemes.values()].join(", ");
41
- console.warn(`You have requested a non-registered theme - falling back to ${DEFAULT_THEME}. Registered themes are: ${regThemesStr}`); /* eslint-disable-line */
42
- return themeStyles.get(`${packageName}_${DEFAULT_THEME}`);
41
+ console.warn(`You have requested a non-registered theme ${themeName} - falling back to ${DEFAULT_THEME}. Registered themes are: ${regThemesStr}`); /* eslint-disable-line */
42
+ return _getThemeProperties(packageName, DEFAULT_THEME);
43
43
  }
44
44
 
45
+ return _getThemeProperties(packageName, themeName);
46
+ };
47
+
48
+ const _getThemeProperties = async (packageName, themeName) => {
45
49
  const loader = loaders.get(`${packageName}/${themeName}`);
46
50
  if (!loader) {
47
51
  // no themes for package
@@ -0,0 +1,52 @@
1
+ import { getTheme, isThemeFamily } from "./Theme.js";
2
+
3
+ const IconCollectionConfiguration = new Map();
4
+
5
+ /**
6
+ * Sets the default icon collection (v4 or v5) per theme,
7
+ * which will be applied in case icon collection is not specified.
8
+ *
9
+ * Note: by default SAP-icons-v5 is used in SAP Horizon and SAP-icons-v4 for all the rest.
10
+ * @param {String} theme
11
+ * @param {String} collectionName
12
+ */
13
+ const setDefaultIconCollection = (theme, collectionName) => {
14
+ if (collectionName === "horizon") {
15
+ collectionName = "SAP-icons-v5";
16
+ }
17
+
18
+ IconCollectionConfiguration.set(theme, collectionName);
19
+ };
20
+
21
+ /**
22
+ * Returns the default icon collection (v4 or v5) for given theme,
23
+ * that is configured.
24
+ *
25
+ * @param {String} theme
26
+ * @returns {String}
27
+ */
28
+ const getDefaultIconCollection = theme => {
29
+ return IconCollectionConfiguration.get(theme);
30
+ };
31
+
32
+ /**
33
+ * Returns the effective icon collection that will be applied for icon web components
34
+ * whenever namespace is not specified.
35
+ * @returns {String}
36
+ */
37
+ const getEffectiveDefaultIconCollection = () => {
38
+ const currentTheme = getTheme();
39
+ const currentThemeConfiguration = IconCollectionConfiguration.get(currentTheme);
40
+
41
+ if (currentThemeConfiguration) {
42
+ return currentThemeConfiguration;
43
+ }
44
+
45
+ return isThemeFamily("sap_horizon") ? "SAP-icons-v5" : "SAP-icons";
46
+ };
47
+
48
+ export {
49
+ setDefaultIconCollection,
50
+ getDefaultIconCollection,
51
+ getEffectiveDefaultIconCollection,
52
+ };
@@ -35,8 +35,19 @@ const isTheme = _theme => {
35
35
  return currentTheme === _theme || currentTheme === `${_theme}_exp`;
36
36
  };
37
37
 
38
+ /**
39
+ * Returns if the current theme is part of given theme family
40
+ * @private
41
+ * @param {String} the theme family
42
+ * @returns {boolean}
43
+ */
44
+ const isThemeFamily = _theme => {
45
+ return getTheme().startsWith(_theme);
46
+ };
47
+
38
48
  export {
39
49
  getTheme,
40
50
  setTheme,
41
51
  isTheme,
52
+ isThemeFamily,
42
53
  };
@@ -0,0 +1,80 @@
1
+ .busy-indicator-wrapper {
2
+ position: relative;
3
+ height: 100%;
4
+ width: 100%;
5
+ }
6
+
7
+ .busy-indicator-overlay {
8
+ display: var(--ui5_web_components_busy_indicator_display);
9
+ position: absolute;
10
+ inset: 0;
11
+ background: var(--ui5_web_components_busy_indicator_background-color);
12
+ z-index: 99;
13
+ }
14
+
15
+ .busy-indicator-busy-area {
16
+ display: var(--ui5_web_components_busy_indicator_display);
17
+ position: absolute;
18
+ z-index: 99;
19
+ inset: 0;
20
+ justify-content: center;
21
+ align-items: center;
22
+ background-color: inherit;
23
+ flex-direction: column;
24
+ color: var(--_ui5_busy_indicator_color);
25
+ }
26
+
27
+ :host([__is-busy]) .busy-indicator-wrapper > :not(.busy-indicator-busy-area):not(.busy-indicator-overlay):not([busy-indicator-before-span]) {
28
+ --ui5_web_components_busy_indicator_display: none;
29
+ }
30
+
31
+ .busy-indicator-busy-area:focus {
32
+ outline: var(--_ui5_busy_indicator_focus_outline);
33
+ outline-offset: -.125rem;
34
+ }
35
+
36
+ .busy-indicator-circle {
37
+ width: 1rem;
38
+ height: 1rem;
39
+ display: inline-block;
40
+ background-color: currentColor;
41
+ border-radius: 50%;
42
+ }
43
+
44
+ .circle-animation-0 {
45
+ animation: grow 1.6s infinite cubic-bezier(0.32, 0.06, 0.85, 1.11);
46
+ }
47
+
48
+ .circle-animation-1 {
49
+ animation: grow 1.6s infinite cubic-bezier(0.32, 0.06, 0.85, 1.11);
50
+ animation-delay: 200ms;
51
+ }
52
+
53
+ .circle-animation-2 {
54
+ animation: grow 1.6s infinite cubic-bezier(0.32, 0.06, 0.85, 1.11);
55
+ animation-delay: 400ms;
56
+ }
57
+
58
+ .sapUiLocalBusy {
59
+ --ui5_web_components_busy_indicator_display: none;
60
+ }
61
+
62
+ .busy-indicator-wrapper [ui5-busy-indicator] {
63
+ display: none;
64
+ }
65
+
66
+ @keyframes grow {
67
+ 0%, 50%, 100% {
68
+ -webkit-transform: scale(0.5);
69
+ -moz-transform: scale(0.5);
70
+ -ms-transform: scale(0.5);
71
+ transform: scale(0.5);
72
+ }
73
+
74
+ 25% {
75
+ -webkit-transform: scale(1);
76
+ -moz-transform: scale(1);
77
+ -ms-transform: scale(1);
78
+ transform: scale(1);
79
+ }
80
+ }
@@ -3,8 +3,8 @@
3
3
  font-style: normal;
4
4
  font-weight: 400;
5
5
  src: local("72"),
6
- url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular.woff2?ui5-webcomponents) format("woff2"),
7
- url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular.woff?ui5-webcomponents) format("woff");
6
+ url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular.woff2?ui5-webcomponents) format("woff2"),
7
+ url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular.woff?ui5-webcomponents) format("woff");
8
8
  }
9
9
 
10
10
  @font-face {
@@ -12,8 +12,8 @@
12
12
  font-style: normal;
13
13
  font-weight: 400;
14
14
  src: local('72-full'),
15
- url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular-full.woff2?ui5-webcomponents) format("woff2"),
16
- url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular-full.woff?ui5-webcomponents) format("woff");
15
+ url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular-full.woff2?ui5-webcomponents) format("woff2"),
16
+ url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular-full.woff?ui5-webcomponents) format("woff");
17
17
 
18
18
  }
19
19
 
@@ -22,8 +22,8 @@
22
22
  font-style: normal;
23
23
  font-weight: 700;
24
24
  src: local('72-Bold'),
25
- url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff2?ui5-webcomponents) format("woff2"),
26
- url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff?ui5-webcomponents) format("woff");
25
+ url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff2?ui5-webcomponents) format("woff2"),
26
+ url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff?ui5-webcomponents) format("woff");
27
27
  }
28
28
 
29
29
  @font-face {
@@ -31,8 +31,38 @@
31
31
  font-style: normal;
32
32
  font-weight: 700;
33
33
  src: local('72-Bold-full'),
34
- url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff2?ui5-webcomponents) format("woff2"),
35
- url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff?ui5-webcomponents) format("woff");
34
+ url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff2?ui5-webcomponents) format("woff2"),
35
+ url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff?ui5-webcomponents) format("woff");
36
+ }
37
+
38
+ @font-face {
39
+ font-family: '72-Bold';
40
+ font-style: normal;
41
+ src: local('72-Bold'),
42
+ url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff2?ui5-webcomponents) format("woff2"),
43
+ url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff?ui5-webcomponents) format("woff");
44
+ }
45
+
46
+ @font-face {
47
+ font-family: '72-Boldfull';
48
+ font-style: normal;
49
+ src: url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff2?ui5-webcomponents) format("woff2"),
50
+ url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff?ui5-webcomponents) format("woff");
51
+ }
52
+
53
+ @font-face {
54
+ font-family: '72-Light';
55
+ font-style: normal;
56
+ src: local('72-Light'),
57
+ url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Light.woff2?ui5-webcomponents) format("woff2"),
58
+ url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Light.woff?ui5-webcomponents) format("woff");
59
+ }
60
+
61
+ @font-face {
62
+ font-family: '72-Lightfull';
63
+ font-style: normal;
64
+ src: url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Light-full.woff2?ui5-webcomponents) format("woff2"),
65
+ url(https://ui5.sap.com/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Light-full.woff?ui5-webcomponents) format("woff");
36
66
  }
37
67
 
38
68
  @font-face {