igniteui-webcomponents 7.3.1 → 7.4.0

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 (606) hide show
  1. package/CHANGELOG.md +72 -1
  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/avatar/themes/avatar.base.css.js +1 -1
  12. package/components/avatar/themes/avatar.base.css.js.map +1 -1
  13. package/components/badge/themes/badge.base.css.js +1 -1
  14. package/components/badge/themes/badge.base.css.js.map +1 -1
  15. package/components/banner/themes/banner.base.css.js +1 -1
  16. package/components/banner/themes/banner.base.css.js.map +1 -1
  17. package/components/banner/themes/shared/banner.indigo.css.js +1 -1
  18. package/components/banner/themes/shared/banner.indigo.css.js.map +1 -1
  19. package/components/breadcrumb/breadcrumb.d.ts +74 -0
  20. package/components/breadcrumb/breadcrumb.js +107 -0
  21. package/components/breadcrumb/breadcrumb.js.map +1 -0
  22. package/components/breadcrumb/breadcrumbs.d.ts +60 -0
  23. package/components/breadcrumb/breadcrumbs.js +50 -0
  24. package/components/breadcrumb/breadcrumbs.js.map +1 -0
  25. package/components/breadcrumb/themes/breadcrumb.base.css.d.ts +1 -0
  26. package/components/breadcrumb/themes/breadcrumb.base.css.js +3 -0
  27. package/components/breadcrumb/themes/breadcrumb.base.css.js.map +1 -0
  28. package/components/breadcrumb/themes/breadcrumbs.base.css.d.ts +1 -0
  29. package/components/breadcrumb/themes/breadcrumbs.base.css.js +3 -0
  30. package/components/breadcrumb/themes/breadcrumbs.base.css.js.map +1 -0
  31. package/components/breadcrumb/themes/dark/breadcrumb.bootstrap.css.d.ts +1 -0
  32. package/components/breadcrumb/themes/dark/breadcrumb.bootstrap.css.js +3 -0
  33. package/components/breadcrumb/themes/dark/breadcrumb.bootstrap.css.js.map +1 -0
  34. package/components/breadcrumb/themes/dark/breadcrumb.fluent.css.d.ts +1 -0
  35. package/components/breadcrumb/themes/dark/breadcrumb.fluent.css.js +3 -0
  36. package/components/breadcrumb/themes/dark/breadcrumb.fluent.css.js.map +1 -0
  37. package/components/breadcrumb/themes/dark/breadcrumb.indigo.css.d.ts +1 -0
  38. package/components/breadcrumb/themes/dark/breadcrumb.indigo.css.js +3 -0
  39. package/components/breadcrumb/themes/dark/breadcrumb.indigo.css.js.map +1 -0
  40. package/components/breadcrumb/themes/dark/breadcrumb.material.css.d.ts +1 -0
  41. package/components/breadcrumb/themes/dark/breadcrumb.material.css.js +3 -0
  42. package/components/breadcrumb/themes/dark/breadcrumb.material.css.js.map +1 -0
  43. package/components/breadcrumb/themes/light/breadcrumb.bootstrap.css.d.ts +1 -0
  44. package/components/breadcrumb/themes/light/breadcrumb.bootstrap.css.js +3 -0
  45. package/components/breadcrumb/themes/light/breadcrumb.bootstrap.css.js.map +1 -0
  46. package/components/breadcrumb/themes/light/breadcrumb.fluent.css.d.ts +1 -0
  47. package/components/breadcrumb/themes/light/breadcrumb.fluent.css.js +3 -0
  48. package/components/breadcrumb/themes/light/breadcrumb.fluent.css.js.map +1 -0
  49. package/components/breadcrumb/themes/light/breadcrumb.indigo.css.d.ts +1 -0
  50. package/components/breadcrumb/themes/light/breadcrumb.indigo.css.js +3 -0
  51. package/components/breadcrumb/themes/light/breadcrumb.indigo.css.js.map +1 -0
  52. package/components/breadcrumb/themes/light/breadcrumb.material.css.d.ts +1 -0
  53. package/components/breadcrumb/themes/light/breadcrumb.material.css.js +3 -0
  54. package/components/breadcrumb/themes/light/breadcrumb.material.css.js.map +1 -0
  55. package/components/breadcrumb/themes/light/breadcrumb.shared.css.d.ts +1 -0
  56. package/components/breadcrumb/themes/light/breadcrumb.shared.css.js +3 -0
  57. package/components/breadcrumb/themes/light/breadcrumb.shared.css.js.map +1 -0
  58. package/components/breadcrumb/themes/shared/breadcrumb.bootstrap.css.d.ts +1 -0
  59. package/components/breadcrumb/themes/shared/breadcrumb.bootstrap.css.js +3 -0
  60. package/components/breadcrumb/themes/shared/breadcrumb.bootstrap.css.js.map +1 -0
  61. package/components/breadcrumb/themes/shared/breadcrumb.common.css.d.ts +1 -0
  62. package/components/breadcrumb/themes/shared/breadcrumb.common.css.js +3 -0
  63. package/components/breadcrumb/themes/shared/breadcrumb.common.css.js.map +1 -0
  64. package/components/breadcrumb/themes/shared/breadcrumb.fluent.css.d.ts +1 -0
  65. package/components/breadcrumb/themes/shared/breadcrumb.fluent.css.js +3 -0
  66. package/components/breadcrumb/themes/shared/breadcrumb.fluent.css.js.map +1 -0
  67. package/components/breadcrumb/themes/shared/breadcrumb.indigo.css.d.ts +1 -0
  68. package/components/breadcrumb/themes/shared/breadcrumb.indigo.css.js +3 -0
  69. package/components/breadcrumb/themes/shared/breadcrumb.indigo.css.js.map +1 -0
  70. package/components/breadcrumb/themes/shared/breadcrumb.material.css.d.ts +1 -0
  71. package/components/breadcrumb/themes/shared/breadcrumb.material.css.js +3 -0
  72. package/components/breadcrumb/themes/shared/breadcrumb.material.css.js.map +1 -0
  73. package/components/breadcrumb/themes/themes.d.ts +2 -0
  74. package/components/breadcrumb/themes/themes.js +50 -0
  75. package/components/breadcrumb/themes/themes.js.map +1 -0
  76. package/components/button/button.d.ts +0 -2
  77. package/components/button/button.js.map +1 -1
  78. package/components/button-group/button-group.d.ts +42 -12
  79. package/components/button-group/button-group.js +82 -34
  80. package/components/button-group/button-group.js.map +1 -1
  81. package/components/button-group/toggle-button.d.ts +6 -1
  82. package/components/button-group/toggle-button.js +28 -2
  83. package/components/button-group/toggle-button.js.map +1 -1
  84. package/components/calendar/base.d.ts +7 -2
  85. package/components/calendar/base.js +10 -4
  86. package/components/calendar/base.js.map +1 -1
  87. package/components/calendar/calendar.d.ts +6 -3
  88. package/components/calendar/calendar.js +41 -14
  89. package/components/calendar/calendar.js.map +1 -1
  90. package/components/calendar/days-view/days-view.d.ts +5 -8
  91. package/components/calendar/days-view/days-view.js +7 -16
  92. package/components/calendar/days-view/days-view.js.map +1 -1
  93. package/components/calendar/helpers.d.ts +13 -0
  94. package/components/calendar/helpers.js +15 -0
  95. package/components/calendar/helpers.js.map +1 -1
  96. package/components/calendar/themes/calendar.base.css.js +1 -1
  97. package/components/calendar/themes/calendar.base.css.js.map +1 -1
  98. package/components/calendar/themes/days-view.base.css.js +1 -1
  99. package/components/calendar/themes/days-view.base.css.js.map +1 -1
  100. package/components/calendar/themes/shared/bootstrap/calendar.bootstrap.css.js +1 -1
  101. package/components/calendar/themes/shared/bootstrap/calendar.bootstrap.css.js.map +1 -1
  102. package/components/calendar/themes/shared/bootstrap/days-view.bootstrap.css.js +1 -1
  103. package/components/calendar/themes/shared/bootstrap/days-view.bootstrap.css.js.map +1 -1
  104. package/components/calendar/themes/shared/fluent/days-view.fluent.css.js +1 -1
  105. package/components/calendar/themes/shared/fluent/days-view.fluent.css.js.map +1 -1
  106. package/components/calendar/themes/shared/indigo/calendar.indigo.css.js +1 -1
  107. package/components/calendar/themes/shared/indigo/calendar.indigo.css.js.map +1 -1
  108. package/components/calendar/themes/shared/indigo/days-view.indigo.css.js +1 -1
  109. package/components/calendar/themes/shared/indigo/days-view.indigo.css.js.map +1 -1
  110. package/components/calendar/themes/shared/material/days-view.material.css.js +1 -1
  111. package/components/calendar/themes/shared/material/days-view.material.css.js.map +1 -1
  112. package/components/calendar/themes/year-month-view.base.css.js +1 -1
  113. package/components/calendar/themes/year-month-view.base.css.js.map +1 -1
  114. package/components/card/themes/container.base.css.js +1 -1
  115. package/components/card/themes/container.base.css.js.map +1 -1
  116. package/components/carousel/carousel-indicator.js +1 -0
  117. package/components/carousel/carousel-indicator.js.map +1 -1
  118. package/components/carousel/carousel-slide.d.ts +1 -1
  119. package/components/carousel/carousel-slide.js.map +1 -1
  120. package/components/carousel/carousel.d.ts +3 -3
  121. package/components/carousel/carousel.js.map +1 -1
  122. package/components/carousel/themes/carousel.base.css.js +1 -1
  123. package/components/carousel/themes/carousel.base.css.js.map +1 -1
  124. package/components/carousel/themes/shared/carousel.indigo.css.js +1 -1
  125. package/components/carousel/themes/shared/carousel.indigo.css.js.map +1 -1
  126. package/components/chat/chat-input.d.ts +1 -2
  127. package/components/chat/chat-input.js +1 -1
  128. package/components/chat/chat-input.js.map +1 -1
  129. package/components/chat/chat-state.d.ts +8 -9
  130. package/components/chat/chat-state.js.map +1 -1
  131. package/components/chat/chat.d.ts +1 -3
  132. package/components/chat/chat.js +2 -2
  133. package/components/chat/chat.js.map +1 -1
  134. package/components/chat/message-attachments.d.ts +6 -15
  135. package/components/chat/message-attachments.js.map +1 -1
  136. package/components/chat/themes/chat.base.css.js +1 -1
  137. package/components/chat/themes/chat.base.css.js.map +1 -1
  138. package/components/chat/themes/message.base.css.js +1 -1
  139. package/components/chat/themes/message.base.css.js.map +1 -1
  140. package/components/chat/utils.d.ts +0 -1
  141. package/components/chat/utils.js +1 -1
  142. package/components/chat/utils.js.map +1 -1
  143. package/components/checkbox/checkbox-base.d.ts +1 -1
  144. package/components/checkbox/checkbox.js +1 -1
  145. package/components/checkbox/checkbox.js.map +1 -1
  146. package/components/checkbox/themes/checkbox.base.css.js +1 -1
  147. package/components/checkbox/themes/checkbox.base.css.js.map +1 -1
  148. package/components/checkbox/themes/shared/checkbox/checkbox.bootstrap.css.js +1 -1
  149. package/components/checkbox/themes/shared/checkbox/checkbox.bootstrap.css.js.map +1 -1
  150. package/components/checkbox/themes/shared/checkbox/checkbox.fluent.css.js +1 -1
  151. package/components/checkbox/themes/shared/checkbox/checkbox.fluent.css.js.map +1 -1
  152. package/components/checkbox/themes/shared/switch/switch.bootstrap.css.js +1 -1
  153. package/components/checkbox/themes/shared/switch/switch.bootstrap.css.js.map +1 -1
  154. package/components/checkbox/themes/shared/switch/switch.fluent.css.js +1 -1
  155. package/components/checkbox/themes/shared/switch/switch.fluent.css.js.map +1 -1
  156. package/components/checkbox/themes/shared/switch/switch.indigo.css.js +1 -1
  157. package/components/checkbox/themes/shared/switch/switch.indigo.css.js.map +1 -1
  158. package/components/checkbox/themes/shared/switch/switch.material.css.js +1 -1
  159. package/components/checkbox/themes/shared/switch/switch.material.css.js.map +1 -1
  160. package/components/checkbox/themes/switch.base.css.js +1 -1
  161. package/components/checkbox/themes/switch.base.css.js.map +1 -1
  162. package/components/chip/chip.d.ts +2 -2
  163. package/components/chip/chip.js.map +1 -1
  164. package/components/color-picker/color-picker.d.ts +35 -34
  165. package/components/color-picker/color-picker.js +9 -4
  166. package/components/color-picker/color-picker.js.map +1 -1
  167. package/components/color-picker/common.d.ts +0 -2
  168. package/components/color-picker/common.js +2 -2
  169. package/components/color-picker/common.js.map +1 -1
  170. package/components/color-picker/converters.js.map +1 -1
  171. package/components/color-picker/picker-canvas.js.map +1 -1
  172. package/components/color-picker/themes/color-picker.base.css.js +1 -1
  173. package/components/color-picker/themes/color-picker.base.css.js.map +1 -1
  174. package/components/combo/combo.d.ts +18 -20
  175. package/components/combo/combo.js +8 -2
  176. package/components/combo/combo.js.map +1 -1
  177. package/components/combo/controllers/data.d.ts +7 -10
  178. package/components/combo/controllers/data.js.map +1 -1
  179. package/components/combo/themes/combo-item.base.css.js +1 -1
  180. package/components/combo/themes/combo-item.base.css.js.map +1 -1
  181. package/components/combo/themes/combo.base.css.js +1 -1
  182. package/components/combo/themes/combo.base.css.js.map +1 -1
  183. package/components/combo/themes/shared/combo.bootstrap.css.js +1 -1
  184. package/components/combo/themes/shared/combo.bootstrap.css.js.map +1 -1
  185. package/components/date-picker/date-picker.base.d.ts +33 -29
  186. package/components/date-picker/date-picker.base.js +15 -4
  187. package/components/date-picker/date-picker.base.js.map +1 -1
  188. package/components/date-picker/date-picker.d.ts +1 -1
  189. package/components/date-picker/date-picker.js +5 -3
  190. package/components/date-picker/date-picker.js.map +1 -1
  191. package/components/date-picker/themes/date-picker.base.css.js +1 -1
  192. package/components/date-picker/themes/date-picker.base.css.js.map +1 -1
  193. package/components/date-range-picker/date-range-input.d.ts +0 -2
  194. package/components/date-range-picker/date-range-input.js +0 -6
  195. package/components/date-range-picker/date-range-input.js.map +1 -1
  196. package/components/date-range-picker/date-range-picker.base.css.js +1 -1
  197. package/components/date-range-picker/date-range-picker.base.css.js.map +1 -1
  198. package/components/date-range-picker/date-range-picker.d.ts +22 -31
  199. package/components/date-range-picker/date-range-picker.js +7 -7
  200. package/components/date-range-picker/date-range-picker.js.map +1 -1
  201. package/components/date-range-picker/i18n.d.ts +21 -0
  202. package/components/date-range-picker/i18n.js +10 -0
  203. package/components/date-range-picker/i18n.js.map +1 -0
  204. package/components/date-range-picker/predefined-ranges-area.base.css.js +1 -1
  205. package/components/date-range-picker/predefined-ranges-area.base.css.js.map +1 -1
  206. package/components/date-range-picker/predefined-ranges-area.d.ts +3 -3
  207. package/components/date-range-picker/predefined-ranges-area.js +2 -5
  208. package/components/date-range-picker/predefined-ranges-area.js.map +1 -1
  209. package/components/date-range-picker/validators.d.ts +0 -4
  210. package/components/date-range-picker/validators.js +4 -4
  211. package/components/date-range-picker/validators.js.map +1 -1
  212. package/components/date-time-input/date-time-input.base.d.ts +39 -37
  213. package/components/date-time-input/date-time-input.base.js +6 -0
  214. package/components/date-time-input/date-time-input.base.js.map +1 -1
  215. package/components/date-time-input/date-time-input.d.ts +1 -11
  216. package/components/date-time-input/date-time-input.js +0 -6
  217. package/components/date-time-input/date-time-input.js.map +1 -1
  218. package/components/date-time-input/datetime-mask-parser.d.ts +0 -10
  219. package/components/date-time-input/datetime-mask-parser.js +1 -1
  220. package/components/date-time-input/datetime-mask-parser.js.map +1 -1
  221. package/components/dialog/dialog.js.map +1 -1
  222. package/components/divider/themes/divider.base.css.js +1 -1
  223. package/components/divider/themes/divider.base.css.js.map +1 -1
  224. package/components/dropdown/dropdown-group.d.ts +2 -10
  225. package/components/dropdown/dropdown-group.js +2 -27
  226. package/components/dropdown/dropdown-group.js.map +1 -1
  227. package/components/dropdown/dropdown.d.ts +17 -23
  228. package/components/dropdown/dropdown.js +5 -17
  229. package/components/dropdown/dropdown.js.map +1 -1
  230. package/components/dropdown/themes/dropdown-item.base.css.js +1 -1
  231. package/components/dropdown/themes/dropdown-item.base.css.js.map +1 -1
  232. package/components/dropdown/themes/dropdown.base.css.js +1 -1
  233. package/components/dropdown/themes/dropdown.base.css.js.map +1 -1
  234. package/components/file-input/file-input.d.ts +2 -2
  235. package/components/file-input/file-input.js.map +1 -1
  236. package/components/file-input/themes/file-input.base.css.js +1 -1
  237. package/components/file-input/themes/file-input.base.css.js.map +1 -1
  238. package/components/file-input/themes/shared/file-input.bootstrap.css.js +1 -1
  239. package/components/file-input/themes/shared/file-input.bootstrap.css.js.map +1 -1
  240. package/components/icon/icon.d.ts +1 -1
  241. package/components/icon/icon.registry.d.ts +6 -6
  242. package/components/icon/icon.registry.js.map +1 -1
  243. package/components/input/input.d.ts +3 -3
  244. package/components/input/input.js.map +1 -1
  245. package/components/input/themes/shared/input.indigo.css.js +1 -1
  246. package/components/input/themes/shared/input.indigo.css.js.map +1 -1
  247. package/components/input/themes/shared/input.material.css.js +1 -1
  248. package/components/input/themes/shared/input.material.css.js.map +1 -1
  249. package/components/list/themes/item.base.css.js +1 -1
  250. package/components/list/themes/item.base.css.js.map +1 -1
  251. package/components/mask-input/mask-history.d.ts +22 -18
  252. package/components/mask-input/mask-history.js.map +1 -1
  253. package/components/mask-input/mask-input.d.ts +1 -1
  254. package/components/mask-input/mask-parser.d.ts +11 -13
  255. package/components/mask-input/mask-parser.js.map +1 -1
  256. package/components/nav-drawer/themes/item.base.css.js +1 -1
  257. package/components/nav-drawer/themes/item.base.css.js.map +1 -1
  258. package/components/popover/popover.d.ts +45 -34
  259. package/components/popover/popover.js +54 -122
  260. package/components/popover/popover.js.map +1 -1
  261. package/components/popover/position/arrow.d.ts +19 -0
  262. package/components/popover/position/arrow.js +33 -0
  263. package/components/popover/position/arrow.js.map +1 -0
  264. package/components/popover/position/floating.d.ts +40 -0
  265. package/components/popover/position/floating.js +146 -0
  266. package/components/popover/position/floating.js.map +1 -0
  267. package/components/popover/position/native.d.ts +45 -0
  268. package/components/popover/position/native.js +158 -0
  269. package/components/popover/position/native.js.map +1 -0
  270. package/components/popover/position/strategy.d.ts +37 -0
  271. package/components/popover/position/strategy.js +21 -0
  272. package/components/popover/position/strategy.js.map +1 -0
  273. package/components/popover/position/types.d.ts +26 -0
  274. package/components/popover/position/types.js +15 -0
  275. package/components/popover/position/types.js.map +1 -0
  276. package/components/popover/themes/light/popover.base.css.js +1 -1
  277. package/components/popover/themes/light/popover.base.css.js.map +1 -1
  278. package/components/progress/circular-progress.d.ts +0 -5
  279. package/components/progress/circular-progress.js.map +1 -1
  280. package/components/progress/themes/linear/linear.progress.base.css.js +1 -1
  281. package/components/progress/themes/linear/linear.progress.base.css.js.map +1 -1
  282. package/components/progress/themes/linear/shared/linear.progress.bootstrap.css.d.ts +1 -0
  283. package/components/progress/themes/linear/shared/linear.progress.bootstrap.css.js +3 -0
  284. package/components/progress/themes/linear/shared/linear.progress.bootstrap.css.js.map +1 -0
  285. package/components/progress/themes/linear/themes.js +3 -2
  286. package/components/progress/themes/linear/themes.js.map +1 -1
  287. package/components/qr-code/qr-code.d.ts +29 -2
  288. package/components/qr-code/qr-code.js +56 -13
  289. package/components/qr-code/qr-code.js.map +1 -1
  290. package/components/qr-code/renderer/export.d.ts +28 -0
  291. package/components/qr-code/renderer/export.js +120 -0
  292. package/components/qr-code/renderer/export.js.map +1 -0
  293. package/components/qr-code/types.d.ts +26 -0
  294. package/components/qr-code/types.js.map +1 -1
  295. package/components/radio/radio.d.ts +4 -4
  296. package/components/radio/radio.js +17 -14
  297. package/components/radio/radio.js.map +1 -1
  298. package/components/radio/themes/radio.base.css.js +1 -1
  299. package/components/radio/themes/radio.base.css.js.map +1 -1
  300. package/components/radio/themes/shared/radio.bootstrap.css.js +1 -1
  301. package/components/radio/themes/shared/radio.bootstrap.css.js.map +1 -1
  302. package/components/radio/themes/shared/radio.indigo.css.js +1 -1
  303. package/components/radio/themes/shared/radio.indigo.css.js.map +1 -1
  304. package/components/radio-group/radio-group.js.map +1 -1
  305. package/components/rating/rating.d.ts +6 -6
  306. package/components/rating/rating.js.map +1 -1
  307. package/components/select/select-group.d.ts +5 -10
  308. package/components/select/select-group.js +10 -34
  309. package/components/select/select-group.js.map +1 -1
  310. package/components/select/select.d.ts +12 -20
  311. package/components/select/select.js +4 -14
  312. package/components/select/select.js.map +1 -1
  313. package/components/select/themes/select.base.css.js +1 -1
  314. package/components/select/themes/select.base.css.js.map +1 -1
  315. package/components/select/themes/shared/select.bootstrap.css.js +1 -1
  316. package/components/select/themes/shared/select.bootstrap.css.js.map +1 -1
  317. package/components/slider/themes/shared/slider.material.css.js +1 -1
  318. package/components/slider/themes/shared/slider.material.css.js.map +1 -1
  319. package/components/slider/themes/slider.base.css.js +1 -1
  320. package/components/slider/themes/slider.base.css.js.map +1 -1
  321. package/components/snackbar/themes/snackbar.base.css.js +1 -1
  322. package/components/snackbar/themes/snackbar.base.css.js.map +1 -1
  323. package/components/splitter/splitter.d.ts +6 -6
  324. package/components/splitter/splitter.js.map +1 -1
  325. package/components/splitter/themes/splitter.base.css.js +1 -1
  326. package/components/splitter/themes/splitter.base.css.js.map +1 -1
  327. package/components/stepper/themes/step/step.base.css.js +1 -1
  328. package/components/stepper/themes/step/step.base.css.js.map +1 -1
  329. package/components/tabs/themes/shared/tab/tab.bootstrap.css.js +1 -1
  330. package/components/tabs/themes/shared/tab/tab.bootstrap.css.js.map +1 -1
  331. package/components/tabs/themes/shared/tab/tab.fluent.css.js +1 -1
  332. package/components/tabs/themes/shared/tab/tab.fluent.css.js.map +1 -1
  333. package/components/tabs/themes/shared/tab/tab.indigo.css.js +1 -1
  334. package/components/tabs/themes/shared/tab/tab.indigo.css.js.map +1 -1
  335. package/components/tabs/themes/shared/tab/tab.material.css.js +1 -1
  336. package/components/tabs/themes/shared/tab/tab.material.css.js.map +1 -1
  337. package/components/tabs/themes/shared/tabs/tabs.fluent.css.js +1 -1
  338. package/components/tabs/themes/shared/tabs/tabs.fluent.css.js.map +1 -1
  339. package/components/tabs/themes/shared/tabs/tabs.indigo.css.js +1 -1
  340. package/components/tabs/themes/shared/tabs/tabs.indigo.css.js.map +1 -1
  341. package/components/tabs/themes/shared/tabs/tabs.material.css.js +1 -1
  342. package/components/tabs/themes/shared/tabs/tabs.material.css.js.map +1 -1
  343. package/components/tabs/themes/tab.base.css.js +1 -1
  344. package/components/tabs/themes/tab.base.css.js.map +1 -1
  345. package/components/textarea/textarea.d.ts +1 -1
  346. package/components/textarea/textarea.js.map +1 -1
  347. package/components/textarea/themes/shared/textarea.bootstrap.css.js +1 -1
  348. package/components/textarea/themes/shared/textarea.bootstrap.css.js.map +1 -1
  349. package/components/textarea/themes/shared/textarea.common.css.js +1 -1
  350. package/components/textarea/themes/shared/textarea.common.css.js.map +1 -1
  351. package/components/textarea/themes/shared/textarea.fluent.css.js +1 -1
  352. package/components/textarea/themes/shared/textarea.fluent.css.js.map +1 -1
  353. package/components/textarea/themes/shared/textarea.indigo.css.js +1 -1
  354. package/components/textarea/themes/shared/textarea.indigo.css.js.map +1 -1
  355. package/components/textarea/themes/shared/textarea.material.css.js +1 -1
  356. package/components/textarea/themes/shared/textarea.material.css.js.map +1 -1
  357. package/components/tile-manager/themes/tile.base.css.js +1 -1
  358. package/components/tile-manager/themes/tile.base.css.js.map +1 -1
  359. package/components/tile-manager/tile-manager.d.ts +6 -7
  360. package/components/tile-manager/tile-manager.js.map +1 -1
  361. package/components/tile-manager/tile.d.ts +3 -3
  362. package/components/tile-manager/tile.js.map +1 -1
  363. package/components/toast/themes/toast.base.css.js +1 -1
  364. package/components/toast/themes/toast.base.css.js.map +1 -1
  365. package/components/toast/toast.d.ts +0 -2
  366. package/components/toast/toast.js.map +1 -1
  367. package/components/tooltip/controller.js.map +1 -1
  368. package/components/tooltip/service.js +4 -5
  369. package/components/tooltip/service.js.map +1 -1
  370. package/components/tooltip/themes/tooltip.base.css.js +1 -1
  371. package/components/tooltip/themes/tooltip.base.css.js.map +1 -1
  372. package/components/tooltip/tooltip.d.ts +34 -13
  373. package/components/tooltip/tooltip.js +8 -4
  374. package/components/tooltip/tooltip.js.map +1 -1
  375. package/components/tree/themes/item.base.css.js +1 -1
  376. package/components/tree/themes/item.base.css.js.map +1 -1
  377. package/components/tree/tree-item.d.ts +6 -6
  378. package/components/tree/tree-item.js.map +1 -1
  379. package/components/tree/tree.navigation.d.ts +5 -6
  380. package/components/tree/tree.navigation.js.map +1 -1
  381. package/components/tree/tree.selection.js.map +1 -1
  382. package/components/types.d.ts +1 -1
  383. package/components/types.js.map +1 -1
  384. package/components/validation-container/themes/validator.base.css.js +1 -1
  385. package/components/validation-container/themes/validator.base.css.js.map +1 -1
  386. package/components/validation-container/validation-container.d.ts +10 -12
  387. package/components/validation-container/validation-container.js +14 -17
  388. package/components/validation-container/validation-container.js.map +1 -1
  389. package/components/virtualization/engine.d.ts +5 -5
  390. package/components/virtualization/engine.js.map +1 -1
  391. package/components/virtualization/virtualization.d.ts +61 -63
  392. package/components/virtualization/virtualization.js +6 -5
  393. package/components/virtualization/virtualization.js.map +1 -1
  394. package/custom-elements.json +16769 -19698
  395. package/igniteui-webcomponents.css-data.json +2 -2
  396. package/igniteui-webcomponents.html-data.json +1 -1
  397. package/index.d.ts +3 -1
  398. package/index.js +2 -0
  399. package/index.js.map +1 -1
  400. package/internals/abort-handler.d.ts +13 -25
  401. package/internals/abort-handler.js +4 -6
  402. package/internals/abort-handler.js.map +1 -1
  403. package/internals/context.d.ts +13 -7
  404. package/internals/context.js +2 -1
  405. package/internals/context.js.map +1 -1
  406. package/internals/controllers/adopt-styles.d.ts +19 -20
  407. package/internals/controllers/adopt-styles.js +3 -8
  408. package/internals/controllers/adopt-styles.js.map +1 -1
  409. package/internals/controllers/aria-projection.d.ts +56 -55
  410. package/internals/controllers/aria-projection.js +14 -15
  411. package/internals/controllers/aria-projection.js.map +1 -1
  412. package/internals/controllers/async-consumer.js.map +1 -1
  413. package/internals/controllers/command.d.ts +15 -30
  414. package/internals/controllers/command.js +2 -7
  415. package/internals/controllers/command.js.map +1 -1
  416. package/internals/controllers/context-provider.d.ts +7 -13
  417. package/internals/controllers/context-provider.js.map +1 -1
  418. package/internals/controllers/focus-ring.d.ts +10 -30
  419. package/internals/controllers/focus-ring.js +6 -12
  420. package/internals/controllers/focus-ring.js.map +1 -1
  421. package/internals/controllers/fullscreen.d.ts +7 -23
  422. package/internals/controllers/fullscreen.js +3 -9
  423. package/internals/controllers/fullscreen.js.map +1 -1
  424. package/internals/controllers/gestures.d.ts +10 -29
  425. package/internals/controllers/gestures.js +1 -3
  426. package/internals/controllers/gestures.js.map +1 -1
  427. package/internals/controllers/group.d.ts +13 -30
  428. package/internals/controllers/group.js.map +1 -1
  429. package/internals/controllers/host-listeners.d.ts +28 -0
  430. package/internals/controllers/host-listeners.js +27 -0
  431. package/internals/controllers/host-listeners.js.map +1 -0
  432. package/internals/controllers/id-resolver.d.ts +8 -9
  433. package/internals/controllers/id-resolver.js +6 -14
  434. package/internals/controllers/id-resolver.js.map +1 -1
  435. package/internals/controllers/internals.d.ts +53 -104
  436. package/internals/controllers/internals.js +40 -13
  437. package/internals/controllers/internals.js.map +1 -1
  438. package/internals/controllers/key-bindings.d.ts +61 -158
  439. package/internals/controllers/key-bindings.js +68 -67
  440. package/internals/controllers/key-bindings.js.map +1 -1
  441. package/internals/controllers/keys.d.ts +32 -0
  442. package/internals/controllers/keys.js +20 -0
  443. package/internals/controllers/keys.js.map +1 -0
  444. package/internals/controllers/mutation-observer.d.ts +14 -37
  445. package/internals/controllers/mutation-observer.js +1 -1
  446. package/internals/controllers/mutation-observer.js.map +1 -1
  447. package/internals/controllers/resize-observer.d.ts +9 -19
  448. package/internals/controllers/resize-observer.js.map +1 -1
  449. package/internals/controllers/root-click.d.ts +11 -42
  450. package/internals/controllers/root-click.js +4 -6
  451. package/internals/controllers/root-click.js.map +1 -1
  452. package/internals/controllers/roving-focus.d.ts +16 -35
  453. package/internals/controllers/roving-focus.js.map +1 -1
  454. package/internals/controllers/slot.d.ts +25 -54
  455. package/internals/controllers/slot.js +6 -6
  456. package/internals/controllers/slot.js.map +1 -1
  457. package/internals/controllers/toggle.d.ts +44 -48
  458. package/internals/controllers/toggle.js.map +1 -1
  459. package/internals/date/compare.js.map +1 -1
  460. package/internals/date/converters.d.ts +10 -7
  461. package/internals/date/converters.js.map +1 -1
  462. package/internals/date/model.d.ts +9 -16
  463. package/internals/date/model.js +22 -25
  464. package/internals/date/model.js.map +1 -1
  465. package/internals/decorators/blazorAdditionalDependencies.d.ts +4 -2
  466. package/internals/decorators/blazorAdditionalDependencies.js.map +1 -1
  467. package/internals/decorators/blazorDeepImport.d.ts +1 -3
  468. package/internals/decorators/blazorDeepImport.js.map +1 -1
  469. package/internals/decorators/blazorInclude.d.ts +3 -2
  470. package/internals/decorators/blazorInclude.js.map +1 -1
  471. package/internals/decorators/blazorIndirectRender.d.ts +1 -3
  472. package/internals/decorators/blazorIndirectRender.js.map +1 -1
  473. package/internals/decorators/blazorSuppressComponent.d.ts +1 -3
  474. package/internals/decorators/blazorSuppressComponent.js.map +1 -1
  475. package/internals/decorators/coerced-property.d.ts +14 -20
  476. package/internals/decorators/coerced-property.js.map +1 -1
  477. package/internals/decorators/shadow-options.d.ts +2 -5
  478. package/internals/decorators/shadow-options.js.map +1 -1
  479. package/internals/definitions/defineAllComponents.js +6 -0
  480. package/internals/definitions/defineAllComponents.js.map +1 -1
  481. package/internals/directives/drag.d.ts +51 -81
  482. package/internals/directives/drag.js +27 -89
  483. package/internals/directives/drag.js.map +1 -1
  484. package/internals/directives/pointer-operation.d.ts +75 -0
  485. package/internals/directives/pointer-operation.js +92 -0
  486. package/internals/directives/pointer-operation.js.map +1 -0
  487. package/internals/directives/resize.d.ts +36 -64
  488. package/internals/directives/resize.js +18 -85
  489. package/internals/directives/resize.js.map +1 -1
  490. package/internals/i18n/EN/calendar.resources.d.ts +8 -2
  491. package/internals/i18n/EN/calendar.resources.js +2 -2
  492. package/internals/i18n/EN/calendar.resources.js.map +1 -1
  493. package/internals/i18n/EN/chat.resources.d.ts +8 -2
  494. package/internals/i18n/EN/chat.resources.js +3 -10
  495. package/internals/i18n/EN/chat.resources.js.map +1 -1
  496. package/internals/i18n/EN/date-picker.resources.d.ts +6 -4
  497. package/internals/i18n/EN/date-picker.resources.js +1 -7
  498. package/internals/i18n/EN/date-picker.resources.js.map +1 -1
  499. package/internals/i18n/EN/date-range-picker.resources.d.ts +9 -2
  500. package/internals/i18n/EN/date-range-picker.resources.js +2 -2
  501. package/internals/i18n/EN/date-range-picker.resources.js.map +1 -1
  502. package/internals/i18n/i18n-controller.d.ts +44 -46
  503. package/internals/i18n/i18n-controller.js +46 -33
  504. package/internals/i18n/i18n-controller.js.map +1 -1
  505. package/internals/i18n/utils.d.ts +9 -4
  506. package/internals/i18n/utils.js +4 -27
  507. package/internals/i18n/utils.js.map +1 -1
  508. package/internals/mixins/alert.d.ts +10 -25
  509. package/internals/mixins/alert.js.map +1 -1
  510. package/internals/mixins/combo-box.d.ts +21 -11
  511. package/internals/mixins/combo-box.js +16 -22
  512. package/internals/mixins/combo-box.js.map +1 -1
  513. package/internals/mixins/event-emitter.js +9 -11
  514. package/internals/mixins/event-emitter.js.map +1 -1
  515. package/internals/mixins/forms/associated-required.d.ts +4 -4
  516. package/internals/mixins/forms/associated-required.js.map +1 -1
  517. package/internals/mixins/forms/associated.d.ts +4 -2
  518. package/internals/mixins/forms/associated.js +8 -19
  519. package/internals/mixins/forms/associated.js.map +1 -1
  520. package/internals/mixins/forms/form-transformers.js.map +1 -1
  521. package/internals/mixins/forms/types.d.ts +24 -80
  522. package/internals/mixins/forms/types.js.map +1 -1
  523. package/internals/mixins/group.d.ts +18 -0
  524. package/internals/mixins/group.js +37 -0
  525. package/internals/mixins/group.js.map +1 -0
  526. package/internals/mixins/i18n.d.ts +10 -16
  527. package/internals/mixins/i18n.js.map +1 -1
  528. package/internals/mixins/mask-behavior.d.ts +8 -22
  529. package/internals/mixins/mask-behavior.js +1 -2
  530. package/internals/mixins/mask-behavior.js.map +1 -1
  531. package/internals/mixins/option.d.ts +1 -2
  532. package/internals/mixins/option.js +2 -1
  533. package/internals/mixins/option.js.map +1 -1
  534. package/internals/part-map.d.ts +4 -2
  535. package/internals/part-map.js +1 -1
  536. package/internals/part-map.js.map +1 -1
  537. package/internals/templates/input-shell.d.ts +8 -17
  538. package/internals/templates/input-shell.js +4 -1
  539. package/internals/templates/input-shell.js.map +1 -1
  540. package/internals/templates/masked-input.d.ts +7 -8
  541. package/internals/templates/masked-input.js.map +1 -1
  542. package/internals/templates/slotted-icon.d.ts +7 -12
  543. package/internals/templates/slotted-icon.js.map +1 -1
  544. package/internals/templates/toggle-shell.d.ts +6 -7
  545. package/internals/templates/toggle-shell.js.map +1 -1
  546. package/internals/timing.d.ts +5 -14
  547. package/internals/timing.js.map +1 -1
  548. package/internals/utils/arrays.d.ts +21 -21
  549. package/internals/utils/arrays.js +14 -0
  550. package/internals/utils/arrays.js.map +1 -1
  551. package/internals/utils/dom.d.ts +51 -39
  552. package/internals/utils/dom.js +1 -2
  553. package/internals/utils/dom.js.map +1 -1
  554. package/internals/utils/events.d.ts +29 -16
  555. package/internals/utils/events.js +9 -1
  556. package/internals/utils/events.js.map +1 -1
  557. package/internals/utils/lit.d.ts +5 -2
  558. package/internals/utils/lit.js.map +1 -1
  559. package/internals/utils/math.d.ts +8 -6
  560. package/internals/utils/math.js.map +1 -1
  561. package/internals/utils/objects.d.ts +3 -20
  562. package/internals/utils/objects.js +1 -39
  563. package/internals/utils/objects.js.map +1 -1
  564. package/internals/utils/strings.d.ts +9 -11
  565. package/internals/utils/strings.js.map +1 -1
  566. package/internals/utils/types.d.ts +16 -3
  567. package/internals/utils/types.js +3 -0
  568. package/internals/utils/types.js.map +1 -1
  569. package/internals/validators.d.ts +9 -8
  570. package/internals/validators.js +12 -6
  571. package/internals/validators.js.map +1 -1
  572. package/package.json +1 -1
  573. package/skills/README.md +3 -0
  574. package/skills/igniteui-wc-figma-to-app/SKILL.md +907 -0
  575. package/skills/igniteui-wc-figma-to-app/references/asset-extraction.md +363 -0
  576. package/skills/igniteui-wc-figma-to-app/references/design-token-bridge.md +407 -0
  577. package/skills/igniteui-wc-figma-to-app/references/figma-component-map.md +325 -0
  578. package/skills/igniteui-wc-figma-to-app/references/mcp-setup.md +409 -0
  579. package/skills/igniteui-wc-figma-to-app/references/validation-patterns.md +376 -0
  580. package/skills/igniteui-wc-generate-from-image-design/references/gotchas.md +21 -0
  581. package/skills/igniteui-wc-integrate-with-framework/SKILL.md +4 -3
  582. package/skills/igniteui-wc-integrate-with-framework/references/vanilla-js.md +14 -0
  583. package/skills/igniteui-wc-migrate-grid-lite-to-premium/SKILL.md +12 -2
  584. package/theming/config.d.ts +14 -5
  585. package/theming/config.js +38 -18
  586. package/theming/config.js.map +1 -1
  587. package/theming/context.d.ts +1 -23
  588. package/theming/context.js.map +1 -1
  589. package/theming/theming-controller.d.ts +2 -32
  590. package/theming/theming-controller.js +15 -21
  591. package/theming/theming-controller.js.map +1 -1
  592. package/theming/theming-event.d.ts +0 -7
  593. package/theming/theming-event.js +0 -13
  594. package/theming/theming-event.js.map +1 -1
  595. package/theming/types.d.ts +1 -8
  596. package/theming/types.js.map +1 -1
  597. package/web-types.json +3 -3
  598. package/animations/presets/slide/index.d.ts +0 -3
  599. package/animations/presets/slide/index.js +0 -16
  600. package/animations/presets/slide/index.js.map +0 -1
  601. package/internals/controllers/root-scroll.d.ts +0 -31
  602. package/internals/controllers/root-scroll.js +0 -71
  603. package/internals/controllers/root-scroll.js.map +0 -1
  604. package/theming/utils.d.ts +0 -11
  605. package/theming/utils.js +0 -20
  606. package/theming/utils.js.map +0 -1
@@ -2,14 +2,12 @@ import { type LitElement, type ReactiveController, type ReactiveControllerHost }
2
2
  import { Directive, type DirectiveParameters, type ElementPart, type PartInfo } from 'lit/directive.js';
3
3
  type ControllerHost = ReactiveControllerHost & LitElement;
4
4
  /**
5
- * ARIA semantics a composite host projects onto the native editor of an
6
- * input-shaped component.
5
+ * The ARIA semantics that a composite host projects onto the native editor.
7
6
  *
8
- * The host cannot publish these itself: it delegates focus, so the native
9
- * editor inside the input component's shadow root is what assistive technology
10
- * lands on and reports. All relations travel as element references - an IDREF
11
- * cannot cross a shadow boundary, while ARIA element reflection resolves into
12
- * ancestor tree scopes.
7
+ * @remarks
8
+ * The host delegates focus, so assistive technology lands on the editor of
9
+ * the input-shaped component and reports it. Every relation travels as an
10
+ * element reference, because an IDREF does not cross a shadow boundary.
13
11
  */
14
12
  export type ProjectedARIA = {
15
13
  role?: string;
@@ -22,21 +20,17 @@ export type ProjectedARIA = {
22
20
  labelledBy?: ReadonlyArray<Element> | null;
23
21
  activeDescendant?: Element | null;
24
22
  };
25
- /** Configuration for the {@link AriaTargetController}. */
26
23
  type AriaTargetConfig = {
27
24
  /** Resolves the component's own `ElementInternals` labels. */
28
25
  labels: () => ReadonlyArray<Element> | null;
29
- /**
30
- * Resolves the component's own description element (its helper-text
31
- * container), or `null` when it currently renders no description content.
32
- */
26
+ /** Resolves the helper-text container, or `null` when there is none. */
33
27
  description: () => Element | null;
34
28
  };
35
29
  /**
36
- * Binding values for a native editor element, resolved from the projected
37
- * state merged with the editor's own ARIA. Applied onto the editor with the
38
- * {@link ariaBindings} directive: scalars bind as attributes, relations bind
39
- * through the ARIA element-reflection properties.
30
+ * The binding values for a native editor element, resolved from the projected
31
+ * state and the own ARIA of the editor, and applied by the
32
+ * {@link ariaBindings} directive. A scalar binds as an attribute, a relation
33
+ * through an ARIA element-reflection property.
40
34
  */
41
35
  export type ResolvedARIABindings = {
42
36
  role?: string;
@@ -45,9 +39,9 @@ export type ResolvedARIABindings = {
45
39
  disabled?: string;
46
40
  label?: string;
47
41
  /**
48
- * Same-root IDREF for the editor's own description, applied while no
49
- * description is projected. Unlike element reflection, a content attribute
50
- * stays visible to tooling that only reads attributes (e.g. axe).
42
+ * The same-root IDREF for the own description of the editor. It applies
43
+ * while the host projects no description, so tooling that reads attributes
44
+ * only, for example axe, still sees a content attribute.
51
45
  */
52
46
  describedByRef?: string;
53
47
  labelledBy: ReadonlyArray<Element> | null;
@@ -56,47 +50,56 @@ export type ResolvedARIABindings = {
56
50
  activeDescendant: Element | null;
57
51
  };
58
52
  /**
59
- * The receiving end of an ARIA projection, added by every input-shaped
60
- * component. Holds the state a composite host currently projects and resolves
61
- * it against the component's own ARIA when the native editor is rendered.
53
+ * The receiving end of an ARIA projection. Every input-shaped component adds
54
+ * it to hold the state that a composite host projects, and resolves that
55
+ * state against its own ARIA.
62
56
  *
63
- * Not a reactive controller - it needs no lifecycle hooks, only a render
64
- * scheduled on the host when the projected state changes.
57
+ * @remarks
58
+ * Not a reactive controller: it needs only a host render when the projected
59
+ * state changes.
65
60
  */
66
61
  declare class AriaTargetController {
67
62
  private readonly _host;
68
63
  private readonly _config;
69
64
  private _projected;
65
+ /** The bindings last resolved for the native editor. */
66
+ private _resolved?;
70
67
  constructor(host: ControllerHost, config: AriaTargetConfig);
71
68
  /**
72
- * Replaces the projected state, scheduling a host render only when it
73
- * actually changed so projecting on every host update stays cheap.
69
+ * Replaces the projected state.
70
+ *
71
+ * @remarks
72
+ * A host render happens only when the resolved bindings change, so a
73
+ * projection on every host update stays inexpensive. The comparison uses
74
+ * the resolved bindings, so it also catches a change to the own labels or
75
+ * description, which the component cannot observe.
74
76
  */
75
77
  setProjected(state: ProjectedARIA): void;
76
78
  /**
77
- * Mirrors the projected `role`/`hasPopup` as `data-role`/`data-haspopup`
78
- * attributes on the component itself. The input themes style anchors of
79
- * composite widgets differently and key off these; the ARIA itself lives on
80
- * the native editor inside the shadow root, where `:host()` selectors
81
- * cannot observe it.
79
+ * Mirrors the projected `role` and `hasPopup` onto `data-role` and
80
+ * `data-haspopup`.
81
+ *
82
+ * @remarks
83
+ * The input themes style the anchor of a composite widget from these
84
+ * attributes. The ARIA itself stays on the editor in the shadow root, where
85
+ * a `:host()` selector cannot observe it.
82
86
  */
83
87
  private _reflectStylingHooks;
84
88
  /**
85
- * Resolves the binding values for the native editor element by merging the
86
- * projected state with the editor's own ARIA.
89
+ * Resolves the binding values for the native editor element.
87
90
  *
88
- * Projected labels take precedence over the component's own. The editor's
89
- * description stays a same-root IDREF ({@link ResolvedARIABindings.describedByRef})
90
- * while nothing is projected; once a host projects a description, the whole
91
- * relation switches to element references - attribute and reflection cannot
92
- * coexist - with the editor's own description element joining the projected
93
- * ones.
91
+ * @remarks
92
+ * A projected label wins over the own label of the component. The
93
+ * description stays a same-root IDREF while the host projects none, and the
94
+ * whole relation switches to element references afterwards, because an
95
+ * attribute and a reflection cannot coexist. See
96
+ * {@link ResolvedARIABindings.describedByRef}.
94
97
  */
95
98
  resolveBindings(): ResolvedARIABindings;
96
99
  }
97
100
  /**
98
- * Applies {@link ResolvedARIABindings} onto the native editor element -
99
- * relations on every render, scalar attributes only when they changed.
101
+ * Applies {@link ResolvedARIABindings} onto the native editor element. It
102
+ * applies a relation on every render, and a scalar only on a change.
100
103
  */
101
104
  declare class AriaBindingsDirective extends Directive {
102
105
  private _previous?;
@@ -105,21 +108,20 @@ declare class AriaBindingsDirective extends Directive {
105
108
  update(part: ElementPart, [bindings]: DirectiveParameters<this>): unknown;
106
109
  }
107
110
  /**
108
- * Binds resolved ARIA state onto a native editor element as a single element
109
- * expression, e.g. `<input ${ariaBindings(aria)} />`.
111
+ * Binds the resolved ARIA state onto a native editor element as one element
112
+ * expression, for example `<input ${ariaBindings(aria)} />`.
110
113
  */
111
114
  export declare const ariaBindings: (_: ResolvedARIABindings) => import("lit-html/directive.js").DirectiveResult<typeof AriaBindingsDirective>;
112
- /** Configuration for the {@link AriaProjectorController}. */
113
115
  type AriaProjectorConfig = {
114
- /** Resolves the input-shaped component the ARIA state is projected onto. */
116
+ /** Resolves the input-shaped component that receives the ARIA state. */
115
117
  target: () => Element | null | undefined;
116
- /** Computes the ARIA state to project. Invoked after every host update. */
118
+ /** Computes the ARIA state to project, after every host update. */
117
119
  state: () => ProjectedARIA;
118
120
  };
119
121
  /**
120
- * The sending end of an ARIA projection, added by composite hosts
121
- * (e.g. `igc-select`). After every host update it pushes the computed ARIA
122
- * state onto the target component's {@link AriaTargetController}.
122
+ * The sending end of an ARIA projection. A composite host such as
123
+ * `igc-select` adds it to push the computed ARIA state onto the
124
+ * {@link AriaTargetController} of the target after every host update.
123
125
  */
124
126
  declare class AriaProjectorController implements ReactiveController {
125
127
  private readonly _host;
@@ -130,15 +132,14 @@ declare class AriaProjectorController implements ReactiveController {
130
132
  hostUpdated(): void;
131
133
  }
132
134
  /**
133
- * Creates and adds an {@link AriaTargetController} to an input-shaped
134
- * component, making its native editor a valid target for
135
- * {@link addAriaProjector} - the editor is what assistive technology lands on
136
- * and reports once the component's host delegates focus to it.
135
+ * Creates an {@link AriaTargetController} and adds it to an input-shaped
136
+ * component. It makes the native editor of the component a valid target for
137
+ * {@link addAriaProjector}.
137
138
  */
138
139
  export declare function addAriaTarget(host: ControllerHost, config: AriaTargetConfig): AriaTargetController;
139
140
  /**
140
- * Creates and adds an {@link AriaProjectorController} to a composite host,
141
- * projecting ARIA semantics onto the native editor of the target component.
141
+ * Creates an {@link AriaProjectorController} and adds it to a composite host.
142
+ * It projects ARIA onto the native editor of the target component.
142
143
  */
143
144
  export declare function addAriaProjector(host: ControllerHost, config: AriaProjectorConfig): AriaProjectorController;
144
145
  export type { AriaProjectorController, AriaTargetController };
@@ -1,22 +1,19 @@
1
1
  import { noChange, } from 'lit';
2
2
  import { Directive, directive, PartType, } from 'lit/directive.js';
3
+ import { sameItems } from '../utils/arrays.js';
3
4
  const targets = new WeakMap();
4
- function elementsEqual(a, b) {
5
- if (a == null || b == null) {
6
- return a == null && b == null;
7
- }
8
- return a.length === b.length && a.every((element, i) => element === b[i]);
9
- }
10
- function projectionsEqual(a, b) {
11
- return (a.role === b.role &&
5
+ function bindingsEqual(a, b) {
6
+ return (a !== undefined &&
7
+ a.role === b.role &&
12
8
  a.hasPopup === b.hasPopup &&
13
9
  a.expanded === b.expanded &&
14
10
  a.disabled === b.disabled &&
15
11
  a.label === b.label &&
16
- (a.activeDescendant ?? null) === (b.activeDescendant ?? null) &&
17
- elementsEqual(a.controls, b.controls) &&
18
- elementsEqual(a.describedBy, b.describedBy) &&
19
- elementsEqual(a.labelledBy, b.labelledBy));
12
+ a.describedByRef === b.describedByRef &&
13
+ a.activeDescendant === b.activeDescendant &&
14
+ sameItems(a.controls, b.controls) &&
15
+ sameItems(a.describedBy, b.describedBy) &&
16
+ sameItems(a.labelledBy, b.labelledBy));
20
17
  }
21
18
  class AriaTargetController {
22
19
  constructor(host, config) {
@@ -26,8 +23,9 @@ class AriaTargetController {
26
23
  targets.set(host, this);
27
24
  }
28
25
  setProjected(state) {
29
- if (!projectionsEqual(this._projected, state)) {
30
- this._projected = state;
26
+ const previous = this._resolved;
27
+ this._projected = state;
28
+ if (!bindingsEqual(previous, this.resolveBindings())) {
31
29
  this._reflectStylingHooks();
32
30
  this._host.requestUpdate();
33
31
  }
@@ -45,7 +43,7 @@ class AriaTargetController {
45
43
  resolveBindings() {
46
44
  const projected = this._projected;
47
45
  const description = this._config.description();
48
- return {
46
+ this._resolved = {
49
47
  role: projected.role,
50
48
  hasPopup: projected.hasPopup,
51
49
  expanded: projected.expanded,
@@ -63,6 +61,7 @@ class AriaTargetController {
63
61
  : description?.id || undefined,
64
62
  activeDescendant: projected.activeDescendant ?? null,
65
63
  };
64
+ return this._resolved;
66
65
  }
67
66
  }
68
67
  const scalarBindings = [
@@ -1 +1 @@
1
- {"version":3,"file":"aria-projection.js","sourceRoot":"","sources":["../../../src/internals/controllers/aria-projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,GAGT,MAAM,KAAK,CAAC;AACb,OAAO,EACL,SAAS,EAET,SAAS,EAGT,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAkE1B,MAAM,OAAO,GAAG,IAAI,OAAO,EAAiC,CAAC;AAE7D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5B,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;gBACtD,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;gBAC7B,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;YAC7B,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAQD,MAAM,UAAU,aAAa,CAC3B,IAAoB,EACpB,MAAwB;IAExB,OAAO,IAAI,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC;AAMD,MAAM,UAAU,gBAAgB,CAC9B,IAAoB,EACpB,MAA2B;IAE3B,OAAO,IAAI,uBAAuB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACnD,CAAC","sourcesContent":["import {\n type LitElement,\n noChange,\n type ReactiveController,\n type ReactiveControllerHost,\n} from 'lit';\nimport {\n Directive,\n type DirectiveParameters,\n directive,\n type ElementPart,\n type PartInfo,\n PartType,\n} from 'lit/directive.js';\n\ntype ControllerHost = ReactiveControllerHost & LitElement;\n\n/**\n * ARIA semantics a composite host projects onto the native editor of an\n * input-shaped component.\n *\n * The host cannot publish these itself: it delegates focus, so the native\n * editor inside the input component's shadow root is what assistive technology\n * lands on and reports. All relations travel as element references - an IDREF\n * cannot cross a shadow boundary, while ARIA element reflection resolves into\n * ancestor tree scopes.\n */\nexport type ProjectedARIA = {\n role?: string;\n hasPopup?: string;\n expanded?: string;\n disabled?: string;\n label?: string;\n controls?: ReadonlyArray<Element> | null;\n describedBy?: ReadonlyArray<Element> | null;\n labelledBy?: ReadonlyArray<Element> | null;\n activeDescendant?: Element | null;\n};\n\n/** Configuration for the {@link AriaTargetController}. */\ntype AriaTargetConfig = {\n /** Resolves the component's own `ElementInternals` labels. */\n labels: () => ReadonlyArray<Element> | null;\n /**\n * Resolves the component's own description element (its helper-text\n * container), or `null` when it currently renders no description content.\n */\n description: () => Element | null;\n};\n\n/**\n * Binding values for a native editor element, resolved from the projected\n * state merged with the editor's own ARIA. Applied onto the editor with the\n * {@link ariaBindings} directive: scalars bind as attributes, relations bind\n * through the ARIA element-reflection properties.\n */\nexport type ResolvedARIABindings = {\n role?: string;\n hasPopup?: string;\n expanded?: string;\n disabled?: string;\n label?: string;\n /**\n * Same-root IDREF for the editor's own description, applied while no\n * description is projected. Unlike element reflection, a content attribute\n * stays visible to tooling that only reads attributes (e.g. axe).\n */\n describedByRef?: string;\n labelledBy: ReadonlyArray<Element> | null;\n controls: ReadonlyArray<Element> | null;\n describedBy: ReadonlyArray<Element> | null;\n activeDescendant: Element | null;\n};\n\n/**\n * Internal registry resolving an input-shaped component to its ARIA target\n * controller, so composite hosts can project state without the component\n * exposing a public member for it.\n */\nconst targets = new WeakMap<Element, AriaTargetController>();\n\nfunction elementsEqual(\n a: ReadonlyArray<Element> | null | undefined,\n b: ReadonlyArray<Element> | null | undefined\n): boolean {\n if (a == null || b == null) {\n return a == null && b == null;\n }\n\n return a.length === b.length && a.every((element, i) => element === b[i]);\n}\n\nfunction projectionsEqual(a: ProjectedARIA, b: ProjectedARIA): boolean {\n return (\n a.role === b.role &&\n a.hasPopup === b.hasPopup &&\n a.expanded === b.expanded &&\n a.disabled === b.disabled &&\n a.label === b.label &&\n (a.activeDescendant ?? null) === (b.activeDescendant ?? null) &&\n elementsEqual(a.controls, b.controls) &&\n elementsEqual(a.describedBy, b.describedBy) &&\n elementsEqual(a.labelledBy, b.labelledBy)\n );\n}\n\n/**\n * The receiving end of an ARIA projection, added by every input-shaped\n * component. Holds the state a composite host currently projects and resolves\n * it against the component's own ARIA when the native editor is rendered.\n *\n * Not a reactive controller - it needs no lifecycle hooks, only a render\n * scheduled on the host when the projected state changes.\n */\nclass AriaTargetController {\n private readonly _host: ControllerHost;\n private readonly _config: AriaTargetConfig;\n private _projected: ProjectedARIA = {};\n\n constructor(host: ControllerHost, config: AriaTargetConfig) {\n this._host = host;\n this._config = config;\n targets.set(host, this);\n }\n\n /**\n * Replaces the projected state, scheduling a host render only when it\n * actually changed so projecting on every host update stays cheap.\n */\n public setProjected(state: ProjectedARIA): void {\n if (!projectionsEqual(this._projected, state)) {\n this._projected = state;\n this._reflectStylingHooks();\n this._host.requestUpdate();\n }\n }\n\n /**\n * Mirrors the projected `role`/`hasPopup` as `data-role`/`data-haspopup`\n * attributes on the component itself. The input themes style anchors of\n * composite widgets differently and key off these; the ARIA itself lives on\n * the native editor inside the shadow root, where `:host()` selectors\n * cannot observe it.\n */\n private _reflectStylingHooks(): void {\n const host = this._host;\n const { role, hasPopup } = this._projected;\n\n role\n ? host.setAttribute('data-role', role)\n : host.removeAttribute('data-role');\n hasPopup\n ? host.setAttribute('data-haspopup', hasPopup)\n : host.removeAttribute('data-haspopup');\n }\n\n /**\n * Resolves the binding values for the native editor element by merging the\n * projected state with the editor's own ARIA.\n *\n * Projected labels take precedence over the component's own. The editor's\n * description stays a same-root IDREF ({@link ResolvedARIABindings.describedByRef})\n * while nothing is projected; once a host projects a description, the whole\n * relation switches to element references - attribute and reflection cannot\n * coexist - with the editor's own description element joining the projected\n * ones.\n */\n public resolveBindings(): ResolvedARIABindings {\n const projected = this._projected;\n const description = this._config.description();\n\n return {\n role: projected.role,\n hasPopup: projected.hasPopup,\n expanded: projected.expanded,\n disabled: projected.disabled,\n label: projected.label,\n labelledBy: projected.labelledBy ?? this._config.labels(),\n controls: projected.controls ?? null,\n describedBy: projected.describedBy\n ? description\n ? [description, ...projected.describedBy]\n : projected.describedBy\n : null,\n describedByRef: projected.describedBy\n ? undefined\n : description?.id || undefined,\n activeDescendant: projected.activeDescendant ?? null,\n };\n }\n}\n\nconst scalarBindings = [\n ['role', 'role'],\n ['hasPopup', 'aria-haspopup'],\n ['expanded', 'aria-expanded'],\n ['disabled', 'aria-disabled'],\n ['label', 'aria-label'],\n ['describedByRef', 'aria-describedby'],\n] as const;\n\n/**\n * Applies {@link ResolvedARIABindings} onto the native editor element -\n * relations on every render, scalar attributes only when they changed.\n */\nclass AriaBindingsDirective extends Directive {\n private _previous?: ResolvedARIABindings;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n\n if (partInfo.type !== PartType.ELEMENT) {\n throw new Error(\n '`ariaBindings()` can only be used as an element expression.'\n );\n }\n }\n\n public override render(_: ResolvedARIABindings): unknown {\n return noChange;\n }\n\n public override update(\n part: ElementPart,\n [bindings]: DirectiveParameters<this>\n ): unknown {\n const element = part.element;\n const previous = this._previous;\n this._previous = bindings;\n\n // Relations are re-asserted on every render: element references assigned\n // while the editor is detached (its first render commits inside the\n // template fragment) are dropped by the browser, so memoizing them here\n // would leave the associations permanently missing.\n // Assigning them first also means the scalar pass below always observes\n // the final state, since a reflection property detaches the corresponding\n // content attribute.\n element.ariaLabelledByElements = bindings.labelledBy;\n element.ariaControlsElements = bindings.controls;\n element.ariaDescribedByElements = bindings.describedBy;\n element.ariaActiveDescendantElement = bindings.activeDescendant;\n\n for (const [key, attribute] of scalarBindings) {\n const value = bindings[key];\n\n if (!previous || previous[key] !== value) {\n value != null\n ? element.setAttribute(attribute, value)\n : element.removeAttribute(attribute);\n }\n }\n\n return noChange;\n }\n}\n\n/**\n * Binds resolved ARIA state onto a native editor element as a single element\n * expression, e.g. `<input ${ariaBindings(aria)} />`.\n */\nexport const ariaBindings = directive(AriaBindingsDirective);\n\n/** Configuration for the {@link AriaProjectorController}. */\ntype AriaProjectorConfig = {\n /** Resolves the input-shaped component the ARIA state is projected onto. */\n target: () => Element | null | undefined;\n /** Computes the ARIA state to project. Invoked after every host update. */\n state: () => ProjectedARIA;\n};\n\n/**\n * The sending end of an ARIA projection, added by composite hosts\n * (e.g. `igc-select`). After every host update it pushes the computed ARIA\n * state onto the target component's {@link AriaTargetController}.\n */\nclass AriaProjectorController implements ReactiveController {\n private readonly _host: ControllerHost;\n private readonly _config: AriaProjectorConfig;\n private _retryScheduled = false;\n\n constructor(host: ControllerHost, config: AriaProjectorConfig) {\n this._host = host;\n this._config = config;\n host.addController(this);\n }\n\n /** @internal */\n public hostUpdated(): void {\n const element = this._config.target();\n\n if (!element) {\n return;\n }\n\n const target = targets.get(element);\n\n if (target) {\n target.setProjected(this._config.state());\n return;\n }\n\n // The target exists but has no controller yet - it is not upgraded on the\n // host's first render when definitions register late. Re-project once its\n // definition resolves.\n if (!this._retryScheduled) {\n this._retryScheduled = true;\n\n customElements.whenDefined(element.localName).then(() => {\n this._retryScheduled = false;\n this._host.requestUpdate();\n });\n }\n }\n}\n\n/**\n * Creates and adds an {@link AriaTargetController} to an input-shaped\n * component, making its native editor a valid target for\n * {@link addAriaProjector} - the editor is what assistive technology lands on\n * and reports once the component's host delegates focus to it.\n */\nexport function addAriaTarget(\n host: ControllerHost,\n config: AriaTargetConfig\n): AriaTargetController {\n return new AriaTargetController(host, config);\n}\n\n/**\n * Creates and adds an {@link AriaProjectorController} to a composite host,\n * projecting ARIA semantics onto the native editor of the target component.\n */\nexport function addAriaProjector(\n host: ControllerHost,\n config: AriaProjectorConfig\n): AriaProjectorController {\n return new AriaProjectorController(host, config);\n}\n\nexport type { AriaProjectorController, AriaTargetController };\n"]}
1
+ {"version":3,"file":"aria-projection.js","sourceRoot":"","sources":["../../../src/internals/controllers/aria-projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,GAGT,MAAM,KAAK,CAAC;AACb,OAAO,EACL,SAAS,EAET,SAAS,EAGT,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA2D/C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAiC,CAAC;AAE7D,SAAS,aAAa,CACpB,CAAmC,EACnC,CAAuB;IAEvB,OAAO,CACL,CAAC,KAAK,SAAS;QACf,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI;QACjB,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ;QACzB,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ;QACzB,CAAC,CAAC,QAAQ,KAAK,CAAC,C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ange,\n type ReactiveController,\n type ReactiveControllerHost,\n} from 'lit';\nimport {\n Directive,\n type DirectiveParameters,\n directive,\n type ElementPart,\n type PartInfo,\n PartType,\n} from 'lit/directive.js';\nimport { sameItems } from '../utils/arrays.js';\n\ntype ControllerHost = ReactiveControllerHost & LitElement;\n\n/**\n * The ARIA semantics that a composite host projects onto the native editor.\n *\n * @remarks\n * The host delegates focus, so assistive technology lands on the editor of\n * the input-shaped component and reports it. Every relation travels as an\n * element reference, because an IDREF does not cross a shadow boundary.\n */\nexport type ProjectedARIA = {\n role?: string;\n hasPopup?: string;\n expanded?: string;\n disabled?: string;\n label?: string;\n controls?: ReadonlyArray<Element> | null;\n describedBy?: ReadonlyArray<Element> | null;\n labelledBy?: ReadonlyArray<Element> | null;\n activeDescendant?: Element | null;\n};\n\ntype AriaTargetConfig = {\n /** Resolves the component's own `ElementInternals` labels. */\n labels: () => ReadonlyArray<Element> | null;\n /** Resolves the helper-text container, or `null` when there is none. */\n description: () => Element | null;\n};\n\n/**\n * The binding values for a native editor element, resolved from the projected\n * state and the own ARIA of the editor, and applied by the\n * {@link ariaBindings} directive. A scalar binds as an attribute, a relation\n * through an ARIA element-reflection property.\n */\nexport type ResolvedARIABindings = {\n role?: string;\n hasPopup?: string;\n expanded?: string;\n disabled?: string;\n label?: string;\n /**\n * The same-root IDREF for the own description of the editor. It applies\n * while the host projects no description, so tooling that reads attributes\n * only, for example axe, still sees a content attribute.\n */\n describedByRef?: string;\n labelledBy: ReadonlyArray<Element> | null;\n controls: ReadonlyArray<Element> | null;\n describedBy: ReadonlyArray<Element> | null;\n activeDescendant: Element | null;\n};\n\n/**\n * Resolves an input-shaped component to its ARIA target controller, so the\n * component needs no public member for the projection.\n */\nconst targets = new WeakMap<Element, AriaTargetController>();\n\nfunction bindingsEqual(\n a: ResolvedARIABindings | undefined,\n b: ResolvedARIABindings\n): boolean {\n return (\n a !== undefined &&\n a.role === b.role &&\n a.hasPopup === b.hasPopup &&\n a.expanded === b.expanded &&\n a.disabled === b.disabled &&\n a.label === b.label &&\n a.describedByRef === b.describedByRef &&\n a.activeDescendant === b.activeDescendant &&\n sameItems(a.controls, b.controls) &&\n sameItems(a.describedBy, b.describedBy) &&\n sameItems(a.labelledBy, b.labelledBy)\n );\n}\n\n/**\n * The receiving end of an ARIA projection. Every input-shaped component adds\n * it to hold the state that a composite host projects, and resolves that\n * state against its own ARIA.\n *\n * @remarks\n * Not a reactive controller: it needs only a host render when the projected\n * state changes.\n */\nclass AriaTargetController {\n private readonly _host: ControllerHost;\n private readonly _config: AriaTargetConfig;\n private _projected: ProjectedARIA = {};\n /** The bindings last resolved for the native editor. */\n private _resolved?: ResolvedARIABindings;\n\n constructor(host: ControllerHost, config: AriaTargetConfig) {\n this._host = host;\n this._config = config;\n targets.set(host, this);\n }\n\n /**\n * Replaces the projected state.\n *\n * @remarks\n * A host render happens only when the resolved bindings change, so a\n * projection on every host update stays inexpensive. The comparison uses\n * the resolved bindings, so it also catches a change to the own labels or\n * description, which the component cannot observe.\n */\n public setProjected(state: ProjectedARIA): void {\n const previous = this._resolved;\n this._projected = state;\n\n if (!bindingsEqual(previous, this.resolveBindings())) {\n this._reflectStylingHooks();\n this._host.requestUpdate();\n }\n }\n\n /**\n * Mirrors the projected `role` and `hasPopup` onto `data-role` and\n * `data-haspopup`.\n *\n * @remarks\n * The input themes style the anchor of a composite widget from these\n * attributes. The ARIA itself stays on the editor in the shadow root, where\n * a `:host()` selector cannot observe it.\n */\n private _reflectStylingHooks(): void {\n const host = this._host;\n const { role, hasPopup } = this._projected;\n\n role\n ? host.setAttribute('data-role', role)\n : host.removeAttribute('data-role');\n hasPopup\n ? host.setAttribute('data-haspopup', hasPopup)\n : host.removeAttribute('data-haspopup');\n }\n\n /**\n * Resolves the binding values for the native editor element.\n *\n * @remarks\n * A projected label wins over the own label of the component. The\n * description stays a same-root IDREF while the host projects none, and the\n * whole relation switches to element references afterwards, because an\n * attribute and a reflection cannot coexist. See\n * {@link ResolvedARIABindings.describedByRef}.\n */\n public resolveBindings(): ResolvedARIABindings {\n const projected = this._projected;\n const description = this._config.description();\n\n this._resolved = {\n role: projected.role,\n hasPopup: projected.hasPopup,\n expanded: projected.expanded,\n disabled: projected.disabled,\n label: projected.label,\n labelledBy: projected.labelledBy ?? this._config.labels(),\n controls: projected.controls ?? null,\n describedBy: projected.describedBy\n ? description\n ? [description, ...projected.describedBy]\n : projected.describedBy\n : null,\n describedByRef: projected.describedBy\n ? undefined\n : description?.id || undefined,\n activeDescendant: projected.activeDescendant ?? null,\n };\n\n return this._resolved;\n }\n}\n\nconst scalarBindings = [\n ['role', 'role'],\n ['hasPopup', 'aria-haspopup'],\n ['expanded', 'aria-expanded'],\n ['disabled', 'aria-disabled'],\n ['label', 'aria-label'],\n ['describedByRef', 'aria-describedby'],\n] as const;\n\n/**\n * Applies {@link ResolvedARIABindings} onto the native editor element. It\n * applies a relation on every render, and a scalar only on a change.\n */\nclass AriaBindingsDirective extends Directive {\n private _previous?: ResolvedARIABindings;\n\n constructor(partInfo: PartInfo) {\n super(partInfo);\n\n if (partInfo.type !== PartType.ELEMENT) {\n throw new Error(\n '`ariaBindings()` can only be used as an element expression.'\n );\n }\n }\n\n public override render(_: ResolvedARIABindings): unknown {\n return noChange;\n }\n\n public override update(\n part: ElementPart,\n [bindings]: DirectiveParameters<this>\n ): unknown {\n const element = part.element;\n const previous = this._previous;\n this._previous = bindings;\n\n // The relations run on every render: the browser drops an element\n // reference assigned while the editor is outside the document, and the\n // first render commits inside the template fragment. They come first, so\n // the scalar pass sees the attributes that a reflection property removed.\n element.ariaLabelledByElements = bindings.labelledBy;\n element.ariaControlsElements = bindings.controls;\n element.ariaDescribedByElements = bindings.describedBy;\n element.ariaActiveDescendantElement = bindings.activeDescendant;\n\n for (const [key, attribute] of scalarBindings) {\n const value = bindings[key];\n\n if (!previous || previous[key] !== value) {\n value != null\n ? element.setAttribute(attribute, value)\n : element.removeAttribute(attribute);\n }\n }\n\n return noChange;\n }\n}\n\n/**\n * Binds the resolved ARIA state onto a native editor element as one element\n * expression, for example `<input ${ariaBindings(aria)} />`.\n */\nexport const ariaBindings = directive(AriaBindingsDirective);\n\ntype AriaProjectorConfig = {\n /** Resolves the input-shaped component that receives the ARIA state. */\n target: () => Element | null | undefined;\n /** Computes the ARIA state to project, after every host update. */\n state: () => ProjectedARIA;\n};\n\n/**\n * The sending end of an ARIA projection. A composite host such as\n * `igc-select` adds it to push the computed ARIA state onto the\n * {@link AriaTargetController} of the target after every host update.\n */\nclass AriaProjectorController implements ReactiveController {\n private readonly _host: ControllerHost;\n private readonly _config: AriaProjectorConfig;\n private _retryScheduled = false;\n\n constructor(host: ControllerHost, config: AriaProjectorConfig) {\n this._host = host;\n this._config = config;\n host.addController(this);\n }\n\n /** @internal */\n public hostUpdated(): void {\n const element = this._config.target();\n\n if (!element) {\n return;\n }\n\n const target = targets.get(element);\n\n if (target) {\n target.setProjected(this._config.state());\n return;\n }\n\n // The target exists but is not upgraded yet, because its definition\n // registered late. Project again once that definition resolves.\n if (!this._retryScheduled) {\n this._retryScheduled = true;\n\n customElements.whenDefined(element.localName).then(() => {\n this._retryScheduled = false;\n this._host.requestUpdate();\n });\n }\n }\n}\n\n/**\n * Creates an {@link AriaTargetController} and adds it to an input-shaped\n * component. It makes the native editor of the component a valid target for\n * {@link addAriaProjector}.\n */\nexport function addAriaTarget(\n host: ControllerHost,\n config: AriaTargetConfig\n): AriaTargetController {\n return new AriaTargetController(host, config);\n}\n\n/**\n * Creates an {@link AriaProjectorController} and adds it to a composite host.\n * It projects ARIA onto the native editor of the target component.\n */\nexport function addAriaProjector(\n host: ControllerHost,\n config: AriaProjectorConfig\n): AriaProjectorController {\n return new AriaProjectorController(host, config);\n}\n\nexport type { AriaProjectorController, AriaTargetController };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"async-consumer.js","sourceRoot":"","sources":["../../../src/internals/controllers/async-consumer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,eAAe,EAAoB,MAAM,cAAc,CAAC;AAc/E,MAAM,OAAO,oBAAoB;IAQ/B,YAAY,IAAU,EAAE,OAA+B;QACrD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAExB,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC;IAC/B,CAAC;IAKM,KAAK,CAAC,aAAa;QACxB,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;QAEhC,IAAI,CAAC,SAAS,KAAK,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,EAAE;YACjD,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO;YAC9B,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ;YAChC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS;SACnC,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,UAAU,kBAAkB,CAIhC,IAAU,EACV,OAAU,EACV,QAAgE;IAEhE,OAAO,IAAI,oBAAoB,CAAC,IAAI,EAAE;QACpC,OAAO;QACP,QAAQ;QACR,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { type Context, ContextConsumer, type ContextType } from '@lit/context';\nimport type {\n LitElement,\n ReactiveController,\n ReactiveControllerHost,\n} from 'lit';\n\ntype AsyncContextOptions<T extends Context<unknown, unknown>> = {\n context: T;\n callback?: (value: ContextType<T>, dispose?: () => void) => void;\n subscribe?: boolean;\n};\n\n/* blazorSuppress */\nexport class AsyncContextConsumer<\n T extends Context<unknown, unknown>,\n Host extends ReactiveControllerHost & HTMLElement,\n> implements ReactiveController {\n protected _host: Host;\n protected _options: AsyncContextOptions<T>;\n protected _consumer?: ContextConsumer<T, Host>;\n\n constructor(host: Host, options: AsyncContextOptions<T>) {\n this._host = host;\n this._options = options;\n\n this._host.addController(this);\n }\n\n public get value(): ContextType<T> | undefined {\n return this._consumer?.value;\n }\n\n // If there is already an instance of a consumer (because of an attach/detach cycle),\n // skip creating a new instance for this host - checked both before and after the\n // await, since a reconnect can land in between.\n public async hostConnected(): Promise<void> {\n if (this._consumer) {\n return;\n }\n\n await this._host.updateComplete;\n\n this._consumer ??= new ContextConsumer(this._host, {\n context: this._options.context,\n callback: this._options.callback,\n subscribe: this._options.subscribe,\n });\n }\n}\n\nexport function createAsyncContext<\n T extends Context<unknown, unknown>,\n Host extends ReactiveControllerHost & LitElement,\n>(\n host: Host,\n context: T,\n callback?: (value: ContextType<T>, dispose?: () => void) => void\n): AsyncContextConsumer<T, Host> {\n return new AsyncContextConsumer(host, {\n context,\n callback,\n subscribe: true,\n });\n}\n"]}
1
+ {"version":3,"file":"async-consumer.js","sourceRoot":"","sources":["../../../src/internals/controllers/async-consumer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,eAAe,EAAoB,MAAM,cAAc,CAAC;AAc/E,MAAM,OAAO,oBAAoB;IAQ/B,YAAY,IAAU,EAAE,OAA+B;QACrD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAExB,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC;IAC/B,CAAC;IAIM,KAAK,CAAC,aAAa;QACxB,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;QAEhC,IAAI,CAAC,SAAS,KAAK,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,EAAE;YACjD,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO;YAC9B,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ;YAChC,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS;SACnC,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,UAAU,kBAAkB,CAIhC,IAAU,EACV,OAAU,EACV,QAAgE;IAEhE,OAAO,IAAI,oBAAoB,CAAC,IAAI,EAAE;QACpC,OAAO;QACP,QAAQ;QACR,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { type Context, ContextConsumer, type ContextType } from '@lit/context';\nimport type {\n LitElement,\n ReactiveController,\n ReactiveControllerHost,\n} from 'lit';\n\ntype AsyncContextOptions<T extends Context<unknown, unknown>> = {\n context: T;\n callback?: (value: ContextType<T>, dispose?: () => void) => void;\n subscribe?: boolean;\n};\n\n/* blazorSuppress */\nexport class AsyncContextConsumer<\n T extends Context<unknown, unknown>,\n Host extends ReactiveControllerHost & HTMLElement,\n> implements ReactiveController {\n protected _host: Host;\n protected _options: AsyncContextOptions<T>;\n protected _consumer?: ContextConsumer<T, Host>;\n\n constructor(host: Host, options: AsyncContextOptions<T>) {\n this._host = host;\n this._options = options;\n\n this._host.addController(this);\n }\n\n public get value(): ContextType<T> | undefined {\n return this._consumer?.value;\n }\n\n // The consumer survives a disconnect, and a reconnect can land during the\n // await, so the guard runs on both sides of it.\n public async hostConnected(): Promise<void> {\n if (this._consumer) {\n return;\n }\n\n await this._host.updateComplete;\n\n this._consumer ??= new ContextConsumer(this._host, {\n context: this._options.context,\n callback: this._options.callback,\n subscribe: this._options.subscribe,\n });\n }\n}\n\nexport function createAsyncContext<\n T extends Context<unknown, unknown>,\n Host extends ReactiveControllerHost & LitElement,\n>(\n host: Host,\n context: T,\n callback?: (value: ContextType<T>, dispose?: () => void) => void\n): AsyncContextConsumer<T, Host> {\n return new AsyncContextConsumer(host, {\n context,\n callback,\n subscribe: true,\n });\n}\n"]}
@@ -1,14 +1,13 @@
1
- import type { LitElement, ReactiveController } from 'lit';
1
+ import type { LitElement } from 'lit';
2
2
  /**
3
- * A Lit reactive controller that bridges the native
3
+ * Connects the native
4
4
  * [Invoker Commands API](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API)
5
- * with a component's programmatic API.
5
+ * to the programmatic API of a component.
6
6
  *
7
- * When an `igc-button` (or any element using the `command` / `commandfor`
8
- * attributes) invokes a command on the host, the browser dispatches a
9
- * `CommandEvent` on the target element. This controller listens for that
10
- * event and forwards it to the registered callback for the given command
11
- * string.
7
+ * @remarks
8
+ * An element with the `command` and `commandfor` attributes makes the browser
9
+ * send a `CommandEvent` to the host, and the controller runs the callback of
10
+ * that command string.
12
11
  *
13
12
  * @example
14
13
  * ```ts
@@ -20,43 +19,29 @@ import type { LitElement, ReactiveController } from 'lit';
20
19
  * }
21
20
  * ```
22
21
  *
23
- * With the above setup, a button in the document can control the dialog
24
- * declaratively:
22
+ * A button in the document then controls the dialog declaratively:
25
23
  *
26
24
  * ```html
27
25
  * <igc-button command="open" commandfor="my-dialog">Open</igc-button>
28
26
  * <igc-dialog id="my-dialog"></igc-dialog>
29
27
  * ```
30
28
  */
31
- declare class CommandController implements ReactiveController {
29
+ declare class CommandController {
32
30
  private readonly _host;
33
31
  private readonly _commandMap;
34
32
  constructor(host: LitElement);
35
33
  /**
36
- * Registers a command string and its corresponding handler callback.
34
+ * Registers a command string and its handler callback.
37
35
  *
38
- * Returns `this` to allow chained calls:
39
- * ```ts
40
- * addCommandController(this)
41
- * .set('open', this.show)
42
- * .set('close', this.hide);
43
- * ```
44
- *
45
- * @param command - The command string to listen for (e.g. `'open'`,
46
- * `'toggle-popover'`, or a custom `'--my-command'`).
47
- * @param callback - The method to invoke when the command is received.
48
- * Called with the host as `this`.
36
+ * @param command - The command string to listen for, for example `'open'`,
37
+ * `'toggle-popover'`, or a custom `'--my-command'`.
38
+ * @param callback - The method that runs when the command arrives. The
39
+ * controller calls it with the host as `this`.
49
40
  */
50
41
  set(command: string, callback: () => unknown): this;
51
42
  /** @internal */
52
- hostConnected(): void;
53
- /** @internal */
54
- hostDisconnected(): void;
55
- /** @internal */
56
43
  handleEvent(event: Event): void;
57
44
  }
58
- /**
59
- * Creates a {@link CommandController} and attaches it to the given host.
60
- */
45
+ /** Creates a {@link CommandController} and adds it to the given host. */
61
46
  export declare function addCommandController(host: LitElement): CommandController;
62
47
  export type { CommandController };
@@ -1,19 +1,14 @@
1
+ import { addHostListeners } from './host-listeners.js';
1
2
  class CommandController {
2
3
  constructor(host) {
3
4
  this._commandMap = new Map();
4
5
  this._host = host;
5
- host.addController(this);
6
+ addHostListeners(host, { events: ['command'], listener: this });
6
7
  }
7
8
  set(command, callback) {
8
9
  this._commandMap.set(command, callback);
9
10
  return this;
10
11
  }
11
- hostConnected() {
12
- this._host.addEventListener('command', this);
13
- }
14
- hostDisconnected() {
15
- this._host.removeEventListener('command', this);
16
- }
17
12
  handleEvent(event) {
18
13
  const commandEvent = event;
19
14
  this._commandMap.get(commandEvent.command)?.call(this._host);
@@ -1 +1 @@
1
- {"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/internals/controllers/command.ts"],"names":[],"mappings":"AA+BA,MAAM,iBAAiB;IAIrB,YAAY,IAAgB;QAFX,gBAAW,GAAG,IAAI,GAAG,EAAyB,CAAC;QAG9D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAiBM,GAAG,CAAC,OAAe,EAAE,QAAuB;QACjD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAGM,aAAa;QAClB,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;IAGM,gBAAgB;QACrB,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAGM,WAAW,CAAC,KAAY;QAC7B,MAAM,YAAY,GAAG,KAAqB,CAAC;QAC3C,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/D,CAAC;CACF;AAKD,MAAM,UAAU,oBAAoB,CAAC,IAAgB;IACnD,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import type { LitElement, ReactiveController } from 'lit';\n\n/**\n * A Lit reactive controller that bridges the native\n * [Invoker Commands API](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API)\n * with a component's programmatic API.\n *\n * When an `igc-button` (or any element using the `command` / `commandfor`\n * attributes) invokes a command on the host, the browser dispatches a\n * `CommandEvent` on the target element. This controller listens for that\n * event and forwards it to the registered callback for the given command\n * string.\n *\n * @example\n * ```ts\n * class IgcDialogComponent extends LitElement {\n * private readonly _commands = addCommandController(this)\n * .set('open', this.show)\n * .set('close', this.hide)\n * .set('toggle-popover', this.toggle);\n * }\n * ```\n *\n * With the above setup, a button in the document can control the dialog\n * declaratively:\n *\n * ```html\n * <igc-button command=\"open\" commandfor=\"my-dialog\">Open</igc-button>\n * <igc-dialog id=\"my-dialog\"></igc-dialog>\n * ```\n */\nclass CommandController implements ReactiveController {\n private readonly _host: LitElement;\n private readonly _commandMap = new Map<string, () => unknown>();\n\n constructor(host: LitElement) {\n this._host = host;\n host.addController(this);\n }\n\n /**\n * Registers a command string and its corresponding handler callback.\n *\n * Returns `this` to allow chained calls:\n * ```ts\n * addCommandController(this)\n * .set('open', this.show)\n * .set('close', this.hide);\n * ```\n *\n * @param command - The command string to listen for (e.g. `'open'`,\n * `'toggle-popover'`, or a custom `'--my-command'`).\n * @param callback - The method to invoke when the command is received.\n * Called with the host as `this`.\n */\n public set(command: string, callback: () => unknown): this {\n this._commandMap.set(command, callback);\n return this;\n }\n\n /** @internal */\n public hostConnected(): void {\n this._host.addEventListener('command', this);\n }\n\n /** @internal */\n public hostDisconnected(): void {\n this._host.removeEventListener('command', this);\n }\n\n /** @internal */\n public handleEvent(event: Event): void {\n const commandEvent = event as CommandEvent;\n this._commandMap.get(commandEvent.command)?.call(this._host);\n }\n}\n\n/**\n * Creates a {@link CommandController} and attaches it to the given host.\n */\nexport function addCommandController(host: LitElement): CommandController {\n return new CommandController(host);\n}\n\nexport type { CommandController };\n"]}
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/internals/controllers/command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AA6BvD,MAAM,iBAAiB;IAIrB,YAAY,IAAgB;QAFX,gBAAW,GAAG,IAAI,GAAG,EAAyB,CAAC;QAG9D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,gBAAgB,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;IAUM,GAAG,CAAC,OAAe,EAAE,QAAuB;QACjD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAGM,WAAW,CAAC,KAAY;QAC7B,MAAM,YAAY,GAAG,KAAqB,CAAC;QAC3C,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/D,CAAC;CACF;AAGD,MAAM,UAAU,oBAAoB,CAAC,IAAgB;IACnD,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import type { LitElement } from 'lit';\nimport { addHostListeners } from './host-listeners.js';\n\n/**\n * Connects the native\n * [Invoker Commands API](https://developer.mozilla.org/en-US/docs/Web/API/Invoker_Commands_API)\n * to the programmatic API of a component.\n *\n * @remarks\n * An element with the `command` and `commandfor` attributes makes the browser\n * send a `CommandEvent` to the host, and the controller runs the callback of\n * that command string.\n *\n * @example\n * ```ts\n * class IgcDialogComponent extends LitElement {\n * private readonly _commands = addCommandController(this)\n * .set('open', this.show)\n * .set('close', this.hide)\n * .set('toggle-popover', this.toggle);\n * }\n * ```\n *\n * A button in the document then controls the dialog declaratively:\n *\n * ```html\n * <igc-button command=\"open\" commandfor=\"my-dialog\">Open</igc-button>\n * <igc-dialog id=\"my-dialog\"></igc-dialog>\n * ```\n */\nclass CommandController {\n private readonly _host: LitElement;\n private readonly _commandMap = new Map<string, () => unknown>();\n\n constructor(host: LitElement) {\n this._host = host;\n\n addHostListeners(host, { events: ['command'], listener: this });\n }\n\n /**\n * Registers a command string and its handler callback.\n *\n * @param command - The command string to listen for, for example `'open'`,\n * `'toggle-popover'`, or a custom `'--my-command'`.\n * @param callback - The method that runs when the command arrives. The\n * controller calls it with the host as `this`.\n */\n public set(command: string, callback: () => unknown): this {\n this._commandMap.set(command, callback);\n return this;\n }\n\n /** @internal */\n public handleEvent(event: Event): void {\n const commandEvent = event as CommandEvent;\n this._commandMap.get(commandEvent.command)?.call(this._host);\n }\n}\n\n/** Creates a {@link CommandController} and adds it to the given host. */\nexport function addCommandController(host: LitElement): CommandController {\n return new CommandController(host);\n}\n\nexport type { CommandController };\n"]}
@@ -2,24 +2,19 @@ import { type Context, type ContextType } from '@lit/context';
2
2
  import type { ReactiveController, ReactiveControllerHost } from 'lit';
3
3
  type ProviderHost = ReactiveControllerHost & HTMLElement;
4
4
  type ContextProviderControllerOptions<C extends Context<unknown, unknown>, H extends ProviderHost> = {
5
- /** The context to provide. */
6
5
  context: C;
7
- /** Computes the context value published to subscribers. */
6
+ /** Computes the published context value. */
8
7
  value: () => ContextType<C>;
9
- /**
10
- * Host properties whose changes republish the context. Anything else that must
11
- * republish calls {@link ContextProviderController.publish}.
12
- */
8
+ /** The host properties that republish the context when they change. */
13
9
  watch?: readonly (keyof H)[];
14
10
  };
15
11
  /**
16
- * Provides a context from the host and keeps subscribers current: the value
17
- * is published when the host connects, republished before an update whenever
18
- * one of the watched host properties has changed, and on demand via
19
- * {@link ContextProviderController.publish}.
12
+ * Gives a context from the host, and keeps the subscribers current.
20
13
  *
21
- * Every publish notifies subscribers, also when the value keeps its identity -
22
- * hosts that share one mutable context object still propagate their changes.
14
+ * @remarks
15
+ * Every publish notifies the subscribers, also when the value keeps its
16
+ * identity, so a host that shares one mutable context object still
17
+ * propagates its changes.
23
18
  *
24
19
  * @example
25
20
  * ```typescript
@@ -40,7 +35,6 @@ declare class ContextProviderController<C extends Context<unknown, unknown>, H e
40
35
  hostConnected(): void;
41
36
  /** @internal */
42
37
  hostUpdate(): void;
43
- /** Publishes the current value to the subscribers. */
44
38
  publish(): void;
45
39
  }
46
40
  /** Creates and adds a {@link ContextProviderController} to the given host. */
@@ -1 +1 @@
1
- {"version":3,"file":"context-provider.js","sourceRoot":"","sources":["../../../src/internals/controllers/context-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,eAAe,EAAoB,MAAM,cAAc,CAAC;AAsC/E,MAAM,yBAAyB;IAS7B,YAAY,IAAO,EAAE,OAA+C;QAFnD,cAAS,GAAG,IAAI,GAAG,EAAoB,CAAC;QAGvD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,IAAI,eAAe,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAEzE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAGM,aAAa;QAClB,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;IAGM,UAAU;QACf,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAEpC,IAAI,OAAO,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YACxE,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;IAGM,OAAO;QACZ,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;YAC5C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;IACtE,CAAC;CACF;AAGD,MAAM,UAAU,kBAAkB,CAIhC,IAAO,EACP,OAA+C;IAE/C,OAAO,IAAI,yBAAyB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import { type Context, ContextProvider, type ContextType } from '@lit/context';\nimport type { ReactiveController, ReactiveControllerHost } from 'lit';\n\ntype ProviderHost = ReactiveControllerHost & HTMLElement;\n\ntype ContextProviderControllerOptions<\n C extends Context<unknown, unknown>,\n H extends ProviderHost,\n> = {\n /** The context to provide. */\n context: C;\n /** Computes the context value published to subscribers. */\n value: () => ContextType<C>;\n /**\n * Host properties whose changes republish the context. Anything else that must\n * republish calls {@link ContextProviderController.publish}.\n */\n watch?: readonly (keyof H)[];\n};\n\n/**\n * Provides a context from the host and keeps subscribers current: the value\n * is published when the host connects, republished before an update whenever\n * one of the watched host properties has changed, and on demand via\n * {@link ContextProviderController.publish}.\n *\n * Every publish notifies subscribers, also when the value keeps its identity -\n * hosts that share one mutable context object still propagate their changes.\n *\n * @example\n * ```typescript\n * private readonly _provider = addContextProvider(this, {\n * context: themeContext,\n * watch: ['theme', 'variant'],\n * value: () => ({ theme: this.theme, variant: this.variant }),\n * });\n * ```\n */\nclass ContextProviderController<\n C extends Context<unknown, unknown>,\n H extends ProviderHost,\n> implements ReactiveController {\n private readonly _host: H;\n private readonly _options: ContextProviderControllerOptions<C, H>;\n private readonly _provider: ContextProvider<C, H>;\n private readonly _snapshot = new Map<keyof H, unknown>();\n\n constructor(host: H, options: ContextProviderControllerOptions<C, H>) {\n this._host = host;\n this._options = options;\n this._provider = new ContextProvider(host, { context: options.context });\n\n host.addController(this);\n }\n\n /** @internal */\n public hostConnected(): void {\n this.publish();\n }\n\n /** @internal */\n public hostUpdate(): void {\n const watched = this._options.watch;\n\n if (watched?.some((key) => this._host[key] !== this._snapshot.get(key))) {\n this.publish();\n }\n }\n\n /** Publishes the current value to the subscribers. */\n public publish(): void {\n for (const key of this._options.watch ?? []) {\n this._snapshot.set(key, this._host[key]);\n }\n\n this._provider.setValue(this._options.value.call(this._host), true);\n }\n}\n\n/** Creates and adds a {@link ContextProviderController} to the given host. */\nexport function addContextProvider<\n C extends Context<unknown, unknown>,\n H extends ProviderHost,\n>(\n host: H,\n options: ContextProviderControllerOptions<C, H>\n): ContextProviderController<C, H> {\n return new ContextProviderController(host, options);\n}\n\nexport type { ContextProviderController, ContextProviderControllerOptions };\n"]}
1
+ {"version":3,"file":"context-provider.js","sourceRoot":"","sources":["../../../src/internals/controllers/context-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,eAAe,EAAoB,MAAM,cAAc,CAAC;AAiC/E,MAAM,yBAAyB;IAS7B,YAAY,IAAO,EAAE,OAA+C;QAFnD,cAAS,GAAG,IAAI,GAAG,EAAoB,CAAC;QAGvD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,IAAI,eAAe,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAEzE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAGM,aAAa;QAClB,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;IAGM,UAAU;QACf,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAEpC,IAAI,OAAO,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YACxE,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;IAEM,OAAO;QACZ,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;YAC5C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;IACtE,CAAC;CACF;AAGD,MAAM,UAAU,kBAAkB,CAIhC,IAAO,EACP,OAA+C;IAE/C,OAAO,IAAI,yBAAyB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import { type Context, ContextProvider, type ContextType } from '@lit/context';\nimport type { ReactiveController, ReactiveControllerHost } from 'lit';\n\ntype ProviderHost = ReactiveControllerHost & HTMLElement;\n\ntype ContextProviderControllerOptions<\n C extends Context<unknown, unknown>,\n H extends ProviderHost,\n> = {\n context: C;\n /** Computes the published context value. */\n value: () => ContextType<C>;\n /** The host properties that republish the context when they change. */\n watch?: readonly (keyof H)[];\n};\n\n/**\n * Gives a context from the host, and keeps the subscribers current.\n *\n * @remarks\n * Every publish notifies the subscribers, also when the value keeps its\n * identity, so a host that shares one mutable context object still\n * propagates its changes.\n *\n * @example\n * ```typescript\n * private readonly _provider = addContextProvider(this, {\n * context: themeContext,\n * watch: ['theme', 'variant'],\n * value: () => ({ theme: this.theme, variant: this.variant }),\n * });\n * ```\n */\nclass ContextProviderController<\n C extends Context<unknown, unknown>,\n H extends ProviderHost,\n> implements ReactiveController {\n private readonly _host: H;\n private readonly _options: ContextProviderControllerOptions<C, H>;\n private readonly _provider: ContextProvider<C, H>;\n private readonly _snapshot = new Map<keyof H, unknown>();\n\n constructor(host: H, options: ContextProviderControllerOptions<C, H>) {\n this._host = host;\n this._options = options;\n this._provider = new ContextProvider(host, { context: options.context });\n\n host.addController(this);\n }\n\n /** @internal */\n public hostConnected(): void {\n this.publish();\n }\n\n /** @internal */\n public hostUpdate(): void {\n const watched = this._options.watch;\n\n if (watched?.some((key) => this._host[key] !== this._snapshot.get(key))) {\n this.publish();\n }\n }\n\n public publish(): void {\n for (const key of this._options.watch ?? []) {\n this._snapshot.set(key, this._host[key]);\n }\n\n this._provider.setValue(this._options.value.call(this._host), true);\n }\n}\n\n/** Creates and adds a {@link ContextProviderController} to the given host. */\nexport function addContextProvider<\n C extends Context<unknown, unknown>,\n H extends ProviderHost,\n>(\n host: H,\n options: ContextProviderControllerOptions<C, H>\n): ContextProviderController<C, H> {\n return new ContextProviderController(host, options);\n}\n\nexport type { ContextProviderController, ContextProviderControllerOptions };\n"]}
@@ -1,43 +1,23 @@
1
- import type { ReactiveController, ReactiveControllerHost } from 'lit';
2
- /**
3
- * A controller class which determines whether a focus ring should be shown to indicate keyboard focus.
4
- * Focus rings are visible only when the user is interacting with a keyboard, not with a mouse, touch, or other input methods.
5
- *
6
- * By default the class attaches a keyup event handler on the component host and will update its keyboard focus
7
- * state based on it.
8
- *
9
- * **Important Note:** This controller is designed for use with **atomic web components** that represent single,
10
- * interactive elements (e.g., buttons, form fields, interactive icons). It helps these components correctly
11
- * display a focus indicator *only* when keyboard navigation is occurring, improving accessibility without
12
- * visual clutter during mouse or touch interactions.
13
- *
14
- * **Do not use this controller as a general-purpose shortcut for managing focus state in complex components or layouts.**
15
- * Misusing it in this way can lead to incorrect focus ring behavior, accessibility issues, and make your
16
- * application harder to maintain. For managing focus within larger, composite components, consider alternative
17
- * strategies like ARIA attributes, managing `tabindex`, or a bespoke implementation if needed.
18
- */
19
- declare class KeyboardFocusRingController implements ReactiveController {
1
+ import type { ReactiveControllerHost } from 'lit';
2
+ /** Tracks the keyboard focus state. See {@link addKeyboardFocusRing}. */
3
+ declare class KeyboardFocusRingController {
20
4
  private static readonly _events;
21
5
  private readonly _host;
22
- private readonly _abortHandle;
23
6
  private _isKeyboardFocused;
24
- /**
25
- * Gets whether the current focus state is activated through a keyboard interaction.
26
- */
7
+ /** Whether a keyboard interaction activated the current focus state. */
27
8
  get focused(): boolean;
28
9
  constructor(host: ReactiveControllerHost & HTMLElement);
29
10
  /** @internal */
30
- hostConnected(): void;
31
- /** @internal */
32
- hostDisconnected(): void;
33
- /** @internal */
34
11
  handleEvent(event: Event): void;
35
12
  }
36
13
  export type { KeyboardFocusRingController };
37
14
  /**
38
- * Adds a {@link KeyboardFocusRingController} responsible for managing keyboard focus state.
15
+ * Adds a controller that reports whether the host has focus from the
16
+ * keyboard. A component shows its focus ring only in that condition.
39
17
  *
40
- * This utility function is intended for use with **atomic web components** that require
41
- * dynamic focus ring visibility based on keyboard interaction.
18
+ * @remarks
19
+ * Use it for an atomic component, such as a button or a form field. A
20
+ * composite component or a layout needs ARIA attributes, a managed
21
+ * `tabindex`, or an implementation of its own.
42
22
  */
43
23
  export declare function addKeyboardFocusRing(host: ReactiveControllerHost & HTMLElement): KeyboardFocusRingController;
@@ -1,23 +1,17 @@
1
- import { createAbortHandle } from '../abort-handler.js';
1
+ import { addHostListeners } from './host-listeners.js';
2
2
  class KeyboardFocusRingController {
3
3
  static { this._events = ['keyup', 'focusout', 'pointerup']; }
4
4
  get focused() {
5
5
  return this._isKeyboardFocused;
6
6
  }
7
7
  constructor(host) {
8
- this._abortHandle = createAbortHandle();
9
8
  this._isKeyboardFocused = false;
10
9
  this._host = host;
11
- host.addController(this);
12
- }
13
- hostConnected() {
14
- const { signal } = this._abortHandle;
15
- for (const event of KeyboardFocusRingController._events) {
16
- this._host.addEventListener(event, this, { passive: true, signal });
17
- }
18
- }
19
- hostDisconnected() {
20
- this._abortHandle.abort();
10
+ addHostListeners(host, {
11
+ events: KeyboardFocusRingController._events,
12
+ listener: this,
13
+ options: { passive: true },
14
+ });
21
15
  }
22
16
  handleEvent(event) {
23
17
  const focused = event.type === 'keyup';