@ui5/webcomponents-base 0.0.0-64a57f090 → 0.0.0-6827fdc09

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 (479) hide show
  1. package/CHANGELOG.md +1499 -0
  2. package/README.md +3 -13
  3. package/cypress/specs/Accessor.cy.tsx +79 -0
  4. package/cypress/specs/Boot.cy.tsx +19 -0
  5. package/cypress/specs/ConfigurationChange.cy.tsx +41 -0
  6. package/cypress/specs/ConfigurationScript.cy.tsx +133 -0
  7. package/cypress/specs/ConfigurationURL.cy.tsx +201 -0
  8. package/cypress/specs/CustomMount.cy.tsx +9 -0
  9. package/cypress/specs/CustomTheme.cy.tsx +36 -0
  10. package/cypress/specs/EventProvider.cy.tsx +59 -0
  11. package/cypress/specs/Events.cy.tsx +28 -0
  12. package/cypress/specs/SystemDOMElements.cy.tsx +8 -0
  13. package/cypress/specs/Theming.cy.tsx +74 -0
  14. package/cypress/specs/UI5ElementInvalidation.cy.tsx +252 -0
  15. package/cypress/specs/UI5ElementLifecycle.cy.tsx +82 -0
  16. package/cypress/specs/UI5ElementListenForChildPropChanges.cy.tsx +83 -0
  17. package/cypress/specs/UI5ElementMetadataExt.cy.tsx +42 -0
  18. package/cypress/specs/UI5ElementPropertyValidation.cy.tsx +16 -0
  19. package/cypress/specs/UI5ElementPropsAndAttrs.cy.tsx +113 -0
  20. package/cypress/specs/UI5ElementShadowDOM.cy.tsx +30 -0
  21. package/cypress/specs/UI5ElementSlots.cy.tsx +136 -0
  22. package/cypress/specs/WithComplexTemplate.cy.tsx +32 -0
  23. package/cypress/specs/i18n_texts.cy.tsx +129 -0
  24. package/cypress/specs/util/FocusableElements.cy.tsx +48 -0
  25. package/cypress/support/commands.ts +39 -0
  26. package/cypress/support/component-index.html +12 -0
  27. package/cypress/support/component.ts +17 -0
  28. package/cypress/tsconfig.json +21 -0
  29. package/cypress.config.js +3 -0
  30. package/dist/.tsbuildinfobuild +1 -0
  31. package/dist/AssetRegistry.d.ts +2 -2
  32. package/dist/AssetRegistry.js +2 -2
  33. package/dist/AssetRegistry.js.map +1 -1
  34. package/dist/Boot.d.ts +3 -2
  35. package/dist/Boot.js +11 -7
  36. package/dist/Boot.js.map +1 -1
  37. package/dist/CustomElementsRegistry.d.ts +2 -1
  38. package/dist/CustomElementsRegistry.js +5 -2
  39. package/dist/CustomElementsRegistry.js.map +1 -1
  40. package/dist/CustomElementsScope.d.ts +2 -2
  41. package/dist/CustomElementsScopeUtils.d.ts +3 -1
  42. package/dist/CustomElementsScopeUtils.js +8 -1
  43. package/dist/CustomElementsScopeUtils.js.map +1 -1
  44. package/dist/DOMObserver.js.map +1 -1
  45. package/dist/Device.d.ts +16 -2
  46. package/dist/Device.js +10 -14
  47. package/dist/Device.js.map +1 -1
  48. package/dist/EventProvider.js.map +1 -1
  49. package/dist/FontFace.js +6 -1
  50. package/dist/FontFace.js.map +1 -1
  51. package/dist/IgnoreCustomElements.d.ts +3 -5
  52. package/dist/IgnoreCustomElements.js +3 -5
  53. package/dist/IgnoreCustomElements.js.map +1 -1
  54. package/dist/InitialConfiguration.d.ts +9 -3
  55. package/dist/InitialConfiguration.js +26 -8
  56. package/dist/InitialConfiguration.js.map +1 -1
  57. package/dist/Keys.d.ts +4 -1
  58. package/dist/Keys.js +110 -106
  59. package/dist/Keys.js.map +1 -1
  60. package/dist/Location.d.ts +11 -0
  61. package/dist/Location.js +49 -0
  62. package/dist/Location.js.map +1 -0
  63. package/dist/ManagedStyles.d.ts +5 -6
  64. package/dist/ManagedStyles.js +45 -54
  65. package/dist/ManagedStyles.js.map +1 -1
  66. package/dist/MediaRange.d.ts +6 -12
  67. package/dist/MediaRange.js +21 -31
  68. package/dist/MediaRange.js.map +1 -1
  69. package/dist/PropertiesFileFormat.js.map +1 -1
  70. package/dist/Render.js.map +1 -1
  71. package/dist/RenderQueue.js.map +1 -1
  72. package/dist/Runtimes.js +11 -0
  73. package/dist/Runtimes.js.map +1 -1
  74. package/dist/SystemCSSVars.js.map +1 -1
  75. package/dist/UI5Element.d.ts +120 -76
  76. package/dist/UI5Element.js +388 -231
  77. package/dist/UI5Element.js.map +1 -1
  78. package/dist/UI5ElementMetadata.d.ts +36 -27
  79. package/dist/UI5ElementMetadata.js +27 -72
  80. package/dist/UI5ElementMetadata.js.map +1 -1
  81. package/dist/animations/AnimationQueue.js.map +1 -1
  82. package/dist/animations/animate.js.map +1 -1
  83. package/dist/animations/slideUp.js.map +1 -1
  84. package/dist/asset-registries/Icons.d.ts +1 -1
  85. package/dist/asset-registries/Icons.js +1 -1
  86. package/dist/asset-registries/Icons.js.map +1 -1
  87. package/dist/asset-registries/Illustrations.d.ts +1 -0
  88. package/dist/asset-registries/Illustrations.js +20 -28
  89. package/dist/asset-registries/Illustrations.js.map +1 -1
  90. package/dist/asset-registries/LocaleData.js +1 -1
  91. package/dist/asset-registries/LocaleData.js.map +1 -1
  92. package/dist/asset-registries/Themes.d.ts +5 -7
  93. package/dist/asset-registries/Themes.js +27 -12
  94. package/dist/asset-registries/Themes.js.map +1 -1
  95. package/dist/asset-registries/i18n.d.ts +2 -2
  96. package/dist/asset-registries/i18n.js +4 -3
  97. package/dist/asset-registries/i18n.js.map +1 -1
  98. package/dist/asset-registries/util/IconCollectionsAlias.js.map +1 -1
  99. package/dist/asset-registries/util/IconCollectionsByTheme.d.ts +1 -1
  100. package/dist/asset-registries/util/IconCollectionsByTheme.js +1 -1
  101. package/dist/asset-registries/util/IconCollectionsByTheme.js.map +1 -1
  102. package/dist/asset-registries/util/getIconCollectionByTheme.d.ts +3 -3
  103. package/dist/asset-registries/util/getIconCollectionByTheme.js +3 -3
  104. package/dist/asset-registries/util/getIconCollectionByTheme.js.map +1 -1
  105. package/dist/config/AnimationMode.js +6 -1
  106. package/dist/config/AnimationMode.js.map +1 -1
  107. package/dist/config/CalendarType.js +5 -0
  108. package/dist/config/CalendarType.js.map +1 -1
  109. package/dist/config/ConfigurationReset.d.ts +4 -0
  110. package/dist/config/ConfigurationReset.js +11 -0
  111. package/dist/config/ConfigurationReset.js.map +1 -0
  112. package/dist/config/Fonts.d.ts +16 -0
  113. package/dist/config/Fonts.js +30 -0
  114. package/dist/config/Fonts.js.map +1 -0
  115. package/dist/config/FormatSettings.js +4 -0
  116. package/dist/config/FormatSettings.js.map +1 -1
  117. package/dist/config/Icons.d.ts +8 -8
  118. package/dist/config/Icons.js +7 -7
  119. package/dist/config/Icons.js.map +1 -1
  120. package/dist/config/Language.d.ts +1 -1
  121. package/dist/config/Language.js +11 -3
  122. package/dist/config/Language.js.map +1 -1
  123. package/dist/config/NoConflict.js +4 -0
  124. package/dist/config/NoConflict.js.map +1 -1
  125. package/dist/config/Theme.d.ts +4 -3
  126. package/dist/config/Theme.js +18 -8
  127. package/dist/config/Theme.js.map +1 -1
  128. package/dist/config/ThemeRoot.d.ts +2 -4
  129. package/dist/config/ThemeRoot.js +6 -4
  130. package/dist/config/ThemeRoot.js.map +1 -1
  131. package/dist/config/Timezone.d.ts +1 -1
  132. package/dist/config/Timezone.js +5 -1
  133. package/dist/config/Timezone.js.map +1 -1
  134. package/dist/config/Tooltips.d.ts +19 -0
  135. package/dist/config/Tooltips.js +29 -0
  136. package/dist/config/Tooltips.js.map +1 -0
  137. package/dist/connectToComponent.js.map +1 -1
  138. package/dist/converters/DOMReference.d.ts +5 -0
  139. package/dist/converters/DOMReference.js +13 -0
  140. package/dist/converters/DOMReference.js.map +1 -0
  141. package/dist/css/FontFace.css +13 -1
  142. package/dist/css/SystemCSSVars.css +0 -8
  143. package/dist/decorators/bound.d.ts +1 -0
  144. package/dist/decorators/bound.js +34 -0
  145. package/dist/decorators/bound.js.map +1 -0
  146. package/dist/decorators/customElement.d.ts +43 -3
  147. package/dist/decorators/customElement.js +14 -6
  148. package/dist/decorators/customElement.js.map +1 -1
  149. package/dist/decorators/event-strict.d.ts +15 -0
  150. package/dist/decorators/event-strict.js +26 -0
  151. package/dist/decorators/event-strict.js.map +1 -0
  152. package/dist/decorators/event.d.ts +8 -2
  153. package/dist/decorators/event.js +3 -0
  154. package/dist/decorators/event.js.map +1 -1
  155. package/dist/decorators/i18n.d.ts +17 -0
  156. package/dist/decorators/i18n.js +32 -0
  157. package/dist/decorators/i18n.js.map +1 -0
  158. package/dist/decorators/property.d.ts +1 -1
  159. package/dist/decorators/property.js +1 -1
  160. package/dist/decorators/property.js.map +1 -1
  161. package/dist/decorators/query.d.ts +25 -0
  162. package/dist/decorators/query.js +32 -0
  163. package/dist/decorators/query.js.map +1 -0
  164. package/dist/decorators/queryAll.d.ts +27 -0
  165. package/dist/decorators/queryAll.js +34 -0
  166. package/dist/decorators/queryAll.js.map +1 -0
  167. package/dist/decorators/slot.d.ts +1 -1
  168. package/dist/decorators/slot.js.map +1 -1
  169. package/dist/decorators.d.ts +8 -0
  170. package/dist/decorators.js +9 -0
  171. package/dist/decorators.js.map +1 -0
  172. package/dist/delegate/ItemNavigation.d.ts +9 -8
  173. package/dist/delegate/ItemNavigation.js +11 -12
  174. package/dist/delegate/ItemNavigation.js.map +1 -1
  175. package/dist/delegate/ResizeHandler.d.ts +4 -6
  176. package/dist/delegate/ResizeHandler.js +4 -6
  177. package/dist/delegate/ResizeHandler.js.map +1 -1
  178. package/dist/delegate/ScrollEnablement.js +2 -2
  179. package/dist/delegate/ScrollEnablement.js.map +1 -1
  180. package/dist/features/F6Navigation.d.ts +4 -3
  181. package/dist/features/F6Navigation.js +41 -9
  182. package/dist/features/F6Navigation.js.map +1 -1
  183. package/dist/features/InputElementsFormSupport.d.ts +15 -0
  184. package/dist/features/InputElementsFormSupport.js +39 -0
  185. package/dist/features/InputElementsFormSupport.js.map +1 -0
  186. package/dist/features/LegacyDateFormats.js.map +1 -1
  187. package/dist/features/OpenUI5Enablement.d.ts +3 -3
  188. package/dist/features/OpenUI5Enablement.js.map +1 -1
  189. package/dist/features/OpenUI5Support.d.ts +1 -3
  190. package/dist/features/OpenUI5Support.js +11 -22
  191. package/dist/features/OpenUI5Support.js.map +1 -1
  192. package/dist/features/patchPatcher.d.ts +11 -0
  193. package/dist/features/patchPatcher.js +11 -0
  194. package/dist/features/patchPatcher.js.map +1 -0
  195. package/dist/features/patchPopup.d.ts +15 -0
  196. package/dist/features/patchPopup.js +70 -0
  197. package/dist/features/patchPopup.js.map +1 -0
  198. package/dist/generated/AssetParameters.d.ts +6 -0
  199. package/dist/generated/AssetParameters.js +3 -10
  200. package/dist/generated/AssetParameters.js.map +1 -0
  201. package/dist/generated/VersionInfo.d.ts +10 -0
  202. package/dist/generated/VersionInfo.js +9 -8
  203. package/dist/generated/VersionInfo.js.map +1 -0
  204. package/dist/generated/css/BusyIndicator.css.d.ts +2 -3
  205. package/dist/generated/css/BusyIndicator.css.js +1 -6
  206. package/dist/generated/css/BusyIndicator.css.js.map +1 -1
  207. package/dist/generated/css/FontFace.css.d.ts +2 -3
  208. package/dist/generated/css/FontFace.css.js +1 -6
  209. package/dist/generated/css/FontFace.css.js.map +1 -1
  210. package/dist/generated/css/OverrideFontFace.css.d.ts +2 -3
  211. package/dist/generated/css/OverrideFontFace.css.js +1 -6
  212. package/dist/generated/css/OverrideFontFace.css.js.map +1 -1
  213. package/dist/generated/css/SystemCSSVars.css.d.ts +2 -3
  214. package/dist/generated/css/SystemCSSVars.css.js +1 -6
  215. package/dist/generated/css/SystemCSSVars.css.js.map +1 -1
  216. package/dist/getSharedResource.js.map +1 -1
  217. package/dist/i18nBundle.d.ts +1 -3
  218. package/dist/i18nBundle.js +1 -4
  219. package/dist/i18nBundle.js.map +1 -1
  220. package/dist/index.d.ts +48 -0
  221. package/dist/index.js +88 -0
  222. package/dist/index.js.map +1 -0
  223. package/dist/jsx-dev-runtime.d.ts +4 -0
  224. package/dist/jsx-dev-runtime.js +43 -0
  225. package/dist/jsx-dev-runtime.js.map +1 -0
  226. package/dist/jsx-runtime.d.ts +50 -0
  227. package/dist/jsx-runtime.js +27 -0
  228. package/dist/jsx-runtime.js.map +1 -0
  229. package/dist/jsx-utils.d.ts +3 -0
  230. package/dist/jsx-utils.js +48 -0
  231. package/dist/jsx-utils.js.map +1 -0
  232. package/dist/locale/Locale.js.map +1 -1
  233. package/dist/locale/applyDirection.d.ts +3 -2
  234. package/dist/locale/applyDirection.js +3 -2
  235. package/dist/locale/applyDirection.js.map +1 -1
  236. package/dist/locale/getEffectiveDir.d.ts +1 -1
  237. package/dist/locale/getEffectiveDir.js +3 -19
  238. package/dist/locale/getEffectiveDir.js.map +1 -1
  239. package/dist/locale/getLocale.js.map +1 -1
  240. package/dist/locale/nextFallbackLocale.js +6 -2
  241. package/dist/locale/nextFallbackLocale.js.map +1 -1
  242. package/dist/locale/normalizeLocale.js.map +1 -1
  243. package/dist/renderer/JsxRenderer.d.ts +3 -0
  244. package/dist/renderer/JsxRenderer.js +16 -0
  245. package/dist/renderer/JsxRenderer.js.map +1 -0
  246. package/dist/renderer/LitRenderer.d.ts +3 -3
  247. package/dist/renderer/LitRenderer.js +5 -10
  248. package/dist/renderer/LitRenderer.js.map +1 -1
  249. package/dist/renderer/directives/style-map.d.ts +13 -0
  250. package/dist/renderer/directives/style-map.js +59 -59
  251. package/dist/renderer/directives/style-map.js.map +1 -0
  252. package/dist/renderer/executeTemplate.d.ts +3 -4
  253. package/dist/renderer/executeTemplate.js +1 -19
  254. package/dist/renderer/executeTemplate.js.map +1 -1
  255. package/dist/sap/base/Log.js +698 -188
  256. package/dist/sap/base/assert.js +28 -1
  257. package/dist/sap/base/config/MemoryConfigurationProvider.js +20 -0
  258. package/dist/sap/base/security/URLListValidator.js +253 -6
  259. package/dist/sap/base/security/encodeCSS.js +34 -8
  260. package/dist/sap/base/security/encodeXML.js +47 -17
  261. package/dist/sap/base/security/sanitizeHTML.js +35 -13
  262. package/dist/sap/base/strings/toHex.js +27 -2
  263. package/dist/sap/base/util/now.js +24 -3
  264. package/dist/sap/base/util/uid.js +27 -0
  265. package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +2 -2
  266. package/dist/ssr-dom-shim.d.ts +1 -0
  267. package/dist/ssr-dom-shim.js +62 -0
  268. package/dist/ssr-dom-shim.js.map +1 -0
  269. package/dist/ssr-dom.d.ts +1 -0
  270. package/dist/ssr-dom.js +3 -0
  271. package/dist/ssr-dom.js.map +1 -0
  272. package/dist/theming/CustomStyle.js.map +1 -1
  273. package/dist/theming/applyTheme.js +5 -5
  274. package/dist/theming/applyTheme.js.map +1 -1
  275. package/dist/theming/getConstructableStyle.d.ts +2 -2
  276. package/dist/theming/getConstructableStyle.js +3 -3
  277. package/dist/theming/getConstructableStyle.js.map +1 -1
  278. package/dist/theming/getEffectiveStyle.d.ts +1 -1
  279. package/dist/theming/getEffectiveStyle.js +5 -12
  280. package/dist/theming/getEffectiveStyle.js.map +1 -1
  281. package/dist/theming/getStylesString.js +2 -4
  282. package/dist/theming/getStylesString.js.map +1 -1
  283. package/dist/theming/getThemeDesignerTheme.js +2 -1
  284. package/dist/theming/getThemeDesignerTheme.js.map +1 -1
  285. package/dist/thirdparty/_merge.js.map +1 -1
  286. package/dist/thirdparty/isPlainObject.js.map +1 -1
  287. package/dist/thirdparty/preact/jsx.d.ts +2616 -0
  288. package/dist/thirdparty/preact/jsxRuntime.module.d.ts +62 -0
  289. package/dist/thirdparty/preact/jsxRuntime.module.js +1 -0
  290. package/dist/thirdparty/preact/preact.module.d.ts +398 -0
  291. package/dist/thirdparty/preact/preact.module.js +1 -0
  292. package/dist/types/AnimationMode.d.ts +0 -8
  293. package/dist/types/AnimationMode.js +0 -8
  294. package/dist/types/AnimationMode.js.map +1 -1
  295. package/dist/types/CalendarType.d.ts +0 -9
  296. package/dist/types/CalendarType.js +0 -9
  297. package/dist/types/CalendarType.js.map +1 -1
  298. package/dist/types/InvisibleMessageMode.d.ts +5 -10
  299. package/dist/types/InvisibleMessageMode.js +4 -11
  300. package/dist/types/InvisibleMessageMode.js.map +1 -1
  301. package/dist/types/ItemNavigationBehavior.d.ts +0 -6
  302. package/dist/types/ItemNavigationBehavior.js +0 -6
  303. package/dist/types/ItemNavigationBehavior.js.map +1 -1
  304. package/dist/types/MovePlacement.d.ts +20 -0
  305. package/dist/types/MovePlacement.js +22 -0
  306. package/dist/types/MovePlacement.js.map +1 -0
  307. package/dist/types/NavigationMode.d.ts +0 -8
  308. package/dist/types/NavigationMode.js +0 -8
  309. package/dist/types/NavigationMode.js.map +1 -1
  310. package/dist/types/Orientation.d.ts +16 -0
  311. package/dist/types/Orientation.js +18 -0
  312. package/dist/types/Orientation.js.map +1 -0
  313. package/dist/types/SortOrder.d.ts +24 -0
  314. package/dist/types/SortOrder.js +26 -0
  315. package/dist/types/SortOrder.js.map +1 -0
  316. package/dist/types/ValueState.d.ts +3 -17
  317. package/dist/types/ValueState.js +3 -17
  318. package/dist/types/ValueState.js.map +1 -1
  319. package/dist/types.d.ts +37 -14
  320. package/dist/types.js.map +1 -1
  321. package/dist/updateShadowRoot.d.ts +1 -2
  322. package/dist/updateShadowRoot.js +4 -29
  323. package/dist/updateShadowRoot.js.map +1 -1
  324. package/dist/util/{AriaLabelHelper.d.ts → AccessibilityTextsHelper.d.ts} +4 -2
  325. package/dist/util/{AriaLabelHelper.js → AccessibilityTextsHelper.js} +36 -8
  326. package/dist/util/AccessibilityTextsHelper.js.map +1 -0
  327. package/dist/util/Caret.js.map +1 -1
  328. package/dist/util/ColorConversion.d.ts +2 -1
  329. package/dist/util/ColorConversion.js +233 -216
  330. package/dist/util/ColorConversion.js.map +1 -1
  331. package/dist/util/FetchHelper.js.map +1 -1
  332. package/dist/util/FocusableElements.js +40 -12
  333. package/dist/util/FocusableElements.js.map +1 -1
  334. package/dist/util/HTMLSanitizer.d.ts +2 -0
  335. package/dist/util/HTMLSanitizer.js +2 -2
  336. package/dist/util/HTMLSanitizer.js.map +1 -1
  337. package/dist/util/InvisibleMessage.d.ts +1 -1
  338. package/dist/util/InvisibleMessage.js +2 -2
  339. package/dist/util/InvisibleMessage.js.map +1 -1
  340. package/dist/util/PopupUtils.d.ts +1 -3
  341. package/dist/util/PopupUtils.js +1 -15
  342. package/dist/util/PopupUtils.js.map +1 -1
  343. package/dist/util/SelectionAssistant.d.ts +12 -0
  344. package/dist/util/SelectionAssistant.js +79 -0
  345. package/dist/util/SelectionAssistant.js.map +1 -0
  346. package/dist/util/SlotsHelper.js.map +1 -1
  347. package/dist/util/StringHelper.d.ts +3 -1
  348. package/dist/util/StringHelper.js +15 -1
  349. package/dist/util/StringHelper.js.map +1 -1
  350. package/dist/util/TabbableElements.js +3 -10
  351. package/dist/util/TabbableElements.js.map +1 -1
  352. package/dist/util/arraysAreEqual.js.map +1 -1
  353. package/dist/util/clamp.js +2 -1
  354. package/dist/util/clamp.js.map +1 -1
  355. package/dist/util/createLinkInHead.d.ts +1 -1
  356. package/dist/util/createLinkInHead.js +1 -1
  357. package/dist/util/createLinkInHead.js.map +1 -1
  358. package/dist/util/debounce.js.map +1 -1
  359. package/dist/util/detectNavigatorLanguage.d.ts +2 -2
  360. package/dist/util/detectNavigatorLanguage.js +6 -1
  361. package/dist/util/detectNavigatorLanguage.js.map +1 -1
  362. package/dist/util/dragAndDrop/DragRegistry.d.ts +33 -0
  363. package/dist/util/dragAndDrop/DragRegistry.js +66 -0
  364. package/dist/util/dragAndDrop/DragRegistry.js.map +1 -0
  365. package/dist/util/dragAndDrop/findClosestPosition.d.ts +12 -0
  366. package/dist/util/dragAndDrop/findClosestPosition.js +106 -0
  367. package/dist/util/dragAndDrop/findClosestPosition.js.map +1 -0
  368. package/dist/util/dragAndDrop/handleDragOver.d.ts +16 -0
  369. package/dist/util/dragAndDrop/handleDragOver.js +42 -0
  370. package/dist/util/dragAndDrop/handleDragOver.js.map +1 -0
  371. package/dist/util/dragAndDrop/handleDrop.d.ts +5 -0
  372. package/dist/util/dragAndDrop/handleDrop.js +22 -0
  373. package/dist/util/dragAndDrop/handleDrop.js.map +1 -0
  374. package/dist/util/dragAndDrop/longDragOverHandler.d.ts +2 -0
  375. package/dist/util/dragAndDrop/longDragOverHandler.js +25 -0
  376. package/dist/util/dragAndDrop/longDragOverHandler.js.map +1 -0
  377. package/dist/util/fixSafariActiveState.d.ts +2 -0
  378. package/dist/util/fixSafariActiveState.js +11 -0
  379. package/dist/util/fixSafariActiveState.js.map +1 -0
  380. package/dist/util/formatMessage.js.map +1 -1
  381. package/dist/util/generateHighlightedMarkup.js.map +1 -1
  382. package/dist/util/getActiveElement.js.map +1 -1
  383. package/dist/util/getClassCopy.d.ts +144 -103
  384. package/dist/util/getDesigntimePropertyAsArray.d.ts +2 -2
  385. package/dist/util/getDesigntimePropertyAsArray.js +2 -1
  386. package/dist/util/getDesigntimePropertyAsArray.js.map +1 -1
  387. package/dist/util/getEffectiveScrollbarStyle.d.ts +1 -1
  388. package/dist/util/getEffectiveScrollbarStyle.js +31 -1
  389. package/dist/util/getEffectiveScrollbarStyle.js.map +1 -1
  390. package/dist/util/getFastNavigationGroups.js +6 -1
  391. package/dist/util/getFastNavigationGroups.js.map +1 -1
  392. package/dist/util/getFileExtension.js.map +1 -1
  393. package/dist/util/getNormalizedTarget.js.map +1 -1
  394. package/dist/util/getSingletonElementInstance.js.map +1 -1
  395. package/dist/util/hash2str.d.ts +1 -0
  396. package/dist/util/hash2str.js +14 -0
  397. package/dist/util/hash2str.js.map +1 -0
  398. package/dist/util/isElementClickable.js.map +1 -1
  399. package/dist/util/isElementHidden.js.map +1 -1
  400. package/dist/util/isElementTabbable.js +2 -2
  401. package/dist/util/isElementTabbable.js.map +1 -1
  402. package/dist/util/isValidPropertyName.js.map +1 -1
  403. package/dist/util/throttle.d.ts +2 -0
  404. package/dist/util/throttle.js +20 -0
  405. package/dist/util/throttle.js.map +1 -0
  406. package/dist/util/toLowercaseEnumValue.d.ts +3 -0
  407. package/dist/util/toLowercaseEnumValue.js +4 -0
  408. package/dist/util/toLowercaseEnumValue.js.map +1 -0
  409. package/dist/util/whenDOMReady.js.map +1 -1
  410. package/dist/validateThemeRoot.js +3 -2
  411. package/dist/validateThemeRoot.js.map +1 -1
  412. package/package-scripts.cjs +26 -23
  413. package/package.json +37 -11
  414. package/src/css/FontFace.css +13 -1
  415. package/src/css/SystemCSSVars.css +0 -8
  416. package/src/thirdparty/preact/jsxRuntime.module.js +1 -0
  417. package/src/thirdparty/preact/preact.module.js +1 -0
  418. package/src/thirdparty/preact/version.txt +1 -0
  419. package/tsconfig.json +18 -13
  420. package/.eslintignore +0 -16
  421. package/.eslintrc.cjs +0 -3
  422. package/bundle.esm.js +0 -67
  423. package/config/wdio.conf.cjs +0 -400
  424. package/dist/CSP.d.ts +0 -30
  425. package/dist/CSP.js +0 -51
  426. package/dist/CSP.js.map +0 -1
  427. package/dist/MarkedEvents.d.ts +0 -9
  428. package/dist/MarkedEvents.js +0 -15
  429. package/dist/MarkedEvents.js.map +0 -1
  430. package/dist/StaticArea.d.ts +0 -3
  431. package/dist/StaticArea.js +0 -7
  432. package/dist/StaticArea.js.map +0 -1
  433. package/dist/StaticAreaItem.d.ts +0 -37
  434. package/dist/StaticAreaItem.js +0 -102
  435. package/dist/StaticAreaItem.js.map +0 -1
  436. package/dist/api.json +0 -1
  437. package/dist/assets/Boot-34b7cea0.css +0 -1
  438. package/dist/assets/Boot-c953ce57.js +0 -9
  439. package/dist/assets/bundle.esm-a0b43d30.js +0 -50
  440. package/dist/config/RTL.d.ts +0 -7
  441. package/dist/config/RTL.js +0 -37
  442. package/dist/config/RTL.js.map +0 -1
  443. package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.d.ts +0 -4
  444. package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.js +0 -9
  445. package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.js.map +0 -1
  446. package/dist/theming/getEffectiveLinksHrefs.d.ts +0 -3
  447. package/dist/theming/getEffectiveLinksHrefs.js +0 -17
  448. package/dist/theming/getEffectiveLinksHrefs.js.map +0 -1
  449. package/dist/theming/preloadLinks.d.ts +0 -3
  450. package/dist/theming/preloadLinks.js +0 -19
  451. package/dist/theming/preloadLinks.js.map +0 -1
  452. package/dist/types/CSSColor.d.ts +0 -15
  453. package/dist/types/CSSColor.js +0 -18
  454. package/dist/types/CSSColor.js.map +0 -1
  455. package/dist/types/CSSSize.d.ts +0 -15
  456. package/dist/types/CSSSize.js +0 -18
  457. package/dist/types/CSSSize.js.map +0 -1
  458. package/dist/types/DOMReference.d.ts +0 -17
  459. package/dist/types/DOMReference.js +0 -25
  460. package/dist/types/DOMReference.js.map +0 -1
  461. package/dist/types/DataType.d.ts +0 -25
  462. package/dist/types/DataType.js +0 -44
  463. package/dist/types/DataType.js.map +0 -1
  464. package/dist/types/Float.d.ts +0 -17
  465. package/dist/types/Float.js +0 -21
  466. package/dist/types/Float.js.map +0 -1
  467. package/dist/types/Integer.d.ts +0 -17
  468. package/dist/types/Integer.js +0 -21
  469. package/dist/types/Integer.js.map +0 -1
  470. package/dist/util/AriaLabelHelper.js.map +0 -1
  471. package/dist/util/createStyleInHead.d.ts +0 -8
  472. package/dist/util/createStyleInHead.js +0 -18
  473. package/dist/util/createStyleInHead.js.map +0 -1
  474. package/index.js +0 -230
  475. package/lib/generate-asset-parameters/index.js +0 -27
  476. package/lib/generate-styles/index.js +0 -31
  477. package/lib/generate-version-info/index.js +0 -32
  478. package/src/renderer/directives/style-map.js +0 -72
  479. package/used-modules.txt +0 -10
@@ -1,26 +1,56 @@
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";
13
13
  import getEffectiveDir from "./locale/getEffectiveDir.js";
14
- import { kebabToCamelCase, camelToKebabCase } from "./util/StringHelper.js";
14
+ import { kebabToCamelCase, camelToKebabCase, kebabToPascalCase } from "./util/StringHelper.js";
15
15
  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";
20
+ import { shouldScopeCustomElement } from "./CustomElementsScopeUtils.js";
21
+ import { updateFormValue, setFormValue } from "./features/InputElementsFormSupport.js";
22
+ import { getI18nBundle } from "./i18nBundle.js";
23
+ import { fetchCldr } from "./asset-registries/LocaleData.js";
24
+ import getLocale from "./locale/getLocale.js";
25
+ const DEV_MODE = true;
21
26
  let autoId = 0;
22
27
  const elementTimeouts = new Map();
23
28
  const uniqueDependenciesCache = new Map();
29
+ const defaultConverter = {
30
+ fromAttribute(value, type) {
31
+ if (type === Boolean) {
32
+ return value !== null;
33
+ }
34
+ if (type === Number) {
35
+ return value === null ? undefined : parseFloat(value);
36
+ }
37
+ return value;
38
+ },
39
+ toAttribute(value, type) {
40
+ if (type === Boolean) {
41
+ return value ? "" : null;
42
+ }
43
+ // don't set attributes for arrays and objects
44
+ if (type === Object || type === Array) {
45
+ return null;
46
+ }
47
+ // object, array, other
48
+ if (value === null || value === undefined) {
49
+ return null;
50
+ }
51
+ return String(value);
52
+ },
53
+ };
24
54
  /**
25
55
  * Triggers re-rendering of a UI5Element instance due to state change.
26
56
  * @param {ChangeInfo} changeInfo An object with information about the change that caused invalidation.
@@ -36,21 +66,38 @@ function _invalidate(changeInfo) {
36
66
  this.onInvalidation(changeInfo);
37
67
  this._changedState.push(changeInfo);
38
68
  renderDeferred(this);
39
- this._eventProvider.fireEvent("invalidate", { ...changeInfo, target: this });
69
+ this._invalidationEventProvider.fireEvent("invalidate", { ...changeInfo, target: this });
70
+ }
71
+ /**
72
+ * looks up a property descsriptor including in the prototype chain
73
+ * @param proto the starting prototype
74
+ * @param name the property to look for
75
+ * @returns the property descriptor if found directly or in the prototype chaing, undefined if not found
76
+ */
77
+ function getPropertyDescriptor(proto, name) {
78
+ do {
79
+ const descriptor = Object.getOwnPropertyDescriptor(proto, name);
80
+ if (descriptor) {
81
+ return descriptor;
82
+ }
83
+ // go up the prototype chain
84
+ proto = Object.getPrototypeOf(proto);
85
+ } while (proto && proto !== HTMLElement.prototype);
40
86
  }
41
87
  /**
88
+ * @class
42
89
  * Base class for all UI5 Web Components
43
90
  *
44
- * @class
45
- * @constructor
46
- * @author SAP SE
47
- * @alias sap.ui.webc.base.UI5Element
48
91
  * @extends HTMLElement
49
92
  * @public
50
93
  */
51
94
  class UI5Element extends HTMLElement {
52
95
  constructor() {
53
96
  super();
97
+ // used to differentiate whether a setter is called from the constructor (from an initializer) or later
98
+ // setters from the constructor should not set attributes, this is delegated after the first rendering but is async
99
+ // setters after the constructor can set attributes synchronously for more convinient development
100
+ this._rendered = false;
54
101
  const ctor = this.constructor;
55
102
  this._changedState = []; // Filled on each invalidation, cleared on re-render (used for debugging)
56
103
  this._suppressInvalidation = true; // A flag telling whether all invalidations should be ignored. Initialized with "true" because a UI5Element can not be invalidated until it is rendered for the first time
@@ -58,17 +105,46 @@ class UI5Element extends HTMLElement {
58
105
  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)
59
106
  this._childChangeListeners = new Map(); // used to store lazy listeners per slot for the child change event of every child inside that slot
60
107
  this._slotChangeListeners = new Map(); // used to store lazy listeners per slot for the slotchange event of all slot children inside that slot
61
- this._eventProvider = new EventProvider(); // used by parent components for listening to changes to child components
108
+ this._invalidationEventProvider = new EventProvider(); // used by parent components for listening to changes to child components
109
+ this._componentStateFinalizedEventProvider = new EventProvider(); // used by friend classes for synchronization
62
110
  let deferredResolve;
63
111
  this._domRefReadyPromise = new Promise(resolve => {
64
112
  deferredResolve = resolve;
65
113
  });
66
114
  this._domRefReadyPromise._deferredResolve = deferredResolve;
67
115
  this._doNotSyncAttributes = new Set(); // attributes that are excluded from attributeChangedCallback synchronization
116
+ this._slotsAssignedNodes = new WeakMap(); // map of all nodes, slotted (directly or transitively) per component slot
68
117
  this._state = { ...ctor.getMetadata().getInitialState() };
69
- this._upgradeAllProperties();
118
+ // save properties set before element is upgraded, as they will be overriden by the field initializers in the constructor
119
+ this.initializedProperties = new Map();
120
+ const allProps = this.constructor.getMetadata().getPropertiesList();
121
+ allProps.forEach(propertyName => {
122
+ if (this.hasOwnProperty(propertyName)) { // eslint-disable-line
123
+ const value = this[propertyName];
124
+ this.initializedProperties.set(propertyName, value);
125
+ }
126
+ });
127
+ this._internals = this.attachInternals();
128
+ this._initShadowRoot();
129
+ }
130
+ _initShadowRoot() {
131
+ const ctor = this.constructor;
70
132
  if (ctor._needsShadowDOM()) {
71
- this.attachShadow({ mode: "open" });
133
+ const defaultOptions = { mode: "open" };
134
+ this.attachShadow({ ...defaultOptions, ...ctor.getMetadata().getShadowRootOptions() });
135
+ const slotsAreManaged = ctor.getMetadata().slotsAreManaged();
136
+ if (slotsAreManaged) {
137
+ this.shadowRoot.addEventListener("slotchange", this._onShadowRootSlotChange.bind(this));
138
+ }
139
+ }
140
+ }
141
+ /**
142
+ * Note: this "slotchange" listener is for slots, rendered in the component's shadow root
143
+ */
144
+ _onShadowRootSlotChange(e) {
145
+ const targetShadowRoot = e.target?.getRootNode(); // the "slotchange" event target is always a slot element
146
+ if (targetShadowRoot === this.shadowRoot) { // only for slotchange events that originate from slots, belonging to the component's shadow root
147
+ this._processChildren();
72
148
  }
73
149
  }
74
150
  /**
@@ -87,15 +163,21 @@ class UI5Element extends HTMLElement {
87
163
  const template = this.constructor.template;
88
164
  return executeTemplate(template, this);
89
165
  }
90
- renderStatic() {
91
- const template = this.constructor.staticAreaTemplate;
92
- return executeTemplate(template, this);
93
- }
94
166
  /**
95
167
  * Do not call this method from derivatives of UI5Element, use "onEnterDOM" only
96
168
  * @private
97
169
  */
98
170
  async connectedCallback() {
171
+ if (DEV_MODE) {
172
+ const props = this.constructor.getMetadata().getProperties();
173
+ for (const [prop, propData] of Object.entries(props)) { // eslint-disable-line
174
+ if (Object.hasOwn(this, prop) && !this.initializedProperties.has(prop)) {
175
+ // initialized properties should not trigger this error as they will be reassigned, only property initializers will trigger this in case unsupported TS mode
176
+ // eslint-disable-next-line no-console
177
+ 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`);
178
+ }
179
+ }
180
+ }
99
181
  const ctor = this.constructor;
100
182
  this.setAttribute(ctor.getMetadata().getPureTag(), "");
101
183
  if (ctor.getMetadata().supportsF6FastNavigation()) {
@@ -111,6 +193,9 @@ class UI5Element extends HTMLElement {
111
193
  if (!this._inDOM) { // Component removed from DOM while _processChildren was running
112
194
  return;
113
195
  }
196
+ if (!ctor.asyncFinished) {
197
+ await ctor.definePromise;
198
+ }
114
199
  renderImmediately(this);
115
200
  this._domRefReadyPromise._deferredResolve();
116
201
  this._fullyConnected = true;
@@ -131,9 +216,7 @@ class UI5Element extends HTMLElement {
131
216
  this.onExitDOM();
132
217
  this._fullyConnected = false;
133
218
  }
134
- if (this.staticAreaItem && this.staticAreaItem.parentElement) {
135
- this.staticAreaItem.parentElement.removeChild(this.staticAreaItem);
136
- }
219
+ this._domRefReadyPromise._deferredResolve();
137
220
  cancelRender(this);
138
221
  }
139
222
  /**
@@ -161,11 +244,12 @@ class UI5Element extends HTMLElement {
161
244
  */
162
245
  _startObservingDOMChildren() {
163
246
  const ctor = this.constructor;
164
- const shouldObserveChildren = ctor.getMetadata().hasSlots();
247
+ const metadata = ctor.getMetadata();
248
+ const shouldObserveChildren = metadata.hasSlots();
165
249
  if (!shouldObserveChildren) {
166
250
  return;
167
251
  }
168
- const canSlotText = ctor.getMetadata().canSlotText();
252
+ const canSlotText = metadata.canSlotText();
169
253
  const mutationObserverOptions = {
170
254
  childList: true,
171
255
  subtree: canSlotText,
@@ -231,9 +315,9 @@ class UI5Element extends HTMLElement {
231
315
  const localName = child.localName;
232
316
  const shouldWaitForCustomElement = localName.includes("-") && !shouldIgnoreCustomElement(localName);
233
317
  if (shouldWaitForCustomElement) {
234
- const isDefined = window.customElements.get(localName);
318
+ const isDefined = customElements.get(localName);
235
319
  if (!isDefined) {
236
- const whenDefinedPromise = window.customElements.whenDefined(localName); // Class registered, but instances not upgraded yet
320
+ const whenDefinedPromise = customElements.whenDefined(localName); // Class registered, but instances not upgraded yet
237
321
  let timeoutPromise = elementTimeouts.get(localName);
238
322
  if (!timeoutPromise) {
239
323
  timeoutPromise = new Promise(resolve => setTimeout(resolve, 1000));
@@ -241,20 +325,18 @@ class UI5Element extends HTMLElement {
241
325
  }
242
326
  await Promise.race([whenDefinedPromise, timeoutPromise]);
243
327
  }
244
- window.customElements.upgrade(child);
328
+ customElements.upgrade(child);
245
329
  }
246
330
  }
247
331
  child = ctor.getMetadata().constructor.validateSlotValue(child, slotData);
248
332
  // Listen for any invalidation on the child if invalidateOnChildChange is true or an object (ignore when false or not set)
249
333
  if (instanceOfUI5Element(child) && slotData.invalidateOnChildChange) {
250
334
  const childChangeListener = this._getChildChangeListener(slotName);
251
- if (childChangeListener) {
252
- child.attachInvalidate.call(child, childChangeListener);
253
- }
335
+ child.attachInvalidate.call(child, childChangeListener);
254
336
  }
255
337
  // Listen for the slotchange event if the child is a slot itself
256
338
  if (child instanceof HTMLSlotElement) {
257
- this._attachSlotChange(child, slotName);
339
+ this._attachSlotChange(child, slotName, !!slotData.invalidateOnChildChange);
258
340
  }
259
341
  const propertyName = slotData.propertyName || slotName;
260
342
  if (slottedChildrenMap.has(propertyName)) {
@@ -269,6 +351,7 @@ class UI5Element extends HTMLElement {
269
351
  // not the order elements are defined.
270
352
  slottedChildrenMap.forEach((children, propertyName) => {
271
353
  this._state[propertyName] = children.sort((a, b) => a.idx - b.idx).map(_ => _.child);
354
+ this._state[kebabToCamelCase(propertyName)] = this._state[propertyName];
272
355
  });
273
356
  // Compare the content of each slot with the cached values and invalidate for the ones that changed
274
357
  let invalidated = false;
@@ -281,6 +364,9 @@ class UI5Element extends HTMLElement {
281
364
  reason: "children",
282
365
  });
283
366
  invalidated = true;
367
+ if (ctor.getMetadata().isFormAssociated()) {
368
+ setFormValue(this);
369
+ }
284
370
  }
285
371
  }
286
372
  // If none of the slots had an invalidation due to changes to immediate children,
@@ -303,39 +389,38 @@ class UI5Element extends HTMLElement {
303
389
  children.forEach(child => {
304
390
  if (instanceOfUI5Element(child)) {
305
391
  const childChangeListener = this._getChildChangeListener(slotName);
306
- if (childChangeListener) {
307
- child.detachInvalidate.call(child, childChangeListener);
308
- }
392
+ child.detachInvalidate.call(child, childChangeListener);
309
393
  }
310
394
  if (child instanceof HTMLSlotElement) {
311
395
  this._detachSlotChange(child, slotName);
312
396
  }
313
397
  });
314
398
  this._state[propertyName] = [];
399
+ this._state[kebabToCamelCase(propertyName)] = this._state[propertyName];
315
400
  }
316
401
  /**
317
402
  * Attach a callback that will be executed whenever the component is invalidated
318
403
  *
319
- * @param {InvalidationInfo} callback
404
+ * @param callback
320
405
  * @public
321
406
  */
322
407
  attachInvalidate(callback) {
323
- this._eventProvider.attachEvent("invalidate", callback);
408
+ this._invalidationEventProvider.attachEvent("invalidate", callback);
324
409
  }
325
410
  /**
326
411
  * Detach the callback that is executed whenever the component is invalidated
327
412
  *
328
- * @param {InvalidationInfo} callback
413
+ * @param callback
329
414
  * @public
330
415
  */
331
416
  detachInvalidate(callback) {
332
- this._eventProvider.detachEvent("invalidate", callback);
417
+ this._invalidationEventProvider.detachEvent("invalidate", callback);
333
418
  }
334
419
  /**
335
420
  * Callback that is executed whenever a monitored child changes its state
336
421
  *
337
- * @param {sting} slotName the slot in which a child was invalidated
338
- * @param { ChangeInfo } childChangeInfo the changeInfo object for the child in the given slot
422
+ * @param slotName the slot in which a child was invalidated
423
+ * @param childChangeInfo the changeInfo object for the child in the given slot
339
424
  * @private
340
425
  */
341
426
  _onChildChange(slotName, childChangeInfo) {
@@ -365,23 +450,21 @@ class UI5Element extends HTMLElement {
365
450
  const nameInCamelCase = kebabToCamelCase(realName);
366
451
  if (properties.hasOwnProperty(nameInCamelCase)) { // eslint-disable-line
367
452
  const propData = properties[nameInCamelCase];
368
- const propertyType = propData.type;
369
- let propertyValidator = propData.validator;
370
- if (propertyType && propertyType.isDataTypeClass) {
371
- propertyValidator = propertyType;
372
- }
373
- if (propertyValidator) {
374
- newPropertyValue = propertyValidator.attributeToProperty(newValue);
375
- }
376
- else if (propertyType === Boolean) {
377
- newPropertyValue = newValue !== null;
378
- }
379
- else {
380
- newPropertyValue = newValue;
381
- }
453
+ const converter = propData.converter ?? defaultConverter;
454
+ newPropertyValue = converter.fromAttribute(newValue, propData.type);
382
455
  this[nameInCamelCase] = newPropertyValue;
383
456
  }
384
457
  }
458
+ formAssociatedCallback() {
459
+ const ctor = this.constructor;
460
+ if (!ctor.getMetadata().isFormAssociated()) {
461
+ return;
462
+ }
463
+ updateFormValue(this);
464
+ }
465
+ static get formAssociated() {
466
+ return this.getMetadata().isFormAssociated();
467
+ }
385
468
  /**
386
469
  * @private
387
470
  */
@@ -392,60 +475,37 @@ class UI5Element extends HTMLElement {
392
475
  }
393
476
  const properties = ctor.getMetadata().getProperties();
394
477
  const propData = properties[name];
395
- const propertyType = propData.type;
396
- let propertyValidator = propData.validator;
397
478
  const attrName = camelToKebabCase(name);
398
- const attrValue = this.getAttribute(attrName);
399
- if (propertyType && propertyType.isDataTypeClass) {
400
- propertyValidator = propertyType;
401
- }
402
- if (propertyValidator) {
403
- const newAttrValue = propertyValidator.propertyToAttribute(newValue);
404
- if (newAttrValue === null) { // null means there must be no attribute for the current value of the property
405
- this._doNotSyncAttributes.add(attrName); // skip the attributeChangedCallback call for this attribute
406
- this.removeAttribute(attrName); // remove the attribute safely (will not trigger synchronization to the property value due to the above line)
407
- this._doNotSyncAttributes.delete(attrName); // enable synchronization again for this attribute
479
+ const converter = propData.converter || defaultConverter;
480
+ if (DEV_MODE) {
481
+ const tag = this.constructor.getMetadata().getTag();
482
+ if (typeof newValue === "boolean" && propData.type !== Boolean) {
483
+ // eslint-disable-next-line
484
+ console.error(`[UI5-FWK] boolean value for property [${name}] of component [${tag}] is missing "{ type: Boolean }" in its property decorator. Attribute conversion will treat it as a string. If this is intended, pass the value converted to string, otherwise add the type to the property decorator`);
408
485
  }
409
- else {
410
- this.setAttribute(attrName, newAttrValue);
411
- }
412
- }
413
- else if (propertyType === Boolean) {
414
- if (newValue === true && attrValue === null) {
415
- this.setAttribute(attrName, "");
486
+ if (typeof newValue === "number" && propData.type !== Number) {
487
+ // eslint-disable-next-line
488
+ console.error(`[UI5-FWK] numeric value for property [${name}] of component [${tag}] is missing "{ type: Number }" in its property decorator. Attribute conversion will treat it as a string. If this is intended, pass the value converted to string, otherwise add the type to the property decorator`);
416
489
  }
417
- else if (newValue === false && attrValue !== null) {
418
- this.removeAttribute(attrName);
490
+ if (typeof newValue === "string" && propData.type && propData.type !== String) {
491
+ // eslint-disable-next-line
492
+ console.error(`[UI5-FWK] string value for property [${name}] of component [${tag}] which has a non-string type [${propData.type}] in its property decorator. Attribute conversion will stop and keep the string value in the property.`);
419
493
  }
420
494
  }
421
- else if (typeof newValue !== "object") {
422
- if (attrValue !== newValue) {
423
- this.setAttribute(attrName, newValue);
424
- }
425
- } // else { return; } // old object handling
426
- }
427
- /**
428
- * @private
429
- */
430
- _upgradeProperty(propertyName) {
431
- if (this.hasOwnProperty(propertyName)) { // eslint-disable-line
432
- const value = this[propertyName];
433
- delete this[propertyName];
434
- this[propertyName] = value;
495
+ const newAttrValue = converter.toAttribute(newValue, propData.type);
496
+ this._doNotSyncAttributes.add(attrName); // skip the attributeChangedCallback call for this attribute
497
+ if (newAttrValue === null || newAttrValue === undefined) { // null means there must be no attribute for the current value of the property
498
+ this.removeAttribute(attrName); // remove the attribute safely (will not trigger synchronization to the property value due to the above line)
435
499
  }
436
- }
437
- /**
438
- * @private
439
- */
440
- _upgradeAllProperties() {
441
- const allProps = this.constructor.getMetadata().getPropertiesList();
442
- allProps.forEach(this._upgradeProperty.bind(this));
500
+ else {
501
+ this.setAttribute(attrName, newAttrValue); // setting attributes from properties should not trigger the property setter again
502
+ }
503
+ this._doNotSyncAttributes.delete(attrName); // enable synchronization again for this attribute
443
504
  }
444
505
  /**
445
506
  * Returns a singleton event listener for the "change" event of a child in a given slot
446
507
  *
447
508
  * @param slotName the name of the slot, where the child is
448
- * @returns {ChildChangeListener}
449
509
  * @private
450
510
  */
451
511
  _getChildChangeListener(slotName) {
@@ -458,7 +518,6 @@ class UI5Element extends HTMLElement {
458
518
  * Returns a singleton slotchange event listener that invalidates the component due to changes in the given slot
459
519
  *
460
520
  * @param slotName the name of the slot, where the slot element (whose slotchange event we're listening to) is
461
- * @returns {SlotChangeListener}
462
521
  * @private
463
522
  */
464
523
  _getSlotChangeListener(slotName) {
@@ -470,11 +529,32 @@ class UI5Element extends HTMLElement {
470
529
  /**
471
530
  * @private
472
531
  */
473
- _attachSlotChange(child, slotName) {
532
+ _attachSlotChange(slot, slotName, invalidateOnChildChange) {
474
533
  const slotChangeListener = this._getSlotChangeListener(slotName);
475
- if (slotChangeListener) {
476
- child.addEventListener("slotchange", slotChangeListener);
477
- }
534
+ slot.addEventListener("slotchange", (e) => {
535
+ slotChangeListener.call(slot, e);
536
+ if (invalidateOnChildChange) {
537
+ // Detach listeners for UI5 Elements that used to be in this slot
538
+ const previousChildren = this._slotsAssignedNodes.get(slot);
539
+ if (previousChildren) {
540
+ previousChildren.forEach(child => {
541
+ if (instanceOfUI5Element(child)) {
542
+ const childChangeListener = this._getChildChangeListener(slotName);
543
+ child.detachInvalidate.call(child, childChangeListener);
544
+ }
545
+ });
546
+ }
547
+ // Attach listeners for UI5 Elements that are now in this slot
548
+ const newChildren = getSlottedNodesList([slot]);
549
+ this._slotsAssignedNodes.set(slot, newChildren);
550
+ newChildren.forEach(child => {
551
+ if (instanceOfUI5Element(child)) {
552
+ const childChangeListener = this._getChildChangeListener(slotName);
553
+ child.attachInvalidate.call(child, childChangeListener);
554
+ }
555
+ });
556
+ }
557
+ });
478
558
  }
479
559
  /**
480
560
  * @private
@@ -484,6 +564,7 @@ class UI5Element extends HTMLElement {
484
564
  }
485
565
  /**
486
566
  * Whenever a slot element is slotted inside a UI5 Web Component, its slotchange event invalidates the component
567
+ * Note: this "slotchange" listener is for slots that are children of the component (in the light dom, as opposed to slots rendered by the component in the shadow root)
487
568
  *
488
569
  * @param slotName the name of the slot, where the slot element (whose slotchange event we're listening to) is
489
570
  * @private
@@ -510,9 +591,9 @@ class UI5Element extends HTMLElement {
510
591
  * 1) children: immediate children (HTML elements or text nodes) were added, removed or reordered in the slot
511
592
  * 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"
512
593
  * 3) slotchange: a slot element, slotted inside that slot had its "slotchange" event listener called. This practically means that transitively slotted children changed.
513
- * Can only trigger if the child of a slot is a slot element itself.
594
+ * Can only trigger if the child of a slot is a slot element itself.
514
595
  * 4) childchange: indicates that a UI5Element child in that slot was invalidated and in turn invalidated the component.
515
- * Can only trigger for slots with "invalidateOnChildChange" metadata descriptor
596
+ * Can only trigger for slots with "invalidateOnChildChange" metadata descriptor
516
597
  *
517
598
  * - newValue: the new value of the property (for type="property" only)
518
599
  *
@@ -523,6 +604,13 @@ class UI5Element extends HTMLElement {
523
604
  * @public
524
605
  */
525
606
  onInvalidation(changeInfo) { } // eslint-disable-line
607
+ updateAttributes() {
608
+ const ctor = this.constructor;
609
+ const props = ctor.getMetadata().getProperties();
610
+ for (const [prop, propData] of Object.entries(props)) { // eslint-disable-line
611
+ this._updateAttribute(prop, this[prop]);
612
+ }
613
+ }
526
614
  /**
527
615
  * Do not call this method directly, only intended to be called by js
528
616
  * @protected
@@ -530,15 +618,29 @@ class UI5Element extends HTMLElement {
530
618
  _render() {
531
619
  const ctor = this.constructor;
532
620
  const hasIndividualSlots = ctor.getMetadata().hasIndividualSlots();
621
+ // restore properties that were initialized before `define` by calling the setter
622
+ if (this.initializedProperties.size > 0) {
623
+ Array.from(this.initializedProperties.entries()).forEach(([prop, value]) => {
624
+ delete this[prop];
625
+ this[prop] = value;
626
+ });
627
+ this.initializedProperties.clear();
628
+ }
533
629
  // suppress invalidation to prevent state changes scheduling another rendering
534
630
  this._suppressInvalidation = true;
535
- this.onBeforeRendering();
536
- // Intended for framework usage only. Currently ItemNavigation updates tab indexes after the component has updated its state but before the template is rendered
537
- if (this._onComponentStateFinalized) {
538
- this._onComponentStateFinalized();
631
+ try {
632
+ this.onBeforeRendering();
633
+ if (!this._rendered) {
634
+ // first time rendering, previous setters might have been initializers from the constructor - update attributes here
635
+ this.updateAttributes();
636
+ }
637
+ // Intended for framework usage only. Currently ItemNavigation updates tab indexes after the component has updated its state but before the template is rendered
638
+ this._componentStateFinalizedEventProvider.fireEvent("componentStateFinalized");
639
+ }
640
+ finally {
641
+ // always resume normal invalidation handling
642
+ this._suppressInvalidation = false;
539
643
  }
540
- // resume normal invalidation handling
541
- this._suppressInvalidation = false;
542
644
  // Update the shadow root with the render result
543
645
  /*
544
646
  if (this._changedState.length) {
@@ -561,13 +663,11 @@ class UI5Element extends HTMLElement {
561
663
  }
562
664
  */
563
665
  this._changedState = [];
564
- // Update shadow root and static area item
666
+ // Update shadow root
565
667
  if (ctor._needsShadowDOM()) {
566
668
  updateShadowRoot(this);
567
669
  }
568
- if (this.staticAreaItem) {
569
- this.staticAreaItem.update();
570
- }
670
+ this._rendered = true;
571
671
  // Safari requires that children get the slot attribute only after the slot tags have been rendered in the shadow DOM
572
672
  if (hasIndividualSlots) {
573
673
  this._assignIndividualSlotsToChildren();
@@ -607,11 +707,7 @@ class UI5Element extends HTMLElement {
607
707
  if (!this.shadowRoot || this.shadowRoot.children.length === 0) {
608
708
  return;
609
709
  }
610
- const children = [...this.shadowRoot.children].filter(child => !["link", "style"].includes(child.localName));
611
- if (children.length !== 1) {
612
- 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
613
- }
614
- return children[0];
710
+ return this.shadowRoot.children[0];
615
711
  }
616
712
  /**
617
713
  * Returns the DOM Element marked with "data-sap-focus-ref" inside the template.
@@ -636,13 +732,16 @@ class UI5Element extends HTMLElement {
636
732
  }
637
733
  /**
638
734
  * Set the focus to the element, returned by "getFocusDomRef()" (marked by "data-sap-focus-ref")
639
- * @param {FocusOptions} focusOptions additional options for the focus
735
+ * @param focusOptions additional options for the focus
640
736
  * @public
641
737
  */
642
738
  async focus(focusOptions) {
643
739
  await this._waitForDomRef();
644
740
  const focusDomRef = this.getFocusDomRef();
645
- if (focusDomRef && typeof focusDomRef.focus === "function") {
741
+ if (focusDomRef === this) {
742
+ HTMLElement.prototype.focus.call(this, focusOptions);
743
+ }
744
+ else if (focusDomRef && typeof focusDomRef.focus === "function") {
646
745
  focusDomRef.focus(focusOptions);
647
746
  }
648
747
  }
@@ -653,13 +752,40 @@ class UI5Element extends HTMLElement {
653
752
  * @param data - additional data for the event
654
753
  * @param cancelable - true, if the user can call preventDefault on the event object
655
754
  * @param bubbles - true, if the event bubbles
656
- * @returns {boolean} false, if the event was cancelled (preventDefault called), true otherwise
755
+ * @returns false, if the event was cancelled (preventDefault called), true otherwise
756
+ * @deprecated use fireDecoratorEvent instead
657
757
  */
658
758
  fireEvent(name, data, cancelable = false, bubbles = true) {
659
759
  const eventResult = this._fireEvent(name, data, cancelable, bubbles);
660
- const camelCaseEventName = kebabToCamelCase(name);
661
- if (camelCaseEventName !== name) {
662
- return eventResult && this._fireEvent(camelCaseEventName, data, cancelable);
760
+ const pascalCaseEventName = kebabToPascalCase(name);
761
+ // pascal events are more convinient for native react usage
762
+ // live-change:
763
+ // Before: onlive-change
764
+ // After: onLiveChange
765
+ if (pascalCaseEventName !== name) {
766
+ return eventResult && this._fireEvent(pascalCaseEventName, data, cancelable, bubbles);
767
+ }
768
+ return eventResult;
769
+ }
770
+ /**
771
+ * Fires a custom event, configured via the "event" decorator.
772
+ * @public
773
+ * @param name - name of the event
774
+ * @param data - additional data for the event
775
+ * @returns false, if the event was cancelled (preventDefault called), true otherwise
776
+ */
777
+ fireDecoratorEvent(name, data) {
778
+ const eventData = this.getEventData(name);
779
+ const cancellable = eventData ? eventData.cancelable : false;
780
+ const bubbles = eventData ? eventData.bubbles : false;
781
+ const eventResult = this._fireEvent(name, data, cancellable, bubbles);
782
+ const pascalCaseEventName = kebabToPascalCase(name);
783
+ // pascal events are more convinient for native react usage
784
+ // live-change:
785
+ // Before: onlive-change
786
+ // After: onLiveChange
787
+ if (pascalCaseEventName !== name) {
788
+ return eventResult && this._fireEvent(pascalCaseEventName, data, cancellable, bubbles);
663
789
  }
664
790
  return eventResult;
665
791
  }
@@ -686,6 +812,11 @@ class UI5Element extends HTMLElement {
686
812
  // Return false if any of the two events was prevented (its result was false).
687
813
  return normalEventResult && noConflictEventResult;
688
814
  }
815
+ getEventData(name) {
816
+ const ctor = this.constructor;
817
+ const eventMap = ctor.getMetadata().getEvents();
818
+ return eventMap[name];
819
+ }
689
820
  /**
690
821
  * Returns the actual children, associated with a slot.
691
822
  * Useful when there are transitive slots in nested component scenarios and you don't want to get a list of the slots, but rather of their content.
@@ -694,12 +825,30 @@ class UI5Element extends HTMLElement {
694
825
  getSlottedNodes(slotName) {
695
826
  return getSlottedNodesList(this[slotName]);
696
827
  }
828
+ /**
829
+ * Attach a callback that will be executed whenever the component's state is finalized
830
+ *
831
+ * @param callback
832
+ * @public
833
+ */
834
+ attachComponentStateFinalized(callback) {
835
+ this._componentStateFinalizedEventProvider.attachEvent("componentStateFinalized", callback);
836
+ }
837
+ /**
838
+ * Detach the callback that is executed whenever the component's state is finalized
839
+ *
840
+ * @param callback
841
+ * @public
842
+ */
843
+ detachComponentStateFinalized(callback) {
844
+ this._componentStateFinalizedEventProvider.detachEvent("componentStateFinalized", callback);
845
+ }
697
846
  /**
698
847
  * Determines whether the component should be rendered in RTL mode or not.
699
848
  * Returns: "rtl", "ltr" or undefined
700
849
  *
701
850
  * @public
702
- * @returns {String|undefined}
851
+ * @default undefined
703
852
  */
704
853
  get effectiveDir() {
705
854
  markAsRtlAware(this.constructor); // if a UI5 Element calls this method, it's considered to be rtl-aware
@@ -707,49 +856,50 @@ class UI5Element extends HTMLElement {
707
856
  }
708
857
  /**
709
858
  * Used to duck-type UI5 elements without using instanceof
710
- * @returns {boolean}
711
859
  * @public
860
+ * @default true
712
861
  */
713
862
  get isUI5Element() {
714
863
  return true;
715
864
  }
865
+ get isUI5AbstractElement() {
866
+ return !this.constructor._needsShadowDOM();
867
+ }
716
868
  get classes() {
717
869
  return {};
718
870
  }
719
871
  /**
720
- * Do not override this method in derivatives of UI5Element, use metadata properties instead
872
+ * Returns the component accessibility info.
721
873
  * @private
722
874
  */
723
- static get observedAttributes() {
724
- return this.getMetadata().getAttributesList();
875
+ get accessibilityInfo() {
876
+ return {};
725
877
  }
726
878
  /**
879
+ * Do not override this method in derivatives of UI5Element, use metadata properties instead
727
880
  * @private
728
881
  */
729
- static _needsShadowDOM() {
730
- return !!this.template || Object.prototype.hasOwnProperty.call(this.prototype, "render");
882
+ static get observedAttributes() {
883
+ return this.getMetadata().getAttributesList();
731
884
  }
732
885
  /**
886
+ * Returns all tags, used inside component's template subject to scoping.
887
+ * returns {Array[]} // TODO add @
733
888
  * @private
734
889
  */
735
- static _needsStaticArea() {
736
- return !!this.staticAreaTemplate || Object.prototype.hasOwnProperty.call(this.prototype, "renderStatic");
890
+ static get tagsToScope() {
891
+ const componentTag = this.getMetadata().getPureTag();
892
+ const tagsToScope = this.getUniqueDependencies().map((dep) => dep.getMetadata().getPureTag()).filter(shouldScopeCustomElement);
893
+ if (shouldScopeCustomElement(componentTag)) {
894
+ tagsToScope.push(componentTag);
895
+ }
896
+ return tagsToScope;
737
897
  }
738
898
  /**
739
- * @public
899
+ * @private
740
900
  */
741
- getStaticAreaItemDomRef() {
742
- if (!this.constructor._needsStaticArea()) {
743
- throw new Error("This component does not use the static area");
744
- }
745
- if (!this.staticAreaItem) {
746
- this.staticAreaItem = StaticAreaItem.createInstance();
747
- this.staticAreaItem.setOwnerElement(this);
748
- }
749
- if (!this.staticAreaItem.parentElement) {
750
- getSingletonElementInstance("ui5-static-area").appendChild(this.staticAreaItem);
751
- }
752
- return this.staticAreaItem.getDomRef();
901
+ static _needsShadowDOM() {
902
+ return !!this.template || Object.prototype.hasOwnProperty.call(this.prototype, "render");
753
903
  }
754
904
  /**
755
905
  * @private
@@ -763,66 +913,56 @@ class UI5Element extends HTMLElement {
763
913
  if (!isValidPropertyName(prop)) {
764
914
  console.warn(`"${prop}" is not a valid property name. Use a name that does not collide with DOM APIs`); /* eslint-disable-line */
765
915
  }
766
- if (propData.type === Boolean && propData.defaultValue) {
767
- throw new Error(`Cannot set a default value for property "${prop}". All booleans are false by default.`);
768
- }
769
- if (propData.type === Array) {
770
- throw new Error(`Wrong type for property "${prop}". Properties cannot be of type Array - use "multiple: true" and set "type" to the single value type, such as "String", "Object", etc...`);
916
+ const descriptor = getPropertyDescriptor(proto, prop);
917
+ // if the decorator is on a setter, proxy the new setter to it
918
+ let origSet;
919
+ if (descriptor?.set) {
920
+ // eslint-disable-next-line @typescript-eslint/unbound-method
921
+ origSet = descriptor.set;
771
922
  }
772
- if (propData.type === Object && propData.defaultValue) {
773
- throw new Error(`Cannot set a default value for property "${prop}". All properties of type "Object" are empty objects by default.`);
774
- }
775
- if (propData.multiple && propData.defaultValue) {
776
- throw new Error(`Cannot set a default value for property "${prop}". All multiple properties are empty arrays by default.`);
923
+ // if the decorator is on a setter, there will be a corresponding getter - proxy the new getter to it
924
+ let origGet;
925
+ if (descriptor?.get) {
926
+ // eslint-disable-next-line @typescript-eslint/unbound-method
927
+ origGet = descriptor.get;
777
928
  }
778
929
  Object.defineProperty(proto, prop, {
779
930
  get() {
780
- if (this._state[prop] !== undefined) {
781
- return this._state[prop];
782
- }
783
- const propDefaultValue = propData.defaultValue;
784
- if (propData.type === Boolean) {
785
- return false;
786
- }
787
- else if (propData.type === String) { // eslint-disable-line
788
- return propDefaultValue;
789
- }
790
- else if (propData.multiple) { // eslint-disable-line
791
- return [];
792
- }
793
- else {
794
- return propDefaultValue;
931
+ // proxy the getter to the original accessor if there was one
932
+ if (origGet) {
933
+ return origGet.call(this);
795
934
  }
935
+ return this._state[prop];
796
936
  },
797
937
  set(value) {
798
- let isDifferent;
799
938
  const ctor = this.constructor;
800
- const metadataCtor = ctor.getMetadata().constructor;
801
- value = metadataCtor.validatePropertyValue(value, propData);
802
- const propertyType = propData.type;
803
- let propertyValidator = propData.validator;
804
- const oldState = this._state[prop];
805
- if (propertyType && propertyType.isDataTypeClass) {
806
- propertyValidator = propertyType;
807
- }
808
- if (propertyValidator) {
809
- isDifferent = !propertyValidator.valuesAreEqual(oldState, value);
810
- }
811
- else if (Array.isArray(oldState) && Array.isArray(value) && propData.multiple && propData.compareValues) { // compareValues is added for IE, test if needed now
812
- isDifferent = !arraysAreEqual(oldState, value);
813
- }
814
- else {
815
- isDifferent = oldState !== value;
816
- }
939
+ const oldState = origGet ? origGet.call(this) : this._state[prop];
940
+ const isDifferent = oldState !== value;
817
941
  if (isDifferent) {
818
- this._state[prop] = value;
942
+ // if the decorator is on a setter, use it for storage
943
+ if (origSet) {
944
+ origSet.call(this, value);
945
+ }
946
+ else {
947
+ this._state[prop] = value;
948
+ }
819
949
  _invalidate.call(this, {
820
950
  type: "property",
821
951
  name: prop,
822
952
  newValue: value,
823
953
  oldValue: oldState,
824
954
  });
825
- this._updateAttribute(prop, value);
955
+ if (this._rendered) {
956
+ // the component is already rendered, indicating it is not the constructor -
957
+ // therefore the attribute can be set synchronously.
958
+ // get the effective value of the property,
959
+ // as it might differ from the provided value
960
+ const newValue = origGet ? origGet.call(this) : this._state[prop];
961
+ this._updateAttribute(prop, newValue);
962
+ }
963
+ if (ctor.getMetadata().isFormAssociated()) {
964
+ setFormValue(this);
965
+ }
826
966
  }
827
967
  },
828
968
  });
@@ -835,7 +975,7 @@ class UI5Element extends HTMLElement {
835
975
  console.warn(`"${slotName}" is not a valid property name. Use a name that does not collide with DOM APIs`); /* eslint-disable-line */
836
976
  }
837
977
  const propertyName = slotData.propertyName || slotName;
838
- Object.defineProperty(proto, propertyName, {
978
+ const propertyDescriptor = {
839
979
  get() {
840
980
  if (this._state[propertyName] !== undefined) {
841
981
  return this._state[propertyName];
@@ -845,34 +985,29 @@ class UI5Element extends HTMLElement {
845
985
  set() {
846
986
  throw new Error("Cannot set slot content directly, use the DOM APIs (appendChild, removeChild, etc...)");
847
987
  },
848
- });
988
+ };
989
+ Object.defineProperty(proto, propertyName, propertyDescriptor);
990
+ if (propertyName !== kebabToCamelCase(propertyName)) {
991
+ Object.defineProperty(proto, kebabToCamelCase(propertyName), propertyDescriptor);
992
+ }
849
993
  }
850
994
  }
851
995
  }
852
- /**
853
- * Returns the CSS for this UI5 Web Component Class
854
- * @protected
855
- */
856
- static get styles() {
857
- return "";
858
- }
859
- /**
860
- * Returns the Static Area CSS for this UI5 Web Component Class
861
- * @protected
862
- */
863
- static get staticAreaStyles() {
864
- return "";
865
- }
866
996
  /**
867
997
  * Returns an array with the dependencies for this UI5 Web Component, which could be:
868
- * - composed components (used in its shadow root or static area item)
998
+ * - composed components (used in its shadow root)
869
999
  * - slotted components that the component may need to communicate with
870
1000
  *
1001
+ * @deprecated no longer necessary for jsxRenderer-enabled components
871
1002
  * @protected
872
1003
  */
873
1004
  static get dependencies() {
874
1005
  return [];
875
1006
  }
1007
+ static cacheUniqueDependencies() {
1008
+ const filtered = this.dependencies.filter((dep, index, deps) => deps.indexOf(dep) === index);
1009
+ uniqueDependenciesCache.set(this, filtered);
1010
+ }
876
1011
  /**
877
1012
  * Returns a list of the unique dependencies for this UI5 Web Component
878
1013
  *
@@ -880,39 +1015,54 @@ class UI5Element extends HTMLElement {
880
1015
  */
881
1016
  static getUniqueDependencies() {
882
1017
  if (!uniqueDependenciesCache.has(this)) {
883
- const filtered = this.dependencies.filter((dep, index, deps) => deps.indexOf(dep) === index);
884
- uniqueDependenciesCache.set(this, filtered);
1018
+ this.cacheUniqueDependencies();
885
1019
  }
886
1020
  return uniqueDependenciesCache.get(this) || [];
887
1021
  }
888
- /**
889
- * Returns a promise that resolves whenever all dependencies for this UI5 Web Component have resolved
890
- *
891
- * @returns {Promise}
892
- */
893
- static whenDependenciesDefined() {
894
- return Promise.all(this.getUniqueDependencies().map(dep => dep.define()));
895
- }
896
1022
  /**
897
1023
  * Hook that will be called upon custom element definition
898
1024
  *
899
1025
  * @protected
900
- * @returns {Promise<void>}
1026
+ * @deprecated use the "i18n" decorator for fetching message bundles and the "cldr" option in the "customElements" decorator for fetching CLDR
901
1027
  */
902
1028
  static async onDefine() {
903
1029
  return Promise.resolve();
904
1030
  }
1031
+ static fetchI18nBundles() {
1032
+ return Promise.all(Object.entries(this.getMetadata().getI18n()).map(pair => {
1033
+ const { bundleName } = pair[1];
1034
+ return getI18nBundle(bundleName);
1035
+ }));
1036
+ }
1037
+ static fetchCLDR() {
1038
+ if (this.getMetadata().needsCLDR()) {
1039
+ return fetchCldr(getLocale().getLanguage(), getLocale().getRegion(), getLocale().getScript());
1040
+ }
1041
+ return Promise.resolve();
1042
+ }
1043
+ static get i18nBundles() {
1044
+ return this.i18nBundleStorage;
1045
+ }
905
1046
  /**
906
1047
  * Registers a UI5 Web Component in the browser window object
907
1048
  * @public
908
- * @returns {Promise<UI5Element>}
909
- */
910
- static async define() {
911
- await boot();
912
- await Promise.all([
913
- this.whenDependenciesDefined(),
914
- this.onDefine(),
915
- ]);
1049
+ */
1050
+ static define() {
1051
+ const defineSequence = async () => {
1052
+ await boot(); // boot must finish first, because it initializes configuration
1053
+ const result = await Promise.all([
1054
+ this.fetchI18nBundles(), // uses configuration
1055
+ this.fetchCLDR(),
1056
+ this.onDefine(),
1057
+ ]);
1058
+ const [i18nBundles] = result;
1059
+ Object.entries(this.getMetadata().getI18n()).forEach((pair, index) => {
1060
+ const bundleName = pair[1].bundleName;
1061
+ this.i18nBundleStorage[bundleName] = i18nBundles[index];
1062
+ });
1063
+ this.asyncFinished = true;
1064
+ };
1065
+ this.definePromise = defineSequence();
916
1066
  const tag = this.getMetadata().getTag();
917
1067
  const definedLocally = isTagRegistered(tag);
918
1068
  const definedGlobally = customElements.get(tag);
@@ -922,8 +1072,7 @@ class UI5Element extends HTMLElement {
922
1072
  else if (!definedGlobally) {
923
1073
  this._generateAccessors();
924
1074
  registerTag(tag);
925
- window.customElements.define(tag, this);
926
- preloadLinks(this);
1075
+ customElements.define(tag, this);
927
1076
  }
928
1077
  return this;
929
1078
  }
@@ -931,7 +1080,6 @@ class UI5Element extends HTMLElement {
931
1080
  * Returns an instance of UI5ElementMetadata.js representing this UI5 Web Component's full metadata (its and its parents')
932
1081
  * Note: not to be confused with the "get metadata()" method, which returns an object for this class's metadata only
933
1082
  * @public
934
- * @returns {UI5ElementMetadata}
935
1083
  */
936
1084
  static getMetadata() {
937
1085
  if (this.hasOwnProperty("_metadata")) { // eslint-disable-line
@@ -947,19 +1095,28 @@ class UI5Element extends HTMLElement {
947
1095
  this._metadata = new UI5ElementMetadata(mergedMetadata);
948
1096
  return this._metadata;
949
1097
  }
1098
+ get validity() { return this._internals.validity; }
1099
+ get validationMessage() { return this._internals.validationMessage; }
1100
+ checkValidity() { return this._internals.checkValidity(); }
1101
+ reportValidity() { return this._internals.reportValidity(); }
950
1102
  }
951
1103
  /**
952
1104
  * Returns the metadata object for this UI5 Web Component Class
953
1105
  * @protected
954
1106
  */
955
1107
  UI5Element.metadata = {};
1108
+ /**
1109
+ * Returns the CSS for this UI5 Web Component Class
1110
+ * @protected
1111
+ */
1112
+ UI5Element.styles = "";
1113
+ UI5Element.i18nBundleStorage = {};
956
1114
  /**
957
1115
  * Always use duck-typing to cover all runtimes on the page.
958
- * @returns {boolean}
959
1116
  */
960
1117
  const instanceOfUI5Element = (object) => {
961
1118
  return "isUI5Element" in object;
962
1119
  };
963
1120
  export default UI5Element;
964
- export { instanceOfUI5Element };
1121
+ export { instanceOfUI5Element, };
965
1122
  //# sourceMappingURL=UI5Element.js.map