@ui5/webcomponents-base 0.0.0-fb61e9889 → 0.0.0-fd6264051

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 (105) hide show
  1. package/.eslintignore +3 -1
  2. package/CHANGELOG.md +125 -0
  3. package/README.md +2 -3
  4. package/bundle.esm.js +1 -2
  5. package/dist/Boot.js +34 -18
  6. package/dist/CSP.js +59 -0
  7. package/dist/CustomElementsRegistry.js +60 -4
  8. package/dist/Device.js +15 -1
  9. package/dist/FeaturesRegistry.js +4 -1
  10. package/dist/FontFace.js +7 -95
  11. package/dist/InitialConfiguration.js +11 -0
  12. package/dist/Keys.js +32 -0
  13. package/dist/ManagedStyles.js +83 -0
  14. package/dist/Render.js +3 -1
  15. package/dist/Runtimes.js +107 -0
  16. package/dist/StaticAreaItem.js +3 -9
  17. package/dist/SystemCSSVars.js +4 -25
  18. package/dist/UI5Element.js +20 -23
  19. package/dist/UI5ElementMetadata.js +16 -0
  20. package/dist/asset-registries/Icons.js +25 -14
  21. package/dist/assets-meta/IconCollectionsAlias.js +18 -0
  22. package/dist/config/Theme.js +25 -0
  23. package/dist/css/FontFace.css +45 -0
  24. package/dist/css/OverrideFontFace.css +32 -0
  25. package/dist/css/SystemCSSVars.css +17 -0
  26. package/dist/features/F6Navigation.js +106 -0
  27. package/dist/generated/AssetParameters.js +1 -1
  28. package/dist/generated/VersionInfo.js +10 -0
  29. package/dist/generated/css/FontFace.css.js +5 -0
  30. package/dist/generated/css/OverrideFontFace.css.js +5 -0
  31. package/dist/generated/css/SystemCSSVars.css.js +5 -0
  32. package/dist/i18nBundle.js +32 -2
  33. package/dist/renderer/LitRenderer.js +6 -4
  34. package/dist/renderer/directives/style-map.js +72 -0
  35. package/dist/resources/bundle.esm.js +8 -8
  36. package/dist/resources/bundle.esm.js.map +1 -1
  37. package/dist/sap/base/security/encodeCSS.js +14 -0
  38. package/dist/sap/base/security/encodeXML.js +23 -0
  39. package/dist/sap/base/strings/toHex.js +8 -0
  40. package/dist/test-resources/pages/i18n.html +1 -3
  41. package/dist/test-resources/specs/CustomTheme.spec.js +2 -2
  42. package/dist/test-resources/specs/Theming.spec.js +4 -4
  43. package/dist/theming/CustomStyle.js +23 -3
  44. package/dist/theming/applyTheme.js +11 -10
  45. package/dist/theming/getEffectiveLinksHrefs.js +20 -0
  46. package/dist/theming/getStylesString.js +4 -2
  47. package/dist/theming/getThemeDesignerTheme.js +25 -5
  48. package/dist/theming/preloadLinks.js +23 -0
  49. package/dist/updateShadowRoot.js +8 -4
  50. package/dist/util/FocusableElements.js +8 -6
  51. package/dist/util/InvisibleMessage.js +11 -9
  52. package/dist/util/TabbableElements.js +4 -0
  53. package/dist/util/createLinkInHead.js +19 -0
  54. package/dist/util/escapeRegex.js +10 -0
  55. package/dist/util/generateHighlightedMarkup.js +42 -0
  56. package/dist/util/isNodeHidden.js +1 -1
  57. package/hash.txt +1 -1
  58. package/lib/generate-styles/index.js +18 -0
  59. package/lib/generate-version-info/index.js +27 -0
  60. package/package-scripts.js +8 -3
  61. package/package.json +5 -4
  62. package/src/Boot.js +34 -18
  63. package/src/CSP.js +59 -0
  64. package/src/CustomElementsRegistry.js +60 -4
  65. package/src/Device.js +15 -1
  66. package/src/FeaturesRegistry.js +4 -1
  67. package/src/FontFace.js +7 -95
  68. package/src/InitialConfiguration.js +11 -0
  69. package/src/Keys.js +32 -0
  70. package/src/ManagedStyles.js +83 -0
  71. package/src/Render.js +3 -1
  72. package/src/Runtimes.js +107 -0
  73. package/src/StaticAreaItem.js +3 -9
  74. package/src/SystemCSSVars.js +4 -25
  75. package/src/UI5Element.js +20 -23
  76. package/src/UI5ElementMetadata.js +16 -0
  77. package/src/asset-registries/Icons.js +25 -14
  78. package/src/assets-meta/IconCollectionsAlias.js +18 -0
  79. package/src/config/Theme.js +25 -0
  80. package/src/css/FontFace.css +45 -0
  81. package/src/css/OverrideFontFace.css +32 -0
  82. package/src/css/SystemCSSVars.css +17 -0
  83. package/src/features/F6Navigation.js +106 -0
  84. package/src/i18nBundle.js +32 -2
  85. package/src/renderer/LitRenderer.js +6 -4
  86. package/src/renderer/directives/style-map.js +72 -0
  87. package/src/theming/CustomStyle.js +23 -3
  88. package/src/theming/applyTheme.js +11 -10
  89. package/src/theming/getEffectiveLinksHrefs.js +20 -0
  90. package/src/theming/getStylesString.js +4 -2
  91. package/src/theming/getThemeDesignerTheme.js +25 -5
  92. package/src/theming/preloadLinks.js +23 -0
  93. package/src/updateShadowRoot.js +8 -4
  94. package/src/util/FocusableElements.js +8 -6
  95. package/src/util/InvisibleMessage.js +11 -9
  96. package/src/util/TabbableElements.js +4 -0
  97. package/src/util/createLinkInHead.js +19 -0
  98. package/src/util/escapeRegex.js +10 -0
  99. package/src/util/generateHighlightedMarkup.js +42 -0
  100. package/src/util/isNodeHidden.js +1 -1
  101. package/used-modules.txt +4 -1
  102. package/dist/theming/createThemePropertiesStyleTag.js +0 -20
  103. package/dist/util/encodeCSS.js +0 -24
  104. package/src/theming/createThemePropertiesStyleTag.js +0 -20
  105. package/src/util/encodeCSS.js +0 -24
package/.eslintignore CHANGED
@@ -10,4 +10,6 @@ rollup.config*.js
10
10
  wdio.conf.js
11
11
  postcss.config.js
12
12
  package-scripts.js
13
- .eslintrc.js
13
+ .eslintrc.js
14
+ src/renderer/directives/style-map.js
15
+ src/util/metaUrl.js
package/CHANGELOG.md CHANGED
@@ -3,6 +3,131 @@
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.2.0](https://github.com/SAP/ui5-webcomponents/compare/v1.1.2...v1.2.0) (2022-02-28)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ui5-input:** improve lazy loading behaviour ([#4763](https://github.com/SAP/ui5-webcomponents/issues/4763)) ([35342be](https://github.com/SAP/ui5-webcomponents/commit/35342be))
12
+ * **ui5-list:** initial focus target ([#4809](https://github.com/SAP/ui5-webcomponents/issues/4809)) ([cf6dd1a](https://github.com/SAP/ui5-webcomponents/commit/cf6dd1a))
13
+ * attached boot tasks always run ([#4777](https://github.com/SAP/ui5-webcomponents/issues/4777)) ([ad4608c](https://github.com/SAP/ui5-webcomponents/commit/ad4608c))
14
+ * **framework:** Tabbable elements error ([#4704](https://github.com/SAP/ui5-webcomponents/issues/4704)) ([650473f](https://github.com/SAP/ui5-webcomponents/commit/650473f))
15
+ * **ui5-badge:** update color-scheme parameters ([#4678](https://github.com/SAP/ui5-webcomponents/issues/4678)) ([c7d75ef](https://github.com/SAP/ui5-webcomponents/commit/c7d75ef)), closes [#3940](https://github.com/SAP/ui5-webcomponents/issues/3940)
16
+ * **ui5-label:** allow focusing elements linked with for attribute inside a shadow root ([#4754](https://github.com/SAP/ui5-webcomponents/issues/4754)) ([bd7a8a1](https://github.com/SAP/ui5-webcomponents/commit/bd7a8a1)), closes [#4751](https://github.com/SAP/ui5-webcomponents/issues/4751)
17
+ * **ui5-li-tree:** correct usage of i18nBudnle ([#4668](https://github.com/SAP/ui5-webcomponents/issues/4668)) ([67848d7](https://github.com/SAP/ui5-webcomponents/commit/67848d7))
18
+ * **ui5-select:** incorrect popover styles when value state is used ([#4651](https://github.com/SAP/ui5-webcomponents/issues/4651)) ([2d8ce46](https://github.com/SAP/ui5-webcomponents/commit/2d8ce46))
19
+ * **ui5-tabcontainer:** await for renderFinished in resize handler ([#4675](https://github.com/SAP/ui5-webcomponents/issues/4675)) ([cd8dc26](https://github.com/SAP/ui5-webcomponents/commit/cd8dc26)), closes [#4628](https://github.com/SAP/ui5-webcomponents/issues/4628)
20
+
21
+
22
+ ### Features
23
+
24
+ * add and update icons from 4.13 and 5.01 icon fonts ([#4790](https://github.com/SAP/ui5-webcomponents/issues/4790)) ([a9e88f0](https://github.com/SAP/ui5-webcomponents/commit/a9e88f0))
25
+ * **ui5-input:** implement showClearIcon property ([#4641](https://github.com/SAP/ui5-webcomponents/issues/4641)) ([b1c1620](https://github.com/SAP/ui5-webcomponents/commit/b1c1620))
26
+ * **ui5-table:** extend keyboard handling ([#4550](https://github.com/SAP/ui5-webcomponents/issues/4550)) ([8daa764](https://github.com/SAP/ui5-webcomponents/commit/8daa764)), closes [#3090](https://github.com/SAP/ui5-webcomponents/issues/3090)
27
+ * **ui5-table:** improve keyboard handling ([#4631](https://github.com/SAP/ui5-webcomponents/issues/4631)) ([f1f2b1b](https://github.com/SAP/ui5-webcomponents/commit/f1f2b1b))
28
+ * **ui5-tree:** make `item-click` event preventable ([#4708](https://github.com/SAP/ui5-webcomponents/issues/4708)) ([29967f0](https://github.com/SAP/ui5-webcomponents/commit/29967f0)), closes [#4502](https://github.com/SAP/ui5-webcomponents/issues/4502)
29
+
30
+
31
+
32
+
33
+
34
+ ## [1.1.2](https://github.com/SAP/ui5-webcomponents/compare/v1.1.1...v1.1.2) (2022-01-26)
35
+
36
+
37
+ ### Bug Fixes
38
+
39
+ * fix ipad recognition ([#4632](https://github.com/SAP/ui5-webcomponents/issues/4632)) ([c0cc73d](https://github.com/SAP/ui5-webcomponents/commit/c0cc73d))
40
+ * remove import.meta.url ([#4630](https://github.com/SAP/ui5-webcomponents/issues/4630)) ([604ce63](https://github.com/SAP/ui5-webcomponents/commit/604ce63))
41
+
42
+
43
+ ### Features
44
+
45
+ * **ui5-multi-input:** Keyboard handling ([#4495](https://github.com/SAP/ui5-webcomponents/issues/4495)) ([b978f4a](https://github.com/SAP/ui5-webcomponents/commit/b978f4a))
46
+
47
+
48
+
49
+
50
+
51
+ ## [1.1.1](https://github.com/SAP/ui5-webcomponents/compare/v1.1.0...v1.1.1) (2022-01-24)
52
+
53
+ **Note:** Version bump only for package @ui5/webcomponents-base
54
+
55
+
56
+
57
+
58
+
59
+ # [1.1.0](https://github.com/SAP/ui5-webcomponents/compare/v1.0.2...v1.1.0) (2022-01-21)
60
+
61
+
62
+ ### Bug Fixes
63
+
64
+ * **framework:** correct scoping issues ([#4573](https://github.com/SAP/ui5-webcomponents/issues/4573)) ([4e430d3](https://github.com/SAP/ui5-webcomponents/commit/4e430d3))
65
+ * **framework:** prevent runtime error on malformed custom theme object ([#4375](https://github.com/SAP/ui5-webcomponents/issues/4375)) ([3215c7d](https://github.com/SAP/ui5-webcomponents/commit/3215c7d))
66
+
67
+
68
+ ### Features
69
+
70
+ * **framework:** implement F6 Navigation Helper ([#4490](https://github.com/SAP/ui5-webcomponents/issues/4490)) ([60d0dc1](https://github.com/SAP/ui5-webcomponents/commit/60d0dc1))
71
+ * **framework:** add support for `stable-dom-ref` for abstract items ([#4604](https://github.com/SAP/ui5-webcomponents/issues/4604)) ([5526dea](https://github.com/SAP/ui5-webcomponents/commit/5526dea))
72
+ * **framework:** introduce runtime and version info ([#4491](https://github.com/SAP/ui5-webcomponents/issues/4491)) ([757577f](https://github.com/SAP/ui5-webcomponents/commit/757577f))
73
+
74
+
75
+
76
+
77
+
78
+ ## [1.0.2](https://github.com/SAP/ui5-webcomponents/compare/v1.0.1...v1.0.2) (2021-11-29)
79
+
80
+
81
+ ### Bug Fixes
82
+
83
+ * prevent runtime error on malformed custom theme object ([#4375](https://github.com/SAP/ui5-webcomponents/issues/4375)) ([dd10d7c](https://github.com/SAP/ui5-webcomponents/commit/dd10d7c))
84
+
85
+
86
+
87
+
88
+
89
+ ## [1.0.1](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0...v1.0.1) (2021-11-10)
90
+
91
+ **Note:** Version bump only for package @ui5/webcomponents-base
92
+
93
+
94
+
95
+
96
+
97
+ # [1.0.0](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.16...v1.0.0) (2021-11-10)
98
+
99
+
100
+ **Note:** Version bump only for package @ui5/webcomponents-base
101
+
102
+
103
+
104
+
105
+
106
+ # [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)
107
+
108
+
109
+ ### Bug Fixes
110
+
111
+ * **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))
112
+ * **framework:** Multiple properties have no attribute ([#3725](https://github.com/SAP/ui5-webcomponents/issues/3725)) ([2548935](https://github.com/SAP/ui5-webcomponents/commit/2548935))
113
+ * **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))
114
+ * **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))
115
+
116
+
117
+ ### Features
118
+
119
+ * **framework:** add SAP-icons5.0 ([#4244](https://github.com/SAP/ui5-webcomponents/issues/4244)) ([c0a226e](https://github.com/SAP/ui5-webcomponents/commit/c0a226e))
120
+ * rework stableDomRef concept ([#4210](https://github.com/SAP/ui5-webcomponents/issues/4210)) ([d1ebea3](https://github.com/SAP/ui5-webcomponents/commit/d1ebea3))
121
+ * **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))
122
+ * **framework:** Implement better custom theme support ([#4121](https://github.com/SAP/ui5-webcomponents/issues/4121)) ([31e30f8](https://github.com/SAP/ui5-webcomponents/commit/31e30f8))
123
+ * **framework:** handle Page UP/DOWN ([#3727](https://github.com/SAP/ui5-webcomponents/issues/3727)) ([91a974f](https://github.com/SAP/ui5-webcomponents/commit/91a974f))
124
+ * **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)
125
+ * **framework:** load "72Black" font face ([#4139](https://github.com/SAP/ui5-webcomponents/issues/4139)) ([2be7869](https://github.com/SAP/ui5-webcomponents/commit/2be7869))
126
+
127
+
128
+
129
+
130
+
6
131
  # [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)
7
132
 
8
133
 
package/README.md CHANGED
@@ -23,8 +23,7 @@ Contains the base files for all Web Components, most notably `@ui5/webcomponents
23
23
  ### `i18nBundle.js`
24
24
 
25
25
  - `registerI18nLoader`
26
- - `fetchI18nBundle`
27
- - `getI18nBundleData`
26
+ - `getI18nBundle`
28
27
 
29
28
  ### `PropertiesFileFormat.js`
30
29
 
@@ -43,7 +42,7 @@ Contains the base files for all Web Components, most notably `@ui5/webcomponents
43
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/).
44
43
 
45
44
  ## Contribute
46
- 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).
47
46
 
48
47
  ## License
49
48
  Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
package/bundle.esm.js CHANGED
@@ -24,7 +24,7 @@ window.isIE = isIE; // attached to the window object for testing purposes
24
24
  window.registerThemePropertiesLoader = registerThemePropertiesLoader;
25
25
 
26
26
  // i18n
27
- import { registerI18nLoader, fetchI18nBundle, getI18nBundle } from "./dist/i18nBundle.js";
27
+ import { registerI18nLoader, getI18nBundle } from "./dist/i18nBundle.js";
28
28
 
29
29
  // Note: keep in sync with rollup.config value for IIFE
30
30
  import { getAnimationMode } from "./dist/config/AnimationMode.js";
@@ -51,7 +51,6 @@ window["sap-ui-webcomponents-bundle"] = {
51
51
  },
52
52
  getIconNames,
53
53
  registerI18nLoader,
54
- fetchI18nBundle,
55
54
  getI18nBundle,
56
55
  renderFinished,
57
56
  applyDirection,
package/dist/Boot.js CHANGED
@@ -1,40 +1,56 @@
1
- import EventProvider from "./EventProvider.js";
2
1
  import whenDOMReady from "./util/whenDOMReady.js";
3
2
  import insertFontFace from "./FontFace.js";
4
3
  import insertSystemCSSVars from "./SystemCSSVars.js";
5
4
  import { getTheme } from "./config/Theme.js";
6
5
  import applyTheme from "./theming/applyTheme.js";
6
+ import { registerCurrentRuntime } from "./Runtimes.js";
7
7
  import { getFeature } from "./FeaturesRegistry.js";
8
8
 
9
- let booted = false;
10
- const eventProvider = new EventProvider();
9
+ let bootPromise;
11
10
 
12
11
  /**
13
12
  * Attach a callback that will be executed on boot
14
13
  * @public
15
14
  * @param listener
16
15
  */
17
- const attachBoot = listener => {
18
- eventProvider.attachEvent("boot", listener);
16
+ const attachBoot = async listener => {
17
+ await boot();
18
+ listener();
19
19
  };
20
20
 
21
21
  const boot = async () => {
22
- if (booted) {
23
- return;
22
+ if (bootPromise) {
23
+ return bootPromise;
24
24
  }
25
25
 
26
- const OpenUI5Support = getFeature("OpenUI5Support");
27
- if (OpenUI5Support) {
28
- await OpenUI5Support.init();
29
- }
26
+ /* eslint-disable no-alert, no-async-promise-executor */
27
+ /*
28
+ Note(since we disable eslint rule):
29
+ If an async executor function throws an error, the error will be lost and won't cause the newly-constructed Promise to reject.
30
+ This could make it difficult to debug and handle some errors.
31
+ */
32
+ bootPromise = new Promise(async resolve => {
33
+ registerCurrentRuntime();
34
+
35
+ const OpenUI5Support = getFeature("OpenUI5Support");
36
+ const F6Navigation = getFeature("F6Navigation");
37
+ if (OpenUI5Support) {
38
+ await OpenUI5Support.init();
39
+ } else if (F6Navigation) {
40
+ F6Navigation.init();
41
+ }
42
+
43
+ await whenDOMReady();
44
+ await applyTheme(getTheme());
45
+ OpenUI5Support && OpenUI5Support.attachListeners();
46
+ insertFontFace();
47
+ insertSystemCSSVars();
48
+
49
+ resolve();
50
+ });
51
+ /* eslint-enable no-alert, no-async-promise-executor */
30
52
 
31
- await whenDOMReady();
32
- await applyTheme(getTheme());
33
- OpenUI5Support && OpenUI5Support.attachListeners();
34
- insertFontFace();
35
- insertSystemCSSVars();
36
- await eventProvider.fireEventAsync("boot");
37
- booted = true;
53
+ return bootPromise;
38
54
  };
39
55
 
40
56
  export {
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
+ };
@@ -1,11 +1,18 @@
1
1
  import setToArray from "./util/setToArray.js";
2
+ import getSharedResource from "./getSharedResource.js";
3
+ import { getCurrentRuntimeIndex, compareRuntimes, getAllRuntimes } from "./Runtimes.js";
4
+
5
+ const Tags = getSharedResource("Tags", new Map());
2
6
 
3
7
  const Definitions = new Set();
4
- const Failures = new Set();
8
+ let Failures = {};
5
9
  let failureTimeout;
6
10
 
11
+ const UNKNOWN_RUNTIME = "unknown";
12
+
7
13
  const registerTag = tag => {
8
14
  Definitions.add(tag);
15
+ Tags.set(tag, getCurrentRuntimeIndex());
9
16
  };
10
17
 
11
18
  const isTagRegistered = tag => {
@@ -17,18 +24,67 @@ const getAllRegisteredTags = () => {
17
24
  };
18
25
 
19
26
  const recordTagRegistrationFailure = tag => {
20
- Failures.add(tag);
27
+ let tagRegRuntimeIndex = Tags.get(tag);
28
+ if (tagRegRuntimeIndex === undefined) {
29
+ tagRegRuntimeIndex = UNKNOWN_RUNTIME; // If the tag is taken, but not registered in Tags, then a version before 1.1.0 defined it => use the "unknown" key
30
+ }
31
+ Failures[tagRegRuntimeIndex] = Failures[tagRegRuntimeIndex] || new Set();
32
+ Failures[tagRegRuntimeIndex].add(tag);
33
+
21
34
  if (!failureTimeout) {
22
35
  failureTimeout = setTimeout(() => {
23
36
  displayFailedRegistrations();
37
+ Failures = {};
24
38
  failureTimeout = undefined;
25
39
  }, 1000);
26
40
  }
27
41
  };
28
42
 
29
43
  const displayFailedRegistrations = () => {
30
- console.warn(`The following tags have already been defined by a different UI5 Web Components version: ${setToArray(Failures).join(", ")}`); // eslint-disable-line
31
- Failures.clear();
44
+ const allRuntimes = getAllRuntimes();
45
+ const currentRuntimeIndex = getCurrentRuntimeIndex();
46
+ const currentRuntime = allRuntimes[currentRuntimeIndex];
47
+
48
+ let message = `Multiple UI5 Web Components instances detected.`;
49
+
50
+ if (allRuntimes.length > 1) {
51
+ message = `${message}\nLoading order (versions before 1.1.0 not listed): ${allRuntimes.map(runtime => `\n${runtime.description}`).join("")}`;
52
+ }
53
+
54
+ Object.keys(Failures).forEach(otherRuntimeIndex => {
55
+ let comparison;
56
+ let otherRuntime;
57
+
58
+ if (otherRuntimeIndex === UNKNOWN_RUNTIME) { // version < 1.1.0 defined the tag
59
+ comparison = 1; // the current runtime is considered newer
60
+ otherRuntime = {
61
+ description: `Older unknown runtime`,
62
+ };
63
+ } else {
64
+ comparison = compareRuntimes(currentRuntimeIndex, otherRuntimeIndex);
65
+ otherRuntime = allRuntimes[otherRuntimeIndex];
66
+ }
67
+
68
+ let compareWord;
69
+ if (comparison > 0) {
70
+ compareWord = "an older";
71
+ } else if (comparison < 0) {
72
+ compareWord = "a newer";
73
+ } else {
74
+ compareWord = "the same";
75
+ }
76
+ message = `${message}\n\n"${currentRuntime.description}" failed to define ${Failures[otherRuntimeIndex].size} tag(s) as they were defined by a runtime of ${compareWord} version "${otherRuntime.description}": ${setToArray(Failures[otherRuntimeIndex]).sort().join(", ")}.`;
77
+
78
+ if (comparison > 0) {
79
+ message = `${message}\nWARNING! If your code uses features of the above web components, unavailable in ${otherRuntime.description}, it might not work as expected!`;
80
+ } else {
81
+ message = `${message}\nSince the above web components were defined by the same or newer version runtime, they should be compatible with your code.`;
82
+ }
83
+ });
84
+
85
+ message = `${message}\n\nTo prevent other runtimes from defining tags that you use, consider using scoping or have third-party libraries use scoping: https://github.com/SAP/ui5-webcomponents/blob/master/docs/2-advanced/03-scoping.md.`;
86
+
87
+ console.warn(message); // eslint-disable-line
32
88
  };
33
89
 
34
90
  export {
package/dist/Device.js CHANGED
@@ -5,9 +5,13 @@ const chrome = !ie && /(Chrome|CriOS)/.test(ua);
5
5
  const safari = !ie && !chrome && /(Version|PhantomJS)\/(\d+\.\d+).*Safari/.test(ua);
6
6
  const webkit = !ie && /webkit/.test(ua);
7
7
  const windows = navigator.platform.indexOf("Win") !== -1;
8
+ const iOS = navigator.platform.match(/iPhone|iPad|iPod/) || (navigator.userAgent.match(/Mac/) && "ontouchend" in document);
8
9
  const android = !windows && /Android/.test(ua);
9
10
  const androidPhone = android && /(?=android)(?=.*mobile)/i.test(ua);
10
- const ipad = /ipad/i.test(ua);
11
+ const ipad = /ipad/i.test(ua) || (/Macintosh/i.test(ua) && "ontouchend" in document);
12
+ // With iOS 13 the string 'iPad' was removed from the user agent string through a browser setting, which is applied on all sites by default:
13
+ // "Request Desktop Website -> All websites" (for more infos see: https://forums.developer.apple.com/thread/119186).
14
+ // Therefore the OS is detected as MACINTOSH instead of iOS and the device is a tablet if the Device.support.touch is true.
11
15
 
12
16
  let windowsVersion;
13
17
  let webkitVersion;
@@ -91,6 +95,14 @@ const isDesktop = () => {
91
95
  return (!isTablet() && !isPhone()) || isWindows8OrAbove();
92
96
  };
93
97
 
98
+ const isCombi = () => {
99
+ return isTablet() && isDesktop();
100
+ };
101
+
102
+ const isIOS = () => {
103
+ return iOS;
104
+ };
105
+
94
106
  export {
95
107
  supportsTouch,
96
108
  isIE,
@@ -99,4 +111,6 @@ export {
99
111
  isPhone,
100
112
  isTablet,
101
113
  isDesktop,
114
+ isCombi,
115
+ isIOS,
102
116
  };
@@ -8,4 +8,7 @@ const getFeature = name => {
8
8
  return features.get(name);
9
9
  };
10
10
 
11
- export { registerFeature, getFeature };
11
+ export {
12
+ registerFeature,
13
+ getFeature,
14
+ };
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
 
@@ -106,6 +106,14 @@ const parseURLParameters = () => {
106
106
  });
107
107
  };
108
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
+
109
117
  const applyURLParam = (key, value, paramType) => {
110
118
  const lowerCaseValue = value.toLowerCase();
111
119
  const param = key.split(`${paramType}-`)[1];
@@ -113,6 +121,9 @@ const applyURLParam = (key, value, paramType) => {
113
121
  if (booleanMapping.has(value)) {
114
122
  value = booleanMapping.get(lowerCaseValue);
115
123
  }
124
+
125
+ value = normalizeParamValue(param, value);
126
+
116
127
  initialConfig[param] = value;
117
128
  };
118
129