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,42 +1,33 @@
1
1
  import { type LitElement, type ReactiveController, type ReactiveControllerHost } from 'lit';
2
2
  type InferSlotNames<T> = T extends readonly (infer U)[] ? U : never;
3
- /**
4
- * Additional query options for the slot controller methods.
5
- */
6
3
  type SlotQueryOptions = {
7
4
  /**
8
- * If set to `true`, it returns a sequence of both the elements assigned to the queried slot,
9
- * as well as elements assigned to any other slots that are descendants of this slot. If no
10
- * assigned elements are found, it returns the slot's fallback content.
5
+ * Whether the query also returns the content of the descendant slots.
6
+ * Defaults to `false`.
11
7
  *
12
8
  * @remarks
13
- * Mind that fallback content when checking whether a consumer projected anything:
14
- * for a slot rendered as `<slot>${this.label}</slot>`, a flattened query reports
15
- * the rendered `label` as assigned content even though nothing was projected.
16
- *
17
- * Defaults to `false`.
9
+ * A flattened query also returns fallback content: a slot rendered as
10
+ * `<slot>${this.label}</slot>` reports `label` as assigned content,
11
+ * although the consumer projected nothing.
18
12
  */
19
13
  flatten?: boolean;
20
- /**
21
- * CSS selector used to filter the elements returned.
22
- */
14
+ /** The CSS selector that filters the returned elements. */
23
15
  selector?: string;
24
16
  };
25
17
  type SlotChangeCallback<T> = (parameters: SlotChangeCallbackParameters<T>) => void;
26
18
  type SlotChangeCallbackParameters<T> = {
27
- /** The slot name that has its assigned nodes changed. */
19
+ /** The name of the slot with the changed assigned nodes. */
28
20
  slot: T;
29
- /** `true` if the slot is the default slot. */
30
21
  isDefault: boolean;
31
- /** `true` if the callback handler is called for the initial host update. */
22
+ /** Whether the callback runs for the first host update. */
32
23
  isInitial: boolean;
33
24
  };
34
25
  type SlotControllerOptions<T> = {
35
- /** An iterable collection of slot names to observe. */
26
+ /** The slot names to observe. */
36
27
  slots?: Iterable<T>;
37
- /** Callback function which is invoked a slot's assigned nodes change. */
28
+ /** Callback that runs when the assigned nodes of a slot change. */
38
29
  onChange?: SlotChangeCallback<T>;
39
- /** If set to `true`, the `onChange` callback is invoked once after the host is updated for the first time. */
30
+ /** Whether `onChange` also runs once, after the first host update. */
40
31
  initial?: boolean;
41
32
  };
42
33
  declare const DefaultSlot = "[default]";
@@ -48,58 +39,38 @@ declare class SlotController<T> implements ReactiveController {
48
39
  private _initialized;
49
40
  constructor(host: ReactiveControllerHost & LitElement, options?: SlotControllerOptions<T>);
50
41
  /**
51
- * The query results are cached, since the accessors below are routinely called
52
- * from a host's `render`. Only a still connected slot is served from the cache -
53
- * one removed by a conditional template falls back to a fresh query.
42
+ * Finds the slot element with the given name.
54
43
  *
55
- * There is no slot to find before the host creates its render root, which happens
56
- * when it connects. A query that comes earlier, such as one from an attribute that
57
- * the parser applies on upgrade, reports no slot instead of an error.
44
+ * @remarks
45
+ * The result is cached, because the accessors below run from `render`. The
46
+ * cache serves only a connected slot. A query before the host creates its
47
+ * render root reports no slot and raises no error.
58
48
  */
59
49
  private _getSlot;
60
50
  /**
61
- * Returns an array of the assigned nodes for `slot`.
62
- *
63
- * If `flatten` is set to `true`, it returns a sequence of both the nodes assigned to the queried slot,
64
- * as well as nodes assigned to any other slots that are descendants of this slot. If no
65
- * assigned nodes are found, it returns the slot's fallback content.
51
+ * Returns the nodes assigned to `slot`. See
52
+ * {@link SlotQueryOptions.flatten}.
66
53
  */
67
54
  getAssignedNodes(slot: T, flatten?: boolean): Node[];
68
- /**
69
- * Returns an array of the assigned elements for `slot` with additional `options`.
70
- *
71
- * See {@link SlotQueryOptions.flatten} and {@link SlotQueryOptions.selector} for more information.
72
- */
55
+ /** Returns the elements assigned to `slot`, as `options` selects them. */
73
56
  getAssignedElements<U extends Element>(slot: T, options?: SlotQueryOptions): U[];
74
57
  /**
75
- * Returns the combined text content of the nodes assigned to `slot`,
76
- * trimmed and with consecutive whitespace collapsed.
77
- *
78
- * Useful for deriving an accessible label from projected content.
79
- * See {@link SlotQueryOptions.flatten} for the `flatten` semantics.
58
+ * Returns the text content assigned to `slot`, trimmed and with collapsed
59
+ * whitespace.
80
60
  */
81
61
  getAssignedText(slot: T, flatten?: boolean): string;
82
62
  /**
83
- * Return whether `slot` has assigned nodes.
84
- *
85
- * If `flatten` is set to `true`, it returns a sequence of both the nodes assigned to the queried slot,
86
- * as well as nodes assigned to any other slots that are descendants of this slot. If no
87
- * assigned nodes are found, it returns the slot's fallback content - so a slot with
88
- * fallback content always reports as having nodes. See {@link SlotQueryOptions.flatten}.
63
+ * Whether `slot` has assigned nodes. A flattened query counts fallback
64
+ * content, so a slot with fallback always reports nodes.
89
65
  */
90
66
  hasAssignedNodes(slot: T, flatten?: boolean): boolean;
91
- /**
92
- * Return whether `slot` has assigned elements accepting additional `options`.
93
- *
94
- * See {@link SlotQueryOptions.flatten} and {@link SlotQueryOptions.selector} for more information.
95
- */
67
+ /** Whether `slot` has assigned elements, as `options` selects them. */
96
68
  hasAssignedElements(slot: T, options?: SlotQueryOptions): boolean;
97
69
  /** @internal */
98
- handleEvent(event: Event): void;
99
- /** @internal */
100
70
  hostConnected(): void;
101
71
  /** @internal */
102
72
  hostDisconnected(): void;
73
+ handleEvent(event: Event): void;
103
74
  /** @internal */
104
75
  hostUpdated(): void;
105
76
  }
@@ -50,6 +50,12 @@ class SlotController {
50
50
  hasAssignedElements(slot, options) {
51
51
  return !isEmpty(this.getAssignedElements(slot, options));
52
52
  }
53
+ hostConnected() {
54
+ this._host.renderRoot.addEventListener('slotchange', this);
55
+ }
56
+ hostDisconnected() {
57
+ this._host.renderRoot.removeEventListener('slotchange', this);
58
+ }
53
59
  handleEvent(event) {
54
60
  const slot = event.target;
55
61
  const name = slot.name;
@@ -64,12 +70,6 @@ class SlotController {
64
70
  this._host.requestUpdate();
65
71
  }
66
72
  }
67
- hostConnected() {
68
- this._host.renderRoot.addEventListener('slotchange', this);
69
- }
70
- hostDisconnected() {
71
- this._host.renderRoot.removeEventListener('slotchange', this);
72
- }
73
73
  hostUpdated() {
74
74
  if (!this._initialized && this._options.initial) {
75
75
  this._initialized = true;
@@ -1 +1 @@
1
- {"version":3,"file":"slot.js","sourceRoot":"","sources":["../../../src/internals/controllers/slot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,GAIT,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAiDxD,MAAM,WAAW,GAAG,WAAW,CAAC;AAEhC,MAAM,cAAc;IAOlB,YACE,IAAyC,EACzC,OAAkC;QALnB,eAAU,GAAG,IAAI,GAAG,EAAkC,CAAC;QAChE,iBAAY,GAAG,KAAK,CAAC;QAM3B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC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ACjB,CAAC,CAAC;YACH,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QAC7B,CAAC;IACH,CAAC;IAGM,aAAa;QAClB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAC7D,CAAC;IAGM,gBAAgB;QACrB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAChE,CAAC;IAGM,WAAW;QAChB,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YAChD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;gBACvC,IAAI,EAAE,WAAgB;gBACtB,SAAS,EAAE,KAAK;gBAChB,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAED,SAAS,iBAAiB,CACxB,IAA4B,EAC5B,OAEC;IAED,OAAO,IAAI,cAAc,CAAC,IAA2C,EAAE;QACrE,GAAG,OAAO;QACV,KAAK,EAAE,OAAO,EAAE,KAAoC;KACrD,CAAC,CAAC;AACL,CAAC;AAED,SAAS,QAAQ,CAAoC,GAAG,KAAQ;IAC9D,OAAO,CAAC,WAAW,EAAE,GAAG,KAAK,CAAU,CAAC;AAC1C,CAAC;AAUD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import {\n isServer,\n type LitElement,\n type ReactiveController,\n type ReactiveControllerHost,\n} from 'lit';\nimport { isEmpty } from '../utils/arrays.js';\nimport { normalizedTextContent } from '../utils/dom.js';\n\ntype InferSlotNames<T> = T extends readonly (infer U)[] ? U : never;\n\n/**\n * Additional query options for the slot controller methods.\n */\ntype SlotQueryOptions = {\n /**\n * If set to `true`, it returns a sequence of both the elements assigned to the queried slot,\n * as well as elements assigned to any other slots that are descendants of this slot. If no\n * assigned elements are found, it returns the slot's fallback content.\n *\n * @remarks\n * Mind that fallback content when checking whether a consumer projected anything:\n * for a slot rendered as `<slot>${this.label}</slot>`, a flattened query reports\n * the rendered `label` as assigned content even though nothing was projected.\n *\n * Defaults to `false`.\n */\n flatten?: boolean;\n /**\n * CSS selector used to filter the elements returned.\n */\n selector?: string;\n};\n\ntype SlotChangeCallback<T> = (\n parameters: SlotChangeCallbackParameters<T>\n) => void;\n\ntype SlotChangeCallbackParameters<T> = {\n /** The slot name that has its assigned nodes changed. */\n slot: T;\n /** `true` if the slot is the default slot. */\n isDefault: boolean;\n /** `true` if the callback handler is called for the initial host update. */\n isInitial: boolean;\n};\n\ntype SlotControllerOptions<T> = {\n /** An iterable collection of slot names to observe. */\n slots?: Iterable<T>;\n /** Callback function which is invoked a slot's assigned nodes change. */\n onChange?: SlotChangeCallback<T>;\n /** If set to `true`, the `onChange` callback is invoked once after the host is updated for the first time. */\n initial?: boolean;\n};\n\nconst DefaultSlot = '[default]';\n\nclass SlotController<T> implements ReactiveController {\n private readonly _host: ReactiveControllerHost & LitElement;\n private readonly _options: SlotControllerOptions<T>;\n private readonly _slots?: Set<T>;\n private readonly _slotCache = new Map<T | undefined, HTMLSlotElement>();\n private _initialized = false;\n\n constructor(\n host: ReactiveControllerHost & LitElement,\n options?: SlotControllerOptions<T>\n ) {\n this._host = host;\n this._host.addController(this);\n\n this._options = { ...options };\n this._slots = options?.slots ? new Set(options.slots) : undefined;\n }\n\n /**\n * The query results are cached, since the accessors below are routinely called\n * from a host's `render`. Only a still connected slot is served from the cache -\n * one removed by a conditional template falls back to a fresh query.\n *\n * There is no slot to find before the host creates its render root, which happens\n * when it connects. A query that comes earlier, such as one from an attribute that\n * the parser applies on upgrade, reports no slot instead of an error.\n */\n private _getSlot(slotName?: T): HTMLSlotElement | null {\n if (isServer) return null;\n\n const cached = this._slotCache.get(slotName);\n\n if (cached?.isConnected) {\n return cached;\n }\n\n const selector =\n slotName === DefaultSlot\n ? 'slot:not([name])'\n : `slot[name=\"${slotName}\"]`;\n const slot =\n this._host.renderRoot?.querySelector<HTMLSlotElement>(selector) ?? null;\n\n if (slot) {\n this._slotCache.set(slotName, slot);\n } else {\n this._slotCache.delete(slotName);\n }\n\n return slot;\n }\n\n /**\n * Returns an array of the assigned nodes for `slot`.\n *\n * If `flatten` is set to `true`, it returns a sequence of both the nodes assigned to the queried slot,\n * as well as nodes assigned to any other slots that are descendants of this slot. If no\n * assigned nodes are found, it returns the slot's fallback content.\n */\n public getAssignedNodes(slot: T, flatten = false): Node[] {\n return this._getSlot(slot)?.assignedNodes({ flatten }) ?? [];\n }\n\n /**\n * Returns an array of the assigned elements for `slot` with additional `options`.\n *\n * See {@link SlotQueryOptions.flatten} and {@link SlotQueryOptions.selector} for more information.\n */\n public getAssignedElements<U extends Element>(\n slot: T,\n options?: SlotQueryOptions\n ): U[] {\n const elements =\n (this._getSlot(slot)?.assignedElements({\n flatten: options?.flatten,\n }) as U[]) ?? [];\n\n return options?.selector\n ? elements.filter((e) => e.matches(options.selector!))\n : elements;\n }\n\n /**\n * Returns the combined text content of the nodes assigned to `slot`,\n * trimmed and with consecutive whitespace collapsed.\n *\n * Useful for deriving an accessible label from projected content.\n * See {@link SlotQueryOptions.flatten} for the `flatten` semantics.\n */\n public getAssignedText(slot: T, flatten = false): string {\n return normalizedTextContent(this.getAssignedNodes(slot, flatten));\n }\n\n /**\n * Return whether `slot` has assigned nodes.\n *\n * If `flatten` is set to `true`, it returns a sequence of both the nodes assigned to the queried slot,\n * as well as nodes assigned to any other slots that are descendants of this slot. If no\n * assigned nodes are found, it returns the slot's fallback content - so a slot with\n * fallback content always reports as having nodes. See {@link SlotQueryOptions.flatten}.\n */\n public hasAssignedNodes(slot: T, flatten = false): boolean {\n return !isEmpty(this.getAssignedNodes(slot, flatten));\n }\n\n /**\n * Return whether `slot` has assigned elements accepting additional `options`.\n *\n * See {@link SlotQueryOptions.flatten} and {@link SlotQueryOptions.selector} for more information.\n */\n public hasAssignedElements(slot: T, options?: SlotQueryOptions): boolean {\n return !isEmpty(this.getAssignedElements(slot, options));\n }\n\n /** @internal */\n public handleEvent(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n const name = slot.name as T;\n const isDefault = name === '';\n const observed = isDefault ? (DefaultSlot as T) : name;\n\n if (!this._slots || this._slots.has(observed)) {\n this._options.onChange?.call(this._host, {\n slot: name,\n isDefault,\n isInitial: false,\n });\n this._host.requestUpdate();\n }\n }\n\n /** @internal */\n public hostConnected(): void {\n this._host.renderRoot.addEventListener('slotchange', this);\n }\n\n /** @internal */\n public hostDisconnected(): void {\n this._host.renderRoot.removeEventListener('slotchange', this);\n }\n\n /** @internal */\n public hostUpdated(): void {\n if (!this._initialized && this._options.initial) {\n this._initialized = true;\n this._options.onChange?.call(this._host, {\n slot: '<initial>' as T,\n isDefault: false,\n isInitial: true,\n });\n }\n }\n}\n\nfunction addSlotController<K extends readonly string[]>(\n host: ReactiveControllerHost,\n options?: SlotControllerOptions<InferSlotNames<K>> & {\n slots?: K;\n }\n): SlotController<InferSlotNames<K>> {\n return new SlotController(host as ReactiveControllerHost & LitElement, {\n ...options,\n slots: options?.slots as Iterable<InferSlotNames<K>>,\n });\n}\n\nfunction setSlots<const T extends readonly string[]>(...slots: T) {\n return [DefaultSlot, ...slots] as const;\n}\n\nexport type {\n InferSlotNames,\n SlotChangeCallback,\n SlotChangeCallbackParameters,\n SlotController,\n SlotControllerOptions,\n SlotQueryOptions,\n};\nexport { addSlotController, DefaultSlot, setSlots };\n"]}
1
+ {"version":3,"file":"slot.js","sourceRoot":"","sources":["../../../src/internals/controllers/slot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,GAIT,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;A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import {\n isServer,\n type LitElement,\n type ReactiveController,\n type ReactiveControllerHost,\n} from 'lit';\nimport { isEmpty } from '../utils/arrays.js';\nimport { normalizedTextContent } from '../utils/dom.js';\n\ntype InferSlotNames<T> = T extends readonly (infer U)[] ? U : never;\n\ntype SlotQueryOptions = {\n /**\n * Whether the query also returns the content of the descendant slots.\n * Defaults to `false`.\n *\n * @remarks\n * A flattened query also returns fallback content: a slot rendered as\n * `<slot>${this.label}</slot>` reports `label` as assigned content,\n * although the consumer projected nothing.\n */\n flatten?: boolean;\n /** The CSS selector that filters the returned elements. */\n selector?: string;\n};\n\ntype SlotChangeCallback<T> = (\n parameters: SlotChangeCallbackParameters<T>\n) => void;\n\ntype SlotChangeCallbackParameters<T> = {\n /** The name of the slot with the changed assigned nodes. */\n slot: T;\n isDefault: boolean;\n /** Whether the callback runs for the first host update. */\n isInitial: boolean;\n};\n\ntype SlotControllerOptions<T> = {\n /** The slot names to observe. */\n slots?: Iterable<T>;\n /** Callback that runs when the assigned nodes of a slot change. */\n onChange?: SlotChangeCallback<T>;\n /** Whether `onChange` also runs once, after the first host update. */\n initial?: boolean;\n};\n\nconst DefaultSlot = '[default]';\n\nclass SlotController<T> implements ReactiveController {\n private readonly _host: ReactiveControllerHost & LitElement;\n private readonly _options: SlotControllerOptions<T>;\n private readonly _slots?: Set<T>;\n private readonly _slotCache = new Map<T | undefined, HTMLSlotElement>();\n private _initialized = false;\n\n constructor(\n host: ReactiveControllerHost & LitElement,\n options?: SlotControllerOptions<T>\n ) {\n this._host = host;\n this._host.addController(this);\n\n this._options = { ...options };\n this._slots = options?.slots ? new Set(options.slots) : undefined;\n }\n\n /**\n * Finds the slot element with the given name.\n *\n * @remarks\n * The result is cached, because the accessors below run from `render`. The\n * cache serves only a connected slot. A query before the host creates its\n * render root reports no slot and raises no error.\n */\n private _getSlot(slotName?: T): HTMLSlotElement | null {\n if (isServer) return null;\n\n const cached = this._slotCache.get(slotName);\n\n if (cached?.isConnected) {\n return cached;\n }\n\n const selector =\n slotName === DefaultSlot\n ? 'slot:not([name])'\n : `slot[name=\"${slotName}\"]`;\n const slot =\n this._host.renderRoot?.querySelector<HTMLSlotElement>(selector) ?? null;\n\n if (slot) {\n this._slotCache.set(slotName, slot);\n } else {\n this._slotCache.delete(slotName);\n }\n\n return slot;\n }\n\n /**\n * Returns the nodes assigned to `slot`. See\n * {@link SlotQueryOptions.flatten}.\n */\n public getAssignedNodes(slot: T, flatten = false): Node[] {\n return this._getSlot(slot)?.assignedNodes({ flatten }) ?? [];\n }\n\n /** Returns the elements assigned to `slot`, as `options` selects them. */\n public getAssignedElements<U extends Element>(\n slot: T,\n options?: SlotQueryOptions\n ): U[] {\n const elements =\n (this._getSlot(slot)?.assignedElements({\n flatten: options?.flatten,\n }) as U[]) ?? [];\n\n return options?.selector\n ? elements.filter((e) => e.matches(options.selector!))\n : elements;\n }\n\n /**\n * Returns the text content assigned to `slot`, trimmed and with collapsed\n * whitespace.\n */\n public getAssignedText(slot: T, flatten = false): string {\n return normalizedTextContent(this.getAssignedNodes(slot, flatten));\n }\n\n /**\n * Whether `slot` has assigned nodes. A flattened query counts fallback\n * content, so a slot with fallback always reports nodes.\n */\n public hasAssignedNodes(slot: T, flatten = false): boolean {\n return !isEmpty(this.getAssignedNodes(slot, flatten));\n }\n\n /** Whether `slot` has assigned elements, as `options` selects them. */\n public hasAssignedElements(slot: T, options?: SlotQueryOptions): boolean {\n return !isEmpty(this.getAssignedElements(slot, options));\n }\n\n /** @internal */\n public hostConnected(): void {\n this._host.renderRoot.addEventListener('slotchange', this);\n }\n\n /** @internal */\n public hostDisconnected(): void {\n this._host.renderRoot.removeEventListener('slotchange', this);\n }\n\n public handleEvent(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n const name = slot.name as T;\n const isDefault = name === '';\n const observed = isDefault ? (DefaultSlot as T) : name;\n\n if (!this._slots || this._slots.has(observed)) {\n this._options.onChange?.call(this._host, {\n slot: name,\n isDefault,\n isInitial: false,\n });\n this._host.requestUpdate();\n }\n }\n\n /** @internal */\n public hostUpdated(): void {\n if (!this._initialized && this._options.initial) {\n this._initialized = true;\n this._options.onChange?.call(this._host, {\n slot: '<initial>' as T,\n isDefault: false,\n isInitial: true,\n });\n }\n }\n}\n\nfunction addSlotController<K extends readonly string[]>(\n host: ReactiveControllerHost,\n options?: SlotControllerOptions<InferSlotNames<K>> & {\n slots?: K;\n }\n): SlotController<InferSlotNames<K>> {\n return new SlotController(host as ReactiveControllerHost & LitElement, {\n ...options,\n slots: options?.slots as Iterable<InferSlotNames<K>>,\n });\n}\n\nfunction setSlots<const T extends readonly string[]>(...slots: T) {\n return [DefaultSlot, ...slots] as const;\n}\n\nexport type {\n InferSlotNames,\n SlotChangeCallback,\n SlotChangeCallbackParameters,\n SlotController,\n SlotControllerOptions,\n SlotQueryOptions,\n};\nexport { addSlotController, DefaultSlot, setSlots };\n"]}
@@ -1,96 +1,92 @@
1
1
  import type { LitElement } from 'lit';
2
2
  /**
3
- * The events emitted by a {@link ToggleController}.
4
- *
5
- * Include (a subset of) these in a host's event map to document them.
3
+ * The events that a {@link ToggleController} sends. Include them, or a subset
4
+ * of them, in the event map of a host to document them.
6
5
  */
7
6
  export interface ToggleEventMap {
8
- /** Emitted before opening. Cancelable - preventing it aborts the sequence. */
7
+ /** Sent before an open. Cancelable; a prevented event stops the sequence. */
9
8
  igcOpening: CustomEvent<unknown>;
10
- /** Emitted after the host has opened and its transition has completed. */
9
+ /** Sent after the host opens and its transition ends. */
11
10
  igcOpened: CustomEvent<unknown>;
12
- /** Emitted before closing. Cancelable - preventing it aborts the sequence. */
11
+ /** Sent before a close. Cancelable; a prevented event stops the sequence. */
13
12
  igcClosing: CustomEvent<unknown>;
14
- /** Emitted after the host has closed and its transition has completed. */
13
+ /** Sent after the host closes and its transition ends. */
15
14
  igcClosed: CustomEvent<unknown>;
16
15
  }
17
16
  /**
18
- * A toggleable host must expose the event-emitter mixin's `emitEvent` -
19
- * extend {@link ../mixins/event-emitter.js#EventEmitterMixin | EventEmitterMixin}
20
- * with (a subset of) the {@link ToggleEventMap}.
17
+ * A toggleable host must give the `emitEvent` method of the event-emitter
18
+ * mixin. Extend {@link ../mixins/event-emitter.js#EventEmitterMixin | EventEmitterMixin}
19
+ * with the {@link ToggleEventMap}, or with a subset of it.
21
20
  */
22
21
  type ToggleHost = LitElement & {
23
22
  open: boolean;
24
23
  emitEvent(name: string, init?: CustomEventInit): boolean;
25
24
  };
26
25
  /**
27
- * Runs the host's visual transition to the requested state - flipping `open`,
28
- * playing animations, awaiting updates - in whatever order the host needs.
29
- *
30
- * Resolving `false` marks the transition as superseded (an animation was
31
- * interrupted by a newer one), which skips the trailing "-ed" event.
26
+ * Runs the visual transition of the host to the requested state: it sets
27
+ * `open`, plays the animations and awaits the updates. A resolved `false`
28
+ * marks the transition as superseded, for example by a newer animation, and
29
+ * the controller then sends no trailing "-ed" event.
32
30
  */
33
31
  type ToggleTransitionFunction = (open: boolean) => Promise<boolean> | boolean;
34
32
  type ToggleControllerOptions = {
35
33
  /**
36
- * The host transition. When omitted, the controller flips `host.open` itself
37
- * and the transition always counts as completed.
34
+ * The host transition. Without one, the controller sets `host.open` itself
35
+ * and the transition always counts as complete.
38
36
  */
39
37
  transition?: ToggleTransitionFunction;
40
- /** Factory for the `detail` payload of the emitted events. */
38
+ /** The factory for the `detail` payload of the events. */
41
39
  detail?: () => unknown;
42
40
  };
43
41
  /**
44
- * Implements the open/close choreography shared by every toggleable component:
45
- *
46
- * 1. Bail when the host is already in the requested state.
47
- * 2. When emitting, fire the cancelable `igcOpening`/`igcClosing` event and
48
- * bail if the consumer prevented it.
49
- * 3. Run the host transition.
50
- * 4. When emitting and the transition completed, await the host update and
51
- * fire the `igcOpened`/`igcClosed` event.
42
+ * Implements the open and close sequence of every toggleable component.
52
43
  *
53
- * The host keeps its public `open` property, `show()`/`hide()`/`toggle()`
54
- * methods and event documentation, and delegates to the controller.
44
+ * @remarks
45
+ * The sequence stops when the host is already in the requested state, sends
46
+ * the cancelable `igcOpening` or `igcClosing` event, runs the host
47
+ * transition, awaits the host update, then sends `igcOpened` or `igcClosed`.
48
+ * The events run only when the caller asks for them.
55
49
  *
56
- * Unlike the other controllers of this directory it is not registered with the
57
- * host - it drives the host on demand and has no life-cycle of its own.
50
+ * The host keeps its public `open`, `show()`, `hide()` and `toggle()` members
51
+ * and delegates to the controller. Unlike the other controllers here, the
52
+ * host does not register it; it has no life-cycle of its own.
58
53
  */
59
54
  declare class ToggleController {
60
55
  private readonly _host;
61
56
  private readonly _options;
62
- /** The target of an in-flight operation - a transition may flip `host.open` only at its end. */
57
+ /**
58
+ * The target of an operation in flight. A transition can set `host.open` at
59
+ * its end only.
60
+ */
63
61
  private _pending?;
64
- /** Bumped per operation, so a superseded one can bail out instead of finishing. */
62
+ /** Incremented per operation. A superseded operation stops. */
65
63
  private _generation;
66
64
  constructor(host: ToggleHost, options?: ToggleControllerOptions);
67
65
  /**
68
- * Events go through the host's `emitEvent` - it is the choke point
69
- * consumers and framework wrappers observe.
66
+ * Sends the event through the host `emitEvent`. Consumers and framework
67
+ * wrappers observe that one method.
70
68
  */
71
69
  private _emit;
72
70
  private _setOpenState;
73
71
  /**
74
- * Opens the host. When `emitEvents` is true, wraps the transition in
75
- * `igcOpening`/`igcOpened` events.
76
- *
77
- * Returns `false` when the host was already open (or heading there), the
78
- * opening event was canceled, or the operation was superseded - either by the
79
- * transition reporting itself interrupted or by a newer request.
72
+ * Opens the host, wrapped in the `igcOpening` and `igcOpened` events when
73
+ * `emitEvents` is true. Returns `false` when the host is already open or
74
+ * moves there, when the consumer canceled the opening event, when a later
75
+ * request supersedes this one, or when the transition reports an
76
+ * interruption.
80
77
  */
81
78
  show(emitEvents?: boolean): Promise<boolean>;
82
79
  /**
83
- * Closes the host. When `emitEvents` is true, wraps the transition in
84
- * `igcClosing`/`igcClosed` events.
85
- *
86
- * Returns `false` when the host was already closed (or heading there), the
87
- * closing event was canceled, or the operation was superseded - either by the
88
- * transition reporting itself interrupted or by a newer request.
80
+ * Closes the host, wrapped in the `igcClosing` and `igcClosed` events when
81
+ * `emitEvents` is true. Returns `false` when the host is already closed or
82
+ * moves there, when the consumer canceled the closing event, when a later
83
+ * request supersedes this one, or when the transition reports an
84
+ * interruption.
89
85
  */
90
86
  hide(emitEvents?: boolean): Promise<boolean>;
91
- /** Opens or closes the host based on its current state. */
87
+ /** Opens the host, or closes it, based on its current state. */
92
88
  toggle(emitEvents?: boolean): Promise<boolean>;
93
89
  }
94
- /** Creates and adds a {@link ToggleController} to the given host. */
90
+ /** Creates a {@link ToggleController} for the given host. */
95
91
  export declare function addToggleController(host: ToggleHost, options?: ToggleControllerOptions): ToggleController;
96
92
  export type { ToggleController, ToggleControllerOptions, ToggleHost };
@@ -1 +1 @@
1
- {"version":3,"file":"toggle.js","sourceRoot":"","sources":["../../../src/internals/controllers/toggle.ts"],"names":[],"mappings":"AA+DA,MAAM,gBAAgB;IAUpB,YAAY,IAAgB,EAAE,OAAiC;QAFvD,gBAAW,GAAG,CAAC,CAAC;QAGtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;IACjC,CAAC;IAMO,KAAK,CAAC,IAA0B,EAAE,UAAmB;QAC3D,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAIhD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE;YAC1B,GAAG,CAAC,UAAU,IAAI,EAAE,UAAU,EAAE,CAAC;YACjC,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,aAAa,CACzB,IAAa,EACb,UAAmB;QAEnB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,M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,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAiBM,IAAI,CAAC,UAAU,GAAG,KAAK;QAC5B,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC9C,CAAC;IAUM,IAAI,CAAC,UAAU,GAAG,KAAK;QAC5B,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC/C,CAAC;IAGM,MAAM,CAAC,UAAU,GAAG,KAAK;QAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzE,CAAC;CACF;AAGD,MAAM,UAAU,mBAAmB,CACjC,IAAgB,EAChB,OAAiC;IAEjC,OAAO,IAAI,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import type { LitElement } from 'lit';\n\n/**\n * The events emitted by a {@link ToggleController}.\n *\n * Include (a subset of) these in a host's event map to document them.\n */\nexport interface ToggleEventMap {\n /** Emitted before opening. Cancelable - preventing it aborts the sequence. */\n igcOpening: CustomEvent<unknown>;\n /** Emitted after the host has opened and its transition has completed. */\n igcOpened: CustomEvent<unknown>;\n /** Emitted before closing. Cancelable - preventing it aborts the sequence. */\n igcClosing: CustomEvent<unknown>;\n /** Emitted after the host has closed and its transition has completed. */\n igcClosed: CustomEvent<unknown>;\n}\n\n/**\n * A toggleable host must expose the event-emitter mixin's `emitEvent` -\n * extend {@link ../mixins/event-emitter.js#EventEmitterMixin | EventEmitterMixin}\n * with (a subset of) the {@link ToggleEventMap}.\n */\ntype ToggleHost = LitElement & {\n open: boolean;\n emitEvent(name: string, init?: CustomEventInit): boolean;\n};\n\n/**\n * Runs the host's visual transition to the requested state - flipping `open`,\n * playing animations, awaiting updates - in whatever order the host needs.\n *\n * Resolving `false` marks the transition as superseded (an animation was\n * interrupted by a newer one), which skips the trailing \"-ed\" event.\n */\ntype ToggleTransitionFunction = (open: boolean) => Promise<boolean> | boolean;\n\ntype ToggleControllerOptions = {\n /**\n * The host transition. When omitted, the controller flips `host.open` itself\n * and the transition always counts as completed.\n */\n transition?: ToggleTransitionFunction;\n /** Factory for the `detail` payload of the emitted events. */\n detail?: () => unknown;\n};\n\n/**\n * Implements the open/close choreography shared by every toggleable component:\n *\n * 1. Bail when the host is already in the requested state.\n * 2. When emitting, fire the cancelable `igcOpening`/`igcClosing` event and\n * bail if the consumer prevented it.\n * 3. Run the host transition.\n * 4. When emitting and the transition completed, await the host update and\n * fire the `igcOpened`/`igcClosed` event.\n *\n * The host keeps its public `open` property, `show()`/`hide()`/`toggle()`\n * methods and event documentation, and delegates to the controller.\n *\n * Unlike the other controllers of this directory it is not registered with the\n * host - it drives the host on demand and has no life-cycle of its own.\n */\nclass ToggleController {\n private readonly _host: ToggleHost;\n private readonly _options: ToggleControllerOptions;\n\n /** The target of an in-flight operation - a transition may flip `host.open` only at its end. */\n private _pending?: boolean;\n\n /** Bumped per operation, so a superseded one can bail out instead of finishing. */\n private _generation = 0;\n\n constructor(host: ToggleHost, options?: ToggleControllerOptions) {\n this._host = host;\n this._options = { ...options };\n }\n\n /**\n * Events go through the host's `emitEvent` - it is the choke point\n * consumers and framework wrappers observe.\n */\n private _emit(name: keyof ToggleEventMap, cancelable: boolean): boolean {\n const host = this._host;\n const detail = this._options.detail?.call(host);\n\n // Both keys are omitted rather than passed as falsy, so that `emitEvent`\n // applies its own defaults and the init of a plain event stays empty.\n return host.emitEvent(name, {\n ...(cancelable && { cancelable }),\n ...(detail !== undefined && { detail }),\n });\n }\n\n private async _setOpenState(\n open: boolean,\n emitEvents: boolean\n ): Promise<boolean> {\n const host = this._host;\n const { transition } = this._options;\n\n if ((this._pending ?? host.open) === open) {\n return false;\n }\n\n if (emitEvents && !this._emit(open ? 'igcOpening' : 'igcClosing', true)) {\n return false;\n }\n\n const generation = ++this._generation;\n this._pending = open;\n\n // The default transition runs synchronously so the state flip - and the\n // `updateComplete` subscription below - happen within the caller's own\n // microtask, exactly as if the host had flipped the property itself.\n let completed = true;\n try {\n if (transition) {\n completed = (await transition.call(host, open)) !== false;\n } else {\n host.open = open;\n }\n } finally {\n // A newer operation owns the pending state from here on.\n if (generation === this._generation) {\n this._pending = undefined;\n }\n }\n\n if (generation !== this._generation) {\n return false;\n }\n\n if (emitEvents && completed) {\n await host.updateComplete;\n\n // A newer operation may have taken over while the update settled.\n if (generation !== this._generation) {\n return false;\n }\n\n this._emit(open ? 'igcOpened' : 'igcClosed', false);\n }\n\n return completed;\n }\n\n /*\n * The methods below deliberately return the underlying promise instead of\n * being `async` - every `async` wrapper that returns a promise costs extra\n * microtask hops on resolution, which shifts the timing of caller code\n * (e.g. focus management) relative to `updateComplete` subscribers.\n */\n\n /**\n * Opens the host. When `emitEvents` is true, wraps the transition in\n * `igcOpening`/`igcOpened` events.\n *\n * Returns `false` when the host was already open (or heading there), the\n * opening event was canceled, or the operation was superseded - either by the\n * transition reporting itself interrupted or by a newer request.\n */\n public show(emitEvents = false): Promise<boolean> {\n return this._setOpenState(true, emitEvents);\n }\n\n /**\n * Closes the host. When `emitEvents` is true, wraps the transition in\n * `igcClosing`/`igcClosed` events.\n *\n * Returns `false` when the host was already closed (or heading there), the\n * closing event was canceled, or the operation was superseded - either by the\n * transition reporting itself interrupted or by a newer request.\n */\n public hide(emitEvents = false): Promise<boolean> {\n return this._setOpenState(false, emitEvents);\n }\n\n /** Opens or closes the host based on its current state. */\n public toggle(emitEvents = false): Promise<boolean> {\n return this._host.open ? this.hide(emitEvents) : this.show(emitEvents);\n }\n}\n\n/** Creates and adds a {@link ToggleController} to the given host. */\nexport function addToggleController(\n host: ToggleHost,\n options?: ToggleControllerOptions\n): ToggleController {\n return new ToggleController(host, options);\n}\n\nexport type { ToggleController, ToggleControllerOptions, ToggleHost };\n"]}
1
+ {"version":3,"file":"toggle.js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MAAM,UAAU,mBAAmB,CACjC,IAAgB,EAChB,OAAiC;IAEjC,OAAO,IAAI,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import type { LitElement } from 'lit';\n\n/**\n * The events that a {@link ToggleController} sends. Include them, or a subset\n * of them, in the event map of a host to document them.\n */\nexport interface ToggleEventMap {\n /** Sent before an open. Cancelable; a prevented event stops the sequence. */\n igcOpening: CustomEvent<unknown>;\n /** Sent after the host opens and its transition ends. */\n igcOpened: CustomEvent<unknown>;\n /** Sent before a close. Cancelable; a prevented event stops the sequence. */\n igcClosing: CustomEvent<unknown>;\n /** Sent after the host closes and its transition ends. */\n igcClosed: CustomEvent<unknown>;\n}\n\n/**\n * A toggleable host must give the `emitEvent` method of the event-emitter\n * mixin. Extend {@link ../mixins/event-emitter.js#EventEmitterMixin | EventEmitterMixin}\n * with the {@link ToggleEventMap}, or with a subset of it.\n */\ntype ToggleHost = LitElement & {\n open: boolean;\n emitEvent(name: string, init?: CustomEventInit): boolean;\n};\n\n/**\n * Runs the visual transition of the host to the requested state: it sets\n * `open`, plays the animations and awaits the updates. A resolved `false`\n * marks the transition as superseded, for example by a newer animation, and\n * the controller then sends no trailing \"-ed\" event.\n */\ntype ToggleTransitionFunction = (open: boolean) => Promise<boolean> | boolean;\n\ntype ToggleControllerOptions = {\n /**\n * The host transition. Without one, the controller sets `host.open` itself\n * and the transition always counts as complete.\n */\n transition?: ToggleTransitionFunction;\n /** The factory for the `detail` payload of the events. */\n detail?: () => unknown;\n};\n\n/**\n * Implements the open and close sequence of every toggleable component.\n *\n * @remarks\n * The sequence stops when the host is already in the requested state, sends\n * the cancelable `igcOpening` or `igcClosing` event, runs the host\n * transition, awaits the host update, then sends `igcOpened` or `igcClosed`.\n * The events run only when the caller asks for them.\n *\n * The host keeps its public `open`, `show()`, `hide()` and `toggle()` members\n * and delegates to the controller. Unlike the other controllers here, the\n * host does not register it; it has no life-cycle of its own.\n */\nclass ToggleController {\n private readonly _host: ToggleHost;\n private readonly _options: ToggleControllerOptions;\n\n /**\n * The target of an operation in flight. A transition can set `host.open` at\n * its end only.\n */\n private _pending?: boolean;\n\n /** Incremented per operation. A superseded operation stops. */\n private _generation = 0;\n\n constructor(host: ToggleHost, options?: ToggleControllerOptions) {\n this._host = host;\n this._options = { ...options };\n }\n\n /**\n * Sends the event through the host `emitEvent`. Consumers and framework\n * wrappers observe that one method.\n */\n private _emit(name: keyof ToggleEventMap, cancelable: boolean): boolean {\n const host = this._host;\n const detail = this._options.detail?.call(host);\n\n // The init omits both keys instead of a falsy value. `emitEvent` then\n // applies its own defaults, and the init of a plain event stays empty.\n return host.emitEvent(name, {\n ...(cancelable && { cancelable }),\n ...(detail !== undefined && { detail }),\n });\n }\n\n private async _setOpenState(\n open: boolean,\n emitEvents: boolean\n ): Promise<boolean> {\n const host = this._host;\n const { transition } = this._options;\n\n if ((this._pending ?? host.open) === open) {\n return false;\n }\n\n if (emitEvents && !this._emit(open ? 'igcOpening' : 'igcClosing', true)) {\n return false;\n }\n\n const generation = ++this._generation;\n this._pending = open;\n\n // The default transition is synchronous, so the state change and the\n // `updateComplete` subscription stay in the microtask of the caller.\n let completed = true;\n try {\n if (transition) {\n completed = (await transition.call(host, open)) !== false;\n } else {\n host.open = open;\n }\n } finally {\n // A newer operation owns the pending state from here on.\n if (generation === this._generation) {\n this._pending = undefined;\n }\n }\n\n if (generation !== this._generation) {\n return false;\n }\n\n if (emitEvents && completed) {\n await host.updateComplete;\n\n // A newer operation can take over while the update settles.\n if (generation !== this._generation) {\n return false;\n }\n\n this._emit(open ? 'igcOpened' : 'igcClosed', false);\n }\n\n return completed;\n }\n\n /*\n * The methods below return the underlying promise instead of being `async`.\n * An `async` wrapper costs extra microtask hops, which shift the timing of\n * caller code, for example focus management, against `updateComplete`.\n */\n\n /**\n * Opens the host, wrapped in the `igcOpening` and `igcOpened` events when\n * `emitEvents` is true. Returns `false` when the host is already open or\n * moves there, when the consumer canceled the opening event, when a later\n * request supersedes this one, or when the transition reports an\n * interruption.\n */\n public show(emitEvents = false): Promise<boolean> {\n return this._setOpenState(true, emitEvents);\n }\n\n /**\n * Closes the host, wrapped in the `igcClosing` and `igcClosed` events when\n * `emitEvents` is true. Returns `false` when the host is already closed or\n * moves there, when the consumer canceled the closing event, when a later\n * request supersedes this one, or when the transition reports an\n * interruption.\n */\n public hide(emitEvents = false): Promise<boolean> {\n return this._setOpenState(false, emitEvents);\n }\n\n /** Opens the host, or closes it, based on its current state. */\n public toggle(emitEvents = false): Promise<boolean> {\n return this._host.open ? this.hide(emitEvents) : this.show(emitEvents);\n }\n}\n\n/** Creates a {@link ToggleController} for the given host. */\nexport function addToggleController(\n host: ToggleHost,\n options?: ToggleControllerOptions\n): ToggleController {\n return new ToggleController(host, options);\n}\n\nexport type { ToggleController, ToggleControllerOptions, ToggleHost };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"compare.js","sourceRoot":"","sources":["../../../src/internals/date/compare.ts"],"names":[],"mappings":"AACA,SAAS,YAAY,CACnB,KAAW,EACX,QAAc,EACd,UAA6C,EAC7C,WAAoB,EACpB,WAAoB;IAEpB,IAAI,WAAW,IAAI,WAAW,EAAE,CAAC;QAC/B,OAAO,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACpC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAEvC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACvB,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACzB,CAAC;IACD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACvB,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,KAAW,EACX,QAAc,EACd,WAAW,GAAG,IAAI,EAClB,WAAW,GAAG,IAAI;IAElB,OAAO,YAAY,CACjB,KAAK,EACL,QAAQ,EACR,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EACf,WAAW,EACX,WAAW,CACZ,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,KAAW,EACX,QAAc,EACd,WAAW,GAAG,IAAI,EAClB,WAAW,GAAG,IAAI;IAElB,OAAO,YAAY,CACjB,KAAK,EACL,QAAQ,EACR,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EACf,WAAW,EACX,WAAW,CACZ,CAAC;AACJ,CAAC","sourcesContent":["/** Compares two dates, optionally ignoring their time or their date portion. */\nfunction compareDates(\n value: Date,\n boundary: Date,\n comparator: (a: number, b: number) => boolean,\n includeTime: boolean,\n includeDate: boolean\n): boolean {\n if (includeTime && includeDate) {\n return comparator(value.getTime(), boundary.getTime());\n }\n\n const v = new Date(value.getTime());\n const b = new Date(boundary.getTime());\n\n if (!includeTime) {\n v.setHours(0, 0, 0, 0);\n b.setHours(0, 0, 0, 0);\n }\n if (!includeDate) {\n v.setFullYear(0, 0, 0);\n b.setFullYear(0, 0, 0);\n }\n\n return comparator(v.getTime(), b.getTime());\n}\n\nexport function isDateExceedingMax(\n value: Date,\n maxValue: Date,\n includeTime = true,\n includeDate = true\n): boolean {\n return compareDates(\n value,\n maxValue,\n (a, b) => a > b,\n includeTime,\n includeDate\n );\n}\n\nexport function isDateLessThanMin(\n value: Date,\n minValue: Date,\n includeTime = true,\n includeDate = true\n): boolean {\n return compareDates(\n value,\n minValue,\n (a, b) => a < b,\n includeTime,\n includeDate\n );\n}\n"]}
1
+ {"version":3,"file":"compare.js","sourceRoot":"","sources":["../../../src/internals/date/compare.ts"],"names":[],"mappings":"AAKA,SAAS,YAAY,CACnB,KAAW,EACX,QAAc,EACd,UAA6C,EAC7C,WAAoB,EACpB,WAAoB;IAEpB,IAAI,WAAW,IAAI,WAAW,EAAE,CAAC;QAC/B,OAAO,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACpC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAEvC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACvB,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACzB,CAAC;IACD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACvB,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,KAAW,EACX,QAAc,EACd,WAAW,GAAG,IAAI,EAClB,WAAW,GAAG,IAAI;IAElB,OAAO,YAAY,CACjB,KAAK,EACL,QAAQ,EACR,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EACf,WAAW,EACX,WAAW,CACZ,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,KAAW,EACX,QAAc,EACd,WAAW,GAAG,IAAI,EAClB,WAAW,GAAG,IAAI;IAElB,OAAO,YAAY,CACjB,KAAK,EACL,QAAQ,EACR,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EACf,WAAW,EACX,WAAW,CACZ,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Compares two dates with the given comparator. Ignores the time portion\n * when `includeTime` is `false`, and the date portion when `includeDate` is\n * `false`.\n */\nfunction compareDates(\n value: Date,\n boundary: Date,\n comparator: (a: number, b: number) => boolean,\n includeTime: boolean,\n includeDate: boolean\n): boolean {\n if (includeTime && includeDate) {\n return comparator(value.getTime(), boundary.getTime());\n }\n\n const v = new Date(value.getTime());\n const b = new Date(boundary.getTime());\n\n if (!includeTime) {\n v.setHours(0, 0, 0, 0);\n b.setHours(0, 0, 0, 0);\n }\n if (!includeDate) {\n v.setFullYear(0, 0, 0);\n b.setFullYear(0, 0, 0);\n }\n\n return comparator(v.getTime(), b.getTime());\n}\n\nexport function isDateExceedingMax(\n value: Date,\n maxValue: Date,\n includeTime = true,\n includeDate = true\n): boolean {\n return compareDates(\n value,\n maxValue,\n (a, b) => a > b,\n includeTime,\n includeDate\n );\n}\n\nexport function isDateLessThanMin(\n value: Date,\n minValue: Date,\n includeTime = true,\n includeDate = true\n): boolean {\n return compareDates(\n value,\n minValue,\n (a, b) => a < b,\n includeTime,\n includeDate\n );\n}\n"]}
@@ -1,17 +1,20 @@
1
1
  import type { DateRangeValue } from '../../components/types.js';
2
- /** Whether `value` is a `Date` holding a valid time. */
2
+ /** Returns whether `value` is a `Date` with a valid time. */
3
3
  export declare function isValidDate(value: unknown): value is Date;
4
- /** Converts `value` to a `Date`, or to `null` when it is empty or cannot be parsed. */
4
+ /** Converts `value` to a `Date`, or `null` when empty or unparsable. */
5
5
  export declare function convertToDate(value?: Date | string | null): Date | null;
6
6
  /**
7
- * Converts a comma-separated string of ISO 8601 dates, or an array of dates and ISO 8601
8
- * strings, into an array of `Date` objects, dropping the ones which cannot be parsed.
7
+ * Converts a comma-separated string of ISO 8601 dates, or an array of dates
8
+ * and ISO 8601 strings, into an array of `Date` objects. Unparsable items
9
+ * are dropped.
9
10
  */
10
11
  export declare function convertToDates(value?: (Date | string)[] | string | null): Date[] | null;
11
12
  /**
12
- * Converts `value` to a `DateRangeValue`, parsing a string as JSON and truncating the
13
- * time of both endpoints. Malformed input converts to `null` rather than throwing, since
14
- * this runs as an attribute converter.
13
+ * Converts `value` to a `DateRangeValue`, parsing a string as JSON and
14
+ * truncating the time of both endpoints.
15
+ *
16
+ * @remarks
17
+ * Malformed input gives `null`, because this runs as an attribute converter.
15
18
  */
16
19
  export declare function convertToDateRange(value?: DateRangeValue | string | null): DateRangeValue | null;
17
20
  /** Converts a `Date` to an ISO 8601 string. */
@@ -1 +1 @@
1
- {"version":3,"file":"converters.js","sourceRoot":"","sources":["../../../src/internals/date/converters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGvD,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAGlC,MAAM,YAAY,GAAG,cAAc,CAAC;AAGpC,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,KAAK,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,YAAY,CAAC,IAAU;IAC9B,OAAO,WAAW,CAAC,IAAI,CAAC,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K,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;AAChE,CAAC;AAGD,MAAM,UAAU,gBAAgB,CAAC,KAAkB;IACjD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5C,CAAC","sourcesContent":["import type { DateRangeValue } from '../../components/types.js';\nimport { isPlainObject, isString } from '../utils/types.js';\nimport { CalendarDay, truncateTime } from './model.js';\n\n/** Matches a string beginning with a four digit year, which is left to `Date` to parse. */\nconst ISO_DATE_PATTERN = /^\\d{4}/;\n\n/** Matches a time only string - `HH:MM` optionally followed by seconds and milliseconds. */\nconst TIME_PATTERN = /^\\d{2}:\\d{2}/;\n\n/** Whether `value` is a `Date` holding a valid time. */\nexport function isValidDate(value: unknown): value is Date {\n return value instanceof Date && !Number.isNaN(value.getTime());\n}\n\nfunction getValidDate(date: Date): Date | null {\n return isValidDate(date) ? date : null;\n}\n\n/** Parses an ISO 8601 date, or a time only string against the current date. */\nfunction parseISODate(value: string): Date | null {\n const string = value.trim();\n\n if (ISO_DATE_PATTERN.test(string)) {\n const timeComponent = !string.includes('T') ? 'T00:00:00' : '';\n return getValidDate(new Date(`${string}${timeComponent}`));\n }\n\n if (TIME_PATTERN.test(string)) {\n const today = CalendarDay.today;\n const month = `${today.month + 1}`.padStart(2, '0');\n const date = `${today.date}`.padStart(2, '0');\n\n return getValidDate(new Date(`${today.year}-${month}-${date}T${string}`));\n }\n\n return null;\n}\n\n/** Converts `value` to a `Date`, or to `null` when it is empty or cannot be parsed. */\nexport function convertToDate(value?: Date | string | null): Date | null {\n if (!value) {\n return null;\n }\n\n return isString(value) ? parseISODate(value) : getValidDate(value);\n}\n\n/**\n * Converts a comma-separated string of ISO 8601 dates, or an array of dates and ISO 8601\n * strings, into an array of `Date` objects, dropping the ones which cannot be parsed.\n */\nexport function convertToDates(\n value?: (Date | string)[] | string | null\n): Date[] | null {\n if (!value) {\n return null;\n }\n\n const values: Date[] = [];\n const sources = isString(value) ? value.split(',') : value;\n\n for (const source of sources) {\n const trimmed = isString(source) ? source.trim() : source;\n const date = convertToDate(trimmed);\n if (date) {\n values.push(date);\n }\n }\n\n return values;\n}\n\n/**\n * Converts `value` to a `DateRangeValue`, parsing a string as JSON and truncating the\n * time of both endpoints. Malformed input converts to `null` rather than throwing, since\n * this runs as an attribute converter.\n */\nexport function convertToDateRange(\n value?: DateRangeValue | string | null\n): DateRangeValue | null {\n if (!value) {\n return null;\n }\n\n if (!isString(value)) {\n return value;\n }\n\n let parsed: unknown;\n\n try {\n parsed = JSON.parse(value);\n } catch {\n return null;\n }\n\n if (!isPlainObject(parsed)) {\n return null;\n }\n\n const start = convertToDate(parsed.start as Date | string | null);\n const end = convertToDate(parsed.end as Date | string | null);\n\n return { start: truncateTime(start), end: truncateTime(end) };\n}\n\n/** Converts a `Date` to an ISO 8601 string. */\nexport function getDateFormValue(value: Date | null): string | null {\n return value ? value.toISOString() : null;\n}\n"]}
1
+ {"version":3,"file":"converters.js","sourceRoot":"","sources":["../../../src/internals/date/converters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGvD,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAGlC,MAAM,YAAY,GAAG,cAAc,CAAC;AAGpC,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,KAAK,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,YAAY,CAAC,IAAU;IAC9B,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACzC,CAAC;AAGD,SAAS,YAAY,CAAC,KAAa;IACjC,MAAM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AAkB;IACjD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5C,CAAC","sourcesContent":["import type { DateRangeValue } from '../../components/types.js';\nimport { isPlainObject, isString } from '../utils/types.js';\nimport { CalendarDay, truncateTime } from './model.js';\n\n/** Matches a string that starts with a four digit year. `Date` parses it. */\nconst ISO_DATE_PATTERN = /^\\d{4}/;\n\n/** Matches a time only string: `HH:MM`, with optional seconds and ms. */\nconst TIME_PATTERN = /^\\d{2}:\\d{2}/;\n\n/** Returns whether `value` is a `Date` with a valid time. */\nexport function isValidDate(value: unknown): value is Date {\n return value instanceof Date && !Number.isNaN(value.getTime());\n}\n\nfunction getValidDate(date: Date): Date | null {\n return isValidDate(date) ? date : null;\n}\n\n/** Parses an ISO 8601 date, or a time only string against the current date. */\nfunction parseISODate(value: string): Date | null {\n const string = value.trim();\n\n if (ISO_DATE_PATTERN.test(string)) {\n const timeComponent = !string.includes('T') ? 'T00:00:00' : '';\n return getValidDate(new Date(`${string}${timeComponent}`));\n }\n\n if (TIME_PATTERN.test(string)) {\n const today = CalendarDay.today;\n const month = `${today.month + 1}`.padStart(2, '0');\n const date = `${today.date}`.padStart(2, '0');\n\n return getValidDate(new Date(`${today.year}-${month}-${date}T${string}`));\n }\n\n return null;\n}\n\n/** Converts `value` to a `Date`, or `null` when empty or unparsable. */\nexport function convertToDate(value?: Date | string | null): Date | null {\n if (!value) {\n return null;\n }\n\n return isString(value) ? parseISODate(value) : getValidDate(value);\n}\n\n/**\n * Converts a comma-separated string of ISO 8601 dates, or an array of dates\n * and ISO 8601 strings, into an array of `Date` objects. Unparsable items\n * are dropped.\n */\nexport function convertToDates(\n value?: (Date | string)[] | string | null\n): Date[] | null {\n if (!value) {\n return null;\n }\n\n const values: Date[] = [];\n const sources = isString(value) ? value.split(',') : value;\n\n for (const source of sources) {\n const trimmed = isString(source) ? source.trim() : source;\n const date = convertToDate(trimmed);\n if (date) {\n values.push(date);\n }\n }\n\n return values;\n}\n\n/**\n * Converts `value` to a `DateRangeValue`, parsing a string as JSON and\n * truncating the time of both endpoints.\n *\n * @remarks\n * Malformed input gives `null`, because this runs as an attribute converter.\n */\nexport function convertToDateRange(\n value?: DateRangeValue | string | null\n): DateRangeValue | null {\n if (!value) {\n return null;\n }\n\n if (!isString(value)) {\n return value;\n }\n\n let parsed: unknown;\n\n try {\n parsed = JSON.parse(value);\n } catch {\n return null;\n }\n\n if (!isPlainObject(parsed)) {\n return null;\n }\n\n const start = convertToDate(parsed.start as Date | string | null);\n const end = convertToDate(parsed.end as Date | string | null);\n\n return { start: truncateTime(start), end: truncateTime(end) };\n}\n\n/** Converts a `Date` to an ISO 8601 string. */\nexport function getDateFormValue(value: Date | null): string | null {\n return value ? value.toISOString() : null;\n}\n"]}
@@ -13,20 +13,19 @@ type CalendarDayParams = {
13
13
  };
14
14
  export declare const DAYS_IN_WEEK = 7;
15
15
  export declare function toCalendarDay(date: DayParameter): CalendarDay;
16
- /** Null-preserving {@link toCalendarDay}: empty values convert to `null`. */
16
+ /** Returns the {@link toCalendarDay} result of `date`, or `null` if empty. */
17
17
  export declare function toCalendarDayOrNull(date?: DayParameter | null): CalendarDay | null;
18
- /** Truncates the time portion of `date`, passing empty values through as `null`. */
18
+ /** Truncates the time portion of `date`. An empty value gives `null`. */
19
19
  export declare function truncateTime(date?: Date | null): Date | null;
20
20
  /**
21
- * Yields the days between `start` and `end`, stepping by `unit` and stopping short of
22
- * `end` unless `inclusive` is set.
21
+ * Yields the days between `start` and `end`, stepped by `unit`. Stops before
22
+ * `end`, unless `inclusive` is `true`.
23
23
  */
24
24
  export declare function calendarRange(options: CalendarRangeParams): Generator<CalendarDay, void, unknown>;
25
25
  export declare class CalendarDay {
26
26
  private readonly _date;
27
27
  /** Constructs and returns the current day. */
28
28
  static get today(): CalendarDay;
29
- /** Constructs a new CalendarDay instance from a Date object. */
30
29
  static from(date: Date): CalendarDay;
31
30
  /**
32
31
  * Compares the date portion of two date objects.
@@ -40,18 +39,14 @@ export declare class CalendarDay {
40
39
  */
41
40
  static compare(first: DayParameter, second: DayParameter): number;
42
41
  constructor(args: CalendarDayParams);
43
- /** Returns a copy of this instance. */
44
42
  clone(): CalendarDay;
45
43
  /** Returns a new instance with the given values replaced. */
46
44
  set(args: Partial<CalendarDayParams>): CalendarDay;
47
45
  add(unit: DayInterval, value: number): CalendarDay;
48
46
  /** Returns the day of the week (Sunday = 0). */
49
47
  get day(): number;
50
- /** Returns the full year. */
51
48
  get year(): number;
52
- /** Returns the month. */
53
49
  get month(): number;
54
- /** Returns the date */
55
50
  get date(): number;
56
51
  /** Returns the timestamp since epoch in milliseconds. */
57
52
  get timestamp(): number;
@@ -59,17 +54,15 @@ export declare class CalendarDay {
59
54
  * Returns the ISO 8601 week number.
60
55
  *
61
56
  * @remarks
62
- * Week 1 is the week containing the first Thursday of the year.
63
- * Weeks start on Monday. Some years can have 53 weeks.
57
+ * Week 1 holds the first Thursday of the year, weeks start on Monday, and
58
+ * a year can have 53 weeks.
64
59
  */
65
60
  get week(): number;
66
- /** Returns the underlying native date instance. */
61
+ /** Returns a copy of the underlying native `Date` instance. */
67
62
  get native(): Date;
68
63
  /**
69
- * Whether the current date is a weekend day.
70
- *
71
- * @remarks
72
- * This is naive, since it does not account for locale specifics.
64
+ * Returns whether the current date is a weekend day. The check is naive
65
+ * and ignores locale specifics.
73
66
  */
74
67
  get weekend(): boolean;
75
68
  equalTo(value: DayParameter): boolean;