@m3e/core 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (357) hide show
  1. package/LICENSE +22 -0
  2. package/NOTICE.md +8 -0
  3. package/README.md +59 -0
  4. package/cem.config.mjs +16 -0
  5. package/demo/index.html +58 -0
  6. package/dist/a11y.js +1431 -0
  7. package/dist/a11y.js.map +1 -0
  8. package/dist/a11y.min.js +87 -0
  9. package/dist/a11y.min.js.map +1 -0
  10. package/dist/anchoring.js +1748 -0
  11. package/dist/anchoring.js.map +1 -0
  12. package/dist/anchoring.min.js +7 -0
  13. package/dist/anchoring.min.js.map +1 -0
  14. package/dist/bidi.js +106 -0
  15. package/dist/bidi.js.map +1 -0
  16. package/dist/bidi.min.js +16 -0
  17. package/dist/bidi.min.js.map +1 -0
  18. package/dist/css-custom-data.json +257 -0
  19. package/dist/custom-elements.json +13504 -0
  20. package/dist/html-custom-data.json +199 -0
  21. package/dist/index.js +4342 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/index.min.js +520 -0
  24. package/dist/index.min.js.map +1 -0
  25. package/dist/layout.js +64 -0
  26. package/dist/layout.js.map +1 -0
  27. package/dist/layout.min.js +15 -0
  28. package/dist/layout.min.js.map +1 -0
  29. package/dist/platform.js +56 -0
  30. package/dist/platform.js.map +1 -0
  31. package/dist/platform.min.js +15 -0
  32. package/dist/platform.min.js.map +1 -0
  33. package/dist/src/a11y/AriaDescriber.d.ts +31 -0
  34. package/dist/src/a11y/AriaDescriber.d.ts.map +1 -0
  35. package/dist/src/a11y/FocusTrapElement.d.ts +25 -0
  36. package/dist/src/a11y/FocusTrapElement.d.ts.map +1 -0
  37. package/dist/src/a11y/InteractivityChecker.d.ts +22 -0
  38. package/dist/src/a11y/InteractivityChecker.d.ts.map +1 -0
  39. package/dist/src/a11y/LiveAnnouncer.d.ts +56 -0
  40. package/dist/src/a11y/LiveAnnouncer.d.ts.map +1 -0
  41. package/dist/src/a11y/aria-reference.d.ts +30 -0
  42. package/dist/src/a11y/aria-reference.d.ts.map +1 -0
  43. package/dist/src/a11y/index.d.ts +8 -0
  44. package/dist/src/a11y/index.d.ts.map +1 -0
  45. package/dist/src/a11y/keycodes/KeyCode.d.ts +118 -0
  46. package/dist/src/a11y/keycodes/KeyCode.d.ts.map +1 -0
  47. package/dist/src/a11y/keycodes/ModifierKeys.d.ts +5 -0
  48. package/dist/src/a11y/keycodes/ModifierKeys.d.ts.map +1 -0
  49. package/dist/src/a11y/keycodes/getKeyCode.d.ts +7 -0
  50. package/dist/src/a11y/keycodes/getKeyCode.d.ts.map +1 -0
  51. package/dist/src/a11y/keycodes/hasModifierKey.d.ts +9 -0
  52. package/dist/src/a11y/keycodes/hasModifierKey.d.ts.map +1 -0
  53. package/dist/src/a11y/keycodes/index.d.ts +6 -0
  54. package/dist/src/a11y/keycodes/index.d.ts.map +1 -0
  55. package/dist/src/a11y/keycodes/isModifierAllowed.d.ts +9 -0
  56. package/dist/src/a11y/keycodes/isModifierAllowed.d.ts.map +1 -0
  57. package/dist/src/a11y/list-key/FocusKeyManager.d.ts +17 -0
  58. package/dist/src/a11y/list-key/FocusKeyManager.d.ts.map +1 -0
  59. package/dist/src/a11y/list-key/ListKeyManager.d.ts +114 -0
  60. package/dist/src/a11y/list-key/ListKeyManager.d.ts.map +1 -0
  61. package/dist/src/a11y/list-key/ListManager.d.ts +37 -0
  62. package/dist/src/a11y/list-key/ListManager.d.ts.map +1 -0
  63. package/dist/src/a11y/list-key/RadioKeyManager.d.ts +20 -0
  64. package/dist/src/a11y/list-key/RadioKeyManager.d.ts.map +1 -0
  65. package/dist/src/a11y/list-key/RovingTabIndexManager.d.ts +22 -0
  66. package/dist/src/a11y/list-key/RovingTabIndexManager.d.ts.map +1 -0
  67. package/dist/src/a11y/list-key/SelectionManager.d.ts +46 -0
  68. package/dist/src/a11y/list-key/SelectionManager.d.ts.map +1 -0
  69. package/dist/src/a11y/list-key/Typeahead.d.ts +64 -0
  70. package/dist/src/a11y/list-key/Typeahead.d.ts.map +1 -0
  71. package/dist/src/a11y/list-key/index.d.ts +8 -0
  72. package/dist/src/a11y/list-key/index.d.ts.map +1 -0
  73. package/dist/src/a11y/visuallyHide.d.ts +6 -0
  74. package/dist/src/a11y/visuallyHide.d.ts.map +1 -0
  75. package/dist/src/anchoring/AnchorOptions.d.ts +15 -0
  76. package/dist/src/anchoring/AnchorOptions.d.ts.map +1 -0
  77. package/dist/src/anchoring/AnchorPosition.d.ts +3 -0
  78. package/dist/src/anchoring/AnchorPosition.d.ts.map +1 -0
  79. package/dist/src/anchoring/index.d.ts +4 -0
  80. package/dist/src/anchoring/index.d.ts.map +1 -0
  81. package/dist/src/anchoring/positionAnchor.d.ts +12 -0
  82. package/dist/src/anchoring/positionAnchor.d.ts.map +1 -0
  83. package/dist/src/bidi/Directionality.d.ts +27 -0
  84. package/dist/src/bidi/Directionality.d.ts.map +1 -0
  85. package/dist/src/bidi/index.d.ts +2 -0
  86. package/dist/src/bidi/index.d.ts.map +1 -0
  87. package/dist/src/index.d.ts +2 -0
  88. package/dist/src/index.d.ts.map +1 -0
  89. package/dist/src/layout/Breakpoint.d.ts +26 -0
  90. package/dist/src/layout/Breakpoint.d.ts.map +1 -0
  91. package/dist/src/layout/BreakpointObserver.d.ts +18 -0
  92. package/dist/src/layout/BreakpointObserver.d.ts.map +1 -0
  93. package/dist/src/layout/index.d.ts +3 -0
  94. package/dist/src/layout/index.d.ts.map +1 -0
  95. package/dist/src/platform/Platform.d.ts +34 -0
  96. package/dist/src/platform/Platform.d.ts.map +1 -0
  97. package/dist/src/platform/index.d.ts +2 -0
  98. package/dist/src/platform/index.d.ts.map +1 -0
  99. package/dist/src/shared/controllers/FocusController.d.ts +30 -0
  100. package/dist/src/shared/controllers/FocusController.d.ts.map +1 -0
  101. package/dist/src/shared/controllers/HoverController.d.ts +40 -0
  102. package/dist/src/shared/controllers/HoverController.d.ts.map +1 -0
  103. package/dist/src/shared/controllers/IntersectionController.d.ts +40 -0
  104. package/dist/src/shared/controllers/IntersectionController.d.ts.map +1 -0
  105. package/dist/src/shared/controllers/LongPressController.d.ts +32 -0
  106. package/dist/src/shared/controllers/LongPressController.d.ts.map +1 -0
  107. package/dist/src/shared/controllers/MonitorControllerBase.d.ts +62 -0
  108. package/dist/src/shared/controllers/MonitorControllerBase.d.ts.map +1 -0
  109. package/dist/src/shared/controllers/MutationController.d.ts +37 -0
  110. package/dist/src/shared/controllers/MutationController.d.ts.map +1 -0
  111. package/dist/src/shared/controllers/PressedController.d.ts +45 -0
  112. package/dist/src/shared/controllers/PressedController.d.ts.map +1 -0
  113. package/dist/src/shared/controllers/ResizeController.d.ts +40 -0
  114. package/dist/src/shared/controllers/ResizeController.d.ts.map +1 -0
  115. package/dist/src/shared/controllers/ScrollController.d.ts +34 -0
  116. package/dist/src/shared/controllers/ScrollController.d.ts.map +1 -0
  117. package/dist/src/shared/controllers/index.d.ts +9 -0
  118. package/dist/src/shared/controllers/index.d.ts.map +1 -0
  119. package/dist/src/shared/decorators/debounce.d.ts +7 -0
  120. package/dist/src/shared/decorators/debounce.d.ts.map +1 -0
  121. package/dist/src/shared/decorators/index.d.ts +2 -0
  122. package/dist/src/shared/decorators/index.d.ts.map +1 -0
  123. package/dist/src/shared/directives/index.d.ts +2 -0
  124. package/dist/src/shared/directives/index.d.ts.map +1 -0
  125. package/dist/src/shared/directives/safeStyleMap.d.ts +44 -0
  126. package/dist/src/shared/directives/safeStyleMap.d.ts.map +1 -0
  127. package/dist/src/shared/index.d.ts +8 -0
  128. package/dist/src/shared/index.d.ts.map +1 -0
  129. package/dist/src/shared/mixins/AttachInternals.d.ts +24 -0
  130. package/dist/src/shared/mixins/AttachInternals.d.ts.map +1 -0
  131. package/dist/src/shared/mixins/Checked.d.ts +24 -0
  132. package/dist/src/shared/mixins/Checked.d.ts.map +1 -0
  133. package/dist/src/shared/mixins/CheckedIndeterminate.d.ts +25 -0
  134. package/dist/src/shared/mixins/CheckedIndeterminate.d.ts.map +1 -0
  135. package/dist/src/shared/mixins/CheckedOrSelected.d.ts +23 -0
  136. package/dist/src/shared/mixins/CheckedOrSelected.d.ts.map +1 -0
  137. package/dist/src/shared/mixins/ConstraintValidation.d.ts +48 -0
  138. package/dist/src/shared/mixins/ConstraintValidation.d.ts.map +1 -0
  139. package/dist/src/shared/mixins/Constructor.d.ts +3 -0
  140. package/dist/src/shared/mixins/Constructor.d.ts.map +1 -0
  141. package/dist/src/shared/mixins/Dirty.d.ts +27 -0
  142. package/dist/src/shared/mixins/Dirty.d.ts.map +1 -0
  143. package/dist/src/shared/mixins/Disabled.d.ts +25 -0
  144. package/dist/src/shared/mixins/Disabled.d.ts.map +1 -0
  145. package/dist/src/shared/mixins/DisabledInteractive.d.ts +25 -0
  146. package/dist/src/shared/mixins/DisabledInteractive.d.ts.map +1 -0
  147. package/dist/src/shared/mixins/EventAttribute.d.ts +11 -0
  148. package/dist/src/shared/mixins/EventAttribute.d.ts.map +1 -0
  149. package/dist/src/shared/mixins/Focusable.d.ts +11 -0
  150. package/dist/src/shared/mixins/Focusable.d.ts.map +1 -0
  151. package/dist/src/shared/mixins/FormAssociated.d.ts +34 -0
  152. package/dist/src/shared/mixins/FormAssociated.d.ts.map +1 -0
  153. package/dist/src/shared/mixins/FormSubmitter.d.ts +31 -0
  154. package/dist/src/shared/mixins/FormSubmitter.d.ts.map +1 -0
  155. package/dist/src/shared/mixins/HtmlFor.d.ts +30 -0
  156. package/dist/src/shared/mixins/HtmlFor.d.ts.map +1 -0
  157. package/dist/src/shared/mixins/KeyboardClick.d.ts +11 -0
  158. package/dist/src/shared/mixins/KeyboardClick.d.ts.map +1 -0
  159. package/dist/src/shared/mixins/Labelled.d.ts +22 -0
  160. package/dist/src/shared/mixins/Labelled.d.ts.map +1 -0
  161. package/dist/src/shared/mixins/LinkButton.d.ts +36 -0
  162. package/dist/src/shared/mixins/LinkButton.d.ts.map +1 -0
  163. package/dist/src/shared/mixins/ReadOnly.d.ts +25 -0
  164. package/dist/src/shared/mixins/ReadOnly.d.ts.map +1 -0
  165. package/dist/src/shared/mixins/Required.d.ts +26 -0
  166. package/dist/src/shared/mixins/Required.d.ts.map +1 -0
  167. package/dist/src/shared/mixins/RequiredConstraintValidation.d.ts +21 -0
  168. package/dist/src/shared/mixins/RequiredConstraintValidation.d.ts.map +1 -0
  169. package/dist/src/shared/mixins/Role.d.ts +13 -0
  170. package/dist/src/shared/mixins/Role.d.ts.map +1 -0
  171. package/dist/src/shared/mixins/Selected.d.ts +24 -0
  172. package/dist/src/shared/mixins/Selected.d.ts.map +1 -0
  173. package/dist/src/shared/mixins/Touched.d.ts +27 -0
  174. package/dist/src/shared/mixins/Touched.d.ts.map +1 -0
  175. package/dist/src/shared/mixins/Vertical.d.ts +24 -0
  176. package/dist/src/shared/mixins/Vertical.d.ts.map +1 -0
  177. package/dist/src/shared/mixins/hasKeys.d.ts +9 -0
  178. package/dist/src/shared/mixins/hasKeys.d.ts.map +1 -0
  179. package/dist/src/shared/mixins/index.d.ts +25 -0
  180. package/dist/src/shared/mixins/index.d.ts.map +1 -0
  181. package/dist/src/shared/primitives/CollapsibleElement.d.ts +58 -0
  182. package/dist/src/shared/primitives/CollapsibleElement.d.ts.map +1 -0
  183. package/dist/src/shared/primitives/ElevationElement.d.ts +88 -0
  184. package/dist/src/shared/primitives/ElevationElement.d.ts.map +1 -0
  185. package/dist/src/shared/primitives/ElevationLevel.d.ts +3 -0
  186. package/dist/src/shared/primitives/ElevationLevel.d.ts.map +1 -0
  187. package/dist/src/shared/primitives/ElevationToken.d.ts +15 -0
  188. package/dist/src/shared/primitives/ElevationToken.d.ts.map +1 -0
  189. package/dist/src/shared/primitives/FocusRingElement.d.ts +78 -0
  190. package/dist/src/shared/primitives/FocusRingElement.d.ts.map +1 -0
  191. package/dist/src/shared/primitives/FocusRingToken.d.ts +17 -0
  192. package/dist/src/shared/primitives/FocusRingToken.d.ts.map +1 -0
  193. package/dist/src/shared/primitives/PseudoCheckboxElement.d.ts +50 -0
  194. package/dist/src/shared/primitives/PseudoCheckboxElement.d.ts.map +1 -0
  195. package/dist/src/shared/primitives/PseudoRadioElement.d.ts +41 -0
  196. package/dist/src/shared/primitives/PseudoRadioElement.d.ts.map +1 -0
  197. package/dist/src/shared/primitives/RippleElement.d.ts +110 -0
  198. package/dist/src/shared/primitives/RippleElement.d.ts.map +1 -0
  199. package/dist/src/shared/primitives/RippleToken.d.ts +12 -0
  200. package/dist/src/shared/primitives/RippleToken.d.ts.map +1 -0
  201. package/dist/src/shared/primitives/ScrollContainerElement.d.ts +64 -0
  202. package/dist/src/shared/primitives/ScrollContainerElement.d.ts.map +1 -0
  203. package/dist/src/shared/primitives/ScrollDividers.d.ts +3 -0
  204. package/dist/src/shared/primitives/ScrollDividers.d.ts.map +1 -0
  205. package/dist/src/shared/primitives/SlideElement.d.ts +48 -0
  206. package/dist/src/shared/primitives/SlideElement.d.ts.map +1 -0
  207. package/dist/src/shared/primitives/StateLayerElement.d.ts +77 -0
  208. package/dist/src/shared/primitives/StateLayerElement.d.ts.map +1 -0
  209. package/dist/src/shared/primitives/StateLayerToken.d.ts +13 -0
  210. package/dist/src/shared/primitives/StateLayerToken.d.ts.map +1 -0
  211. package/dist/src/shared/primitives/TextOverflowElement.d.ts +39 -0
  212. package/dist/src/shared/primitives/TextOverflowElement.d.ts.map +1 -0
  213. package/dist/src/shared/primitives/index.d.ts +13 -0
  214. package/dist/src/shared/primitives/index.d.ts.map +1 -0
  215. package/dist/src/shared/tokens/ColorToken.d.ts +96 -0
  216. package/dist/src/shared/tokens/ColorToken.d.ts.map +1 -0
  217. package/dist/src/shared/tokens/DensityToken.d.ts +15 -0
  218. package/dist/src/shared/tokens/DensityToken.d.ts.map +1 -0
  219. package/dist/src/shared/tokens/DesignToken.d.ts +366 -0
  220. package/dist/src/shared/tokens/DesignToken.d.ts.map +1 -0
  221. package/dist/src/shared/tokens/ElevationToken.d.ts +16 -0
  222. package/dist/src/shared/tokens/ElevationToken.d.ts.map +1 -0
  223. package/dist/src/shared/tokens/MotionToken.d.ts +69 -0
  224. package/dist/src/shared/tokens/MotionToken.d.ts.map +1 -0
  225. package/dist/src/shared/tokens/ScrollbarToken.d.ts +10 -0
  226. package/dist/src/shared/tokens/ScrollbarToken.d.ts.map +1 -0
  227. package/dist/src/shared/tokens/ShapeToken.d.ts +79 -0
  228. package/dist/src/shared/tokens/ShapeToken.d.ts.map +1 -0
  229. package/dist/src/shared/tokens/StateToken.d.ts +10 -0
  230. package/dist/src/shared/tokens/StateToken.d.ts.map +1 -0
  231. package/dist/src/shared/tokens/TypescaleToken.d.ts +220 -0
  232. package/dist/src/shared/tokens/TypescaleToken.d.ts.map +1 -0
  233. package/dist/src/shared/tokens/index.d.ts +2 -0
  234. package/dist/src/shared/tokens/index.d.ts.map +1 -0
  235. package/dist/src/shared/utils/getTextContent.d.ts +8 -0
  236. package/dist/src/shared/utils/getTextContent.d.ts.map +1 -0
  237. package/dist/src/shared/utils/guid.d.ts +6 -0
  238. package/dist/src/shared/utils/guid.d.ts.map +1 -0
  239. package/dist/src/shared/utils/hasAssignedNodes.d.ts +7 -0
  240. package/dist/src/shared/utils/hasAssignedNodes.d.ts.map +1 -0
  241. package/dist/src/shared/utils/index.d.ts +6 -0
  242. package/dist/src/shared/utils/index.d.ts.map +1 -0
  243. package/dist/src/shared/utils/prefersReducedMotion.d.ts +6 -0
  244. package/dist/src/shared/utils/prefersReducedMotion.d.ts.map +1 -0
  245. package/dist/src/shared/utils/scrollIntoViewIfNeeded.d.ts +8 -0
  246. package/dist/src/shared/utils/scrollIntoViewIfNeeded.d.ts.map +1 -0
  247. package/eslint.config.mjs +21 -0
  248. package/package.json +87 -0
  249. package/rollup.config.js +132 -0
  250. package/src/a11y/AriaDescriber.ts +130 -0
  251. package/src/a11y/FocusTrapElement.ts +136 -0
  252. package/src/a11y/InteractivityChecker.ts +62 -0
  253. package/src/a11y/LiveAnnouncer.ts +143 -0
  254. package/src/a11y/aria-reference.ts +51 -0
  255. package/src/a11y/index.ts +8 -0
  256. package/src/a11y/keycodes/KeyCode.ts +128 -0
  257. package/src/a11y/keycodes/ModifierKeys.ts +5 -0
  258. package/src/a11y/keycodes/getKeyCode.ts +8 -0
  259. package/src/a11y/keycodes/hasModifierKey.ts +11 -0
  260. package/src/a11y/keycodes/index.ts +5 -0
  261. package/src/a11y/keycodes/isModifierAllowed.ts +12 -0
  262. package/src/a11y/list-key/FocusKeyManager.ts +25 -0
  263. package/src/a11y/list-key/ListKeyManager.ts +350 -0
  264. package/src/a11y/list-key/ListManager.ts +66 -0
  265. package/src/a11y/list-key/RadioKeyManager.ts +49 -0
  266. package/src/a11y/list-key/RovingTabIndexManager.ts +56 -0
  267. package/src/a11y/list-key/SelectionManager.ts +132 -0
  268. package/src/a11y/list-key/Typeahead.ts +131 -0
  269. package/src/a11y/list-key/index.ts +7 -0
  270. package/src/a11y/visuallyHide.ts +18 -0
  271. package/src/anchoring/AnchorOptions.ts +19 -0
  272. package/src/anchoring/AnchorPosition.ts +14 -0
  273. package/src/anchoring/index.ts +3 -0
  274. package/src/anchoring/positionAnchor.ts +53 -0
  275. package/src/bidi/Directionality.ts +85 -0
  276. package/src/bidi/index.ts +1 -0
  277. package/src/index.ts +1 -0
  278. package/src/layout/Breakpoint.ts +26 -0
  279. package/src/layout/BreakpointObserver.ts +44 -0
  280. package/src/layout/index.ts +2 -0
  281. package/src/platform/Platform.ts +67 -0
  282. package/src/platform/index.ts +1 -0
  283. package/src/shared/controllers/FocusController.ts +60 -0
  284. package/src/shared/controllers/HoverController.ts +140 -0
  285. package/src/shared/controllers/IntersectionController.ts +81 -0
  286. package/src/shared/controllers/LongPressController.ts +87 -0
  287. package/src/shared/controllers/MonitorControllerBase.ts +99 -0
  288. package/src/shared/controllers/MutationController.ts +89 -0
  289. package/src/shared/controllers/PressedController.ts +137 -0
  290. package/src/shared/controllers/ResizeController.ts +83 -0
  291. package/src/shared/controllers/ScrollController.ts +100 -0
  292. package/src/shared/controllers/index.ts +8 -0
  293. package/src/shared/decorators/debounce.ts +19 -0
  294. package/src/shared/decorators/index.ts +1 -0
  295. package/src/shared/directives/index.ts +1 -0
  296. package/src/shared/directives/safeStyleMap.ts +108 -0
  297. package/src/shared/index.ts +7 -0
  298. package/src/shared/mixins/AttachInternals.ts +48 -0
  299. package/src/shared/mixins/Checked.ts +50 -0
  300. package/src/shared/mixins/CheckedIndeterminate.ts +47 -0
  301. package/src/shared/mixins/CheckedOrSelected.ts +36 -0
  302. package/src/shared/mixins/ConstraintValidation.ts +213 -0
  303. package/src/shared/mixins/Constructor.ts +2 -0
  304. package/src/shared/mixins/Dirty.ts +71 -0
  305. package/src/shared/mixins/Disabled.ts +49 -0
  306. package/src/shared/mixins/DisabledInteractive.ts +78 -0
  307. package/src/shared/mixins/EventAttribute.ts +25 -0
  308. package/src/shared/mixins/Focusable.ts +52 -0
  309. package/src/shared/mixins/FormAssociated.ts +152 -0
  310. package/src/shared/mixins/FormSubmitter.ts +123 -0
  311. package/src/shared/mixins/HtmlFor.ts +89 -0
  312. package/src/shared/mixins/KeyboardClick.ts +46 -0
  313. package/src/shared/mixins/Labelled.ts +88 -0
  314. package/src/shared/mixins/LinkButton.ts +169 -0
  315. package/src/shared/mixins/ReadOnly.ts +48 -0
  316. package/src/shared/mixins/Required.ts +50 -0
  317. package/src/shared/mixins/RequiredConstraintValidation.ts +45 -0
  318. package/src/shared/mixins/Role.ts +134 -0
  319. package/src/shared/mixins/Selected.ts +50 -0
  320. package/src/shared/mixins/Touched.ts +71 -0
  321. package/src/shared/mixins/Vertical.ts +44 -0
  322. package/src/shared/mixins/hasKeys.ts +10 -0
  323. package/src/shared/mixins/index.ts +24 -0
  324. package/src/shared/primitives/CollapsibleElement.ts +227 -0
  325. package/src/shared/primitives/ElevationElement.ts +254 -0
  326. package/src/shared/primitives/ElevationLevel.ts +2 -0
  327. package/src/shared/primitives/ElevationToken.ts +18 -0
  328. package/src/shared/primitives/FocusRingElement.ts +199 -0
  329. package/src/shared/primitives/FocusRingToken.ts +24 -0
  330. package/src/shared/primitives/PseudoCheckboxElement.ts +116 -0
  331. package/src/shared/primitives/PseudoRadioElement.ts +83 -0
  332. package/src/shared/primitives/RippleElement.ts +289 -0
  333. package/src/shared/primitives/RippleToken.ts +15 -0
  334. package/src/shared/primitives/ScrollContainerElement.ts +151 -0
  335. package/src/shared/primitives/ScrollDividers.ts +2 -0
  336. package/src/shared/primitives/SlideElement.ts +128 -0
  337. package/src/shared/primitives/StateLayerElement.ts +191 -0
  338. package/src/shared/primitives/StateLayerToken.ts +16 -0
  339. package/src/shared/primitives/TextOverflowElement.ts +60 -0
  340. package/src/shared/primitives/index.ts +12 -0
  341. package/src/shared/tokens/ColorToken.ts +142 -0
  342. package/src/shared/tokens/DensityToken.ts +23 -0
  343. package/src/shared/tokens/DesignToken.ts +35 -0
  344. package/src/shared/tokens/ElevationToken.ts +115 -0
  345. package/src/shared/tokens/MotionToken.ts +107 -0
  346. package/src/shared/tokens/ScrollbarToken.ts +13 -0
  347. package/src/shared/tokens/ShapeToken.ts +138 -0
  348. package/src/shared/tokens/StateToken.ts +13 -0
  349. package/src/shared/tokens/TypescaleToken.ts +230 -0
  350. package/src/shared/tokens/index.ts +1 -0
  351. package/src/shared/utils/getTextContent.ts +31 -0
  352. package/src/shared/utils/guid.ts +11 -0
  353. package/src/shared/utils/hasAssignedNodes.ts +8 -0
  354. package/src/shared/utils/index.ts +5 -0
  355. package/src/shared/utils/prefersReducedMotion.ts +9 -0
  356. package/src/shared/utils/scrollIntoViewIfNeeded.ts +18 -0
  357. package/tsconfig.json +9 -0
@@ -0,0 +1,350 @@
1
+ /**
2
+ * Adapted from Angular Material CDK KeyManager
3
+ * Source: https://github.com/angular/components/blob/main/src/cdk/a11y/key-manager/list-key-manager.ts
4
+ *
5
+ * @license MIT
6
+ * Copyright (c) 2025 Google LLC
7
+ * See LICENSE file in the project root for full license text.
8
+ */
9
+
10
+ import { hasModifierKey, isModifierAllowed, ModifierKey } from "../keycodes";
11
+ import { isDisabledMixin } from "../../shared/mixins/Disabled";
12
+
13
+ import { ListManager } from "./ListManager";
14
+ import { Typeahead, TypeaheadItem } from "./Typeahead";
15
+
16
+ /**
17
+ * Utility for managing keyboard events for selectable lists.
18
+ * @template T The type of managed item.
19
+ */
20
+ export class ListKeyManager<T extends HTMLElement & TypeaheadItem> extends ListManager<T> {
21
+ /** @private */ #typeahead?: Typeahead<T>;
22
+
23
+ /**
24
+ * Whether the active item will wrap to the other end of
25
+ * list when there are no more items in the given direction.
26
+ * @default false
27
+ */
28
+ public wrap = false;
29
+
30
+ /**
31
+ * Whether to activate the first and last items respectively when
32
+ * the `HOME` or `END` key is pressed.
33
+ * @default false
34
+ */
35
+ public homeAndEnd = false;
36
+
37
+ /**
38
+ * Whether to activate every 10th (or configured) first/last item
39
+ * in the up/down direction when the `PAGEUP` or `PAGEDOWN` key is pressed.
40
+ * @default false
41
+ */
42
+ public pageUpAndDown = false;
43
+
44
+ /**
45
+ * The number of items to skip when the `PAGEUP` or `PAGEDOWN` key is pressed.
46
+ * @default 10
47
+ */
48
+ public pageDelta = 10;
49
+
50
+ /**
51
+ * Whether to the list is oriented vertically.
52
+ * @default false
53
+ */
54
+ public vertical = false;
55
+
56
+ /** The allowed modifier keys.
57
+ * @default []
58
+ */
59
+ public allowedModifiers: ModifierKey[] = [];
60
+
61
+ /**
62
+ * A function used to skip items.
63
+ * @param {T} item The item to test.
64
+ * @returns {boolean} Whether `item` should be skipped.
65
+ */
66
+ public skipPredicate: (item: T) => boolean = (item) => isDisabledMixin(item) && item.disabled;
67
+
68
+ /** @inheritdoc */
69
+ override setItems(items: T[]): { added: readonly T[]; removed: readonly T[] } {
70
+ this.#typeahead?.setItems(items);
71
+ return super.setItems(items);
72
+ }
73
+
74
+ /** @inheritdoc */
75
+ override updateActiveItem(item: T | null | undefined): void {
76
+ super.updateActiveItem(item);
77
+ if (this.#typeahead) {
78
+ this.#typeahead.setSelectedIndex(item ? this.items.indexOf(item) : -1);
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Configures the key manager to activate the first and last items respectively when the `HOME` or `END` key is pressed.
84
+ * @param {boolean} [enabled = true] Whether to activate the first and last items respectively when
85
+ * the `HOME` or `END` key is pressed.
86
+ * @returns {ListKeyManager<T>} The configured key manager.
87
+ */
88
+ withHomeAndEnd(enabled: boolean = true): this {
89
+ this.homeAndEnd = enabled;
90
+ return this;
91
+ }
92
+
93
+ /**
94
+ * Configures the key manager to page up and down when the `PAGEUP` or `PAGEDOWN` key is pressed.
95
+ * @param {boolean} [enabled = true] Whether to activate page up and down when the `PAGEUP` or `PAGEDOWN` key is pressed.
96
+ * @param {number} [pageDelta=10] The number of items to skip when the `PAGEUP` or `PAGEDOWN` key is pressed.
97
+ * @returns {ListKeyManager<T>} The configured key manager.
98
+ */
99
+ withPageUpAndDown(enabled: boolean = true, pageDelta: number = 10): this {
100
+ this.pageUpAndDown = enabled;
101
+ this.pageDelta = pageDelta;
102
+ return this;
103
+ }
104
+
105
+ /**
106
+ * Configures wrapping mode, which determines whether the active item will wrap to the other end of list when there are no more items in the given direction.
107
+ * @param {boolean} [enabled = true] Whether the active item will wrap to the other end of
108
+ * list when there are no more items in the given direction.
109
+ * @returns {ListKeyManager<T>} The configured key manager.
110
+ */
111
+ withWrap(enabled: boolean = true): this {
112
+ this.wrap = enabled;
113
+ return this;
114
+ }
115
+
116
+ /**
117
+ * Configures whether to move the selection vertically.
118
+ * @param {boolean} [enabled = true] Whether to move selection vertically.
119
+ * @returns {ListKeyManager<T>} The configured key manager.
120
+ */
121
+ withVerticalOrientation(enabled: boolean = true): this {
122
+ this.vertical = enabled;
123
+ return this;
124
+ }
125
+
126
+ /**
127
+ * Configured allowed modifier keys.
128
+ * @param {ModifierKey[]} modifiers The allowed modifier keys.
129
+ * @returns {ListKeyManager<T>} The configured key manager.
130
+ */
131
+ withAllowedModifiers(...modifiers: ModifierKey[]): this {
132
+ this.allowedModifiers = modifiers;
133
+ return this;
134
+ }
135
+
136
+ /**
137
+ * Configures whether typeahead is enabled.
138
+ * @param {boolean} [enabled = true] Whether typeahead is enabled.
139
+ * @returns {ListKeyManager<T>} The configured key manager.
140
+ */
141
+ withTypeahead(enabled: boolean = true): this {
142
+ if (enabled) {
143
+ this.#typeahead = new Typeahead<T>({ callback: (item) => this.setActiveItem(item) });
144
+ } else {
145
+ this.#typeahead = undefined;
146
+ }
147
+ return this;
148
+ }
149
+
150
+ /**
151
+ * Configures a function used to test whether an item should be skipped.
152
+ * @param skipPredicate A function used to determine whether an item should be skipped.
153
+ * @returns {ListKeyManager<T>} The configured key manager.
154
+ */
155
+ withSkipPredicate(skipPredicate: (item: T) => boolean): this {
156
+ this.skipPredicate = skipPredicate;
157
+ return this;
158
+ }
159
+
160
+ /**
161
+ * Sets the active item depending on the key event passed in.
162
+ * @param {KeyboardEvent} e The keyboard event to be used for determining which element should be active.
163
+ */
164
+ onKeyDown(e: KeyboardEvent): void {
165
+ if (e.defaultPrevented) return;
166
+
167
+ const modifierAllowed = isModifierAllowed(e, ...this.allowedModifiers);
168
+
169
+ switch (e.key) {
170
+ case "Left":
171
+ case "ArrowLeft":
172
+ if (modifierAllowed && !this.vertical) {
173
+ e.preventDefault();
174
+ const prev = this.#findPrevious();
175
+ if (prev) {
176
+ this.setActiveItem(prev);
177
+ }
178
+ }
179
+ break;
180
+ case "Up":
181
+ case "ArrowUp":
182
+ if (modifierAllowed) {
183
+ e.preventDefault();
184
+ const prev = this.#findPrevious();
185
+ if (prev) {
186
+ this.setActiveItem(prev);
187
+ }
188
+ }
189
+
190
+ break;
191
+
192
+ case "Right":
193
+ case "ArrowRight":
194
+ if (modifierAllowed && !this.vertical) {
195
+ e.preventDefault();
196
+ const next = this.#findNext();
197
+ if (next) {
198
+ this.setActiveItem(next);
199
+ }
200
+ }
201
+ break;
202
+
203
+ case "Down":
204
+ case "ArrowDown":
205
+ if (modifierAllowed) {
206
+ e.preventDefault();
207
+ const next = this.#findNext();
208
+ if (next) {
209
+ this.setActiveItem(next);
210
+ }
211
+ }
212
+
213
+ break;
214
+
215
+ case "Home":
216
+ if (modifierAllowed && this.homeAndEnd) {
217
+ e.preventDefault();
218
+ const first = this.#findFirst();
219
+ if (first) {
220
+ this.setActiveItem(first);
221
+ }
222
+ }
223
+
224
+ break;
225
+
226
+ case "End":
227
+ if (modifierAllowed && this.homeAndEnd) {
228
+ e.preventDefault();
229
+ const last = this.#findLast();
230
+ if (last) {
231
+ this.setActiveItem(last);
232
+ }
233
+ }
234
+
235
+ break;
236
+
237
+ case "PageUp":
238
+ if (modifierAllowed && this.pageUpAndDown) {
239
+ e.preventDefault();
240
+ const prev = this.#findPreviousByIndex(
241
+ this.activeItem ? Math.max(0, this.items.indexOf(this.activeItem) - this.pageDelta) : 0
242
+ );
243
+ if (prev) {
244
+ this.setActiveItem(prev);
245
+ }
246
+ }
247
+
248
+ break;
249
+
250
+ case "PageDown":
251
+ if (modifierAllowed && this.pageUpAndDown) {
252
+ e.preventDefault();
253
+ const next = this.#findNextByIndex(
254
+ this.activeItem
255
+ ? Math.min(this.items.length - 1, this.items.indexOf(this.activeItem) + this.pageDelta)
256
+ : this.items.length - 1
257
+ );
258
+ if (next) {
259
+ this.setActiveItem(next);
260
+ }
261
+ }
262
+
263
+ break;
264
+
265
+ default:
266
+ if (modifierAllowed || hasModifierKey(e, "shift")) {
267
+ this.#typeahead?.onKeyDown(e);
268
+ }
269
+ break;
270
+ }
271
+ }
272
+
273
+ /** @private */
274
+ #findFirst(): T | null {
275
+ for (let i = 0; i < this.items.length; i++) {
276
+ if (this.items[i] === this.activeItem) break;
277
+ const test = this.items[i];
278
+ if (!this.skipPredicate(test)) {
279
+ return test;
280
+ }
281
+ }
282
+ return null;
283
+ }
284
+
285
+ /** @private */
286
+ #findLast(): T | null {
287
+ for (let i = this.items.length - 1; i >= 0; i--) {
288
+ if (this.items[i] === this.activeItem) break;
289
+ const test = this.items[i];
290
+ if (!this.skipPredicate(test)) {
291
+ return test;
292
+ }
293
+ }
294
+ return null;
295
+ }
296
+
297
+ /** @private */
298
+ #findNext(): T | null {
299
+ for (let i = 0; i < this.items.length; i++) {
300
+ if (this.items[i] === this.activeItem) {
301
+ for (let j = i + 1; j < this.items.length; j++) {
302
+ const test = this.items[j];
303
+ if (!this.skipPredicate(test)) {
304
+ return test;
305
+ }
306
+ }
307
+ break;
308
+ }
309
+ }
310
+ return this.wrap ? this.#findFirst() : null;
311
+ }
312
+
313
+ /** @private */
314
+ #findPrevious(): T | null {
315
+ for (let i = 0; i < this.items.length; i++) {
316
+ if (this.items[i] === this.activeItem) {
317
+ for (let j = i - 1; j >= 0; j--) {
318
+ const test = this.items[j];
319
+ if (!this.skipPredicate(test)) {
320
+ return test;
321
+ }
322
+ }
323
+ break;
324
+ }
325
+ }
326
+ return this.wrap ? this.#findLast() : null;
327
+ }
328
+
329
+ /** @private */
330
+ #findPreviousByIndex(index: number): T | null {
331
+ for (let i = index; i >= 0; i--) {
332
+ const test = this.items[i];
333
+ if (!this.skipPredicate(test)) {
334
+ return test;
335
+ }
336
+ }
337
+ return null;
338
+ }
339
+
340
+ /** @private */
341
+ #findNextByIndex(index: number): T | null {
342
+ for (let i = index; i < this.items.length; i++) {
343
+ const test = this.items[i];
344
+ if (!this.skipPredicate(test)) {
345
+ return test;
346
+ }
347
+ }
348
+ return null;
349
+ }
350
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Utility for managing a list of items which supports activation.
3
+ * @template T The type of managed item.
4
+ */
5
+ export class ListManager<T> {
6
+ /** @private */ #items = new Array<T>();
7
+ /** @private */ #activeItem: T | null = null;
8
+ /** @private */ #onActiveItemChangeCallback?: () => void;
9
+
10
+ /** The items being managed. */
11
+ get items(): ReadonlyArray<T> {
12
+ return this.#items;
13
+ }
14
+
15
+ /** The active item. */
16
+ get activeItem(): T | null {
17
+ return this.#activeItem;
18
+ }
19
+
20
+ /**
21
+ * Sets the items to manage.
22
+ * @param {Array<T>} items The new items.
23
+ * @returns {{ added: ReadonlyArray<T>; removed: ReadonlyArray<T> }} An object specifying added and removed items.
24
+ */
25
+ setItems(items: Array<T>): { added: ReadonlyArray<T>; removed: ReadonlyArray<T> } {
26
+ const removed = this.items.filter((x) => !items.includes(x));
27
+ const added = items.filter((x) => !this.items.includes(x));
28
+
29
+ this.#items = items;
30
+
31
+ if (this.activeItem && !this.items.includes(this.activeItem)) {
32
+ this.updateActiveItem(null);
33
+ }
34
+
35
+ return { added, removed };
36
+ }
37
+
38
+ /**
39
+ * Sets the active item.
40
+ * @param {T | null | undefined} item The new active item.
41
+ */
42
+ setActiveItem(item: T | null | undefined): void {
43
+ if (this.activeItem !== item) {
44
+ this.updateActiveItem(item);
45
+ this.#onActiveItemChangeCallback?.();
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Updates the active item.
51
+ * @param {T | null | undefined} item The active item.
52
+ */
53
+ updateActiveItem(item: T | null | undefined): void {
54
+ this.#activeItem = item ?? null;
55
+ }
56
+
57
+ /**
58
+ * Configures the list manager with a callback invoked when an item is activated.
59
+ * @param {() => void} callback The callback invoked when an item is activated.
60
+ * @returns {ListManager<T>} The configured list manager.
61
+ */
62
+ onActiveItemChange(callback: () => void): this {
63
+ this.#onActiveItemChangeCallback = callback;
64
+ return this;
65
+ }
66
+ }
@@ -0,0 +1,49 @@
1
+ import { LitElement } from "lit";
2
+
3
+ import { CheckedOrSelectedMixin, isCheckedOrSelected } from "../../shared/mixins/CheckedOrSelected";
4
+ import { DisabledMixin } from "../../shared/mixins/Disabled";
5
+
6
+ import { RovingTabIndexManager } from "./RovingTabIndexManager";
7
+
8
+ /**
9
+ * Utility for managing keyboard events for selectable lists whose items behave like a radio.
10
+ * @template T The type of managed item.
11
+ */
12
+ export class RadioKeyManager<
13
+ T extends LitElement & DisabledMixin & CheckedOrSelectedMixin
14
+ > extends RovingTabIndexManager<T> {
15
+ /** @private */ #disabled = false;
16
+
17
+ /** A value indicating whether managed items are disabled. */
18
+ get disabled(): boolean {
19
+ return this.#disabled;
20
+ }
21
+ set disabled(value: boolean) {
22
+ this.#disabled = value;
23
+ this.items.forEach((x) => (x.disabled = value));
24
+ }
25
+
26
+ /** @inheritdoc */
27
+ override setItems(items: T[]): { added: readonly T[]; removed: readonly T[] } {
28
+ if (this.disabled) {
29
+ items.forEach((x) => (x.disabled = true));
30
+ }
31
+
32
+ const { added, removed } = super.setItems(items);
33
+
34
+ if (added.length > 0 || removed.length > 0) {
35
+ if (!this.activeItem) {
36
+ this.updateActiveItem(added.find((x) => !this.skipPredicate(x)) ?? null);
37
+ }
38
+
39
+ if (this.activeItem && (this.activeItem.disabled || !isCheckedOrSelected(this.activeItem))) {
40
+ const checked = added.find((x) => !this.skipPredicate(x) && isCheckedOrSelected(x));
41
+ if (checked) {
42
+ this.updateActiveItem(checked);
43
+ }
44
+ }
45
+ }
46
+
47
+ return { added, removed };
48
+ }
49
+ }
@@ -0,0 +1,56 @@
1
+ import { FocusKeyManager } from "./FocusKeyManager";
2
+
3
+ /**
4
+ * Utility for managing keyboard events and a roving tab index for selectable lists whose items directly receive focus.
5
+ * @template T The type of managed item.
6
+ */
7
+ export class RovingTabIndexManager<T extends HTMLElement> extends FocusKeyManager<T> {
8
+ /** @private */ #disableRovingTabIndex = false;
9
+
10
+ /** @inheritdoc */
11
+ override updateActiveItem(item: T | null | undefined): void {
12
+ super.updateActiveItem(item);
13
+
14
+ if (!this.#disableRovingTabIndex) {
15
+ item?.setAttribute("tabindex", "0");
16
+ for (const other of this.items) {
17
+ if (other !== item && other.hasAttribute("tabindex")) {
18
+ other.setAttribute("tabindex", "-1");
19
+ }
20
+ }
21
+ }
22
+ }
23
+
24
+ /** @inheritdoc */
25
+ override setItems(items: T[]): { added: readonly T[]; removed: readonly T[] } {
26
+ const result = super.setItems(items);
27
+
28
+ if (!this.#disableRovingTabIndex) {
29
+ for (const added of result.added) {
30
+ if (added !== this.activeItem && !this.skipPredicate(added)) {
31
+ added.setAttribute("tabindex", "-1");
32
+ }
33
+ }
34
+ }
35
+
36
+ return result;
37
+ }
38
+
39
+ /**
40
+ * Configures whether roving tab index is disabled.
41
+ * @param {boolean} [disabled=true] Whether the roving tab index is disabled.
42
+ * @returns {RovingTabIndexManager<T>} The configured roving tab index manager.
43
+ */
44
+ disableRovingTabIndex(disabled: boolean = true): this {
45
+ if (disabled !== this.#disableRovingTabIndex) {
46
+ this.#disableRovingTabIndex = disabled;
47
+ for (const item of this.items) {
48
+ if (!this.skipPredicate(item)) {
49
+ item?.setAttribute("tabindex", this.#disableRovingTabIndex || item === this.activeItem ? "0" : "-1");
50
+ }
51
+ }
52
+ }
53
+
54
+ return this;
55
+ }
56
+ }
@@ -0,0 +1,132 @@
1
+ import { LitElement } from "lit";
2
+
3
+ import { CheckedOrSelectedMixin, checkOrSelect, isCheckedOrSelected } from "../../shared/mixins/CheckedOrSelected";
4
+ import { DisabledMixin } from "../../shared/mixins/Disabled";
5
+
6
+ import { RadioKeyManager } from "./RadioKeyManager";
7
+
8
+ /** A symbol through which to access an element's selection manager. */
9
+ export const selectionManager = Symbol("selectionManager");
10
+
11
+ /**
12
+ * Utility for managing keyboard events for selectable lists where one or more items can be selected.
13
+ * @template T The type of managed item.
14
+ */
15
+ export class SelectionManager<
16
+ T extends LitElement & DisabledMixin & CheckedOrSelectedMixin
17
+ > extends RadioKeyManager<T> {
18
+ /** @private */ #onSelectedItemsChangeCallback?: () => void;
19
+ /** @private */ #selectedItems = new Array<T>();
20
+ /** @private */ #multi = false;
21
+
22
+ /** A value indicating whether multiple items can be selected. */
23
+ get multi(): boolean {
24
+ return this.#multi;
25
+ }
26
+ set multi(value: boolean) {
27
+ this.#multi = value;
28
+ this.#enforceSingleSelect(true);
29
+ }
30
+
31
+ /** The selected items. */
32
+ get selectedItems(): readonly T[] {
33
+ return this.#selectedItems;
34
+ }
35
+
36
+ /**
37
+ * Selects or deselects the item based on the item's checked or selected state.
38
+ * @param {T} item The item whose selection state has changed.
39
+ */
40
+ notifySelectionChange(item: T): void {
41
+ if (this.items.includes(item)) {
42
+ if (isCheckedOrSelected(item)) {
43
+ this.select(item);
44
+ } else {
45
+ this.deselect(item);
46
+ }
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Deselects the specified item.
52
+ * @param {T} item The item to deselect.
53
+ */
54
+ deselect(item: T): void {
55
+ if (this.items.includes(item)) {
56
+ if (isCheckedOrSelected(item)) {
57
+ checkOrSelect(item, false);
58
+ }
59
+
60
+ const index = this.#selectedItems.indexOf(item);
61
+ if (index >= 0) {
62
+ this.#selectedItems.splice(index, 1);
63
+ this.#onSelectedItemsChangeCallback?.();
64
+ }
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Updates the selected item.
70
+ * @param {T | null | undefined} item The selected item.
71
+ * @param {boolean} [activate=true] A value indicating whether to activate the item.
72
+ */
73
+ select(item: T | null | undefined, activate: boolean = true): void {
74
+ if (!item || this.items.includes(item)) {
75
+ if (!this.multi) {
76
+ for (const selected of this.#selectedItems) {
77
+ if (selected !== item) {
78
+ checkOrSelect(selected, false);
79
+ }
80
+ }
81
+ this.#selectedItems.length = 0;
82
+ }
83
+
84
+ if (item) {
85
+ this.#selectedItems.push(item);
86
+ if (!isCheckedOrSelected(item)) {
87
+ checkOrSelect(item, true);
88
+ }
89
+ }
90
+
91
+ if (activate) {
92
+ this.updateActiveItem(item);
93
+ }
94
+
95
+ this.#onSelectedItemsChangeCallback?.();
96
+ }
97
+ }
98
+
99
+ /** @inheritdoc */
100
+ override setItems(items: T[]): { added: readonly T[]; removed: readonly T[] } {
101
+ const { added, removed } = super.setItems(items);
102
+
103
+ this.#selectedItems = this.#selectedItems.filter((x) => !removed.includes(x));
104
+ this.#selectedItems.push(...added.filter((x) => isCheckedOrSelected(x)));
105
+ this.#enforceSingleSelect();
106
+ this.#onSelectedItemsChangeCallback?.();
107
+ return { added, removed };
108
+ }
109
+
110
+ /**
111
+ * Configures the selection manager with a callback invoked when selected items change.
112
+ * @param {() => void} callback The callback invoked when selected items change.
113
+ * @returns {SelectionManager<T>} The configured selection manager.
114
+ */
115
+ onSelectedItemsChange(callback: () => void): this {
116
+ this.#onSelectedItemsChangeCallback = callback;
117
+ return this;
118
+ }
119
+
120
+ /** @private */
121
+ #enforceSingleSelect(emit = false): void {
122
+ if (!this.multi && this.#selectedItems.length > 1) {
123
+ for (let i = 1; i < this.#selectedItems.length; i++) {
124
+ checkOrSelect(this.#selectedItems[i], false);
125
+ }
126
+ this.#selectedItems.length = 1;
127
+ if (emit) {
128
+ this.#onSelectedItemsChangeCallback?.();
129
+ }
130
+ }
131
+ }
132
+ }