@ui5/webcomponents-base 0.0.0-0af474175 → 0.0.0-0dd36ca4b

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 (297) hide show
  1. package/CHANGELOG.md +1055 -0
  2. package/README.md +2 -9
  3. package/config/wdio.conf.cjs +0 -8
  4. package/dist/.tsbuildinfo +1 -0
  5. package/dist/AssetRegistry.d.ts +2 -2
  6. package/dist/AssetRegistry.js +2 -2
  7. package/dist/AssetRegistry.js.map +1 -1
  8. package/dist/Boot.d.ts +3 -2
  9. package/dist/Boot.js +8 -6
  10. package/dist/Boot.js.map +1 -1
  11. package/dist/CustomElementsScope.d.ts +4 -4
  12. package/dist/CustomElementsScope.js +2 -2
  13. package/dist/CustomElementsScope.js.map +1 -1
  14. package/dist/CustomElementsScopeUtils.d.ts +8 -1
  15. package/dist/CustomElementsScopeUtils.js +13 -1
  16. package/dist/CustomElementsScopeUtils.js.map +1 -1
  17. package/dist/Device.d.ts +2 -2
  18. package/dist/Device.js +14 -12
  19. package/dist/Device.js.map +1 -1
  20. package/dist/FontFace.js +1 -1
  21. package/dist/FontFace.js.map +1 -1
  22. package/dist/IgnoreCustomElements.d.ts +3 -5
  23. package/dist/IgnoreCustomElements.js +3 -5
  24. package/dist/IgnoreCustomElements.js.map +1 -1
  25. package/dist/InitialConfiguration.d.ts +2 -2
  26. package/dist/InitialConfiguration.js +7 -6
  27. package/dist/InitialConfiguration.js.map +1 -1
  28. package/dist/Keys.d.ts +7 -1
  29. package/dist/Keys.js +113 -106
  30. package/dist/Keys.js.map +1 -1
  31. package/dist/ManagedStyles.d.ts +5 -4
  32. package/dist/ManagedStyles.js +55 -60
  33. package/dist/ManagedStyles.js.map +1 -1
  34. package/dist/MediaRange.d.ts +6 -12
  35. package/dist/MediaRange.js +21 -31
  36. package/dist/MediaRange.js.map +1 -1
  37. package/dist/UI5Element.d.ts +48 -53
  38. package/dist/UI5Element.js +127 -100
  39. package/dist/UI5Element.js.map +1 -1
  40. package/dist/UI5ElementMetadata.d.ts +13 -13
  41. package/dist/UI5ElementMetadata.js +26 -15
  42. package/dist/UI5ElementMetadata.js.map +1 -1
  43. package/dist/asset-registries/Icons.d.ts +4 -3
  44. package/dist/asset-registries/Icons.js +28 -17
  45. package/dist/asset-registries/Icons.js.map +1 -1
  46. package/dist/asset-registries/Illustrations.d.ts +2 -0
  47. package/dist/asset-registries/Illustrations.js +51 -20
  48. package/dist/asset-registries/Illustrations.js.map +1 -1
  49. package/dist/asset-registries/LocaleData.js +1 -1
  50. package/dist/asset-registries/LocaleData.js.map +1 -1
  51. package/dist/asset-registries/Themes.d.ts +4 -3
  52. package/dist/asset-registries/Themes.js +26 -10
  53. package/dist/asset-registries/Themes.js.map +1 -1
  54. package/dist/asset-registries/i18n.d.ts +2 -2
  55. package/dist/asset-registries/i18n.js +4 -3
  56. package/dist/asset-registries/i18n.js.map +1 -1
  57. package/dist/{assets-meta → asset-registries/util}/IconCollectionsAlias.d.ts +1 -2
  58. package/dist/{assets-meta → asset-registries/util}/IconCollectionsAlias.js +1 -2
  59. package/dist/asset-registries/util/IconCollectionsAlias.js.map +1 -0
  60. package/dist/asset-registries/util/IconCollectionsByTheme.d.ts +20 -0
  61. package/dist/asset-registries/util/IconCollectionsByTheme.js +42 -0
  62. package/dist/asset-registries/util/IconCollectionsByTheme.js.map +1 -0
  63. package/dist/asset-registries/util/getIconCollectionByTheme.d.ts +13 -0
  64. package/dist/asset-registries/util/getIconCollectionByTheme.js +29 -0
  65. package/dist/asset-registries/util/getIconCollectionByTheme.js.map +1 -0
  66. package/dist/config/CalendarType.d.ts +8 -1
  67. package/dist/config/CalendarType.js +18 -2
  68. package/dist/config/CalendarType.js.map +1 -1
  69. package/dist/config/Icons.d.ts +9 -24
  70. package/dist/config/Icons.js +8 -67
  71. package/dist/config/Icons.js.map +1 -1
  72. package/dist/config/Language.d.ts +1 -1
  73. package/dist/config/Language.js +6 -3
  74. package/dist/config/Language.js.map +1 -1
  75. package/dist/config/Theme.d.ts +4 -3
  76. package/dist/config/Theme.js +13 -6
  77. package/dist/config/Theme.js.map +1 -1
  78. package/dist/config/ThemeRoot.d.ts +2 -4
  79. package/dist/config/ThemeRoot.js +2 -4
  80. package/dist/config/ThemeRoot.js.map +1 -1
  81. package/dist/config/Timezone.d.ts +1 -1
  82. package/dist/config/Timezone.js +1 -1
  83. package/dist/config/Timezone.js.map +1 -1
  84. package/dist/connectToComponent.d.ts +9 -0
  85. package/dist/connectToComponent.js +59 -0
  86. package/dist/connectToComponent.js.map +1 -0
  87. package/dist/css/FontFace.css +47 -17
  88. package/dist/css/SystemCSSVars.css +0 -8
  89. package/dist/custom-elements-internal.json +2952 -0
  90. package/dist/custom-elements.json +2583 -0
  91. package/dist/decorators/customElement.d.ts +3 -3
  92. package/dist/decorators/customElement.js +10 -5
  93. package/dist/decorators/customElement.js.map +1 -1
  94. package/dist/decorators/event.d.ts +5 -2
  95. package/dist/decorators/event.js.map +1 -1
  96. package/dist/decorators.d.ts +5 -0
  97. package/dist/decorators.js +6 -0
  98. package/dist/decorators.js.map +1 -0
  99. package/dist/delegate/ItemNavigation.d.ts +9 -8
  100. package/dist/delegate/ItemNavigation.js +13 -14
  101. package/dist/delegate/ItemNavigation.js.map +1 -1
  102. package/dist/delegate/ResizeHandler.d.ts +4 -6
  103. package/dist/delegate/ResizeHandler.js +4 -6
  104. package/dist/delegate/ResizeHandler.js.map +1 -1
  105. package/dist/delegate/ScrollEnablement.js +2 -2
  106. package/dist/delegate/ScrollEnablement.js.map +1 -1
  107. package/dist/features/InputElementsFormSupport.d.ts +18 -0
  108. package/dist/features/InputElementsFormSupport.js +40 -0
  109. package/dist/features/InputElementsFormSupport.js.map +1 -0
  110. package/dist/features/OpenUI5Enablement.d.ts +1 -1
  111. package/dist/features/OpenUI5Support.d.ts +13 -5
  112. package/dist/features/OpenUI5Support.js +87 -46
  113. package/dist/features/OpenUI5Support.js.map +1 -1
  114. package/dist/features/patchPatcher.d.ts +11 -0
  115. package/dist/features/patchPatcher.js +11 -0
  116. package/dist/features/patchPatcher.js.map +1 -0
  117. package/dist/features/patchPopup.d.ts +14 -0
  118. package/dist/features/patchPopup.js +50 -0
  119. package/dist/features/patchPopup.js.map +1 -0
  120. package/dist/generated/AssetParameters.d.ts +6 -0
  121. package/dist/generated/AssetParameters.js +3 -10
  122. package/dist/generated/AssetParameters.js.map +1 -0
  123. package/dist/generated/VersionInfo.d.ts +10 -0
  124. package/dist/generated/VersionInfo.js +9 -8
  125. package/dist/generated/VersionInfo.js.map +1 -0
  126. package/dist/generated/css/FontFace.css.js +1 -1
  127. package/dist/generated/css/FontFace.css.js.map +1 -1
  128. package/dist/generated/css/SystemCSSVars.css.js +1 -1
  129. package/dist/generated/css/SystemCSSVars.css.js.map +1 -1
  130. package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.d.ts +1 -1
  131. package/dist/i18nBundle.d.ts +2 -4
  132. package/dist/i18nBundle.js +1 -4
  133. package/dist/i18nBundle.js.map +1 -1
  134. package/dist/locale/applyDirection.d.ts +3 -2
  135. package/dist/locale/applyDirection.js +3 -2
  136. package/dist/locale/applyDirection.js.map +1 -1
  137. package/dist/locale/getEffectiveDir.d.ts +1 -1
  138. package/dist/locale/getEffectiveDir.js +3 -19
  139. package/dist/locale/getEffectiveDir.js.map +1 -1
  140. package/dist/renderer/LitRenderer.d.ts +2 -2
  141. package/dist/renderer/LitRenderer.js +2 -8
  142. package/dist/renderer/LitRenderer.js.map +1 -1
  143. package/dist/renderer/directives/style-map.d.ts +13 -0
  144. package/dist/renderer/directives/style-map.js +59 -59
  145. package/dist/renderer/directives/style-map.js.map +1 -0
  146. package/dist/sap/base/Log.js +698 -188
  147. package/dist/sap/base/assert.js +28 -1
  148. package/dist/sap/base/config/MemoryConfigurationProvider.js +20 -0
  149. package/dist/sap/base/security/URLListValidator.js +253 -6
  150. package/dist/sap/base/security/encodeCSS.js +34 -8
  151. package/dist/sap/base/security/encodeXML.js +47 -17
  152. package/dist/sap/base/security/sanitizeHTML.js +35 -13
  153. package/dist/sap/base/strings/toHex.js +27 -2
  154. package/dist/sap/base/util/now.js +24 -3
  155. package/dist/sap/base/util/uid.js +27 -0
  156. package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +112 -97
  157. package/dist/ssr-dom-shim.d.ts +1 -0
  158. package/dist/ssr-dom-shim.js +12 -0
  159. package/dist/ssr-dom-shim.js.map +1 -0
  160. package/dist/ssr-dom.d.ts +0 -0
  161. package/dist/ssr-dom.js +0 -0
  162. package/dist/theming/applyTheme.js +5 -5
  163. package/dist/theming/applyTheme.js.map +1 -1
  164. package/dist/theming/getConstructableStyle.d.ts +1 -1
  165. package/dist/theming/getConstructableStyle.js +3 -3
  166. package/dist/theming/getConstructableStyle.js.map +1 -1
  167. package/dist/theming/getEffectiveStyle.d.ts +1 -1
  168. package/dist/theming/getEffectiveStyle.js +5 -12
  169. package/dist/theming/getEffectiveStyle.js.map +1 -1
  170. package/dist/types/AnimationMode.d.ts +0 -8
  171. package/dist/types/AnimationMode.js +0 -8
  172. package/dist/types/AnimationMode.js.map +1 -1
  173. package/dist/types/AriaHasPopup.d.ts +32 -0
  174. package/dist/types/AriaHasPopup.js +34 -0
  175. package/dist/types/AriaHasPopup.js.map +1 -0
  176. package/dist/types/AriaLandmarkRole.d.ts +79 -0
  177. package/dist/types/AriaLandmarkRole.js +81 -0
  178. package/dist/types/AriaLandmarkRole.js.map +1 -0
  179. package/dist/types/AriaRole.d.ts +27 -0
  180. package/dist/types/AriaRole.js +29 -0
  181. package/dist/types/AriaRole.js.map +1 -0
  182. package/dist/types/CSSColor.d.ts +0 -4
  183. package/dist/types/CSSColor.js +0 -4
  184. package/dist/types/CSSColor.js.map +1 -1
  185. package/dist/types/CSSSize.d.ts +11 -0
  186. package/dist/types/CSSSize.js +14 -0
  187. package/dist/types/CSSSize.js.map +1 -0
  188. package/dist/types/CalendarType.d.ts +0 -9
  189. package/dist/types/CalendarType.js +0 -9
  190. package/dist/types/CalendarType.js.map +1 -1
  191. package/dist/types/DOMReference.d.ts +1 -5
  192. package/dist/types/DOMReference.js +1 -5
  193. package/dist/types/DOMReference.js.map +1 -1
  194. package/dist/types/DataType.d.ts +1 -6
  195. package/dist/types/DataType.js +1 -6
  196. package/dist/types/DataType.js.map +1 -1
  197. package/dist/types/Float.d.ts +0 -3
  198. package/dist/types/Float.js +0 -3
  199. package/dist/types/Float.js.map +1 -1
  200. package/dist/types/Integer.d.ts +0 -3
  201. package/dist/types/Integer.js +0 -3
  202. package/dist/types/Integer.js.map +1 -1
  203. package/dist/types/InvisibleMessageMode.d.ts +5 -10
  204. package/dist/types/InvisibleMessageMode.js +4 -11
  205. package/dist/types/InvisibleMessageMode.js.map +1 -1
  206. package/dist/types/ItemNavigationBehavior.d.ts +0 -6
  207. package/dist/types/ItemNavigationBehavior.js +0 -6
  208. package/dist/types/ItemNavigationBehavior.js.map +1 -1
  209. package/dist/types/MovePlacement.d.ts +20 -0
  210. package/dist/types/MovePlacement.js +22 -0
  211. package/dist/types/MovePlacement.js.map +1 -0
  212. package/dist/types/NavigationMode.d.ts +0 -8
  213. package/dist/types/NavigationMode.js +0 -8
  214. package/dist/types/NavigationMode.js.map +1 -1
  215. package/dist/types/Orientation.d.ts +16 -0
  216. package/dist/types/Orientation.js +18 -0
  217. package/dist/types/Orientation.js.map +1 -0
  218. package/dist/types/ValueState.d.ts +3 -17
  219. package/dist/types/ValueState.js +3 -17
  220. package/dist/types/ValueState.js.map +1 -1
  221. package/dist/types.d.ts +24 -1
  222. package/dist/types.js.map +1 -1
  223. package/dist/updateShadowRoot.d.ts +1 -2
  224. package/dist/updateShadowRoot.js +5 -28
  225. package/dist/updateShadowRoot.js.map +1 -1
  226. package/dist/util/ColorConversion.js +200 -195
  227. package/dist/util/ColorConversion.js.map +1 -1
  228. package/dist/util/InvisibleMessage.d.ts +1 -1
  229. package/dist/util/InvisibleMessage.js.map +1 -1
  230. package/dist/util/PopupUtils.d.ts +1 -3
  231. package/dist/util/PopupUtils.js +1 -15
  232. package/dist/util/PopupUtils.js.map +1 -1
  233. package/dist/util/clamp.js +2 -1
  234. package/dist/util/clamp.js.map +1 -1
  235. package/dist/util/createLinkInHead.d.ts +1 -1
  236. package/dist/util/createLinkInHead.js +1 -1
  237. package/dist/util/createLinkInHead.js.map +1 -1
  238. package/dist/util/detectNavigatorLanguage.d.ts +2 -2
  239. package/dist/util/detectNavigatorLanguage.js +6 -1
  240. package/dist/util/detectNavigatorLanguage.js.map +1 -1
  241. package/dist/util/dragAndDrop/DragRegistry.d.ts +12 -0
  242. package/dist/util/dragAndDrop/DragRegistry.js +68 -0
  243. package/dist/util/dragAndDrop/DragRegistry.js.map +1 -0
  244. package/dist/util/dragAndDrop/findClosestPosition.d.ts +7 -0
  245. package/dist/util/dragAndDrop/findClosestPosition.js +59 -0
  246. package/dist/util/dragAndDrop/findClosestPosition.js.map +1 -0
  247. package/dist/util/dragAndDrop/longDragOverHandler.d.ts +2 -0
  248. package/dist/util/dragAndDrop/longDragOverHandler.js +25 -0
  249. package/dist/util/dragAndDrop/longDragOverHandler.js.map +1 -0
  250. package/dist/util/getClassCopy.d.ts +62 -42
  251. package/dist/util/getDesigntimePropertyAsArray.d.ts +2 -2
  252. package/dist/util/getDesigntimePropertyAsArray.js +2 -1
  253. package/dist/util/getDesigntimePropertyAsArray.js.map +1 -1
  254. package/dist/util/getParentElement.d.ts +2 -0
  255. package/dist/util/getParentElement.js +5 -0
  256. package/dist/util/getParentElement.js.map +1 -0
  257. package/dist/util/isElementContainingBlock.d.ts +2 -0
  258. package/dist/util/isElementContainingBlock.js +11 -0
  259. package/dist/util/isElementContainingBlock.js.map +1 -0
  260. package/dist/vscode.html-custom-data.json +22 -0
  261. package/index.js +3 -19
  262. package/package-scripts.cjs +17 -19
  263. package/package.json +16 -7
  264. package/src/css/FontFace.css +47 -17
  265. package/src/css/SystemCSSVars.css +0 -8
  266. package/tsconfig.json +6 -0
  267. package/.eslintignore +0 -16
  268. package/.eslintrc.cjs +0 -3
  269. package/bundle.esm.js +0 -67
  270. package/dist/CSP.d.ts +0 -30
  271. package/dist/CSP.js +0 -51
  272. package/dist/CSP.js.map +0 -1
  273. package/dist/StaticAreaItem.d.ts +0 -36
  274. package/dist/StaticAreaItem.js +0 -102
  275. package/dist/StaticAreaItem.js.map +0 -1
  276. package/dist/api.json +0 -1
  277. package/dist/assets/Boot.34b7cea0.css +0 -1
  278. package/dist/assets/Boot.4ee0e678.js +0 -9
  279. package/dist/assets/bundle.esm.a67f0b0c.js +0 -50
  280. package/dist/assets-meta/IconCollectionsAlias.js.map +0 -1
  281. package/dist/config/RTL.d.ts +0 -7
  282. package/dist/config/RTL.js +0 -37
  283. package/dist/config/RTL.js.map +0 -1
  284. package/dist/theming/getEffectiveLinksHrefs.d.ts +0 -3
  285. package/dist/theming/getEffectiveLinksHrefs.js +0 -17
  286. package/dist/theming/getEffectiveLinksHrefs.js.map +0 -1
  287. package/dist/theming/preloadLinks.d.ts +0 -3
  288. package/dist/theming/preloadLinks.js +0 -19
  289. package/dist/theming/preloadLinks.js.map +0 -1
  290. package/dist/util/createStyleInHead.d.ts +0 -8
  291. package/dist/util/createStyleInHead.js +0 -18
  292. package/dist/util/createStyleInHead.js.map +0 -1
  293. package/lib/generate-asset-parameters/index.js +0 -27
  294. package/lib/generate-styles/index.js +0 -31
  295. package/lib/generate-version-info/index.js +0 -32
  296. package/src/renderer/directives/style-map.js +0 -72
  297. package/used-modules.txt +0 -10
@@ -1,12 +1,12 @@
1
+ // eslint-disable-next-line import/no-extraneous-dependencies
2
+ import "@ui5/webcomponents-base/dist/ssr-dom.js";
1
3
  import merge from "./thirdparty/merge.js";
2
4
  import { boot } from "./Boot.js";
3
5
  import UI5ElementMetadata from "./UI5ElementMetadata.js";
4
6
  import EventProvider from "./EventProvider.js";
5
- import getSingletonElementInstance from "./util/getSingletonElementInstance.js";
6
- import StaticAreaItem from "./StaticAreaItem.js";
7
7
  import updateShadowRoot from "./updateShadowRoot.js";
8
8
  import { shouldIgnoreCustomElement } from "./IgnoreCustomElements.js";
9
- import { renderDeferred, renderImmediately, cancelRender } from "./Render.js";
9
+ import { renderDeferred, renderImmediately, cancelRender, } from "./Render.js";
10
10
  import { registerTag, isTagRegistered, recordTagRegistrationFailure } from "./CustomElementsRegistry.js";
11
11
  import { observeDOMNode, unobserveDOMNode } from "./DOMObserver.js";
12
12
  import { skipOriginalEvent } from "./config/NoConflict.js";
@@ -16,9 +16,8 @@ import isValidPropertyName from "./util/isValidPropertyName.js";
16
16
  import { getSlotName, getSlottedNodesList } from "./util/SlotsHelper.js";
17
17
  import arraysAreEqual from "./util/arraysAreEqual.js";
18
18
  import { markAsRtlAware } from "./locale/RTLAwareRegistry.js";
19
- import preloadLinks from "./theming/preloadLinks.js";
20
19
  import executeTemplate from "./renderer/executeTemplate.js";
21
- import { getCurrentRuntimeIndex } from "./Runtimes.js";
20
+ import { attachFormElementInternals, setFormValue } from "./features/InputElementsFormSupport.js";
22
21
  let autoId = 0;
23
22
  const elementTimeouts = new Map();
24
23
  const uniqueDependenciesCache = new Map();
@@ -37,15 +36,28 @@ function _invalidate(changeInfo) {
37
36
  this.onInvalidation(changeInfo);
38
37
  this._changedState.push(changeInfo);
39
38
  renderDeferred(this);
40
- this._eventProvider.fireEvent("invalidate", { ...changeInfo, target: this });
39
+ this._invalidationEventProvider.fireEvent("invalidate", { ...changeInfo, target: this });
41
40
  }
42
41
  /**
42
+ * looks up a property descsriptor including in the prototype chain
43
+ * @param proto the starting prototype
44
+ * @param name the property to look for
45
+ * @returns the property descriptor if found directly or in the prototype chaing, undefined if not found
46
+ */
47
+ function getPropertyDescriptor(proto, name) {
48
+ do {
49
+ const descriptor = Object.getOwnPropertyDescriptor(proto, name);
50
+ if (descriptor) {
51
+ return descriptor;
52
+ }
53
+ // go up the prototype chain
54
+ proto = Object.getPrototypeOf(proto);
55
+ } while (proto && proto !== HTMLElement.prototype);
56
+ }
57
+ /**
58
+ * @class
43
59
  * Base class for all UI5 Web Components
44
60
  *
45
- * @class
46
- * @constructor
47
- * @author SAP SE
48
- * @alias sap.ui.webc.base.UI5Element
49
61
  * @extends HTMLElement
50
62
  * @public
51
63
  */
@@ -59,7 +71,8 @@ class UI5Element extends HTMLElement {
59
71
  this._fullyConnected = false; // A flag telling whether the UI5Element's onEnterDOM hook was called (since it's possible to have the element removed from DOM before that)
60
72
  this._childChangeListeners = new Map(); // used to store lazy listeners per slot for the child change event of every child inside that slot
61
73
  this._slotChangeListeners = new Map(); // used to store lazy listeners per slot for the slotchange event of all slot children inside that slot
62
- this._eventProvider = new EventProvider(); // used by parent components for listening to changes to child components
74
+ this._invalidationEventProvider = new EventProvider(); // used by parent components for listening to changes to child components
75
+ this._componentStateFinalizedEventProvider = new EventProvider(); // used by friend classes for synchronization
63
76
  let deferredResolve;
64
77
  this._domRefReadyPromise = new Promise(resolve => {
65
78
  deferredResolve = resolve;
@@ -69,7 +82,8 @@ class UI5Element extends HTMLElement {
69
82
  this._state = { ...ctor.getMetadata().getInitialState() };
70
83
  this._upgradeAllProperties();
71
84
  if (ctor._needsShadowDOM()) {
72
- this.attachShadow({ mode: "open" });
85
+ const defaultOptions = { mode: "open" };
86
+ this.attachShadow({ ...defaultOptions, ...ctor.getMetadata().getShadowRootOptions() });
73
87
  }
74
88
  }
75
89
  /**
@@ -88,18 +102,12 @@ class UI5Element extends HTMLElement {
88
102
  const template = this.constructor.template;
89
103
  return executeTemplate(template, this);
90
104
  }
91
- renderStatic() {
92
- const template = this.constructor.staticAreaTemplate;
93
- return executeTemplate(template, this);
94
- }
95
105
  /**
96
106
  * Do not call this method from derivatives of UI5Element, use "onEnterDOM" only
97
107
  * @private
98
108
  */
99
109
  async connectedCallback() {
100
110
  const ctor = this.constructor;
101
- this.setAttribute(`_ui5rt${getCurrentRuntimeIndex()}`, "");
102
- this.setAttribute("_ui5host", "");
103
111
  this.setAttribute(ctor.getMetadata().getPureTag(), "");
104
112
  if (ctor.getMetadata().supportsF6FastNavigation()) {
105
113
  this.setAttribute("data-sap-ui-fastnavgroup", "true");
@@ -134,9 +142,7 @@ class UI5Element extends HTMLElement {
134
142
  this.onExitDOM();
135
143
  this._fullyConnected = false;
136
144
  }
137
- if (this.staticAreaItem && this.staticAreaItem.parentElement) {
138
- this.staticAreaItem.parentElement.removeChild(this.staticAreaItem);
139
- }
145
+ this._domRefReadyPromise._deferredResolve();
140
146
  cancelRender(this);
141
147
  }
142
148
  /**
@@ -164,14 +170,16 @@ class UI5Element extends HTMLElement {
164
170
  */
165
171
  _startObservingDOMChildren() {
166
172
  const ctor = this.constructor;
167
- const shouldObserveChildren = ctor.getMetadata().hasSlots();
173
+ const metadata = ctor.getMetadata();
174
+ const shouldObserveChildren = metadata.hasSlots();
168
175
  if (!shouldObserveChildren) {
169
176
  return;
170
177
  }
171
- const canSlotText = ctor.getMetadata().canSlotText();
178
+ const canSlotText = metadata.canSlotText();
179
+ const hasClonedSlot = Object.keys(metadata.getSlots()).some(slotName => metadata.getSlots()[slotName].cloned);
172
180
  const mutationObserverOptions = {
173
181
  childList: true,
174
- subtree: canSlotText,
182
+ subtree: canSlotText || hasClonedSlot,
175
183
  characterData: canSlotText,
176
184
  };
177
185
  observeDOMNode(this, this._processChildren.bind(this), mutationObserverOptions);
@@ -234,9 +242,9 @@ class UI5Element extends HTMLElement {
234
242
  const localName = child.localName;
235
243
  const shouldWaitForCustomElement = localName.includes("-") && !shouldIgnoreCustomElement(localName);
236
244
  if (shouldWaitForCustomElement) {
237
- const isDefined = window.customElements.get(localName);
245
+ const isDefined = customElements.get(localName);
238
246
  if (!isDefined) {
239
- const whenDefinedPromise = window.customElements.whenDefined(localName); // Class registered, but instances not upgraded yet
247
+ const whenDefinedPromise = customElements.whenDefined(localName); // Class registered, but instances not upgraded yet
240
248
  let timeoutPromise = elementTimeouts.get(localName);
241
249
  if (!timeoutPromise) {
242
250
  timeoutPromise = new Promise(resolve => setTimeout(resolve, 1000));
@@ -244,7 +252,7 @@ class UI5Element extends HTMLElement {
244
252
  }
245
253
  await Promise.race([whenDefinedPromise, timeoutPromise]);
246
254
  }
247
- window.customElements.upgrade(child);
255
+ customElements.upgrade(child);
248
256
  }
249
257
  }
250
258
  child = ctor.getMetadata().constructor.validateSlotValue(child, slotData);
@@ -284,6 +292,9 @@ class UI5Element extends HTMLElement {
284
292
  reason: "children",
285
293
  });
286
294
  invalidated = true;
295
+ if (ctor.getMetadata().isFormAssociated()) {
296
+ setFormValue(this);
297
+ }
287
298
  }
288
299
  }
289
300
  // If none of the slots had an invalidation due to changes to immediate children,
@@ -319,26 +330,26 @@ class UI5Element extends HTMLElement {
319
330
  /**
320
331
  * Attach a callback that will be executed whenever the component is invalidated
321
332
  *
322
- * @param {InvalidationInfo} callback
333
+ * @param callback
323
334
  * @public
324
335
  */
325
336
  attachInvalidate(callback) {
326
- this._eventProvider.attachEvent("invalidate", callback);
337
+ this._invalidationEventProvider.attachEvent("invalidate", callback);
327
338
  }
328
339
  /**
329
340
  * Detach the callback that is executed whenever the component is invalidated
330
341
  *
331
- * @param {InvalidationInfo} callback
342
+ * @param callback
332
343
  * @public
333
344
  */
334
345
  detachInvalidate(callback) {
335
- this._eventProvider.detachEvent("invalidate", callback);
346
+ this._invalidationEventProvider.detachEvent("invalidate", callback);
336
347
  }
337
348
  /**
338
349
  * Callback that is executed whenever a monitored child changes its state
339
350
  *
340
- * @param {sting} slotName the slot in which a child was invalidated
341
- * @param { ChangeInfo } childChangeInfo the changeInfo object for the child in the given slot
351
+ * @param slotName the slot in which a child was invalidated
352
+ * @param childChangeInfo the changeInfo object for the child in the given slot
342
353
  * @private
343
354
  */
344
355
  _onChildChange(slotName, childChangeInfo) {
@@ -385,6 +396,16 @@ class UI5Element extends HTMLElement {
385
396
  this[nameInCamelCase] = newPropertyValue;
386
397
  }
387
398
  }
399
+ formAssociatedCallback() {
400
+ const ctor = this.constructor;
401
+ if (!ctor.getMetadata().isFormAssociated()) {
402
+ return;
403
+ }
404
+ attachFormElementInternals(this);
405
+ }
406
+ static get formAssociated() {
407
+ return this.getMetadata().isFormAssociated();
408
+ }
388
409
  /**
389
410
  * @private
390
411
  */
@@ -448,7 +469,6 @@ class UI5Element extends HTMLElement {
448
469
  * Returns a singleton event listener for the "change" event of a child in a given slot
449
470
  *
450
471
  * @param slotName the name of the slot, where the child is
451
- * @returns {ChildChangeListener}
452
472
  * @private
453
473
  */
454
474
  _getChildChangeListener(slotName) {
@@ -461,7 +481,6 @@ class UI5Element extends HTMLElement {
461
481
  * Returns a singleton slotchange event listener that invalidates the component due to changes in the given slot
462
482
  *
463
483
  * @param slotName the name of the slot, where the slot element (whose slotchange event we're listening to) is
464
- * @returns {SlotChangeListener}
465
484
  * @private
466
485
  */
467
486
  _getSlotChangeListener(slotName) {
@@ -513,9 +532,9 @@ class UI5Element extends HTMLElement {
513
532
  * 1) children: immediate children (HTML elements or text nodes) were added, removed or reordered in the slot
514
533
  * 2) textcontent: text nodes in the slot changed value (or nested text nodes were added or changed value). Can only trigger for slots of "type: Node"
515
534
  * 3) slotchange: a slot element, slotted inside that slot had its "slotchange" event listener called. This practically means that transitively slotted children changed.
516
- * Can only trigger if the child of a slot is a slot element itself.
535
+ * Can only trigger if the child of a slot is a slot element itself.
517
536
  * 4) childchange: indicates that a UI5Element child in that slot was invalidated and in turn invalidated the component.
518
- * Can only trigger for slots with "invalidateOnChildChange" metadata descriptor
537
+ * Can only trigger for slots with "invalidateOnChildChange" metadata descriptor
519
538
  *
520
539
  * - newValue: the new value of the property (for type="property" only)
521
540
  *
@@ -537,9 +556,7 @@ class UI5Element extends HTMLElement {
537
556
  this._suppressInvalidation = true;
538
557
  this.onBeforeRendering();
539
558
  // Intended for framework usage only. Currently ItemNavigation updates tab indexes after the component has updated its state but before the template is rendered
540
- if (this._onComponentStateFinalized) {
541
- this._onComponentStateFinalized();
542
- }
559
+ this._componentStateFinalizedEventProvider.fireEvent("componentStateFinalized");
543
560
  // resume normal invalidation handling
544
561
  this._suppressInvalidation = false;
545
562
  // Update the shadow root with the render result
@@ -568,9 +585,6 @@ class UI5Element extends HTMLElement {
568
585
  if (ctor._needsShadowDOM()) {
569
586
  updateShadowRoot(this);
570
587
  }
571
- if (this.staticAreaItem) {
572
- this.staticAreaItem.update();
573
- }
574
588
  // Safari requires that children get the slot attribute only after the slot tags have been rendered in the shadow DOM
575
589
  if (hasIndividualSlots) {
576
590
  this._assignIndividualSlotsToChildren();
@@ -610,11 +624,7 @@ class UI5Element extends HTMLElement {
610
624
  if (!this.shadowRoot || this.shadowRoot.children.length === 0) {
611
625
  return;
612
626
  }
613
- const children = [...this.shadowRoot.children].filter(child => !["link", "style"].includes(child.localName));
614
- if (children.length !== 1) {
615
- 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
616
- }
617
- return children[0];
627
+ return this.shadowRoot.children[0];
618
628
  }
619
629
  /**
620
630
  * Returns the DOM Element marked with "data-sap-focus-ref" inside the template.
@@ -639,7 +649,7 @@ class UI5Element extends HTMLElement {
639
649
  }
640
650
  /**
641
651
  * Set the focus to the element, returned by "getFocusDomRef()" (marked by "data-sap-focus-ref")
642
- * @param {FocusOptions} focusOptions additional options for the focus
652
+ * @param focusOptions additional options for the focus
643
653
  * @public
644
654
  */
645
655
  async focus(focusOptions) {
@@ -656,13 +666,13 @@ class UI5Element extends HTMLElement {
656
666
  * @param data - additional data for the event
657
667
  * @param cancelable - true, if the user can call preventDefault on the event object
658
668
  * @param bubbles - true, if the event bubbles
659
- * @returns {boolean} false, if the event was cancelled (preventDefault called), true otherwise
669
+ * @returns false, if the event was cancelled (preventDefault called), true otherwise
660
670
  */
661
671
  fireEvent(name, data, cancelable = false, bubbles = true) {
662
672
  const eventResult = this._fireEvent(name, data, cancelable, bubbles);
663
673
  const camelCaseEventName = kebabToCamelCase(name);
664
674
  if (camelCaseEventName !== name) {
665
- return eventResult && this._fireEvent(camelCaseEventName, data, cancelable);
675
+ return eventResult && this._fireEvent(camelCaseEventName, data, cancelable, bubbles);
666
676
  }
667
677
  return eventResult;
668
678
  }
@@ -697,12 +707,30 @@ class UI5Element extends HTMLElement {
697
707
  getSlottedNodes(slotName) {
698
708
  return getSlottedNodesList(this[slotName]);
699
709
  }
710
+ /**
711
+ * Attach a callback that will be executed whenever the component's state is finalized
712
+ *
713
+ * @param callback
714
+ * @public
715
+ */
716
+ attachComponentStateFinalized(callback) {
717
+ this._componentStateFinalizedEventProvider.attachEvent("componentStateFinalized", callback);
718
+ }
719
+ /**
720
+ * Detach the callback that is executed whenever the component's state is finalized
721
+ *
722
+ * @param callback
723
+ * @public
724
+ */
725
+ detachComponentStateFinalized(callback) {
726
+ this._componentStateFinalizedEventProvider.detachEvent("componentStateFinalized", callback);
727
+ }
700
728
  /**
701
729
  * Determines whether the component should be rendered in RTL mode or not.
702
730
  * Returns: "rtl", "ltr" or undefined
703
731
  *
704
732
  * @public
705
- * @returns {String|undefined}
733
+ * @default undefined
706
734
  */
707
735
  get effectiveDir() {
708
736
  markAsRtlAware(this.constructor); // if a UI5 Element calls this method, it's considered to be rtl-aware
@@ -710,8 +738,8 @@ class UI5Element extends HTMLElement {
710
738
  }
711
739
  /**
712
740
  * Used to duck-type UI5 elements without using instanceof
713
- * @returns {boolean}
714
741
  * @public
742
+ * @default true
715
743
  */
716
744
  get isUI5Element() {
717
745
  return true;
@@ -719,6 +747,13 @@ class UI5Element extends HTMLElement {
719
747
  get classes() {
720
748
  return {};
721
749
  }
750
+ /**
751
+ * Returns the component accessibility info.
752
+ * @private
753
+ */
754
+ get accessibilityInfo() {
755
+ return {};
756
+ }
722
757
  /**
723
758
  * Do not override this method in derivatives of UI5Element, use metadata properties instead
724
759
  * @private
@@ -732,28 +767,6 @@ class UI5Element extends HTMLElement {
732
767
  static _needsShadowDOM() {
733
768
  return !!this.template || Object.prototype.hasOwnProperty.call(this.prototype, "render");
734
769
  }
735
- /**
736
- * @private
737
- */
738
- static _needsStaticArea() {
739
- return !!this.staticAreaTemplate || Object.prototype.hasOwnProperty.call(this.prototype, "renderStatic");
740
- }
741
- /**
742
- * @public
743
- */
744
- getStaticAreaItemDomRef() {
745
- if (!this.constructor._needsStaticArea()) {
746
- throw new Error("This component does not use the static area");
747
- }
748
- if (!this.staticAreaItem) {
749
- this.staticAreaItem = StaticAreaItem.createInstance();
750
- this.staticAreaItem.setOwnerElement(this);
751
- }
752
- if (!this.staticAreaItem.parentElement) {
753
- getSingletonElementInstance("ui5-static-area").appendChild(this.staticAreaItem);
754
- }
755
- return this.staticAreaItem.getDomRef();
756
- }
757
770
  /**
758
771
  * @private
759
772
  */
@@ -778,8 +791,25 @@ class UI5Element extends HTMLElement {
778
791
  if (propData.multiple && propData.defaultValue) {
779
792
  throw new Error(`Cannot set a default value for property "${prop}". All multiple properties are empty arrays by default.`);
780
793
  }
794
+ const descriptor = getPropertyDescriptor(proto, prop);
795
+ // if the decorator is on a setter, proxy the new setter to it
796
+ let origSet;
797
+ if (descriptor?.set) {
798
+ // eslint-disable-next-line @typescript-eslint/unbound-method
799
+ origSet = descriptor.set;
800
+ }
801
+ // if the decorator is on a setter, there will be a corresponding getter - proxy the new getter to it
802
+ let origGet;
803
+ if (descriptor?.get) {
804
+ // eslint-disable-next-line @typescript-eslint/unbound-method
805
+ origGet = descriptor.get;
806
+ }
781
807
  Object.defineProperty(proto, prop, {
782
808
  get() {
809
+ // proxy the getter to the original accessor if there was one
810
+ if (origGet) {
811
+ return origGet.call(this);
812
+ }
783
813
  if (this._state[prop] !== undefined) {
784
814
  return this._state[prop];
785
815
  }
@@ -804,7 +834,7 @@ class UI5Element extends HTMLElement {
804
834
  value = metadataCtor.validatePropertyValue(value, propData);
805
835
  const propertyType = propData.type;
806
836
  let propertyValidator = propData.validator;
807
- const oldState = this._state[prop];
837
+ const oldState = origGet ? origGet.call(this) : this._state[prop];
808
838
  if (propertyType && propertyType.isDataTypeClass) {
809
839
  propertyValidator = propertyType;
810
840
  }
@@ -818,13 +848,22 @@ class UI5Element extends HTMLElement {
818
848
  isDifferent = oldState !== value;
819
849
  }
820
850
  if (isDifferent) {
821
- this._state[prop] = value;
851
+ // if the decorator is on a setter, use it for storage
852
+ if (origSet) {
853
+ origSet.call(this, value);
854
+ }
855
+ else {
856
+ this._state[prop] = value;
857
+ }
822
858
  _invalidate.call(this, {
823
859
  type: "property",
824
860
  name: prop,
825
861
  newValue: value,
826
862
  oldValue: oldState,
827
863
  });
864
+ if (ctor.getMetadata().isFormAssociated()) {
865
+ setFormValue(this);
866
+ }
828
867
  this._updateAttribute(prop, value);
829
868
  }
830
869
  },
@@ -852,20 +891,6 @@ class UI5Element extends HTMLElement {
852
891
  }
853
892
  }
854
893
  }
855
- /**
856
- * Returns the CSS for this UI5 Web Component Class
857
- * @protected
858
- */
859
- static get styles() {
860
- return "";
861
- }
862
- /**
863
- * Returns the Static Area CSS for this UI5 Web Component Class
864
- * @protected
865
- */
866
- static get staticAreaStyles() {
867
- return "";
868
- }
869
894
  /**
870
895
  * Returns an array with the dependencies for this UI5 Web Component, which could be:
871
896
  * - composed components (used in its shadow root or static area item)
@@ -890,8 +915,6 @@ class UI5Element extends HTMLElement {
890
915
  }
891
916
  /**
892
917
  * Returns a promise that resolves whenever all dependencies for this UI5 Web Component have resolved
893
- *
894
- * @returns {Promise}
895
918
  */
896
919
  static whenDependenciesDefined() {
897
920
  return Promise.all(this.getUniqueDependencies().map(dep => dep.define()));
@@ -900,7 +923,6 @@ class UI5Element extends HTMLElement {
900
923
  * Hook that will be called upon custom element definition
901
924
  *
902
925
  * @protected
903
- * @returns {Promise<void>}
904
926
  */
905
927
  static async onDefine() {
906
928
  return Promise.resolve();
@@ -908,7 +930,6 @@ class UI5Element extends HTMLElement {
908
930
  /**
909
931
  * Registers a UI5 Web Component in the browser window object
910
932
  * @public
911
- * @returns {Promise<UI5Element>}
912
933
  */
913
934
  static async define() {
914
935
  await boot();
@@ -925,8 +946,7 @@ class UI5Element extends HTMLElement {
925
946
  else if (!definedGlobally) {
926
947
  this._generateAccessors();
927
948
  registerTag(tag);
928
- window.customElements.define(tag, this);
929
- preloadLinks(this);
949
+ customElements.define(tag, this);
930
950
  }
931
951
  return this;
932
952
  }
@@ -934,7 +954,6 @@ class UI5Element extends HTMLElement {
934
954
  * Returns an instance of UI5ElementMetadata.js representing this UI5 Web Component's full metadata (its and its parents')
935
955
  * Note: not to be confused with the "get metadata()" method, which returns an object for this class's metadata only
936
956
  * @public
937
- * @returns {UI5ElementMetadata}
938
957
  */
939
958
  static getMetadata() {
940
959
  if (this.hasOwnProperty("_metadata")) { // eslint-disable-line
@@ -950,19 +969,27 @@ class UI5Element extends HTMLElement {
950
969
  this._metadata = new UI5ElementMetadata(mergedMetadata);
951
970
  return this._metadata;
952
971
  }
972
+ get validity() { return this._internals?.validity; }
973
+ get validationMessage() { return this._internals?.validationMessage; }
974
+ checkValidity() { return this._internals?.checkValidity(); }
975
+ reportValidity() { return this._internals?.reportValidity(); }
953
976
  }
954
977
  /**
955
978
  * Returns the metadata object for this UI5 Web Component Class
956
979
  * @protected
957
980
  */
958
981
  UI5Element.metadata = {};
982
+ /**
983
+ * Returns the CSS for this UI5 Web Component Class
984
+ * @protected
985
+ */
986
+ UI5Element.styles = "";
959
987
  /**
960
988
  * Always use duck-typing to cover all runtimes on the page.
961
- * @returns {boolean}
962
989
  */
963
990
  const instanceOfUI5Element = (object) => {
964
991
  return "isUI5Element" in object;
965
992
  };
966
993
  export default UI5Element;
967
- export { instanceOfUI5Element };
994
+ export { instanceOfUI5Element, };
968
995
  //# sourceMappingURL=UI5Element.js.map