@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
@@ -0,0 +1,106 @@
1
+ import { registerFeature } from "../FeaturesRegistry.js";
2
+ import { isF6Next, isF6Previous } from "../Keys.js";
3
+ import { getFirstFocusableElement } from "../util/FocusableElements.js";
4
+
5
+ class F6Navigation {
6
+ init() {
7
+ this.keydownHandler = this._keydownHandler.bind(this);
8
+ this.attachEventListeners();
9
+ this.selectedGroup = null;
10
+ this.groups = [];
11
+ }
12
+
13
+ attachEventListeners() {
14
+ document.addEventListener("keydown", this.keydownHandler);
15
+ }
16
+
17
+ async _keydownHandler(event) {
18
+ if (isF6Next(event)) {
19
+ this.updateGroups();
20
+ if (this.groups.length < 1) {
21
+ return;
22
+ }
23
+
24
+ const nextIndex = this.groups.indexOf(this.selectedGroup);
25
+ let nextElement = null;
26
+
27
+ if (nextIndex > -1) {
28
+ if (nextIndex + 1 >= this.groups.length) {
29
+ nextElement = this.groups[0];
30
+ } else {
31
+ nextElement = this.groups[nextIndex + 1];
32
+ }
33
+ } else {
34
+ nextElement = this.groups[0];
35
+ }
36
+
37
+ const elementToFocus = await getFirstFocusableElement(nextElement.isUI5Element ? nextElement.getDomRef() : nextElement, true);
38
+ elementToFocus.focus();
39
+ }
40
+
41
+ if (isF6Previous(event)) {
42
+ this.updateGroups();
43
+ if (this.groups.length < 1) {
44
+ return;
45
+ }
46
+
47
+ const nextIndex = this.groups.indexOf(this.selectedGroup);
48
+ let nextElement = null;
49
+
50
+ if (nextIndex > -1) {
51
+ if (nextIndex - 1 < 0) {
52
+ nextElement = this.groups[this.groups.length - 1];
53
+ } else {
54
+ // Handle the situation where the first focusable element of two neighbor groups is the same
55
+ // For example:
56
+ // <ui5-flexible-column-layout>
57
+ // <ui5-list>
58
+ // <ui5-li>List Item</ui5-li>
59
+ // </ui5-list>
60
+ // </ui5-flexible-column-layout>
61
+ // Here for both FCL & List the firstFoccusableElement is the same (the ui5-li)
62
+
63
+ const firstFocusable = await getFirstFocusableElement(this.groups[nextIndex - 1], true);
64
+ const shouldSkipParent = firstFocusable === await getFirstFocusableElement(this.groups[nextIndex], true);
65
+
66
+ nextElement = this.groups[shouldSkipParent ? nextIndex - 2 : nextIndex - 1];
67
+ }
68
+ } else {
69
+ nextElement = this.groups[this.groups.length - 1];
70
+ }
71
+
72
+ const elementToFocus = await getFirstFocusableElement(nextElement.isUI5Element ? nextElement.getDomRef() : nextElement, true);
73
+ elementToFocus.focus();
74
+ }
75
+ }
76
+
77
+ removeEventListeners() {
78
+ document.removeEventListener("keydown", this.keydownHandler);
79
+ }
80
+
81
+ updateGroups() {
82
+ this.setSelectedGroup(document.activeElement);
83
+ this.setGroups();
84
+ }
85
+
86
+ setGroups() {
87
+ this.groups = Array.from(document.querySelectorAll("[data-sap-ui-fastnavgroup='true']")).filter(group => group.clientWidth && window.getComputedStyle(group).visibility !== "hidden");
88
+ }
89
+
90
+ setSelectedGroup(element) {
91
+ while (element && element.getAttribute("data-sap-ui-fastnavgroup") !== "true" && element !== document.querySelector("html")) {
92
+ element = element.parentElement ? element.parentNode : element.parentNode.host;
93
+ }
94
+
95
+ this.selectedGroup = element;
96
+ }
97
+
98
+ destroy() {
99
+ this.removeEventListeners();
100
+ }
101
+ }
102
+
103
+ const F6HelperInstance = new F6Navigation();
104
+ registerFeature("F6Navigation", F6HelperInstance);
105
+
106
+ export default F6Navigation;
@@ -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"]},"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_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"]}};
2
2
 
3
3
  const DEFAULT_THEME = assetParameters.themes.default;
4
4
  const DEFAULT_LANGUAGE = assetParameters.languages.default;
@@ -0,0 +1,10 @@
1
+ const VersionInfo = {
2
+ version: "0.0.0-cf069fb29",
3
+ major: 0,
4
+ minor: 0,
5
+ patch: 0,
6
+ suffix: "-cf069fb29",
7
+ isNext: true,
8
+ buildTime: 1643285894,
9
+ };
10
+ export default VersionInfo;
@@ -0,0 +1,5 @@
1
+ export default {
2
+ packageName: "@ui5/webcomponents-base",
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")}`
5
+ };
@@ -0,0 +1,5 @@
1
+ export default {
2
+ packageName: "@ui5/webcomponents-base",
3
+ fileName: "OverrideFontFace.css",
4
+ content: `@font-face{font-family:'72override';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;src:local('Arial'),local('Helvetica'),local('sans-serif')}`
5
+ };
@@ -0,0 +1,5 @@
1
+ export default {
2
+ packageName: "@ui5/webcomponents-base",
3
+ fileName: "SystemCSSVars.css",
4
+ content: `:root{--_ui5_content_density:cozy}.sapUiSizeCompact,.ui5-content-density-compact,[data-ui5-compact-size]{--_ui5_content_density:compact}[dir=rtl]{--_ui5_dir:rtl}[dir=ltr]{--_ui5_dir:ltr}`
5
+ };
@@ -3,6 +3,8 @@ import formatMessage from "./util/formatMessage.js";
3
3
 
4
4
  const I18nBundleInstances = new Map();
5
5
 
6
+ let customGetI18nBundle;
7
+
6
8
  /**
7
9
  * @class
8
10
  * @public
@@ -15,6 +17,7 @@ class I18nBundle {
15
17
  /**
16
18
  * Returns a text in the currently loaded language
17
19
  *
20
+ * @public
18
21
  * @param {Object|String} textObj key/defaultText pair or just the key
19
22
  * @param params Values for the placeholders
20
23
  * @returns {*}
@@ -38,7 +41,7 @@ class I18nBundle {
38
41
  }
39
42
  }
40
43
 
41
- const getI18nBundle = packageName => {
44
+ const getI18nBundleSync = packageName => {
42
45
  if (I18nBundleInstances.has(packageName)) {
43
46
  return I18nBundleInstances.get(packageName);
44
47
  }
@@ -48,8 +51,36 @@ const getI18nBundle = packageName => {
48
51
  return i18nBundle;
49
52
  };
50
53
 
54
+ /**
55
+ * Allows developers to provide a custom getI18nBundle implementation
56
+ * If this function is called, the custom implementation will be used for all components and will completely
57
+ * replace the default implementation.
58
+ *
59
+ * @public
60
+ * @param customGet the function to use instead of the standard getI18nBundle implementation
61
+ */
62
+ const registerCustomI18nBundleGetter = customGet => {
63
+ customGetI18nBundle = customGet;
64
+ };
65
+
66
+ /**
67
+ * Fetches and returns the I18nBundle instance for the given package
68
+ *
69
+ * @public
70
+ * @param packageName
71
+ * @returns {Promise<I18nBundle>}
72
+ */
73
+ const getI18nBundle = async packageName => {
74
+ if (customGetI18nBundle) {
75
+ return customGetI18nBundle(packageName);
76
+ }
77
+
78
+ await fetchI18nBundle(packageName);
79
+ return getI18nBundleSync(packageName);
80
+ };
81
+
51
82
  export {
52
83
  registerI18nLoader,
53
- fetchI18nBundle,
54
84
  getI18nBundle,
85
+ registerCustomI18nBundleGetter,
55
86
  };
@@ -1,31 +1,34 @@
1
- import { html, svg, render } from "lit-html/lit-html.js";
2
- import scopeHTML from "./scopeHTML.js";
1
+ import { render } from "lit-html";
2
+ import {
3
+ html,
4
+ svg,
5
+ unsafeStatic,
6
+ } from "lit-html/static.js";
3
7
 
4
- let tags;
5
- let suffix;
6
-
7
- const setTags = t => {
8
- tags = t;
9
- };
10
- const setSuffix = s => {
11
- suffix = s;
12
- };
13
-
14
- const litRender = (templateResult, domNode, styles, { eventContext } = {}) => {
15
- if (styles) {
16
- templateResult = html`<style>${styles}</style>${templateResult}`;
8
+ const litRender = (templateResult, domNode, styleStrOrHrefsArr, { host } = {}) => {
9
+ if (typeof styleStrOrHrefsArr === "string") {
10
+ templateResult = html`<style>${styleStrOrHrefsArr}</style>${templateResult}`;
11
+ } else if (Array.isArray(styleStrOrHrefsArr) && styleStrOrHrefsArr.length) {
12
+ templateResult = html`${styleStrOrHrefsArr.map(href => html`<link type="text/css" rel="stylesheet" href="${href}">`)}${templateResult}`;
17
13
  }
18
- render(templateResult, domNode, { eventContext });
14
+ render(templateResult, domNode, { host });
19
15
  };
20
16
 
21
- const scopedHtml = (strings, ...values) => html(scopeHTML(strings, tags, suffix), ...values);
22
- const scopedSvg = (strings, ...values) => svg(scopeHTML(strings, tags, suffix), ...values);
17
+ const scopeTag = (tag, tags, suffix) => {
18
+ const resultTag = suffix && (tags || []).includes(tag) ? `${tag}-${suffix}` : tag;
19
+ return unsafeStatic(resultTag);
20
+ };
23
21
 
24
- export { setTags, setSuffix };
25
- export { scopedHtml as html, scopedSvg as svg };
22
+ export {
23
+ html,
24
+ svg,
25
+ unsafeStatic,
26
+ };
27
+ export { scopeTag };
26
28
  export { repeat } from "lit-html/directives/repeat.js";
27
29
  export { classMap } from "lit-html/directives/class-map.js";
28
- export { styleMap } from "lit-html/directives/style-map.js";
30
+ export { styleMap } from "./directives/style-map.js";
31
+ export { ifDefined } from "lit-html/directives/if-defined.js";
29
32
  export { unsafeHTML } from "lit-html/directives/unsafe-html.js";
30
33
 
31
34
  export default litRender;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2018 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+
7
+ /**
8
+ * This is the original style-map.js directive from lit-html 2 with the only difference that "render" is not called even for the first rendering (update is used instead)
9
+ */
10
+
11
+ import { noChange } from 'lit-html';
12
+ import { directive, Directive, PartType, } from 'lit-html/directive.js';
13
+ class StyleMapDirective extends Directive {
14
+ constructor(partInfo) {
15
+ var _a;
16
+ super(partInfo);
17
+ if (partInfo.type !== PartType.ATTRIBUTE ||
18
+ partInfo.name !== 'style' ||
19
+ ((_a = partInfo.strings) === null || _a === void 0 ? void 0 : _a.length) > 2) {
20
+ throw new Error('The `styleMap` directive must be used in the `style` attribute ' +
21
+ 'and must be the only part in the attribute.');
22
+ }
23
+ }
24
+ render(styleInfo) {
25
+ return "";
26
+ }
27
+ update(part, [styleInfo]) {
28
+ const { style } = part.element;
29
+ if (this._previousStyleProperties === undefined) {
30
+ this._previousStyleProperties = new Set();
31
+ for (const name in styleInfo) {
32
+ this._previousStyleProperties.add(name);
33
+ }
34
+ // return this.render(styleInfo);
35
+ }
36
+ // Remove old properties that no longer exist in styleInfo
37
+ // We use forEach() instead of for-of so that re don't require down-level
38
+ // iteration.
39
+ this._previousStyleProperties.forEach((name) => {
40
+ // If the name isn't in styleInfo or it's null/undefined
41
+ if (styleInfo[name] == null) {
42
+ this._previousStyleProperties.delete(name);
43
+ if (name.includes('-')) {
44
+ style.removeProperty(name);
45
+ }
46
+ else {
47
+ // Note reset using empty string (vs null) as IE11 does not always
48
+ // reset via null (https://developer.mozilla.org/en-US/docs/Web/API/ElementCSSInlineStyle/style#setting_styles)
49
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
+ style[name] = '';
51
+ }
52
+ }
53
+ });
54
+ // Add or update properties
55
+ for (const name in styleInfo) {
56
+ const value = styleInfo[name];
57
+ if (value != null) {
58
+ this._previousStyleProperties.add(name);
59
+ if (name.includes('-')) {
60
+ style.setProperty(name, value);
61
+ }
62
+ else {
63
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
64
+ style[name] = value;
65
+ }
66
+ }
67
+ }
68
+ return noChange;
69
+ }
70
+ }
71
+
72
+ export const styleMap = directive(StyleMapDirective);