@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,131 @@
1
+ /**
2
+ * Adapted from Angular Material CDK KeyManager
3
+ * Source: https://github.com/angular/components/blob/main/src/cdk/a11y/key-manager/typeahead.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 { getKeyCode, KeyCode } from "../keycodes";
11
+ import { hasKeys } from "../../shared/mixins/hasKeys";
12
+
13
+ /** A symbol through which to access an element's textual content used for typeahead search. */
14
+ export const typeaheadLabel = Symbol("typeaheadLabel");
15
+
16
+ /** Defines functionality required for an item that supports searching using typeahead. */
17
+ export interface TypeaheadItem {
18
+ /** Returns the textual content to search. */
19
+ [typeaheadLabel]?(): string;
20
+ }
21
+
22
+ /**
23
+ * Determines whether a value is a `TypeaheadItem`.
24
+ * @param {unknown} value The value to test.
25
+ * @returns A value indicating whether `value` is an `TypeaheadItem`.
26
+ */
27
+ export function isTypeaheadItem(value: unknown): value is TypeaheadItem {
28
+ return hasKeys<TypeaheadItem>(value, typeaheadLabel);
29
+ }
30
+
31
+ /** Encapsulates options used to select items based on typeahead.
32
+ * @template T The type of `TypeaheadItem`.
33
+ */
34
+ export interface TypeaheadOptions<T extends TypeaheadItem = TypeaheadItem> {
35
+ /** The interval, in milliseconds, before searching items. */
36
+ debounceInterval?: number;
37
+
38
+ /** Function used to determine whether an item should be skipped. */
39
+ skipPredicate?: (item: T) => boolean;
40
+
41
+ /** Function invoked when an item is selected. */
42
+ callback: (item: T) => void;
43
+ }
44
+
45
+ /**
46
+ * Implements typeahead functionality which selects items based on keyboard input.
47
+ * @template T The type of `TypeaheadItem`.
48
+ */
49
+ export class Typeahead<T extends TypeaheadItem = TypeaheadItem> {
50
+ /** @private */ #debounceInterval: number;
51
+ /** @private */ #timeoutId = -1;
52
+ /** @private */ #callback: (item: T) => void;
53
+ /** @private */ #skipPredicate?: (item: T) => boolean;
54
+
55
+ /** @private */ #pressedKeys = new Array<string>();
56
+ /** @private */ #selectedIndex = -1;
57
+ /** @private */ #items: readonly T[] = [];
58
+
59
+ /**
60
+ * Initializes a new instance of this class.
61
+ * @param {TypeaheadOptions<T>} options Options that control typeahead behavior.
62
+ */
63
+ constructor(options: TypeaheadOptions<T>) {
64
+ this.#debounceInterval = options.debounceInterval ?? 200;
65
+ this.#callback = options.callback;
66
+ this.#skipPredicate = options.skipPredicate;
67
+ }
68
+
69
+ /** A value indicating whether the user is currently typing. */
70
+ get isTyping(): boolean {
71
+ return this.#pressedKeys.length > 0;
72
+ }
73
+
74
+ /**
75
+ * Sets the items to search.
76
+ * @param {readonly T[]} items The items to search.
77
+ */
78
+ setItems(items: readonly T[]): void {
79
+ this.#items = items;
80
+ }
81
+
82
+ /**
83
+ * Sets the index of the selected item.
84
+ * @param {number} index The index of the selected item.
85
+ */
86
+ setSelectedIndex(index: number): void {
87
+ this.#selectedIndex = index;
88
+ }
89
+
90
+ /** Resets the stored sequence of typed characters. */
91
+ reset(): void {
92
+ this.#pressedKeys.length = 0;
93
+ }
94
+
95
+ /**
96
+ * Sets the selected item depending on the key event passed in.
97
+ * @param {KeyboardEvent} e The keyboard event to be used for determining which element should be active.
98
+ */
99
+ onKeyDown(e: KeyboardEvent): void {
100
+ if (e.key && e.key.length === 1) {
101
+ this.#appendKey(e.key);
102
+ } else {
103
+ const keycode = getKeyCode(e);
104
+ if ((keycode >= KeyCode.A && keycode <= KeyCode.Z) || (keycode >= KeyCode.Zero && keycode <= KeyCode.Nine)) {
105
+ this.#appendKey(String.fromCharCode(keycode));
106
+ }
107
+ }
108
+ }
109
+
110
+ /** @private */
111
+ #appendKey(key: string): void {
112
+ this.#pressedKeys.push(key.toLocaleUpperCase());
113
+ clearTimeout(this.#timeoutId);
114
+ this.#timeoutId = setTimeout(() => this.#searchItems(), this.#debounceInterval);
115
+ }
116
+
117
+ /** @private */
118
+ #searchItems(): void {
119
+ const term = this.#pressedKeys.join("");
120
+ for (let i = 1; i < this.#items.length + 1; i++) {
121
+ const index = (this.#selectedIndex + i) % this.#items.length;
122
+ const item = this.#items[index];
123
+ const label = item[typeaheadLabel]?.().toLocaleUpperCase().trim();
124
+ if (!this.#skipPredicate?.(item) && label?.indexOf(term) === 0) {
125
+ this.#callback(item);
126
+ break;
127
+ }
128
+ }
129
+ this.reset();
130
+ }
131
+ }
@@ -0,0 +1,7 @@
1
+ export * from "./FocusKeyManager";
2
+ export * from "./ListKeyManager";
3
+ export * from "./ListManager";
4
+ export * from "./RadioKeyManager";
5
+ export * from "./RovingTabIndexManager";
6
+ export * from "./SelectionManager";
7
+ export * from "./Typeahead";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Visually hides an element.
3
+ * @param {CSSStyleDeclaration} style The style of the element to visually hide.
4
+ */
5
+ export function visuallyHide(style: CSSStyleDeclaration): void {
6
+ style.position = "absolute";
7
+ style.appearance = "none";
8
+ style.visibility = "hidden";
9
+ style.border = "0";
10
+ style.outline = "0";
11
+ style.overflow = "hidden";
12
+ style.left = "0";
13
+ style.height = "1px";
14
+ style.width = "1px";
15
+ style.margin = "-1px";
16
+ style.padding = "0";
17
+ style.whiteSpace = "nowrap";
18
+ }
@@ -0,0 +1,19 @@
1
+ import { AnchorPosition } from "./AnchorPosition";
2
+
3
+ /** Options used to anchor an element to another. */
4
+ export interface AnchorOptions {
5
+ /** The position of the element, relative to the anchor. */
6
+ position: AnchorPosition;
7
+
8
+ /** Whether to improve positioning for inline elements which can span multiple lines. */
9
+ inline?: boolean;
10
+
11
+ /** Whether the element can be shifted to keep it in view. */
12
+ shift?: boolean;
13
+
14
+ /** Whether the element can flip to keep it in view. */
15
+ flip?: boolean | AnchorPosition[];
16
+
17
+ /** The logical margin, in pixels, between element and its anchor. */
18
+ offset?: number;
19
+ }
@@ -0,0 +1,14 @@
1
+ /** Specifies the possible positions in which to anchor an element to another. */
2
+ export type AnchorPosition =
3
+ | "top"
4
+ | "right"
5
+ | "bottom"
6
+ | "left"
7
+ | "top-start"
8
+ | "top-end"
9
+ | "right-start"
10
+ | "right-end"
11
+ | "bottom-start"
12
+ | "bottom-end"
13
+ | "left-start"
14
+ | "left-end";
@@ -0,0 +1,3 @@
1
+ export * from "./AnchorOptions";
2
+ export * from "./AnchorPosition";
3
+ export * from "./positionAnchor";
@@ -0,0 +1,53 @@
1
+ import { autoUpdate, computePosition, flip, inline, Middleware, offset, platform, shift } from "@floating-ui/dom";
2
+ import { offsetParent } from "composed-offset-position";
3
+
4
+ import { AnchorOptions } from "./AnchorOptions";
5
+ import { AnchorPosition } from "./AnchorPosition";
6
+
7
+ /**
8
+ * Positions an element relative to an anchor element.
9
+ * @param {HTMLElement} target The element to position.
10
+ * @param {HTMLElement} anchor The element in which to anchor `target`.
11
+ * @param {AnchorOptions} options Options that control positioning relative to the anchor.
12
+ * @param {((x: number, y: number, position: AnchorPosition) => void) | undefined} update Callback used to position `target`.
13
+ * @returns {Promise<() => void>} Promise that resolves to a function used to stop updating target when the position of the anchor element changes.
14
+ */
15
+ export async function positionAnchor(
16
+ target: HTMLElement,
17
+ anchor: HTMLElement,
18
+ options: AnchorOptions,
19
+ update?: (x: number, y: number, position: AnchorPosition) => void
20
+ ): Promise<() => void> {
21
+ async function computeAnchorPosition() {
22
+ const middleware = new Array<Middleware>();
23
+
24
+ if (options?.inline) {
25
+ middleware.push(inline());
26
+ }
27
+ if (options.flip) {
28
+ middleware.push(options.flip === true ? flip() : flip({ fallbackPlacements: options.flip }));
29
+ }
30
+ if (options.shift) {
31
+ middleware.push(shift());
32
+ }
33
+ if (options.offset && !isNaN(options.offset)) {
34
+ middleware.push(offset(options.offset));
35
+ }
36
+
37
+ const result = await computePosition(anchor, target, {
38
+ placement: options.position,
39
+ middleware: middleware,
40
+ platform: { ...platform, getOffsetParent: (x) => platform.getOffsetParent(x, offsetParent) },
41
+ });
42
+
43
+ if (!update) {
44
+ target.style.left = `${result.x}px`;
45
+ target.style.top = `${result.y}px`;
46
+ } else {
47
+ update(result.x, result.y, result.placement);
48
+ }
49
+ }
50
+
51
+ await computeAnchorPosition();
52
+ return autoUpdate(anchor, target, async () => await computeAnchorPosition());
53
+ }
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Adapted from Angular Material CDK Directionality
3
+ * Source: https://github.com/angular/components/blob/main/src/cdk/bidi/directionality.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 { isServer } from "lit";
11
+
12
+ /** Taken from `goog.i18n.bidi.isRtlLanguage`. */
13
+ const RTL_LOCALES =
14
+ /^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i;
15
+
16
+ /** Specifies the directionalities for a document. */
17
+ export type Direction = "ltr" | "rtl";
18
+
19
+ /** Utility used to determine the directionality of the current document. */
20
+ export class M3eDirectionality {
21
+ /** @private */ static #current: Direction = "ltr";
22
+ /** @private */ static readonly #observers = Array<() => void>();
23
+
24
+ static {
25
+ if (!isServer) {
26
+ this.#updateDirection();
27
+
28
+ if (MutationObserver) {
29
+ const init: MutationObserverInit = { attributeFilter: ["dir"] };
30
+ const observer = new MutationObserver(() => this.#handleChange());
31
+ if (document.body) {
32
+ observer.observe(document.body, init);
33
+ }
34
+ if (document.documentElement) {
35
+ observer.observe(document.documentElement, init);
36
+ }
37
+ }
38
+
39
+ window.addEventListener("languagechange", () => this.#handleChange());
40
+ }
41
+ }
42
+
43
+ /** The directionality of the current document. */
44
+ static get current(): Direction {
45
+ return this.#current;
46
+ }
47
+
48
+ /**
49
+ * Observes changes to directionality.
50
+ * @param {()=>void} callback Function invoked when directionality changes.
51
+ * @returns {()=>void} A function used to unobserve changes.
52
+ */
53
+ static observe(callback: () => void): () => void {
54
+ this.#observers.push(callback);
55
+ return () => {
56
+ this.#observers.splice(this.#observers.indexOf(callback), 1);
57
+ };
58
+ }
59
+
60
+ /** @private */
61
+ static #updateDirection() {
62
+ const _dir = (document?.body?.dir || document?.documentElement?.dir)?.toLowerCase() || "auto";
63
+ this.#current =
64
+ _dir === "auto" && !isServer && navigator?.language
65
+ ? RTL_LOCALES.test(navigator.language)
66
+ ? "rtl"
67
+ : "ltr"
68
+ : _dir === "rtl"
69
+ ? "rtl"
70
+ : "ltr";
71
+ }
72
+
73
+ /** @private */
74
+ static #handleChange(): void {
75
+ this.#updateDirection();
76
+ this.#observers.forEach((x) => x());
77
+ }
78
+ }
79
+
80
+ declare global {
81
+ /** Utility used to determine the directionality of the current document. */
82
+ var M3eDirectionality: M3eDirectionality;
83
+ }
84
+
85
+ globalThis.M3eDirectionality = M3eDirectionality;
@@ -0,0 +1 @@
1
+ export * from "./Directionality";
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./shared";
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Adapted from Angular Material CDK Breakpoints
3
+ * Source: https://github.com/angular/components/blob/main/src/cdk/layout/breakpoints.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
+ /** Specifies predefined breakpoints. */
11
+ export enum Breakpoint {
12
+ XSmall = "(max-width: 599.98px)",
13
+ Small = "(min-width: 600px) and (max-width: 959.98px)",
14
+ Medium = "(min-width: 960px) and (max-width: 1279.98px)",
15
+ Large = "(min-width: 1280px) and (max-width: 1919.98px)",
16
+ XLarge = "(min-width: 1920px)",
17
+ Handset = "(max-width: 599.98px) and (orientation: portrait), (max-width: 959.98px) and (orientation: landscape)",
18
+ Tablet = "(min-width: 600px) and (max-width: 839.98px) and (orientation: portrait), (min-width: 960px) and (max-width: 1279.98px) and (orientation: landscape)",
19
+ Web = "(min-width: 840px) and (orientation: portrait), (min-width: 1280px) and (orientation: landscape)",
20
+ HandsetPortrait = "(max-width: 599.98px) and (orientation: portrait)",
21
+ TabletPortrait = "(min-width: 600px) and (max-width: 839.98px) and (orientation: portrait)",
22
+ WebPortrait = "(min-width: 840px) and (orientation: portrait)",
23
+ HandsetLandscape = "(max-width: 959.98px) and (orientation: landscape)",
24
+ TabletLandscape = "(min-width: 960px) and (max-width: 1279.98px) and (orientation: landscape)",
25
+ WebLandscape = "(min-width: 1280px) and (orientation: landscape)",
26
+ }
@@ -0,0 +1,44 @@
1
+ import { isServer } from "lit";
2
+
3
+ import { Breakpoint } from "./Breakpoint";
4
+
5
+ /** The callback function invoked when the viewport size changes. */
6
+ export type BreakpointObserverCallback = (matches: Map<Breakpoint | string, boolean>) => void;
7
+
8
+ /** Utility used to detect changes to viewport sizes. */
9
+ export class M3eBreakpointObserver {
10
+ /**
11
+ * Observes changes to viewport sizes.
12
+ * @param {Array<Breakpoint | string>} breakpoints The breakpoints to observe.
13
+ * @param {BreakpointObserverCallback} callback The callback function invoked when the viewport size changes.
14
+ * @returns {() => void} A function used to stop observing changes to viewport sizes.
15
+ */
16
+ static observe(breakpoints: Array<Breakpoint | string>, callback: BreakpointObserverCallback): () => void {
17
+ if (isServer || breakpoints.length == 0) {
18
+ return () => {};
19
+ }
20
+
21
+ const mediaQueries = breakpoints.map((x) => matchMedia(x));
22
+ const changeHandler = () => {
23
+ const map = new Map<Breakpoint | string, boolean>();
24
+ breakpoints.forEach((x, i) => map.set(x, mediaQueries[i].matches));
25
+ callback(map);
26
+ };
27
+
28
+ mediaQueries.forEach((x) => x.addEventListener("change", changeHandler));
29
+
30
+ changeHandler();
31
+
32
+ return () => {
33
+ mediaQueries.forEach((x) => x.removeEventListener("change", changeHandler));
34
+ mediaQueries.length = 0;
35
+ };
36
+ }
37
+ }
38
+
39
+ declare global {
40
+ /** Utility used to detect changes to viewport sizes. */
41
+ var M3eBreakpointObserver: M3eBreakpointObserver;
42
+ }
43
+
44
+ globalThis.M3eBreakpointObserver = M3eBreakpointObserver;
@@ -0,0 +1,2 @@
1
+ export * from "./Breakpoint";
2
+ export * from "./BreakpointObserver";
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Adapted from Angular Material CDK Platform
3
+ * Source: https://github.com/angular/components/blob/main/src/cdk/platform/platform.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
+ /* eslint-disable @typescript-eslint/no-explicit-any */
11
+ import { isServer } from "lit";
12
+
13
+ let hasV8BreakIterator: boolean;
14
+
15
+ try {
16
+ hasV8BreakIterator = typeof Intl !== "undefined" && (Intl as any).v8BreakIterator;
17
+ } catch {
18
+ hasV8BreakIterator = false;
19
+ }
20
+
21
+ /** Utility used to detect the current platform. */
22
+ export class M3ePlatform {
23
+ /** A value indicating whether the platform is a browser. */
24
+ static readonly isBrowser = !isServer && typeof document === "object" && !!document;
25
+
26
+ /** A value indicating whether the current browser is Microsoft Edge. */
27
+ static readonly Edge = M3ePlatform.isBrowser && /(edge)/i.test(navigator.userAgent);
28
+
29
+ /** A value indicating whether the current rendering engine is Microsoft Trident. */
30
+ static readonly Trident = M3ePlatform.isBrowser && /(msie|trident)/i.test(navigator.userAgent);
31
+
32
+ /** A value indicating whether the current rendering engine is Blink. */
33
+ static readonly Blink =
34
+ M3ePlatform.isBrowser &&
35
+ !!((window as any).chrome || hasV8BreakIterator) &&
36
+ typeof CSS !== "undefined" &&
37
+ !M3ePlatform.Edge &&
38
+ !M3ePlatform.Trident;
39
+
40
+ /** A value indicating whether the current rendering engine is WebKit. */
41
+ static readonly WebKit =
42
+ M3ePlatform.isBrowser &&
43
+ /AppleWebKit/i.test(navigator.userAgent) &&
44
+ !M3ePlatform.Blink &&
45
+ !M3ePlatform.Edge &&
46
+ !M3ePlatform.Trident;
47
+
48
+ /** A value indicating whether the current platform is Apply iOS. */
49
+ static readonly iOS =
50
+ M3ePlatform.isBrowser && /iPad|iPhone|iPod/.test(navigator.userAgent) && !("MSStream" in window);
51
+
52
+ /** A value indicating whether the current browser is Firefox. */
53
+ static readonly Firefox = M3ePlatform.isBrowser && /(firefox|minefield)/i.test(navigator.userAgent);
54
+
55
+ /** A value indicating whether the current platform is Android. */
56
+ static readonly Android = M3ePlatform.isBrowser && /android/i.test(navigator.userAgent) && !M3ePlatform.Trident;
57
+
58
+ /** A value indicating whether the current browser is Safari. */
59
+ static readonly Safari = M3ePlatform.isBrowser && /safari/i.test(navigator.userAgent) && M3ePlatform.WebKit;
60
+ }
61
+
62
+ declare global {
63
+ /** Utility used to detect the current platform. */
64
+ var M3ePlatform: M3ePlatform;
65
+ }
66
+
67
+ globalThis.M3ePlatform = M3ePlatform;
@@ -0,0 +1 @@
1
+ export * from "./Platform";
@@ -0,0 +1,60 @@
1
+ import { ReactiveControllerHost } from "lit";
2
+
3
+ import { MonitorControllerBase, MonitorControllerOptions } from "./MonitorControllerBase";
4
+
5
+ /** The callback function invoked when the focused state of an element changes. */
6
+ export type FocusControllerCallback = (focused: boolean, focusVisible: boolean, target: HTMLElement) => void;
7
+
8
+ /** Encapsulates options used to configure a `FocusController`. */
9
+ export interface FocusControllerOptions extends MonitorControllerOptions {
10
+ /** The callback invoked when the focused state of an element changes. */
11
+ callback: FocusControllerCallback;
12
+ }
13
+
14
+ /** A `ReactiveController` used to monitor the focused state of one or more elements. */
15
+ export class FocusController extends MonitorControllerBase {
16
+ /** @private */ readonly #callback: FocusControllerCallback;
17
+ /** @private */ readonly #focusInHandler = (e: Event) => this.#handleFocusIn(e);
18
+ /** @private */ readonly #focusOutHandler = (e: Event) => this.#handleFocusOut(e);
19
+
20
+ /**
21
+ * Initializes a new instance of this class.
22
+ * @param {ReactiveControllerHost & HTMLElement} host The host element to which this controller will be added.
23
+ * @param {FocusControllerOptions} options Options used to configure this controller.
24
+ */
25
+ constructor(host: ReactiveControllerHost & HTMLElement, options: FocusControllerOptions) {
26
+ super(host, options);
27
+ this.#callback = options.callback;
28
+ }
29
+
30
+ /**
31
+ * Starts observing the specified element.
32
+ * @param {HTMLElement} target The element to start observing.
33
+ */
34
+ protected override _observe(target: HTMLElement): void {
35
+ target.addEventListener("keydown", this.#focusInHandler);
36
+ target.addEventListener("focusin", this.#focusInHandler);
37
+ target.addEventListener("focusout", this.#focusOutHandler);
38
+ }
39
+
40
+ /**
41
+ * Stops observing the specified element.
42
+ * @param {HTMLElement} target The element to stop observing.
43
+ */
44
+ protected override _unobserve(target: HTMLElement): void {
45
+ target.removeEventListener("keydown", this.#focusInHandler);
46
+ target.removeEventListener("focusin", this.#focusInHandler);
47
+ target.removeEventListener("focusout", this.#focusOutHandler);
48
+ }
49
+
50
+ /** @private */
51
+ #handleFocusIn(e: Event): void {
52
+ const target = e.target as HTMLElement;
53
+ this.#callback(true, target.matches(":focus-visible") || matchMedia("(forced-colors: active)").matches, target);
54
+ }
55
+
56
+ /** @private */
57
+ #handleFocusOut(e: Event): void {
58
+ this.#callback(false, false, e.target as HTMLElement);
59
+ }
60
+ }