@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 @@
1
+ {"version":3,"file":"shadowed.js","sources":["../src/shadowed.gts"],"sourcesContent":["import Component from '@glimmer/component'\nimport type Owner from '@ember/owner'\nimport { modifier } from 'ember-modifier'\n\nexport interface ShadowedSignature {\n Args: {\n /**\n * Bring the page's style sheets in: a copy of each `<style>` and `<link rel=\"stylesheet\">`\n * in the document's `<head>`, and its adopted style sheets. Default `false`: the content\n * starts from the browser's own styles, untouched by the app's.\n */\n includeStyles?: boolean\n /** Its name, for its harness (`data-test-jn-name`). */\n name?: string\n }\n Blocks: {\n /** The content to render in the shadow root. */\n default: []\n }\n /**\n * The outer `<div>`, which has the attributes. The shadow root's host is the `<div>` inside\n * it, and the content is in a `<div>` in the shadow root.\n */\n Element: HTMLDivElement\n}\n\n/**\n * Renders its content in a shadow root, as ember-primitives' `Shadowed`, so the app's styles\n * don't reach it: for content that must look as it would on a page of its own, such as an\n * email preview or a third-party widget. The content is still the component's (its state,\n * actions and destruction); only the styles stop at the shadow boundary.\n *\n * <Shadowed>\n * <p class=\"card\">Not styled by the app's .card</p>\n * </Shadowed>\n *\n * The shadow root is open, so a test can reach it (`ShadowedHarness`). Ember can't render\n * straight into a shadow root on every version Joinery supports, so, as in ember-primitives,\n * the host is a `<div>` inside the outer one, and the content renders in a `<div>` inside the\n * shadow root. Harnesses don't look into shadow roots: drive what's inside through\n * `ShadowedHarness`.\n */\nexport class Shadowed extends Component<ShadowedSignature> {\n /** The shadow root's host, rendered in the outer `<div>`. */\n readonly host: HTMLDivElement\n /** The shadow root. */\n readonly shadowRoot: ShadowRoot\n /** Where the content renders, inside the shadow root. */\n readonly target: HTMLDivElement\n\n constructor(owner: Owner, args: ShadowedSignature['Args']) {\n super(owner, args)\n this.host = document.createElement('div')\n this.shadowRoot = this.host.attachShadow({ mode: 'open' })\n this.target = document.createElement('div')\n this.shadowRoot.append(this.target)\n }\n\n /** A copy of each style sheet in the document's `<head>`, in order. */\n copyStyles = (): Node[] => {\n const document = this.host.ownerDocument\n return [...document.head.querySelectorAll('style, link[rel~=\"stylesheet\"]')].map(sheet =>\n sheet.cloneNode(true),\n )\n }\n\n /**\n * With `@includeStyles`, the document's adopted style sheets too, ahead of the root's own.\n * When `@includeStyles` turns off, or the component goes, it takes out the ones it added\n * (and leaves the root's own, such as a layout primitive's rules, where they are).\n */\n adoptSheets = modifier((element: HTMLElement, [include]: [boolean | undefined]) => {\n if (!include) return\n const root = this.shadowRoot\n const added = (element.ownerDocument.adoptedStyleSheets ?? []).filter(\n sheet => !root.adoptedStyleSheets.includes(sheet),\n )\n if (!added.length) return\n try {\n root.adoptedStyleSheets = [...added, ...root.adoptedStyleSheets]\n } catch {\n // A sheet made in another window (an iframe) can't be adopted here; the copies remain.\n return\n }\n return () => {\n root.adoptedStyleSheets = root.adoptedStyleSheets.filter(sheet => !added.includes(sheet))\n }\n })\n\n <template>\n <div\n data-test-jn=\"shadowed\"\n data-test-jn-wrapper\n data-test-jn-name={{@name}}\n ...attributes\n {{this.adoptSheets @includeStyles}}\n >{{this.host}}</div>\n {{#in-element this.target insertBefore=null}}\n {{#if @includeStyles}}\n {{#each (this.copyStyles) as |sheet|}}{{sheet}}{{/each}}\n {{/if}}\n {{yield}}\n {{/in-element}}\n </template>\n}\n"],"names":["Shadowed","Component","host","shadowRoot","target","constructor","owner","args","document","createElement","attachShadow","mode","append","copyStyles","ownerDocument","head","querySelectorAll","map","sheet","cloneNode","adoptSheets","modifier","element","include","root","added","adoptedStyleSheets","filter","includes","length","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;AA0BA;;;;;;;;;;;;;;;;AAgBO,MAAMA,QAAA,SAAiBC,SAAA,CAAU;AACtC,+DACSC,IAAA;AACT;EACSC,UAAA;AACT;EACSC,MAAA;AAETC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAA+B,EAAE;AACzD,IAAA,KAAK,CAACD,KAAA,EAAOC,IAAA,CAAA;IACb,IAAI,CAACL,IAAI,GAAGM,QAAA,CAASC,aAAa,CAAC,KAAA,CAAA;IACnC,IAAI,CAACN,UAAU,GAAG,IAAI,CAACD,IAAI,CAACQ,YAAY,CAAC;AAAEC,MAAAA,IAAA,EAAM;AAAO,KAAA,CAAA;IACxD,IAAI,CAACP,MAAM,GAAGI,QAAA,CAASC,aAAa,CAAC,KAAA,CAAA;IACrC,IAAI,CAACN,UAAU,CAACS,MAAM,CAAC,IAAI,CAACR,MAAM,CAAA;AACpC,EAAA;AAEA;EACAS,aAAaA,MAAI;AACf,IAAA,MAAML,QAAA,GAAW,IAAI,CAACN,IAAI,CAACY,aAAa;IACxC,OAAO,IAAIN,QAAA,CAASO,IAAI,CAACC,gBAAgB,CAAC,gCAAA,CAAA,CAAkC,CAACC,GAAG,CAACC,KAAA,IAC/EA,KAAA,CAAMC,SAAS,CAAC,IAAA,CAAA,CAAA;EAEpB,CAAA;AAEA;;;;;EAKAC,WAAA,GAAcC,QAAA,CAAS,CAACC,OAAS,EAAa,CAACC,OAAA,CAA+B,KAAA;IAC5E,IAAI,CAACA,OAAA,EAAS;AACd,IAAA,MAAMC,IAAA,GAAO,IAAI,CAACrB,UAAU;IAC5B,MAAMsB,QAAQ,CAACH,OAAA,CAAQR,aAAa,CAACY,kBAAkB,IAAI,EAAE,EAAEC,MAAM,CACnET,KAAA,IAAS,CAACM,KAAKE,kBAAkB,CAACE,QAAQ,CAACV,KAAA,CAAA,CAAA;AAE7C,IAAA,IAAI,CAACO,KAAA,CAAMI,MAAM,EAAE;IACnB,IAAI;MACFL,IAAA,CAAKE,kBAAkB,GAAG,CAAI,GAAAD,KAAA,EAAU,GAAAD,IAAA,CAAKE,kBAAkB,CAAC;AAClE,IAAA,CAAA,CAAE,MAAM;AACN;AACA,MAAA;AACF,IAAA;AACA,IAAA,OAAO,MAAA;AACLF,MAAAA,IAAA,CAAKE,kBAAkB,GAAGF,IAAA,CAAKE,kBAAkB,CAACC,MAAM,CAACT,KAAA,IAAS,CAACO,KAAA,CAAMG,QAAQ,CAACV,KAAA,CAAA,CAAA;IACpF,CAAA;AACF,EAAA,CAAA,CAAA;AAEA,EAAA;IAAAY,oBAAA,CAAAC,kBAAA,CAAA,uUAAA,EAcA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
package/dist/slider.js ADDED
@@ -0,0 +1,586 @@
1
+ import Component from '@glimmer/component';
2
+ import { hash } from '@ember/helper';
3
+ import { on } from '@ember/modifier';
4
+ import { registerDestructor } from '@ember/destroyable';
5
+ import Modifier, { modifier } from 'ember-modifier';
6
+ import { As } from './as.js';
7
+ import { ControllableState } from './controllable-state.js';
8
+ import { getDirection } from './direction.js';
9
+ import { ignoreROError } from './resize-observer.js';
10
+ import { translate } from './i18n.js';
11
+ import { messages } from './messages.js';
12
+ import { isNumber } from '@sindresorhus/is';
13
+ import { precompileTemplate } from '@ember/template-compilation';
14
+ import { setComponentTemplate } from '@ember/component';
15
+ import templateOnly from '@ember/component/template-only';
16
+
17
+ /**
18
+ * A slider's value: an array, one number per thumb (`[25, 75]` is a range), as Radix's, or a
19
+ * number for one thumb, as ember-primitives' also takes. `@onValueChange` hears the same shape.
20
+ */
21
+ /** Names a thumb (its `aria-label`), given its index and how many thumbs there are. */
22
+ const PAGE_KEYS = ['PageUp', 'PageDown'];
23
+ const ARROW_KEYS = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
24
+ /** The keys that step back, by where the values start: Radix's `BACK_KEYS`. */
25
+ const BACK_KEYS = {
26
+ 'from-left': ['Home', 'PageDown', 'ArrowDown', 'ArrowLeft'],
27
+ 'from-right': ['Home', 'PageDown', 'ArrowDown', 'ArrowRight'],
28
+ 'from-bottom': ['Home', 'PageDown', 'ArrowDown', 'ArrowLeft'],
29
+ 'from-top': ['Home', 'PageDown', 'ArrowUp', 'ArrowLeft']
30
+ };
31
+ function clamp(value, min, max) {
32
+ return Math.min(max, Math.max(min, value));
33
+ }
34
+ function getDecimalCount(value) {
35
+ return (String(value).split('.')[1] ?? '').length;
36
+ }
37
+ function roundValue(value, decimalCount) {
38
+ const rounder = Math.pow(10, decimalCount);
39
+ return Math.round(value * rounder) / rounder;
40
+ }
41
+ /** Where a value sits between `min` and `max`, from 0 to 100. */
42
+ function sliderPercent(value, min, max) {
43
+ if (max === min) return 0;
44
+ return clamp(100 / (max - min) * (value - min), 0, 100);
45
+ }
46
+ /** The values with one replaced, sorted: Radix lets thumbs pass each other. */
47
+ function nextSortedValues(values, value, index) {
48
+ const next = [...values];
49
+ next[index] = value;
50
+ return next.sort((a, b) => a - b);
51
+ }
52
+ function hasMinStepsBetween(values, minSteps) {
53
+ if (minSteps <= 0) return true;
54
+ const gaps = values.slice(0, -1).map((value, index) => values[index + 1] - value);
55
+ return Math.min(...gaps) >= minSteps;
56
+ }
57
+ /** The index of the value nearest `value`; the first of two as near. */
58
+ function closestIndex(values, value) {
59
+ if (values.length <= 1) return 0;
60
+ const distances = values.map(other => Math.abs(other - value));
61
+ return distances.indexOf(Math.min(...distances));
62
+ }
63
+ function linearScale(input, output) {
64
+ return value => {
65
+ if (input[0] === input[1] || output[0] === output[1]) return output[0];
66
+ const ratio = (output[1] - output[0]) / (input[1] - input[0]);
67
+ return output[0] + ratio * (value - input[0]);
68
+ };
69
+ }
70
+ /** The tick values a `@step` array names: finite, unique, sorted; `null` for a number. */
71
+ function ticksOf(step) {
72
+ if (!Array.isArray(step)) return null;
73
+ const ticks = [...new Set(step.filter(value => Number.isFinite(value)))].sort((a, b) => a - b);
74
+ return ticks.length ? ticks : null;
75
+ }
76
+ /**
77
+ * A thumb's default name: `Value` for a slider's only thumb (as ember-primitives'), `Minimum` and
78
+ * `Maximum` for a range, and `Value 2 of 3` past two (as Radix's), in the language of `context`'s
79
+ * translator (English without one). Pass `@getThumbLabel` for other words.
80
+ */
81
+ function defaultSliderThumbLabel(index, count, context) {
82
+ if (count > 2) return translate(context, messages.sliderNthValue, {
83
+ index: index + 1,
84
+ count
85
+ });
86
+ if (count === 2) {
87
+ return translate(context, index === 0 ? messages.sliderMinimum : messages.sliderMaximum);
88
+ }
89
+ return translate(context, messages.sliderValue);
90
+ }
91
+ /** What a slider reads from its arguments. */
92
+
93
+ /** One thumb, as a slider yields it in `thumbs`: stable across changes, so `#each` keeps its DOM. */
94
+
95
+ /**
96
+ * Which edge a part is placed from: the start of the line (`inset-inline-start`, so right to
97
+ * left flips it with no script), its end when inverted, or the bottom (top when inverted).
98
+ */
99
+ const EDGES = ['inset-inline-start', 'inset-inline-end', 'bottom', 'top'];
100
+ /**
101
+ * A slider's state and behaviour, shared by its parts: Radix's slider, kept in Radix's terms.
102
+ * With a `@step` array, it works on the ticks' indexes (`internal` values), evenly spaced, as
103
+ * ember-primitives' does, and reports the ticks themselves.
104
+ */
105
+ class SliderStore {
106
+ #args;
107
+ state;
108
+ #thumbElements = new Map();
109
+ #thumbStates = [];
110
+ /** The value the keys and the pointer move: the thumb focused or pressed last. */
111
+ #indexToChange = 0;
112
+ /** The pointer sliding a thumb, and the values before it started. */
113
+ #sliding;
114
+ constructor(args) {
115
+ this.#args = args;
116
+ this.state = new ControllableState({
117
+ name: 'value',
118
+ value: () => this.#args().value,
119
+ defaultValue: () => this.#args().defaultValue ?? [this.min],
120
+ onChange: () => this.#args().onValueChange,
121
+ fallback: []
122
+ });
123
+ }
124
+ // ----- Settings ---------------------------------------------------------------------------
125
+ /** The step array's values, sorted, or `null` when `@step` is a number. */
126
+ get tickValues() {
127
+ return ticksOf(this.#args().step);
128
+ }
129
+ /** The lowest value: `@min` (default 0), or the first tick. */
130
+ get min() {
131
+ return this.tickValues?.[0] ?? this.#args().min ?? 0;
132
+ }
133
+ /** The highest value: `@max` (default 100), or the last tick. */
134
+ get max() {
135
+ return this.tickValues?.at(-1) ?? this.#args().max ?? 100;
136
+ }
137
+ /** The step: `@step` (default 1); with ticks, 1 (from one tick to the next). */
138
+ get step() {
139
+ const step = this.#args().step;
140
+ return isNumber(step) && step > 0 ? step : 1;
141
+ }
142
+ get orientation() {
143
+ return this.#args().orientation ?? 'horizontal';
144
+ }
145
+ get isDisabled() {
146
+ return this.#args().disabled ?? false;
147
+ }
148
+ get isInverted() {
149
+ return this.#args().inverted ?? false;
150
+ }
151
+ get internalMin() {
152
+ return this.tickValues ? 0 : this.min;
153
+ }
154
+ get internalMax() {
155
+ const ticks = this.tickValues;
156
+ return ticks ? ticks.length - 1 : this.max;
157
+ }
158
+ get internalStep() {
159
+ return this.tickValues ? 1 : this.step;
160
+ }
161
+ // ----- Values -----------------------------------------------------------------------------
162
+ /** The values, one per thumb, as the caller sees them. */
163
+ get values() {
164
+ const value = this.state.value;
165
+ return Array.isArray(value) ? value : [value];
166
+ }
167
+ /** The values on the internal scale: the nearest tick's index, with ticks. */
168
+ get internalValues() {
169
+ const ticks = this.tickValues;
170
+ if (!ticks) return this.values;
171
+ return this.values.map(value => closestIndex(ticks, value));
172
+ }
173
+ /** Each thumb's state, one per value, the same objects every time. */
174
+ get thumbs() {
175
+ const count = this.values.length;
176
+ const states = this.#thumbStates;
177
+ if (states.length > count) states.length = count;
178
+ while (states.length < count) states.push(this.#thumbState(states.length));
179
+ return states;
180
+ }
181
+ #thumbState(index) {
182
+ const value = () => this.values[index] ?? this.min;
183
+ const percent = () => this.percentAt(index);
184
+ return {
185
+ index,
186
+ get value() {
187
+ return value();
188
+ },
189
+ get percent() {
190
+ return percent();
191
+ }
192
+ };
193
+ }
194
+ /** The value at a thumb, or `undefined` past the last. */
195
+ valueAt = index => this.values[index];
196
+ /** Where a thumb sits along the track, from 0 to 100. */
197
+ percentAt = index => {
198
+ const value = this.internalValues[index];
199
+ if (value === undefined) return 0;
200
+ return sliderPercent(value, this.internalMin, this.internalMax);
201
+ };
202
+ /** A thumb's `aria-label`; the default's words are `context`'s translator's. */
203
+ labelAt = (index, context) => {
204
+ const label = this.#args().getThumbLabel;
205
+ const count = this.values.length;
206
+ return label ? label(index, count) : defaultSliderThumbLabel(index, count, context);
207
+ };
208
+ /** Where the range starts and ends along the track, from 0 to 100. */
209
+ get rangeOffsets() {
210
+ const percents = this.internalValues.map(value => sliderPercent(value, this.internalMin, this.internalMax));
211
+ return {
212
+ start: percents.length > 1 ? Math.min(...percents) : 0,
213
+ end: 100 - Math.max(...percents, 0)
214
+ };
215
+ }
216
+ /** The edge the values start from, and the one they end at. */
217
+ get edges() {
218
+ const inverted = this.isInverted;
219
+ if (this.orientation === 'vertical') {
220
+ return inverted ? {
221
+ start: 'top',
222
+ end: 'bottom'
223
+ } : {
224
+ start: 'bottom',
225
+ end: 'top'
226
+ };
227
+ }
228
+ return inverted ? {
229
+ start: 'inset-inline-end',
230
+ end: 'inset-inline-start'
231
+ } : {
232
+ start: 'inset-inline-start',
233
+ end: 'inset-inline-end'
234
+ };
235
+ }
236
+ /** Values on the internal scale, in the caller's terms and shape. */
237
+ #output(internal) {
238
+ const ticks = this.tickValues;
239
+ const values = ticks ? internal.map(index => ticks[clamp(Math.round(index), 0, ticks.length - 1)]) : internal;
240
+ return Array.isArray(this.state.value) ? values : values[0] ?? this.min;
241
+ }
242
+ /**
243
+ * Moves the thumb at `index` to `value` (internal), as Radix's `updateValues`: snapped to the
244
+ * step, kept within bounds and `@minStepsBetweenThumbs` apart, and sorted, so a thumb dragged
245
+ * past another swaps with it. Focus follows the value it moved.
246
+ */
247
+ update(value, index, {
248
+ commit = false
249
+ } = {}) {
250
+ const min = this.internalMin;
251
+ const max = this.internalMax;
252
+ const step = this.internalStep;
253
+ const snapped = roundValue(Math.round((value - min) / step) * step + min, getDecimalCount(step));
254
+ const next = clamp(snapped, min, max);
255
+ const previous = this.internalValues;
256
+ const values = nextSortedValues(previous, next, index);
257
+ const minSteps = (this.#args().minStepsBetweenThumbs ?? 0) * step;
258
+ if (!hasMinStepsBetween(values, minSteps)) return;
259
+ this.#indexToChange = values.indexOf(next);
260
+ if (String(values) === String(previous)) return;
261
+ this.state.set(this.#output(values));
262
+ this.#thumbElements.get(this.#indexToChange)?.focus();
263
+ if (commit) this.#commit(values);
264
+ }
265
+ #commit(internal) {
266
+ const onCommit = this.#args().onValueCommit;
267
+ onCommit?.(this.#output(internal));
268
+ }
269
+ // ----- Thumbs -----------------------------------------------------------------------------
270
+ /** @internal Keeps each thumb's element, to focus it. */
271
+ thumbElement = modifier((element, [index]) => {
272
+ this.#thumbElements.set(index, element);
273
+ return () => {
274
+ if (this.#thumbElements.get(index) === element) this.#thumbElements.delete(index);
275
+ };
276
+ });
277
+ /** @internal A thumb took focus: the keys move it now. */
278
+ focusThumb = index => {
279
+ this.#indexToChange = index;
280
+ };
281
+ #thumbIndexOf(target) {
282
+ if (!(target instanceof Node)) return undefined;
283
+ for (const [index, element] of this.#thumbElements) {
284
+ if (element.contains(target)) return index;
285
+ }
286
+ return undefined;
287
+ }
288
+ // ----- The pointer ------------------------------------------------------------------------
289
+ /** The value under the pointer, from the root's box, as Radix's `getValueFromPointer`. */
290
+ #valueFromPointer(event, root) {
291
+ const sliding = this.#sliding;
292
+ const rect = sliding?.rect ?? root.getBoundingClientRect();
293
+ if (sliding) sliding.rect = rect;
294
+ const min = this.internalMin;
295
+ const max = this.internalMax;
296
+ if (this.orientation === 'vertical') {
297
+ const fromBottom = !this.isInverted;
298
+ const scale = linearScale([0, rect.height], fromBottom ? [max, min] : [min, max]);
299
+ return scale(event.clientY - rect.top);
300
+ }
301
+ const ltr = getDirection(root, this.#args().dir) === 'ltr';
302
+ const fromLeft = ltr !== this.isInverted;
303
+ const scale = linearScale([0, rect.width], fromLeft ? [min, max] : [max, min]);
304
+ return scale(event.clientX - rect.left);
305
+ }
306
+ /** @internal */
307
+ onPointerDown = event => {
308
+ if (this.isDisabled || event.defaultPrevented) return;
309
+ const root = event.currentTarget;
310
+ const target = event.target;
311
+ try {
312
+ target.setPointerCapture(event.pointerId);
313
+ } catch {
314
+ // A pointer the browser doesn't know (a synthetic event) can't be captured.
315
+ }
316
+ event.preventDefault();
317
+ this.#sliding = {
318
+ pointerId: event.pointerId,
319
+ target,
320
+ before: this.internalValues
321
+ };
322
+ const thumb = this.#thumbIndexOf(target);
323
+ if (thumb !== undefined) {
324
+ this.#thumbElements.get(thumb)?.focus();
325
+ return;
326
+ }
327
+ const value = this.#valueFromPointer(event, root);
328
+ this.update(value, closestIndex(this.internalValues, value));
329
+ };
330
+ /** @internal */
331
+ onPointerMove = event => {
332
+ if (this.#sliding?.pointerId !== event.pointerId) return;
333
+ const value = this.#valueFromPointer(event, event.currentTarget);
334
+ this.update(value, this.#indexToChange);
335
+ };
336
+ /** @internal */
337
+ onPointerUp = event => {
338
+ const sliding = this.#sliding;
339
+ if (sliding?.pointerId !== event.pointerId) return;
340
+ this.#sliding = undefined;
341
+ try {
342
+ if (sliding.target.hasPointerCapture(event.pointerId)) {
343
+ sliding.target.releasePointerCapture(event.pointerId);
344
+ }
345
+ } catch {
346
+ // As above: nothing was captured.
347
+ }
348
+ const index = this.#indexToChange;
349
+ const values = this.internalValues;
350
+ if (values[index] !== sliding.before[index]) this.#commit(values);
351
+ };
352
+ // ----- The keys ---------------------------------------------------------------------------
353
+ /** @internal Home, End, the arrows and Page Up and Down, as Radix's slider takes them. */
354
+ onKeyDown = event => {
355
+ if (event.defaultPrevented) return;
356
+ const {
357
+ key
358
+ } = event;
359
+ const disabled = this.isDisabled;
360
+ if (key === 'Home') {
361
+ if (!disabled) this.update(this.internalMin, 0, {
362
+ commit: true
363
+ });
364
+ } else if (key === 'End') {
365
+ if (!disabled) this.update(this.internalMax, this.values.length - 1, {
366
+ commit: true
367
+ });
368
+ } else if (PAGE_KEYS.includes(key) || ARROW_KEYS.includes(key)) {
369
+ if (!disabled) this.#step(event);
370
+ } else {
371
+ return;
372
+ }
373
+ event.preventDefault();
374
+ };
375
+ #step(event) {
376
+ const root = event.currentTarget;
377
+ let from;
378
+ if (this.orientation === 'vertical') {
379
+ from = this.isInverted ? 'from-top' : 'from-bottom';
380
+ } else {
381
+ const ltr = getDirection(root, this.#args().dir) === 'ltr';
382
+ from = ltr !== this.isInverted ? 'from-left' : 'from-right';
383
+ }
384
+ const direction = BACK_KEYS[from].includes(event.key) ? -1 : 1;
385
+ const isSkip = PAGE_KEYS.includes(event.key) || event.shiftKey && ARROW_KEYS.includes(event.key);
386
+ const index = this.#indexToChange;
387
+ const value = this.internalValues[index];
388
+ if (value === undefined) return;
389
+ const step = this.internalStep * (isSkip ? 10 : 1) * direction;
390
+ this.update(value + step, index, {
391
+ commit: true
392
+ });
393
+ }
394
+ }
395
+ // ----- Placing the parts --------------------------------------------------------------------
396
+ /** Sets one edge (and clears the others) through the CSSOM, which a strict CSP allows. */
397
+ function place(element, values) {
398
+ for (const edge of EDGES) {
399
+ const value = values[edge];
400
+ if (value === undefined) element.style.removeProperty(edge);else element.style.setProperty(edge, value);
401
+ }
402
+ }
403
+ /** Stretches the range between its offsets, as Radix's `SliderRange` style does. */const rangePosition = modifier((element, _, {
404
+ start,
405
+ end,
406
+ startEdge,
407
+ endEdge
408
+ }) => {
409
+ place(element, {
410
+ [startEdge]: `${start}%`,
411
+ [endEdge]: `${end}%`
412
+ });
413
+ });
414
+ /**
415
+ * A thumb's length along the track: its layout size (a transformed ancestor, such as a scaled
416
+ * preview, doesn't change it), as the `ResizeObserver` reports it after.
417
+ */
418
+ function measure(element, vertical) {
419
+ return vertical ? element.offsetHeight : element.offsetWidth;
420
+ }
421
+ /**
422
+ * Places a thumb at its value, kept inside the track: its start edge at `percent` of the
423
+ * length, less that share of its own size, so it touches each end at the min and max. That is
424
+ * where Radix's `getThumbInBoundsOffset` puts it, with a logical edge in place of `left` or
425
+ * `right`, so right to left needs no script. The thumb's size is measured, and watched.
426
+ */
427
+ class ThumbPosition extends Modifier {
428
+ #element;
429
+ #size = 0;
430
+ #vertical = false;
431
+ #percent = 0;
432
+ #edge = 'inset-inline-start';
433
+ modify(element, _, {
434
+ percent,
435
+ edge,
436
+ vertical
437
+ }) {
438
+ this.#percent = percent;
439
+ this.#edge = edge;
440
+ this.#vertical = vertical;
441
+ if (!this.#element) {
442
+ this.#element = element;
443
+ element.style.setProperty('position', 'absolute');
444
+ this.#size = measure(element, vertical);
445
+ ignoreROError();
446
+ const observer = new ResizeObserver(([entry]) => {
447
+ const box = entry?.borderBoxSize?.[0];
448
+ if (!box) return;
449
+ const size = this.#vertical ? box.blockSize : box.inlineSize;
450
+ if (size === this.#size) return;
451
+ this.#size = size;
452
+ this.#place();
453
+ });
454
+ observer.observe(element, {
455
+ box: 'border-box'
456
+ });
457
+ registerDestructor(this, () => observer.disconnect());
458
+ } else {
459
+ this.#size = measure(element, vertical);
460
+ }
461
+ this.#place();
462
+ }
463
+ #place() {
464
+ const element = this.#element;
465
+ if (!element) return;
466
+ const offset = this.#percent / 100 * this.#size;
467
+ place(element, {
468
+ [this.#edge]: `calc(${this.#percent}% - ${offset}px)`
469
+ });
470
+ }
471
+ }
472
+ /**
473
+ * Keeps a thumb's hidden form input at its value, and tells the form when it changes with a
474
+ * bubbling `input` event, as Radix's `SliderBubbleInput` does.
475
+ */
476
+ class BubbleValue extends Modifier {
477
+ #value;
478
+ modify(element, _, {
479
+ value
480
+ }) {
481
+ const next = value === undefined ? '' : String(value);
482
+ const previous = this.#value;
483
+ this.#value = next;
484
+ element.value = next;
485
+ if (previous !== undefined && previous !== next) {
486
+ element.dispatchEvent(new Event('input', {
487
+ bubbles: true
488
+ }));
489
+ }
490
+ }
491
+ }
492
+ // ----- The parts ----------------------------------------------------------------------------
493
+
494
+ /** The rail the thumbs move along: Radix's `Slider.Track`. */const SliderTrack = setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"span\" data-orientation={{@store.orientation}} data-disabled={{if @store.isDisabled \"\"}} data-test-jn-part=\"track\" ...attributes>{{yield}}</As>", {
495
+ strictMode: true,
496
+ scope: () => ({
497
+ As
498
+ })
499
+ }), templateOnly());
500
+ /**
501
+ * The filled part of the track: Radix's `Slider.Range`, from the start to the thumb, or
502
+ * between the outermost thumbs. It places itself (position it `absolute` in your CSS).
503
+ */
504
+ const SliderRange = setComponentTemplate(precompileTemplate("{{#let @store.rangeOffsets @store.edges as |offsets edges|}}\n <As @as={{@as}} @tag=\"span\" data-orientation={{@store.orientation}} data-disabled={{if @store.isDisabled \"\"}} data-test-jn-part=\"range\" ...attributes {{rangePosition start=offsets.start end=offsets.end startEdge=edges.start endEdge=edges.end}} />\n{{/let}}", {
505
+ strictMode: true,
506
+ scope: () => ({
507
+ As,
508
+ rangePosition
509
+ })
510
+ }), templateOnly());
511
+ /**
512
+ * A thumb: Radix's `Slider.Thumb`, a `role="slider"` element in the tab order with the value in
513
+ * ARIA, inside a span that places it. With a field name, a hidden input beside it puts the value
514
+ * in its form.
515
+ */
516
+ class SliderThumb extends Component {
517
+ get index() {
518
+ return this.args.index ?? 0;
519
+ }
520
+ get value() {
521
+ return this.args.store.valueAt(this.index);
522
+ }
523
+ get fieldName() {
524
+ const name = this.args.fieldName ?? this.args.sliderFieldName;
525
+ if (!name) return undefined;
526
+ return this.args.fieldName || this.args.store.values.length <= 1 ? name : `${name}[]`;
527
+ }
528
+ onFocus = () => this.args.store.focusThumb(this.index);
529
+ static {
530
+ setComponentTemplate(precompileTemplate("{{#let @store.edges as |edges|}}\n <span {{ThumbPosition percent=(@store.percentAt this.index) edge=edges.start vertical=(isVertical @store.orientation)}}>\n <As @as={{@as}} @tag=\"span\" role=\"slider\" aria-label={{@store.labelAt this.index this}} aria-valuemin={{@store.min}} aria-valuenow={{this.value}} aria-valuemax={{@store.max}} aria-orientation={{@store.orientation}} data-orientation={{@store.orientation}} data-disabled={{if @store.isDisabled \"\"}} tabindex={{if @store.isDisabled undefined \"0\"}} hidden={{isMissing this.value}} data-test-jn-part=\"thumb\" data-test-jn-value=\"{{this.index}}\" ...attributes {{@store.thumbElement this.index}} {{on \"focus\" this.onFocus}}>{{yield}}</As>\n {{#if this.fieldName}}\n <input type=\"hidden\" name={{this.fieldName}} form={{@form}} {{BubbleValue value=this.value}} />\n {{/if}}\n </span>\n{{/let}}", {
531
+ strictMode: true,
532
+ scope: () => ({
533
+ ThumbPosition,
534
+ isVertical,
535
+ As,
536
+ isMissing,
537
+ on,
538
+ BubbleValue
539
+ })
540
+ }), this);
541
+ }
542
+ }
543
+ function isVertical(orientation) {
544
+ return orientation === 'vertical';
545
+ }
546
+ function isMissing(value) {
547
+ return value === undefined;
548
+ }
549
+ /** What `<Slider>` yields. */
550
+
551
+ /**
552
+ * A control for choosing a value, or a range, from within bounds: Radix's `Slider`, headless,
553
+ * which also covers ember-primitives' (range and multiple thumbs, discrete values, vertical).
554
+ * It yields its parts, which you render and style:
555
+ *
556
+ * <Slider @defaultValue={{array 25 75}} @step={{5}} as |s|>
557
+ * <s.Track><s.Range /></s.Track>
558
+ * {{#each s.thumbs as |thumb|}}
559
+ * <s.Thumb @index={{thumb.index}} />
560
+ * {{/each}}
561
+ * </Slider>
562
+ *
563
+ * Each thumb is a `role="slider"` element in the tab order: the arrows step it, Shift with an
564
+ * arrow and Page Up and Down step ten times as far, and Home and End go to the bounds. Pressing
565
+ * the track moves the nearest thumb there, and dragging slides it. The range and the thumbs
566
+ * place themselves with logical edges, so right to left flips them, and the keys follow.
567
+ */
568
+ class Slider extends Component {
569
+ store = new SliderStore(() => this.args);
570
+ static {
571
+ setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"span\" dir={{@dir}} aria-disabled={{if this.store.isDisabled \"true\"}} data-disabled={{if this.store.isDisabled \"\"}} data-orientation={{this.store.orientation}} data-test-jn=\"slider\" data-test-jn-name={{@name}} ...attributes {{on \"pointerdown\" this.store.onPointerDown}} {{on \"pointermove\" this.store.onPointerMove}} {{on \"pointerup\" this.store.onPointerUp}} {{on \"pointercancel\" this.store.onPointerUp}} {{on \"keydown\" this.store.onKeyDown}}>\n {{yield (hash Track=(component SliderTrack store=this.store) Range=(component SliderRange store=this.store) Thumb=(component SliderThumb store=this.store sliderFieldName=@fieldName form=@form) thumbs=this.store.thumbs values=this.store.values tickValues=this.store.tickValues min=this.store.min max=this.store.max step=this.store.internalStep orientation=this.store.orientation isDisabled=this.store.isDisabled)}}\n</As>", {
572
+ strictMode: true,
573
+ scope: () => ({
574
+ As,
575
+ on,
576
+ hash,
577
+ SliderTrack,
578
+ SliderRange,
579
+ SliderThumb
580
+ })
581
+ }), this);
582
+ }
583
+ }
584
+
585
+ export { Slider, SliderRange, SliderStore, SliderThumb, SliderTrack, Slider as default, defaultSliderThumbLabel, sliderPercent };
586
+ //# sourceMappingURL=slider.js.map