@ui5/webcomponents-base 0.0.0-0742854fd → 0.0.0-11d529e8a

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 (278) hide show
  1. package/.eslintignore +2 -0
  2. package/CHANGELOG.md +109 -0
  3. package/README.md +26 -1
  4. package/bundle.esm.js +13 -10
  5. package/dist/AssetRegistry.js +8 -7
  6. package/dist/Boot.js +43 -0
  7. package/dist/DOMObserver.js +65 -0
  8. package/dist/Device.js +58 -779
  9. package/dist/EventProvider.js +30 -26
  10. package/dist/FontFace.js +52 -7
  11. package/dist/InitialConfiguration.js +26 -21
  12. package/dist/Keys.js +51 -0
  13. package/dist/MediaRange.js +109 -0
  14. package/{src/util/parseProperties.js → dist/PropertiesFileFormat.js} +6 -0
  15. package/dist/Render.js +173 -0
  16. package/dist/RenderScheduler.js +16 -138
  17. package/dist/StaticArea.js +1 -29
  18. package/dist/StaticAreaItem.js +64 -65
  19. package/dist/Theming.js +2 -1
  20. package/dist/UI5Element.js +305 -374
  21. package/dist/UI5ElementMetadata.js +115 -16
  22. package/dist/asset-registries/Icons.js +110 -14
  23. package/dist/asset-registries/Illustrations.js +30 -0
  24. package/dist/asset-registries/LocaleData.js +90 -66
  25. package/dist/asset-registries/Themes.js +23 -33
  26. package/dist/asset-registries/i18n.js +61 -50
  27. package/dist/config/Language.js +18 -20
  28. package/dist/delegate/ItemNavigation.js +233 -201
  29. package/dist/delegate/ResizeHandler.js +78 -37
  30. package/dist/delegate/ScrollEnablement.js +49 -20
  31. package/dist/features/OpenUI5Support.js +41 -6
  32. package/dist/generated/AssetParameters.js +1 -1
  33. package/dist/i18nBundle.js +6 -2
  34. package/dist/isLegacyBrowser.js +3 -0
  35. package/dist/locale/applyDirection.js +6 -4
  36. package/dist/locale/directionChange.js +32 -0
  37. package/dist/locale/getEffectiveDir.js +28 -0
  38. package/dist/locale/getLocale.js +12 -2
  39. package/dist/locale/languageChange.js +1 -1
  40. package/dist/renderer/LitRenderer.js +19 -18
  41. package/dist/resources/bundle.esm.js +17 -109
  42. package/dist/resources/bundle.esm.js.map +1 -1
  43. package/dist/sap/base/Log.js +241 -0
  44. package/dist/sap/base/assert.js +8 -0
  45. package/dist/sap/base/security/URLListValidator.js +148 -0
  46. package/dist/sap/base/security/sanitizeHTML.js +16 -0
  47. package/dist/sap/base/util/now.js +7 -0
  48. package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +3585 -0
  49. package/dist/test-resources/assets/Themes.js +8 -8
  50. package/dist/test-resources/elements/Parent.js +6 -2
  51. package/dist/test-resources/elements/WithStaticArea.js +2 -1
  52. package/dist/test-resources/pages/AllTestElements.html +3 -3
  53. package/dist/test-resources/pages/Configuration.html +0 -2
  54. package/dist/test-resources/pages/ConfigurationScript.html +0 -2
  55. package/dist/test-resources/pages/i18n.html +1 -6
  56. package/dist/test-resources/specs/ConfigurationChange.spec.js +10 -8
  57. package/dist/test-resources/specs/ConfigurationScript.spec.js +25 -23
  58. package/dist/test-resources/specs/ConfigurationURL.spec.js +65 -17
  59. package/dist/test-resources/specs/CustomTheme.spec.js +7 -5
  60. package/dist/test-resources/specs/EventProvider.spec.js +63 -0
  61. package/dist/test-resources/specs/StaticArea.spec.js +56 -12
  62. package/dist/test-resources/specs/Theming.spec.js +9 -7
  63. package/dist/test-resources/specs/UI5ElementInvalidation.js +54 -70
  64. package/dist/test-resources/specs/UI5ElementLifecycle.js +17 -15
  65. package/dist/test-resources/specs/UI5ElementListenForChildPropChanges.spec.js +25 -51
  66. package/dist/test-resources/specs/UI5ElementMetadataExt.js +9 -7
  67. package/dist/test-resources/specs/UI5ElementPropertyValidation.js +7 -5
  68. package/dist/test-resources/specs/UI5ElementPropsAndAttrs.spec.js +37 -35
  69. package/dist/test-resources/specs/UI5ElementShadowDOM.js +10 -8
  70. package/dist/test-resources/specs/UI5ElementSlots.js +10 -8
  71. package/dist/theming/CustomStyle.js +2 -2
  72. package/dist/theming/ThemeLoaded.js +22 -0
  73. package/dist/theming/applyTheme.js +2 -5
  74. package/dist/theming/getConstructableStyle.js +7 -6
  75. package/dist/theming/getEffectiveStyle.js +15 -8
  76. package/dist/theming/getStylesString.js +1 -1
  77. package/dist/types/CSSColor.js +9 -0
  78. package/dist/types/CalendarType.js +1 -1
  79. package/dist/types/DataType.js +13 -1
  80. package/dist/types/Float.js +4 -0
  81. package/dist/types/Integer.js +4 -0
  82. package/dist/types/InvisibleMessageMode.js +30 -0
  83. package/dist/types/ItemNavigationBehavior.js +2 -7
  84. package/dist/types/PopupState.js +1 -1
  85. package/dist/types/ValueState.js +1 -1
  86. package/dist/updateShadowRoot.js +26 -0
  87. package/dist/util/AriaLabelHelper.js +4 -4
  88. package/dist/util/Caret.js +45 -0
  89. package/dist/util/ColorConversion.js +370 -0
  90. package/dist/util/FocusableElements.js +17 -6
  91. package/dist/util/HTMLSanitizer.js +7 -0
  92. package/dist/util/InvisibleMessage.js +58 -0
  93. package/dist/util/PopupUtils.js +93 -0
  94. package/dist/util/SlotsHelper.js +43 -0
  95. package/dist/util/TabbableElements.js +1 -1
  96. package/dist/util/arraysAreEqual.js +15 -0
  97. package/dist/util/clamp.js +12 -0
  98. package/dist/util/debounce.js +17 -0
  99. package/dist/util/encodeCSS.js +24 -0
  100. package/dist/util/getActiveElement.js +11 -0
  101. package/dist/util/getClassCopy.js +10 -0
  102. package/dist/util/getEffectiveContentDensity.js +5 -0
  103. package/dist/util/isElementInView.js +15 -0
  104. package/dist/util/isNodeTabbable.js +4 -4
  105. package/hash.txt +1 -0
  106. package/index.js +1 -1
  107. package/package-scripts.js +33 -18
  108. package/package.json +20 -12
  109. package/src/AssetRegistry.js +8 -7
  110. package/src/Boot.js +43 -0
  111. package/src/DOMObserver.js +65 -0
  112. package/src/Device.js +58 -779
  113. package/src/EventProvider.js +30 -26
  114. package/src/FontFace.js +52 -7
  115. package/src/InitialConfiguration.js +26 -21
  116. package/src/Keys.js +51 -0
  117. package/src/MediaRange.js +109 -0
  118. package/{dist/util/parseProperties.js → src/PropertiesFileFormat.js} +6 -0
  119. package/src/Render.js +173 -0
  120. package/src/RenderScheduler.js +16 -138
  121. package/src/StaticArea.js +1 -29
  122. package/src/StaticAreaItem.js +64 -65
  123. package/src/Theming.js +2 -1
  124. package/src/UI5Element.js +305 -374
  125. package/src/UI5ElementMetadata.js +115 -16
  126. package/src/asset-registries/Icons.js +110 -14
  127. package/src/asset-registries/Illustrations.js +30 -0
  128. package/src/asset-registries/LocaleData.js +90 -66
  129. package/src/asset-registries/Themes.js +23 -33
  130. package/src/asset-registries/i18n.js +61 -50
  131. package/src/config/Language.js +18 -20
  132. package/src/delegate/ItemNavigation.js +233 -201
  133. package/src/delegate/ResizeHandler.js +78 -37
  134. package/src/delegate/ScrollEnablement.js +49 -20
  135. package/src/features/OpenUI5Support.js +41 -6
  136. package/src/i18nBundle.js +6 -2
  137. package/src/isLegacyBrowser.js +3 -0
  138. package/src/locale/applyDirection.js +6 -4
  139. package/src/locale/directionChange.js +32 -0
  140. package/src/locale/getEffectiveDir.js +28 -0
  141. package/src/locale/getLocale.js +12 -2
  142. package/src/locale/languageChange.js +1 -1
  143. package/src/renderer/LitRenderer.js +19 -18
  144. package/src/theming/CustomStyle.js +2 -2
  145. package/src/theming/ThemeLoaded.js +22 -0
  146. package/src/theming/applyTheme.js +2 -5
  147. package/src/theming/getConstructableStyle.js +7 -6
  148. package/src/theming/getEffectiveStyle.js +15 -8
  149. package/src/theming/getStylesString.js +1 -1
  150. package/src/types/CSSColor.js +9 -0
  151. package/src/types/CalendarType.js +1 -1
  152. package/src/types/DataType.js +13 -1
  153. package/src/types/Float.js +4 -0
  154. package/src/types/Integer.js +4 -0
  155. package/src/types/InvisibleMessageMode.js +30 -0
  156. package/src/types/ItemNavigationBehavior.js +2 -7
  157. package/src/types/PopupState.js +1 -1
  158. package/src/types/ValueState.js +1 -1
  159. package/src/updateShadowRoot.js +26 -0
  160. package/src/util/AriaLabelHelper.js +4 -4
  161. package/src/util/Caret.js +45 -0
  162. package/src/util/ColorConversion.js +370 -0
  163. package/src/util/FocusableElements.js +17 -6
  164. package/src/util/HTMLSanitizer.js +7 -0
  165. package/src/util/InvisibleMessage.js +58 -0
  166. package/src/util/PopupUtils.js +93 -0
  167. package/src/util/SlotsHelper.js +43 -0
  168. package/src/util/TabbableElements.js +1 -1
  169. package/src/util/arraysAreEqual.js +15 -0
  170. package/src/util/clamp.js +12 -0
  171. package/src/util/debounce.js +17 -0
  172. package/src/util/encodeCSS.js +24 -0
  173. package/src/util/getActiveElement.js +11 -0
  174. package/src/util/getClassCopy.js +10 -0
  175. package/src/util/getEffectiveContentDensity.js +5 -0
  176. package/src/util/isElementInView.js +15 -0
  177. package/src/util/isNodeTabbable.js +4 -4
  178. package/used-modules.txt +7 -0
  179. package/bundle.es5.js +0 -28
  180. package/dist/SVGIconRegistry.js +0 -62
  181. package/dist/boot.js +0 -34
  182. package/dist/compatibility/DOMObserver.js +0 -62
  183. package/dist/compatibility/patchNodeValue.js +0 -24
  184. package/dist/compatibility/whenPolyfillLoaded.js +0 -26
  185. package/dist/config/AssetsPath.js +0 -17
  186. package/dist/delegate/CustomResize.js +0 -78
  187. package/dist/delegate/NativeResize.js +0 -44
  188. package/dist/features/PropertiesFormatSupport.js +0 -8
  189. package/dist/features/browsersupport/Edge.js +0 -6
  190. package/dist/features/browsersupport/IE11.js +0 -41
  191. package/dist/features/browsersupport/IE11WithWebComponentsPolyfill.js +0 -5
  192. package/dist/renderer/ifDefined.js +0 -21
  193. package/dist/renderer/scopeHTML.js +0 -32
  194. package/dist/resources/bundle.es5.js +0 -212
  195. package/dist/resources/bundle.es5.js.map +0 -1
  196. package/dist/theming/CSSVarsPonyfill.js +0 -48
  197. package/dist/theming/adaptCSSForIE.js +0 -95
  198. package/dist/theming/createComponentStyleTag.js +0 -54
  199. package/dist/thirdparty/Array.from.js +0 -16
  200. package/dist/thirdparty/Array.prototype.fill.js +0 -44
  201. package/dist/thirdparty/Array.prototype.find.js +0 -46
  202. package/dist/thirdparty/Array.prototype.includes.js +0 -51
  203. package/dist/thirdparty/Element.prototype.closest.js +0 -11
  204. package/dist/thirdparty/Element.prototype.matches.js +0 -6
  205. package/dist/thirdparty/Map.prototype.keys.js +0 -9
  206. package/dist/thirdparty/Number.isInteger.js +0 -5
  207. package/dist/thirdparty/Number.isNaN.js +0 -1
  208. package/dist/thirdparty/Number.parseInt.js +0 -1
  209. package/dist/thirdparty/Object.assign.js +0 -31
  210. package/dist/thirdparty/Object.entries.js +0 -11
  211. package/dist/thirdparty/Symbol.js +0 -2
  212. package/dist/thirdparty/WeakSet.js +0 -27
  213. package/dist/thirdparty/es6-string-methods.js +0 -182
  214. package/dist/thirdparty/events-polyfills.js +0 -89
  215. package/dist/thirdparty/fetch.js +0 -1
  216. package/dist/thirdparty/template.js +0 -600
  217. package/dist/thirdparty/webcomponents-sd-ce-pf.js +0 -318
  218. package/dist/util/getEffectiveAssetPath.js +0 -12
  219. package/dist/util/isSlot.js +0 -3
  220. package/dist/webcomponentsjs/LICENSE.md +0 -19
  221. package/dist/webcomponentsjs/README.md +0 -229
  222. package/dist/webcomponentsjs/bundles/webcomponents-ce.js +0 -63
  223. package/dist/webcomponentsjs/bundles/webcomponents-ce.js.map +0 -1
  224. package/dist/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js +0 -297
  225. package/dist/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js.map +0 -1
  226. package/dist/webcomponentsjs/bundles/webcomponents-sd-ce.js +0 -208
  227. package/dist/webcomponentsjs/bundles/webcomponents-sd-ce.js.map +0 -1
  228. package/dist/webcomponentsjs/bundles/webcomponents-sd.js +0 -166
  229. package/dist/webcomponentsjs/bundles/webcomponents-sd.js.map +0 -1
  230. package/dist/webcomponentsjs/custom-elements-es5-adapter.js +0 -15
  231. package/dist/webcomponentsjs/package.json +0 -46
  232. package/dist/webcomponentsjs/src/entrypoints/custom-elements-es5-adapter-index.js +0 -16
  233. package/dist/webcomponentsjs/src/entrypoints/webcomponents-bundle-index.js +0 -53
  234. package/dist/webcomponentsjs/src/entrypoints/webcomponents-ce-index.js +0 -17
  235. package/dist/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-index.js +0 -19
  236. package/dist/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-pf-index.js +0 -28
  237. package/dist/webcomponentsjs/src/entrypoints/webcomponents-sd-index.js +0 -18
  238. package/dist/webcomponentsjs/webcomponents-bundle.js +0 -298
  239. package/dist/webcomponentsjs/webcomponents-bundle.js.map +0 -1
  240. package/dist/webcomponentsjs/webcomponents-loader.js +0 -185
  241. package/src/SVGIconRegistry.js +0 -62
  242. package/src/boot.js +0 -34
  243. package/src/compatibility/DOMObserver.js +0 -62
  244. package/src/compatibility/patchNodeValue.js +0 -24
  245. package/src/compatibility/whenPolyfillLoaded.js +0 -26
  246. package/src/config/AssetsPath.js +0 -17
  247. package/src/delegate/CustomResize.js +0 -78
  248. package/src/delegate/NativeResize.js +0 -44
  249. package/src/features/PropertiesFormatSupport.js +0 -8
  250. package/src/features/browsersupport/Edge.js +0 -6
  251. package/src/features/browsersupport/IE11.js +0 -41
  252. package/src/features/browsersupport/IE11WithWebComponentsPolyfill.js +0 -5
  253. package/src/renderer/ifDefined.js +0 -21
  254. package/src/renderer/scopeHTML.js +0 -32
  255. package/src/theming/CSSVarsPonyfill.js +0 -48
  256. package/src/theming/adaptCSSForIE.js +0 -95
  257. package/src/theming/createComponentStyleTag.js +0 -54
  258. package/src/thirdparty/Array.from.js +0 -16
  259. package/src/thirdparty/Array.prototype.fill.js +0 -44
  260. package/src/thirdparty/Array.prototype.find.js +0 -46
  261. package/src/thirdparty/Array.prototype.includes.js +0 -51
  262. package/src/thirdparty/Element.prototype.closest.js +0 -11
  263. package/src/thirdparty/Element.prototype.matches.js +0 -6
  264. package/src/thirdparty/Map.prototype.keys.js +0 -9
  265. package/src/thirdparty/Number.isInteger.js +0 -5
  266. package/src/thirdparty/Number.isNaN.js +0 -1
  267. package/src/thirdparty/Number.parseInt.js +0 -1
  268. package/src/thirdparty/Object.assign.js +0 -31
  269. package/src/thirdparty/Object.entries.js +0 -11
  270. package/src/thirdparty/Symbol.js +0 -2
  271. package/src/thirdparty/WeakSet.js +0 -27
  272. package/src/thirdparty/es6-string-methods.js +0 -182
  273. package/src/thirdparty/events-polyfills.js +0 -89
  274. package/src/thirdparty/fetch.js +0 -1
  275. package/src/thirdparty/template.js +0 -600
  276. package/src/thirdparty/webcomponents-sd-ce-pf.js +0 -318
  277. package/src/util/getEffectiveAssetPath.js +0 -12
  278. package/src/util/isSlot.js +0 -3
@@ -1,42 +1,42 @@
1
1
  class EventProvider {
2
2
  constructor() {
3
- this._eventRegistry = {};
3
+ this._eventRegistry = new Map();
4
4
  }
5
5
 
6
6
  attachEvent(eventName, fnFunction) {
7
7
  const eventRegistry = this._eventRegistry;
8
- let eventListeners = eventRegistry[eventName];
8
+ const eventListeners = eventRegistry.get(eventName);
9
9
 
10
10
  if (!Array.isArray(eventListeners)) {
11
- eventRegistry[eventName] = [];
12
- eventListeners = eventRegistry[eventName];
11
+ eventRegistry.set(eventName, [fnFunction]);
12
+ return;
13
13
  }
14
14
 
15
- eventListeners.push({
16
- "function": fnFunction,
17
- });
15
+ if (!eventListeners.includes(fnFunction)) {
16
+ eventListeners.push(fnFunction);
17
+ }
18
18
  }
19
19
 
20
20
  detachEvent(eventName, fnFunction) {
21
21
  const eventRegistry = this._eventRegistry;
22
- let eventListeners = eventRegistry[eventName];
22
+ const eventListeners = eventRegistry.get(eventName);
23
23
 
24
24
  if (!eventListeners) {
25
25
  return;
26
26
  }
27
+ const indexOfFnToDetach = eventListeners.indexOf(fnFunction);
27
28
 
28
- eventListeners = eventListeners.filter(event => {
29
- return event["function"] !== fnFunction; // eslint-disable-line
30
- });
29
+ if (indexOfFnToDetach !== -1) {
30
+ eventListeners.splice(indexOfFnToDetach, 1);
31
+ }
31
32
 
32
33
  if (eventListeners.length === 0) {
33
- delete eventRegistry[eventName];
34
+ eventRegistry.delete(eventName);
34
35
  }
35
36
  }
36
37
 
37
38
  /**
38
39
  * Fires an event and returns the results of all event listeners as an array.
39
- * Example: If listeners return promises, you can: await fireEvent("myEvent") to know when all listeners have finished.
40
40
  *
41
41
  * @param eventName the event to fire
42
42
  * @param data optional data to pass to each event listener
@@ -44,37 +44,41 @@ class EventProvider {
44
44
  */
45
45
  fireEvent(eventName, data) {
46
46
  const eventRegistry = this._eventRegistry;
47
- const eventListeners = eventRegistry[eventName];
47
+ const eventListeners = eventRegistry.get(eventName);
48
48
 
49
49
  if (!eventListeners) {
50
50
  return [];
51
51
  }
52
52
 
53
- return eventListeners.map(event => {
54
- return event["function"].call(this, data); // eslint-disable-line
53
+ return eventListeners.map(fn => {
54
+ return fn.call(this, data); // eslint-disable-line
55
55
  });
56
56
  }
57
57
 
58
+ /**
59
+ * Fires an event and returns a promise that will resolve once all listeners have resolved.
60
+ *
61
+ * @param eventName the event to fire
62
+ * @param data optional data to pass to each event listener
63
+ * @returns {Promise} a promise that will resolve when all listeners have resolved
64
+ */
65
+ fireEventAsync(eventName, data) {
66
+ return Promise.all(this.fireEvent(eventName, data));
67
+ }
68
+
58
69
  isHandlerAttached(eventName, fnFunction) {
59
70
  const eventRegistry = this._eventRegistry;
60
- const eventListeners = eventRegistry[eventName];
71
+ const eventListeners = eventRegistry.get(eventName);
61
72
 
62
73
  if (!eventListeners) {
63
74
  return false;
64
75
  }
65
76
 
66
- for (let i = 0; i < eventListeners.length; i++) {
67
- const event = eventListeners[i];
68
- if (event["function"] === fnFunction) { // eslint-disable-line
69
- return true;
70
- }
71
- }
72
-
73
- return false;
77
+ return eventListeners.includes(fnFunction);
74
78
  }
75
79
 
76
80
  hasListeners(eventName) {
77
- return !!this._eventRegistry[eventName];
81
+ return !!this._eventRegistry.get(eventName);
78
82
  }
79
83
  }
80
84
 
package/dist/FontFace.js CHANGED
@@ -56,18 +56,63 @@ const fontFaceCSS = `
56
56
  }
57
57
  `;
58
58
 
59
- const insertFontFace = () => {
60
- if (document.querySelector(`head>style[data-ui5-font-face]`)) {
61
- return;
59
+ /**
60
+ * Some diacritics are supported by the 72 font:
61
+ * * Grave
62
+ * * Acute
63
+ * * Circumflex
64
+ * * Tilde
65
+ *
66
+ * However, the following diacritics and the combination of multiple diacritics (including the supported ones) are not supported:
67
+ * * Breve
68
+ * * Horn
69
+ * * Dot below
70
+ * * Hook above
71
+ *
72
+ *
73
+ * Override for the characters that aren't covered by the '72' font to other system fonts
74
+ *
75
+ * U+0102-0103: A and a with Breve
76
+ * U+01A0-01A1: O and o with Horn
77
+ * U+01AF-01B0: U and u with Horn
78
+ * U+1EA0-1EB7: A and a with diacritics that are not supported by the font and combination of multiple diacritics
79
+ * U+1EB8-1EC7: E and e with diacritics that are not supported by the font and combination of multiple diacritics
80
+ * U+1EC8-1ECB: I and i with diacritics that are not supported by the font and combination of multiple diacritics
81
+ * U+1ECC-1EE3: O and o with diacritics that are not supported by the font and combination of multiple diacritics
82
+ * U+1EE4-1EF1: U and u with diacritics that are not supported by the font and combination of multiple diacritics
83
+ * U+1EF4-1EF7: Y and y with diacritics that are not supported by the font and combination of multiple diacritics
84
+ *
85
+ */
86
+ const overrideFontFaceCSS = `
87
+ @font-face {
88
+ font-family: '72override';
89
+ unicode-range: U+0102-0103, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EB7, U+1EB8-1EC7, U+1EC8-1ECB, U+1ECC-1EE3, U+1EE4-1EF1, U+1EF4-1EF7;
90
+ src: local('Arial'), local('Helvetica'), local('sans-serif');
62
91
  }
92
+ `;
63
93
 
64
- // If OpenUI5 is found, let it set the font
94
+ const insertFontFace = () => {
65
95
  const OpenUI5Support = getFeature("OpenUI5Support");
66
- if (OpenUI5Support && OpenUI5Support.isLoaded()) {
67
- return;
96
+
97
+ // Only set the main font if there is no OpenUI5 support, or there is, but OpenUI5 is not loaded
98
+ if (!OpenUI5Support || !OpenUI5Support.isLoaded()) {
99
+ insertMainFontFace();
68
100
  }
69
101
 
70
- createStyleInHead(fontFaceCSS, { "data-ui5-font-face": "" });
102
+ // Always set the override font - OpenUI5 in CSS Vars mode does not set it, unlike the main font
103
+ insertOverrideFontFace();
104
+ };
105
+
106
+ const insertMainFontFace = () => {
107
+ if (!document.querySelector(`head>style[data-ui5-font-face]`)) {
108
+ createStyleInHead(fontFaceCSS, { "data-ui5-font-face": "" });
109
+ }
110
+ };
111
+
112
+ const insertOverrideFontFace = () => {
113
+ if (!document.querySelector(`head>style[data-ui5-font-face-override]`)) {
114
+ createStyleInHead(overrideFontFaceCSS, { "data-ui5-font-face-override": "" });
115
+ }
71
116
  };
72
117
 
73
118
  export default insertFontFace;
@@ -12,8 +12,7 @@ let initialConfig = {
12
12
  calendarType: null,
13
13
  noConflict: false, // no URL
14
14
  formatSettings: {},
15
- useDefaultLanguage: false,
16
- assetsPath: "",
15
+ fetchDefaultLanguage: false,
17
16
  };
18
17
 
19
18
  /* General settings */
@@ -38,13 +37,13 @@ const getLanguage = () => {
38
37
  };
39
38
 
40
39
  /**
41
- * Returns if the default language, that is inlined build time,
42
- * should be used, instead of trying fetching the language over the network.
40
+ * Returns if the default language, that is inlined at build time,
41
+ * should be fetched over the network instead.
43
42
  * @returns {Boolean}
44
43
  */
45
- const getUseDefaultLanguage = () => {
44
+ const getFetchDefaultLanguage = () => {
46
45
  initConfiguration();
47
- return initialConfig.useDefaultLanguage;
46
+ return initialConfig.fetchDefaultLanguage;
48
47
  };
49
48
 
50
49
  const getNoConflict = () => {
@@ -62,11 +61,6 @@ const getFormatSettings = () => {
62
61
  return initialConfig.formatSettings;
63
62
  };
64
63
 
65
- const getAssetsPath = () => {
66
- initConfiguration();
67
- return initialConfig.assetsPath;
68
- };
69
-
70
64
  const booleanMapping = new Map();
71
65
  booleanMapping.set("true", true);
72
66
  booleanMapping.set("false", false);
@@ -92,23 +86,36 @@ const parseConfigurationScript = () => {
92
86
  const parseURLParameters = () => {
93
87
  const params = new URLSearchParams(window.location.search);
94
88
 
89
+ // Process "sap-*" params first
95
90
  params.forEach((value, key) => {
96
- if (!key.startsWith("sap-ui")) {
91
+ const parts = key.split("sap-").length;
92
+ if (parts === 0 || parts === key.split("sap-ui-").length) {
97
93
  return;
98
94
  }
99
95
 
100
- const lowerCaseValue = value.toLowerCase();
101
-
102
- const param = key.split("sap-ui-")[1];
96
+ applyURLParam(key, value, "sap");
97
+ });
103
98
 
104
- if (booleanMapping.has(value)) {
105
- value = booleanMapping.get(lowerCaseValue);
99
+ // Process "sap-ui-*" params
100
+ params.forEach((value, key) => {
101
+ if (!key.startsWith("sap-ui")) {
102
+ return;
106
103
  }
107
104
 
108
- initialConfig[param] = value;
105
+ applyURLParam(key, value, "sap-ui");
109
106
  });
110
107
  };
111
108
 
109
+ const applyURLParam = (key, value, paramType) => {
110
+ const lowerCaseValue = value.toLowerCase();
111
+ const param = key.split(`${paramType}-`)[1];
112
+
113
+ if (booleanMapping.has(value)) {
114
+ value = booleanMapping.get(lowerCaseValue);
115
+ }
116
+ initialConfig[param] = value;
117
+ };
118
+
112
119
  const applyOpenUI5Configuration = () => {
113
120
  const OpenUI5Support = getFeature("OpenUI5Support");
114
121
  if (!OpenUI5Support || !OpenUI5Support.isLoaded()) {
@@ -119,7 +126,6 @@ const applyOpenUI5Configuration = () => {
119
126
  initialConfig = merge(initialConfig, OpenUI5Config);
120
127
  };
121
128
 
122
-
123
129
  const initConfiguration = () => {
124
130
  if (initialized) {
125
131
  return;
@@ -142,9 +148,8 @@ export {
142
148
  getTheme,
143
149
  getRTL,
144
150
  getLanguage,
145
- getUseDefaultLanguage,
151
+ getFetchDefaultLanguage,
146
152
  getNoConflict,
147
153
  getCalendarType,
148
154
  getFormatSettings,
149
- getAssetsPath,
150
155
  };
package/dist/Keys.js CHANGED
@@ -105,8 +105,12 @@ const KeyCodes = {
105
105
 
106
106
  const isEnter = event => (event.key ? event.key === "Enter" : event.keyCode === KeyCodes.ENTER) && !hasModifierKeys(event);
107
107
 
108
+ const isEnterShift = event => (event.key ? event.key === "Enter" : event.keyCode === KeyCodes.ENTER) && checkModifierKeys(event, false, false, true);
109
+
108
110
  const isSpace = event => (event.key ? (event.key === "Spacebar" || event.key === " ") : event.keyCode === KeyCodes.SPACE) && !hasModifierKeys(event);
109
111
 
112
+ const isSpaceShift = event => (event.key ? (event.key === "Spacebar" || event.key === " ") : event.keyCode === KeyCodes.SPACE) && checkModifierKeys(event, false, false, true);
113
+
110
114
  const isLeft = event => (event.key ? (event.key === "ArrowLeft" || event.key === "Left") : event.keyCode === KeyCodes.ARROW_LEFT) && !hasModifierKeys(event);
111
115
 
112
116
  const isRight = event => (event.key ? (event.key === "ArrowRight" || event.key === "Right") : event.keyCode === KeyCodes.ARROW_RIGHT) && !hasModifierKeys(event);
@@ -115,6 +119,26 @@ const isUp = event => (event.key ? (event.key === "ArrowUp" || event.key === "Up
115
119
 
116
120
  const isDown = event => (event.key ? (event.key === "ArrowDown" || event.key === "Down") : event.keyCode === KeyCodes.ARROW_DOWN) && !hasModifierKeys(event);
117
121
 
122
+ const isLeftCtrl = event => (event.key ? (event.key === "ArrowLeft" || event.key === "Left") : event.keyCode === KeyCodes.ARROW_LEFT) && checkModifierKeys(event, true, false, false);
123
+
124
+ const isRightCtrl = event => (event.key ? (event.key === "ArrowRight" || event.key === "Right") : event.keyCode === KeyCodes.ARROW_RIGHT) && checkModifierKeys(event, true, false, false);
125
+
126
+ const isUpCtrl = event => (event.key ? (event.key === "ArrowUp" || event.key === "Up") : event.keyCode === KeyCodes.ARROW_UP) && checkModifierKeys(event, true, false, false);
127
+
128
+ const isDownCtrl = event => (event.key ? (event.key === "ArrowDown" || event.key === "Down") : event.keyCode === KeyCodes.ARROW_DOWN) && checkModifierKeys(event, true, false, false);
129
+
130
+ const isUpShift = event => (event.key ? (event.key === "ArrowUp" || event.key === "Up") : event.keyCode === KeyCodes.ARROW_UP) && checkModifierKeys(event, false, false, true);
131
+
132
+ const isDownShift = event => (event.key ? (event.key === "ArrowDown" || event.key === "Down") : event.keyCode === KeyCodes.ARROW_DOWN) && checkModifierKeys(event, false, false, true);
133
+
134
+ const isLeftShift = event => (event.key ? (event.key === "ArrowLeft" || event.key === "Left") : event.keyCode === KeyCodes.ARROW_LEFT) && checkModifierKeys(event, false, false, true);
135
+
136
+ const isRightShift = event => (event.key ? (event.key === "ArrowRight" || event.key === "Right") : event.keyCode === KeyCodes.ARROW_RIGHT) && checkModifierKeys(event, false, false, true);
137
+
138
+ const isUpShiftCtrl = event => (event.key ? (event.key === "ArrowUp" || event.key === "Up") : event.keyCode === KeyCodes.ARROW_UP) && checkModifierKeys(event, true, false, true);
139
+
140
+ const isDownShiftCtrl = event => (event.key ? (event.key === "ArrowDown" || event.key === "Down") : event.keyCode === KeyCodes.ARROW_DOWN) && checkModifierKeys(event, true, false, true);
141
+
118
142
  const isHome = event => (event.key ? event.key === "Home" : event.keyCode === KeyCodes.HOME) && !hasModifierKeys(event);
119
143
 
120
144
  const isEnd = event => (event.key ? event.key === "End" : event.keyCode === KeyCodes.END) && !hasModifierKeys(event);
@@ -139,12 +163,20 @@ const isPageDown = event => (event.key ? event.key === "PageDown" : event.keyCod
139
163
 
140
164
  const isPageUpShift = event => (event.key ? event.key === "PageUp" : event.keyCode === KeyCodes.PAGE_UP) && checkModifierKeys(event, false, false, true);
141
165
 
166
+ const isPageUpAlt = event => (event.key ? event.key === "PageUp" : event.keyCode === KeyCodes.PAGE_UP) && checkModifierKeys(event, false, true, false);
167
+
142
168
  const isPageDownShift = event => (event.key ? event.key === "PageDown" : event.keyCode === KeyCodes.PAGE_DOWN) && checkModifierKeys(event, false, false, true);
143
169
 
170
+ const isPageDownAlt = event => (event.key ? event.key === "PageDown" : event.keyCode === KeyCodes.PAGE_DOWN) && checkModifierKeys(event, false, true, false);
171
+
144
172
  const isPageUpShiftCtrl = event => (event.key ? event.key === "PageUp" : event.keyCode === KeyCodes.PAGE_UP) && checkModifierKeys(event, true, false, true);
145
173
 
146
174
  const isPageDownShiftCtrl = event => (event.key ? event.key === "PageDown" : event.keyCode === KeyCodes.PAGE_DOWN) && checkModifierKeys(event, true, false, true);
147
175
 
176
+ const isPlus = event => (event.key ? event.key === "+" : event.keyCode === KeyCodes.PLUS) || (event.keyCode === KeyCodes.NUMPAD_PLUS && !hasModifierKeys(event));
177
+
178
+ const isMinus = event => (event.key ? event.key === "-" : event.keyCode === KeyCodes.MINUS) || (event.keyCode === KeyCodes.NUMPAD_MINUS && !hasModifierKeys(event));
179
+
148
180
  const isShow = event => {
149
181
  if (event.key) {
150
182
  return isF4(event) || isShowByArrows(event);
@@ -159,6 +191,8 @@ const isF4 = event => {
159
191
 
160
192
  const isF4Shift = event => (event.key ? event.key === "F4" : event.keyCode === KeyCodes.F4) && checkModifierKeys(event, false, false, true);
161
193
 
194
+ const isF7 = event => (event.key ? event.key === "F7" : event.keyCode === KeyCodes.F7) && !hasModifierKeys(event);
195
+
162
196
  const isShowByArrows = event => {
163
197
  return ((event.key === "ArrowDown" || event.key === "Down") || (event.key === "ArrowUp" || event.key === "Up")) && checkModifierKeys(event, /* Ctrl */ false, /* Alt */ true, /* Shift */ false);
164
198
  };
@@ -171,13 +205,27 @@ const checkModifierKeys = (event, bCtrlKey, bAltKey, bShiftKey) => event.shiftKe
171
205
 
172
206
  export {
173
207
  isEnter,
208
+ isEnterShift,
174
209
  isSpace,
210
+ isSpaceShift,
175
211
  isLeft,
176
212
  isRight,
177
213
  isUp,
178
214
  isDown,
215
+ isLeftCtrl,
216
+ isRightCtrl,
217
+ isUpCtrl,
218
+ isDownCtrl,
219
+ isUpShift,
220
+ isDownShift,
221
+ isLeftShift,
222
+ isRightShift,
223
+ isUpShiftCtrl,
224
+ isDownShiftCtrl,
179
225
  isHome,
180
226
  isEnd,
227
+ isPlus,
228
+ isMinus,
181
229
  isHomeCtrl,
182
230
  isEndCtrl,
183
231
  isEscape,
@@ -188,10 +236,13 @@ export {
188
236
  isShow,
189
237
  isF4,
190
238
  isF4Shift,
239
+ isF7,
191
240
  isPageUp,
192
241
  isPageDown,
193
242
  isPageUpShift,
243
+ isPageUpAlt,
194
244
  isPageDownShift,
245
+ isPageDownAlt,
195
246
  isPageUpShiftCtrl,
196
247
  isPageDownShiftCtrl,
197
248
  };
@@ -0,0 +1,109 @@
1
+ const querySets = {};
2
+
3
+ /**
4
+ * Initializes a screen width media query range set.
5
+ *
6
+ * This initialization step makes the range set ready to be used for one of the other functions in namespace <code>MediaRange</code>.
7
+ *
8
+ * A range set can be defined as shown in the following example:
9
+ * <pre>
10
+ * MediaRange.initRangeSet("MyRangeSet", [200, 400], ["Small", "Medium", "Large"]);
11
+ * </pre>
12
+ * This example defines the following named ranges:
13
+ * <ul>
14
+ * <li><code>"Small"</code>: For screens smaller than 200 pixels.</li>
15
+ * <li><code>"Medium"</code>: For screens greater than or equal to 200 pixels and smaller than 400 pixels.</li>
16
+ * <li><code>"Large"</code>: For screens greater than or equal to 400 pixels.</li>
17
+ * </ul>
18
+ *
19
+ * @param {string} name The name of the range set to be initialized.
20
+ * The name must be a valid id and consist only of letters and numeric digits.
21
+ *
22
+ * @param {int[]} [borders] The range borders
23
+ *
24
+ * @param {string[]} [names] The names of the ranges. The names must be a valid id and consist only of letters and digits.
25
+ *
26
+ * @name MediaRange.initRangeSet
27
+ * @function
28
+ * @public
29
+ */
30
+ const _initRangeSet = (name, borders, names) => {
31
+ querySets[name] = {
32
+ borders,
33
+ names,
34
+ };
35
+ };
36
+
37
+ /**
38
+ * Returns information about the current active range of the range set with the given name.
39
+ *
40
+ * If the optional parameter <code>width</code> is given, the active range will be determined for that width,
41
+ * otherwise it is determined for the current window size.
42
+ *
43
+ * @param {string} name The name of the range set. The range set must be initialized beforehand ({@link MediaRange.initRangeSet})
44
+ * @param {int} [width] An optional width, based on which the range should be determined;
45
+ * If <code>width</code> is not provided, the window size will be used.
46
+ * @returns {string} The name of the current active interval of the range set.
47
+ *
48
+ * @name MediaRange.getCurrentRange
49
+ * @function
50
+ * @public
51
+ */
52
+ const _getCurrentRange = (name, width = window.innerWidth) => {
53
+ const querySet = querySets[name];
54
+ let i = 0;
55
+
56
+ if (!querySet) {
57
+ return null;
58
+ }
59
+
60
+ for (; i < querySet.borders.length; i++) {
61
+ if (width < querySet.borders[i]) {
62
+ return querySet.names[i];
63
+ }
64
+ }
65
+
66
+ return querySet.names[i];
67
+ };
68
+
69
+ /**
70
+ * Enumeration containing the names and settings of predefined screen width media query range sets.
71
+ *
72
+ * @namespace
73
+ * @name MediaRange.RANGESETS
74
+ * @public
75
+ */
76
+ const RANGESETS = {
77
+ /**
78
+ * A 4-step range set (S-M-L-XL).
79
+ *
80
+ * The ranges of this set are:
81
+ * <ul>
82
+ * <li><code>"S"</code>: For screens smaller than 600 pixels.</li>
83
+ * <li><code>"M"</code>: For screens greater than or equal to 600 pixels and smaller than 1024 pixels.</li>
84
+ * <li><code>"L"</code>: For screens greater than or equal to 1024 pixels and smaller than 1440 pixels.</li>
85
+ * <li><code>"XL"</code>: For screens greater than or equal to 1440 pixels.</li>
86
+ * </ul>
87
+ *
88
+ * @name MediaRange.RANGESETS.RANGE_4STEPS
89
+ * @public
90
+ */
91
+ RANGE_4STEPS: "4Step",
92
+ };
93
+
94
+ /**
95
+ * API for screen width changes.
96
+ *
97
+ * @namespace
98
+ * @name MediaRange
99
+ */
100
+
101
+ const MediaRange = {
102
+ RANGESETS,
103
+ initRangeSet: _initRangeSet,
104
+ getCurrentRange: _getCurrentRange,
105
+ };
106
+
107
+ MediaRange.initRangeSet(MediaRange.RANGESETS.RANGE_4STEPS, [600, 1024, 1440], ["S", "M", "L", "XL"]);
108
+
109
+ export default MediaRange;
@@ -15,6 +15,12 @@ const mEscapes = {
15
15
  "\\t": "\t",
16
16
  };
17
17
 
18
+ /**
19
+ * Parses a .properties format
20
+ * @param {string} sText the contents a of a .properties file
21
+ * @returns a object with key/value pairs parsed from the .properties file format
22
+ * @public
23
+ */
18
24
  const parseProperties = sText => {
19
25
  const properties = {},
20
26
  aLines = sText.split(rLines);
package/dist/Render.js ADDED
@@ -0,0 +1,173 @@
1
+ import EventProvider from "./EventProvider.js";
2
+ import RenderQueue from "./RenderQueue.js";
3
+ import { getAllRegisteredTags } from "./CustomElementsRegistry.js";
4
+ import { isRtlAware } from "./locale/RTLAwareRegistry.js";
5
+
6
+ const registeredElements = new Set();
7
+ const eventProvider = new EventProvider();
8
+
9
+ const invalidatedWebComponents = new RenderQueue(); // Queue for invalidated web components
10
+
11
+ let renderTaskPromise,
12
+ renderTaskPromiseResolve;
13
+
14
+ let mutationObserverTimer;
15
+
16
+ let queuePromise;
17
+
18
+ /**
19
+ * Schedules a render task (if not already scheduled) to render the component
20
+ *
21
+ * @param webComponent
22
+ * @returns {Promise}
23
+ */
24
+ const renderDeferred = async webComponent => {
25
+ // Enqueue the web component
26
+ invalidatedWebComponents.add(webComponent);
27
+
28
+ // Schedule a rendering task
29
+ await scheduleRenderTask();
30
+ };
31
+
32
+ /**
33
+ * Renders a component synchronously and adds it to the registry of rendered components
34
+ *
35
+ * @param webComponent
36
+ */
37
+ const renderImmediately = webComponent => {
38
+ eventProvider.fireEvent("beforeComponentRender", webComponent);
39
+ registeredElements.add(webComponent);
40
+ webComponent._render();
41
+ };
42
+
43
+ /**
44
+ * Cancels the rendering of a component, if awaiting to be rendered, and removes it from the registry of rendered components
45
+ *
46
+ * @param webComponent
47
+ */
48
+ const cancelRender = webComponent => {
49
+ invalidatedWebComponents.remove(webComponent);
50
+ registeredElements.delete(webComponent);
51
+ };
52
+
53
+ /**
54
+ * Schedules a rendering task, if not scheduled already
55
+ */
56
+ const scheduleRenderTask = async () => {
57
+ if (!queuePromise) {
58
+ queuePromise = new Promise(resolve => {
59
+ window.requestAnimationFrame(() => {
60
+ // Render all components in the queue
61
+
62
+ // console.log(`--------------------RENDER TASK START------------------------------`); // eslint-disable-line
63
+ invalidatedWebComponents.process(renderImmediately);
64
+ // console.log(`--------------------RENDER TASK END------------------------------`); // eslint-disable-line
65
+
66
+ // Resolve the promise so that callers of renderDeferred can continue
67
+ queuePromise = null;
68
+ resolve();
69
+
70
+ // Wait for Mutation observer before the render task is considered finished
71
+ if (!mutationObserverTimer) {
72
+ mutationObserverTimer = setTimeout(() => {
73
+ mutationObserverTimer = undefined;
74
+ if (invalidatedWebComponents.isEmpty()) {
75
+ _resolveTaskPromise();
76
+ }
77
+ }, 200);
78
+ }
79
+ });
80
+ });
81
+ }
82
+
83
+ await queuePromise;
84
+ };
85
+
86
+ /**
87
+ * return a promise that will be resolved once all invalidated web components are rendered
88
+ */
89
+ const whenDOMUpdated = () => {
90
+ if (renderTaskPromise) {
91
+ return renderTaskPromise;
92
+ }
93
+
94
+ renderTaskPromise = new Promise(resolve => {
95
+ renderTaskPromiseResolve = resolve;
96
+ window.requestAnimationFrame(() => {
97
+ if (invalidatedWebComponents.isEmpty()) {
98
+ renderTaskPromise = undefined;
99
+ resolve();
100
+ }
101
+ });
102
+ });
103
+
104
+ return renderTaskPromise;
105
+ };
106
+
107
+ const whenAllCustomElementsAreDefined = () => {
108
+ const definedPromises = getAllRegisteredTags().map(tag => customElements.whenDefined(tag));
109
+ return Promise.all(definedPromises);
110
+ };
111
+
112
+ const renderFinished = async () => {
113
+ await whenAllCustomElementsAreDefined();
114
+ await whenDOMUpdated();
115
+ };
116
+
117
+ const _resolveTaskPromise = () => {
118
+ if (!invalidatedWebComponents.isEmpty()) {
119
+ // More updates are pending. Resolve will be called again
120
+ return;
121
+ }
122
+
123
+ if (renderTaskPromiseResolve) {
124
+ renderTaskPromiseResolve();
125
+ renderTaskPromiseResolve = undefined;
126
+ renderTaskPromise = undefined;
127
+ }
128
+ };
129
+
130
+ /**
131
+ * Re-renders all UI5 Elements on the page, with the option to specify filters to rerender only some components.
132
+ *
133
+ * Usage:
134
+ * reRenderAllUI5Elements() -> re-renders all components
135
+ * reRenderAllUI5Elements({tag: "ui5-button"}) -> re-renders only instances of ui5-button
136
+ * reRenderAllUI5Elements({rtlAware: true}) -> re-renders only rtlAware components
137
+ * reRenderAllUI5Elements({languageAware: true}) -> re-renders only languageAware components
138
+ * reRenderAllUI5Elements({rtlAware: true, languageAware: true}) -> re-renders components that are rtlAware or languageAware
139
+ * etc...
140
+ *
141
+ * @public
142
+ * @param {Object|undefined} filters - Object with keys that can be "rtlAware" or "languageAware"
143
+ * @returns {Promise<void>}
144
+ */
145
+ const reRenderAllUI5Elements = async filters => {
146
+ registeredElements.forEach(element => {
147
+ const tag = element.constructor.getMetadata().getTag();
148
+ const rtlAware = isRtlAware(element.constructor);
149
+ const languageAware = element.constructor.getMetadata().isLanguageAware();
150
+ if (!filters || (filters.tag === tag) || (filters.rtlAware && rtlAware) || (filters.languageAware && languageAware)) {
151
+ renderDeferred(element);
152
+ }
153
+ });
154
+ await renderFinished();
155
+ };
156
+
157
+ const attachBeforeComponentRender = listener => {
158
+ eventProvider.attachEvent("beforeComponentRender", listener);
159
+ };
160
+
161
+ const detachBeforeComponentRender = listener => {
162
+ eventProvider.detachEvent("beforeComponentRender", listener);
163
+ };
164
+
165
+ export {
166
+ renderDeferred,
167
+ renderImmediately,
168
+ cancelRender,
169
+ renderFinished,
170
+ reRenderAllUI5Elements,
171
+ attachBeforeComponentRender,
172
+ detachBeforeComponentRender,
173
+ };