@ui5/webcomponents-base 0.32.0 → 1.0.0-rc.16

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 (143) hide show
  1. package/.eslintignore +3 -1
  2. package/CHANGELOG.md +35 -0
  3. package/README.md +26 -2
  4. package/bundle.esm.js +6 -2
  5. package/dist/CSP.js +59 -0
  6. package/dist/Device.js +7 -0
  7. package/dist/EventProvider.js +19 -25
  8. package/dist/FontFace.js +7 -95
  9. package/dist/InitialConfiguration.js +31 -14
  10. package/dist/Keys.js +15 -0
  11. package/dist/ManagedStyles.js +83 -0
  12. package/dist/Render.js +3 -1
  13. package/dist/StaticAreaItem.js +27 -10
  14. package/dist/SystemCSSVars.js +4 -25
  15. package/dist/UI5Element.js +48 -62
  16. package/dist/UI5ElementMetadata.js +9 -1
  17. package/dist/asset-registries/Icons.js +29 -8
  18. package/dist/asset-registries/Illustrations.js +30 -0
  19. package/dist/asset-registries/LocaleData.js +11 -2
  20. package/dist/assets-meta/IconCollectionsAlias.js +18 -0
  21. package/dist/config/Theme.js +14 -0
  22. package/dist/css/FontFace.css +45 -0
  23. package/dist/css/OverrideFontFace.css +32 -0
  24. package/dist/css/SystemCSSVars.css +17 -0
  25. package/dist/delegate/ItemNavigation.js +66 -0
  26. package/dist/delegate/ScrollEnablement.js +7 -1
  27. package/dist/generated/AssetParameters.js +1 -1
  28. package/dist/generated/css/FontFace.css.js +5 -0
  29. package/dist/generated/css/OverrideFontFace.css.js +5 -0
  30. package/dist/generated/css/SystemCSSVars.css.js +5 -0
  31. package/dist/i18nBundle.js +36 -2
  32. package/dist/renderer/LitRenderer.js +24 -21
  33. package/dist/renderer/directives/style-map.js +72 -0
  34. package/dist/resources/bundle.esm.js +17 -101
  35. package/dist/resources/bundle.esm.js.map +1 -1
  36. package/dist/sap/base/Log.js +241 -0
  37. package/dist/sap/base/assert.js +8 -0
  38. package/dist/sap/base/security/URLListValidator.js +148 -0
  39. package/dist/sap/base/security/sanitizeHTML.js +16 -0
  40. package/dist/sap/base/util/now.js +7 -0
  41. package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +3585 -0
  42. package/dist/test-resources/elements/WithStaticArea.js +2 -1
  43. package/dist/test-resources/pages/AllTestElements.html +3 -0
  44. package/dist/test-resources/pages/i18n.html +1 -3
  45. package/dist/test-resources/specs/ConfigurationChange.spec.js +9 -9
  46. package/dist/test-resources/specs/ConfigurationScript.spec.js +24 -24
  47. package/dist/test-resources/specs/ConfigurationURL.spec.js +64 -18
  48. package/dist/test-resources/specs/CustomTheme.spec.js +7 -7
  49. package/dist/test-resources/specs/EventProvider.spec.js +63 -0
  50. package/dist/test-resources/specs/StaticArea.spec.js +55 -13
  51. package/dist/test-resources/specs/Theming.spec.js +11 -11
  52. package/dist/test-resources/specs/UI5ElementInvalidation.js +29 -29
  53. package/dist/test-resources/specs/UI5ElementLifecycle.js +11 -11
  54. package/dist/test-resources/specs/UI5ElementListenForChildPropChanges.spec.js +11 -11
  55. package/dist/test-resources/specs/UI5ElementMetadataExt.js +8 -8
  56. package/dist/test-resources/specs/UI5ElementPropertyValidation.js +6 -6
  57. package/dist/test-resources/specs/UI5ElementPropsAndAttrs.spec.js +36 -36
  58. package/dist/test-resources/specs/UI5ElementShadowDOM.js +9 -9
  59. package/dist/test-resources/specs/UI5ElementSlots.js +9 -9
  60. package/dist/theming/applyTheme.js +5 -8
  61. package/dist/theming/getEffectiveLinksHrefs.js +20 -0
  62. package/dist/theming/getStylesString.js +4 -2
  63. package/dist/theming/getThemeDesignerTheme.js +2 -1
  64. package/dist/theming/preloadLinks.js +23 -0
  65. package/dist/types/DataType.js +12 -0
  66. package/dist/types/Float.js +4 -0
  67. package/dist/types/Integer.js +4 -0
  68. package/dist/types/InvisibleMessageMode.js +30 -0
  69. package/dist/updateShadowRoot.js +8 -4
  70. package/dist/util/AriaLabelHelper.js +4 -4
  71. package/dist/util/FocusableElements.js +5 -1
  72. package/dist/util/HTMLSanitizer.js +7 -0
  73. package/dist/util/InvisibleMessage.js +58 -0
  74. package/dist/util/PopupUtils.js +1 -1
  75. package/dist/util/TabbableElements.js +1 -1
  76. package/dist/util/createLinkInHead.js +19 -0
  77. package/dist/util/encodeXML.js +35 -0
  78. package/dist/util/escapeRegex.js +10 -0
  79. package/dist/util/generateHighlightedMarkup.js +42 -0
  80. package/dist/util/getClassCopy.js +7 -2
  81. package/dist/util/isNodeTabbable.js +4 -4
  82. package/hash.txt +1 -1
  83. package/index.js +1 -1
  84. package/lib/generate-asset-parameters/index.js +0 -1
  85. package/lib/generate-styles/index.js +18 -0
  86. package/package-scripts.js +25 -3
  87. package/package.json +16 -8
  88. package/src/CSP.js +59 -0
  89. package/src/Device.js +7 -0
  90. package/src/EventProvider.js +19 -25
  91. package/src/FontFace.js +7 -95
  92. package/src/InitialConfiguration.js +31 -14
  93. package/src/Keys.js +15 -0
  94. package/src/ManagedStyles.js +83 -0
  95. package/src/Render.js +3 -1
  96. package/src/StaticAreaItem.js +27 -10
  97. package/src/SystemCSSVars.js +4 -25
  98. package/src/UI5Element.js +48 -62
  99. package/src/UI5ElementMetadata.js +9 -1
  100. package/src/asset-registries/Icons.js +29 -8
  101. package/src/asset-registries/Illustrations.js +30 -0
  102. package/src/asset-registries/LocaleData.js +11 -2
  103. package/src/assets-meta/IconCollectionsAlias.js +18 -0
  104. package/src/config/Theme.js +14 -0
  105. package/src/css/FontFace.css +45 -0
  106. package/src/css/OverrideFontFace.css +32 -0
  107. package/src/css/SystemCSSVars.css +17 -0
  108. package/src/delegate/ItemNavigation.js +66 -0
  109. package/src/delegate/ScrollEnablement.js +7 -1
  110. package/src/i18nBundle.js +36 -2
  111. package/src/renderer/LitRenderer.js +24 -21
  112. package/src/renderer/directives/style-map.js +72 -0
  113. package/src/theming/applyTheme.js +5 -8
  114. package/src/theming/getEffectiveLinksHrefs.js +20 -0
  115. package/src/theming/getStylesString.js +4 -2
  116. package/src/theming/getThemeDesignerTheme.js +2 -1
  117. package/src/theming/preloadLinks.js +23 -0
  118. package/src/types/DataType.js +12 -0
  119. package/src/types/Float.js +4 -0
  120. package/src/types/Integer.js +4 -0
  121. package/src/types/InvisibleMessageMode.js +30 -0
  122. package/src/updateShadowRoot.js +8 -4
  123. package/src/util/AriaLabelHelper.js +4 -4
  124. package/src/util/FocusableElements.js +5 -1
  125. package/src/util/HTMLSanitizer.js +7 -0
  126. package/src/util/InvisibleMessage.js +58 -0
  127. package/src/util/PopupUtils.js +1 -1
  128. package/src/util/TabbableElements.js +1 -1
  129. package/src/util/createLinkInHead.js +19 -0
  130. package/src/util/encodeXML.js +35 -0
  131. package/src/util/escapeRegex.js +10 -0
  132. package/src/util/generateHighlightedMarkup.js +42 -0
  133. package/src/util/getClassCopy.js +7 -2
  134. package/src/util/isNodeTabbable.js +4 -4
  135. package/used-modules.txt +7 -0
  136. package/dist/config/AssetsPath.js +0 -17
  137. package/dist/renderer/ifDefined.js +0 -21
  138. package/dist/renderer/scopeHTML.js +0 -32
  139. package/dist/theming/createThemePropertiesStyleTag.js +0 -20
  140. package/src/config/AssetsPath.js +0 -17
  141. package/src/renderer/ifDefined.js +0 -21
  142. package/src/renderer/scopeHTML.js +0 -32
  143. package/src/theming/createThemePropertiesStyleTag.js +0 -20
package/.eslintignore CHANGED
@@ -1,6 +1,7 @@
1
1
  # Note: Changes to this file also must be applied to the top level .eslintignore file.
2
2
  test
3
3
  lib
4
+ overlay
4
5
  dist
5
6
  src/thirdparty
6
7
  bundle.esm.js
@@ -9,4 +10,5 @@ rollup.config*.js
9
10
  wdio.conf.js
10
11
  postcss.config.js
11
12
  package-scripts.js
12
- .eslintrc.js
13
+ .eslintrc.js
14
+ src/renderer/directives/style-map.js
package/CHANGELOG.md CHANGED
@@ -3,6 +3,41 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-rc.16](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.15...v1.0.0-rc.16) (2021-11-09)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **framework:** apply RTL for components with popovers ([#3657](https://github.com/SAP/ui5-webcomponents/issues/3657)) ([28e868b](https://github.com/SAP/ui5-webcomponents/commit/28e868b))
12
+ * **framework:** Multiple properties have no attribute ([#3725](https://github.com/SAP/ui5-webcomponents/issues/3725)) ([2548935](https://github.com/SAP/ui5-webcomponents/commit/2548935))
13
+ * **framework:** removing the base theme works with adopted stylesheets ([#4158](https://github.com/SAP/ui5-webcomponents/issues/4158)) ([aa1f594](https://github.com/SAP/ui5-webcomponents/commit/aa1f594))
14
+ * **framework:** detach events correctly to prevent memory leaks ([#3941](https://github.com/SAP/ui5-webcomponents/issues/3941)) ([6c877ee](https://github.com/SAP/ui5-webcomponents/commit/6c877ee))
15
+
16
+
17
+ ### Features
18
+
19
+ * **framework:** add SAP-icons5.0 ([#4244](https://github.com/SAP/ui5-webcomponents/issues/4244)) ([c0a226e](https://github.com/SAP/ui5-webcomponents/commit/c0a226e))
20
+ * rework stableDomRef concept ([#4210](https://github.com/SAP/ui5-webcomponents/issues/4210)) ([d1ebea3](https://github.com/SAP/ui5-webcomponents/commit/d1ebea3))
21
+ * **framework:** allow using a custom i18n library ([#4119](https://github.com/SAP/ui5-webcomponents/issues/4119)) ([56f366f](https://github.com/SAP/ui5-webcomponents/commit/56f366f))
22
+ * **framework:** Implement better custom theme support ([#4121](https://github.com/SAP/ui5-webcomponents/issues/4121)) ([31e30f8](https://github.com/SAP/ui5-webcomponents/commit/31e30f8))
23
+ * **framework:** handle Page UP/DOWN ([#3727](https://github.com/SAP/ui5-webcomponents/issues/3727)) ([91a974f](https://github.com/SAP/ui5-webcomponents/commit/91a974f))
24
+ * **framework:** introduce sap_horizon theme initial draft ([#3991](https://github.com/SAP/ui5-webcomponents/issues/3991)) ([b1afaf0](https://github.com/SAP/ui5-webcomponents/commit/b1afaf0)), closes [#3988](https://github.com/SAP/ui5-webcomponents/issues/3988)
25
+ * **framework:** load "72Black" font face ([#4139](https://github.com/SAP/ui5-webcomponents/issues/4139)) ([2be7869](https://github.com/SAP/ui5-webcomponents/commit/2be7869))
26
+
27
+
28
+
29
+
30
+
31
+ # [1.0.0-rc.15](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.14...v1.0.0-rc.15) (2021-07-23)
32
+
33
+
34
+ ### Features
35
+
36
+ * **framework:** expose dist paths as root paths via package.json export field ([#3274](https://github.com/SAP/ui5-webcomponents/issues/3274)) ([bd34a5e](https://github.com/SAP/ui5-webcomponents/commit/bd34a5e))
37
+ * **framework:** support sap-* config URL params ([#3138](https://github.com/SAP/ui5-webcomponents/issues/3138)) ([5d9cdb9](https://github.com/SAP/ui5-webcomponents/commit/5d9cdb9)), closes [#3114](https://github.com/SAP/ui5-webcomponents/issues/3114)
38
+ * **framework:** introduce InvisibleMessage util ([#3192](https://github.com/SAP/ui5-webcomponents/issues/3192)) ([0a33c40](https://github.com/SAP/ui5-webcomponents/commit/0a33c40))
39
+
40
+
6
41
  # [1.0.0-rc.13](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.12...v1.0.0-rc.13) (2021-03-26)
7
42
 
8
43
 
package/README.md CHANGED
@@ -7,7 +7,31 @@
7
7
 
8
8
  Contains the base files for all Web Components, most notably `@ui5/webcomponents-base/dist/UI5Element.js`.
9
9
 
10
- For a complete list of all app development related public module imports from the `base` package, click [here](../../docs/Public%20Module%20Imports.md#base):
10
+ ## Provided APIs for applications
11
+
12
+ ### `Boot.js`
13
+
14
+ - `attachBoot`
15
+
16
+ ### `CustomElementsScope.js`
17
+
18
+ - `setCustomElementsScopingSuffix`
19
+ - `getCustomElementsScopingSuffix`
20
+ - `setCustomElementsScopingRules`
21
+ - `getCustomElementsScopingRules`
22
+
23
+ ### `i18nBundle.js`
24
+
25
+ - `registerI18nLoader`
26
+ - `getI18nBundle`
27
+
28
+ ### `PropertiesFileFormat.js`
29
+
30
+ - `parseProperties`
31
+
32
+ ### `Render.js`
33
+
34
+ - `renderFinished`
11
35
 
12
36
  ## Resources
13
37
  - [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/master/README.md)
@@ -18,7 +42,7 @@ For a complete list of all app development related public module imports from th
18
42
  We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/master/SUPPORT.md#-content) on how to report an issue, or chat with us in the `#webcomponents` channel of the [OpenUI5 Community Slack](https://join-ui5-slack.herokuapp.com/).
19
43
 
20
44
  ## Contribute
21
- Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/master/CONTRIBUTING.md).
45
+ Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/master/docs/6-contributing/02-conventions-and-guidelines.md).
22
46
 
23
47
  ## License
24
48
  Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
package/bundle.esm.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { registerThemePropertiesLoader } from "./dist/AssetRegistry.js";
2
+ import EventProvider from "./dist/EventProvider.js";
2
3
 
3
4
  // ESM bundle targets browsers with native support
4
5
  import "./dist/features/OpenUI5Support.js";
@@ -23,7 +24,7 @@ window.isIE = isIE; // attached to the window object for testing purposes
23
24
  window.registerThemePropertiesLoader = registerThemePropertiesLoader;
24
25
 
25
26
  // i18n
26
- import { registerI18nLoader, fetchI18nBundle, getI18nBundle } from "./dist/i18nBundle.js";
27
+ import { registerI18nLoader, getI18nBundle } from "./dist/i18nBundle.js";
27
28
 
28
29
  // Note: keep in sync with rollup.config value for IIFE
29
30
  import { getAnimationMode } from "./dist/config/AnimationMode.js";
@@ -34,6 +35,8 @@ import { getNoConflict, setNoConflict } from "./dist/config/NoConflict.js";
34
35
  import { getRTL } from "./dist/config/RTL.js";
35
36
  import { getFirstDayOfWeek } from "./dist/config/FormatSettings.js";
36
37
  import { _getRegisteredNames as getIconNames } from "./dist/asset-registries/Icons.js"
38
+ import applyDirection from "./dist/locale/applyDirection.js";
39
+
37
40
  window["sap-ui-webcomponents-bundle"] = {
38
41
  configuration : {
39
42
  getAnimationMode,
@@ -48,7 +51,8 @@ window["sap-ui-webcomponents-bundle"] = {
48
51
  },
49
52
  getIconNames,
50
53
  registerI18nLoader,
51
- fetchI18nBundle,
52
54
  getI18nBundle,
53
55
  renderFinished,
56
+ applyDirection,
57
+ EventProvider,
54
58
  };
package/dist/CSP.js ADDED
@@ -0,0 +1,59 @@
1
+ const roots = new Map();
2
+ let useLinks = false;
3
+ let preloadLinks = true;
4
+
5
+ /**
6
+ * Use this function to provide the path to the directory where the css resources for the given package will be served from
7
+ *
8
+ * @public
9
+ * @param packageName name of the package that is being configured
10
+ * @param root path, accessible by the server that will serve the css resources
11
+ */
12
+ const setPackageCSSRoot = (packageName, root) => {
13
+ roots.set(packageName, root);
14
+ };
15
+
16
+ const getUrl = (packageName, path) => {
17
+ return `${roots.get(packageName)}${path}`;
18
+ };
19
+
20
+ /**
21
+ * Call this function to enable or disable the usage of <link> tags instead of <style> tags to achieve CSP compliance
22
+ * Example: "setUseLinks(true)" will unconditionally use <link> tags for all browsers;
23
+ * Example: "setUseLinks(!document.adoptedStyleSheets) will only enable the usage of <link> tags for browsers that do not support constructable stylesheets.
24
+ *
25
+ * @public
26
+ * @param use whether links will be used
27
+ */
28
+ const setUseLinks = use => {
29
+ useLinks = use;
30
+ };
31
+
32
+ /**
33
+ * Call this function to enable or disable the preloading of <link> tags.
34
+ * Note: only taken into account when <link> tags are being used.
35
+ * Note: links are being preloaded by default, so call "setPreloadLinks(false)" to opt out of this.
36
+ *
37
+ * @public
38
+ * @param preload
39
+ */
40
+ const setPreloadLinks = preload => {
41
+ preloadLinks = preload;
42
+ };
43
+
44
+ const shouldUseLinks = () => {
45
+ return useLinks;
46
+ };
47
+
48
+ const shouldPreloadLinks = () => {
49
+ return preloadLinks;
50
+ };
51
+
52
+ export {
53
+ setPackageCSSRoot,
54
+ getUrl,
55
+ setUseLinks,
56
+ setPreloadLinks,
57
+ shouldUseLinks,
58
+ shouldPreloadLinks,
59
+ };
package/dist/Device.js CHANGED
@@ -75,6 +75,7 @@ const detectTablet = () => {
75
75
  const supportsTouch = () => touch;
76
76
  const isIE = () => ie;
77
77
  const isSafari = () => safari;
78
+ const isChrome = () => chrome;
78
79
 
79
80
  const isTablet = () => {
80
81
  detectTablet();
@@ -90,11 +91,17 @@ const isDesktop = () => {
90
91
  return (!isTablet() && !isPhone()) || isWindows8OrAbove();
91
92
  };
92
93
 
94
+ const isCombi = () => {
95
+ return isTablet() && isDesktop();
96
+ };
97
+
93
98
  export {
94
99
  supportsTouch,
95
100
  isIE,
96
101
  isSafari,
102
+ isChrome,
97
103
  isPhone,
98
104
  isTablet,
99
105
  isDesktop,
106
+ isCombi,
100
107
  };
@@ -1,36 +1,37 @@
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
 
@@ -43,14 +44,14 @@ class EventProvider {
43
44
  */
44
45
  fireEvent(eventName, data) {
45
46
  const eventRegistry = this._eventRegistry;
46
- const eventListeners = eventRegistry[eventName];
47
+ const eventListeners = eventRegistry.get(eventName);
47
48
 
48
49
  if (!eventListeners) {
49
50
  return [];
50
51
  }
51
52
 
52
- return eventListeners.map(event => {
53
- return event["function"].call(this, data); // eslint-disable-line
53
+ return eventListeners.map(fn => {
54
+ return fn.call(this, data); // eslint-disable-line
54
55
  });
55
56
  }
56
57
 
@@ -67,24 +68,17 @@ class EventProvider {
67
68
 
68
69
  isHandlerAttached(eventName, fnFunction) {
69
70
  const eventRegistry = this._eventRegistry;
70
- const eventListeners = eventRegistry[eventName];
71
+ const eventListeners = eventRegistry.get(eventName);
71
72
 
72
73
  if (!eventListeners) {
73
74
  return false;
74
75
  }
75
76
 
76
- for (let i = 0; i < eventListeners.length; i++) {
77
- const event = eventListeners[i];
78
- if (event["function"] === fnFunction) { // eslint-disable-line
79
- return true;
80
- }
81
- }
82
-
83
- return false;
77
+ return eventListeners.includes(fnFunction);
84
78
  }
85
79
 
86
80
  hasListeners(eventName) {
87
- return !!this._eventRegistry[eventName];
81
+ return !!this._eventRegistry.get(eventName);
88
82
  }
89
83
  }
90
84
 
package/dist/FontFace.js CHANGED
@@ -1,95 +1,7 @@
1
- /**
2
- * CSS font face used for the texts provided by SAP.
3
- */
4
- import createStyleInHead from "./util/createStyleInHead.js";
1
+ import { hasStyle, createStyle } from "./ManagedStyles.js";
5
2
  import { getFeature } from "./FeaturesRegistry.js";
6
-
7
- /* CDN Locations */
8
- const font72RegularWoff = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular.woff?ui5-webcomponents`;
9
- const font72RegularWoff2 = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular.woff2?ui5-webcomponents`;
10
-
11
- const font72RegularFullWoff = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular-full.woff?ui5-webcomponents`;
12
- const font72RegularFullWoff2 = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular-full.woff2?ui5-webcomponents`;
13
-
14
- const font72BoldWoff = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff?ui5-webcomponents`;
15
- const font72BoldWoff2 = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff2?ui5-webcomponents`;
16
-
17
- const font72BoldFullWoff = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff?ui5-webcomponents`;
18
- const font72BoldFullWoff2 = `https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff2?ui5-webcomponents`;
19
-
20
- const fontFaceCSS = `
21
- @font-face {
22
- font-family: "72";
23
- font-style: normal;
24
- font-weight: 400;
25
- src: local("72"),
26
- url(${font72RegularWoff2}) format("woff2"),
27
- url(${font72RegularWoff}) format("woff");
28
- }
29
-
30
- @font-face {
31
- font-family: "72full";
32
- font-style: normal;
33
- font-weight: 400;
34
- src: local('72-full'),
35
- url(${font72RegularFullWoff2}) format("woff2"),
36
- url(${font72RegularFullWoff}) format("woff");
37
-
38
- }
39
-
40
- @font-face {
41
- font-family: "72";
42
- font-style: normal;
43
- font-weight: 700;
44
- src: local('72-Bold'),
45
- url(${font72BoldWoff2}) format("woff2"),
46
- url(${font72BoldWoff}) format("woff");
47
- }
48
-
49
- @font-face {
50
- font-family: "72full";
51
- font-style: normal;
52
- font-weight: 700;
53
- src: local('72-Bold-full'),
54
- url(${font72BoldFullWoff2}) format("woff2"),
55
- url(${font72BoldFullWoff}) format("woff");
56
- }
57
- `;
58
-
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');
91
- }
92
- `;
3
+ import fontFaceCSS from "./generated/css/FontFace.css.js";
4
+ import overrideFontFaceCSS from "./generated/css/OverrideFontFace.css.js";
93
5
 
94
6
  const insertFontFace = () => {
95
7
  const OpenUI5Support = getFeature("OpenUI5Support");
@@ -104,14 +16,14 @@ const insertFontFace = () => {
104
16
  };
105
17
 
106
18
  const insertMainFontFace = () => {
107
- if (!document.querySelector(`head>style[data-ui5-font-face]`)) {
108
- createStyleInHead(fontFaceCSS, { "data-ui5-font-face": "" });
19
+ if (!hasStyle("data-ui5-font-face")) {
20
+ createStyle(fontFaceCSS, "data-ui5-font-face");
109
21
  }
110
22
  };
111
23
 
112
24
  const insertOverrideFontFace = () => {
113
- if (!document.querySelector(`head>style[data-ui5-font-face-override]`)) {
114
- createStyleInHead(overrideFontFaceCSS, { "data-ui5-font-face-override": "" });
25
+ if (!hasStyle("data-ui5-font-face-override")) {
26
+ createStyle(overrideFontFaceCSS, "data-ui5-font-face-override");
115
27
  }
116
28
  };
117
29
 
@@ -13,7 +13,6 @@ let initialConfig = {
13
13
  noConflict: false, // no URL
14
14
  formatSettings: {},
15
15
  fetchDefaultLanguage: false,
16
- assetsPath: "",
17
16
  };
18
17
 
19
18
  /* General settings */
@@ -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,47 @@ 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 normalizeParamValue = (param, value) => {
110
+ if (param === "theme" && value.includes("@")) { // the theme parameter might have @<URL-TO-THEME> in the value - strip this
111
+ return value.split("@")[0];
112
+ }
113
+
114
+ return value;
115
+ };
116
+
117
+ const applyURLParam = (key, value, paramType) => {
118
+ const lowerCaseValue = value.toLowerCase();
119
+ const param = key.split(`${paramType}-`)[1];
120
+
121
+ if (booleanMapping.has(value)) {
122
+ value = booleanMapping.get(lowerCaseValue);
123
+ }
124
+
125
+ value = normalizeParamValue(param, value);
126
+
127
+ initialConfig[param] = value;
128
+ };
129
+
112
130
  const applyOpenUI5Configuration = () => {
113
131
  const OpenUI5Support = getFeature("OpenUI5Support");
114
132
  if (!OpenUI5Support || !OpenUI5Support.isLoaded()) {
@@ -145,5 +163,4 @@ export {
145
163
  getNoConflict,
146
164
  getCalendarType,
147
165
  getFormatSettings,
148
- getAssetsPath,
149
166
  };
package/dist/Keys.js CHANGED
@@ -131,6 +131,10 @@ const isUpShift = event => (event.key ? (event.key === "ArrowUp" || event.key ==
131
131
 
132
132
  const isDownShift = event => (event.key ? (event.key === "ArrowDown" || event.key === "Down") : event.keyCode === KeyCodes.ARROW_DOWN) && checkModifierKeys(event, false, false, true);
133
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
+
134
138
  const isUpShiftCtrl = event => (event.key ? (event.key === "ArrowUp" || event.key === "Up") : event.keyCode === KeyCodes.ARROW_UP) && checkModifierKeys(event, true, false, true);
135
139
 
136
140
  const isDownShiftCtrl = event => (event.key ? (event.key === "ArrowDown" || event.key === "Down") : event.keyCode === KeyCodes.ARROW_DOWN) && checkModifierKeys(event, true, false, true);
@@ -159,8 +163,12 @@ const isPageDown = event => (event.key ? event.key === "PageDown" : event.keyCod
159
163
 
160
164
  const isPageUpShift = event => (event.key ? event.key === "PageUp" : event.keyCode === KeyCodes.PAGE_UP) && checkModifierKeys(event, false, false, true);
161
165
 
166
+ const isPageUpAlt = event => (event.key ? event.key === "PageUp" : event.keyCode === KeyCodes.PAGE_UP) && checkModifierKeys(event, false, true, false);
167
+
162
168
  const isPageDownShift = event => (event.key ? event.key === "PageDown" : event.keyCode === KeyCodes.PAGE_DOWN) && checkModifierKeys(event, false, false, true);
163
169
 
170
+ const isPageDownAlt = event => (event.key ? event.key === "PageDown" : event.keyCode === KeyCodes.PAGE_DOWN) && checkModifierKeys(event, false, true, false);
171
+
164
172
  const isPageUpShiftCtrl = event => (event.key ? event.key === "PageUp" : event.keyCode === KeyCodes.PAGE_UP) && checkModifierKeys(event, true, false, true);
165
173
 
166
174
  const isPageDownShiftCtrl = event => (event.key ? event.key === "PageDown" : event.keyCode === KeyCodes.PAGE_DOWN) && checkModifierKeys(event, true, false, true);
@@ -183,6 +191,8 @@ const isF4 = event => {
183
191
 
184
192
  const isF4Shift = event => (event.key ? event.key === "F4" : event.keyCode === KeyCodes.F4) && checkModifierKeys(event, false, false, true);
185
193
 
194
+ const isF7 = event => (event.key ? event.key === "F7" : event.keyCode === KeyCodes.F7) && !hasModifierKeys(event);
195
+
186
196
  const isShowByArrows = event => {
187
197
  return ((event.key === "ArrowDown" || event.key === "Down") || (event.key === "ArrowUp" || event.key === "Up")) && checkModifierKeys(event, /* Ctrl */ false, /* Alt */ true, /* Shift */ false);
188
198
  };
@@ -208,6 +218,8 @@ export {
208
218
  isDownCtrl,
209
219
  isUpShift,
210
220
  isDownShift,
221
+ isLeftShift,
222
+ isRightShift,
211
223
  isUpShiftCtrl,
212
224
  isDownShiftCtrl,
213
225
  isHome,
@@ -224,10 +236,13 @@ export {
224
236
  isShow,
225
237
  isF4,
226
238
  isF4Shift,
239
+ isF7,
227
240
  isPageUp,
228
241
  isPageDown,
229
242
  isPageUpShift,
243
+ isPageUpAlt,
230
244
  isPageDownShift,
245
+ isPageDownAlt,
231
246
  isPageUpShiftCtrl,
232
247
  isPageDownShiftCtrl,
233
248
  };
@@ -0,0 +1,83 @@
1
+ import createStyleInHead from "./util/createStyleInHead.js";
2
+ import createLinkInHead from "./util/createLinkInHead.js";
3
+ import { shouldUseLinks, getUrl } from "./CSP.js";
4
+
5
+ const getStyleId = (name, value) => {
6
+ return value ? `${name}|${value}` : name;
7
+ };
8
+
9
+ const createStyle = (data, name, value = "") => {
10
+ const content = typeof data === "string" ? data : data.content;
11
+
12
+ if (shouldUseLinks()) {
13
+ const attributes = {};
14
+ attributes[name] = value;
15
+ const href = getUrl(data.packageName, data.fileName);
16
+ createLinkInHead(href, attributes);
17
+ } else if (document.adoptedStyleSheets) {
18
+ const stylesheet = new CSSStyleSheet();
19
+ stylesheet.replaceSync(content);
20
+ stylesheet._ui5StyleId = getStyleId(name, value); // set an id so that we can find the style later
21
+ document.adoptedStyleSheets = [...document.adoptedStyleSheets, stylesheet];
22
+ } else {
23
+ const attributes = {};
24
+ attributes[name] = value;
25
+ createStyleInHead(content, attributes);
26
+ }
27
+ };
28
+
29
+ const updateStyle = (data, name, value = "") => {
30
+ const content = typeof data === "string" ? data : data.content;
31
+
32
+ if (shouldUseLinks()) {
33
+ document.querySelector(`head>link[${name}="${value}"]`).href = getUrl(data.packageName, data.fileName);
34
+ } else if (document.adoptedStyleSheets) {
35
+ document.adoptedStyleSheets.find(sh => sh._ui5StyleId === getStyleId(name, value)).replaceSync(content || "");
36
+ } else {
37
+ document.querySelector(`head>style[${name}="${value}"]`).textContent = content || "";
38
+ }
39
+ };
40
+
41
+ const hasStyle = (name, value = "") => {
42
+ if (shouldUseLinks()) {
43
+ return !!document.querySelector(`head>link[${name}="${value}"]`);
44
+ }
45
+
46
+ if (document.adoptedStyleSheets) {
47
+ return !!document.adoptedStyleSheets.find(sh => sh._ui5StyleId === getStyleId(name, value));
48
+ }
49
+
50
+ return !!document.querySelector(`head>style[${name}="${value}"]`);
51
+ };
52
+
53
+ const removeStyle = (name, value = "") => {
54
+ if (shouldUseLinks()) {
55
+ const linkElement = document.querySelector(`head>link[${name}="${value}"]`);
56
+ if (linkElement) {
57
+ linkElement.parentElement.removeChild(linkElement);
58
+ }
59
+ } else if (document.adoptedStyleSheets) {
60
+ document.adoptedStyleSheets = document.adoptedStyleSheets.filter(sh => sh._ui5StyleId !== getStyleId(name, value));
61
+ } else {
62
+ const styleElement = document.querySelector(`head > style[${name}="${value}"]`);
63
+ if (styleElement) {
64
+ styleElement.parentElement.removeChild(styleElement);
65
+ }
66
+ }
67
+ };
68
+
69
+ const createOrUpdateStyle = (data, name, value = "") => {
70
+ if (hasStyle(name, value)) {
71
+ updateStyle(data, name, value);
72
+ } else {
73
+ createStyle(data, name, value);
74
+ }
75
+ };
76
+
77
+ export {
78
+ createStyle,
79
+ hasStyle,
80
+ updateStyle,
81
+ removeStyle,
82
+ createOrUpdateStyle,
83
+ };
package/dist/Render.js CHANGED
@@ -135,6 +135,7 @@ const _resolveTaskPromise = () => {
135
135
  * reRenderAllUI5Elements({tag: "ui5-button"}) -> re-renders only instances of ui5-button
136
136
  * reRenderAllUI5Elements({rtlAware: true}) -> re-renders only rtlAware components
137
137
  * reRenderAllUI5Elements({languageAware: true}) -> re-renders only languageAware components
138
+ * reRenderAllUI5Elements({themeAware: true}) -> re-renders only themeAware components
138
139
  * reRenderAllUI5Elements({rtlAware: true, languageAware: true}) -> re-renders components that are rtlAware or languageAware
139
140
  * etc...
140
141
  *
@@ -147,7 +148,8 @@ const reRenderAllUI5Elements = async filters => {
147
148
  const tag = element.constructor.getMetadata().getTag();
148
149
  const rtlAware = isRtlAware(element.constructor);
149
150
  const languageAware = element.constructor.getMetadata().isLanguageAware();
150
- if (!filters || (filters.tag === tag) || (filters.rtlAware && rtlAware) || (filters.languageAware && languageAware)) {
151
+ const themeAware = element.constructor.getMetadata().isThemeAware();
152
+ if (!filters || (filters.tag === tag) || (filters.rtlAware && rtlAware) || (filters.languageAware && languageAware) || (filters.themeAware && themeAware)) {
151
153
  renderDeferred(element);
152
154
  }
153
155
  });