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

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 (124) hide show
  1. package/.eslintignore +0 -1
  2. package/CHANGELOG.md +173 -0
  3. package/README.md +28 -6
  4. package/bundle.esm.js +7 -9
  5. package/dist/Boot.js +3 -5
  6. package/dist/CustomElementsRegistry.js +1 -1
  7. package/dist/CustomElementsScope.js +20 -98
  8. package/dist/CustomElementsScopeUtils.js +108 -0
  9. package/dist/Device.js +5 -0
  10. package/dist/Keys.js +24 -0
  11. package/dist/StaticAreaItem.js +1 -1
  12. package/dist/UI5Element.js +24 -2
  13. package/dist/UI5ElementMetadata.js +1 -1
  14. package/dist/asset-registries/Icons.js +4 -8
  15. package/dist/asset-registries/LocaleData.js +7 -2
  16. package/dist/asset-registries/Themes.js +6 -2
  17. package/dist/asset-registries/i18n.js +3 -1
  18. package/dist/assets/bundle.esm.83f057b4.js +43 -0
  19. package/dist/config/Icons.js +52 -0
  20. package/dist/config/Theme.js +11 -0
  21. package/dist/css/BusyIndicator.css +80 -0
  22. package/dist/css/FontFace.css +31 -10
  23. package/dist/delegate/ItemNavigation.js +9 -4
  24. package/dist/features/F6Navigation.js +4 -0
  25. package/dist/features/OpenUI5Enablement.js +119 -0
  26. package/dist/generated/AssetParameters.js +1 -1
  27. package/dist/generated/VersionInfo.js +3 -3
  28. package/dist/generated/css/BusyIndicator.css.js +5 -0
  29. package/dist/generated/css/FontFace.css.js +1 -1
  30. package/dist/i18nBundle.js +1 -1
  31. package/dist/renderer/LitRenderer.js +29 -11
  32. package/dist/renderer/executeTemplate.js +19 -2
  33. package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +1 -1
  34. package/dist/theming/getEffectiveLinksHrefs.js +7 -0
  35. package/dist/theming/getEffectiveStyle.js +9 -0
  36. package/dist/types/DOMReference.js +24 -0
  37. package/dist/updateShadowRoot.js +2 -3
  38. package/dist/util/AriaLabelHelper.js +2 -4
  39. package/dist/util/Caret.js +1 -14
  40. package/dist/util/ColorConversion.js +30 -2
  41. package/dist/util/InvisibleMessage.js +20 -9
  42. package/dist/util/TabbableElements.js +4 -0
  43. package/dist/util/getEffectiveScrollbarStyle.js +5 -0
  44. package/dist/util/getNormalizedTarget.js +16 -0
  45. package/dist/util/isDefaultSlotProvided.js +11 -0
  46. package/hash.txt +1 -1
  47. package/lib/generate-asset-parameters/index.js +8 -4
  48. package/lib/generate-styles/index.js +17 -9
  49. package/lib/generate-version-info/index.js +18 -13
  50. package/package-scripts.js +16 -27
  51. package/package.json +7 -6
  52. package/src/Boot.js +3 -5
  53. package/src/CustomElementsRegistry.js +1 -1
  54. package/src/CustomElementsScope.js +20 -98
  55. package/src/CustomElementsScopeUtils.js +108 -0
  56. package/src/Device.js +5 -0
  57. package/src/Keys.js +24 -0
  58. package/src/StaticAreaItem.js +1 -1
  59. package/src/UI5Element.js +24 -2
  60. package/src/UI5ElementMetadata.js +1 -1
  61. package/src/asset-registries/Icons.js +4 -8
  62. package/src/asset-registries/LocaleData.js +7 -2
  63. package/src/asset-registries/Themes.js +6 -2
  64. package/src/asset-registries/i18n.js +3 -1
  65. package/src/config/Icons.js +52 -0
  66. package/src/config/Theme.js +11 -0
  67. package/src/css/BusyIndicator.css +80 -0
  68. package/src/css/FontFace.css +31 -10
  69. package/src/delegate/ItemNavigation.js +9 -4
  70. package/src/features/F6Navigation.js +4 -0
  71. package/src/features/OpenUI5Enablement.js +119 -0
  72. package/src/i18nBundle.js +1 -1
  73. package/src/renderer/LitRenderer.js +29 -11
  74. package/src/renderer/executeTemplate.js +19 -2
  75. package/src/theming/getEffectiveLinksHrefs.js +7 -0
  76. package/src/theming/getEffectiveStyle.js +9 -0
  77. package/src/types/DOMReference.js +24 -0
  78. package/src/updateShadowRoot.js +2 -3
  79. package/src/util/AriaLabelHelper.js +2 -4
  80. package/src/util/Caret.js +1 -14
  81. package/src/util/ColorConversion.js +30 -2
  82. package/src/util/InvisibleMessage.js +20 -9
  83. package/src/util/TabbableElements.js +4 -0
  84. package/src/util/getEffectiveScrollbarStyle.js +5 -0
  85. package/src/util/getNormalizedTarget.js +16 -0
  86. package/src/util/isDefaultSlotProvided.js +11 -0
  87. package/config/.eslintrc.js +0 -3
  88. package/config/rollup.config.js +0 -1
  89. package/dist/isLegacyBrowser.js +0 -3
  90. package/dist/resources/bundle.esm.js +0 -37
  91. package/dist/resources/bundle.esm.js.map +0 -1
  92. package/dist/test-resources/assets/Themes.js +0 -17
  93. package/dist/test-resources/elements/Child.js +0 -35
  94. package/dist/test-resources/elements/Generic.js +0 -84
  95. package/dist/test-resources/elements/GenericExt.js +0 -26
  96. package/dist/test-resources/elements/NoShadowDOM.js +0 -13
  97. package/dist/test-resources/elements/Parent.js +0 -41
  98. package/dist/test-resources/elements/WithStaticArea.js +0 -77
  99. package/dist/test-resources/pages/AllTestElements.html +0 -42
  100. package/dist/test-resources/pages/Configuration.html +0 -18
  101. package/dist/test-resources/pages/ConfigurationScript.html +0 -34
  102. package/dist/test-resources/pages/assets/messagebundle_de.properties +0 -1
  103. package/dist/test-resources/pages/assets/messagebundle_en.properties +0 -1
  104. package/dist/test-resources/pages/assets/messagebundle_es.properties +0 -1
  105. package/dist/test-resources/pages/assets/messagebundle_fr.properties +0 -1
  106. package/dist/test-resources/pages/i18n.html +0 -33
  107. package/dist/test-resources/specs/ConfigurationChange.spec.js +0 -27
  108. package/dist/test-resources/specs/ConfigurationScript.spec.js +0 -63
  109. package/dist/test-resources/specs/ConfigurationURL.spec.js +0 -93
  110. package/dist/test-resources/specs/CustomTheme.spec.js +0 -27
  111. package/dist/test-resources/specs/EventProvider.spec.js +0 -63
  112. package/dist/test-resources/specs/StaticArea.spec.js +0 -78
  113. package/dist/test-resources/specs/Theming.spec.js +0 -33
  114. package/dist/test-resources/specs/UI5ElementInvalidation.js +0 -242
  115. package/dist/test-resources/specs/UI5ElementLifecycle.js +0 -98
  116. package/dist/test-resources/specs/UI5ElementListenForChildPropChanges.spec.js +0 -75
  117. package/dist/test-resources/specs/UI5ElementMetadataExt.js +0 -42
  118. package/dist/test-resources/specs/UI5ElementPropertyValidation.js +0 -14
  119. package/dist/test-resources/specs/UI5ElementPropsAndAttrs.spec.js +0 -67
  120. package/dist/test-resources/specs/UI5ElementShadowDOM.js +0 -24
  121. package/dist/test-resources/specs/UI5ElementSlots.js +0 -36
  122. package/dist/util/findNodeOwner.js +0 -35
  123. package/src/isLegacyBrowser.js +0 -3
  124. package/src/util/findNodeOwner.js +0 -35
@@ -0,0 +1,119 @@
1
+ import { registerFeature } from "../FeaturesRegistry.js";
2
+ import BusyIndicatorStyles from "../generated/css/BusyIndicator.css.js";
3
+ import merge from "../thirdparty/merge.js";
4
+ import {
5
+ isTabPrevious,
6
+ } from "../Keys.js";
7
+
8
+ const busyIndicatorMetadata = {
9
+ properties: {
10
+ __isBusy: {
11
+ type: Boolean,
12
+ },
13
+ },
14
+ };
15
+
16
+ const getBusyIndicatorStyles = () => {
17
+ return BusyIndicatorStyles;
18
+ };
19
+
20
+ const wrapTemplateResultInBusyMarkup = (html, host, templateResult) => {
21
+ if (host.isOpenUI5Component && host.__isBusy) {
22
+ templateResult = html`
23
+ <div class="busy-indicator-wrapper">
24
+ <span tabindex="0" busy-indicator-before-span @focusin=${host.__suppressFocusIn}></span>
25
+ ${templateResult}
26
+ <div class="busy-indicator-overlay"></div>
27
+ <div busy-indicator
28
+ class="busy-indicator-busy-area"
29
+ tabindex="0"
30
+ role="progressbar"
31
+ @keydown=${host.__suppressFocusBack}
32
+ aria-valuemin="0"
33
+ aria-valuemax="100"
34
+ aria-valuetext="Busy">
35
+ <div>
36
+ <div class="busy-indicator-circle circle-animation-0"></div>
37
+ <div class="busy-indicator-circle circle-animation-1"></div>
38
+ <div class="busy-indicator-circle circle-animation-2"></div>
39
+ </div>
40
+ </div>
41
+ </div>`;
42
+ }
43
+
44
+ return templateResult;
45
+ };
46
+
47
+ const enrichBusyIndicatorMetadata = UI5Element => {
48
+ UI5Element.metadata = merge(UI5Element.metadata, busyIndicatorMetadata);
49
+ };
50
+
51
+ const enrichBusyIndicatorMethods = UI5ElementPrototype => {
52
+ Object.defineProperties(UI5ElementPrototype, {
53
+ "__redirectFocus": { value: true, writable: true },
54
+ "__suppressFocusBack": {
55
+ get() {
56
+ const that = this;
57
+
58
+ return {
59
+ handleEvent: e => {
60
+ if (isTabPrevious(e)) {
61
+ const beforeElem = that.shadowRoot.querySelector("[busy-indicator-before-span]");
62
+ that.__redirectFocus = false;
63
+ beforeElem.focus();
64
+ that.__redirectFocus = true;
65
+ }
66
+ },
67
+ capture: true,
68
+ passive: false,
69
+ };
70
+ },
71
+ },
72
+ "isOpenUI5Component": { get: () => { return true; } },
73
+ });
74
+
75
+ UI5ElementPrototype.__suppressFocusIn = function handleFocusIn() {
76
+ const busyIndicator = this.shadowRoot.querySelector("[busy-indicator]");
77
+ if (busyIndicator && this.__redirectFocus) {
78
+ busyIndicator.focus();
79
+ }
80
+ };
81
+
82
+ UI5ElementPrototype.getDomRef = function getDomRef() {
83
+ // If a component set _getRealDomRef to its children, use the return value of this function
84
+ if (typeof this._getRealDomRef === "function") {
85
+ return this._getRealDomRef();
86
+ }
87
+
88
+ if (!this.shadowRoot || this.shadowRoot.children.length === 0) {
89
+ return;
90
+ }
91
+
92
+ const children = [...this.shadowRoot.children].filter(child => !["link", "style"].includes(child.localName));
93
+
94
+ if (children.length !== 1) {
95
+ console.warn(`The shadow DOM for ${this.constructor.getMetadata().getTag()} does not have a top level element, the getDomRef() method might not work as expected`); // eslint-disable-line
96
+ }
97
+
98
+ if (this.__isBusy) {
99
+ return children[0].querySelector(".busy-indicator-wrapper > :not([busy-indicator-before-span]):not(.busy-indicator-overlay):not(.busy-indicator-busy-area)");
100
+ }
101
+
102
+ return children[0];
103
+ };
104
+ };
105
+
106
+ const enrichBusyIndicatorSettings = UI5Element => {
107
+ enrichBusyIndicatorMetadata(UI5Element);
108
+ enrichBusyIndicatorMethods(UI5Element.prototype);
109
+ };
110
+
111
+ const OpenUI5Enablement = {
112
+ enrichBusyIndicatorSettings,
113
+ wrapTemplateResultInBusyMarkup,
114
+ getBusyIndicatorStyles,
115
+ };
116
+
117
+ export default OpenUI5Enablement;
118
+
119
+ registerFeature("OpenUI5Enablement", OpenUI5Enablement);
@@ -1,4 +1,4 @@
1
- const assetParameters = {"themes":{"default":"sap_fiori_3","all":["sap_fiori_3","sap_fiori_3_dark","sap_belize","sap_belize_hcb","sap_belize_hcw","sap_fiori_3_hcb","sap_fiori_3_hcw","sap_horizon","sap_horizon_exp"]},"languages":{"default":"en","all":["ar","bg","ca","cs","cy","da","de","el","en","en_GB","en_US_sappsd","en_US_saprigi","en_US_saptrc","es","es_MX","et","fi","fr","fr_CA","hi","hr","hu","in","it","iw","ja","kk","ko","lt","lv","ms","nl","no","pl","pt_PT","pt","ro","ru","sh","sk","sl","sv","th","tr","uk","vi","zh_CN","zh_TW"]},"locales":{"default":"en","all":["ar","ar_EG","ar_SA","bg","ca","cs","da","de","de_AT","de_CH","el","el_CY","en","en_AU","en_GB","en_HK","en_IE","en_IN","en_NZ","en_PG","en_SG","en_ZA","es","es_AR","es_BO","es_CL","es_CO","es_MX","es_PE","es_UY","es_VE","et","fa","fi","fr","fr_BE","fr_CA","fr_CH","fr_LU","he","hi","hr","hu","id","it","it_CH","ja","kk","ko","lt","lv","ms","nb","nl","nl_BE","pl","pt","pt_PT","ro","ru","ru_UA","sk","sl","sr","sv","th","tr","uk","vi","zh_CN","zh_HK","zh_SG","zh_TW"]}};
1
+ const assetParameters = {"themes":{"default":"sap_fiori_3","all":["sap_fiori_3","sap_fiori_3_dark","sap_belize","sap_belize_hcb","sap_belize_hcw","sap_fiori_3_hcb","sap_fiori_3_hcw","sap_horizon","sap_horizon_dark","sap_horizon_hcb","sap_horizon_hcw","sap_horizon_exp"]},"languages":{"default":"en","all":["ar","bg","ca","cs","cy","da","de","el","en","en_GB","en_US_sappsd","en_US_saprigi","en_US_saptrc","es","es_MX","et","fi","fr","fr_CA","hi","hr","hu","in","it","iw","ja","kk","ko","lt","lv","ms","nl","no","pl","pt_PT","pt","ro","ru","sh","sk","sl","sv","th","tr","uk","vi","zh_CN","zh_TW"]},"locales":{"default":"en","all":["ar","ar_EG","ar_SA","bg","ca","cs","da","de","de_AT","de_CH","el","el_CY","en","en_AU","en_GB","en_HK","en_IE","en_IN","en_NZ","en_PG","en_SG","en_ZA","es","es_AR","es_BO","es_CL","es_CO","es_MX","es_PE","es_UY","es_VE","et","fa","fi","fr","fr_BE","fr_CA","fr_CH","fr_LU","he","hi","hr","hu","id","it","it_CH","ja","kk","ko","lt","lv","ms","nb","nl","nl_BE","pl","pt","pt_PT","ro","ru","ru_UA","sk","sl","sr","sr_Latn","sv","th","tr","uk","vi","zh_CN","zh_HK","zh_SG","zh_TW"]}};
2
2
 
3
3
  const DEFAULT_THEME = assetParameters.themes.default;
4
4
  const DEFAULT_LANGUAGE = assetParameters.languages.default;
@@ -1,10 +1,10 @@
1
1
  const VersionInfo = {
2
- version: "0.0.0-cf069fb29",
2
+ version: "0.0.0-cf50976ce",
3
3
  major: 0,
4
4
  minor: 0,
5
5
  patch: 0,
6
- suffix: "-cf069fb29",
6
+ suffix: "-cf50976ce",
7
7
  isNext: true,
8
- buildTime: 1643285894,
8
+ buildTime: 1663566007,
9
9
  };
10
10
  export default VersionInfo;
@@ -0,0 +1,5 @@
1
+ export default {
2
+ packageName: "@ui5/webcomponents-base",
3
+ fileName: "BusyIndicator.css",
4
+ content: `.busy-indicator-wrapper{position:relative;height:100%;width:100%}.busy-indicator-overlay{display:var(--ui5_web_components_busy_indicator_display);position:absolute;inset:0;background:var(--ui5_web_components_busy_indicator_background-color);z-index:99}.busy-indicator-busy-area{display:var(--ui5_web_components_busy_indicator_display);position:absolute;z-index:99;inset:0;justify-content:center;align-items:center;background-color:inherit;flex-direction:column;color:var(--_ui5_busy_indicator_color)}:host([__is-busy]) .busy-indicator-wrapper>:not(.busy-indicator-busy-area):not(.busy-indicator-overlay):not([busy-indicator-before-span]){--ui5_web_components_busy_indicator_display:none}.busy-indicator-busy-area:focus{outline:var(--_ui5_busy_indicator_focus_outline);outline-offset:-.125rem}.busy-indicator-circle{width:1rem;height:1rem;display:inline-block;background-color:currentColor;border-radius:50%}.circle-animation-0{animation:grow 1.6s infinite cubic-bezier(.32,.06,.85,1.11)}.circle-animation-1{animation:grow 1.6s infinite cubic-bezier(.32,.06,.85,1.11);animation-delay:.2s}.circle-animation-2{animation:grow 1.6s infinite cubic-bezier(.32,.06,.85,1.11);animation-delay:.4s}.sapUiLocalBusy{--ui5_web_components_busy_indicator_display:none}.busy-indicator-wrapper [ui5-busy-indicator]{display:none}@keyframes grow{0%,100%,50%{-webkit-transform:scale(.5);-moz-transform:scale(.5);-ms-transform:scale(.5);transform:scale(.5)}25%{-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);transform:scale(1)}}`
5
+ };
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  packageName: "@ui5/webcomponents-base",
3
3
  fileName: "FontFace.css",
4
- content: `@font-face{font-family:"72";font-style:normal;font-weight:400;src:local("72"),url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular.woff2?ui5-webcomponents) format("woff2"),url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular.woff?ui5-webcomponents) format("woff")}@font-face{font-family:"72full";font-style:normal;font-weight:400;src:local('72-full'),url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular-full.woff2?ui5-webcomponents) format("woff2"),url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular-full.woff?ui5-webcomponents) format("woff")}@font-face{font-family:"72";font-style:normal;font-weight:700;src:local('72-Bold'),url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff2?ui5-webcomponents) format("woff2"),url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff?ui5-webcomponents) format("woff")}@font-face{font-family:"72full";font-style:normal;font-weight:700;src:local('72-Bold-full'),url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff2?ui5-webcomponents) format("woff2"),url(https://ui5.sap.com/sdk/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff?ui5-webcomponents) format("woff")}@font-face{font-family:"72Black";font-style:bold;font-weight:900;src:local('72Black'),url(https://openui5nightly.hana.ondemand.com/resources/sap/ui/core/themes/sap_horizon/fonts/72-Black.woff2?ui5-webcomponents) format("woff2"),url(https://openui5nightly.hana.ondemand.com/resources/sap/ui/core/themes/sap_horizon/fonts/72-Black.woff?ui5-webcomponents) format("woff")}`
4
+ content: `@font-face{font-family:"72";font-style:normal;font-weight:400;src:local("72"),url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular.woff2?ui5-webcomponents) format("woff2")}@font-face{font-family:"72full";font-style:normal;font-weight:400;src:local('72-full'),url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Regular-full.woff2?ui5-webcomponents) format("woff2")}@font-face{font-family:"72";font-style:normal;font-weight:700;src:local('72-Bold'),url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff2?ui5-webcomponents) format("woff2")}@font-face{font-family:"72full";font-style:normal;font-weight:700;src:local('72-Bold-full'),url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff2?ui5-webcomponents) format("woff2")}@font-face{font-family:'72-Bold';font-style:normal;src:local('72-Bold'),url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold.woff2?ui5-webcomponents) format("woff2")}@font-face{font-family:'72-Boldfull';font-style:normal;src:url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Bold-full.woff2?ui5-webcomponents) format("woff2")}@font-face{font-family:'72-Light';font-style:normal;src:local('72-Light'),url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Light.woff2?ui5-webcomponents) format("woff2")}@font-face{font-family:'72-Lightfull';font-style:normal;src:url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_fiori_3/fonts/72-Light-full.woff2?ui5-webcomponents) format("woff2")}@font-face{font-family:"72Black";font-style:bold;font-weight:900;src:local('72Black'),url(https://sdk.openui5.org/resources/sap/ui/core/themes/sap_horizon/fonts/72-Black.woff2?ui5-webcomponents) format("woff2")}`
5
5
  };
@@ -37,7 +37,7 @@ class I18nBundle {
37
37
  }
38
38
  const messageText = bundle && bundle[textObj.key] ? bundle[textObj.key] : (textObj.defaultText || textObj.key);
39
39
 
40
- return formatMessage(messageText, params);
40
+ return params.length ? formatMessage(messageText, params) : messageText;
41
41
  }
42
42
  }
43
43
 
@@ -1,28 +1,46 @@
1
- import { render } from "lit-html";
2
1
  import {
2
+ render,
3
3
  html,
4
4
  svg,
5
- unsafeStatic,
6
- } from "lit-html/static.js";
5
+ } from "lit-html";
6
+ import { getFeature } from "../FeaturesRegistry.js";
7
+
8
+ const effectiveHtml = (...args) => {
9
+ const LitStatic = getFeature("LitStatic");
10
+ const fn = LitStatic ? LitStatic.html : html;
11
+ return fn(...args);
12
+ };
13
+
14
+ const effectiveSvg = (...args) => {
15
+ const LitStatic = getFeature("LitStatic");
16
+ const fn = LitStatic ? LitStatic.svg : svg;
17
+ return fn(...args);
18
+ };
19
+
20
+ const litRender = (templateResult, domNode, styleStrOrHrefsArr, forStaticArea, { host } = {}) => {
21
+ const OpenUI5Enablement = getFeature("OpenUI5Enablement");
22
+ if (OpenUI5Enablement && !forStaticArea) {
23
+ templateResult = OpenUI5Enablement.wrapTemplateResultInBusyMarkup(effectiveHtml, host, templateResult);
24
+ }
7
25
 
8
- const litRender = (templateResult, domNode, styleStrOrHrefsArr, { host } = {}) => {
9
26
  if (typeof styleStrOrHrefsArr === "string") {
10
- templateResult = html`<style>${styleStrOrHrefsArr}</style>${templateResult}`;
27
+ templateResult = effectiveHtml`<style>${styleStrOrHrefsArr}</style>${templateResult}`;
11
28
  } else if (Array.isArray(styleStrOrHrefsArr) && styleStrOrHrefsArr.length) {
12
- templateResult = html`${styleStrOrHrefsArr.map(href => html`<link type="text/css" rel="stylesheet" href="${href}">`)}${templateResult}`;
29
+ templateResult = effectiveHtml`${styleStrOrHrefsArr.map(href => effectiveHtml`<link type="text/css" rel="stylesheet" href="${href}">`)}${templateResult}`;
13
30
  }
14
31
  render(templateResult, domNode, { host });
15
32
  };
16
33
 
17
34
  const scopeTag = (tag, tags, suffix) => {
18
- const resultTag = suffix && (tags || []).includes(tag) ? `${tag}-${suffix}` : tag;
19
- return unsafeStatic(resultTag);
35
+ const LitStatic = getFeature("LitStatic");
36
+ if (LitStatic) {
37
+ return LitStatic.unsafeStatic((tags || []).includes(tag) ? `${tag}-${suffix}` : tag);
38
+ }
20
39
  };
21
40
 
22
41
  export {
23
- html,
24
- svg,
25
- unsafeStatic,
42
+ effectiveHtml as html,
43
+ effectiveSvg as svg,
26
44
  };
27
45
  export { scopeTag };
28
46
  export { repeat } from "lit-html/directives/repeat.js";
@@ -1,4 +1,4 @@
1
- import { getCustomElementsScopingSuffix, shouldScopeCustomElement } from "../CustomElementsScope.js";
1
+ import { getCustomElementsScopingSuffix, shouldScopeCustomElement } from "../CustomElementsScopeUtils.js";
2
2
 
3
3
  /**
4
4
  * Runs a component's template with the component's current state, while also scoping HTML
@@ -9,9 +9,26 @@ import { getCustomElementsScopingSuffix, shouldScopeCustomElement } from "../Cus
9
9
  * @returns {*}
10
10
  */
11
11
  const executeTemplate = (template, component) => {
12
- const tagsToScope = component.constructor.getUniqueDependencies().map(dep => dep.getMetadata().getPureTag()).filter(shouldScopeCustomElement);
12
+ const tagsToScope = getTagsToScope(component);
13
13
  const scope = getCustomElementsScopingSuffix();
14
14
  return template(component, tagsToScope, scope);
15
15
  };
16
16
 
17
+ /**
18
+ * Returns all tags, used inside component's template subject to scoping.
19
+ * @param component - the component
20
+ * @returns {Array[]}
21
+ * @private
22
+ */
23
+ const getTagsToScope = component => {
24
+ const componentTag = component.constructor.getMetadata().getPureTag();
25
+ const tagsToScope = component.constructor.getUniqueDependencies().map(dep => dep.getMetadata().getPureTag()).filter(shouldScopeCustomElement);
26
+
27
+ if (shouldScopeCustomElement(componentTag)) {
28
+ tagsToScope.push(componentTag);
29
+ }
30
+
31
+ return tagsToScope;
32
+ };
33
+
17
34
  export default executeTemplate;
@@ -1989,7 +1989,7 @@ if (typeof window !== 'undefined') {
1989
1989
  }
1990
1990
  /*!
1991
1991
  * OpenUI5
1992
- * (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
1992
+ * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
1993
1993
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
1994
1994
  */
1995
1995
  // Based on coding from the HTML4 Sanitizer by Google Inc.
@@ -1,4 +1,5 @@
1
1
  import { getUrl } from "../CSP.js";
2
+ import { getFeature } from "../FeaturesRegistry.js";
2
3
 
3
4
  const flatten = arr => {
4
5
  return arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flatten(val) : val), []);
@@ -6,6 +7,8 @@ const flatten = arr => {
6
7
 
7
8
  const getEffectiveLinksHrefs = (ElementClass, forStaticArea = false) => {
8
9
  let stylesData = ElementClass[forStaticArea ? "staticAreaStyles" : "styles"];
10
+ const OpenUI5Enablement = getFeature("OpenUI5Enablement");
11
+
9
12
  if (!stylesData) {
10
13
  return;
11
14
  }
@@ -14,6 +17,10 @@ const getEffectiveLinksHrefs = (ElementClass, forStaticArea = false) => {
14
17
  stylesData = [stylesData];
15
18
  }
16
19
 
20
+ if (OpenUI5Enablement) {
21
+ stylesData.push(OpenUI5Enablement.getBusyIndicatorStyles());
22
+ }
23
+
17
24
  return flatten(stylesData).filter(data => !!data).map(data => getUrl(data.packageName, data.fileName));
18
25
  };
19
26
 
@@ -1,5 +1,6 @@
1
1
  import { getCustomCSS, attachCustomCSSChange } from "./CustomStyle.js";
2
2
  import getStylesString from "./getStylesString.js";
3
+ import { getFeature } from "../FeaturesRegistry.js";
3
4
 
4
5
  const effectiveStyleMap = new Map();
5
6
 
@@ -10,9 +11,15 @@ attachCustomCSSChange(tag => {
10
11
  const getEffectiveStyle = (ElementClass, forStaticArea = false) => {
11
12
  const tag = ElementClass.getMetadata().getTag();
12
13
  const key = `${tag}_${forStaticArea ? "static" : "normal"}`;
14
+ const OpenUI5Enablement = getFeature("OpenUI5Enablement");
13
15
 
14
16
  if (!effectiveStyleMap.has(key)) {
15
17
  let effectiveStyle;
18
+ let busyIndicatorStyles = "";
19
+
20
+ if (OpenUI5Enablement) {
21
+ busyIndicatorStyles = getStylesString(OpenUI5Enablement.getBusyIndicatorStyles());
22
+ }
16
23
 
17
24
  if (forStaticArea) {
18
25
  effectiveStyle = getStylesString(ElementClass.staticAreaStyles);
@@ -21,6 +28,8 @@ const getEffectiveStyle = (ElementClass, forStaticArea = false) => {
21
28
  const builtInStyles = getStylesString(ElementClass.styles);
22
29
  effectiveStyle = `${builtInStyles} ${customStyle}`;
23
30
  }
31
+
32
+ effectiveStyle = `${effectiveStyle} ${busyIndicatorStyles}`;
24
33
  effectiveStyleMap.set(key, effectiveStyle);
25
34
  }
26
35
 
@@ -0,0 +1,24 @@
1
+ import DataType from "./DataType.js";
2
+
3
+ /**
4
+ * @class
5
+ * DOM Element reference or ID.
6
+ * <b>Note:</b> If an ID is passed, it is expected to be part of the same <code>document</code> element as the consuming component.
7
+ *
8
+ * @public
9
+ */
10
+ class DOMReference extends DataType {
11
+ static isValid(value) {
12
+ return (typeof value === "string" || value instanceof HTMLElement);
13
+ }
14
+
15
+ static propertyToAttribute(propertyValue) {
16
+ if (propertyValue instanceof HTMLElement) {
17
+ return null;
18
+ }
19
+
20
+ return propertyValue;
21
+ }
22
+ }
23
+
24
+ export default DOMReference;
@@ -2,7 +2,6 @@ import executeTemplate from "./renderer/executeTemplate.js";
2
2
  import getConstructableStyle from "./theming/getConstructableStyle.js";
3
3
  import getEffectiveStyle from "./theming/getEffectiveStyle.js";
4
4
  import getEffectiveLinksHrefs from "./theming/getEffectiveLinksHrefs.js";
5
- import isLegacyBrowser from "./isLegacyBrowser.js";
6
5
  import { shouldUseLinks } from "./CSP.js";
7
6
 
8
7
  /**
@@ -20,11 +19,11 @@ const updateShadowRoot = (element, forStaticArea = false) => {
20
19
  styleStrOrHrefsArr = getEffectiveLinksHrefs(element.constructor, forStaticArea);
21
20
  } else if (document.adoptedStyleSheets) { // Chrome
22
21
  shadowRoot.adoptedStyleSheets = getConstructableStyle(element.constructor, forStaticArea);
23
- } else if (!isLegacyBrowser()) { // FF, Safari
22
+ } else { // FF, Safari
24
23
  styleStrOrHrefsArr = getEffectiveStyle(element.constructor, forStaticArea);
25
24
  }
26
25
 
27
- element.constructor.render(renderResult, shadowRoot, styleStrOrHrefsArr, { host: element });
26
+ element.constructor.render(renderResult, shadowRoot, styleStrOrHrefsArr, forStaticArea, { host: element });
28
27
  };
29
28
 
30
29
  export default updateShadowRoot;
@@ -1,5 +1,3 @@
1
- import findNodeOwner from "./findNodeOwner.js";
2
-
3
1
  const getEffectiveAriaLabelText = el => {
4
2
  if (!el.accessibleNameRef) {
5
3
  if (el.accessibleName) {
@@ -15,12 +13,12 @@ const getEffectiveAriaLabelText = el => {
15
13
  /**
16
14
  *
17
15
  * @param {HTMLElement} el Defines the HTMLElement, for which you need to get all related texts
18
- * @param {HTMLElement} ownerDocument (Optional) Defines the HTMLElement(might document or custom element) where the you want to search for the texts.
16
+ * @param {Document|HTMLElement} ownerDocument (Optional) Defines the document or element where you want to search for the texts
19
17
  * @param {String} readyIds (Optional) Defines a string of elements ids. The text of these elements will be returned. If used you should provide either el or ownerDocument
20
18
  */
21
19
  const getAriaLabelledByTexts = (el, ownerDocument, readyIds = "") => {
22
20
  const ids = (readyIds && readyIds.split(" ")) || el.accessibleNameRef.split(" ");
23
- const owner = ownerDocument || findNodeOwner(el);
21
+ const owner = ownerDocument || el.getRootNode();
24
22
  let result = "";
25
23
 
26
24
  ids.forEach((elementId, index) => {
@@ -6,20 +6,7 @@ const getCaretPosition = field => {
6
6
  // Initialize
7
7
  let caretPos = 0;
8
8
 
9
- // IE Support
10
- if (document.selection) {
11
- // Set focus on the element
12
- field.focus();
13
-
14
- // To get cursor position, get empty selection range
15
- const selection = document.selection.createRange();
16
-
17
- // Move selection start to 0 position
18
- selection.moveStart("character", -field.value.length);
19
-
20
- // The caret position is selection length
21
- caretPos = selection.text.length;
22
- } else if (field.selectionStart || field.selectionStart === "0") { // Firefox support
9
+ if (field.selectionStart || field.selectionStart === "0") { // Firefox support
23
10
  caretPos = field.selectionDirection === "backward" ? field.selectionStart : field.selectionEnd;
24
11
  }
25
12
 
@@ -163,7 +163,7 @@ const getRGBColor = color => {
163
163
  }
164
164
 
165
165
  if (color.startsWith("rgb")) {
166
- return RGBToRGB(color);
166
+ return RGBStringToRGBObject(color);
167
167
  }
168
168
 
169
169
  // HEX
@@ -209,7 +209,7 @@ const RGBAToRGB = color => {
209
209
  * Return an object with the properties for each of the main colors(red, green, blue)
210
210
  * @param {String} color Receives a color in the following format: "rgb(0, 0, 0)
211
211
  */
212
- const RGBToRGB = color => {
212
+ const RGBStringToRGBObject = color => {
213
213
  const openingBracketIndex = color.indexOf("("),
214
214
  closingBraketIndex = color.indexOf(")"),
215
215
  commasIndexes = [];
@@ -319,6 +319,32 @@ const HEXToRGB = hex => {
319
319
  return rgbValues;
320
320
  };
321
321
 
322
+ /**
323
+ * Returns the hex value of the color as string
324
+ * @param {Object} color Receives an object with the properties for each of the main colors(r, g, b)
325
+ */
326
+ const RGBtoHEX = color => {
327
+ const hexMap = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E"];
328
+ let hexValue = "#";
329
+
330
+ let divisionNumber = color.r / 16;
331
+ let remainder = color.r % 16;
332
+ hexValue += String(hexMap[Math.floor(divisionNumber)]);
333
+ hexValue += String(hexMap[remainder]);
334
+
335
+ divisionNumber = color.g / 16;
336
+ remainder = color.g % 16;
337
+ hexValue += String(hexMap[Math.floor(divisionNumber)]);
338
+ hexValue += String(hexMap[remainder]);
339
+
340
+ divisionNumber = color.b / 16;
341
+ remainder = color.b % 16;
342
+ hexValue += String(hexMap[Math.floor(divisionNumber)]);
343
+ hexValue += String(hexMap[remainder]);
344
+
345
+ return hexValue;
346
+ };
347
+
322
348
  const RGBToHSL = (color = {
323
349
  r: undefined,
324
350
  g: undefined,
@@ -367,4 +393,6 @@ export {
367
393
  HSLToRGB,
368
394
  HEXToRGB,
369
395
  RGBToHSL,
396
+ RGBStringToRGBObject,
397
+ RGBtoHEX,
370
398
  };
@@ -5,18 +5,20 @@ import { attachBoot } from "../Boot.js";
5
5
  let politeSpan;
6
6
  let assertiveSpan;
7
7
 
8
+ const setOutOfViewportStyles = el => {
9
+ el.style.position = "absolute";
10
+ el.style.clip = "rect(1px,1px,1px,1px)";
11
+ el.style.userSelect = "none";
12
+ el.style.left = "-1000px";
13
+ el.style.top = "-1000px";
14
+ el.style.pointerEvents = "none";
15
+ };
16
+
8
17
  attachBoot(() => {
9
18
  if (politeSpan && assertiveSpan) {
10
19
  return;
11
20
  }
12
21
 
13
- const styles = `position: absolute;
14
- clip: rect(1px,1px,1px,1px);
15
- user-select: none;
16
- left: -1000px;
17
- top: -1000px;
18
- pointer-events: none;`;
19
-
20
22
  politeSpan = document.createElement("span");
21
23
  assertiveSpan = document.createElement("span");
22
24
 
@@ -29,8 +31,8 @@ attachBoot(() => {
29
31
  politeSpan.setAttribute("role", "alert");
30
32
  assertiveSpan.setAttribute("role", "alert");
31
33
 
32
- politeSpan.style.cssText = styles;
33
- assertiveSpan.style.cssText = styles;
34
+ setOutOfViewportStyles(politeSpan);
35
+ setOutOfViewportStyles(assertiveSpan);
34
36
 
35
37
  getSingletonElementInstance("ui5-static-area").appendChild(politeSpan);
36
38
  getSingletonElementInstance("ui5-static-area").appendChild(assertiveSpan);
@@ -41,6 +43,7 @@ attachBoot(() => {
41
43
  *
42
44
  * @param {string} message String to be announced by the screen reader.
43
45
  * @param {sap.ui.core.InvisibleMessageMode} mode The mode to be inserted in the aria-live attribute.
46
+ * @public
44
47
  */
45
48
  const announce = (message, mode) => {
46
49
  // If no type is presented, fallback to polite announcement.
@@ -53,6 +56,14 @@ const announce = (message, mode) => {
53
56
  if (mode !== InvisibleMessageMode.Assertive && mode !== InvisibleMessageMode.Polite) {
54
57
  console.warn(`You have entered an invalid mode. Valid values are: "Polite" and "Assertive". The framework will automatically set the mode to "Polite".`); // eslint-disable-line
55
58
  }
59
+
60
+ // clear the span in order to avoid reading it out while in JAWS reading node
61
+ setTimeout(() => {
62
+ // ensure that we clear the text node only if no announce is made in the meantime
63
+ if (span.textContent === message) {
64
+ span.textContent = "";
65
+ }
66
+ }, 3000);
56
67
  };
57
68
 
58
69
  export default announce;
@@ -27,6 +27,10 @@ const getTabbables = (nodes, tabbables) => {
27
27
  currentNode = Array.from(children).find(node => node.tagName !== "STYLE");
28
28
  }
29
29
 
30
+ if (!currentNode) {
31
+ return;
32
+ }
33
+
30
34
  if (isNodeTabbable(currentNode)) {
31
35
  tabbablesNodes.push(currentNode);
32
36
  }
@@ -0,0 +1,5 @@
1
+ const NO_SCROLLBAR_STYLE_CLASS = "ui5-content-native-scrollbars";
2
+
3
+ const getEffectiveScrollbarStyle = () => document.body.classList.contains(NO_SCROLLBAR_STYLE_CLASS);
4
+
5
+ export default getEffectiveScrollbarStyle;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Returns the normalized event target in cases when it has shadow root.
3
+ * @param {Object} target The original event target
4
+ * @returns {Object} The normalized target
5
+ */
6
+ const getNormalizedTarget = target => {
7
+ let element = target;
8
+
9
+ if (target.shadowRoot && target.shadowRoot.activeElement) {
10
+ element = target.shadowRoot.activeElement;
11
+ }
12
+
13
+ return element;
14
+ };
15
+
16
+ export default getNormalizedTarget;
@@ -0,0 +1,11 @@
1
+ import { getSlotName } from "./SlotsHelper.js";
2
+
3
+ const isDefaultSlotProvided = element => {
4
+ return Array.from(element.childNodes).filter(node => {
5
+ return node.nodeType !== Node.COMMENT_NODE
6
+ && getSlotName(node) === "default"
7
+ && (node.nodeType !== Node.TEXT_NODE || node.nodeValue.trim().length !== 0);
8
+ }).length > 0;
9
+ };
10
+
11
+ export default isDefaultSlotProvided;
package/hash.txt CHANGED
@@ -1 +1 @@
1
- ua2aB/RqgDa340pisVBkdGw/gH4=
1
+ XeoUDYYqmjUwnJg4dGNgbPltSMo=
@@ -1,5 +1,4 @@
1
- const fs = require('fs');
2
- const mkdirp = require('mkdirp');
1
+ const fs = require('fs').promises;
3
2
  const assets = require('@ui5/webcomponents-tools/assets-meta.js');
4
3
 
5
4
  const fileContent = `const assetParameters = ${JSON.stringify(assets)};
@@ -16,6 +15,11 @@ export {
16
15
  SUPPORTED_LOCALES,
17
16
  };`;
18
17
 
19
- mkdirp.sync("dist/generated/");
20
- fs.writeFileSync("dist/generated/AssetParameters.js", fileContent);
18
+ const generate = async () => {
19
+ await fs.mkdir("dist/generated/", { recursive: true });
20
+ return fs.writeFile("dist/generated/AssetParameters.js", fileContent);
21
+ }
21
22
 
23
+ generate().then(() => {
24
+ console.log("Assets parameters generated.");
25
+ });