@ember-joinery/primitives 0.0.0-stage → 1.0.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 (485) hide show
  1. package/CHANGELOG.md +472 -0
  2. package/LICENSE.md +9 -0
  3. package/NOTICE +532 -0
  4. package/README.md +11 -2
  5. package/addon-main.cjs +4 -0
  6. package/declarations/-private/combobox-list.d.ts +59 -0
  7. package/declarations/-private/combobox-list.d.ts.map +1 -0
  8. package/declarations/-private/command-score.d.ts +33 -0
  9. package/declarations/-private/command-score.d.ts.map +1 -0
  10. package/declarations/-private/delay-group.d.ts +47 -0
  11. package/declarations/-private/delay-group.d.ts.map +1 -0
  12. package/declarations/-private/dialog.d.ts +180 -0
  13. package/declarations/-private/dialog.d.ts.map +1 -0
  14. package/declarations/-private/form-control.d.ts +70 -0
  15. package/declarations/-private/form-control.d.ts.map +1 -0
  16. package/declarations/-private/form-data.d.ts +14 -0
  17. package/declarations/-private/form-data.d.ts.map +1 -0
  18. package/declarations/-private/hover-intent.d.ts +48 -0
  19. package/declarations/-private/hover-intent.d.ts.map +1 -0
  20. package/declarations/-private/image-loading.d.ts +77 -0
  21. package/declarations/-private/image-loading.d.ts.map +1 -0
  22. package/declarations/-private/indicator.d.ts +27 -0
  23. package/declarations/-private/indicator.d.ts.map +1 -0
  24. package/declarations/-private/instances.d.ts +11 -0
  25. package/declarations/-private/instances.d.ts.map +1 -0
  26. package/declarations/-private/layout-styles.d.ts +34 -0
  27. package/declarations/-private/layout-styles.d.ts.map +1 -0
  28. package/declarations/-private/menu.d.ts +616 -0
  29. package/declarations/-private/menu.d.ts.map +1 -0
  30. package/declarations/-private/observers.d.ts +35 -0
  31. package/declarations/-private/observers.d.ts.map +1 -0
  32. package/declarations/-private/popper.d.ts +149 -0
  33. package/declarations/-private/popper.d.ts.map +1 -0
  34. package/declarations/-private/presence-chart.d.ts +39 -0
  35. package/declarations/-private/presence-chart.d.ts.map +1 -0
  36. package/declarations/-private/promise-state.d.ts +41 -0
  37. package/declarations/-private/promise-state.d.ts.map +1 -0
  38. package/declarations/-private/scroll-end.d.ts +16 -0
  39. package/declarations/-private/scroll-end.d.ts.map +1 -0
  40. package/declarations/-private/scroll-visibility.d.ts +68 -0
  41. package/declarations/-private/scroll-visibility.d.ts.map +1 -0
  42. package/declarations/-private/toast.d.ts +119 -0
  43. package/declarations/-private/toast.d.ts.map +1 -0
  44. package/declarations/-private/typeahead-search.d.ts +29 -0
  45. package/declarations/-private/typeahead-search.d.ts.map +1 -0
  46. package/declarations/accordion.d.ts +284 -0
  47. package/declarations/accordion.d.ts.map +1 -0
  48. package/declarations/alert-dialog.d.ts +80 -0
  49. package/declarations/alert-dialog.d.ts.map +1 -0
  50. package/declarations/anchor/component.d.ts +63 -0
  51. package/declarations/anchor/component.d.ts.map +1 -0
  52. package/declarations/anchor/index.d.ts +7 -0
  53. package/declarations/anchor/index.d.ts.map +1 -0
  54. package/declarations/anchor/middleware.d.ts +46 -0
  55. package/declarations/anchor/middleware.d.ts.map +1 -0
  56. package/declarations/anchor/modifier.d.ts +34 -0
  57. package/declarations/anchor/modifier.d.ts.map +1 -0
  58. package/declarations/anchor/options.d.ts +112 -0
  59. package/declarations/anchor/options.d.ts.map +1 -0
  60. package/declarations/anchor/position.d.ts +36 -0
  61. package/declarations/anchor/position.d.ts.map +1 -0
  62. package/declarations/anchor.d.ts +2 -0
  63. package/declarations/as.d.ts +33 -0
  64. package/declarations/as.d.ts.map +1 -0
  65. package/declarations/aspect-ratio.d.ts +34 -0
  66. package/declarations/aspect-ratio.d.ts.map +1 -0
  67. package/declarations/avatar.d.ts +178 -0
  68. package/declarations/avatar.d.ts.map +1 -0
  69. package/declarations/body-class.d.ts +30 -0
  70. package/declarations/body-class.d.ts.map +1 -0
  71. package/declarations/breadcrumb.d.ts +64 -0
  72. package/declarations/breadcrumb.d.ts.map +1 -0
  73. package/declarations/calendar/dates.d.ts +142 -0
  74. package/declarations/calendar/dates.d.ts.map +1 -0
  75. package/declarations/calendar/index.d.ts +59 -0
  76. package/declarations/calendar/index.d.ts.map +1 -0
  77. package/declarations/calendar/state.d.ts +415 -0
  78. package/declarations/calendar/state.d.ts.map +1 -0
  79. package/declarations/calendar.d.ts +3 -0
  80. package/declarations/checkbox.d.ts +71 -0
  81. package/declarations/checkbox.d.ts.map +1 -0
  82. package/declarations/collapsible.d.ts +216 -0
  83. package/declarations/collapsible.d.ts.map +1 -0
  84. package/declarations/color-scheme.d.ts +115 -0
  85. package/declarations/color-scheme.d.ts.map +1 -0
  86. package/declarations/combobox.d.ts +569 -0
  87. package/declarations/combobox.d.ts.map +1 -0
  88. package/declarations/command.d.ts +410 -0
  89. package/declarations/command.d.ts.map +1 -0
  90. package/declarations/context-menu.d.ts +155 -0
  91. package/declarations/context-menu.d.ts.map +1 -0
  92. package/declarations/controllable-state.d.ts +85 -0
  93. package/declarations/controllable-state.d.ts.map +1 -0
  94. package/declarations/dialog.d.ts +80 -0
  95. package/declarations/dialog.d.ts.map +1 -0
  96. package/declarations/direction.d.ts +55 -0
  97. package/declarations/direction.d.ts.map +1 -0
  98. package/declarations/dismiss.d.ts +111 -0
  99. package/declarations/dismiss.d.ts.map +1 -0
  100. package/declarations/dom-context.d.ts +74 -0
  101. package/declarations/dom-context.d.ts.map +1 -0
  102. package/declarations/drawer/controller.d.ts +174 -0
  103. package/declarations/drawer/controller.d.ts.map +1 -0
  104. package/declarations/drawer/index.d.ts +105 -0
  105. package/declarations/drawer/index.d.ts.map +1 -0
  106. package/declarations/drawer/machine.d.ts +139 -0
  107. package/declarations/drawer/machine.d.ts.map +1 -0
  108. package/declarations/drawer/parts.d.ts +85 -0
  109. package/declarations/drawer/parts.d.ts.map +1 -0
  110. package/declarations/drawer.d.ts +2 -0
  111. package/declarations/dropdown-menu.d.ts +169 -0
  112. package/declarations/dropdown-menu.d.ts.map +1 -0
  113. package/declarations/external-link.d.ts +26 -0
  114. package/declarations/external-link.d.ts.map +1 -0
  115. package/declarations/file-drop.d.ts +119 -0
  116. package/declarations/file-drop.d.ts.map +1 -0
  117. package/declarations/focus-scope.d.ts +105 -0
  118. package/declarations/focus-scope.d.ts.map +1 -0
  119. package/declarations/focus.d.ts +114 -0
  120. package/declarations/focus.d.ts.map +1 -0
  121. package/declarations/head.d.ts +20 -0
  122. package/declarations/head.d.ts.map +1 -0
  123. package/declarations/heading.d.ts +59 -0
  124. package/declarations/heading.d.ts.map +1 -0
  125. package/declarations/hero.d.ts +32 -0
  126. package/declarations/hero.d.ts.map +1 -0
  127. package/declarations/hide-others.d.ts +35 -0
  128. package/declarations/hide-others.d.ts.map +1 -0
  129. package/declarations/hover-card.d.ts +148 -0
  130. package/declarations/hover-card.d.ts.map +1 -0
  131. package/declarations/i18n.d.ts +47 -0
  132. package/declarations/i18n.d.ts.map +1 -0
  133. package/declarations/id.d.ts +15 -0
  134. package/declarations/id.d.ts.map +1 -0
  135. package/declarations/iframe.d.ts +12 -0
  136. package/declarations/iframe.d.ts.map +1 -0
  137. package/declarations/incremental-each.d.ts +81 -0
  138. package/declarations/incremental-each.d.ts.map +1 -0
  139. package/declarations/index.d.ts +108 -0
  140. package/declarations/index.d.ts.map +1 -0
  141. package/declarations/input-otp.d.ts +201 -0
  142. package/declarations/input-otp.d.ts.map +1 -0
  143. package/declarations/keys.d.ts +50 -0
  144. package/declarations/keys.d.ts.map +1 -0
  145. package/declarations/label.d.ts +36 -0
  146. package/declarations/label.d.ts.map +1 -0
  147. package/declarations/layer.d.ts +56 -0
  148. package/declarations/layer.d.ts.map +1 -0
  149. package/declarations/link-helper.d.ts +73 -0
  150. package/declarations/link-helper.d.ts.map +1 -0
  151. package/declarations/link.d.ts +60 -0
  152. package/declarations/link.d.ts.map +1 -0
  153. package/declarations/load.d.ts +47 -0
  154. package/declarations/load.d.ts.map +1 -0
  155. package/declarations/menubar.d.ts +231 -0
  156. package/declarations/menubar.d.ts.map +1 -0
  157. package/declarations/message-scroller/components.d.ts +229 -0
  158. package/declarations/message-scroller/components.d.ts.map +1 -0
  159. package/declarations/message-scroller/geometry.d.ts +95 -0
  160. package/declarations/message-scroller/geometry.d.ts.map +1 -0
  161. package/declarations/message-scroller/index.d.ts +4 -0
  162. package/declarations/message-scroller/index.d.ts.map +1 -0
  163. package/declarations/message-scroller/state.d.ts +124 -0
  164. package/declarations/message-scroller/state.d.ts.map +1 -0
  165. package/declarations/message-scroller.d.ts +2 -0
  166. package/declarations/messages.d.ts +166 -0
  167. package/declarations/messages.d.ts.map +1 -0
  168. package/declarations/narrowing.d.ts +24 -0
  169. package/declarations/narrowing.d.ts.map +1 -0
  170. package/declarations/native-form.d.ts +56 -0
  171. package/declarations/native-form.d.ts.map +1 -0
  172. package/declarations/native-value.d.ts +47 -0
  173. package/declarations/native-value.d.ts.map +1 -0
  174. package/declarations/navigation-menu.d.ts +406 -0
  175. package/declarations/navigation-menu.d.ts.map +1 -0
  176. package/declarations/on-resize.d.ts +32 -0
  177. package/declarations/on-resize.d.ts.map +1 -0
  178. package/declarations/part.d.ts +99 -0
  179. package/declarations/part.d.ts.map +1 -0
  180. package/declarations/popover.d.ts +236 -0
  181. package/declarations/popover.d.ts.map +1 -0
  182. package/declarations/portal/index.d.ts +3 -0
  183. package/declarations/portal/index.d.ts.map +1 -0
  184. package/declarations/portal/portal.d.ts +46 -0
  185. package/declarations/portal/portal.d.ts.map +1 -0
  186. package/declarations/portal/targets.d.ts +40 -0
  187. package/declarations/portal/targets.d.ts.map +1 -0
  188. package/declarations/portal.d.ts +2 -0
  189. package/declarations/presence.d.ts +80 -0
  190. package/declarations/presence.d.ts.map +1 -0
  191. package/declarations/progress.d.ts +98 -0
  192. package/declarations/progress.d.ts.map +1 -0
  193. package/declarations/proper-links.d.ts +69 -0
  194. package/declarations/proper-links.d.ts.map +1 -0
  195. package/declarations/qp.d.ts +55 -0
  196. package/declarations/qp.d.ts.map +1 -0
  197. package/declarations/questionnaire/components.d.ts +348 -0
  198. package/declarations/questionnaire/components.d.ts.map +1 -0
  199. package/declarations/questionnaire/index.d.ts +4 -0
  200. package/declarations/questionnaire/index.d.ts.map +1 -0
  201. package/declarations/questionnaire/state.d.ts +400 -0
  202. package/declarations/questionnaire/state.d.ts.map +1 -0
  203. package/declarations/questionnaire/utils.d.ts +65 -0
  204. package/declarations/questionnaire/utils.d.ts.map +1 -0
  205. package/declarations/questionnaire.d.ts +2 -0
  206. package/declarations/radio-group.d.ts +115 -0
  207. package/declarations/radio-group.d.ts.map +1 -0
  208. package/declarations/rating.d.ts +214 -0
  209. package/declarations/rating.d.ts.map +1 -0
  210. package/declarations/resizable/components.d.ts +107 -0
  211. package/declarations/resizable/components.d.ts.map +1 -0
  212. package/declarations/resizable/index.d.ts +4 -0
  213. package/declarations/resizable/index.d.ts.map +1 -0
  214. package/declarations/resizable/layout.d.ts +93 -0
  215. package/declarations/resizable/layout.d.ts.map +1 -0
  216. package/declarations/resizable/state.d.ts +211 -0
  217. package/declarations/resizable/state.d.ts.map +1 -0
  218. package/declarations/resizable.d.ts +2 -0
  219. package/declarations/resize-observer.d.ts +40 -0
  220. package/declarations/resize-observer.d.ts.map +1 -0
  221. package/declarations/roving-focus.d.ts +204 -0
  222. package/declarations/roving-focus.d.ts.map +1 -0
  223. package/declarations/scroll-area/components.d.ts +125 -0
  224. package/declarations/scroll-area/components.d.ts.map +1 -0
  225. package/declarations/scroll-area/index.d.ts +3 -0
  226. package/declarations/scroll-area/index.d.ts.map +1 -0
  227. package/declarations/scroll-area/state.d.ts +147 -0
  228. package/declarations/scroll-area/state.d.ts.map +1 -0
  229. package/declarations/scroll-area.d.ts +2 -0
  230. package/declarations/scroll-lock.d.ts +69 -0
  231. package/declarations/scroll-lock.d.ts.map +1 -0
  232. package/declarations/scroller.d.ts +71 -0
  233. package/declarations/scroller.d.ts.map +1 -0
  234. package/declarations/select.d.ts +459 -0
  235. package/declarations/select.d.ts.map +1 -0
  236. package/declarations/separator.d.ts +71 -0
  237. package/declarations/separator.d.ts.map +1 -0
  238. package/declarations/service.d.ts +83 -0
  239. package/declarations/service.d.ts.map +1 -0
  240. package/declarations/shadowed.d.ts +63 -0
  241. package/declarations/shadowed.d.ts.map +1 -0
  242. package/declarations/slider.d.ts +283 -0
  243. package/declarations/slider.d.ts.map +1 -0
  244. package/declarations/sticky-footer.d.ts +43 -0
  245. package/declarations/sticky-footer.d.ts.map +1 -0
  246. package/declarations/store.d.ts +47 -0
  247. package/declarations/store.d.ts.map +1 -0
  248. package/declarations/switch.d.ts +76 -0
  249. package/declarations/switch.d.ts.map +1 -0
  250. package/declarations/tabs.d.ts +250 -0
  251. package/declarations/tabs.d.ts.map +1 -0
  252. package/declarations/toast/icons.d.ts +29 -0
  253. package/declarations/toast/icons.d.ts.map +1 -0
  254. package/declarations/toast/index.d.ts +4 -0
  255. package/declarations/toast/index.d.ts.map +1 -0
  256. package/declarations/toast/item.d.ts +162 -0
  257. package/declarations/toast/item.d.ts.map +1 -0
  258. package/declarations/toast/state.d.ts +276 -0
  259. package/declarations/toast/state.d.ts.map +1 -0
  260. package/declarations/toast/styles.d.ts +20 -0
  261. package/declarations/toast/styles.d.ts.map +1 -0
  262. package/declarations/toast/toaster.d.ts +173 -0
  263. package/declarations/toast/toaster.d.ts.map +1 -0
  264. package/declarations/toast.d.ts +2 -0
  265. package/declarations/toggle-group.d.ts +161 -0
  266. package/declarations/toggle-group.d.ts.map +1 -0
  267. package/declarations/toggle.d.ts +70 -0
  268. package/declarations/toggle.d.ts.map +1 -0
  269. package/declarations/tooltip.d.ts +227 -0
  270. package/declarations/tooltip.d.ts.map +1 -0
  271. package/declarations/typeahead.d.ts +97 -0
  272. package/declarations/typeahead.d.ts.map +1 -0
  273. package/declarations/viewport.d.ts +109 -0
  274. package/declarations/viewport.d.ts.map +1 -0
  275. package/declarations/visually-hidden.d.ts +42 -0
  276. package/declarations/visually-hidden.d.ts.map +1 -0
  277. package/declarations/zoetrope.d.ts +120 -0
  278. package/declarations/zoetrope.d.ts.map +1 -0
  279. package/dist/accordion.js +367 -0
  280. package/dist/accordion.js.map +1 -0
  281. package/dist/alert-dialog.js +122 -0
  282. package/dist/alert-dialog.js.map +1 -0
  283. package/dist/anchor.js +2 -0
  284. package/dist/anchor.js.map +1 -0
  285. package/dist/as.js +60 -0
  286. package/dist/as.js.map +1 -0
  287. package/dist/aspect-ratio.js +59 -0
  288. package/dist/aspect-ratio.js.map +1 -0
  289. package/dist/avatar.js +464 -0
  290. package/dist/avatar.js.map +1 -0
  291. package/dist/body-class.js +57 -0
  292. package/dist/body-class.js.map +1 -0
  293. package/dist/breadcrumb.js +59 -0
  294. package/dist/breadcrumb.js.map +1 -0
  295. package/dist/calendar.js +1494 -0
  296. package/dist/calendar.js.map +1 -0
  297. package/dist/checkbox.js +81 -0
  298. package/dist/checkbox.js.map +1 -0
  299. package/dist/collapsible.js +255 -0
  300. package/dist/collapsible.js.map +1 -0
  301. package/dist/color-scheme.js +306 -0
  302. package/dist/color-scheme.js.map +1 -0
  303. package/dist/combobox.js +1413 -0
  304. package/dist/combobox.js.map +1 -0
  305. package/dist/command.js +1054 -0
  306. package/dist/command.js.map +1 -0
  307. package/dist/component-DqLt83fo.js +886 -0
  308. package/dist/component-DqLt83fo.js.map +1 -0
  309. package/dist/components-CWfg0cFs.js +1745 -0
  310. package/dist/components-CWfg0cFs.js.map +1 -0
  311. package/dist/components-DBWszEI3.js +1285 -0
  312. package/dist/components-DBWszEI3.js.map +1 -0
  313. package/dist/components-DI8Azu05.js +1542 -0
  314. package/dist/components-DI8Azu05.js.map +1 -0
  315. package/dist/components-F0Ini448.js +875 -0
  316. package/dist/components-F0Ini448.js.map +1 -0
  317. package/dist/context-menu.js +207 -0
  318. package/dist/context-menu.js.map +1 -0
  319. package/dist/controllable-state.js +134 -0
  320. package/dist/controllable-state.js.map +1 -0
  321. package/dist/delay-group-B1K03gBL.js +75 -0
  322. package/dist/delay-group-B1K03gBL.js.map +1 -0
  323. package/dist/dialog-3gfz_8NA.js +349 -0
  324. package/dist/dialog-3gfz_8NA.js.map +1 -0
  325. package/dist/dialog.js +57 -0
  326. package/dist/dialog.js.map +1 -0
  327. package/dist/direction.js +75 -0
  328. package/dist/direction.js.map +1 -0
  329. package/dist/dismiss.js +329 -0
  330. package/dist/dismiss.js.map +1 -0
  331. package/dist/dom-context.js +104 -0
  332. package/dist/dom-context.js.map +1 -0
  333. package/dist/drawer.js +1456 -0
  334. package/dist/drawer.js.map +1 -0
  335. package/dist/dropdown-menu.js +201 -0
  336. package/dist/dropdown-menu.js.map +1 -0
  337. package/dist/external-link.js +21 -0
  338. package/dist/external-link.js.map +1 -0
  339. package/dist/file-drop.js +183 -0
  340. package/dist/file-drop.js.map +1 -0
  341. package/dist/focus-scope.js +292 -0
  342. package/dist/focus-scope.js.map +1 -0
  343. package/dist/focus.js +307 -0
  344. package/dist/focus.js.map +1 -0
  345. package/dist/form-control-Ca_KHSKK.js +177 -0
  346. package/dist/form-control-Ca_KHSKK.js.map +1 -0
  347. package/dist/head.js +25 -0
  348. package/dist/head.js.map +1 -0
  349. package/dist/heading.js +152 -0
  350. package/dist/heading.js.map +1 -0
  351. package/dist/hero.js +36 -0
  352. package/dist/hero.js.map +1 -0
  353. package/dist/hide-others.js +108 -0
  354. package/dist/hide-others.js.map +1 -0
  355. package/dist/hover-card.js +246 -0
  356. package/dist/hover-card.js.map +1 -0
  357. package/dist/hover-intent-Bxb83fgX.js +92 -0
  358. package/dist/hover-intent-Bxb83fgX.js.map +1 -0
  359. package/dist/i18n.js +72 -0
  360. package/dist/i18n.js.map +1 -0
  361. package/dist/id.js +24 -0
  362. package/dist/id.js.map +1 -0
  363. package/dist/iframe.js +19 -0
  364. package/dist/iframe.js.map +1 -0
  365. package/dist/incremental-each.js +181 -0
  366. package/dist/incremental-each.js.map +1 -0
  367. package/dist/index.js +87 -0
  368. package/dist/index.js.map +1 -0
  369. package/dist/indicator-sYuRuFJA.js +26 -0
  370. package/dist/indicator-sYuRuFJA.js.map +1 -0
  371. package/dist/input-otp.js +611 -0
  372. package/dist/input-otp.js.map +1 -0
  373. package/dist/keys.js +65 -0
  374. package/dist/keys.js.map +1 -0
  375. package/dist/label.js +41 -0
  376. package/dist/label.js.map +1 -0
  377. package/dist/layer.js +157 -0
  378. package/dist/layer.js.map +1 -0
  379. package/dist/layout-styles-DY86so8a.js +81 -0
  380. package/dist/layout-styles-DY86so8a.js.map +1 -0
  381. package/dist/link-helper.js +122 -0
  382. package/dist/link-helper.js.map +1 -0
  383. package/dist/link.js +39 -0
  384. package/dist/link.js.map +1 -0
  385. package/dist/load.js +54 -0
  386. package/dist/load.js.map +1 -0
  387. package/dist/menu-Da1LFCet.js +1109 -0
  388. package/dist/menu-Da1LFCet.js.map +1 -0
  389. package/dist/menubar.js +357 -0
  390. package/dist/menubar.js.map +1 -0
  391. package/dist/message-scroller.js +2 -0
  392. package/dist/message-scroller.js.map +1 -0
  393. package/dist/messages.js +168 -0
  394. package/dist/messages.js.map +1 -0
  395. package/dist/narrowing.js +29 -0
  396. package/dist/narrowing.js.map +1 -0
  397. package/dist/native-form.js +134 -0
  398. package/dist/native-form.js.map +1 -0
  399. package/dist/native-value.js +125 -0
  400. package/dist/native-value.js.map +1 -0
  401. package/dist/navigation-menu.js +872 -0
  402. package/dist/navigation-menu.js.map +1 -0
  403. package/dist/observers-aItWe029.js +113 -0
  404. package/dist/observers-aItWe029.js.map +1 -0
  405. package/dist/on-resize.js +47 -0
  406. package/dist/on-resize.js.map +1 -0
  407. package/dist/part.js +291 -0
  408. package/dist/part.js.map +1 -0
  409. package/dist/popover.js +419 -0
  410. package/dist/popover.js.map +1 -0
  411. package/dist/popper-BbTzV8dP.js +323 -0
  412. package/dist/popper-BbTzV8dP.js.map +1 -0
  413. package/dist/portal-U554WDI9.js +214 -0
  414. package/dist/portal-U554WDI9.js.map +1 -0
  415. package/dist/portal.js +2 -0
  416. package/dist/portal.js.map +1 -0
  417. package/dist/presence.js +243 -0
  418. package/dist/presence.js.map +1 -0
  419. package/dist/progress.js +106 -0
  420. package/dist/progress.js.map +1 -0
  421. package/dist/promise-state-BMi2zVoT.js +91 -0
  422. package/dist/promise-state-BMi2zVoT.js.map +1 -0
  423. package/dist/proper-links.js +136 -0
  424. package/dist/proper-links.js.map +1 -0
  425. package/dist/qp.js +77 -0
  426. package/dist/qp.js.map +1 -0
  427. package/dist/questionnaire.js +2 -0
  428. package/dist/questionnaire.js.map +1 -0
  429. package/dist/radio-group.js +149 -0
  430. package/dist/radio-group.js.map +1 -0
  431. package/dist/rating.js +261 -0
  432. package/dist/rating.js.map +1 -0
  433. package/dist/resizable.js +2 -0
  434. package/dist/resizable.js.map +1 -0
  435. package/dist/resize-observer.js +85 -0
  436. package/dist/resize-observer.js.map +1 -0
  437. package/dist/roving-focus.js +355 -0
  438. package/dist/roving-focus.js.map +1 -0
  439. package/dist/scroll-area.js +2 -0
  440. package/dist/scroll-area.js.map +1 -0
  441. package/dist/scroll-end-Cer8JSIB.js +87 -0
  442. package/dist/scroll-end-Cer8JSIB.js.map +1 -0
  443. package/dist/scroll-lock.js +267 -0
  444. package/dist/scroll-lock.js.map +1 -0
  445. package/dist/scroller.js +117 -0
  446. package/dist/scroller.js.map +1 -0
  447. package/dist/select.js +1223 -0
  448. package/dist/select.js.map +1 -0
  449. package/dist/separator.js +80 -0
  450. package/dist/separator.js.map +1 -0
  451. package/dist/service.js +160 -0
  452. package/dist/service.js.map +1 -0
  453. package/dist/shadowed.js +70 -0
  454. package/dist/shadowed.js.map +1 -0
  455. package/dist/slider.js +586 -0
  456. package/dist/slider.js.map +1 -0
  457. package/dist/sticky-footer.js +40 -0
  458. package/dist/sticky-footer.js.map +1 -0
  459. package/dist/store-BjiAd-KP.js +93 -0
  460. package/dist/store-BjiAd-KP.js.map +1 -0
  461. package/dist/store.js +4 -0
  462. package/dist/store.js.map +1 -0
  463. package/dist/switch.js +58 -0
  464. package/dist/switch.js.map +1 -0
  465. package/dist/tabs.js +458 -0
  466. package/dist/tabs.js.map +1 -0
  467. package/dist/toast.js +2 -0
  468. package/dist/toast.js.map +1 -0
  469. package/dist/toaster-DwprFZ1J.js +1518 -0
  470. package/dist/toaster-DwprFZ1J.js.map +1 -0
  471. package/dist/toggle-group.js +221 -0
  472. package/dist/toggle-group.js.map +1 -0
  473. package/dist/toggle.js +78 -0
  474. package/dist/toggle.js.map +1 -0
  475. package/dist/tooltip.js +422 -0
  476. package/dist/tooltip.js.map +1 -0
  477. package/dist/typeahead.js +233 -0
  478. package/dist/typeahead.js.map +1 -0
  479. package/dist/viewport.js +138 -0
  480. package/dist/viewport.js.map +1 -0
  481. package/dist/visually-hidden.js +49 -0
  482. package/dist/visually-hidden.js.map +1 -0
  483. package/dist/zoetrope.js +336 -0
  484. package/dist/zoetrope.js.map +1 -0
  485. package/package.json +101 -3
@@ -0,0 +1,85 @@
1
+ import { registerDestructor } from '@ember/destroyable';
2
+ import { S as SharedObserver } from './observers-aItWe029.js';
3
+ import { service } from './service.js';
4
+ import { isFunction, isString } from '@sindresorhus/is';
5
+
6
+ const LOOP_MESSAGES = ['ResizeObserver loop limit exceeded', 'ResizeObserver loop completed with undelivered notifications.'];
7
+ const IGNORING = Symbol.for('@ember-joinery/primitives:ignores-resize-observer-loops');
8
+ function isLoopMessage(message) {
9
+ return isString(message) && LOOP_MESSAGES.includes(message);
10
+ }
11
+ let listening = false;
12
+
13
+ /**
14
+ * Stops the browser's "ResizeObserver loop" message from counting as an error. It isn't one:
15
+ * the browser is saying it will deliver a resize in the next frame instead of this one. But it
16
+ * arrives as an `error` event on `window`, which fails tests and fills error trackers.
17
+ *
18
+ * `resizeObserver()` calls it for you, and so does anchoring (`anchorTo`, `anchor()`), whose
19
+ * floating element can be sized by its anchor. It wraps `window.onerror` once (again only if
20
+ * something replaces it), and listens for the `error` event once.
21
+ */
22
+ function ignoreROError() {
23
+ if (!listening) {
24
+ listening = true;
25
+ window.addEventListener('error', event => {
26
+ if (isLoopMessage(event.message)) {
27
+ event.preventDefault();
28
+ event.stopImmediatePropagation();
29
+ }
30
+ });
31
+ }
32
+ const previous = window.onerror;
33
+ if (!isFunction(previous) || previous[IGNORING]) return;
34
+ const wrapped = Object.assign(function (...args) {
35
+ if (isLoopMessage(args[0])) return true;
36
+ return previous.apply(this, args);
37
+ }, {
38
+ [IGNORING]: true
39
+ });
40
+ window.onerror = wrapped;
41
+ }
42
+
43
+ /**
44
+ * The app's resize observer: one `ResizeObserver` for every element and callback. Get it with
45
+ * `resizeObserver(this)`.
46
+ */
47
+ class ResizeObservers {
48
+ #observer = new SharedObserver(deliver => new ResizeObserver(deliver));
49
+ constructor() {
50
+ ignoreROError();
51
+ registerDestructor(this, () => this.#observer.disconnect());
52
+ }
53
+
54
+ /**
55
+ * Calls `callback` with a `ResizeObserverEntry` each time `element` changes size, and once at
56
+ * the start, once it has a size.
57
+ */
58
+ observe(element, callback) {
59
+ this.#observer.observe(element, callback);
60
+ }
61
+
62
+ /** Stops calling `callback` (the same function `observe` was given) for `element`. */
63
+ unobserve(element, callback) {
64
+ this.#observer.unobserve(element, callback);
65
+ }
66
+ }
67
+
68
+ /**
69
+ * The app's resize observer (one per owner, so one per test). One `ResizeObserver` shared by
70
+ * every element is much cheaper than one each:
71
+ *
72
+ * const observer = resizeObserver(this)
73
+ * observer.observe(element, entry => (this.width = entry.contentRect.width))
74
+ *
75
+ * In a template, use `{{onResize}}` from `@ember-joinery/primitives/on-resize`. It is
76
+ * ember-primitives' `resizeObserver`.
77
+ *
78
+ * @param context anything with an owner, or the owner itself
79
+ */
80
+ function resizeObserver(context) {
81
+ return service(context, ResizeObservers);
82
+ }
83
+
84
+ export { ResizeObservers, ignoreROError, resizeObserver };
85
+ //# sourceMappingURL=resize-observer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resize-observer.js","sources":["../src/resize-observer.ts"],"sourcesContent":["import { registerDestructor } from '@ember/destroyable'\nimport { SharedObserver, type EntryCallback } from './-private/observers.ts'\nimport { service } from './service.ts'\nimport { isFunction, isString } from '@sindresorhus/is'\n\nconst LOOP_MESSAGES = [\n 'ResizeObserver loop limit exceeded',\n 'ResizeObserver loop completed with undelivered notifications.',\n]\n\nconst IGNORING = Symbol.for('@ember-joinery/primitives:ignores-resize-observer-loops')\n\nfunction isLoopMessage(message: unknown): boolean {\n return isString(message) && LOOP_MESSAGES.includes(message)\n}\n\nlet listening = false\n\n/**\n * Stops the browser's \"ResizeObserver loop\" message from counting as an error. It isn't one:\n * the browser is saying it will deliver a resize in the next frame instead of this one. But it\n * arrives as an `error` event on `window`, which fails tests and fills error trackers.\n *\n * `resizeObserver()` calls it for you, and so does anchoring (`anchorTo`, `anchor()`), whose\n * floating element can be sized by its anchor. It wraps `window.onerror` once (again only if\n * something replaces it), and listens for the `error` event once.\n */\nexport function ignoreROError(): void {\n if (!listening) {\n listening = true\n window.addEventListener('error', event => {\n if (isLoopMessage(event.message)) {\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n })\n }\n const previous = window.onerror as (OnErrorEventHandlerNonNull & { [IGNORING]?: true }) | null\n if (!isFunction(previous) || previous[IGNORING]) return\n const wrapped = Object.assign(\n function (this: unknown, ...args: Parameters<OnErrorEventHandlerNonNull>) {\n if (isLoopMessage(args[0])) return true\n return previous.apply(this, args)\n },\n { [IGNORING]: true as const },\n )\n window.onerror = wrapped\n}\n\n/**\n * The app's resize observer: one `ResizeObserver` for every element and callback. Get it with\n * `resizeObserver(this)`.\n */\nexport class ResizeObservers {\n readonly #observer = new SharedObserver<ResizeObserverEntry>(\n deliver => new ResizeObserver(deliver),\n )\n\n constructor() {\n ignoreROError()\n registerDestructor(this, () => this.#observer.disconnect())\n }\n\n /**\n * Calls `callback` with a `ResizeObserverEntry` each time `element` changes size, and once at\n * the start, once it has a size.\n */\n observe(element: Element, callback: EntryCallback<ResizeObserverEntry>): void {\n this.#observer.observe(element, callback)\n }\n\n /** Stops calling `callback` (the same function `observe` was given) for `element`. */\n unobserve(\n element: Element | null | undefined,\n callback: EntryCallback<ResizeObserverEntry>,\n ): void {\n this.#observer.unobserve(element, callback)\n }\n}\n\n/**\n * The app's resize observer (one per owner, so one per test). One `ResizeObserver` shared by\n * every element is much cheaper than one each:\n *\n * const observer = resizeObserver(this)\n * observer.observe(element, entry => (this.width = entry.contentRect.width))\n *\n * In a template, use `{{onResize}}` from `@ember-joinery/primitives/on-resize`. It is\n * ember-primitives' `resizeObserver`.\n *\n * @param context anything with an owner, or the owner itself\n */\nexport function resizeObserver(context: object): ResizeObservers {\n return service(context, ResizeObservers)\n}\n"],"names":["LOOP_MESSAGES","IGNORING","Symbol","for","isLoopMessage","message","isString","includes","listening","ignoreROError","window","addEventListener","event","preventDefault","stopImmediatePropagation","previous","onerror","isFunction","wrapped","Object","assign","args","apply","ResizeObservers","SharedObserver","deliver","ResizeObserver","constructor","registerDestructor","disconnect","observe","element","callback","unobserve","resizeObserver","context","service"],"mappings":";;;;;AAKA,MAAMA,aAAa,GAAG,CACpB,oCAAoC,EACpC,+DAA+D,CAChE;AAED,MAAMC,QAAQ,GAAGC,MAAM,CAACC,GAAG,CAAC,yDAAyD,CAAC;AAEtF,SAASC,aAAaA,CAACC,OAAgB,EAAW;EAChD,OAAOC,QAAQ,CAACD,OAAO,CAAC,IAAIL,aAAa,CAACO,QAAQ,CAACF,OAAO,CAAC;AAC7D;AAEA,IAAIG,SAAS,GAAG,KAAK;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,aAAaA,GAAS;EACpC,IAAI,CAACD,SAAS,EAAE;AACdA,IAAAA,SAAS,GAAG,IAAI;AAChBE,IAAAA,MAAM,CAACC,gBAAgB,CAAC,OAAO,EAAEC,KAAK,IAAI;AACxC,MAAA,IAAIR,aAAa,CAACQ,KAAK,CAACP,OAAO,CAAC,EAAE;QAChCO,KAAK,CAACC,cAAc,EAAE;QACtBD,KAAK,CAACE,wBAAwB,EAAE;AAClC,MAAA;AACF,IAAA,CAAC,CAAC;AACJ,EAAA;AACA,EAAA,MAAMC,QAAQ,GAAGL,MAAM,CAACM,OAAsE;EAC9F,IAAI,CAACC,UAAU,CAACF,QA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import { registerDestructor } from '@ember/destroyable';
4
+ import Modifier from 'ember-modifier';
5
+ import { As } from './as.js';
6
+ import { ControllableState } from './controllable-state.js';
7
+ import { getDirection } from './direction.js';
8
+ import { focusFirst } from './focus.js';
9
+ import { idFor } from './id.js';
10
+ import { precompileTemplate } from '@ember/template-compilation';
11
+ import { setComponentTemplate } from '@ember/component';
12
+
13
+ const ENTRY_FOCUS = 'rovingFocusGroup.onEntryFocus';
14
+ /** The arrow keys a group listens to: left and right, up and down, or (unset) all four. */
15
+ /** Where a key asks focus to go. */
16
+ const KEY_TO_INTENT = {
17
+ ArrowLeft: 'prev',
18
+ ArrowUp: 'prev',
19
+ ArrowRight: 'next',
20
+ ArrowDown: 'next',
21
+ PageUp: 'first',
22
+ Home: 'first',
23
+ PageDown: 'last',
24
+ End: 'last'
25
+ };
26
+ /** The key as it means in this direction: right to left, the left arrow moves forward. */
27
+ function directionAwareKey(key, dir) {
28
+ if (dir !== 'rtl') return key;
29
+ if (key === 'ArrowLeft') return 'ArrowRight';
30
+ if (key === 'ArrowRight') return 'ArrowLeft';
31
+ return key;
32
+ }
33
+ /**
34
+ * Where a key press asks focus to go in a group, as Radix's roving focus reads it: the arrows
35
+ * along the orientation (both pairs when it is unset) move to the previous or next item, with
36
+ * left and right swapped right to left; Home and PageUp go to the first, End and PageDown to
37
+ * the last. Anything else is `undefined`.
38
+ *
39
+ * getFocusIntent(event, 'horizontal', 'rtl') // 'next' for ArrowLeft
40
+ */
41
+ function getFocusIntent(event, orientation, dir) {
42
+ const key = directionAwareKey(event.key, dir);
43
+ if (orientation === 'vertical' && (key === 'ArrowLeft' || key === 'ArrowRight')) return undefined;
44
+ if (orientation === 'horizontal' && (key === 'ArrowUp' || key === 'ArrowDown')) return undefined;
45
+ return KEY_TO_INTENT[key];
46
+ }
47
+ /** The array, starting at `start` and wrapping round. */
48
+ function wrap(array, start) {
49
+ return array.map((_, index) => array[(start + index) % array.length]);
50
+ }
51
+ /** Where a `RovingFocus` reads its settings. Each is a function, so it reads them live. */
52
+
53
+ /** An item, as its group sees it. */
54
+
55
+ /** Sets an attribute, or removes it for `null`. */function write(element, name, value) {
56
+ if (value === null) element.removeAttribute(name);else if (element.getAttribute(name) !== value) element.setAttribute(name, value);
57
+ }
58
+ /**
59
+ * A roving tabindex, as Radix's `RovingFocusGroup`: the items of a group take one tab stop
60
+ * between them, and the arrow keys move focus from item to item (APG's roving tabindex, and
61
+ * tabster's Mover in ember-primitives). It remembers the item last focused, so Tab comes back
62
+ * to it; enters on the `active` item first (a selected tab); flips left and right in
63
+ * right-to-left text; and Shift+Tab leaves the group in one step.
64
+ *
65
+ * A component makes one and puts its two modifiers on its own elements, beside its own parts:
66
+ *
67
+ * class Toolbar extends Component {
68
+ * roving = new RovingFocus({
69
+ * orientation: () => this.args.orientation ?? 'horizontal',
70
+ * loop: () => true,
71
+ * })
72
+ * <template>
73
+ * <div role="toolbar" {{this.roving.group}}>
74
+ * <button type="button" {{this.roving.item tabStopId="bold"}}>Bold</button>
75
+ * <button type="button" {{this.roving.item tabStopId="italic" focusable=false}}>Italic</button>
76
+ * </div>
77
+ * </template>
78
+ * }
79
+ *
80
+ * `<RovingFocusGroup>` is the same thing as a component, for an app's own groups.
81
+ */
82
+ class RovingFocus {
83
+ #options;
84
+ /** The tab stop: the id of the item that is in the tab order. */
85
+ tabStop;
86
+ #items = new Set();
87
+ #group;
88
+ #isTabbingBackOut = false;
89
+ #isClickFocus = false;
90
+ /** Put it on the group's element. */
91
+ group;
92
+ /** Put it on each item's element. */
93
+ item;
94
+ constructor(options = {}) {
95
+ this.#options = options;
96
+ this.tabStop = new ControllableState({
97
+ name: 'currentTabStopId',
98
+ value: () => options.currentTabStopId?.(),
99
+ defaultValue: () => options.defaultCurrentTabStopId?.(),
100
+ onChange: () => options.onCurrentTabStopIdChange?.(),
101
+ fallback: null
102
+ });
103
+ this.group = groupModifier(this);
104
+ this.item = itemModifier(this);
105
+ }
106
+ /** The id of the item Tab enters on, or `null` when none has been focused yet. */
107
+ get currentTabStopId() {
108
+ return this.tabStop.value;
109
+ }
110
+ get orientation() {
111
+ return this.#options.orientation?.();
112
+ }
113
+ /** The direction the arrow keys follow: the option, or the document's at the group. */
114
+ get dir() {
115
+ return getDirection(this.#group, this.#options.dir?.());
116
+ }
117
+ /** The items, in document order. */
118
+ items() {
119
+ return [...this.#items].sort((a, b) => a.element.compareDocumentPosition(b.element) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1);
120
+ }
121
+ // ----- The group -------------------------------------------------------------------------
122
+ /** @internal */
123
+ installGroup(element) {
124
+ this.#group = element;
125
+ const outline = element.style.getPropertyValue('outline');
126
+ // The group takes focus for a moment on the way to an item; Radix hides its outline.
127
+ element.style.setProperty('outline', 'none');
128
+ const onMouseDown = () => this.#isClickFocus = true;
129
+ const onFocusIn = event => this.#onGroupFocus(event, element);
130
+ const onFocusOut = () => {
131
+ this.#isTabbingBackOut = false;
132
+ this.#syncGroup();
133
+ };
134
+ const onEntryFocus = event => this.#options.onEntryFocus?.()?.(event);
135
+ element.addEventListener('mousedown', onMouseDown);
136
+ element.addEventListener('focusin', onFocusIn);
137
+ element.addEventListener('focusout', onFocusOut);
138
+ element.addEventListener(ENTRY_FOCUS, onEntryFocus);
139
+ this.#syncGroup();
140
+ return () => {
141
+ element.removeEventListener('mousedown', onMouseDown);
142
+ element.removeEventListener('focusin', onFocusIn);
143
+ element.removeEventListener('focusout', onFocusOut);
144
+ element.removeEventListener(ENTRY_FOCUS, onEntryFocus);
145
+ if (outline) element.style.setProperty('outline', outline);else element.style.removeProperty('outline');
146
+ if (this.#group === element) this.#group = undefined;
147
+ };
148
+ }
149
+ /** @internal Keeps the group's `data-orientation` current. */
150
+ updateGroup(element) {
151
+ write(element, 'data-orientation', this.orientation ?? null);
152
+ }
153
+ /**
154
+ * The group is in the tab order while an item can take focus and Shift+Tab isn't leaving: Tab
155
+ * lands on the group, which sends focus on to an item. It is set straight on the element, not
156
+ * through tracked state, so it holds before the browser moves focus for the same key press.
157
+ */
158
+ #syncGroup() {
159
+ const group = this.#group;
160
+ if (!group) return;
161
+ const focusable = [...this.#items].some(item => item.focusable);
162
+ group.setAttribute('tabindex', this.#isTabbingBackOut || !focusable ? '-1' : '0');
163
+ }
164
+ /** Tab onto the group itself: send focus on to the active item, the tab stop, or the first. */
165
+ #onGroupFocus(event, group) {
166
+ const isKeyboardFocus = !this.#isClickFocus;
167
+ if (event.target === group && isKeyboardFocus && !this.#isTabbingBackOut) {
168
+ const entry = new CustomEvent(ENTRY_FOCUS, {
169
+ bubbles: false,
170
+ cancelable: true
171
+ });
172
+ group.dispatchEvent(entry);
173
+ if (!entry.defaultPrevented) {
174
+ const items = this.items().filter(item => item.focusable);
175
+ const active = items.find(item => item.active);
176
+ const current = items.find(item => item.id === this.currentTabStopId);
177
+ const candidates = [active, current, ...items].filter(item => !!item);
178
+ focusFirst(candidates.map(item => item.element), {
179
+ preventScroll: this.#options.preventScrollOnEntryFocus?.() ?? false
180
+ });
181
+ }
182
+ }
183
+ this.#isClickFocus = false;
184
+ }
185
+ // ----- The items -------------------------------------------------------------------------
186
+ /** @internal */
187
+ register(item) {
188
+ this.#items.add(item);
189
+ this.#syncGroup();
190
+ return () => {
191
+ this.#items.delete(item);
192
+ this.#syncGroup();
193
+ };
194
+ }
195
+ /** @internal An item's `focusable` changed. */
196
+ changed() {
197
+ this.#syncGroup();
198
+ }
199
+ /** @internal */
200
+ onItemFocus(id) {
201
+ this.tabStop.set(id);
202
+ }
203
+ /** @internal */
204
+ onItemMouseDown(event, item) {
205
+ // A disabled item can't take focus from a click either.
206
+ if (!item.focusable) event.preventDefault();else this.onItemFocus(item.id);
207
+ }
208
+ /** @internal The arrow keys, Home and End, from an item. */
209
+ onItemKeyDown(event, item) {
210
+ if (event.key === 'Tab' && event.shiftKey) {
211
+ // Leave the group in one step: take it out of the tab order until focus has gone.
212
+ this.#isTabbingBackOut = true;
213
+ this.#syncGroup();
214
+ return;
215
+ }
216
+ if (event.target !== item.element) return;
217
+ const intent = getFocusIntent(event, this.orientation, this.dir);
218
+ if (intent === undefined) return;
219
+ if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
220
+ event.preventDefault();
221
+ let candidates = this.items().filter(other => other.focusable).map(other => other.element);
222
+ if (intent === 'last') candidates.reverse();else if (intent === 'prev' || intent === 'next') {
223
+ if (intent === 'prev') candidates.reverse();
224
+ const index = candidates.indexOf(item.element);
225
+ candidates = this.#options.loop?.() ? wrap(candidates, index + 1) : candidates.slice(index + 1);
226
+ }
227
+ focusFirst(candidates);
228
+ }
229
+ }
230
+ function groupModifier(roving) {
231
+ return class RovingFocusGroupModifier extends Modifier {
232
+ #installed = false;
233
+ modify(element) {
234
+ if (this.#installed) return roving.updateGroup(element);
235
+ this.#installed = true;
236
+ const tabindex = element.getAttribute('tabindex');
237
+ const orientation = element.getAttribute('data-orientation');
238
+ roving.updateGroup(element);
239
+ const uninstall = roving.installGroup(element);
240
+ registerDestructor(this, () => {
241
+ uninstall();
242
+ write(element, 'tabindex', tabindex);
243
+ write(element, 'data-orientation', orientation);
244
+ });
245
+ }
246
+ };
247
+ }
248
+ function itemModifier(roving) {
249
+ return class RovingFocusItemModifier extends Modifier {
250
+ #item;
251
+ modify(element, _, named) {
252
+ const id = named.tabStopId ?? idFor(this);
253
+ const focusable = named.focusable ?? true;
254
+ const active = named.active ?? false;
255
+ let item = this.#item;
256
+ if (!item) {
257
+ item = this.#item = {
258
+ element,
259
+ id,
260
+ focusable,
261
+ active
262
+ };
263
+ this.#install(element, item);
264
+ } else {
265
+ const focusableChanged = item.focusable !== focusable;
266
+ Object.assign(item, {
267
+ id,
268
+ focusable,
269
+ active
270
+ });
271
+ if (focusableChanged) roving.changed();
272
+ }
273
+ // Read here, so the item updates when the tab stop or the orientation changes.
274
+ write(element, 'tabindex', roving.currentTabStopId === id ? '0' : '-1');
275
+ write(element, 'data-orientation', roving.orientation ?? null);
276
+ }
277
+ #install(element, item) {
278
+ const tabindex = element.getAttribute('tabindex');
279
+ const orientation = element.getAttribute('data-orientation');
280
+ const onMouseDown = event => roving.onItemMouseDown(event, item);
281
+ const onFocusIn = () => roving.onItemFocus(item.id);
282
+ const onKeyDown = event => roving.onItemKeyDown(event, item);
283
+ element.addEventListener('mousedown', onMouseDown);
284
+ element.addEventListener('focusin', onFocusIn);
285
+ element.addEventListener('keydown', onKeyDown);
286
+ const unregister = roving.register(item);
287
+ registerDestructor(this, () => {
288
+ unregister();
289
+ element.removeEventListener('mousedown', onMouseDown);
290
+ element.removeEventListener('focusin', onFocusIn);
291
+ element.removeEventListener('keydown', onKeyDown);
292
+ write(element, 'tabindex', tabindex);
293
+ write(element, 'data-orientation', orientation);
294
+ });
295
+ }
296
+ };
297
+ }
298
+ /** One item of a `<RovingFocusGroup>`, yielded as `group.Item`. */class RovingFocusItem extends Component {
299
+ get id() {
300
+ return this.args.tabStopId ?? idFor(this);
301
+ }
302
+ /** `@as`, typed as the tag, so the element's type follows it. */
303
+ get tag() {
304
+ return this.args.as ?? 'span';
305
+ }
306
+ get state() {
307
+ const current = this.args.roving.currentTabStopId;
308
+ return {
309
+ isCurrentTabStop: current === this.id,
310
+ hasTabStop: current !== null
311
+ };
312
+ }
313
+ static {
314
+ setComponentTemplate(precompileTemplate("<As @tag={{this.tag}} data-test-jn-part=\"item\" data-test-jn-value={{this.id}} ...attributes {{@roving.item tabStopId=this.id focusable=@focusable active=@active}}>\n {{yield this.state}}\n</As>", {
315
+ strictMode: true,
316
+ scope: () => ({
317
+ As
318
+ })
319
+ }), this);
320
+ }
321
+ }
322
+ /**
323
+ * A roving-tabindex group as a component (see `RovingFocus`): its items share one tab stop, and
324
+ * the arrow keys, Home and End move between them, as in Radix's `RovingFocusGroup`.
325
+ *
326
+ * <RovingFocusGroup @orientation="horizontal" @loop={{true}} role="toolbar" aria-label="Format" as |group|>
327
+ * <group.Item @as="button" @tabStopId="bold" type="button">Bold</group.Item>
328
+ * <button type="button" {{group.item tabStopId="italic"}}>Italic</button>
329
+ * </RovingFocusGroup>
330
+ */
331
+ class RovingFocusGroup extends Component {
332
+ roving = new RovingFocus({
333
+ orientation: () => this.args.orientation,
334
+ dir: () => this.args.dir,
335
+ loop: () => this.args.loop,
336
+ currentTabStopId: () => this.args.currentTabStopId,
337
+ defaultCurrentTabStopId: () => this.args.defaultCurrentTabStopId,
338
+ onCurrentTabStopIdChange: () => this.args.onCurrentTabStopIdChange,
339
+ onEntryFocus: () => this.args.onEntryFocus,
340
+ preventScrollOnEntryFocus: () => this.args.preventScrollOnEntryFocus
341
+ });
342
+ static {
343
+ setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"div\" data-slot=\"roving-focus-group\" data-test-jn=\"roving-focus-group\" data-test-jn-name={{@name}} ...attributes {{this.roving.group}}>\n {{yield (hash Item=(component RovingFocusItem roving=this.roving) item=this.roving.item currentTabStopId=this.roving.currentTabStopId)}}\n</As>", {
344
+ strictMode: true,
345
+ scope: () => ({
346
+ As,
347
+ hash,
348
+ RovingFocusItem
349
+ })
350
+ }), this);
351
+ }
352
+ }
353
+
354
+ export { ENTRY_FOCUS, RovingFocus, RovingFocusGroup, getFocusIntent };
355
+ //# sourceMappingURL=roving-focus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roving-focus.js","sources":["../src/roving-focus.gts"],"sourcesContent":["/* global HTMLElementTagNameMap -- a DOM type, which ESLint's browser globals don't list */\nimport Component from '@glimmer/component'\nimport { hash } from '@ember/helper'\nimport { registerDestructor } from '@ember/destroyable'\nimport Modifier from 'ember-modifier'\nimport type { WithBoundArgs } from '@glint/template'\nimport { As, type TagName } from './as.gts'\nimport { ControllableState } from './controllable-state.ts'\nimport { getDirection, type Direction } from './direction.gts'\nimport { focusFirst } from './focus.ts'\nimport { idFor } from './id.ts'\n\n/** The event a group sends itself before it moves focus to an item, when Tab enters it. */\nexport const ENTRY_FOCUS = 'rovingFocusGroup.onEntryFocus'\n\n/** The arrow keys a group listens to: left and right, up and down, or (unset) all four. */\nexport type Orientation = 'horizontal' | 'vertical'\n\n/** Where a key asks focus to go. */\nexport type FocusIntent = 'first' | 'last' | 'prev' | 'next'\n\nconst KEY_TO_INTENT: Record<string, FocusIntent> = {\n ArrowLeft: 'prev',\n ArrowUp: 'prev',\n ArrowRight: 'next',\n ArrowDown: 'next',\n PageUp: 'first',\n Home: 'first',\n PageDown: 'last',\n End: 'last',\n}\n\n/** The key as it means in this direction: right to left, the left arrow moves forward. */\nfunction directionAwareKey(key: string, dir: Direction): string {\n if (dir !== 'rtl') return key\n if (key === 'ArrowLeft') return 'ArrowRight'\n if (key === 'ArrowRight') return 'ArrowLeft'\n return key\n}\n\n/**\n * Where a key press asks focus to go in a group, as Radix's roving focus reads it: the arrows\n * along the orientation (both pairs when it is unset) move to the previous or next item, with\n * left and right swapped right to left; Home and PageUp go to the first, End and PageDown to\n * the last. Anything else is `undefined`.\n *\n * getFocusIntent(event, 'horizontal', 'rtl') // 'next' for ArrowLeft\n */\nexport function getFocusIntent(\n event: Pick<KeyboardEvent, 'key'>,\n orientation: Orientation | undefined,\n dir: Direction,\n): FocusIntent | undefined {\n const key = directionAwareKey(event.key, dir)\n if (orientation === 'vertical' && (key === 'ArrowLeft' || key === 'ArrowRight')) return undefined\n if (orientation === 'horizontal' && (key === 'ArrowUp' || key === 'ArrowDown')) return undefined\n return KEY_TO_INTENT[key]\n}\n\n/** The array, starting at `start` and wrapping round. */\nfunction wrap<T>(array: T[], start: number): T[] {\n return array.map((_, index) => array[(start + index) % array.length]!)\n}\n\n/** Where a `RovingFocus` reads its settings. Each is a function, so it reads them live. */\nexport interface RovingFocusOptions {\n /** Which arrow keys move focus. Unset: all four. */\n orientation?: () => Orientation | undefined\n /** The text direction, when the DOM's (`getDirection`) shouldn't decide. */\n dir?: () => Direction | undefined\n /** Whether the arrows wrap round from the last item to the first and back. Default `false`. */\n loop?: () => boolean | undefined\n /** The controlled tab stop: the id of the item Tab enters on. */\n currentTabStopId?: () => string | null | undefined\n /** The first tab stop, when uncontrolled. */\n defaultCurrentTabStopId?: () => string | undefined\n /** Called with each new tab stop. */\n onCurrentTabStopIdChange?: () => ((id: string | null) => void) | undefined\n /** Called before Tab moves focus into an item; `event.preventDefault()` keeps it on the group. */\n onEntryFocus?: () => ((event: Event) => void) | undefined\n /** Don't scroll the item focused on entry into view. */\n preventScrollOnEntryFocus?: () => boolean | undefined\n}\n\n/** An item, as its group sees it. */\nexport interface RovingFocusItemState {\n /** Its element. */\n element: HTMLElement\n /** Its tab stop id. */\n id: string\n /** Whether focus can land on it. */\n focusable: boolean\n /** Whether Tab enters the group on it first. */\n active: boolean\n}\n\nexport interface RovingFocusGroupModifierSignature {\n Element: HTMLElement\n}\n\nexport interface RovingFocusItemModifierSignature {\n Element: HTMLElement\n Args: {\n Named: {\n /** The item's id, for the tab stop. Default: one of its own. */\n tabStopId?: string\n /** Whether focus can land on it. Default `true`; a disabled item passes `false`. */\n focusable?: boolean\n /** Whether Tab should enter on it first, as on a selected tab. Default `false`. */\n active?: boolean\n }\n }\n}\n\n/** Sets an attribute, or removes it for `null`. */\nfunction write(element: Element, name: string, value: string | null): void {\n if (value === null) element.removeAttribute(name)\n else if (element.getAttribute(name) !== value) element.setAttribute(name, value)\n}\n\n/**\n * A roving tabindex, as Radix's `RovingFocusGroup`: the items of a group take one tab stop\n * between them, and the arrow keys move focus from item to item (APG's roving tabindex, and\n * tabster's Mover in ember-primitives). It remembers the item last focused, so Tab comes back\n * to it; enters on the `active` item first (a selected tab); flips left and right in\n * right-to-left text; and Shift+Tab leaves the group in one step.\n *\n * A component makes one and puts its two modifiers on its own elements, beside its own parts:\n *\n * class Toolbar extends Component {\n * roving = new RovingFocus({\n * orientation: () => this.args.orientation ?? 'horizontal',\n * loop: () => true,\n * })\n * <template>\n * <div role=\"toolbar\" {{this.roving.group}}>\n * <button type=\"button\" {{this.roving.item tabStopId=\"bold\"}}>Bold</button>\n * <button type=\"button\" {{this.roving.item tabStopId=\"italic\" focusable=false}}>Italic</button>\n * </div>\n * </template>\n * }\n *\n * `<RovingFocusGroup>` is the same thing as a component, for an app's own groups.\n */\nexport class RovingFocus {\n readonly #options: RovingFocusOptions\n /** The tab stop: the id of the item that is in the tab order. */\n readonly tabStop: ControllableState<string | null>\n readonly #items = new Set<RovingFocusItemState>()\n #group: HTMLElement | undefined\n #isTabbingBackOut = false\n #isClickFocus = false\n\n /** Put it on the group's element. */\n readonly group: typeof Modifier<RovingFocusGroupModifierSignature>\n /** Put it on each item's element. */\n readonly item: typeof Modifier<RovingFocusItemModifierSignature>\n\n constructor(options: RovingFocusOptions = {}) {\n this.#options = options\n this.tabStop = new ControllableState<string | null>({\n name: 'currentTabStopId',\n value: () => options.currentTabStopId?.(),\n defaultValue: () => options.defaultCurrentTabStopId?.(),\n onChange: () => options.onCurrentTabStopIdChange?.(),\n fallback: null,\n })\n this.group = groupModifier(this)\n this.item = itemModifier(this)\n }\n\n /** The id of the item Tab enters on, or `null` when none has been focused yet. */\n get currentTabStopId(): string | null {\n return this.tabStop.value\n }\n\n get orientation(): Orientation | undefined {\n return this.#options.orientation?.()\n }\n\n /** The direction the arrow keys follow: the option, or the document's at the group. */\n get dir(): Direction {\n return getDirection(this.#group, this.#options.dir?.())\n }\n\n /** The items, in document order. */\n items(): RovingFocusItemState[] {\n return [...this.#items].sort((a, b) =>\n a.element.compareDocumentPosition(b.element) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1,\n )\n }\n\n // ----- The group -------------------------------------------------------------------------\n\n /** @internal */\n installGroup(element: HTMLElement): () => void {\n this.#group = element\n const outline = element.style.getPropertyValue('outline')\n // The group takes focus for a moment on the way to an item; Radix hides its outline.\n element.style.setProperty('outline', 'none')\n const onMouseDown = () => (this.#isClickFocus = true)\n const onFocusIn = (event: FocusEvent) => this.#onGroupFocus(event, element)\n const onFocusOut = () => {\n this.#isTabbingBackOut = false\n this.#syncGroup()\n }\n const onEntryFocus = (event: Event) => this.#options.onEntryFocus?.()?.(event)\n element.addEventListener('mousedown', onMouseDown)\n element.addEventListener('focusin', onFocusIn)\n element.addEventListener('focusout', onFocusOut)\n element.addEventListener(ENTRY_FOCUS, onEntryFocus)\n this.#syncGroup()\n return () => {\n element.removeEventListener('mousedown', onMouseDown)\n element.removeEventListener('focusin', onFocusIn)\n element.removeEventListener('focusout', onFocusOut)\n element.removeEventListener(ENTRY_FOCUS, onEntryFocus)\n if (outline) element.style.setProperty('outline', outline)\n else element.style.removeProperty('outline')\n if (this.#group === element) this.#group = undefined\n }\n }\n\n /** @internal Keeps the group's `data-orientation` current. */\n updateGroup(element: HTMLElement): void {\n write(element, 'data-orientation', this.orientation ?? null)\n }\n\n /**\n * The group is in the tab order while an item can take focus and Shift+Tab isn't leaving: Tab\n * lands on the group, which sends focus on to an item. It is set straight on the element, not\n * through tracked state, so it holds before the browser moves focus for the same key press.\n */\n #syncGroup(): void {\n const group = this.#group\n if (!group) return\n const focusable = [...this.#items].some(item => item.focusable)\n group.setAttribute('tabindex', this.#isTabbingBackOut || !focusable ? '-1' : '0')\n }\n\n /** Tab onto the group itself: send focus on to the active item, the tab stop, or the first. */\n #onGroupFocus(event: FocusEvent, group: HTMLElement): void {\n const isKeyboardFocus = !this.#isClickFocus\n if (event.target === group && isKeyboardFocus && !this.#isTabbingBackOut) {\n const entry = new CustomEvent(ENTRY_FOCUS, { bubbles: false, cancelable: true })\n group.dispatchEvent(entry)\n if (!entry.defaultPrevented) {\n const items = this.items().filter(item => item.focusable)\n const active = items.find(item => item.active)\n const current = items.find(item => item.id === this.currentTabStopId)\n const candidates = [active, current, ...items].filter(\n (item): item is RovingFocusItemState => !!item,\n )\n focusFirst(\n candidates.map(item => item.element),\n { preventScroll: this.#options.preventScrollOnEntryFocus?.() ?? false },\n )\n }\n }\n this.#isClickFocus = false\n }\n\n // ----- The items -------------------------------------------------------------------------\n\n /** @internal */\n register(item: RovingFocusItemState): () => void {\n this.#items.add(item)\n this.#syncGroup()\n return () => {\n this.#items.delete(item)\n this.#syncGroup()\n }\n }\n\n /** @internal An item's `focusable` changed. */\n changed(): void {\n this.#syncGroup()\n }\n\n /** @internal */\n onItemFocus(id: string): void {\n this.tabStop.set(id)\n }\n\n /** @internal */\n onItemMouseDown(event: MouseEvent, item: RovingFocusItemState): void {\n // A disabled item can't take focus from a click either.\n if (!item.focusable) event.preventDefault()\n else this.onItemFocus(item.id)\n }\n\n /** @internal The arrow keys, Home and End, from an item. */\n onItemKeyDown(event: KeyboardEvent, item: RovingFocusItemState): void {\n if (event.key === 'Tab' && event.shiftKey) {\n // Leave the group in one step: take it out of the tab order until focus has gone.\n this.#isTabbingBackOut = true\n this.#syncGroup()\n return\n }\n if (event.target !== item.element) return\n const intent = getFocusIntent(event, this.orientation, this.dir)\n if (intent === undefined) return\n if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return\n event.preventDefault()\n\n let candidates = this.items()\n .filter(other => other.focusable)\n .map(other => other.element)\n if (intent === 'last') candidates.reverse()\n else if (intent === 'prev' || intent === 'next') {\n if (intent === 'prev') candidates.reverse()\n const index = candidates.indexOf(item.element)\n candidates = this.#options.loop?.()\n ? wrap(candidates, index + 1)\n : candidates.slice(index + 1)\n }\n focusFirst(candidates)\n }\n}\n\nfunction groupModifier(roving: RovingFocus): typeof Modifier<RovingFocusGroupModifierSignature> {\n return class RovingFocusGroupModifier extends Modifier<RovingFocusGroupModifierSignature> {\n #installed = false\n\n override modify(element: HTMLElement): void {\n if (this.#installed) return roving.updateGroup(element)\n this.#installed = true\n const tabindex = element.getAttribute('tabindex')\n const orientation = element.getAttribute('data-orientation')\n roving.updateGroup(element)\n const uninstall = roving.installGroup(element)\n registerDestructor(this, () => {\n uninstall()\n write(element, 'tabindex', tabindex)\n write(element, 'data-orientation', orientation)\n })\n }\n }\n}\n\nfunction itemModifier(roving: RovingFocus): typeof Modifier<RovingFocusItemModifierSignature> {\n return class RovingFocusItemModifier extends Modifier<RovingFocusItemModifierSignature> {\n #item: RovingFocusItemState | undefined\n\n override modify(\n element: HTMLElement,\n _: [],\n named: RovingFocusItemModifierSignature['Args']['Named'],\n ): void {\n const id = named.tabStopId ?? idFor(this)\n const focusable = named.focusable ?? true\n const active = named.active ?? false\n\n let item = this.#item\n if (!item) {\n item = this.#item = { element, id, focusable, active }\n this.#install(element, item)\n } else {\n const focusableChanged = item.focusable !== focusable\n Object.assign(item, { id, focusable, active })\n if (focusableChanged) roving.changed()\n }\n\n // Read here, so the item updates when the tab stop or the orientation changes.\n write(element, 'tabindex', roving.currentTabStopId === id ? '0' : '-1')\n write(element, 'data-orientation', roving.orientation ?? null)\n }\n\n #install(element: HTMLElement, item: RovingFocusItemState): void {\n const tabindex = element.getAttribute('tabindex')\n const orientation = element.getAttribute('data-orientation')\n const onMouseDown = (event: MouseEvent) => roving.onItemMouseDown(event, item)\n const onFocusIn = () => roving.onItemFocus(item.id)\n const onKeyDown = (event: KeyboardEvent) => roving.onItemKeyDown(event, item)\n element.addEventListener('mousedown', onMouseDown)\n element.addEventListener('focusin', onFocusIn)\n element.addEventListener('keydown', onKeyDown)\n const unregister = roving.register(item)\n registerDestructor(this, () => {\n unregister()\n element.removeEventListener('mousedown', onMouseDown)\n element.removeEventListener('focusin', onFocusIn)\n element.removeEventListener('keydown', onKeyDown)\n write(element, 'tabindex', tabindex)\n write(element, 'data-orientation', orientation)\n })\n }\n }\n}\n\nexport interface RovingFocusItemSignature<Tag extends keyof HTMLElementTagNameMap = 'span'> {\n Args: {\n /** The item's id, for the tab stop and the harness (`data-test-jn-value`). */\n tabStopId?: string\n /** Whether focus can land on it. Default `true`. */\n focusable?: boolean\n /** Whether Tab enters the group on it first, as on a selected tab. Default `false`. */\n active?: boolean\n /** The tag to render. Default `span`, as in Radix; `button` for a toolbar's buttons. */\n as?: Tag\n /** @internal */\n roving: RovingFocus\n }\n Blocks: {\n default: [state: { isCurrentTabStop: boolean; hasTabStop: boolean }]\n }\n Element: HTMLElementTagNameMap[Tag]\n}\n\n/** One item of a `<RovingFocusGroup>`, yielded as `group.Item`. */\nclass RovingFocusItem<Tag extends keyof HTMLElementTagNameMap = 'span'> extends Component<\n RovingFocusItemSignature<Tag>\n> {\n get id(): string {\n return this.args.tabStopId ?? idFor(this)\n }\n\n /** `@as`, typed as the tag, so the element's type follows it. */\n get tag(): Tag {\n return this.args.as ?? ('span' as Tag)\n }\n\n get state() {\n const current = this.args.roving.currentTabStopId\n return { isCurrentTabStop: current === this.id, hasTabStop: current !== null }\n }\n\n <template>\n <As\n @tag={{this.tag}}\n data-test-jn-part=\"item\"\n data-test-jn-value={{this.id}}\n ...attributes\n {{@roving.item tabStopId=this.id focusable=@focusable active=@active}}\n >\n {{yield this.state}}\n </As>\n </template>\n}\n\nexport interface RovingFocusGroupSignature {\n Args: {\n /** Which arrow keys move focus: `horizontal`, `vertical`, or (unset) all four. */\n orientation?: Orientation\n /** The text direction. Default: the document's, so `dir=\"rtl\"` around it flips the arrows. */\n dir?: Direction\n /** Wrap round from the last item to the first and back. Default `false`. */\n loop?: boolean\n /** The controlled tab stop, by item id. */\n currentTabStopId?: string | null\n /** The first tab stop, uncontrolled. */\n defaultCurrentTabStopId?: string\n /** Called with each new tab stop. */\n onCurrentTabStopIdChange?: (id: string | null) => void\n /** Called before Tab moves focus on to an item; `preventDefault()` keeps it on the group. */\n onEntryFocus?: (event: Event) => void\n /** Don't scroll the item focused on entry into view. */\n preventScrollOnEntryFocus?: boolean\n /** The tag to render. Default `div`. */\n as?: TagName\n /** The harness's name for it (`data-test-jn-name`). */\n name?: string\n }\n Blocks: {\n default: [\n group: {\n /** An item, as an element: `<group.Item @as=\"button\" type=\"button\">`. */\n Item: WithBoundArgs<typeof RovingFocusItem, 'roving'>\n /** An item, as a modifier on your own element: `<button {{group.item}}>`. */\n item: RovingFocus['item']\n /** The id of the item Tab enters on, or `null`. */\n currentTabStopId: string | null\n },\n ]\n }\n Element: HTMLElement\n}\n\n/**\n * A roving-tabindex group as a component (see `RovingFocus`): its items share one tab stop, and\n * the arrow keys, Home and End move between them, as in Radix's `RovingFocusGroup`.\n *\n * <RovingFocusGroup @orientation=\"horizontal\" @loop={{true}} role=\"toolbar\" aria-label=\"Format\" as |group|>\n * <group.Item @as=\"button\" @tabStopId=\"bold\" type=\"button\">Bold</group.Item>\n * <button type=\"button\" {{group.item tabStopId=\"italic\"}}>Italic</button>\n * </RovingFocusGroup>\n */\nexport class RovingFocusGroup extends Component<RovingFocusGroupSignature> {\n roving = new RovingFocus({\n orientation: () => this.args.orientation,\n dir: () => this.args.dir,\n loop: () => this.args.loop,\n currentTabStopId: () => this.args.currentTabStopId,\n defaultCurrentTabStopId: () => this.args.defaultCurrentTabStopId,\n onCurrentTabStopIdChange: () => this.args.onCurrentTabStopIdChange,\n onEntryFocus: () => this.args.onEntryFocus,\n preventScrollOnEntryFocus: () => this.args.preventScrollOnEntryFocus,\n })\n\n <template>\n <As\n @as={{@as}}\n @tag=\"div\"\n data-slot=\"roving-focus-group\"\n data-test-jn=\"roving-focus-group\"\n data-test-jn-name={{@name}}\n ...attributes\n {{this.roving.group}}\n >\n {{yield\n (hash\n Item=(component RovingFocusItem roving=this.roving)\n item=this.roving.item\n currentTabStopId=this.roving.currentTabStopId\n )\n }}\n </As>\n </template>\n}\n"],"names":["ENTRY_FOCUS","KEY_TO_INTENT","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","PageUp","Home","PageDown","End","directionAwareKey","key","dir","getFocusIntent","event","orientation","undefined","wrap","array","start","map","_","index","length","write","element","name","value","removeAttribute","getAttribute","setAttribute","RovingFocus","tabStop","Set","group","item","constructor","options","ControllableState","currentTabStopId","defaultValue","defaultCurrentTabStopId","onChange","onCurrentTabStopIdChange","fallback","groupModifier","itemModifier","getDirection","items","sort","a","b","compareDocumentPosition","Node","DOCUMENT_POSITION_FOLLOWING","installGroup","outline","style","getPropertyValue","setProperty","onMouseDown","onFocusIn","onFocusOut","onEntryFocus","addEventListener","removeEventListener","removeProperty","updateGroup","#syncGroup","focusable","some","#onGroupFocus","isKeyboardFocus","target","entry","CustomEvent","bubbles","cancelable","dispatchEvent","defaultPrevented","filter","active","find","current","id","candidates","focusFirst","preventScroll","preventScrollOnEntryFocus","register","add","delete","changed","onItemFocus","set","onItemMouseDown","preventDefault","onItemKeyDown","shiftKey","intent","metaKey","ctrlKey","altKey","other","reverse","indexOf","loop","slice","roving","RovingFocusGroupModifier","Modifier","modify","tabindex","uninstall","registerDestructor","RovingFocusItemModifier","named","tabStopId","idFor","focusableChanged","Object","assign","#install","onKeyDown","unregister","RovingFocusItem","Component","args","tag","as","state","isCurrentTabStop","hasTabStop","setComponentTemplate","precompileTemplate","strictMode","scope","As","RovingFocusGroup","hash"],"mappings":";;;;;;;;;;;;AAaO,MAAMA,WAAA,GAAc;AAE3B;AAGA;AAGA,MAAMC,aAA8B,GAAe;AACjDC,EAAAA,SAAA,EAAW,MAAA;AACXC,EAAAA,OAAA,EAAS,MAAA;AACTC,EAAAA,UAAA,EAAY,MAAA;AACZC,EAAAA,SAAA,EAAW,MAAA;AACXC,EAAAA,MAAA,EAAQ,OAAA;AACRC,EAAAA,IAAA,EAAM,OAAA;AACNC,EAAAA,QAAA,EAAU,MAAA;AACVC,EAAAA,GAAA,EAAK;AACP,CAAA;AAEA;AACA,SAASC,iBAAAA,CAAkBC,GAAW,EAAEC,GAAc,EAAS;AAC7D,EAAA,IAAIA,GAAA,KAAQ,OAAO,OAAOD,GAAA;AAC1B,EAAA,IAAIA,GAAA,KAAQ,aAAa,OAAO,YAAA;AAChC,EAAA,IAAIA,GAAA,KAAQ,cAAc,OAAO,WAAA;AACjC,EAAA,OAAOA,GAAA;AACT;AAEA;;;;;;;AAOC;AACM,SAASE,cAAAA,CACdC,KAAiC,EACjCC,WAAoC,EACpCH,GAAc,EACU;EACxB,MAAMD,GAAA,GAAMD,iBAAA,CAAkBI,KAAA,CAAMH,GAAG,EAAEC,GAAA,CAAA;AACzC,EAAA,IAAIG,WAAA,KAAgB,eAAeJ,GAAA,KAAQ,eAAeA,GAAA,KAAQ,YAAY,GAAG,OAAOK,SAAA;AACxF,EAAA,IAAID,WAAA,K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S,IAAI7E,WAAA,CAAY;AACvBhB,IAAAA,WAAA,EAAaA,MAAM,IAAI,CAACgH,IAAI,CAAChH,WAAW;AACxCH,IAAAA,GAAA,EAAKA,MAAM,IAAI,CAACmH,IAAI,CAACnH,GAAG;AACxB8F,IAAAA,IAAA,EAAMA,MAAM,IAAI,CAACqB,IAAI,CAACrB,IAAI;AAC1BnE,IAAAA,gBAAA,EAAkBA,MAAM,IAAI,CAACwF,IAAI,CAACxF,gBAAgB;AAClDE,IAAAA,uBAAA,EAAyBA,MAAM,IAAI,CAACsF,IAAI,CAACtF,uBAAuB;AAChEE,IAAAA,wBAAA,EAA0BA,MAAM,IAAI,CAACoF,IAAI,CAACpF,wBAAwB;AAClEoB,IAAAA,YAAA,EAAcA,MAAM,IAAI,CAACgE,IAAI,CAAChE,YAAY;AAC1CyB,IAAAA,yBAAA,EAA2BA,MAAM,IAAI,CAACuC,IAAI,CAACvC;AAC7C,GAAA,CAAA;AAEA,EAAA;IAAA6C,oBAAA,CAAAC,kBAAA,CAAA,uTAAA,EAkBA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,EAAA;QAAAE,IAAA;AAAAd,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -0,0 +1,2 @@
1
+ export { S as ScrollArea, a as ScrollAreaCorner, b as ScrollAreaScrollbar, c as ScrollAreaState, d as ScrollAreaThumb, e as ScrollAreaViewport, f as ScrollbarPart, g as ScrollbarState, s as scrollFromPointer, t as thumbOffset, h as thumbRatio, i as thumbSize } from './components-F0Ini448.js';
2
+ //# sourceMappingURL=scroll-area.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scroll-area.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,87 @@
1
+ /** Where a scroll is headed, as `scrollLeft` and `scrollTop` give it. An axis left out stays put. */
2
+
3
+ /** How many frames without movement count as the end of a scroll, where no `scrollend` comes. */
4
+ const STILL_FRAMES = 3;
5
+
6
+ /**
7
+ * How many, while a scroll is short of where it was headed: a busy page can drop a frame or two
8
+ * of a smooth scroll, and one that stopped short (snapped elsewhere, or was taken over) gets its
9
+ * `scrollend` anyway in browsers that have the event.
10
+ */
11
+ const SHORT_STILL_FRAMES = 10;
12
+
13
+ /**
14
+ * How long a scroll that has somewhere to go may take to start moving, in milliseconds. A
15
+ * smooth scroll can take a few frames to set off, more on a busy machine, and frames without
16
+ * movement before then don't mean it ended.
17
+ */
18
+ const START_TIMEOUT = 1000;
19
+
20
+ /** The longest a scroll is waited for, so a page whose frames stop (a hidden tab) never hangs. */
21
+ const MAX_WAIT = 5000;
22
+
23
+ /** Within a pixel: scroll positions can be fractional, and the sizes they're clamped to aren't. */
24
+ const near = (value, to) => to === undefined || Math.abs(value - to) <= 1;
25
+
26
+ /** Where a scroll to `target` comes to on `element`: the browser holds it within its range. */
27
+ function clamp(element, target) {
28
+ const width = Math.max(0, element.scrollWidth - element.clientWidth);
29
+ const height = Math.max(0, element.scrollHeight - element.clientHeight);
30
+ // In right-to-left text `scrollLeft` runs from 0 at the right edge down to `-width`.
31
+ const rtl = getComputedStyle(element).direction === 'rtl';
32
+ const [min, max] = rtl ? [-width, 0] : [0, width];
33
+ const goal = {};
34
+ if (target.left !== undefined) goal.left = Math.min(max, Math.max(min, target.left));
35
+ if (target.top !== undefined) goal.top = Math.min(height, Math.max(0, target.top));
36
+ return goal;
37
+ }
38
+
39
+ /**
40
+ * Waits for a scroll of `element` to end: the `scrollend` event, or, where none comes (a scroll
41
+ * that goes nowhere, a browser without the event), three frames in a row without movement.
42
+ *
43
+ * Given the `target` the scroll was sent to, a scroll that has somewhere to go is first waited
44
+ * for to start: until it moves, gets there or ends, or a second has gone by. Only then do still
45
+ * frames count, so a smooth scroll that is slow to set off isn't taken for one that ended.
46
+ * Without a target, still frames count from the start.
47
+ */
48
+ function scrollEnd(element, target) {
49
+ return new Promise(resolve => {
50
+ const goal = target && clamp(element, target);
51
+ const reached = () => !goal || near(element.scrollLeft, goal.left) && near(element.scrollTop, goal.top);
52
+ const position = () => `${element.scrollLeft},${element.scrollTop}`;
53
+ const from = position();
54
+ const began = performance.now();
55
+ let started = reached();
56
+ let done = false;
57
+ let last = from;
58
+ let still = 0;
59
+ const finish = () => {
60
+ if (done) return;
61
+ done = true;
62
+ clearTimeout(timeout);
63
+ element.removeEventListener('scrollend', finish);
64
+ resolve();
65
+ };
66
+ const timeout = setTimeout(finish, MAX_WAIT);
67
+ element.addEventListener('scrollend', finish);
68
+ const check = () => {
69
+ if (done) return;
70
+ if (!element.isConnected) return finish();
71
+ const now = position();
72
+ if (!started) {
73
+ started = now !== from || reached() || performance.now() - began >= START_TIMEOUT;
74
+ } else if (now === last) {
75
+ still += 1;
76
+ } else {
77
+ still = 0;
78
+ }
79
+ last = now;
80
+ if (started && still >= (reached() ? STILL_FRAMES : SHORT_STILL_FRAMES)) finish();else requestAnimationFrame(check);
81
+ };
82
+ requestAnimationFrame(check);
83
+ });
84
+ }
85
+
86
+ export { scrollEnd as s };
87
+ //# sourceMappingURL=scroll-end-Cer8JSIB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scroll-end-Cer8JSIB.js","sources":["../src/-private/scroll-end.ts"],"sourcesContent":["/** Where a scroll is headed, as `scrollLeft` and `scrollTop` give it. An axis left out stays put. */\nexport interface ScrollTarget {\n left?: number\n top?: number\n}\n\n/** How many frames without movement count as the end of a scroll, where no `scrollend` comes. */\nconst STILL_FRAMES = 3\n\n/**\n * How many, while a scroll is short of where it was headed: a busy page can drop a frame or two\n * of a smooth scroll, and one that stopped short (snapped elsewhere, or was taken over) gets its\n * `scrollend` anyway in browsers that have the event.\n */\nconst SHORT_STILL_FRAMES = 10\n\n/**\n * How long a scroll that has somewhere to go may take to start moving, in milliseconds. A\n * smooth scroll can take a few frames to set off, more on a busy machine, and frames without\n * movement before then don't mean it ended.\n */\nconst START_TIMEOUT = 1000\n\n/** The longest a scroll is waited for, so a page whose frames stop (a hidden tab) never hangs. */\nconst MAX_WAIT = 5000\n\n/** Within a pixel: scroll positions can be fractional, and the sizes they're clamped to aren't. */\nconst near = (value: number, to: number | undefined) =>\n to === undefined || Math.abs(value - to) <= 1\n\n/** Where a scroll to `target` comes to on `element`: the browser holds it within its range. */\nfunction clamp(element: HTMLElement, target: ScrollTarget): ScrollTarget {\n const width = Math.max(0, element.scrollWidth - element.clientWidth)\n const height = Math.max(0, element.scrollHeight - element.clientHeight)\n // In right-to-left text `scrollLeft` runs from 0 at the right edge down to `-width`.\n const rtl = getComputedStyle(element).direction === 'rtl'\n const [min, max] = rtl ? [-width, 0] : [0, width]\n const goal: ScrollTarget = {}\n if (target.left !== undefined) goal.left = Math.min(max, Math.max(min, target.left))\n if (target.top !== undefined) goal.top = Math.min(height, Math.max(0, target.top))\n return goal\n}\n\n/**\n * Waits for a scroll of `element` to end: the `scrollend` event, or, where none comes (a scroll\n * that goes nowhere, a browser without the event), three frames in a row without movement.\n *\n * Given the `target` the scroll was sent to, a scroll that has somewhere to go is first waited\n * for to start: until it moves, gets there or ends, or a second has gone by. Only then do still\n * frames count, so a smooth scroll that is slow to set off isn't taken for one that ended.\n * Without a target, still frames count from the start.\n */\nexport function scrollEnd(element: HTMLElement, target?: ScrollTarget): Promise<void> {\n return new Promise(resolve => {\n const goal = target && clamp(element, target)\n const reached = () =>\n !goal || (near(element.scrollLeft, goal.left) && near(element.scrollTop, goal.top))\n const position = () => `${element.scrollLeft},${element.scrollTop}`\n const from = position()\n const began = performance.now()\n let started = reached()\n let done = false\n let last = from\n let still = 0\n const finish = () => {\n if (done) return\n done = true\n clearTimeout(timeout)\n element.removeEventListener('scrollend', finish)\n resolve()\n }\n const timeout = setTimeout(finish, MAX_WAIT)\n element.addEventListener('scrollend', finish)\n const check = () => {\n if (done) return\n if (!element.isConnected) return finish()\n const now = position()\n if (!started) {\n started = now !== from || reached() || performance.now() - began >= START_TIMEOUT\n } else if (now === last) {\n still += 1\n } else {\n still = 0\n }\n last = now\n if (started && still >= (reached() ? STILL_FRAMES : SHORT_STILL_FRAMES)) finish()\n else requestAnimationFrame(check)\n }\n requestAnimationFrame(check)\n })\n}\n"],"names":["STILL_FRAMES","SHORT_STILL_FRAMES","START_TIMEOUT","MAX_WAIT","near","value","to","undefined","Math","abs","clamp","element","target","width","max","scrollWidth","clientWidth","height","scrollHeight","clientHeight","rtl","getComputedStyle","direction","min","goal","left","top","scrollEnd","Promise","resolve","reached","scrollLeft","scrollTop","position","from","began","performance","now","started","done","last","still","finish","clearTimeout","timeout","removeEventListener","setTimeout","addEventListener","check","isConnected","requestAnimationFrame"],"mappings":"AAAA;;AAMA;AACA,MAAMA,YAAY,GAAG,CAAC;;AAEtB;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG,EAAE;;AAE7B;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAG,IAAI;;AAE1B;AACA,MAAMC,QAAQ,GAAG,IAAI;;AAErB;AACA,MAAMC,IAAI,GAAGA,CAACC,KAAa,EAAEC,EAAsB,KACjDA,EAAE,KAAKC,SAAS,IAAIC,IAAI,CAACC,GAAG,CAACJ,KAAK,GAAGC,EAAE,CAAC,IAAI,CAAC;;AAE/C;AACA,SAASI,KAAKA,CAACC,OAAoB,EAAEC,MAAoB,EAAgB;AACvE,EAAA,MAAMC,KAAK,GAAGL,IAAI,CAACM,GAAG,CAAC,CAAC,EAAEH,OAAO,CAACI,WAAW,GAAGJ,OAAO,CAACK,WAAW,CAAC;AACpE,EAAA,MAAMC,MAAM,GAAGT,IAAI,CAACM,GAAG,CAAC,CAAC,EAAEH,OAAO,CAACO,YAAY,GAAGP,OAAO,CAACQ,YAAY,CAAC;AACvE;EACA,MAAMC,GAAG,GAAGC,gBAAgB,CAACV,OAAO,CAAC,CAACW,SAAS,KAAK,KAAK;AACzD,EAAA,MAAM,CAACC,GAAG,EAAET,GAAG,CAAC,GAAGM,GAAG,GAAG,CAAC,CAACP,KAA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