@ui5/webcomponents-base 0.0.0-cc312800a → 0.0.0-cf069fb29

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 (160) hide show
  1. package/.eslintignore +4 -1
  2. package/CHANGELOG.md +107 -0
  3. package/README.md +26 -2
  4. package/bundle.esm.js +6 -2
  5. package/dist/Boot.js +32 -14
  6. package/dist/CSP.js +59 -0
  7. package/dist/CustomElementsRegistry.js +60 -4
  8. package/dist/Device.js +17 -1
  9. package/dist/EventProvider.js +19 -25
  10. package/dist/FeaturesRegistry.js +4 -1
  11. package/dist/FontFace.js +7 -95
  12. package/dist/InitialConfiguration.js +31 -14
  13. package/dist/Keys.js +38 -0
  14. package/dist/ManagedStyles.js +83 -0
  15. package/dist/Render.js +3 -1
  16. package/dist/Runtimes.js +107 -0
  17. package/dist/StaticAreaItem.js +14 -9
  18. package/dist/SystemCSSVars.js +4 -25
  19. package/dist/UI5Element.js +48 -59
  20. package/dist/UI5ElementMetadata.js +17 -1
  21. package/dist/asset-registries/Icons.js +29 -8
  22. package/dist/asset-registries/Illustrations.js +30 -0
  23. package/dist/asset-registries/LocaleData.js +11 -2
  24. package/dist/assets-meta/IconCollectionsAlias.js +18 -0
  25. package/dist/config/Theme.js +14 -0
  26. package/dist/css/FontFace.css +45 -0
  27. package/dist/css/OverrideFontFace.css +32 -0
  28. package/dist/css/SystemCSSVars.css +17 -0
  29. package/dist/delegate/ItemNavigation.js +66 -0
  30. package/dist/delegate/ScrollEnablement.js +7 -1
  31. package/dist/features/F6Navigation.js +106 -0
  32. package/dist/generated/AssetParameters.js +1 -1
  33. package/dist/generated/VersionInfo.js +10 -0
  34. package/dist/generated/css/FontFace.css.js +5 -0
  35. package/dist/generated/css/OverrideFontFace.css.js +5 -0
  36. package/dist/generated/css/SystemCSSVars.css.js +5 -0
  37. package/dist/i18nBundle.js +33 -2
  38. package/dist/renderer/LitRenderer.js +24 -21
  39. package/dist/renderer/directives/style-map.js +72 -0
  40. package/dist/resources/bundle.esm.js +17 -101
  41. package/dist/resources/bundle.esm.js.map +1 -1
  42. package/dist/sap/base/Log.js +241 -0
  43. package/dist/sap/base/assert.js +8 -0
  44. package/dist/sap/base/security/URLListValidator.js +148 -0
  45. package/dist/sap/base/security/encodeCSS.js +14 -0
  46. package/dist/sap/base/security/encodeXML.js +23 -0
  47. package/dist/sap/base/security/sanitizeHTML.js +16 -0
  48. package/dist/sap/base/strings/toHex.js +8 -0
  49. package/dist/sap/base/util/now.js +7 -0
  50. package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +3585 -0
  51. package/dist/test-resources/elements/WithStaticArea.js +2 -1
  52. package/dist/test-resources/pages/AllTestElements.html +3 -0
  53. package/dist/test-resources/pages/i18n.html +1 -3
  54. package/dist/test-resources/specs/ConfigurationChange.spec.js +9 -9
  55. package/dist/test-resources/specs/ConfigurationScript.spec.js +24 -24
  56. package/dist/test-resources/specs/ConfigurationURL.spec.js +64 -18
  57. package/dist/test-resources/specs/CustomTheme.spec.js +7 -7
  58. package/dist/test-resources/specs/EventProvider.spec.js +63 -0
  59. package/dist/test-resources/specs/StaticArea.spec.js +55 -13
  60. package/dist/test-resources/specs/Theming.spec.js +11 -11
  61. package/dist/test-resources/specs/UI5ElementInvalidation.js +29 -29
  62. package/dist/test-resources/specs/UI5ElementLifecycle.js +11 -11
  63. package/dist/test-resources/specs/UI5ElementListenForChildPropChanges.spec.js +11 -11
  64. package/dist/test-resources/specs/UI5ElementMetadataExt.js +8 -8
  65. package/dist/test-resources/specs/UI5ElementPropertyValidation.js +6 -6
  66. package/dist/test-resources/specs/UI5ElementPropsAndAttrs.spec.js +36 -36
  67. package/dist/test-resources/specs/UI5ElementShadowDOM.js +9 -9
  68. package/dist/test-resources/specs/UI5ElementSlots.js +9 -9
  69. package/dist/theming/CustomStyle.js +23 -3
  70. package/dist/theming/applyTheme.js +11 -10
  71. package/dist/theming/getEffectiveLinksHrefs.js +20 -0
  72. package/dist/theming/getStylesString.js +4 -2
  73. package/dist/theming/getThemeDesignerTheme.js +25 -5
  74. package/dist/theming/preloadLinks.js +23 -0
  75. package/dist/types/DataType.js +12 -0
  76. package/dist/types/Float.js +4 -0
  77. package/dist/types/Integer.js +4 -0
  78. package/dist/types/InvisibleMessageMode.js +30 -0
  79. package/dist/updateShadowRoot.js +8 -4
  80. package/dist/util/AriaLabelHelper.js +4 -4
  81. package/dist/util/FocusableElements.js +13 -7
  82. package/dist/util/HTMLSanitizer.js +7 -0
  83. package/dist/util/InvisibleMessage.js +58 -0
  84. package/dist/util/PopupUtils.js +1 -1
  85. package/dist/util/TabbableElements.js +1 -1
  86. package/dist/util/createLinkInHead.js +19 -0
  87. package/dist/util/escapeRegex.js +10 -0
  88. package/dist/util/generateHighlightedMarkup.js +42 -0
  89. package/dist/util/isNodeHidden.js +1 -1
  90. package/dist/util/isNodeTabbable.js +4 -4
  91. package/hash.txt +1 -1
  92. package/index.js +1 -1
  93. package/lib/generate-asset-parameters/index.js +0 -1
  94. package/lib/generate-styles/index.js +18 -0
  95. package/lib/generate-version-info/index.js +27 -0
  96. package/package-scripts.js +27 -3
  97. package/package.json +16 -8
  98. package/src/Boot.js +32 -14
  99. package/src/CSP.js +59 -0
  100. package/src/CustomElementsRegistry.js +60 -4
  101. package/src/Device.js +17 -1
  102. package/src/EventProvider.js +19 -25
  103. package/src/FeaturesRegistry.js +4 -1
  104. package/src/FontFace.js +7 -95
  105. package/src/InitialConfiguration.js +31 -14
  106. package/src/Keys.js +38 -0
  107. package/src/ManagedStyles.js +83 -0
  108. package/src/Render.js +3 -1
  109. package/src/Runtimes.js +107 -0
  110. package/src/StaticAreaItem.js +14 -9
  111. package/src/SystemCSSVars.js +4 -25
  112. package/src/UI5Element.js +48 -59
  113. package/src/UI5ElementMetadata.js +17 -1
  114. package/src/asset-registries/Icons.js +29 -8
  115. package/src/asset-registries/Illustrations.js +30 -0
  116. package/src/asset-registries/LocaleData.js +11 -2
  117. package/src/assets-meta/IconCollectionsAlias.js +18 -0
  118. package/src/config/Theme.js +14 -0
  119. package/src/css/FontFace.css +45 -0
  120. package/src/css/OverrideFontFace.css +32 -0
  121. package/src/css/SystemCSSVars.css +17 -0
  122. package/src/delegate/ItemNavigation.js +66 -0
  123. package/src/delegate/ScrollEnablement.js +7 -1
  124. package/src/features/F6Navigation.js +106 -0
  125. package/src/i18nBundle.js +33 -2
  126. package/src/renderer/LitRenderer.js +24 -21
  127. package/src/renderer/directives/style-map.js +72 -0
  128. package/src/theming/CustomStyle.js +23 -3
  129. package/src/theming/applyTheme.js +11 -10
  130. package/src/theming/getEffectiveLinksHrefs.js +20 -0
  131. package/src/theming/getStylesString.js +4 -2
  132. package/src/theming/getThemeDesignerTheme.js +25 -5
  133. package/src/theming/preloadLinks.js +23 -0
  134. package/src/types/DataType.js +12 -0
  135. package/src/types/Float.js +4 -0
  136. package/src/types/Integer.js +4 -0
  137. package/src/types/InvisibleMessageMode.js +30 -0
  138. package/src/updateShadowRoot.js +8 -4
  139. package/src/util/AriaLabelHelper.js +4 -4
  140. package/src/util/FocusableElements.js +13 -7
  141. package/src/util/HTMLSanitizer.js +7 -0
  142. package/src/util/InvisibleMessage.js +58 -0
  143. package/src/util/PopupUtils.js +1 -1
  144. package/src/util/TabbableElements.js +1 -1
  145. package/src/util/createLinkInHead.js +19 -0
  146. package/src/util/escapeRegex.js +10 -0
  147. package/src/util/generateHighlightedMarkup.js +42 -0
  148. package/src/util/isNodeHidden.js +1 -1
  149. package/src/util/isNodeTabbable.js +4 -4
  150. package/used-modules.txt +10 -0
  151. package/dist/config/AssetsPath.js +0 -17
  152. package/dist/renderer/ifDefined.js +0 -21
  153. package/dist/renderer/scopeHTML.js +0 -32
  154. package/dist/theming/createThemePropertiesStyleTag.js +0 -20
  155. package/dist/util/encodeCSS.js +0 -24
  156. package/src/config/AssetsPath.js +0 -17
  157. package/src/renderer/ifDefined.js +0 -21
  158. package/src/renderer/scopeHTML.js +0 -32
  159. package/src/theming/createThemePropertiesStyleTag.js +0 -20
  160. package/src/util/encodeCSS.js +0 -24
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,6 @@ 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
15
+ src/util/metaUrl.js
package/CHANGELOG.md CHANGED
@@ -3,6 +3,113 @@
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.1.2](https://github.com/SAP/ui5-webcomponents/compare/v1.1.1...v1.1.2) (2022-01-26)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fix ipad recognition ([#4632](https://github.com/SAP/ui5-webcomponents/issues/4632)) ([c0cc73d](https://github.com/SAP/ui5-webcomponents/commit/c0cc73d))
12
+ * remove import.meta.url ([#4630](https://github.com/SAP/ui5-webcomponents/issues/4630)) ([604ce63](https://github.com/SAP/ui5-webcomponents/commit/604ce63))
13
+
14
+
15
+ ### Features
16
+
17
+ * **ui5-multi-input:** Keyboard handling ([#4495](https://github.com/SAP/ui5-webcomponents/issues/4495)) ([b978f4a](https://github.com/SAP/ui5-webcomponents/commit/b978f4a))
18
+
19
+
20
+
21
+
22
+
23
+ ## [1.1.1](https://github.com/SAP/ui5-webcomponents/compare/v1.1.0...v1.1.1) (2022-01-24)
24
+
25
+ **Note:** Version bump only for package @ui5/webcomponents-base
26
+
27
+
28
+
29
+
30
+
31
+ # [1.1.0](https://github.com/SAP/ui5-webcomponents/compare/v1.0.2...v1.1.0) (2022-01-21)
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * **framework:** correct scoping issues ([#4573](https://github.com/SAP/ui5-webcomponents/issues/4573)) ([4e430d3](https://github.com/SAP/ui5-webcomponents/commit/4e430d3))
37
+ * **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))
38
+
39
+
40
+ ### Features
41
+
42
+ * **framework:** implement F6 Navigation Helper ([#4490](https://github.com/SAP/ui5-webcomponents/issues/4490)) ([60d0dc1](https://github.com/SAP/ui5-webcomponents/commit/60d0dc1))
43
+ * **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))
44
+ * **framework:** introduce runtime and version info ([#4491](https://github.com/SAP/ui5-webcomponents/issues/4491)) ([757577f](https://github.com/SAP/ui5-webcomponents/commit/757577f))
45
+
46
+
47
+
48
+
49
+
50
+ ## [1.0.2](https://github.com/SAP/ui5-webcomponents/compare/v1.0.1...v1.0.2) (2021-11-29)
51
+
52
+
53
+ ### Bug Fixes
54
+
55
+ * 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))
56
+
57
+
58
+
59
+
60
+
61
+ ## [1.0.1](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0...v1.0.1) (2021-11-10)
62
+
63
+ **Note:** Version bump only for package @ui5/webcomponents-base
64
+
65
+
66
+
67
+
68
+
69
+ # [1.0.0](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.16...v1.0.0) (2021-11-10)
70
+
71
+
72
+ **Note:** Version bump only for package @ui5/webcomponents-base
73
+
74
+
75
+
76
+
77
+
78
+ # [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)
79
+
80
+
81
+ ### Bug Fixes
82
+
83
+ * **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))
84
+ * **framework:** Multiple properties have no attribute ([#3725](https://github.com/SAP/ui5-webcomponents/issues/3725)) ([2548935](https://github.com/SAP/ui5-webcomponents/commit/2548935))
85
+ * **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))
86
+ * **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))
87
+
88
+
89
+ ### Features
90
+
91
+ * **framework:** add SAP-icons5.0 ([#4244](https://github.com/SAP/ui5-webcomponents/issues/4244)) ([c0a226e](https://github.com/SAP/ui5-webcomponents/commit/c0a226e))
92
+ * rework stableDomRef concept ([#4210](https://github.com/SAP/ui5-webcomponents/issues/4210)) ([d1ebea3](https://github.com/SAP/ui5-webcomponents/commit/d1ebea3))
93
+ * **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))
94
+ * **framework:** Implement better custom theme support ([#4121](https://github.com/SAP/ui5-webcomponents/issues/4121)) ([31e30f8](https://github.com/SAP/ui5-webcomponents/commit/31e30f8))
95
+ * **framework:** handle Page UP/DOWN ([#3727](https://github.com/SAP/ui5-webcomponents/issues/3727)) ([91a974f](https://github.com/SAP/ui5-webcomponents/commit/91a974f))
96
+ * **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)
97
+ * **framework:** load "72Black" font face ([#4139](https://github.com/SAP/ui5-webcomponents/issues/4139)) ([2be7869](https://github.com/SAP/ui5-webcomponents/commit/2be7869))
98
+
99
+
100
+
101
+
102
+
103
+ # [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)
104
+
105
+
106
+ ### Features
107
+
108
+ * **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))
109
+ * **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)
110
+ * **framework:** introduce InvisibleMessage util ([#3192](https://github.com/SAP/ui5-webcomponents/issues/3192)) ([0a33c40](https://github.com/SAP/ui5-webcomponents/commit/0a33c40))
111
+
112
+
6
113
  # [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
114
 
8
115
 
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/Boot.js CHANGED
@@ -4,9 +4,10 @@ import insertFontFace from "./FontFace.js";
4
4
  import insertSystemCSSVars from "./SystemCSSVars.js";
5
5
  import { getTheme } from "./config/Theme.js";
6
6
  import applyTheme from "./theming/applyTheme.js";
7
+ import { registerCurrentRuntime } from "./Runtimes.js";
7
8
  import { getFeature } from "./FeaturesRegistry.js";
8
9
 
9
- let booted = false;
10
+ let bootPromise;
10
11
  const eventProvider = new EventProvider();
11
12
 
12
13
  /**
@@ -19,22 +20,39 @@ const attachBoot = listener => {
19
20
  };
20
21
 
21
22
  const boot = async () => {
22
- if (booted) {
23
- return;
23
+ if (bootPromise) {
24
+ return bootPromise;
24
25
  }
25
26
 
26
- const OpenUI5Support = getFeature("OpenUI5Support");
27
- if (OpenUI5Support) {
28
- await OpenUI5Support.init();
29
- }
27
+ /* eslint-disable no-alert, no-async-promise-executor */
28
+ /*
29
+ Note(since we disable eslint rule):
30
+ If an async executor function throws an error, the error will be lost and won't cause the newly-constructed Promise to reject.
31
+ This could make it difficult to debug and handle some errors.
32
+ */
33
+ bootPromise = new Promise(async resolve => {
34
+ registerCurrentRuntime();
35
+
36
+ const OpenUI5Support = getFeature("OpenUI5Support");
37
+ const F6Navigation = getFeature("F6Navigation");
38
+ if (OpenUI5Support) {
39
+ await OpenUI5Support.init();
40
+ } else if (F6Navigation) {
41
+ F6Navigation.init();
42
+ }
43
+
44
+ await whenDOMReady();
45
+ await applyTheme(getTheme());
46
+ OpenUI5Support && OpenUI5Support.attachListeners();
47
+ insertFontFace();
48
+ insertSystemCSSVars();
49
+ await eventProvider.fireEventAsync("boot");
50
+
51
+ resolve();
52
+ });
53
+ /* eslint-enable no-alert, no-async-promise-executor */
30
54
 
31
- await whenDOMReady();
32
- await applyTheme(getTheme());
33
- OpenUI5Support && OpenUI5Support.attachListeners();
34
- insertFontFace();
35
- insertSystemCSSVars();
36
- await eventProvider.fireEventAsync("boot");
37
- booted = true;
55
+ return bootPromise;
38
56
  };
39
57
 
40
58
  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;
@@ -75,6 +79,7 @@ const detectTablet = () => {
75
79
  const supportsTouch = () => touch;
76
80
  const isIE = () => ie;
77
81
  const isSafari = () => safari;
82
+ const isChrome = () => chrome;
78
83
 
79
84
  const isTablet = () => {
80
85
  detectTablet();
@@ -90,11 +95,22 @@ const isDesktop = () => {
90
95
  return (!isTablet() && !isPhone()) || isWindows8OrAbove();
91
96
  };
92
97
 
98
+ const isCombi = () => {
99
+ return isTablet() && isDesktop();
100
+ };
101
+
102
+ const isIOS = () => {
103
+ return iOS;
104
+ };
105
+
93
106
  export {
94
107
  supportsTouch,
95
108
  isIE,
96
109
  isSafari,
110
+ isChrome,
97
111
  isPhone,
98
112
  isTablet,
99
113
  isDesktop,
114
+ isCombi,
115
+ isIOS,
100
116
  };
@@ -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
 
@@ -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
+ };