igniteui-webcomponents 7.3.2 → 7.4.1

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 (478) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/animations/easings.d.ts +21 -31
  3. package/animations/easings.js +21 -34
  4. package/animations/easings.js.map +1 -1
  5. package/animations/player.d.ts +8 -16
  6. package/animations/player.js +5 -8
  7. package/animations/player.js.map +1 -1
  8. package/animations/view-transition.d.ts +10 -10
  9. package/animations/view-transition.js +26 -37
  10. package/animations/view-transition.js.map +1 -1
  11. package/components/breadcrumb/breadcrumb.d.ts +74 -0
  12. package/components/breadcrumb/breadcrumb.js +107 -0
  13. package/components/breadcrumb/breadcrumb.js.map +1 -0
  14. package/components/breadcrumb/breadcrumbs.d.ts +60 -0
  15. package/components/breadcrumb/breadcrumbs.js +50 -0
  16. package/components/breadcrumb/breadcrumbs.js.map +1 -0
  17. package/components/breadcrumb/themes/breadcrumb.base.css.js +3 -0
  18. package/components/breadcrumb/themes/breadcrumb.base.css.js.map +1 -0
  19. package/components/breadcrumb/themes/breadcrumbs.base.css.d.ts +1 -0
  20. package/components/{resize-container/themes/resize-container.base.css.js → breadcrumb/themes/breadcrumbs.base.css.js} +2 -2
  21. package/components/breadcrumb/themes/breadcrumbs.base.css.js.map +1 -0
  22. package/components/breadcrumb/themes/dark/breadcrumb.bootstrap.css.d.ts +1 -0
  23. package/components/breadcrumb/themes/dark/breadcrumb.bootstrap.css.js +3 -0
  24. package/components/breadcrumb/themes/dark/breadcrumb.bootstrap.css.js.map +1 -0
  25. package/components/breadcrumb/themes/dark/breadcrumb.fluent.css.d.ts +1 -0
  26. package/components/breadcrumb/themes/dark/breadcrumb.fluent.css.js +3 -0
  27. package/components/breadcrumb/themes/dark/breadcrumb.fluent.css.js.map +1 -0
  28. package/components/breadcrumb/themes/dark/breadcrumb.indigo.css.d.ts +1 -0
  29. package/components/breadcrumb/themes/dark/breadcrumb.indigo.css.js +3 -0
  30. package/components/breadcrumb/themes/dark/breadcrumb.indigo.css.js.map +1 -0
  31. package/components/breadcrumb/themes/dark/breadcrumb.material.css.d.ts +1 -0
  32. package/components/breadcrumb/themes/dark/breadcrumb.material.css.js +3 -0
  33. package/components/breadcrumb/themes/dark/breadcrumb.material.css.js.map +1 -0
  34. package/components/breadcrumb/themes/light/breadcrumb.bootstrap.css.d.ts +1 -0
  35. package/components/breadcrumb/themes/light/breadcrumb.bootstrap.css.js +3 -0
  36. package/components/breadcrumb/themes/light/breadcrumb.bootstrap.css.js.map +1 -0
  37. package/components/breadcrumb/themes/light/breadcrumb.fluent.css.d.ts +1 -0
  38. package/components/breadcrumb/themes/light/breadcrumb.fluent.css.js +3 -0
  39. package/components/breadcrumb/themes/light/breadcrumb.fluent.css.js.map +1 -0
  40. package/components/breadcrumb/themes/light/breadcrumb.indigo.css.d.ts +1 -0
  41. package/components/breadcrumb/themes/light/breadcrumb.indigo.css.js +3 -0
  42. package/components/breadcrumb/themes/light/breadcrumb.indigo.css.js.map +1 -0
  43. package/components/breadcrumb/themes/light/breadcrumb.material.css.d.ts +1 -0
  44. package/components/breadcrumb/themes/light/breadcrumb.material.css.js +3 -0
  45. package/components/breadcrumb/themes/light/breadcrumb.material.css.js.map +1 -0
  46. package/components/breadcrumb/themes/light/breadcrumb.shared.css.d.ts +1 -0
  47. package/components/breadcrumb/themes/light/breadcrumb.shared.css.js +3 -0
  48. package/components/breadcrumb/themes/light/breadcrumb.shared.css.js.map +1 -0
  49. package/components/breadcrumb/themes/shared/breadcrumb.bootstrap.css.d.ts +1 -0
  50. package/components/breadcrumb/themes/shared/breadcrumb.bootstrap.css.js +3 -0
  51. package/components/breadcrumb/themes/shared/breadcrumb.bootstrap.css.js.map +1 -0
  52. package/components/breadcrumb/themes/shared/breadcrumb.common.css.d.ts +1 -0
  53. package/components/breadcrumb/themes/shared/breadcrumb.common.css.js +3 -0
  54. package/components/breadcrumb/themes/shared/breadcrumb.common.css.js.map +1 -0
  55. package/components/breadcrumb/themes/shared/breadcrumb.fluent.css.d.ts +1 -0
  56. package/components/breadcrumb/themes/shared/breadcrumb.fluent.css.js +3 -0
  57. package/components/breadcrumb/themes/shared/breadcrumb.fluent.css.js.map +1 -0
  58. package/components/breadcrumb/themes/shared/breadcrumb.indigo.css.d.ts +1 -0
  59. package/components/breadcrumb/themes/shared/breadcrumb.indigo.css.js +3 -0
  60. package/components/breadcrumb/themes/shared/breadcrumb.indigo.css.js.map +1 -0
  61. package/components/breadcrumb/themes/shared/breadcrumb.material.css.d.ts +1 -0
  62. package/components/breadcrumb/themes/shared/breadcrumb.material.css.js +3 -0
  63. package/components/breadcrumb/themes/shared/breadcrumb.material.css.js.map +1 -0
  64. package/components/breadcrumb/themes/themes.d.ts +2 -0
  65. package/components/breadcrumb/themes/themes.js +50 -0
  66. package/components/breadcrumb/themes/themes.js.map +1 -0
  67. package/components/button/button.d.ts +0 -2
  68. package/components/button/button.js.map +1 -1
  69. package/components/button-group/button-group.d.ts +42 -12
  70. package/components/button-group/button-group.js +82 -34
  71. package/components/button-group/button-group.js.map +1 -1
  72. package/components/button-group/toggle-button.d.ts +6 -1
  73. package/components/button-group/toggle-button.js +28 -2
  74. package/components/button-group/toggle-button.js.map +1 -1
  75. package/components/calendar/base.js +2 -1
  76. package/components/calendar/base.js.map +1 -1
  77. package/components/calendar/calendar.d.ts +2 -3
  78. package/components/calendar/calendar.js.map +1 -1
  79. package/components/calendar/days-view/days-view.d.ts +2 -2
  80. package/components/calendar/days-view/days-view.js.map +1 -1
  81. package/components/carousel/carousel-indicator.js +1 -0
  82. package/components/carousel/carousel-indicator.js.map +1 -1
  83. package/components/carousel/carousel-slide.d.ts +1 -1
  84. package/components/carousel/carousel-slide.js.map +1 -1
  85. package/components/carousel/carousel.d.ts +3 -3
  86. package/components/carousel/carousel.js.map +1 -1
  87. package/components/chat/chat-input.d.ts +1 -2
  88. package/components/chat/chat-input.js +1 -1
  89. package/components/chat/chat-input.js.map +1 -1
  90. package/components/chat/chat-state.d.ts +8 -9
  91. package/components/chat/chat-state.js.map +1 -1
  92. package/components/chat/chat.d.ts +1 -3
  93. package/components/chat/chat.js +2 -2
  94. package/components/chat/chat.js.map +1 -1
  95. package/components/chat/message-attachments.d.ts +6 -15
  96. package/components/chat/message-attachments.js.map +1 -1
  97. package/components/chat/utils.d.ts +0 -1
  98. package/components/chat/utils.js +1 -1
  99. package/components/chat/utils.js.map +1 -1
  100. package/components/checkbox/checkbox-base.d.ts +3 -1
  101. package/components/checkbox/checkbox-base.js +4 -0
  102. package/components/checkbox/checkbox-base.js.map +1 -1
  103. package/components/checkbox/checkbox.js +4 -12
  104. package/components/checkbox/checkbox.js.map +1 -1
  105. package/components/checkbox/switch.js +1 -8
  106. package/components/checkbox/switch.js.map +1 -1
  107. package/components/chip/chip.d.ts +2 -2
  108. package/components/chip/chip.js.map +1 -1
  109. package/components/color-picker/color-picker.d.ts +35 -34
  110. package/components/color-picker/color-picker.js +12 -7
  111. package/components/color-picker/color-picker.js.map +1 -1
  112. package/components/color-picker/common.d.ts +0 -2
  113. package/components/color-picker/common.js +2 -2
  114. package/components/color-picker/common.js.map +1 -1
  115. package/components/color-picker/converters.js.map +1 -1
  116. package/components/color-picker/picker-canvas.js.map +1 -1
  117. package/components/combo/combo.d.ts +24 -24
  118. package/components/combo/combo.js +21 -26
  119. package/components/combo/combo.js.map +1 -1
  120. package/components/combo/controllers/data.d.ts +7 -10
  121. package/components/combo/controllers/data.js.map +1 -1
  122. package/components/date-picker/date-picker.base.d.ts +22 -27
  123. package/components/date-picker/date-picker.base.js +9 -3
  124. package/components/date-picker/date-picker.base.js.map +1 -1
  125. package/components/date-picker/date-picker.d.ts +1 -1
  126. package/components/date-picker/date-picker.js +5 -3
  127. package/components/date-picker/date-picker.js.map +1 -1
  128. package/components/date-range-picker/date-range-input.d.ts +0 -2
  129. package/components/date-range-picker/date-range-input.js +0 -6
  130. package/components/date-range-picker/date-range-input.js.map +1 -1
  131. package/components/date-range-picker/date-range-picker.d.ts +22 -31
  132. package/components/date-range-picker/date-range-picker.js +7 -7
  133. package/components/date-range-picker/date-range-picker.js.map +1 -1
  134. package/components/date-range-picker/i18n.d.ts +21 -0
  135. package/components/date-range-picker/i18n.js +10 -0
  136. package/components/date-range-picker/i18n.js.map +1 -0
  137. package/components/date-range-picker/predefined-ranges-area.d.ts +3 -3
  138. package/components/date-range-picker/predefined-ranges-area.js +2 -5
  139. package/components/date-range-picker/predefined-ranges-area.js.map +1 -1
  140. package/components/date-range-picker/validators.d.ts +0 -4
  141. package/components/date-range-picker/validators.js +4 -4
  142. package/components/date-range-picker/validators.js.map +1 -1
  143. package/components/date-time-input/date-time-input.base.d.ts +42 -40
  144. package/components/date-time-input/date-time-input.base.js +9 -5
  145. package/components/date-time-input/date-time-input.base.js.map +1 -1
  146. package/components/date-time-input/date-time-input.d.ts +1 -11
  147. package/components/date-time-input/date-time-input.js +0 -6
  148. package/components/date-time-input/date-time-input.js.map +1 -1
  149. package/components/date-time-input/datetime-mask-parser.d.ts +0 -10
  150. package/components/date-time-input/datetime-mask-parser.js +1 -1
  151. package/components/date-time-input/datetime-mask-parser.js.map +1 -1
  152. package/components/dialog/dialog.js.map +1 -1
  153. package/components/dropdown/dropdown-group.d.ts +2 -10
  154. package/components/dropdown/dropdown-group.js +2 -27
  155. package/components/dropdown/dropdown-group.js.map +1 -1
  156. package/components/dropdown/dropdown.d.ts +17 -23
  157. package/components/dropdown/dropdown.js +5 -17
  158. package/components/dropdown/dropdown.js.map +1 -1
  159. package/components/file-input/file-input.d.ts +7 -2
  160. package/components/file-input/file-input.js +4 -0
  161. package/components/file-input/file-input.js.map +1 -1
  162. package/components/icon/icon.d.ts +1 -1
  163. package/components/icon/icon.registry.d.ts +6 -6
  164. package/components/icon/icon.registry.js.map +1 -1
  165. package/components/input/input-base.d.ts +2 -2
  166. package/components/input/input-base.js +3 -5
  167. package/components/input/input-base.js.map +1 -1
  168. package/components/input/input.d.ts +3 -3
  169. package/components/input/input.js.map +1 -1
  170. package/components/mask-input/mask-history.d.ts +22 -18
  171. package/components/mask-input/mask-history.js.map +1 -1
  172. package/components/mask-input/mask-input.d.ts +1 -1
  173. package/components/mask-input/mask-parser.d.ts +11 -13
  174. package/components/mask-input/mask-parser.js.map +1 -1
  175. package/components/popover/popover.d.ts +45 -34
  176. package/components/popover/popover.js +54 -122
  177. package/components/popover/popover.js.map +1 -1
  178. package/components/popover/position/arrow.d.ts +19 -0
  179. package/components/popover/position/arrow.js +33 -0
  180. package/components/popover/position/arrow.js.map +1 -0
  181. package/components/popover/position/floating.d.ts +40 -0
  182. package/components/popover/position/floating.js +146 -0
  183. package/components/popover/position/floating.js.map +1 -0
  184. package/components/popover/position/native.d.ts +45 -0
  185. package/components/popover/position/native.js +158 -0
  186. package/components/popover/position/native.js.map +1 -0
  187. package/components/popover/position/strategy.d.ts +37 -0
  188. package/components/popover/position/strategy.js +21 -0
  189. package/components/popover/position/strategy.js.map +1 -0
  190. package/components/popover/position/types.d.ts +26 -0
  191. package/components/popover/position/types.js +15 -0
  192. package/components/popover/position/types.js.map +1 -0
  193. package/components/popover/themes/light/popover.base.css.js +1 -1
  194. package/components/popover/themes/light/popover.base.css.js.map +1 -1
  195. package/components/progress/circular-progress.d.ts +0 -5
  196. package/components/progress/circular-progress.js.map +1 -1
  197. package/components/qr-code/qr-code.d.ts +1 -1
  198. package/components/radio/radio.d.ts +6 -4
  199. package/components/radio/radio.js +24 -25
  200. package/components/radio/radio.js.map +1 -1
  201. package/components/radio-group/radio-group.js.map +1 -1
  202. package/components/rating/rating.d.ts +9 -6
  203. package/components/rating/rating.js +17 -18
  204. package/components/rating/rating.js.map +1 -1
  205. package/components/select/select-group.d.ts +5 -10
  206. package/components/select/select-group.js +10 -34
  207. package/components/select/select-group.js.map +1 -1
  208. package/components/select/select.d.ts +12 -20
  209. package/components/select/select.js +5 -15
  210. package/components/select/select.js.map +1 -1
  211. package/components/slider/range-slider.d.ts +0 -1
  212. package/components/slider/range-slider.js +6 -11
  213. package/components/slider/range-slider.js.map +1 -1
  214. package/components/slider/slider-base.d.ts +4 -1
  215. package/components/slider/slider-base.js +20 -18
  216. package/components/slider/slider-base.js.map +1 -1
  217. package/components/slider/slider.d.ts +2 -0
  218. package/components/slider/slider.js +5 -1
  219. package/components/slider/slider.js.map +1 -1
  220. package/components/splitter/splitter.d.ts +6 -6
  221. package/components/splitter/splitter.js.map +1 -1
  222. package/components/textarea/textarea.d.ts +2 -5
  223. package/components/textarea/textarea.js +3 -5
  224. package/components/textarea/textarea.js.map +1 -1
  225. package/components/tile-manager/tile-manager.d.ts +6 -7
  226. package/components/tile-manager/tile-manager.js.map +1 -1
  227. package/components/tile-manager/tile.d.ts +3 -3
  228. package/components/tile-manager/tile.js.map +1 -1
  229. package/components/toast/toast.d.ts +0 -2
  230. package/components/toast/toast.js.map +1 -1
  231. package/components/tooltip/controller.js.map +1 -1
  232. package/components/tooltip/service.js +4 -5
  233. package/components/tooltip/service.js.map +1 -1
  234. package/components/tooltip/tooltip.d.ts +34 -13
  235. package/components/tooltip/tooltip.js +8 -4
  236. package/components/tooltip/tooltip.js.map +1 -1
  237. package/components/tree/tree-item.d.ts +6 -6
  238. package/components/tree/tree-item.js.map +1 -1
  239. package/components/tree/tree.navigation.d.ts +5 -6
  240. package/components/tree/tree.navigation.js.map +1 -1
  241. package/components/tree/tree.selection.js.map +1 -1
  242. package/components/types.d.ts +1 -1
  243. package/components/types.js.map +1 -1
  244. package/components/validation-container/validation-container.js +2 -1
  245. package/components/validation-container/validation-container.js.map +1 -1
  246. package/components/virtualization/engine.d.ts +40 -9
  247. package/components/virtualization/engine.js +126 -61
  248. package/components/virtualization/engine.js.map +1 -1
  249. package/components/virtualization/recycle.d.ts +13 -0
  250. package/components/virtualization/recycle.js +152 -0
  251. package/components/virtualization/recycle.js.map +1 -0
  252. package/components/virtualization/virtualization.d.ts +84 -65
  253. package/components/virtualization/virtualization.js +20 -16
  254. package/components/virtualization/virtualization.js.map +1 -1
  255. package/custom-elements.json +18455 -19551
  256. package/igniteui-webcomponents.css-data.json +2 -2
  257. package/igniteui-webcomponents.html-data.json +1 -1
  258. package/index.d.ts +3 -1
  259. package/index.js +2 -0
  260. package/index.js.map +1 -1
  261. package/internals/abort-handler.d.ts +13 -25
  262. package/internals/abort-handler.js +4 -6
  263. package/internals/abort-handler.js.map +1 -1
  264. package/internals/context.d.ts +13 -7
  265. package/internals/context.js +2 -1
  266. package/internals/context.js.map +1 -1
  267. package/internals/controllers/adopt-styles.d.ts +19 -20
  268. package/internals/controllers/adopt-styles.js +3 -8
  269. package/internals/controllers/adopt-styles.js.map +1 -1
  270. package/internals/controllers/aria-projection.d.ts +100 -61
  271. package/internals/controllers/aria-projection.js +81 -31
  272. package/internals/controllers/aria-projection.js.map +1 -1
  273. package/internals/controllers/async-consumer.js.map +1 -1
  274. package/internals/controllers/command.d.ts +15 -30
  275. package/internals/controllers/command.js +2 -7
  276. package/internals/controllers/command.js.map +1 -1
  277. package/internals/controllers/context-provider.d.ts +7 -13
  278. package/internals/controllers/context-provider.js.map +1 -1
  279. package/internals/controllers/focus-ring.d.ts +10 -30
  280. package/internals/controllers/focus-ring.js +6 -12
  281. package/internals/controllers/focus-ring.js.map +1 -1
  282. package/internals/controllers/fullscreen.d.ts +7 -23
  283. package/internals/controllers/fullscreen.js +3 -9
  284. package/internals/controllers/fullscreen.js.map +1 -1
  285. package/internals/controllers/gestures.d.ts +10 -29
  286. package/internals/controllers/gestures.js +1 -3
  287. package/internals/controllers/gestures.js.map +1 -1
  288. package/internals/controllers/group.d.ts +13 -30
  289. package/internals/controllers/group.js.map +1 -1
  290. package/internals/controllers/host-listeners.d.ts +28 -0
  291. package/internals/controllers/host-listeners.js +27 -0
  292. package/internals/controllers/host-listeners.js.map +1 -0
  293. package/internals/controllers/id-resolver.d.ts +8 -9
  294. package/internals/controllers/id-resolver.js +6 -14
  295. package/internals/controllers/id-resolver.js.map +1 -1
  296. package/internals/controllers/internals.d.ts +53 -104
  297. package/internals/controllers/internals.js +40 -13
  298. package/internals/controllers/internals.js.map +1 -1
  299. package/internals/controllers/key-bindings.d.ts +61 -158
  300. package/internals/controllers/key-bindings.js +68 -67
  301. package/internals/controllers/key-bindings.js.map +1 -1
  302. package/internals/controllers/keys.d.ts +32 -0
  303. package/internals/controllers/keys.js +20 -0
  304. package/internals/controllers/keys.js.map +1 -0
  305. package/internals/controllers/mutation-observer.d.ts +14 -37
  306. package/internals/controllers/mutation-observer.js +1 -1
  307. package/internals/controllers/mutation-observer.js.map +1 -1
  308. package/internals/controllers/resize-observer.d.ts +9 -19
  309. package/internals/controllers/resize-observer.js.map +1 -1
  310. package/internals/controllers/root-click.d.ts +11 -42
  311. package/internals/controllers/root-click.js +4 -6
  312. package/internals/controllers/root-click.js.map +1 -1
  313. package/internals/controllers/roving-focus.d.ts +16 -35
  314. package/internals/controllers/roving-focus.js.map +1 -1
  315. package/internals/controllers/slot.d.ts +25 -54
  316. package/internals/controllers/slot.js +6 -6
  317. package/internals/controllers/slot.js.map +1 -1
  318. package/internals/controllers/toggle.d.ts +44 -48
  319. package/internals/controllers/toggle.js.map +1 -1
  320. package/internals/date/compare.js.map +1 -1
  321. package/internals/date/converters.d.ts +10 -7
  322. package/internals/date/converters.js.map +1 -1
  323. package/internals/date/model.d.ts +9 -16
  324. package/internals/date/model.js +22 -25
  325. package/internals/date/model.js.map +1 -1
  326. package/internals/decorators/blazorAdditionalDependencies.d.ts +4 -2
  327. package/internals/decorators/blazorAdditionalDependencies.js.map +1 -1
  328. package/internals/decorators/blazorDeepImport.d.ts +1 -3
  329. package/internals/decorators/blazorDeepImport.js.map +1 -1
  330. package/internals/decorators/blazorInclude.d.ts +3 -2
  331. package/internals/decorators/blazorInclude.js.map +1 -1
  332. package/internals/decorators/blazorIndirectRender.d.ts +1 -3
  333. package/internals/decorators/blazorIndirectRender.js.map +1 -1
  334. package/internals/decorators/blazorSuppressComponent.d.ts +1 -3
  335. package/internals/decorators/blazorSuppressComponent.js.map +1 -1
  336. package/internals/decorators/coerced-property.d.ts +14 -20
  337. package/internals/decorators/coerced-property.js.map +1 -1
  338. package/internals/decorators/shadow-options.d.ts +2 -5
  339. package/internals/decorators/shadow-options.js.map +1 -1
  340. package/internals/definitions/defineAllComponents.js +2 -0
  341. package/internals/definitions/defineAllComponents.js.map +1 -1
  342. package/internals/directives/drag.d.ts +51 -81
  343. package/internals/directives/drag.js +27 -89
  344. package/internals/directives/drag.js.map +1 -1
  345. package/internals/directives/pointer-operation.d.ts +75 -0
  346. package/internals/directives/pointer-operation.js +92 -0
  347. package/internals/directives/pointer-operation.js.map +1 -0
  348. package/internals/directives/resize.d.ts +36 -64
  349. package/internals/directives/resize.js +18 -85
  350. package/internals/directives/resize.js.map +1 -1
  351. package/internals/i18n/EN/calendar.resources.d.ts +8 -2
  352. package/internals/i18n/EN/calendar.resources.js +2 -2
  353. package/internals/i18n/EN/calendar.resources.js.map +1 -1
  354. package/internals/i18n/EN/chat.resources.d.ts +8 -2
  355. package/internals/i18n/EN/chat.resources.js +3 -10
  356. package/internals/i18n/EN/chat.resources.js.map +1 -1
  357. package/internals/i18n/EN/date-picker.resources.d.ts +6 -4
  358. package/internals/i18n/EN/date-picker.resources.js +1 -7
  359. package/internals/i18n/EN/date-picker.resources.js.map +1 -1
  360. package/internals/i18n/EN/date-range-picker.resources.d.ts +9 -2
  361. package/internals/i18n/EN/date-range-picker.resources.js +2 -2
  362. package/internals/i18n/EN/date-range-picker.resources.js.map +1 -1
  363. package/internals/i18n/i18n-controller.d.ts +44 -46
  364. package/internals/i18n/i18n-controller.js +46 -33
  365. package/internals/i18n/i18n-controller.js.map +1 -1
  366. package/internals/i18n/utils.d.ts +9 -4
  367. package/internals/i18n/utils.js +4 -27
  368. package/internals/i18n/utils.js.map +1 -1
  369. package/internals/mixins/alert.d.ts +10 -25
  370. package/internals/mixins/alert.js.map +1 -1
  371. package/internals/mixins/combo-box.d.ts +21 -11
  372. package/internals/mixins/combo-box.js +16 -22
  373. package/internals/mixins/combo-box.js.map +1 -1
  374. package/internals/mixins/event-emitter.js +9 -11
  375. package/internals/mixins/event-emitter.js.map +1 -1
  376. package/internals/mixins/forms/associated-required.d.ts +4 -4
  377. package/internals/mixins/forms/associated-required.js.map +1 -1
  378. package/internals/mixins/forms/associated.d.ts +4 -2
  379. package/internals/mixins/forms/associated.js +42 -19
  380. package/internals/mixins/forms/associated.js.map +1 -1
  381. package/internals/mixins/forms/form-transformers.js.map +1 -1
  382. package/internals/mixins/forms/types.d.ts +27 -78
  383. package/internals/mixins/forms/types.js.map +1 -1
  384. package/internals/mixins/group.d.ts +18 -0
  385. package/internals/mixins/group.js +37 -0
  386. package/internals/mixins/group.js.map +1 -0
  387. package/internals/mixins/i18n.d.ts +10 -16
  388. package/internals/mixins/i18n.js.map +1 -1
  389. package/internals/mixins/mask-behavior.d.ts +8 -22
  390. package/internals/mixins/mask-behavior.js +1 -2
  391. package/internals/mixins/mask-behavior.js.map +1 -1
  392. package/internals/mixins/option.d.ts +1 -2
  393. package/internals/mixins/option.js +2 -1
  394. package/internals/mixins/option.js.map +1 -1
  395. package/internals/part-map.d.ts +4 -2
  396. package/internals/part-map.js +1 -1
  397. package/internals/part-map.js.map +1 -1
  398. package/internals/templates/input-shell.d.ts +8 -17
  399. package/internals/templates/input-shell.js +4 -1
  400. package/internals/templates/input-shell.js.map +1 -1
  401. package/internals/templates/masked-input.d.ts +7 -8
  402. package/internals/templates/masked-input.js.map +1 -1
  403. package/internals/templates/slotted-icon.d.ts +7 -12
  404. package/internals/templates/slotted-icon.js.map +1 -1
  405. package/internals/templates/toggle-shell.d.ts +19 -19
  406. package/internals/templates/toggle-shell.js +12 -8
  407. package/internals/templates/toggle-shell.js.map +1 -1
  408. package/internals/timing.d.ts +5 -14
  409. package/internals/timing.js.map +1 -1
  410. package/internals/utils/arrays.d.ts +21 -21
  411. package/internals/utils/arrays.js +14 -0
  412. package/internals/utils/arrays.js.map +1 -1
  413. package/internals/utils/dom.d.ts +53 -41
  414. package/internals/utils/dom.js +3 -4
  415. package/internals/utils/dom.js.map +1 -1
  416. package/internals/utils/events.d.ts +29 -16
  417. package/internals/utils/events.js +9 -1
  418. package/internals/utils/events.js.map +1 -1
  419. package/internals/utils/lit.d.ts +5 -2
  420. package/internals/utils/lit.js.map +1 -1
  421. package/internals/utils/math.d.ts +8 -6
  422. package/internals/utils/math.js.map +1 -1
  423. package/internals/utils/objects.d.ts +3 -20
  424. package/internals/utils/objects.js +1 -39
  425. package/internals/utils/objects.js.map +1 -1
  426. package/internals/utils/strings.d.ts +9 -11
  427. package/internals/utils/strings.js.map +1 -1
  428. package/internals/utils/types.d.ts +16 -3
  429. package/internals/utils/types.js +3 -0
  430. package/internals/utils/types.js.map +1 -1
  431. package/internals/validators.d.ts +9 -8
  432. package/internals/validators.js +12 -6
  433. package/internals/validators.js.map +1 -1
  434. package/package.json +1 -1
  435. package/skills/README.md +4 -3
  436. package/skills/igniteui-wc-choose-components/SKILL.md +2 -1
  437. package/skills/igniteui-wc-customize-component-theme/SKILL.md +2 -1
  438. package/skills/igniteui-wc-figma-to-app/SKILL.md +328 -0
  439. package/skills/igniteui-wc-figma-to-app/references/asset-extraction.md +343 -0
  440. package/skills/igniteui-wc-figma-to-app/references/design-provenance.md +199 -0
  441. package/skills/igniteui-wc-figma-to-app/references/design-token-bridge.md +489 -0
  442. package/skills/igniteui-wc-figma-to-app/references/figma-component-map.md +370 -0
  443. package/skills/igniteui-wc-figma-to-app/references/figma-exploration.md +222 -0
  444. package/skills/igniteui-wc-figma-to-app/references/mcp-setup.md +363 -0
  445. package/skills/igniteui-wc-figma-to-app/references/project-setup.md +105 -0
  446. package/skills/igniteui-wc-figma-to-app/references/theme-generation.md +180 -0
  447. package/skills/igniteui-wc-figma-to-app/references/validation-patterns.md +370 -0
  448. package/skills/igniteui-wc-generate-from-image-design/SKILL.md +2 -1
  449. package/skills/igniteui-wc-generate-from-image-design/references/gotchas.md +3 -3
  450. package/skills/igniteui-wc-grids/SKILL.md +133 -0
  451. package/skills/igniteui-wc-integrate-with-framework/SKILL.md +2 -1
  452. package/skills/igniteui-wc-migrate-grid-lite-to-premium/SKILL.md +2 -1
  453. package/skills/igniteui-wc-optimize-bundle-size/SKILL.md +2 -1
  454. package/theming/config.d.ts +14 -5
  455. package/theming/config.js +38 -18
  456. package/theming/config.js.map +1 -1
  457. package/theming/context.d.ts +1 -23
  458. package/theming/context.js.map +1 -1
  459. package/theming/theming-controller.d.ts +2 -32
  460. package/theming/theming-controller.js +15 -21
  461. package/theming/theming-controller.js.map +1 -1
  462. package/theming/theming-event.d.ts +0 -7
  463. package/theming/theming-event.js +0 -13
  464. package/theming/theming-event.js.map +1 -1
  465. package/theming/types.d.ts +1 -8
  466. package/theming/types.js.map +1 -1
  467. package/web-types.json +3 -3
  468. package/animations/presets/slide/index.d.ts +0 -3
  469. package/animations/presets/slide/index.js +0 -16
  470. package/animations/presets/slide/index.js.map +0 -1
  471. package/components/resize-container/themes/resize-container.base.css.js.map +0 -1
  472. package/internals/controllers/root-scroll.d.ts +0 -31
  473. package/internals/controllers/root-scroll.js +0 -71
  474. package/internals/controllers/root-scroll.js.map +0 -1
  475. package/theming/utils.d.ts +0 -11
  476. package/theming/utils.js +0 -20
  477. package/theming/utils.js.map +0 -1
  478. /package/components/{resize-container/themes/resize-container.base.css.d.ts → breadcrumb/themes/breadcrumb.base.css.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"tree.selection.js","sourceRoot":"","sources":["../../../src/components/tree/tree.selection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAkBrD,MAAM,OAAO,uBAAuB;IAMlC,YAAY,IAAsB;QAH1B,mBAAc,GAAY,IAAI,GAAG,EAAE,CAAC;QACpC,wBAAmB,GAAY,IAAI,GAAG,EAAE,CAAC;QAG/C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,IAAY,UAAU;QACpB,OAAO,IAAI,CAAC,KA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C,QAAQ,CAAC,CAAC;QAC/B,MAAM,MAAM,GAA2B,EAAE,CAAC;QAE1C,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACpB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,cAAc,CACpB,KAA6B,EAC7B,MAA8B;QAE9B,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;YACnC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;CAGF","sourcesContent":["import { isEmpty } from '#internals/utils/arrays.js';\nimport type IgcTreeItemComponent from './tree-item.js';\nimport type { TreeSelectionEventInit } from './tree.common.js';\nimport type IgcTreeComponent from './tree.js';\n\ntype ItemSet = Set<IgcTreeItemComponent>;\n\n/**\n * The sets being built up during a single cascade update. Passed explicitly\n * between the cascade helpers rather than kept as scratch fields on the service,\n * so no half-built state is observable outside the update that produced it.\n */\ntype CascadeState = {\n selected: ItemSet;\n indeterminate: ItemSet;\n};\n\n/* blazorSuppress */\nexport class IgcTreeSelectionService {\n private readonly _tree: IgcTreeComponent;\n\n private _itemSelection: ItemSet = new Set();\n private _indeterminateItems: ItemSet = new Set();\n\n constructor(tree: IgcTreeComponent) {\n this._tree = tree;\n }\n\n private get _isCascade(): boolean {\n return this._tree.selection === 'cascade';\n }\n\n //#region Public API\n\n /** Select range from last selected item to the current specified item. */\n public selectMultipleItems(item: IgcTreeItemComponent): void {\n if (isEmpty(this._itemSelection)) {\n this.selectItem(item);\n return;\n }\n\n const items = this._tree.items;\n const selected = this._selectedSnapshot();\n const lastSelectedIndex = items.indexOf(selected[selected.length - 1]);\n const currentIndex = items.indexOf(item);\n\n const range = items.slice(\n Math.min(currentIndex, lastSelectedIndex),\n Math.max(currentIndex, lastSelectedIndex) + 1\n );\n const added = range.filter((i) => !this.isItemSelected(i));\n\n this._emitSelectionEvent(selected.concat(added), added, []);\n }\n\n /** Select the specified item and emit event. */\n public selectItem(item: IgcTreeItemComponent): void {\n if (this._tree.selection === 'none') {\n return;\n }\n this._emitSelectionEvent([...this._itemSelection, item], [item], []);\n }\n\n /** Deselect the specified item and emit event. */\n public deselectItem(item: IgcTreeItemComponent): void {\n const newSelection = this._selectedSnapshot().filter((i) => i !== item);\n this._emitSelectionEvent(newSelection, [], [item]);\n }\n\n /** Clears item selection */\n public clearItemsSelection(): void {\n const oldSelection = this._selectedSnapshot();\n const oldIndeterminate = this._indeterminateSnapshot();\n\n this._itemSelection.clear();\n this._indeterminateItems.clear();\n\n for (const item of oldSelection) {\n item.selected = false;\n }\n for (const item of oldIndeterminate) {\n item.indeterminate = false;\n }\n }\n\n public isItemSelected(item: IgcTreeItemComponent): boolean {\n return this._itemSelection.has(item);\n }\n\n public isItemIndeterminate(item: IgcTreeItemComponent): boolean {\n return this._indeterminateItems.has(item);\n }\n\n /** Called on item`s disconnectedCallback */\n public ensureStateOnItemDelete(item: IgcTreeItemComponent): void {\n // Removing a subtree fires `disconnectedCallback` for the topmost item\n // first and then for every descendant. That first call already covers the\n // whole subtree below it, so a detached parent means an ancestor is\n // handling this removal and repeating the work here would be redundant.\n if (item.parent && !item.parent.isConnected) {\n return;\n }\n\n // Nothing to reconcile if no item is in a selected or indeterminate state.\n if (isEmpty(this._itemSelection) && isEmpty(this._indeterminateItems)) {\n return;\n }\n\n // Don't update the internal state of the deleted items because when moving they should keep it\n // However update the state of their parents\n this.deselectItemsWithNoEvent(\n [item, ...item.getChildren({ flatten: true })],\n true\n );\n }\n\n /** Retrigger the selection state of the item. */\n public retriggerItemState(item: IgcTreeItemComponent): void {\n if (item.selected) {\n this._itemSelection.delete(item);\n this.selectItemsWithNoEvent([item]);\n } else {\n this._itemSelection.add(item);\n this.deselectItemsWithNoEvent([item]);\n }\n }\n\n /** Select specified items. No event is emitted. */\n public selectItemsWithNoEvent(items: IgcTreeItemComponent[]): void {\n const oldSelection = this._selectedSnapshot();\n\n if (this._isCascade) {\n this._cascadeSelectWithNoEvent(items, oldSelection);\n return;\n }\n\n for (const item of items) {\n this._itemSelection.add(item);\n }\n\n this._updateItemsState(oldSelection);\n }\n\n /** Deselect specified items. No event is emitted. */\n public deselectItemsWithNoEvent(\n items?: IgcTreeItemComponent[],\n onDelete = false\n ): void {\n if (this._isCascade) {\n this._cascadeDeselectWithNoEvent(items, onDelete);\n return;\n }\n\n // On delete the removed items keep their own state, so they are excluded\n // from the \"before\" snapshot and never get their `selected` flag cleared.\n const oldSelection = onDelete\n ? this._excluding(this._itemSelection, items)\n : this._selectedSnapshot();\n\n if (items) {\n for (const item of items) {\n this._itemSelection.delete(item);\n }\n } else {\n this._itemSelection.clear();\n }\n\n this._updateItemsState(oldSelection);\n }\n\n //#endregion\n\n //#region Selection events\n\n private _emitSelectionEvent(\n newSelection: IgcTreeItemComponent[],\n added: IgcTreeItemComponent[],\n removed: IgcTreeItemComponent[]\n ): void {\n const currSelection = this._selectedSnapshot();\n\n if (this._sameSelection(currSelection, newSelection)) {\n return;\n }\n\n if (this._isCascade) {\n this._emitCascadeSelectionEvent(currSelection, added, removed);\n return;\n }\n\n const args: TreeSelectionEventInit = {\n detail: { newSelection },\n cancelable: true,\n };\n\n if (!this._tree.emitEvent('igcSelection', args)) {\n return;\n }\n\n // if newSelection is overwritten do not proceed (Blazor)\n if (this._sameSelection(newSelection, args.detail.newSelection)) {\n this._itemSelection = new Set(newSelection);\n this._updateItemsState(currSelection);\n }\n }\n\n private _emitCascadeSelectionEvent(\n currSelection: IgcTreeItemComponent[],\n added: IgcTreeItemComponent[],\n removed: IgcTreeItemComponent[]\n ): void {\n const oldIndeterminate = this._indeterminateSnapshot();\n const state = this._calculateCascadeState(currSelection, added, removed);\n const newSelection = Array.from(state.selected);\n\n const args: TreeSelectionEventInit = {\n detail: { newSelection },\n cancelable: true,\n };\n\n if (!this._tree.emitEvent('igcSelection', args)) {\n return;\n }\n\n // if newSelection is overwritten do not proceed (Blazor)\n if (this._sameSelection(newSelection, args.detail.newSelection)) {\n this._commit(state);\n this._updateItemsState(currSelection, oldIndeterminate);\n }\n }\n\n //#endregion\n\n //#region Cascade selection\n\n private _cascadeSelectWithNoEvent(\n items: IgcTreeItemComponent[],\n oldSelection: IgcTreeItemComponent[]\n ): void {\n const oldIndeterminate = this._indeterminateSnapshot();\n const newSelection = [...oldSelection, ...items];\n\n // retrieve only the rows without their parents/children which has to be added to the selection\n const newSelectionSet = new Set(newSelection);\n const removed = oldSelection.filter((i) => !newSelectionSet.has(i));\n const added = newSelection.filter((i) => !this._itemSelection.has(i));\n\n this._commit(this._calculateCascadeState(oldSelection, added, removed));\n this._updateItemsState(oldSelection, oldIndeterminate);\n }\n\n private _cascadeDeselectWithNoEvent(\n items?: IgcTreeItemComponent[],\n onDelete = false\n ): void {\n const oldSelection = onDelete\n ? this._excluding(this._itemSelection, items)\n : this._selectedSnapshot();\n const oldIndeterminate = onDelete\n ? this._excluding(this._indeterminateItems, items)\n : this._indeterminateSnapshot();\n\n if (items) {\n this._commit(this._calculateCascadeState(oldSelection, [], items));\n } else {\n this._itemSelection.clear();\n this._indeterminateItems.clear();\n }\n\n this._updateItemsState(oldSelection, oldIndeterminate);\n }\n\n /**\n * The sets resulting from applying `added` and `removed` on top of\n * `oldSelection`.\n *\n * Disabled items cascade exactly like enabled ones: selected and deselected\n * with their ancestors, and counted towards a parent's state.\n */\n private _calculateCascadeState(\n oldSelection: IgcTreeItemComponent[],\n added: IgcTreeItemComponent[],\n removed: IgcTreeItemComponent[]\n ): CascadeState {\n const state: CascadeState = {\n selected: new Set(oldSelection),\n indeterminate: new Set(this._indeterminateItems),\n };\n\n this._cascadeInto(state, removed, false);\n this._cascadeInto(state, added, true);\n\n return state;\n }\n\n /** Applies `selected` to each item and its descendants, then reconciles ancestors. */\n private _cascadeInto(\n state: CascadeState,\n items: IgcTreeItemComponent[] | undefined,\n selected: boolean\n ): void {\n if (!items || isEmpty(items)) {\n return;\n }\n\n const parents: ItemSet = new Set();\n\n for (const item of items) {\n this._setItemState(state, item, selected);\n\n for (const child of item.getChildren({ flatten: true })) {\n this._setItemState(state, child, selected);\n }\n\n if (item.parent) {\n parents.add(item.parent);\n }\n }\n\n for (const parent of parents) {\n this._updateAncestors(state, parent);\n }\n }\n\n /** Reconciles `item` and every ancestor above it against their children. */\n private _updateAncestors(\n state: CascadeState,\n item: IgcTreeItemComponent\n ): void {\n for (\n let current: IgcTreeItemComponent | null = item;\n current;\n current = current.parent\n ) {\n this._applyItemState(state, current);\n }\n }\n\n /** Derives an item's state from the states of its direct children. */\n private _applyItemState(\n state: CascadeState,\n item: IgcTreeItemComponent\n ): void {\n const children = item.getChildren();\n\n if (isEmpty(children)) {\n // An item whose children were deleted keeps whatever state it had.\n this._setItemState(state, item, this.isItemSelected(item));\n return;\n }\n\n if (children.every((child) => state.selected.has(child))) {\n this._setItemState(state, item, true);\n } else if (\n children.some(\n (child) => state.selected.has(child) || state.indeterminate.has(child)\n )\n ) {\n this._setItemState(state, item, false, true);\n } else {\n this._setItemState(state, item, false);\n }\n }\n\n private _setItemState(\n state: CascadeState,\n item: IgcTreeItemComponent,\n select: boolean,\n indeterminate = false\n ): void {\n if (indeterminate) {\n state.indeterminate.add(item);\n state.selected.delete(item);\n return;\n }\n\n if (select) {\n state.selected.add(item);\n state.indeterminate.delete(item);\n } else {\n state.selected.delete(item);\n state.indeterminate.delete(item);\n }\n }\n\n private _commit(state: CascadeState): void {\n this._itemSelection = state.selected;\n this._indeterminateItems = state.indeterminate;\n }\n\n //#endregion\n\n //#region Internal helpers\n\n /** Reflects the computed selection onto the affected items. */\n private _updateItemsState(\n oldSelection: IgcTreeItemComponent[],\n oldIndeterminate: IgcTreeItemComponent[] = []\n ): void {\n this._reflect(this._itemSelection, oldSelection, (item, value) => {\n item.selected = value;\n });\n\n if (this._isCascade) {\n this._reflect(\n this._indeterminateItems,\n oldIndeterminate,\n (item, value) => {\n item.indeterminate = value;\n }\n );\n }\n }\n\n /** Applies the transition from `previous` to `current` to the items that moved. */\n private _reflect(\n current: ItemSet,\n previous: IgcTreeItemComponent[],\n apply: (item: IgcTreeItemComponent, value: boolean) => void\n ): void {\n const before = new Set(previous);\n\n for (const item of current) {\n if (!before.has(item)) {\n apply(item, true);\n }\n }\n for (const item of previous) {\n if (!current.has(item)) {\n apply(item, false);\n }\n }\n }\n\n private _selectedSnapshot(): IgcTreeItemComponent[] {\n return Array.from(this._itemSelection);\n }\n\n private _indeterminateSnapshot(): IgcTreeItemComponent[] {\n return Array.from(this._indeterminateItems);\n }\n\n /** Snapshot of `source` without any of `excluded`. */\n private _excluding(\n source: ItemSet,\n excluded?: IgcTreeItemComponent[]\n ): IgcTreeItemComponent[] {\n const skip = new Set(excluded);\n const result: IgcTreeItemComponent[] = [];\n\n for (const item of source) {\n if (!skip.has(item)) {\n result.push(item);\n }\n }\n\n return result;\n }\n\n private _sameSelection(\n first: IgcTreeItemComponent[],\n second: IgcTreeItemComponent[]\n ): boolean {\n if (first.length !== second.length) {\n return false;\n }\n const set = new Set(first);\n return second.every((item) => set.has(item));\n }\n\n //#endregion\n}\n"]}
1
+ {"version":3,"file":"tree.selection.js","sourceRoot":"","sources":["../../../src/components/tree/tree.selection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAkBrD,MAAM,OAAO,uBAAuB;IAMlC,YAAY,IAAsB;QAH1B,mBAAc,GAAY,IAAI,GAAG,EAAE,CAAC;QACpC,wBAAmB,GAAY,IAAI,GAAG,EAAE,CAAC;QAG/C,IAAI,CAAC,KAAK,GAAG,IAA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AChB,MAAe,EACf,QAAiC;QAEjC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC/B,MAAM,MAAM,GAA2B,EAAE,CAAC;QAE1C,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACpB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,cAAc,CACpB,KAA6B,EAC7B,MAA8B;QAE9B,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;YACnC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;CAGF","sourcesContent":["import { isEmpty } from '#internals/utils/arrays.js';\nimport type IgcTreeItemComponent from './tree-item.js';\nimport type { TreeSelectionEventInit } from './tree.common.js';\nimport type IgcTreeComponent from './tree.js';\n\ntype ItemSet = Set<IgcTreeItemComponent>;\n\n/**\n * The sets being built up during a single cascade update. Passed explicitly\n * between the cascade helpers rather than kept as scratch fields on the service,\n * so no half-built state is observable outside the update that produced it.\n */\ntype CascadeState = {\n selected: ItemSet;\n indeterminate: ItemSet;\n};\n\n/* blazorSuppress */\nexport class IgcTreeSelectionService {\n private readonly _tree: IgcTreeComponent;\n\n private _itemSelection: ItemSet = new Set();\n private _indeterminateItems: ItemSet = new Set();\n\n constructor(tree: IgcTreeComponent) {\n this._tree = tree;\n }\n\n private get _isCascade(): boolean {\n return this._tree.selection === 'cascade';\n }\n\n //#region Public API\n\n /** Select range from last selected item to the current specified item. */\n public selectMultipleItems(item: IgcTreeItemComponent): void {\n if (isEmpty(this._itemSelection)) {\n this.selectItem(item);\n return;\n }\n\n const items = this._tree.items;\n const selected = this._selectedSnapshot();\n const lastSelectedIndex = items.indexOf(selected[selected.length - 1]);\n const currentIndex = items.indexOf(item);\n\n const range = items.slice(\n Math.min(currentIndex, lastSelectedIndex),\n Math.max(currentIndex, lastSelectedIndex) + 1\n );\n const added = range.filter((i) => !this.isItemSelected(i));\n\n this._emitSelectionEvent(selected.concat(added), added, []);\n }\n\n /** Select the specified item and emit event. */\n public selectItem(item: IgcTreeItemComponent): void {\n if (this._tree.selection === 'none') {\n return;\n }\n this._emitSelectionEvent([...this._itemSelection, item], [item], []);\n }\n\n /** Deselect the specified item and emit event. */\n public deselectItem(item: IgcTreeItemComponent): void {\n const newSelection = this._selectedSnapshot().filter((i) => i !== item);\n this._emitSelectionEvent(newSelection, [], [item]);\n }\n\n /** Clears item selection */\n public clearItemsSelection(): void {\n const oldSelection = this._selectedSnapshot();\n const oldIndeterminate = this._indeterminateSnapshot();\n\n this._itemSelection.clear();\n this._indeterminateItems.clear();\n\n for (const item of oldSelection) {\n item.selected = false;\n }\n for (const item of oldIndeterminate) {\n item.indeterminate = false;\n }\n }\n\n public isItemSelected(item: IgcTreeItemComponent): boolean {\n return this._itemSelection.has(item);\n }\n\n public isItemIndeterminate(item: IgcTreeItemComponent): boolean {\n return this._indeterminateItems.has(item);\n }\n\n /** Called on item`s disconnectedCallback */\n public ensureStateOnItemDelete(item: IgcTreeItemComponent): void {\n // Removing a subtree calls `disconnectedCallback` on the top item first,\n // then on each descendant. That first call covers the subtree below it, so\n // a detached parent means an ancestor handles this removal.\n if (item.parent && !item.parent.isConnected) {\n return;\n }\n\n // Nothing to reconcile if no item is in a selected or indeterminate state.\n if (isEmpty(this._itemSelection) && isEmpty(this._indeterminateItems)) {\n return;\n }\n\n // Don't update the internal state of the deleted items because when moving they should keep it\n // However update the state of their parents\n this.deselectItemsWithNoEvent(\n [item, ...item.getChildren({ flatten: true })],\n true\n );\n }\n\n /** Retrigger the selection state of the item. */\n public retriggerItemState(item: IgcTreeItemComponent): void {\n if (item.selected) {\n this._itemSelection.delete(item);\n this.selectItemsWithNoEvent([item]);\n } else {\n this._itemSelection.add(item);\n this.deselectItemsWithNoEvent([item]);\n }\n }\n\n /** Select specified items. No event is emitted. */\n public selectItemsWithNoEvent(items: IgcTreeItemComponent[]): void {\n const oldSelection = this._selectedSnapshot();\n\n if (this._isCascade) {\n this._cascadeSelectWithNoEvent(items, oldSelection);\n return;\n }\n\n for (const item of items) {\n this._itemSelection.add(item);\n }\n\n this._updateItemsState(oldSelection);\n }\n\n /** Deselect specified items. No event is emitted. */\n public deselectItemsWithNoEvent(\n items?: IgcTreeItemComponent[],\n onDelete = false\n ): void {\n if (this._isCascade) {\n this._cascadeDeselectWithNoEvent(items, onDelete);\n return;\n }\n\n // On delete the removed items keep their own state, so they are excluded\n // from the \"before\" snapshot and never get their `selected` flag cleared.\n const oldSelection = onDelete\n ? this._excluding(this._itemSelection, items)\n : this._selectedSnapshot();\n\n if (items) {\n for (const item of items) {\n this._itemSelection.delete(item);\n }\n } else {\n this._itemSelection.clear();\n }\n\n this._updateItemsState(oldSelection);\n }\n\n //#endregion\n\n //#region Selection events\n\n private _emitSelectionEvent(\n newSelection: IgcTreeItemComponent[],\n added: IgcTreeItemComponent[],\n removed: IgcTreeItemComponent[]\n ): void {\n const currSelection = this._selectedSnapshot();\n\n if (this._sameSelection(currSelection, newSelection)) {\n return;\n }\n\n if (this._isCascade) {\n this._emitCascadeSelectionEvent(currSelection, added, removed);\n return;\n }\n\n const args: TreeSelectionEventInit = {\n detail: { newSelection },\n cancelable: true,\n };\n\n if (!this._tree.emitEvent('igcSelection', args)) {\n return;\n }\n\n // if newSelection is overwritten do not proceed (Blazor)\n if (this._sameSelection(newSelection, args.detail.newSelection)) {\n this._itemSelection = new Set(newSelection);\n this._updateItemsState(currSelection);\n }\n }\n\n private _emitCascadeSelectionEvent(\n currSelection: IgcTreeItemComponent[],\n added: IgcTreeItemComponent[],\n removed: IgcTreeItemComponent[]\n ): void {\n const oldIndeterminate = this._indeterminateSnapshot();\n const state = this._calculateCascadeState(currSelection, added, removed);\n const newSelection = Array.from(state.selected);\n\n const args: TreeSelectionEventInit = {\n detail: { newSelection },\n cancelable: true,\n };\n\n if (!this._tree.emitEvent('igcSelection', args)) {\n return;\n }\n\n // if newSelection is overwritten do not proceed (Blazor)\n if (this._sameSelection(newSelection, args.detail.newSelection)) {\n this._commit(state);\n this._updateItemsState(currSelection, oldIndeterminate);\n }\n }\n\n //#endregion\n\n //#region Cascade selection\n\n private _cascadeSelectWithNoEvent(\n items: IgcTreeItemComponent[],\n oldSelection: IgcTreeItemComponent[]\n ): void {\n const oldIndeterminate = this._indeterminateSnapshot();\n const newSelection = [...oldSelection, ...items];\n\n // retrieve only the rows without their parents/children which has to be added to the selection\n const newSelectionSet = new Set(newSelection);\n const removed = oldSelection.filter((i) => !newSelectionSet.has(i));\n const added = newSelection.filter((i) => !this._itemSelection.has(i));\n\n this._commit(this._calculateCascadeState(oldSelection, added, removed));\n this._updateItemsState(oldSelection, oldIndeterminate);\n }\n\n private _cascadeDeselectWithNoEvent(\n items?: IgcTreeItemComponent[],\n onDelete = false\n ): void {\n const oldSelection = onDelete\n ? this._excluding(this._itemSelection, items)\n : this._selectedSnapshot();\n const oldIndeterminate = onDelete\n ? this._excluding(this._indeterminateItems, items)\n : this._indeterminateSnapshot();\n\n if (items) {\n this._commit(this._calculateCascadeState(oldSelection, [], items));\n } else {\n this._itemSelection.clear();\n this._indeterminateItems.clear();\n }\n\n this._updateItemsState(oldSelection, oldIndeterminate);\n }\n\n /**\n * The sets resulting from applying `added` and `removed` on top of\n * `oldSelection`.\n *\n * Disabled items cascade exactly like enabled ones: selected and deselected\n * with their ancestors, and counted towards a parent's state.\n */\n private _calculateCascadeState(\n oldSelection: IgcTreeItemComponent[],\n added: IgcTreeItemComponent[],\n removed: IgcTreeItemComponent[]\n ): CascadeState {\n const state: CascadeState = {\n selected: new Set(oldSelection),\n indeterminate: new Set(this._indeterminateItems),\n };\n\n this._cascadeInto(state, removed, false);\n this._cascadeInto(state, added, true);\n\n return state;\n }\n\n /** Applies `selected` to each item and its descendants, then reconciles ancestors. */\n private _cascadeInto(\n state: CascadeState,\n items: IgcTreeItemComponent[] | undefined,\n selected: boolean\n ): void {\n if (!items || isEmpty(items)) {\n return;\n }\n\n const parents: ItemSet = new Set();\n\n for (const item of items) {\n this._setItemState(state, item, selected);\n\n for (const child of item.getChildren({ flatten: true })) {\n this._setItemState(state, child, selected);\n }\n\n if (item.parent) {\n parents.add(item.parent);\n }\n }\n\n for (const parent of parents) {\n this._updateAncestors(state, parent);\n }\n }\n\n /** Reconciles `item` and every ancestor above it against their children. */\n private _updateAncestors(\n state: CascadeState,\n item: IgcTreeItemComponent\n ): void {\n for (\n let current: IgcTreeItemComponent | null = item;\n current;\n current = current.parent\n ) {\n this._applyItemState(state, current);\n }\n }\n\n /** Derives an item's state from the states of its direct children. */\n private _applyItemState(\n state: CascadeState,\n item: IgcTreeItemComponent\n ): void {\n const children = item.getChildren();\n\n if (isEmpty(children)) {\n // An item whose children were deleted keeps whatever state it had.\n this._setItemState(state, item, this.isItemSelected(item));\n return;\n }\n\n if (children.every((child) => state.selected.has(child))) {\n this._setItemState(state, item, true);\n } else if (\n children.some(\n (child) => state.selected.has(child) || state.indeterminate.has(child)\n )\n ) {\n this._setItemState(state, item, false, true);\n } else {\n this._setItemState(state, item, false);\n }\n }\n\n private _setItemState(\n state: CascadeState,\n item: IgcTreeItemComponent,\n select: boolean,\n indeterminate = false\n ): void {\n if (indeterminate) {\n state.indeterminate.add(item);\n state.selected.delete(item);\n return;\n }\n\n if (select) {\n state.selected.add(item);\n state.indeterminate.delete(item);\n } else {\n state.selected.delete(item);\n state.indeterminate.delete(item);\n }\n }\n\n private _commit(state: CascadeState): void {\n this._itemSelection = state.selected;\n this._indeterminateItems = state.indeterminate;\n }\n\n //#endregion\n\n //#region Internal helpers\n\n /** Reflects the computed selection onto the affected items. */\n private _updateItemsState(\n oldSelection: IgcTreeItemComponent[],\n oldIndeterminate: IgcTreeItemComponent[] = []\n ): void {\n this._reflect(this._itemSelection, oldSelection, (item, value) => {\n item.selected = value;\n });\n\n if (this._isCascade) {\n this._reflect(\n this._indeterminateItems,\n oldIndeterminate,\n (item, value) => {\n item.indeterminate = value;\n }\n );\n }\n }\n\n /** Applies the transition from `previous` to `current` to the items that moved. */\n private _reflect(\n current: ItemSet,\n previous: IgcTreeItemComponent[],\n apply: (item: IgcTreeItemComponent, value: boolean) => void\n ): void {\n const before = new Set(previous);\n\n for (const item of current) {\n if (!before.has(item)) {\n apply(item, true);\n }\n }\n for (const item of previous) {\n if (!current.has(item)) {\n apply(item, false);\n }\n }\n }\n\n private _selectedSnapshot(): IgcTreeItemComponent[] {\n return Array.from(this._itemSelection);\n }\n\n private _indeterminateSnapshot(): IgcTreeItemComponent[] {\n return Array.from(this._indeterminateItems);\n }\n\n /** Snapshot of `source` without any of `excluded`. */\n private _excluding(\n source: ItemSet,\n excluded?: IgcTreeItemComponent[]\n ): IgcTreeItemComponent[] {\n const skip = new Set(excluded);\n const result: IgcTreeItemComponent[] = [];\n\n for (const item of source) {\n if (!skip.has(item)) {\n result.push(item);\n }\n }\n\n return result;\n }\n\n private _sameSelection(\n first: IgcTreeItemComponent[],\n second: IgcTreeItemComponent[]\n ): boolean {\n if (first.length !== second.length) {\n return false;\n }\n const set = new Set(first);\n return second.every((item) => set.has(item));\n }\n\n //#endregion\n}\n"]}
@@ -3,7 +3,7 @@ export type ContentOrientation = 'horizontal' | 'vertical';
3
3
  export type HorizontalTransitionAnimation = 'slide' | 'fade' | 'none';
4
4
  export type NotificationPositioning = 'viewport' | 'container';
5
5
  export type PickerMode = 'dropdown' | 'dialog';
6
- export type PopoverScrollStrategy = 'scroll' | 'block' | 'close';
6
+ export type PopoverScrollStrategy = 'scroll' | 'hide' | 'close';
7
7
  export type RangeTextSelectMode = 'preserve' | 'select' | 'start' | 'end';
8
8
  export type SelectionRangeDirection = 'none' | 'backward' | 'forward';
9
9
  export type StyleVariant = 'primary' | 'info' | 'success' | 'warning' | 'danger';
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"","sourcesContent":["// Public API types\n// NOTE: use default value as first in order where possible for union types\n\n//#region shared types\nexport type AbsolutePosition = 'bottom' | 'middle' | 'top';\nexport type ContentOrientation = 'horizontal' | 'vertical';\nexport type HorizontalTransitionAnimation = 'slide' | 'fade' | 'none';\nexport type NotificationPositioning = 'viewport' | 'container';\nexport type PickerMode = 'dropdown' | 'dialog';\nexport type PopoverScrollStrategy = 'scroll' | 'block' | 'close';\nexport type RangeTextSelectMode = 'preserve' | 'select' | 'start' | 'end';\nexport type SelectionRangeDirection = 'none' | 'backward' | 'forward';\nexport type StyleVariant =\n | 'primary'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger';\nexport type ToggleLabelPosition = 'after' | 'before';\nexport type TreeSelection = 'none' | 'multiple' | 'cascade';\n//#endregion\n\n//#region component-specific\nexport type AvatarShape = 'square' | 'circle' | 'rounded';\nexport type BadgeShape = 'rounded' | 'square';\nexport type ButtonGroupSelection = 'single' | 'single-required' | 'multiple';\nexport type ButtonVariant = 'contained' | 'flat' | 'outlined' | 'fab';\nexport type CarouselIndicatorsOrientation = 'end' | 'start';\nexport type ColorFormat = 'hex' | 'rgb' | 'hsl';\nexport type ColorPickerMode = 'default' | 'input';\n/* jsonAPIPlainObject */\nexport type DateRangeValue = { start: Date | null; end: Date | null };\nexport type DividerType = 'solid' | 'dashed';\nexport type ExpansionPanelIndicatorPosition = 'start' | 'end' | 'none';\nexport type IconButtonVariant = 'contained' | 'flat' | 'outlined';\nexport type InputType =\n | 'text'\n | 'email'\n | 'number'\n | 'password'\n | 'search'\n | 'tel'\n | 'url';\nexport type LinearProgressLabelAlign =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'bottom-start'\n | 'bottom'\n | 'bottom-end';\nexport type MaskInputValueMode = 'raw' | 'withFormatting';\nexport type NavDrawerPosition = 'start' | 'end' | 'top' | 'bottom' | 'relative';\nexport type SliderTickLabelRotation = 0 | 90 | -90;\nexport type SliderTickOrientation = 'end' | 'mirror' | 'start';\nexport type SplitterOrientation = 'horizontal' | 'vertical';\nexport type StepperOrientation = 'horizontal' | 'vertical';\nexport type StepperStepType = 'full' | 'indicator' | 'title';\nexport type StepperTitlePosition = 'auto' | 'bottom' | 'top' | 'end' | 'start';\nexport type StepperVerticalAnimation = 'grow' | 'fade' | 'none';\nexport type TabsActivation = 'auto' | 'manual';\nexport type TabsAlignment = 'start' | 'end' | 'center' | 'justify';\nexport type TextareaResize = 'vertical' | 'auto' | 'none';\nexport type TileManagerDragMode = 'none' | 'tile-header' | 'tile';\nexport type TileManagerResizeMode = 'none' | 'hover' | 'always';\n//#endregion\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"","sourcesContent":["// Public API types\n// NOTE: use default value as first in order where possible for union types\n\n//#region shared types\nexport type AbsolutePosition = 'bottom' | 'middle' | 'top';\nexport type ContentOrientation = 'horizontal' | 'vertical';\nexport type HorizontalTransitionAnimation = 'slide' | 'fade' | 'none';\nexport type NotificationPositioning = 'viewport' | 'container';\nexport type PickerMode = 'dropdown' | 'dialog';\nexport type PopoverScrollStrategy = 'scroll' | 'hide' | 'close';\nexport type RangeTextSelectMode = 'preserve' | 'select' | 'start' | 'end';\nexport type SelectionRangeDirection = 'none' | 'backward' | 'forward';\nexport type StyleVariant =\n | 'primary'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger';\nexport type ToggleLabelPosition = 'after' | 'before';\nexport type TreeSelection = 'none' | 'multiple' | 'cascade';\n//#endregion\n\n//#region component-specific\nexport type AvatarShape = 'square' | 'circle' | 'rounded';\nexport type BadgeShape = 'rounded' | 'square';\nexport type ButtonGroupSelection = 'single' | 'single-required' | 'multiple';\nexport type ButtonVariant = 'contained' | 'flat' | 'outlined' | 'fab';\nexport type CarouselIndicatorsOrientation = 'end' | 'start';\nexport type ColorFormat = 'hex' | 'rgb' | 'hsl';\nexport type ColorPickerMode = 'default' | 'input';\n/* jsonAPIPlainObject */\nexport type DateRangeValue = { start: Date | null; end: Date | null };\nexport type DividerType = 'solid' | 'dashed';\nexport type ExpansionPanelIndicatorPosition = 'start' | 'end' | 'none';\nexport type IconButtonVariant = 'contained' | 'flat' | 'outlined';\nexport type InputType =\n | 'text'\n | 'email'\n | 'number'\n | 'password'\n | 'search'\n | 'tel'\n | 'url';\nexport type LinearProgressLabelAlign =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'bottom-start'\n | 'bottom'\n | 'bottom-end';\nexport type MaskInputValueMode = 'raw' | 'withFormatting';\nexport type NavDrawerPosition = 'start' | 'end' | 'top' | 'bottom' | 'relative';\nexport type SliderTickLabelRotation = 0 | 90 | -90;\nexport type SliderTickOrientation = 'end' | 'mirror' | 'start';\nexport type SplitterOrientation = 'horizontal' | 'vertical';\nexport type StepperOrientation = 'horizontal' | 'vertical';\nexport type StepperStepType = 'full' | 'indicator' | 'title';\nexport type StepperTitlePosition = 'auto' | 'bottom' | 'top' | 'end' | 'start';\nexport type StepperVerticalAnimation = 'grow' | 'fade' | 'none';\nexport type TabsActivation = 'auto' | 'manual';\nexport type TabsAlignment = 'start' | 'end' | 'center' | 'justify';\nexport type TextareaResize = 'vertical' | 'auto' | 'none';\nexport type TileManagerDragMode = 'none' | 'tile-header' | 'tile';\nexport type TileManagerResizeMode = 'none' | 'hover' | 'always';\n//#endregion\n"]}
@@ -8,6 +8,7 @@ import { html, isServer, LitElement, nothing } from 'lit';
8
8
  import { property } from 'lit/decorators.js';
9
9
  import { ifDefined } from 'lit/directives/if-defined.js';
10
10
  import { createAbortHandle } from '#internals/abort-handler.js';
11
+ import { HELPER_TEXT_ID } from '#internals/controllers/aria-projection.js';
11
12
  import { registerComponent } from '#internals/definitions/register.js';
12
13
  import { InternalInvalidEvent, InternalResetEvent, } from '#internals/mixins/forms/types.js';
13
14
  import { partMap } from '#internals/part-map.js';
@@ -47,7 +48,7 @@ export default class IgcValidationContainerComponent extends LitElement {
47
48
  registerComponent(IgcValidationContainerComponent, IgcIconComponent);
48
49
  }
49
50
  static create(host, config = {
50
- id: 'helper-text',
51
+ id: HELPER_TEXT_ID,
51
52
  hasHelperText: true,
52
53
  }) {
53
54
  const helperText = config.hasHelperText
@@ -1 +1 @@
1
- {"version":3,"file":"validation-container.js","sourceRoot":"","sources":["../../../src/components/validation-container/validation-container.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAEL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,gBAAgB,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAkBxD,MAAM,cAAc,GAGlB;IACE,UAAU;IAC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I,CAAA,aAAa,OAAO,CAAC,KAAK,CAAC;QAClC,IAAI,cAAc,QAAQ;WACvB,CAAC;IACV,CAAC;IAEO,aAAa,CACnB,cAAmC;QAEnC,OAAO,IAAI,CAAC,OAAO,IAAI,cAAc,CAAC,IAAI,GAAG,CAAC;YAC5C,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,IAAI,CAAA,kCAAkC,CAAC;IAC7C,CAAC;IAEkB,YAAY;QAI7B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;IAEkB,MAAM;QACvB,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,sBAAsB,EAAE,CAAC;QACxE,MAAM,QAAQ,GACZ,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO;YAC7B,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;iBACvD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;iBAC9D,OAAO,EAAE;YACd,CAAC,CAAC,OAAO,CAAC;QAEd,OAAO,IAAI,CAAA;;eAEA,OAAO,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;;;UAG/D,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC;;KAE9C,CAAC;IACJ,CAAC;;AA7IM;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gEACL;AASvB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;6DAc9B","sourcesContent":["import { html, isServer, LitElement, nothing, type TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { createAbortHandle } from '#internals/abort-handler.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport {\n type IgcFormControl,\n InternalInvalidEvent,\n InternalResetEvent,\n} from '#internals/mixins/forms/types.js';\nimport { partMap } from '#internals/part-map.js';\nimport { isEmpty } from '#internals/utils/arrays.js';\nimport { toKebabCase } from '#internals/utils/strings.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport IgcIconComponent from '../icon/icon.js';\nimport { all as inputThemes } from '../input/themes/themes.js';\nimport { styles as shared } from './themes/shared/validator.common.css.js';\nimport { styles } from './themes/validator.base.css.js';\n\n/** Configuration for the validation container. */\nexport interface ValidationContainerConfig {\n /** The id attribute for the validation container. */\n id?: string;\n /** Project the validation container to the given slot inside the host shadow DOM. */\n slot?: string;\n /** Additional part(s) that should be bound to the validation container. */\n part?: string;\n /** Whether the validation container should expose a helper-text slot. */\n hasHelperText?: boolean;\n}\n\n/**\n * Validity flags and their slot names, in a stable order so the generated slots\n * are deterministic across browsers.\n */\nconst VALIDITY_SLOTS: ReadonlyArray<\n readonly [keyof ValidityStateFlags, string]\n> = (\n [\n 'badInput',\n 'customError',\n 'patternMismatch',\n 'rangeOverflow',\n 'rangeUnderflow',\n 'stepMismatch',\n 'tooLong',\n 'tooShort',\n 'typeMismatch',\n 'valueMissing',\n ] as const\n).map((key) => [key, toKebabCase(key)] as const);\n\n/**\n * Yields the active validation slot names for the given validity state:\n * `invalid` first, then each failing constraint.\n */\nfunction* activeValidationSlots(validity: ValidityState): Generator<string> {\n if (!validity.valid) {\n yield 'invalid';\n }\n\n for (const [key, slot] of VALIDITY_SLOTS) {\n if (validity[key]) {\n yield slot;\n }\n }\n}\n\n/* blazorSuppress */\n/**\n * @element igc-validator\n *\n * @csspart helper-text - The base wrapper\n * @csspart validation-message - The validation error message container\n * @csspart validation-icon - The validation error icon\n */\nexport default class IgcValidationContainerComponent extends LitElement {\n public static readonly tagName = 'igc-validator';\n public static override styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcValidationContainerComponent, IgcIconComponent);\n }\n\n /**\n * Creates a validation container for the given form control.\n *\n * The container will render validation messages based on the control's validity state\n * and projected content, and reflect the control's `invalid` state.\n */\n public static create(\n host: IgcFormControl,\n config: ValidationContainerConfig = {\n id: 'helper-text',\n hasHelperText: true,\n }\n ): TemplateResult {\n const helperText = config.hasHelperText\n ? html`<slot name=\"helper-text\" slot=\"helper-text\"></slot>`\n : nothing;\n\n // `hasUpdated` is false during SSR and the hydrating render, so both emit\n // `nothing` and the slots are projected on the next host render (see\n // `firstUpdated` in the container).\n const validationSlots = host.hasUpdated\n ? Iterator.from(activeValidationSlots(host.validity))\n .map((name) => html`<slot name=${name} slot=${name}></slot>`)\n .toArray()\n : nothing;\n\n // `?invalid` tracks host re-renders; the internal invalid/reset events cover\n // a form reset, which restores the value without re-rendering the host.\n return html`\n <igc-validator\n id=${ifDefined(config.id)}\n part=${ifDefined(config.part)}\n slot=${ifDefined(config.slot)}\n ?invalid=${host.invalid}\n .target=${host}\n exportparts=\"helper-text, validation-message, validation-icon\"\n >\n ${helperText}${validationSlots}\n </igc-validator>\n `;\n }\n\n private readonly _abortHandle = createAbortHandle();\n private _target!: IgcFormControl;\n\n /**\n * Whether the container is in an invalid state.\n *\n * This is reflected from the target's `invalid` property,\n * and is used to determine whether to render the validation message slots.\n */\n @property({ type: Boolean })\n public invalid = false;\n\n /**\n * The form control whose validity state is rendered.\n *\n * @remarks Must be set before the first update for SSR compatibility;\n * `create` sets it automatically.\n */\n @property({ attribute: false })\n public set target(value: IgcFormControl) {\n if (this._target === value) {\n return;\n }\n\n // Listeners are not removed on disconnect: the container lives in the\n // target's shadow root and shares its lifetime.\n this._abortHandle.abort();\n const { signal } = this._abortHandle;\n\n this._target = value;\n this._target.addEventListener(InternalInvalidEvent, this, { signal });\n this._target.addEventListener(InternalResetEvent, this, { signal });\n }\n\n public get target(): IgcFormControl {\n return this._target;\n }\n\n constructor() {\n super();\n addThemingController(this, inputThemes);\n }\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n root.addEventListener('slotchange', this);\n return root;\n }\n\n /** @internal */\n public handleEvent(event: Event): void {\n switch (event.type) {\n case InternalInvalidEvent:\n this.invalid = true;\n break;\n case InternalResetEvent:\n this.invalid = false;\n break;\n }\n\n this.requestUpdate();\n }\n\n /**\n * Collects which slots have assigned content.\n *\n * @remarks Reads the shadow DOM from the previous commit. On the render where\n * `invalid` flips on, the message slots do not exist yet, so every message is\n * `empty`; their `slotchange` schedules a second render before paint.\n */\n private _collectProjectedSlots(): {\n isProjectionEmpty: boolean;\n validation: Set<string>;\n } {\n const validation = new Set<string>();\n\n if (isServer || !this.hasUpdated) {\n return { isProjectionEmpty: false, validation };\n }\n\n let isProjectionEmpty = true;\n\n for (const slot of this.renderRoot.querySelectorAll('slot')) {\n if (isEmpty(slot.assignedElements({ flatten: true }))) {\n continue;\n }\n\n isProjectionEmpty = false;\n if (slot.name !== 'helper-text') {\n validation.add(slot.name);\n }\n }\n\n return { isProjectionEmpty, validation };\n }\n\n private _renderValidationMessage(\n slotName: string,\n projectedSlots: ReadonlySet<string>\n ): TemplateResult {\n const hasProjectedContent = projectedSlots.has(slotName);\n const parts = { 'validation-message': true, empty: !hasProjectedContent };\n const icon = hasProjectedContent\n ? html`\n <igc-icon\n aria-hidden=\"true\"\n name=\"error\"\n part=\"validation-icon\"\n ></igc-icon>\n `\n : nothing;\n\n return html`<div part=${partMap(parts)}>\n ${icon}<slot name=${slotName}></slot>\n </div>`;\n }\n\n private _renderHelper(\n projectedSlots: ReadonlySet<string>\n ): TemplateResult | typeof nothing {\n return this.invalid && projectedSlots.size > 0\n ? nothing\n : html`<slot name=\"helper-text\"></slot>`;\n }\n\n protected override firstUpdated(): void {\n // `create` omits the validation slots until the host has updated. If the\n // host hydrated invalid, ask it to re-render so the slots are projected;\n // their `slotchange` then updates this container.\n if (this.invalid) {\n this.target.requestUpdate();\n }\n }\n\n protected override render(): TemplateResult {\n const { isProjectionEmpty, validation } = this._collectProjectedSlots();\n const messages =\n this.hasUpdated && this.invalid\n ? Iterator.from(activeValidationSlots(this.target.validity))\n .map((name) => this._renderValidationMessage(name, validation))\n .toArray()\n : nothing;\n\n return html`\n <div\n part=${partMap({ 'helper-text': true, empty: isProjectionEmpty })}\n aria-live=\"polite\"\n >\n ${messages}${this._renderHelper(validation)}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-validator': IgcValidationContainerComponent;\n }\n}\n"]}
1
+ {"version":3,"file":"validation-container.js","sourceRoot":"","sources":["../../../src/components/validation-container/validation-container.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAEL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,gBAAgB,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,yCAAyC,CAAC;AAC3E,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":["import { html, isServer, LitElement, nothing, type TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { createAbortHandle } from '#internals/abort-handler.js';\nimport { HELPER_TEXT_ID } from '#internals/controllers/aria-projection.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport {\n type IgcFormControl,\n InternalInvalidEvent,\n InternalResetEvent,\n} from '#internals/mixins/forms/types.js';\nimport { partMap } from '#internals/part-map.js';\nimport { isEmpty } from '#internals/utils/arrays.js';\nimport { toKebabCase } from '#internals/utils/strings.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport IgcIconComponent from '../icon/icon.js';\nimport { all as inputThemes } from '../input/themes/themes.js';\nimport { styles as shared } from './themes/shared/validator.common.css.js';\nimport { styles } from './themes/validator.base.css.js';\n\n/** Configuration for the validation container. */\nexport interface ValidationContainerConfig {\n /** The id attribute for the validation container. */\n id?: string;\n /** Project the validation container to the given slot inside the host shadow DOM. */\n slot?: string;\n /** Additional part(s) that should be bound to the validation container. */\n part?: string;\n /** Whether the validation container should expose a helper-text slot. */\n hasHelperText?: boolean;\n}\n\n/**\n * Validity flags and their slot names, in a stable order so the generated slots\n * are deterministic across browsers.\n */\nconst VALIDITY_SLOTS: ReadonlyArray<\n readonly [keyof ValidityStateFlags, string]\n> = (\n [\n 'badInput',\n 'customError',\n 'patternMismatch',\n 'rangeOverflow',\n 'rangeUnderflow',\n 'stepMismatch',\n 'tooLong',\n 'tooShort',\n 'typeMismatch',\n 'valueMissing',\n ] as const\n).map((key) => [key, toKebabCase(key)] as const);\n\n/**\n * Yields the active validation slot names for the given validity state:\n * `invalid` first, then each failing constraint.\n */\nfunction* activeValidationSlots(validity: ValidityState): Generator<string> {\n if (!validity.valid) {\n yield 'invalid';\n }\n\n for (const [key, slot] of VALIDITY_SLOTS) {\n if (validity[key]) {\n yield slot;\n }\n }\n}\n\n/* blazorSuppress */\n/**\n * @element igc-validator\n *\n * @csspart helper-text - The base wrapper\n * @csspart validation-message - The validation error message container\n * @csspart validation-icon - The validation error icon\n */\nexport default class IgcValidationContainerComponent extends LitElement {\n public static readonly tagName = 'igc-validator';\n public static override styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcValidationContainerComponent, IgcIconComponent);\n }\n\n /**\n * Creates a validation container for the given form control.\n *\n * The container will render validation messages based on the control's validity state\n * and projected content, and reflect the control's `invalid` state.\n */\n public static create(\n host: IgcFormControl,\n config: ValidationContainerConfig = {\n id: HELPER_TEXT_ID,\n hasHelperText: true,\n }\n ): TemplateResult {\n const helperText = config.hasHelperText\n ? html`<slot name=\"helper-text\" slot=\"helper-text\"></slot>`\n : nothing;\n\n // `hasUpdated` is false during SSR and the hydrating render, so both give\n // `nothing`, and the next host render projects the slots. See `firstUpdated`.\n const validationSlots = host.hasUpdated\n ? Iterator.from(activeValidationSlots(host.validity))\n .map((name) => html`<slot name=${name} slot=${name}></slot>`)\n .toArray()\n : nothing;\n\n // `?invalid` tracks host re-renders; the internal invalid/reset events cover\n // a form reset, which restores the value without re-rendering the host.\n return html`\n <igc-validator\n id=${ifDefined(config.id)}\n part=${ifDefined(config.part)}\n slot=${ifDefined(config.slot)}\n ?invalid=${host.invalid}\n .target=${host}\n exportparts=\"helper-text, validation-message, validation-icon\"\n >\n ${helperText}${validationSlots}\n </igc-validator>\n `;\n }\n\n private readonly _abortHandle = createAbortHandle();\n private _target!: IgcFormControl;\n\n /**\n * Whether the container is in an invalid state.\n *\n * This is reflected from the target's `invalid` property,\n * and is used to determine whether to render the validation message slots.\n */\n @property({ type: Boolean })\n public invalid = false;\n\n /**\n * The form control whose validity state is rendered.\n *\n * @remarks Must be set before the first update for SSR compatibility;\n * `create` sets it automatically.\n */\n @property({ attribute: false })\n public set target(value: IgcFormControl) {\n if (this._target === value) {\n return;\n }\n\n // Listeners are not removed on disconnect: the container lives in the\n // target's shadow root and shares its lifetime.\n this._abortHandle.abort();\n const { signal } = this._abortHandle;\n\n this._target = value;\n this._target.addEventListener(InternalInvalidEvent, this, { signal });\n this._target.addEventListener(InternalResetEvent, this, { signal });\n }\n\n public get target(): IgcFormControl {\n return this._target;\n }\n\n constructor() {\n super();\n addThemingController(this, inputThemes);\n }\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n root.addEventListener('slotchange', this);\n return root;\n }\n\n /** @internal */\n public handleEvent(event: Event): void {\n switch (event.type) {\n case InternalInvalidEvent:\n this.invalid = true;\n break;\n case InternalResetEvent:\n this.invalid = false;\n break;\n }\n\n this.requestUpdate();\n }\n\n /**\n * Collects which slots have assigned content.\n *\n * @remarks Reads the shadow DOM from the previous commit. On the render where\n * `invalid` flips on, the message slots do not exist yet, so every message is\n * `empty`; their `slotchange` schedules a second render before paint.\n */\n private _collectProjectedSlots(): {\n isProjectionEmpty: boolean;\n validation: Set<string>;\n } {\n const validation = new Set<string>();\n\n if (isServer || !this.hasUpdated) {\n return { isProjectionEmpty: false, validation };\n }\n\n let isProjectionEmpty = true;\n\n for (const slot of this.renderRoot.querySelectorAll('slot')) {\n if (isEmpty(slot.assignedElements({ flatten: true }))) {\n continue;\n }\n\n isProjectionEmpty = false;\n if (slot.name !== 'helper-text') {\n validation.add(slot.name);\n }\n }\n\n return { isProjectionEmpty, validation };\n }\n\n private _renderValidationMessage(\n slotName: string,\n projectedSlots: ReadonlySet<string>\n ): TemplateResult {\n const hasProjectedContent = projectedSlots.has(slotName);\n const parts = { 'validation-message': true, empty: !hasProjectedContent };\n const icon = hasProjectedContent\n ? html`\n <igc-icon\n aria-hidden=\"true\"\n name=\"error\"\n part=\"validation-icon\"\n ></igc-icon>\n `\n : nothing;\n\n return html`<div part=${partMap(parts)}>\n ${icon}<slot name=${slotName}></slot>\n </div>`;\n }\n\n private _renderHelper(\n projectedSlots: ReadonlySet<string>\n ): TemplateResult | typeof nothing {\n return this.invalid && projectedSlots.size > 0\n ? nothing\n : html`<slot name=\"helper-text\"></slot>`;\n }\n\n protected override firstUpdated(): void {\n // `create` omits the validation slots until the host updates. If the host\n // hydrated invalid, make it render again to project the slots. Their\n // `slotchange` then updates this container.\n if (this.invalid) {\n this.target.requestUpdate();\n }\n }\n\n protected override render(): TemplateResult {\n const { isProjectionEmpty, validation } = this._collectProjectedSlots();\n const messages =\n this.hasUpdated && this.invalid\n ? Iterator.from(activeValidationSlots(this.target.validity))\n .map((name) => this._renderValidationMessage(name, validation))\n .toArray()\n : nothing;\n\n return html`\n <div\n part=${partMap({ 'helper-text': true, empty: isProjectionEmpty })}\n aria-live=\"polite\"\n >\n ${messages}${this._renderHelper(validation)}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-validator': IgcValidationContainerComponent;\n }\n}\n"]}
@@ -16,13 +16,17 @@ import type { ScrollAlignment, VisibleRange } from './types.js';
16
16
  export declare class VirtualScrollEngine {
17
17
  private _maxBrowserSize;
18
18
  /**
19
- * The ratio `totalSize / maxBrowserSize` when `totalSize` is larger than
20
- * the maximum DOM coordinate the browser supports; `1` otherwise.
21
- * Maps virtual scroll positions to DOM scroll positions.
19
+ * Maps a virtual scroll position to a DOM scroll position. The ratio
20
+ * `totalSize / maxBrowserSize` if `totalSize` is larger than the maximum DOM
21
+ * coordinate of the browser, and `1` in all other cases.
22
22
  */
23
23
  private _virtualRatio;
24
24
  /** Binary Indexed Tree for O(log N) size queries and updates. */
25
25
  private _tree;
26
+ /** The estimate last given to `resize` or `updateEstimatedSize`. */
27
+ private _configuredEstimate;
28
+ /** Whether `adaptEstimate` has applied a measured average. */
29
+ private _hasAdaptedEstimate;
26
30
  /**
27
31
  * Called when item sizes or the item count change.
28
32
  * Example: `() => this.requestUpdate()`.
@@ -36,10 +40,14 @@ export declare class VirtualScrollEngine {
36
40
  initMaxBrowserSize(doc: Document): void;
37
41
  /**
38
42
  * Resizes the internal sizes array to `length`. Measured sizes below
39
- * `retainCount` are kept. The remainder is filled with `estimatedSize` and
40
- * marked unmeasured. Callers that only append can keep the default
41
- * `retainCount`. Callers whose data changed identity at some index must
42
- * pass that index, so the stale measurements after it are discarded.
43
+ * `retainCount` are kept, and the other items are unmeasured. Callers that
44
+ * only append can keep the default `retainCount`. Callers whose data
45
+ * changed identity at some index must pass that index, so the stale
46
+ * measurements after it are discarded.
47
+ *
48
+ * Unmeasured items take `estimatedSize`, or the adapted average while
49
+ * `estimatedSize` stays the same: a data change does not make it less
50
+ * accurate.
43
51
  */
44
52
  resize(length: number, estimatedSize: number, retainCount?: number): void;
45
53
  /** Records the measured DOM size for a single item. */
@@ -50,6 +58,16 @@ export declare class VirtualScrollEngine {
50
58
  * not, because `resize` is then a no-op.
51
59
  */
52
60
  updateEstimatedSize(estimatedSize: number): void;
61
+ /**
62
+ * Sets the estimate of the unmeasured items to the average size measured
63
+ * since the estimate was last configured. Older sizes can be out of date,
64
+ * for example after a density change.
65
+ *
66
+ * The first change applies anywhere. A later one applies only while each
67
+ * item before `windowStart` is measured: the offset of the rendered items
68
+ * then does not depend on the estimate, so the change cannot move them.
69
+ */
70
+ adaptEstimate(windowStart: number): void;
53
71
  /**
54
72
  * Returns the DOM scroll offset in px that puts the item at `index` at the
55
73
  * leading edge of the viewport.
@@ -57,8 +75,8 @@ export declare class VirtualScrollEngine {
57
75
  getScrollOffsetForIndex(index: number): number;
58
76
  /**
59
77
  * The largest DOM scroll offset the host can reach for the given viewport
60
- * size. A request beyond it does nothing, so offsets given to a caller
61
- * that waits for the scroll to settle are clamped to it.
78
+ * size. A request past it does nothing, so an offset given to a caller that
79
+ * waits for the scroll to settle is clamped to this value.
62
80
  */
63
81
  private _getMaxScrollOffset;
64
82
  /**
@@ -72,6 +90,13 @@ export declare class VirtualScrollEngine {
72
90
  * slack.
73
91
  */
74
92
  getAlignedScrollOffset(index: number, viewportSize: number, align: ScrollAlignment): number;
93
+ /**
94
+ * Returns the DOM scroll offset that brings the item at `index` into view
95
+ * as `position` asks. `nearest` follows native `scrollIntoView`: an item in
96
+ * view, or one that covers the viewport, keeps `scrollPosition`, and any
97
+ * other item scrolls the smallest distance to an edge alignment.
98
+ */
99
+ resolveScrollOffset(index: number, scrollPosition: number, viewportSize: number, position?: ScrollLogicalPosition): number;
75
100
  /**
76
101
  * Whether the item at `index` is visible without more scrolling at the
77
102
  * given DOM scroll position. True when the item is fully inside the
@@ -90,5 +115,11 @@ export declare class VirtualScrollEngine {
90
115
  * items do not overflow past `domSize` under coordinate compression.
91
116
  */
92
117
  getPhysicalRangeSize(startIndex: number, endIndex: number): number;
118
+ /**
119
+ * Records a changed configured estimate and starts a new sample. Returns
120
+ * false for an unchanged one, which keeps the adapted average.
121
+ */
122
+ private _configureEstimate;
123
+ private _applyEstimate;
93
124
  private _updateVirtualRatio;
94
125
  }
@@ -25,82 +25,104 @@ function getMaxBrowserSizeProbePx(doc) {
25
25
  function clampIndex(index, length) {
26
26
  return clamp(index, 0, length - 1);
27
27
  }
28
- function buildTree(tree, sizes) {
29
- const length = sizes.length;
30
- let total = 0;
31
- for (let i = 1; i <= length; i++) {
32
- tree[i] += sizes[i - 1];
33
- total += sizes[i - 1];
34
- const j = i + (i & -i);
35
- if (j <= length) {
36
- tree[j] += tree[i];
37
- }
38
- }
39
- return total;
40
- }
28
+ const UNMEASURED = 0;
29
+ const MEASURED = 1;
30
+ const SAMPLED = 2;
41
31
  class SizeTree {
42
- constructor(length, sizes, tree, total, measured) {
32
+ constructor(length, estimate, sizes = new Float64Array(length), states = new Uint8Array(length)) {
33
+ this._measuredCount = 0;
34
+ this._measuredTotal = 0;
35
+ this._sampleCount = 0;
36
+ this._sampleTotal = 0;
43
37
  this.length = length;
38
+ this.estimate = estimate;
44
39
  this._sizes = sizes;
45
- this._tree = tree;
46
- this._total = total;
47
- this._measured = measured;
40
+ this._states = states;
41
+ this._sums = new Float64Array(length + 1);
42
+ this._counts = new Int32Array(length + 1);
48
43
  this._topBit = length > 0 ? 1 << (31 - Math.clz32(length)) : 0;
44
+ for (let i = 1; i <= length; i++) {
45
+ const state = states[i - 1];
46
+ if (state !== UNMEASURED) {
47
+ const size = sizes[i - 1];
48
+ this._sums[i] += size;
49
+ this._counts[i]++;
50
+ this._measuredCount++;
51
+ this._measuredTotal += size;
52
+ if (state === SAMPLED) {
53
+ this._sampleCount++;
54
+ this._sampleTotal += size;
55
+ }
56
+ }
57
+ const parent = i + (i & -i);
58
+ if (parent <= length) {
59
+ this._sums[parent] += this._sums[i];
60
+ this._counts[parent] += this._counts[i];
61
+ }
62
+ }
49
63
  }
50
- static filled(length, fillSize) {
51
- return SizeTree._build(new Float64Array(length).fill(fillSize), new Uint8Array(length));
64
+ get totalSize() {
65
+ return (this._measuredTotal + (this.length - this._measuredCount) * this.estimate);
52
66
  }
53
- static _build(sizes, measured) {
54
- const tree = new Float64Array(sizes.length + 1);
55
- const total = buildTree(tree, sizes);
56
- return new SizeTree(sizes.length, sizes, tree, total, measured);
67
+ get sampleAverage() {
68
+ return this._sampleCount > 0 ? this._sampleTotal / this._sampleCount : 0;
57
69
  }
58
- get totalSize() {
59
- return this._total;
70
+ isMeasuredBefore(index) {
71
+ let count = 0;
72
+ for (let j = index; j > 0; j -= j & -j) {
73
+ count += this._counts[j];
74
+ }
75
+ return count === index;
60
76
  }
61
77
  prefixSum(i) {
62
78
  let sum = 0;
79
+ let count = 0;
63
80
  for (let j = i; j > 0; j -= j & -j) {
64
- sum += this._tree[j];
81
+ sum += this._sums[j];
82
+ count += this._counts[j];
65
83
  }
66
- return sum;
84
+ return sum + (i - count) * this.estimate;
67
85
  }
68
- update(index, newSize) {
86
+ update(index, size) {
69
87
  if (index < 0 || index >= this.length)
70
88
  return false;
71
- const old = this._sizes[index];
72
- this._measured[index] = 1;
73
- if (old === newSize)
74
- return false;
75
- const delta = newSize - old;
76
- this._sizes[index] = newSize;
77
- this._total += delta;
78
- for (let i = index + 1; i <= this.length; i += i & -i) {
79
- this._tree[i] += delta;
89
+ const state = this._states[index];
90
+ const isNew = state === UNMEASURED;
91
+ const old = isNew ? 0 : this._sizes[index];
92
+ const delta = size - old;
93
+ this._states[index] = SAMPLED;
94
+ this._sizes[index] = size;
95
+ this._measuredTotal += delta;
96
+ this._sampleTotal += state === SAMPLED ? delta : size;
97
+ if (state !== SAMPLED)
98
+ this._sampleCount++;
99
+ if (isNew)
100
+ this._measuredCount++;
101
+ if (isNew || delta !== 0) {
102
+ for (let i = index + 1; i <= this.length; i += i & -i) {
103
+ this._sums[i] += delta;
104
+ if (isNew)
105
+ this._counts[i]++;
106
+ }
80
107
  }
81
- return true;
108
+ return size !== (isNew ? this.estimate : old);
82
109
  }
83
- cloneResized(newLength, fillSize, retainCount = newLength) {
84
- const sizes = new Float64Array(newLength).fill(fillSize);
85
- const measured = new Uint8Array(newLength);
110
+ cloneResized(newLength, retainCount = newLength) {
86
111
  const retained = Math.max(0, Math.min(this.length, newLength, retainCount));
112
+ const sizes = new Float64Array(newLength);
113
+ const states = new Uint8Array(newLength);
87
114
  sizes.set(this._sizes.subarray(0, retained));
88
- measured.set(this._measured.subarray(0, retained));
89
- return SizeTree._build(sizes, measured);
115
+ states.set(this._states.subarray(0, retained));
116
+ return new SizeTree(newLength, this.estimate, sizes, states);
90
117
  }
91
- applyEstimate(estimatedSize) {
92
- let changed = false;
118
+ startSample() {
93
119
  for (let i = 0; i < this.length; i++) {
94
- if (!this._measured[i] && this._sizes[i] !== estimatedSize) {
95
- this._sizes[i] = estimatedSize;
96
- changed = true;
120
+ if (this._states[i] === SAMPLED) {
121
+ this._states[i] = MEASURED;
97
122
  }
98
123
  }
99
- if (!changed)
100
- return false;
101
- this._tree.fill(0);
102
- this._total = buildTree(this._tree, this._sizes);
103
- return true;
124
+ this._sampleCount = 0;
125
+ this._sampleTotal = 0;
104
126
  }
105
127
  findIndexAtOffset(offset) {
106
128
  if (offset <= 0 || this.length === 0)
@@ -109,9 +131,12 @@ class SizeTree {
109
131
  let remaining = offset;
110
132
  for (let bit = this._topBit; bit > 0; bit >>= 1) {
111
133
  const next = idx + bit;
112
- if (next <= this.length && this._tree[next] <= remaining) {
134
+ if (next > this.length)
135
+ continue;
136
+ const size = this._sums[next] + (bit - this._counts[next]) * this.estimate;
137
+ if (size <= remaining) {
113
138
  idx = next;
114
- remaining -= this._tree[idx];
139
+ remaining -= size;
115
140
  }
116
141
  }
117
142
  return Math.min(this.length - 1, idx);
@@ -122,6 +147,8 @@ export class VirtualScrollEngine {
122
147
  this._maxBrowserSize = Number.POSITIVE_INFINITY;
123
148
  this._virtualRatio = 1;
124
149
  this._tree = null;
150
+ this._configuredEstimate = Number.NaN;
151
+ this._hasAdaptedEstimate = false;
125
152
  this.onSizeChange = null;
126
153
  }
127
154
  get totalSize() {
@@ -137,9 +164,13 @@ export class VirtualScrollEngine {
137
164
  resize(length, estimatedSize, retainCount = length) {
138
165
  if (this._tree?.length === length && retainCount >= length)
139
166
  return;
140
- this._tree = this._tree
141
- ? this._tree.cloneResized(length, estimatedSize, retainCount)
142
- : SizeTree.filled(length, estimatedSize);
167
+ const reconfigured = this._configureEstimate(estimatedSize);
168
+ const tree = this._tree?.cloneResized(length, retainCount) ??
169
+ new SizeTree(length, estimatedSize);
170
+ if (reconfigured) {
171
+ tree.estimate = estimatedSize;
172
+ }
173
+ this._tree = tree;
143
174
  this._updateVirtualRatio();
144
175
  this.onSizeChange?.();
145
176
  }
@@ -150,10 +181,18 @@ export class VirtualScrollEngine {
150
181
  this.onSizeChange?.();
151
182
  }
152
183
  updateEstimatedSize(estimatedSize) {
153
- if (!this._tree?.applyEstimate(estimatedSize))
184
+ if (this._configureEstimate(estimatedSize)) {
185
+ this._applyEstimate(estimatedSize);
186
+ }
187
+ }
188
+ adaptEstimate(windowStart) {
189
+ const tree = this._tree;
190
+ if (!tree?.sampleAverage)
154
191
  return;
155
- this._updateVirtualRatio();
156
- this.onSizeChange?.();
192
+ if (this._hasAdaptedEstimate && !tree.isMeasuredBefore(windowStart))
193
+ return;
194
+ this._hasAdaptedEstimate = true;
195
+ this._applyEstimate(tree.sampleAverage);
157
196
  }
158
197
  getScrollOffsetForIndex(index) {
159
198
  if (!this._tree || index <= 0)
@@ -177,6 +216,14 @@ export class VirtualScrollEngine {
177
216
  }
178
217
  return clamp(offset / this._virtualRatio, 0, this._getMaxScrollOffset(viewportSize));
179
218
  }
219
+ resolveScrollOffset(index, scrollPosition, viewportSize, position = 'start') {
220
+ if (position === 'nearest') {
221
+ const start = this.getAlignedScrollOffset(index, viewportSize, 'start');
222
+ const end = this.getAlignedScrollOffset(index, viewportSize, 'end');
223
+ return clamp(scrollPosition, Math.min(start, end), Math.max(start, end));
224
+ }
225
+ return this.getAlignedScrollOffset(index, viewportSize, position === 'center' || position === 'end' ? position : 'start');
226
+ }
180
227
  isIndexInView(index, scrollPosition, viewportSize) {
181
228
  if (!this._tree || this._tree.length === 0)
182
229
  return false;
@@ -208,6 +255,24 @@ export class VirtualScrollEngine {
208
255
  const end = Math.min(Math.max(endIndex + 1, start), this._tree.length);
209
256
  return this._tree.prefixSum(end) - this._tree.prefixSum(start);
210
257
  }
258
+ _configureEstimate(estimatedSize) {
259
+ if (estimatedSize === this._configuredEstimate)
260
+ return false;
261
+ this._configuredEstimate = estimatedSize;
262
+ this._tree?.startSample();
263
+ return true;
264
+ }
265
+ _applyEstimate(estimatedSize) {
266
+ const tree = this._tree;
267
+ if (!tree)
268
+ return;
269
+ const total = tree.totalSize;
270
+ tree.estimate = estimatedSize;
271
+ if (tree.totalSize === total)
272
+ return;
273
+ this._updateVirtualRatio();
274
+ this.onSizeChange?.();
275
+ }
211
276
  _updateVirtualRatio() {
212
277
  const totalSize = this._tree?.totalSize ?? 0;
213
278
  this._virtualRatio =