@ui5/webcomponents-base 0.0.0-d1315d658 → 0.0.0-d473b9686

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 (301) hide show
  1. package/CHANGELOG.md +948 -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/IgnoreCustomElements.d.ts +3 -5
  21. package/dist/IgnoreCustomElements.js +3 -5
  22. package/dist/IgnoreCustomElements.js.map +1 -1
  23. package/dist/InitialConfiguration.d.ts +2 -2
  24. package/dist/InitialConfiguration.js +6 -5
  25. package/dist/InitialConfiguration.js.map +1 -1
  26. package/dist/Keys.d.ts +3 -1
  27. package/dist/Keys.js +109 -106
  28. package/dist/Keys.js.map +1 -1
  29. package/dist/ManagedStyles.d.ts +5 -4
  30. package/dist/ManagedStyles.js +55 -60
  31. package/dist/ManagedStyles.js.map +1 -1
  32. package/dist/MediaRange.d.ts +6 -12
  33. package/dist/MediaRange.js +21 -31
  34. package/dist/MediaRange.js.map +1 -1
  35. package/dist/UI5Element.d.ts +50 -54
  36. package/dist/UI5Element.js +179 -112
  37. package/dist/UI5Element.js.map +1 -1
  38. package/dist/UI5ElementMetadata.d.ts +13 -13
  39. package/dist/UI5ElementMetadata.js +26 -15
  40. package/dist/UI5ElementMetadata.js.map +1 -1
  41. package/dist/asset-registries/Icons.d.ts +4 -3
  42. package/dist/asset-registries/Icons.js +28 -17
  43. package/dist/asset-registries/Icons.js.map +1 -1
  44. package/dist/asset-registries/Illustrations.d.ts +2 -0
  45. package/dist/asset-registries/Illustrations.js +51 -20
  46. package/dist/asset-registries/Illustrations.js.map +1 -1
  47. package/dist/asset-registries/LocaleData.js +1 -1
  48. package/dist/asset-registries/LocaleData.js.map +1 -1
  49. package/dist/asset-registries/Themes.d.ts +4 -3
  50. package/dist/asset-registries/Themes.js +26 -10
  51. package/dist/asset-registries/Themes.js.map +1 -1
  52. package/dist/asset-registries/i18n.d.ts +2 -2
  53. package/dist/asset-registries/i18n.js +4 -3
  54. package/dist/asset-registries/i18n.js.map +1 -1
  55. package/dist/{assets-meta → asset-registries/util}/IconCollectionsAlias.d.ts +1 -2
  56. package/dist/{assets-meta → asset-registries/util}/IconCollectionsAlias.js +1 -2
  57. package/dist/asset-registries/util/IconCollectionsAlias.js.map +1 -0
  58. package/dist/asset-registries/util/IconCollectionsByTheme.d.ts +20 -0
  59. package/dist/asset-registries/util/IconCollectionsByTheme.js +42 -0
  60. package/dist/asset-registries/util/IconCollectionsByTheme.js.map +1 -0
  61. package/dist/asset-registries/util/getIconCollectionByTheme.d.ts +13 -0
  62. package/dist/asset-registries/util/getIconCollectionByTheme.js +29 -0
  63. package/dist/asset-registries/util/getIconCollectionByTheme.js.map +1 -0
  64. package/dist/config/AnimationMode.js +2 -1
  65. package/dist/config/AnimationMode.js.map +1 -1
  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 +13 -1
  88. package/dist/css/SystemCSSVars.css +0 -8
  89. package/dist/decorators/customElement.d.ts +3 -3
  90. package/dist/decorators/customElement.js +11 -6
  91. package/dist/decorators/customElement.js.map +1 -1
  92. package/dist/decorators/event.d.ts +5 -2
  93. package/dist/decorators/event.js.map +1 -1
  94. package/dist/decorators.d.ts +5 -0
  95. package/dist/decorators.js +6 -0
  96. package/dist/decorators.js.map +1 -0
  97. package/dist/delegate/ItemNavigation.d.ts +9 -8
  98. package/dist/delegate/ItemNavigation.js +12 -13
  99. package/dist/delegate/ItemNavigation.js.map +1 -1
  100. package/dist/delegate/ResizeHandler.d.ts +4 -6
  101. package/dist/delegate/ResizeHandler.js +4 -6
  102. package/dist/delegate/ResizeHandler.js.map +1 -1
  103. package/dist/delegate/ScrollEnablement.js +2 -2
  104. package/dist/delegate/ScrollEnablement.js.map +1 -1
  105. package/dist/features/InputElementsFormSupport.d.ts +18 -0
  106. package/dist/features/InputElementsFormSupport.js +40 -0
  107. package/dist/features/InputElementsFormSupport.js.map +1 -0
  108. package/dist/features/OpenUI5Enablement.d.ts +1 -1
  109. package/dist/features/OpenUI5Support.d.ts +0 -2
  110. package/dist/features/OpenUI5Support.js +8 -22
  111. package/dist/features/OpenUI5Support.js.map +1 -1
  112. package/dist/features/patchPatcher.d.ts +11 -0
  113. package/dist/features/patchPatcher.js +11 -0
  114. package/dist/features/patchPatcher.js.map +1 -0
  115. package/dist/features/patchPopup.d.ts +14 -0
  116. package/dist/features/patchPopup.js +50 -0
  117. package/dist/features/patchPopup.js.map +1 -0
  118. package/dist/generated/AssetParameters.d.ts +6 -0
  119. package/dist/generated/AssetParameters.js +3 -10
  120. package/dist/generated/AssetParameters.js.map +1 -0
  121. package/dist/generated/VersionInfo.d.ts +10 -0
  122. package/dist/generated/VersionInfo.js +9 -8
  123. package/dist/generated/VersionInfo.js.map +1 -0
  124. package/dist/generated/css/FontFace.css.js +1 -1
  125. package/dist/generated/css/FontFace.css.js.map +1 -1
  126. package/dist/generated/css/SystemCSSVars.css.js +1 -1
  127. package/dist/generated/css/SystemCSSVars.css.js.map +1 -1
  128. package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.d.ts +1 -1
  129. package/dist/i18nBundle.d.ts +1 -3
  130. package/dist/i18nBundle.js +1 -4
  131. package/dist/i18nBundle.js.map +1 -1
  132. package/dist/locale/applyDirection.d.ts +3 -2
  133. package/dist/locale/applyDirection.js +3 -2
  134. package/dist/locale/applyDirection.js.map +1 -1
  135. package/dist/locale/getEffectiveDir.d.ts +1 -1
  136. package/dist/locale/getEffectiveDir.js +3 -19
  137. package/dist/locale/getEffectiveDir.js.map +1 -1
  138. package/dist/renderer/LitRenderer.d.ts +2 -2
  139. package/dist/renderer/LitRenderer.js +2 -8
  140. package/dist/renderer/LitRenderer.js.map +1 -1
  141. package/dist/renderer/directives/style-map.d.ts +13 -0
  142. package/dist/renderer/directives/style-map.js +59 -59
  143. package/dist/renderer/directives/style-map.js.map +1 -0
  144. package/dist/renderer/executeTemplate.d.ts +8 -0
  145. package/dist/renderer/executeTemplate.js +1 -0
  146. package/dist/renderer/executeTemplate.js.map +1 -1
  147. package/dist/sap/base/Log.js +698 -188
  148. package/dist/sap/base/assert.js +28 -1
  149. package/dist/sap/base/config/MemoryConfigurationProvider.js +20 -0
  150. package/dist/sap/base/security/URLListValidator.js +253 -6
  151. package/dist/sap/base/security/encodeCSS.js +34 -8
  152. package/dist/sap/base/security/encodeXML.js +47 -17
  153. package/dist/sap/base/security/sanitizeHTML.js +35 -13
  154. package/dist/sap/base/strings/toHex.js +27 -2
  155. package/dist/sap/base/util/now.js +24 -3
  156. package/dist/sap/base/util/uid.js +27 -0
  157. package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +1 -1
  158. package/dist/ssr-dom-shim.d.ts +1 -0
  159. package/dist/ssr-dom-shim.js +12 -0
  160. package/dist/ssr-dom-shim.js.map +1 -0
  161. package/dist/ssr-dom.d.ts +0 -0
  162. package/dist/ssr-dom.js +0 -0
  163. package/dist/theming/applyTheme.js +5 -6
  164. package/dist/theming/applyTheme.js.map +1 -1
  165. package/dist/theming/getConstructableStyle.d.ts +1 -1
  166. package/dist/theming/getConstructableStyle.js +3 -3
  167. package/dist/theming/getConstructableStyle.js.map +1 -1
  168. package/dist/theming/getEffectiveStyle.d.ts +1 -1
  169. package/dist/theming/getEffectiveStyle.js +5 -12
  170. package/dist/theming/getEffectiveStyle.js.map +1 -1
  171. package/dist/types/AnimationMode.d.ts +0 -8
  172. package/dist/types/AnimationMode.js +0 -8
  173. package/dist/types/AnimationMode.js.map +1 -1
  174. package/dist/types/AriaHasPopup.d.ts +32 -0
  175. package/dist/types/AriaHasPopup.js +34 -0
  176. package/dist/types/AriaHasPopup.js.map +1 -0
  177. package/dist/types/AriaLandmarkRole.d.ts +79 -0
  178. package/dist/types/AriaLandmarkRole.js +81 -0
  179. package/dist/types/AriaLandmarkRole.js.map +1 -0
  180. package/dist/types/AriaRole.d.ts +27 -0
  181. package/dist/types/AriaRole.js +29 -0
  182. package/dist/types/AriaRole.js.map +1 -0
  183. package/dist/types/CSSColor.d.ts +0 -4
  184. package/dist/types/CSSColor.js +0 -4
  185. package/dist/types/CSSColor.js.map +1 -1
  186. package/dist/types/CSSSize.d.ts +11 -0
  187. package/dist/types/CSSSize.js +14 -0
  188. package/dist/types/CSSSize.js.map +1 -0
  189. package/dist/types/CalendarType.d.ts +0 -9
  190. package/dist/types/CalendarType.js +0 -9
  191. package/dist/types/CalendarType.js.map +1 -1
  192. package/dist/types/DOMReference.d.ts +1 -5
  193. package/dist/types/DOMReference.js +1 -5
  194. package/dist/types/DOMReference.js.map +1 -1
  195. package/dist/types/DataType.d.ts +1 -6
  196. package/dist/types/DataType.js +1 -6
  197. package/dist/types/DataType.js.map +1 -1
  198. package/dist/types/Float.d.ts +0 -3
  199. package/dist/types/Float.js +0 -3
  200. package/dist/types/Float.js.map +1 -1
  201. package/dist/types/Integer.d.ts +0 -3
  202. package/dist/types/Integer.js +0 -3
  203. package/dist/types/Integer.js.map +1 -1
  204. package/dist/types/InvisibleMessageMode.d.ts +5 -10
  205. package/dist/types/InvisibleMessageMode.js +4 -11
  206. package/dist/types/InvisibleMessageMode.js.map +1 -1
  207. package/dist/types/ItemNavigationBehavior.d.ts +0 -6
  208. package/dist/types/ItemNavigationBehavior.js +0 -6
  209. package/dist/types/ItemNavigationBehavior.js.map +1 -1
  210. package/dist/types/MovePlacement.d.ts +20 -0
  211. package/dist/types/MovePlacement.js +22 -0
  212. package/dist/types/MovePlacement.js.map +1 -0
  213. package/dist/types/NavigationMode.d.ts +0 -8
  214. package/dist/types/NavigationMode.js +0 -8
  215. package/dist/types/NavigationMode.js.map +1 -1
  216. package/dist/types/Orientation.d.ts +16 -0
  217. package/dist/types/Orientation.js +18 -0
  218. package/dist/types/Orientation.js.map +1 -0
  219. package/dist/types/ValueState.d.ts +3 -17
  220. package/dist/types/ValueState.js +3 -17
  221. package/dist/types/ValueState.js.map +1 -1
  222. package/dist/types.d.ts +24 -1
  223. package/dist/types.js.map +1 -1
  224. package/dist/updateShadowRoot.d.ts +1 -2
  225. package/dist/updateShadowRoot.js +5 -28
  226. package/dist/updateShadowRoot.js.map +1 -1
  227. package/dist/util/ColorConversion.js +200 -195
  228. package/dist/util/ColorConversion.js.map +1 -1
  229. package/dist/util/InvisibleMessage.d.ts +1 -1
  230. package/dist/util/InvisibleMessage.js +2 -2
  231. package/dist/util/InvisibleMessage.js.map +1 -1
  232. package/dist/util/PopupUtils.d.ts +1 -3
  233. package/dist/util/PopupUtils.js +1 -15
  234. package/dist/util/PopupUtils.js.map +1 -1
  235. package/dist/util/clamp.js +2 -1
  236. package/dist/util/clamp.js.map +1 -1
  237. package/dist/util/createLinkInHead.d.ts +1 -1
  238. package/dist/util/createLinkInHead.js +1 -1
  239. package/dist/util/createLinkInHead.js.map +1 -1
  240. package/dist/util/detectNavigatorLanguage.d.ts +2 -2
  241. package/dist/util/detectNavigatorLanguage.js +6 -1
  242. package/dist/util/detectNavigatorLanguage.js.map +1 -1
  243. package/dist/util/dragAndDrop/DragRegistry.d.ts +12 -0
  244. package/dist/util/dragAndDrop/DragRegistry.js +68 -0
  245. package/dist/util/dragAndDrop/DragRegistry.js.map +1 -0
  246. package/dist/util/dragAndDrop/findClosestPosition.d.ts +7 -0
  247. package/dist/util/dragAndDrop/findClosestPosition.js +59 -0
  248. package/dist/util/dragAndDrop/findClosestPosition.js.map +1 -0
  249. package/dist/util/dragAndDrop/longDragOverHandler.d.ts +2 -0
  250. package/dist/util/dragAndDrop/longDragOverHandler.js +25 -0
  251. package/dist/util/dragAndDrop/longDragOverHandler.js.map +1 -0
  252. package/dist/util/getClassCopy.d.ts +64 -43
  253. package/dist/util/getDesigntimePropertyAsArray.d.ts +2 -2
  254. package/dist/util/getDesigntimePropertyAsArray.js +2 -1
  255. package/dist/util/getDesigntimePropertyAsArray.js.map +1 -1
  256. package/dist/util/getParentElement.d.ts +2 -0
  257. package/dist/util/getParentElement.js +5 -0
  258. package/dist/util/getParentElement.js.map +1 -0
  259. package/dist/util/isElementContainingBlock.d.ts +2 -0
  260. package/dist/util/isElementContainingBlock.js +11 -0
  261. package/dist/util/isElementContainingBlock.js.map +1 -0
  262. package/index.js +3 -19
  263. package/package-scripts.cjs +22 -19
  264. package/package.json +23 -8
  265. package/src/css/FontFace.css +13 -1
  266. package/src/css/SystemCSSVars.css +0 -8
  267. package/tsconfig.json +6 -0
  268. package/.eslintignore +0 -16
  269. package/.eslintrc.cjs +0 -3
  270. package/bundle.esm.js +0 -67
  271. package/dist/CSP.d.ts +0 -30
  272. package/dist/CSP.js +0 -51
  273. package/dist/CSP.js.map +0 -1
  274. package/dist/StaticArea.d.ts +0 -3
  275. package/dist/StaticArea.js +0 -7
  276. package/dist/StaticArea.js.map +0 -1
  277. package/dist/StaticAreaItem.d.ts +0 -37
  278. package/dist/StaticAreaItem.js +0 -105
  279. package/dist/StaticAreaItem.js.map +0 -1
  280. package/dist/api.json +0 -1
  281. package/dist/assets/Boot.34b7cea0.css +0 -1
  282. package/dist/assets/Boot.f668b2d0.js +0 -9
  283. package/dist/assets/bundle.esm.88a9eda7.js +0 -50
  284. package/dist/assets-meta/IconCollectionsAlias.js.map +0 -1
  285. package/dist/config/RTL.d.ts +0 -7
  286. package/dist/config/RTL.js +0 -37
  287. package/dist/config/RTL.js.map +0 -1
  288. package/dist/theming/getEffectiveLinksHrefs.d.ts +0 -3
  289. package/dist/theming/getEffectiveLinksHrefs.js +0 -17
  290. package/dist/theming/getEffectiveLinksHrefs.js.map +0 -1
  291. package/dist/theming/preloadLinks.d.ts +0 -3
  292. package/dist/theming/preloadLinks.js +0 -19
  293. package/dist/theming/preloadLinks.js.map +0 -1
  294. package/dist/util/createStyleInHead.d.ts +0 -8
  295. package/dist/util/createStyleInHead.js +0 -18
  296. package/dist/util/createStyleInHead.js.map +0 -1
  297. package/lib/generate-asset-parameters/index.js +0 -27
  298. package/lib/generate-styles/index.js +0 -31
  299. package/lib/generate-version-info/index.js +0 -32
  300. package/src/renderer/directives/style-map.js +0 -72
  301. 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,9 @@ 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
- import executeTemplate from "./renderer/executeTemplate.js";
21
- import { getCurrentRuntimeIndex } from "./Runtimes.js";
19
+ import executeTemplate, { getTagsToScope } from "./renderer/executeTemplate.js";
20
+ import { attachFormElementInternals, setFormValue } from "./features/InputElementsFormSupport.js";
21
+ const DEV_MODE = true;
22
22
  let autoId = 0;
23
23
  const elementTimeouts = new Map();
24
24
  const uniqueDependenciesCache = new Map();
@@ -37,15 +37,28 @@ function _invalidate(changeInfo) {
37
37
  this.onInvalidation(changeInfo);
38
38
  this._changedState.push(changeInfo);
39
39
  renderDeferred(this);
40
- this._eventProvider.fireEvent("invalidate", { ...changeInfo, target: this });
40
+ this._invalidationEventProvider.fireEvent("invalidate", { ...changeInfo, target: this });
41
41
  }
42
42
  /**
43
+ * looks up a property descsriptor including in the prototype chain
44
+ * @param proto the starting prototype
45
+ * @param name the property to look for
46
+ * @returns the property descriptor if found directly or in the prototype chaing, undefined if not found
47
+ */
48
+ function getPropertyDescriptor(proto, name) {
49
+ do {
50
+ const descriptor = Object.getOwnPropertyDescriptor(proto, name);
51
+ if (descriptor) {
52
+ return descriptor;
53
+ }
54
+ // go up the prototype chain
55
+ proto = Object.getPrototypeOf(proto);
56
+ } while (proto && proto !== HTMLElement.prototype);
57
+ }
58
+ /**
59
+ * @class
43
60
  * Base class for all UI5 Web Components
44
61
  *
45
- * @class
46
- * @constructor
47
- * @author SAP SE
48
- * @alias sap.ui.webc.base.UI5Element
49
62
  * @extends HTMLElement
50
63
  * @public
51
64
  */
@@ -59,17 +72,20 @@ class UI5Element extends HTMLElement {
59
72
  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
73
  this._childChangeListeners = new Map(); // used to store lazy listeners per slot for the child change event of every child inside that slot
61
74
  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
75
+ this._invalidationEventProvider = new EventProvider(); // used by parent components for listening to changes to child components
76
+ this._componentStateFinalizedEventProvider = new EventProvider(); // used by friend classes for synchronization
63
77
  let deferredResolve;
64
78
  this._domRefReadyPromise = new Promise(resolve => {
65
79
  deferredResolve = resolve;
66
80
  });
67
81
  this._domRefReadyPromise._deferredResolve = deferredResolve;
68
82
  this._doNotSyncAttributes = new Set(); // attributes that are excluded from attributeChangedCallback synchronization
83
+ this._slotsAssignedNodes = new WeakMap(); // map of all nodes, slotted (directly or transitively) per component slot
69
84
  this._state = { ...ctor.getMetadata().getInitialState() };
70
85
  this._upgradeAllProperties();
71
86
  if (ctor._needsShadowDOM()) {
72
- this.attachShadow({ mode: "open" });
87
+ const defaultOptions = { mode: "open" };
88
+ this.attachShadow({ ...defaultOptions, ...ctor.getMetadata().getShadowRootOptions() });
73
89
  }
74
90
  }
75
91
  /**
@@ -88,18 +104,33 @@ class UI5Element extends HTMLElement {
88
104
  const template = this.constructor.template;
89
105
  return executeTemplate(template, this);
90
106
  }
91
- renderStatic() {
92
- const template = this.constructor.staticAreaTemplate;
93
- return executeTemplate(template, this);
94
- }
95
107
  /**
96
108
  * Do not call this method from derivatives of UI5Element, use "onEnterDOM" only
97
109
  * @private
98
110
  */
99
111
  async connectedCallback() {
112
+ if (DEV_MODE) {
113
+ const rootNode = this.getRootNode();
114
+ // when an element is connected, check if it exists in the `dependencies` of the parent
115
+ if (rootNode instanceof ShadowRoot && instanceOfUI5Element(rootNode.host)) {
116
+ const klass = rootNode.host.constructor;
117
+ const hasDependency = getTagsToScope(rootNode.host).includes(this.constructor.getMetadata().getPureTag());
118
+ if (!hasDependency) {
119
+ // eslint-disable-next-line no-console
120
+ console.error(`[UI5-FWK] ${this.constructor.getMetadata().getTag()} not found in dependencies of ${klass.getMetadata().getTag()}`);
121
+ }
122
+ }
123
+ }
124
+ if (DEV_MODE) {
125
+ const props = this.constructor.getMetadata().getProperties();
126
+ for (const [prop, propData] of Object.entries(props)) { // eslint-disable-line
127
+ if (Object.hasOwn(this, prop)) {
128
+ // eslint-disable-next-line no-console
129
+ console.error(`[UI5-FWK] ${this.constructor.getMetadata().getTag()} has a property [${prop}] that is shadowed by the instance. Updates to this property will not invalidate the component. Possible reason is TS target ES2022 or TS useDefineForClassFields`);
130
+ }
131
+ }
132
+ }
100
133
  const ctor = this.constructor;
101
- this.setAttribute(`_ui5rt${getCurrentRuntimeIndex()}`, "");
102
- this.setAttribute("_ui5host", "");
103
134
  this.setAttribute(ctor.getMetadata().getPureTag(), "");
104
135
  if (ctor.getMetadata().supportsF6FastNavigation()) {
105
136
  this.setAttribute("data-sap-ui-fastnavgroup", "true");
@@ -134,9 +165,7 @@ class UI5Element extends HTMLElement {
134
165
  this.onExitDOM();
135
166
  this._fullyConnected = false;
136
167
  }
137
- if (this.staticAreaItem && this.staticAreaItem.parentElement) {
138
- this.staticAreaItem.parentElement.removeChild(this.staticAreaItem);
139
- }
168
+ this._domRefReadyPromise._deferredResolve();
140
169
  cancelRender(this);
141
170
  }
142
171
  /**
@@ -164,14 +193,16 @@ class UI5Element extends HTMLElement {
164
193
  */
165
194
  _startObservingDOMChildren() {
166
195
  const ctor = this.constructor;
167
- const shouldObserveChildren = ctor.getMetadata().hasSlots();
196
+ const metadata = ctor.getMetadata();
197
+ const shouldObserveChildren = metadata.hasSlots();
168
198
  if (!shouldObserveChildren) {
169
199
  return;
170
200
  }
171
- const canSlotText = ctor.getMetadata().canSlotText();
201
+ const canSlotText = metadata.canSlotText();
202
+ const hasClonedSlot = Object.keys(metadata.getSlots()).some(slotName => metadata.getSlots()[slotName].cloned);
172
203
  const mutationObserverOptions = {
173
204
  childList: true,
174
- subtree: canSlotText,
205
+ subtree: canSlotText || hasClonedSlot,
175
206
  characterData: canSlotText,
176
207
  };
177
208
  observeDOMNode(this, this._processChildren.bind(this), mutationObserverOptions);
@@ -234,9 +265,9 @@ class UI5Element extends HTMLElement {
234
265
  const localName = child.localName;
235
266
  const shouldWaitForCustomElement = localName.includes("-") && !shouldIgnoreCustomElement(localName);
236
267
  if (shouldWaitForCustomElement) {
237
- const isDefined = window.customElements.get(localName);
268
+ const isDefined = customElements.get(localName);
238
269
  if (!isDefined) {
239
- const whenDefinedPromise = window.customElements.whenDefined(localName); // Class registered, but instances not upgraded yet
270
+ const whenDefinedPromise = customElements.whenDefined(localName); // Class registered, but instances not upgraded yet
240
271
  let timeoutPromise = elementTimeouts.get(localName);
241
272
  if (!timeoutPromise) {
242
273
  timeoutPromise = new Promise(resolve => setTimeout(resolve, 1000));
@@ -244,20 +275,18 @@ class UI5Element extends HTMLElement {
244
275
  }
245
276
  await Promise.race([whenDefinedPromise, timeoutPromise]);
246
277
  }
247
- window.customElements.upgrade(child);
278
+ customElements.upgrade(child);
248
279
  }
249
280
  }
250
281
  child = ctor.getMetadata().constructor.validateSlotValue(child, slotData);
251
282
  // Listen for any invalidation on the child if invalidateOnChildChange is true or an object (ignore when false or not set)
252
283
  if (instanceOfUI5Element(child) && slotData.invalidateOnChildChange) {
253
284
  const childChangeListener = this._getChildChangeListener(slotName);
254
- if (childChangeListener) {
255
- child.attachInvalidate.call(child, childChangeListener);
256
- }
285
+ child.attachInvalidate.call(child, childChangeListener);
257
286
  }
258
287
  // Listen for the slotchange event if the child is a slot itself
259
288
  if (child instanceof HTMLSlotElement) {
260
- this._attachSlotChange(child, slotName);
289
+ this._attachSlotChange(child, slotName, !!slotData.invalidateOnChildChange);
261
290
  }
262
291
  const propertyName = slotData.propertyName || slotName;
263
292
  if (slottedChildrenMap.has(propertyName)) {
@@ -284,6 +313,9 @@ class UI5Element extends HTMLElement {
284
313
  reason: "children",
285
314
  });
286
315
  invalidated = true;
316
+ if (ctor.getMetadata().isFormAssociated()) {
317
+ setFormValue(this);
318
+ }
287
319
  }
288
320
  }
289
321
  // If none of the slots had an invalidation due to changes to immediate children,
@@ -306,9 +338,7 @@ class UI5Element extends HTMLElement {
306
338
  children.forEach(child => {
307
339
  if (instanceOfUI5Element(child)) {
308
340
  const childChangeListener = this._getChildChangeListener(slotName);
309
- if (childChangeListener) {
310
- child.detachInvalidate.call(child, childChangeListener);
311
- }
341
+ child.detachInvalidate.call(child, childChangeListener);
312
342
  }
313
343
  if (child instanceof HTMLSlotElement) {
314
344
  this._detachSlotChange(child, slotName);
@@ -319,26 +349,26 @@ class UI5Element extends HTMLElement {
319
349
  /**
320
350
  * Attach a callback that will be executed whenever the component is invalidated
321
351
  *
322
- * @param {InvalidationInfo} callback
352
+ * @param callback
323
353
  * @public
324
354
  */
325
355
  attachInvalidate(callback) {
326
- this._eventProvider.attachEvent("invalidate", callback);
356
+ this._invalidationEventProvider.attachEvent("invalidate", callback);
327
357
  }
328
358
  /**
329
359
  * Detach the callback that is executed whenever the component is invalidated
330
360
  *
331
- * @param {InvalidationInfo} callback
361
+ * @param callback
332
362
  * @public
333
363
  */
334
364
  detachInvalidate(callback) {
335
- this._eventProvider.detachEvent("invalidate", callback);
365
+ this._invalidationEventProvider.detachEvent("invalidate", callback);
336
366
  }
337
367
  /**
338
368
  * Callback that is executed whenever a monitored child changes its state
339
369
  *
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
370
+ * @param slotName the slot in which a child was invalidated
371
+ * @param childChangeInfo the changeInfo object for the child in the given slot
342
372
  * @private
343
373
  */
344
374
  _onChildChange(slotName, childChangeInfo) {
@@ -385,6 +415,16 @@ class UI5Element extends HTMLElement {
385
415
  this[nameInCamelCase] = newPropertyValue;
386
416
  }
387
417
  }
418
+ formAssociatedCallback() {
419
+ const ctor = this.constructor;
420
+ if (!ctor.getMetadata().isFormAssociated()) {
421
+ return;
422
+ }
423
+ attachFormElementInternals(this);
424
+ }
425
+ static get formAssociated() {
426
+ return this.getMetadata().isFormAssociated();
427
+ }
388
428
  /**
389
429
  * @private
390
430
  */
@@ -448,7 +488,6 @@ class UI5Element extends HTMLElement {
448
488
  * Returns a singleton event listener for the "change" event of a child in a given slot
449
489
  *
450
490
  * @param slotName the name of the slot, where the child is
451
- * @returns {ChildChangeListener}
452
491
  * @private
453
492
  */
454
493
  _getChildChangeListener(slotName) {
@@ -461,7 +500,6 @@ class UI5Element extends HTMLElement {
461
500
  * Returns a singleton slotchange event listener that invalidates the component due to changes in the given slot
462
501
  *
463
502
  * @param slotName the name of the slot, where the slot element (whose slotchange event we're listening to) is
464
- * @returns {SlotChangeListener}
465
503
  * @private
466
504
  */
467
505
  _getSlotChangeListener(slotName) {
@@ -473,11 +511,32 @@ class UI5Element extends HTMLElement {
473
511
  /**
474
512
  * @private
475
513
  */
476
- _attachSlotChange(child, slotName) {
514
+ _attachSlotChange(slot, slotName, invalidateOnChildChange) {
477
515
  const slotChangeListener = this._getSlotChangeListener(slotName);
478
- if (slotChangeListener) {
479
- child.addEventListener("slotchange", slotChangeListener);
480
- }
516
+ slot.addEventListener("slotchange", (e) => {
517
+ slotChangeListener.call(slot, e);
518
+ if (invalidateOnChildChange) {
519
+ // Detach listeners for UI5 Elements that used to be in this slot
520
+ const previousChildren = this._slotsAssignedNodes.get(slot);
521
+ if (previousChildren) {
522
+ previousChildren.forEach(child => {
523
+ if (instanceOfUI5Element(child)) {
524
+ const childChangeListener = this._getChildChangeListener(slotName);
525
+ child.detachInvalidate.call(child, childChangeListener);
526
+ }
527
+ });
528
+ }
529
+ // Attach listeners for UI5 Elements that are now in this slot
530
+ const newChildren = getSlottedNodesList([slot]);
531
+ this._slotsAssignedNodes.set(slot, newChildren);
532
+ newChildren.forEach(child => {
533
+ if (instanceOfUI5Element(child)) {
534
+ const childChangeListener = this._getChildChangeListener(slotName);
535
+ child.attachInvalidate.call(child, childChangeListener);
536
+ }
537
+ });
538
+ }
539
+ });
481
540
  }
482
541
  /**
483
542
  * @private
@@ -513,9 +572,9 @@ class UI5Element extends HTMLElement {
513
572
  * 1) children: immediate children (HTML elements or text nodes) were added, removed or reordered in the slot
514
573
  * 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
574
  * 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.
575
+ * Can only trigger if the child of a slot is a slot element itself.
517
576
  * 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
577
+ * Can only trigger for slots with "invalidateOnChildChange" metadata descriptor
519
578
  *
520
579
  * - newValue: the new value of the property (for type="property" only)
521
580
  *
@@ -537,9 +596,7 @@ class UI5Element extends HTMLElement {
537
596
  this._suppressInvalidation = true;
538
597
  this.onBeforeRendering();
539
598
  // 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
- }
599
+ this._componentStateFinalizedEventProvider.fireEvent("componentStateFinalized");
543
600
  // resume normal invalidation handling
544
601
  this._suppressInvalidation = false;
545
602
  // Update the shadow root with the render result
@@ -568,9 +625,6 @@ class UI5Element extends HTMLElement {
568
625
  if (ctor._needsShadowDOM()) {
569
626
  updateShadowRoot(this);
570
627
  }
571
- if (this.staticAreaItem) {
572
- this.staticAreaItem.update();
573
- }
574
628
  // Safari requires that children get the slot attribute only after the slot tags have been rendered in the shadow DOM
575
629
  if (hasIndividualSlots) {
576
630
  this._assignIndividualSlotsToChildren();
@@ -610,11 +664,7 @@ class UI5Element extends HTMLElement {
610
664
  if (!this.shadowRoot || this.shadowRoot.children.length === 0) {
611
665
  return;
612
666
  }
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];
667
+ return this.shadowRoot.children[0];
618
668
  }
619
669
  /**
620
670
  * Returns the DOM Element marked with "data-sap-focus-ref" inside the template.
@@ -639,7 +689,7 @@ class UI5Element extends HTMLElement {
639
689
  }
640
690
  /**
641
691
  * Set the focus to the element, returned by "getFocusDomRef()" (marked by "data-sap-focus-ref")
642
- * @param {FocusOptions} focusOptions additional options for the focus
692
+ * @param focusOptions additional options for the focus
643
693
  * @public
644
694
  */
645
695
  async focus(focusOptions) {
@@ -656,13 +706,13 @@ class UI5Element extends HTMLElement {
656
706
  * @param data - additional data for the event
657
707
  * @param cancelable - true, if the user can call preventDefault on the event object
658
708
  * @param bubbles - true, if the event bubbles
659
- * @returns {boolean} false, if the event was cancelled (preventDefault called), true otherwise
709
+ * @returns false, if the event was cancelled (preventDefault called), true otherwise
660
710
  */
661
711
  fireEvent(name, data, cancelable = false, bubbles = true) {
662
712
  const eventResult = this._fireEvent(name, data, cancelable, bubbles);
663
713
  const camelCaseEventName = kebabToCamelCase(name);
664
714
  if (camelCaseEventName !== name) {
665
- return eventResult && this._fireEvent(camelCaseEventName, data, cancelable);
715
+ return eventResult && this._fireEvent(camelCaseEventName, data, cancelable, bubbles);
666
716
  }
667
717
  return eventResult;
668
718
  }
@@ -697,12 +747,30 @@ class UI5Element extends HTMLElement {
697
747
  getSlottedNodes(slotName) {
698
748
  return getSlottedNodesList(this[slotName]);
699
749
  }
750
+ /**
751
+ * Attach a callback that will be executed whenever the component's state is finalized
752
+ *
753
+ * @param callback
754
+ * @public
755
+ */
756
+ attachComponentStateFinalized(callback) {
757
+ this._componentStateFinalizedEventProvider.attachEvent("componentStateFinalized", callback);
758
+ }
759
+ /**
760
+ * Detach the callback that is executed whenever the component's state is finalized
761
+ *
762
+ * @param callback
763
+ * @public
764
+ */
765
+ detachComponentStateFinalized(callback) {
766
+ this._componentStateFinalizedEventProvider.detachEvent("componentStateFinalized", callback);
767
+ }
700
768
  /**
701
769
  * Determines whether the component should be rendered in RTL mode or not.
702
770
  * Returns: "rtl", "ltr" or undefined
703
771
  *
704
772
  * @public
705
- * @returns {String|undefined}
773
+ * @default undefined
706
774
  */
707
775
  get effectiveDir() {
708
776
  markAsRtlAware(this.constructor); // if a UI5 Element calls this method, it's considered to be rtl-aware
@@ -710,8 +778,8 @@ class UI5Element extends HTMLElement {
710
778
  }
711
779
  /**
712
780
  * Used to duck-type UI5 elements without using instanceof
713
- * @returns {boolean}
714
781
  * @public
782
+ * @default true
715
783
  */
716
784
  get isUI5Element() {
717
785
  return true;
@@ -719,6 +787,13 @@ class UI5Element extends HTMLElement {
719
787
  get classes() {
720
788
  return {};
721
789
  }
790
+ /**
791
+ * Returns the component accessibility info.
792
+ * @private
793
+ */
794
+ get accessibilityInfo() {
795
+ return {};
796
+ }
722
797
  /**
723
798
  * Do not override this method in derivatives of UI5Element, use metadata properties instead
724
799
  * @private
@@ -732,28 +807,6 @@ class UI5Element extends HTMLElement {
732
807
  static _needsShadowDOM() {
733
808
  return !!this.template || Object.prototype.hasOwnProperty.call(this.prototype, "render");
734
809
  }
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
810
  /**
758
811
  * @private
759
812
  */
@@ -778,8 +831,25 @@ class UI5Element extends HTMLElement {
778
831
  if (propData.multiple && propData.defaultValue) {
779
832
  throw new Error(`Cannot set a default value for property "${prop}". All multiple properties are empty arrays by default.`);
780
833
  }
834
+ const descriptor = getPropertyDescriptor(proto, prop);
835
+ // if the decorator is on a setter, proxy the new setter to it
836
+ let origSet;
837
+ if (descriptor?.set) {
838
+ // eslint-disable-next-line @typescript-eslint/unbound-method
839
+ origSet = descriptor.set;
840
+ }
841
+ // if the decorator is on a setter, there will be a corresponding getter - proxy the new getter to it
842
+ let origGet;
843
+ if (descriptor?.get) {
844
+ // eslint-disable-next-line @typescript-eslint/unbound-method
845
+ origGet = descriptor.get;
846
+ }
781
847
  Object.defineProperty(proto, prop, {
782
848
  get() {
849
+ // proxy the getter to the original accessor if there was one
850
+ if (origGet) {
851
+ return origGet.call(this);
852
+ }
783
853
  if (this._state[prop] !== undefined) {
784
854
  return this._state[prop];
785
855
  }
@@ -804,7 +874,7 @@ class UI5Element extends HTMLElement {
804
874
  value = metadataCtor.validatePropertyValue(value, propData);
805
875
  const propertyType = propData.type;
806
876
  let propertyValidator = propData.validator;
807
- const oldState = this._state[prop];
877
+ const oldState = origGet ? origGet.call(this) : this._state[prop];
808
878
  if (propertyType && propertyType.isDataTypeClass) {
809
879
  propertyValidator = propertyType;
810
880
  }
@@ -818,13 +888,22 @@ class UI5Element extends HTMLElement {
818
888
  isDifferent = oldState !== value;
819
889
  }
820
890
  if (isDifferent) {
821
- this._state[prop] = value;
891
+ // if the decorator is on a setter, use it for storage
892
+ if (origSet) {
893
+ origSet.call(this, value);
894
+ }
895
+ else {
896
+ this._state[prop] = value;
897
+ }
822
898
  _invalidate.call(this, {
823
899
  type: "property",
824
900
  name: prop,
825
901
  newValue: value,
826
902
  oldValue: oldState,
827
903
  });
904
+ if (ctor.getMetadata().isFormAssociated()) {
905
+ setFormValue(this);
906
+ }
828
907
  this._updateAttribute(prop, value);
829
908
  }
830
909
  },
@@ -852,20 +931,6 @@ class UI5Element extends HTMLElement {
852
931
  }
853
932
  }
854
933
  }
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
934
  /**
870
935
  * Returns an array with the dependencies for this UI5 Web Component, which could be:
871
936
  * - composed components (used in its shadow root or static area item)
@@ -890,8 +955,6 @@ class UI5Element extends HTMLElement {
890
955
  }
891
956
  /**
892
957
  * Returns a promise that resolves whenever all dependencies for this UI5 Web Component have resolved
893
- *
894
- * @returns {Promise}
895
958
  */
896
959
  static whenDependenciesDefined() {
897
960
  return Promise.all(this.getUniqueDependencies().map(dep => dep.define()));
@@ -900,7 +963,6 @@ class UI5Element extends HTMLElement {
900
963
  * Hook that will be called upon custom element definition
901
964
  *
902
965
  * @protected
903
- * @returns {Promise<void>}
904
966
  */
905
967
  static async onDefine() {
906
968
  return Promise.resolve();
@@ -908,7 +970,6 @@ class UI5Element extends HTMLElement {
908
970
  /**
909
971
  * Registers a UI5 Web Component in the browser window object
910
972
  * @public
911
- * @returns {Promise<UI5Element>}
912
973
  */
913
974
  static async define() {
914
975
  await boot();
@@ -925,8 +986,7 @@ class UI5Element extends HTMLElement {
925
986
  else if (!definedGlobally) {
926
987
  this._generateAccessors();
927
988
  registerTag(tag);
928
- window.customElements.define(tag, this);
929
- preloadLinks(this);
989
+ customElements.define(tag, this);
930
990
  }
931
991
  return this;
932
992
  }
@@ -934,7 +994,6 @@ class UI5Element extends HTMLElement {
934
994
  * Returns an instance of UI5ElementMetadata.js representing this UI5 Web Component's full metadata (its and its parents')
935
995
  * Note: not to be confused with the "get metadata()" method, which returns an object for this class's metadata only
936
996
  * @public
937
- * @returns {UI5ElementMetadata}
938
997
  */
939
998
  static getMetadata() {
940
999
  if (this.hasOwnProperty("_metadata")) { // eslint-disable-line
@@ -950,19 +1009,27 @@ class UI5Element extends HTMLElement {
950
1009
  this._metadata = new UI5ElementMetadata(mergedMetadata);
951
1010
  return this._metadata;
952
1011
  }
1012
+ get validity() { return this._internals?.validity; }
1013
+ get validationMessage() { return this._internals?.validationMessage; }
1014
+ checkValidity() { return this._internals?.checkValidity(); }
1015
+ reportValidity() { return this._internals?.reportValidity(); }
953
1016
  }
954
1017
  /**
955
1018
  * Returns the metadata object for this UI5 Web Component Class
956
1019
  * @protected
957
1020
  */
958
1021
  UI5Element.metadata = {};
1022
+ /**
1023
+ * Returns the CSS for this UI5 Web Component Class
1024
+ * @protected
1025
+ */
1026
+ UI5Element.styles = "";
959
1027
  /**
960
1028
  * Always use duck-typing to cover all runtimes on the page.
961
- * @returns {boolean}
962
1029
  */
963
1030
  const instanceOfUI5Element = (object) => {
964
1031
  return "isUI5Element" in object;
965
1032
  };
966
1033
  export default UI5Element;
967
- export { instanceOfUI5Element };
1034
+ export { instanceOfUI5Element, };
968
1035
  //# sourceMappingURL=UI5Element.js.map