@ember-joinery/primitives 0.0.0-stage → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (485) hide show
  1. package/CHANGELOG.md +480 -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 +311 -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,243 @@
1
+ import Component from '@glimmer/component';
2
+ import { tracked } from '@glimmer/tracking';
3
+ import { hash } from '@ember/helper';
4
+ import { registerDestructor, isDestroying, isDestroyed } from '@ember/destroyable';
5
+ import Modifier from 'ember-modifier';
6
+ import { State, Machine, transition, invoke } from '@switchyard-ts/core';
7
+ import { machine } from '@switchyard-ts/ember';
8
+ import { n, g, i } from 'decorator-transforms/runtime';
9
+ import { precompileTemplate } from '@ember/template-compilation';
10
+ import { setComponentTemplate } from '@ember/component';
11
+
12
+ class PresenceState extends State {
13
+ /** `@present` is true: the content renders. */
14
+ static Present = PresenceState.of('present');
15
+ /** `@present` turned false: the content stays while its exit animation runs. */
16
+ static Exiting = PresenceState.of('exiting');
17
+ /** The content is gone. */
18
+ static Exited = PresenceState.of('exited');
19
+ }
20
+
21
+ /** What a presence chart waits on. */
22
+
23
+ /**
24
+ * Radix's `Presence` as a chart: `exit()` keeps the content while its exit animation runs, and
25
+ * `enter()` during the exit keeps it for good, aborting the wait.
26
+ */
27
+ class PresenceChart extends Machine {
28
+ host;
29
+ constructor(host) {
30
+ super();
31
+ this.host = host;
32
+ }
33
+
34
+ /** `@present` turned true. */
35
+ enter() {}
36
+
37
+ /** `@present` turned false, and the render that says so is over. */
38
+ static {
39
+ n(this.prototype, "enter", [transition({
40
+ to: PresenceState.Present
41
+ })]);
42
+ }
43
+ exit() {}
44
+
45
+ /** It starts with `@present` false: nothing to wait for. */
46
+ static {
47
+ n(this.prototype, "exit", [transition({
48
+ from: PresenceState.Present,
49
+ to: PresenceState.Exiting
50
+ })]);
51
+ }
52
+ absent() {}
53
+ static {
54
+ n(this.prototype, "absent", [transition({
55
+ to: PresenceState.Exited
56
+ })]);
57
+ }
58
+ waitForExit(signal) {
59
+ return this.host.waitForExit(signal);
60
+ }
61
+ static {
62
+ n(this.prototype, "waitForExit", [invoke(PresenceState.Exiting, {
63
+ onDone: PresenceState.Exited,
64
+ onError: PresenceState.Exited
65
+ })]);
66
+ }
67
+ }
68
+
69
+ /** A started `PresenceChart`, stopped (its wait aborted) when `owner` is destroyed. */
70
+ function presenceChart(owner, host) {
71
+ return machine(owner, new PresenceChart(host));
72
+ }
73
+
74
+ function animationName(styles) {
75
+ return styles?.animationName || 'none';
76
+ }
77
+ /** Tells a `Presence` which element animates, and runs after each render that changes it. */class PresenceRef extends Modifier {
78
+ #element;
79
+ modify(element, _, {
80
+ presence
81
+ }) {
82
+ if (!this.#element) {
83
+ this.#element = element;
84
+ registerDestructor(this, () => presence.release(element));
85
+ }
86
+ presence.observe(element);
87
+ }
88
+ }
89
+ /**
90
+ * Keeps a part rendered while it animates out, as Radix's `Presence` does. The content renders
91
+ * while `@present` is true. When it turns false, the part's `data-state` becomes `closed` and
92
+ * Presence looks at the element given `ref`: if a new CSS animation started (the part's exit
93
+ * animation, such as `data-[state=closed]:animate-out`), the content stays until it ends, and
94
+ * otherwise it goes at once. Turning `@present` back on during the exit keeps it.
95
+ *
96
+ * <Presence @present={{this.open.value}} as |presence|>
97
+ * <div {{presence.ref}} data-state={{if this.open.value "open" "closed"}}>…</div>
98
+ * </Presence>
99
+ *
100
+ * `ref` can go anywhere among the element's modifiers, before or after the part modifier that
101
+ * sets `data-state`: Presence looks for the animation once the render is over.
102
+ *
103
+ * Tests wait for the exit: `settled()` resolves once the content is gone.
104
+ */
105
+ class Presence extends Component {
106
+ /**
107
+ * Present, exiting or exited. Only read while `@present` is false, so the render that makes
108
+ * it present again may send `enter()`.
109
+ */
110
+ #chart = presenceChart(this, {
111
+ waitForExit: signal => this.#waitForExit(signal)
112
+ });
113
+ /** Whether an element has been given `ref`; without one there is nothing to wait for. */
114
+ static {
115
+ g(this.prototype, "observed", [tracked], function () {
116
+ return false;
117
+ });
118
+ }
119
+ #observed_ = (i(this, "observed"), void 0);
120
+ // An untracked copy of the above, so it can be checked during rendering without being read:
121
+ // Ember forbids changing tracked state that the same render has read.
122
+ #observed = false;
123
+ #element;
124
+ #styles;
125
+ #wasPresent = this.args.present;
126
+ /** The animation running when the content last became present, as Radix tracks it. */
127
+ #previousAnimation = 'none';
128
+ #fillTimer;
129
+ constructor(owner, args) {
130
+ super(owner, args);
131
+ if (!args.present) this.#chart.absent();
132
+ registerDestructor(this, () => clearTimeout(this.#fillTimer));
133
+ }
134
+ get isRendered() {
135
+ if (this.args.forceMount || this.args.present) return true;
136
+ return !this.#chart.matches(PresenceState.Exited) && this.observed;
137
+ }
138
+ /**
139
+ * Whether the content is leaving: not present, and not yet exited. While it is present this
140
+ * reads only `@present`, so the render that makes it present again may send `enter()`.
141
+ */
142
+ get isExiting() {
143
+ if (this.args.present) return false;
144
+ return !this.#chart.matches(PresenceState.Exited) && this.observed;
145
+ }
146
+ /** Called by `ref` after every render that touches the element or `@present`. */
147
+ observe(element) {
148
+ const present = this.args.present;
149
+ if (this.#element !== element) this.#attach(element, present);
150
+ if (present === this.#wasPresent) return;
151
+ this.#wasPresent = present;
152
+ if (present) this.#enter();else this.#exit();
153
+ }
154
+ /** Called when the element given `ref` is removed. */
155
+ release(element) {
156
+ if (this.#element !== element) return;
157
+ element.removeEventListener('animationstart', this.#onAnimationStart);
158
+ this.#element = undefined;
159
+ this.#styles = undefined;
160
+ if (!isDestroying(this) && !isDestroyed(this)) this.#setObserved(false);
161
+ }
162
+ #setObserved(observed) {
163
+ if (this.#observed === observed) return;
164
+ this.#observed = observed;
165
+ this.observed = observed;
166
+ }
167
+ #attach(element, present) {
168
+ if (this.#element) this.#element.removeEventListener('animationstart', this.#onAnimationStart);
169
+ this.#element = element;
170
+ this.#styles = getComputedStyle(element);
171
+ element.addEventListener('animationstart', this.#onAnimationStart);
172
+ if (present) this.#afterRender(() => this.#previousAnimation = animationName(this.#styles));
173
+ // Safe during rendering: while it is present or force-mounted, `isRendered` hasn't read it.
174
+ if (present || this.args.forceMount) this.#setObserved(true);
175
+ }
176
+ #onAnimationStart = event => {
177
+ if (event.target === this.#element) this.#previousAnimation = animationName(this.#styles);
178
+ };
179
+ /**
180
+ * Runs `look` once this render is over, unless `@present` is false by then. `ref` runs
181
+ * among the element's modifiers, in template order, and the part modifier that sets
182
+ * `data-state` (and so starts the animation) may come after it; Radix looks after the commit
183
+ * for the same reason.
184
+ */
185
+ #afterRender(look) {
186
+ queueMicrotask(() => {
187
+ if (this.#wasPresent && !isDestroying(this) && !isDestroyed(this)) look();
188
+ });
189
+ }
190
+ #enter() {
191
+ const element = this.#element;
192
+ if (element?.style.animationFillMode === 'forwards') element.style.animationFillMode = '';
193
+ // Safe during rendering: while it is present, `isRendered` hasn't read the chart.
194
+ this.#chart.enter();
195
+ this.#afterRender(() => this.#previousAnimation = animationName(this.#styles));
196
+ }
197
+ #exit() {
198
+ // The content can't go during this render (it can't change state the render has read), and
199
+ // the exit animation can only be seen once every modifier has run: see `#afterRender`.
200
+ queueMicrotask(() => {
201
+ if (this.#wasPresent || isDestroying(this) || isDestroyed(this)) return;
202
+ if (this.#chart.matches(PresenceState.Present)) this.#chart.exit();
203
+ });
204
+ }
205
+ /** The chart's wait while exiting: aborted when `@present` turns back on. */
206
+ async #waitForExit(signal) {
207
+ const element = this.#element;
208
+ const running = this.#exitAnimations();
209
+ if (!element || !running.length) return;
210
+ await Promise.allSettled(running.map(animation => animation.finished));
211
+ if (signal.aborted) return;
212
+ // Hold the last frame until the content is removed, so it doesn't flash back.
213
+ const style = element.style;
214
+ if (style) {
215
+ style.animationFillMode = 'forwards';
216
+ this.#fillTimer = setTimeout(() => {
217
+ if (style.animationFillMode === 'forwards') style.animationFillMode = '';
218
+ });
219
+ }
220
+ }
221
+ /** The element's exit animations: none when it has none, the same one as before, or is hidden. */
222
+ #exitAnimations() {
223
+ const element = this.#element;
224
+ const styles = this.#styles;
225
+ const current = animationName(styles);
226
+ if (!element || current === 'none' || styles?.display === 'none') return [];
227
+ if (current === this.#previousAnimation) return [];
228
+ const names = current.split(',').map(name => name.trim());
229
+ return element.getAnimations().filter(animation => animation instanceof CSSAnimation && names.includes(animation.animationName));
230
+ }
231
+ static {
232
+ setComponentTemplate(precompileTemplate("{{#if this.isRendered}}\n {{yield (hash ref=(modifier PresenceRef presence=this) isPresent=@present isExiting=this.isExiting)}}\n{{/if}}", {
233
+ strictMode: true,
234
+ scope: () => ({
235
+ hash,
236
+ PresenceRef
237
+ })
238
+ }), this);
239
+ }
240
+ }
241
+
242
+ export { Presence };
243
+ //# sourceMappingURL=presence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presence.js","sources":["../src/-private/presence-chart.ts","../src/presence.gts"],"sourcesContent":["import { invoke, Machine, State, transition } from '@switchyard-ts/core'\nimport { machine } from '@switchyard-ts/ember'\n\nexport class PresenceState extends State {\n declare private readonly brand: never\n /** `@present` is true: the content renders. */\n static Present = PresenceState.of('present')\n /** `@present` turned false: the content stays while its exit animation runs. */\n static Exiting = PresenceState.of('exiting')\n /** The content is gone. */\n static Exited = PresenceState.of('exited')\n}\n\n/** What a presence chart waits on. */\nexport interface PresenceHost {\n /** Waits for the element's exit animations: resolves at once when there are none. */\n waitForExit(signal: AbortSignal): Promise<void>\n}\n\n/**\n * Radix's `Presence` as a chart: `exit()` keeps the content while its exit animation runs, and\n * `enter()` during the exit keeps it for good, aborting the wait.\n */\nexport class PresenceChart extends Machine<PresenceState> {\n readonly host: PresenceHost\n\n constructor(host: PresenceHost) {\n super()\n this.host = host\n }\n\n /** `@present` turned true. */\n @transition({ to: PresenceState.Present })\n enter() {}\n\n /** `@present` turned false, and the render that says so is over. */\n @transition({ from: PresenceState.Present, to: PresenceState.Exiting })\n exit() {}\n\n /** It starts with `@present` false: nothing to wait for. */\n @transition({ to: PresenceState.Exited })\n absent() {}\n\n @invoke(PresenceState.Exiting, { onDone: PresenceState.Exited, onError: PresenceState.Exited })\n waitForExit(signal: AbortSignal): Promise<void> {\n return this.host.waitForExit(signal)\n }\n}\n\n/** A started `PresenceChart`, stopped (its wait aborted) when `owner` is destroyed. */\nexport function presenceChart(owner: object, host: PresenceHost): PresenceChart {\n return machine(owner, new PresenceChart(host))\n}\n","import Component from '@glimmer/component'\nimport { tracked } from '@glimmer/tracking'\nimport { hash } from '@ember/helper'\nimport { isDestroyed, isDestroying, registerDestructor } from '@ember/destroyable'\nimport Modifier from 'ember-modifier'\nimport type Owner from '@ember/owner'\nimport type { WithBoundArgs } from '@glint/template'\nimport { presenceChart, PresenceState } from './-private/presence-chart.ts'\n\nfunction animationName(styles: CSSStyleDeclaration | undefined): string {\n return styles?.animationName || 'none'\n}\n\ninterface PresenceRefSignature {\n Element: Element\n Args: { Named: { presence: Presence } }\n}\n\n/** Tells a `Presence` which element animates, and runs after each render that changes it. */\nclass PresenceRef extends Modifier<PresenceRefSignature> {\n #element: Element | undefined\n\n override modify(element: Element, _: [], { presence }: { presence: Presence }): void {\n if (!this.#element) {\n this.#element = element\n registerDestructor(this, () => presence.release(element))\n }\n presence.observe(element)\n }\n}\n\nexport interface PresenceSignature {\n Args: {\n /** Whether the content should be shown: usually the part's open state. */\n present: boolean\n /** Keep the content rendered even when it isn't present, for animating it yourself. */\n forceMount?: boolean\n }\n Blocks: {\n default: [\n presence: {\n /**\n * Put it on the element whose `data-state` drives the exit animation, so Presence\n * can wait for that animation before removing it.\n */\n ref: WithBoundArgs<typeof PresenceRef, 'presence'>\n /** `@present`: false while the content is on its way out. */\n isPresent: boolean\n /**\n * Whether the content is on its way out: `@present` is false and its exit animation\n * hasn't ended. With `@forceMount`, which keeps the content rendered, it says when to\n * hide it, as Radix's Collapsible does with `hidden`.\n */\n isExiting: boolean\n },\n ]\n }\n}\n\n/**\n * Keeps a part rendered while it animates out, as Radix's `Presence` does. The content renders\n * while `@present` is true. When it turns false, the part's `data-state` becomes `closed` and\n * Presence looks at the element given `ref`: if a new CSS animation started (the part's exit\n * animation, such as `data-[state=closed]:animate-out`), the content stays until it ends, and\n * otherwise it goes at once. Turning `@present` back on during the exit keeps it.\n *\n * <Presence @present={{this.open.value}} as |presence|>\n * <div {{presence.ref}} data-state={{if this.open.value \"open\" \"closed\"}}>…</div>\n * </Presence>\n *\n * `ref` can go anywhere among the element's modifiers, before or after the part modifier that\n * sets `data-state`: Presence looks for the animation once the render is over.\n *\n * Tests wait for the exit: `settled()` resolves once the content is gone.\n */\nexport class Presence extends Component<PresenceSignature> {\n /**\n * Present, exiting or exited. Only read while `@present` is false, so the render that makes\n * it present again may send `enter()`.\n */\n #chart = presenceChart(this, { waitForExit: signal => this.#waitForExit(signal) })\n /** Whether an element has been given `ref`; without one there is nothing to wait for. */\n @tracked private observed = false\n\n // An untracked copy of the above, so it can be checked during rendering without being read:\n // Ember forbids changing tracked state that the same render has read.\n #observed = false\n\n #element: Element | undefined\n #styles: CSSStyleDeclaration | undefined\n #wasPresent: boolean = this.args.present\n /** The animation running when the content last became present, as Radix tracks it. */\n #previousAnimation = 'none'\n #fillTimer: ReturnType<typeof setTimeout> | undefined\n\n constructor(owner: Owner, args: PresenceSignature['Args']) {\n super(owner, args)\n if (!args.present) this.#chart.absent()\n registerDestructor(this, () => clearTimeout(this.#fillTimer))\n }\n\n get isRendered(): boolean {\n if (this.args.forceMount || this.args.present) return true\n return !this.#chart.matches(PresenceState.Exited) && this.observed\n }\n\n /**\n * Whether the content is leaving: not present, and not yet exited. While it is present this\n * reads only `@present`, so the render that makes it present again may send `enter()`.\n */\n get isExiting(): boolean {\n if (this.args.present) return false\n return !this.#chart.matches(PresenceState.Exited) && this.observed\n }\n\n /** Called by `ref` after every render that touches the element or `@present`. */\n observe(element: Element): void {\n const present = this.args.present\n if (this.#element !== element) this.#attach(element, present)\n\n if (present === this.#wasPresent) return\n this.#wasPresent = present\n if (present) this.#enter()\n else this.#exit()\n }\n\n /** Called when the element given `ref` is removed. */\n release(element: Element): void {\n if (this.#element !== element) return\n element.removeEventListener('animationstart', this.#onAnimationStart)\n this.#element = undefined\n this.#styles = undefined\n if (!isDestroying(this) && !isDestroyed(this)) this.#setObserved(false)\n }\n\n #setObserved(observed: boolean): void {\n if (this.#observed === observed) return\n this.#observed = observed\n this.observed = observed\n }\n\n #attach(element: Element, present: boolean): void {\n if (this.#element) this.#element.removeEventListener('animationstart', this.#onAnimationStart)\n this.#element = element\n this.#styles = getComputedStyle(element)\n element.addEventListener('animationstart', this.#onAnimationStart)\n if (present) this.#afterRender(() => (this.#previousAnimation = animationName(this.#styles)))\n // Safe during rendering: while it is present or force-mounted, `isRendered` hasn't read it.\n if (present || this.args.forceMount) this.#setObserved(true)\n }\n\n #onAnimationStart = (event: Event): void => {\n if (event.target === this.#element) this.#previousAnimation = animationName(this.#styles)\n }\n\n /**\n * Runs `look` once this render is over, unless `@present` is false by then. `ref` runs\n * among the element's modifiers, in template order, and the part modifier that sets\n * `data-state` (and so starts the animation) may come after it; Radix looks after the commit\n * for the same reason.\n */\n #afterRender(look: () => void): void {\n queueMicrotask(() => {\n if (this.#wasPresent && !isDestroying(this) && !isDestroyed(this)) look()\n })\n }\n\n #enter(): void {\n const element = this.#element as HTMLElement | undefined\n if (element?.style.animationFillMode === 'forwards') element.style.animationFillMode = ''\n // Safe during rendering: while it is present, `isRendered` hasn't read the chart.\n this.#chart.enter()\n this.#afterRender(() => (this.#previousAnimation = animationName(this.#styles)))\n }\n\n #exit(): void {\n // The content can't go during this render (it can't change state the render has read), and\n // the exit animation can only be seen once every modifier has run: see `#afterRender`.\n queueMicrotask(() => {\n if (this.#wasPresent || isDestroying(this) || isDestroyed(this)) return\n if (this.#chart.matches(PresenceState.Present)) this.#chart.exit()\n })\n }\n\n /** The chart's wait while exiting: aborted when `@present` turns back on. */\n async #waitForExit(signal: AbortSignal): Promise<void> {\n const element = this.#element as HTMLElement | undefined\n const running = this.#exitAnimations()\n if (!element || !running.length) return\n await Promise.allSettled(running.map(animation => animation.finished))\n if (signal.aborted) return\n // Hold the last frame until the content is removed, so it doesn't flash back.\n const style = element.style\n if (style) {\n style.animationFillMode = 'forwards'\n this.#fillTimer = setTimeout(() => {\n if (style.animationFillMode === 'forwards') style.animationFillMode = ''\n })\n }\n }\n\n /** The element's exit animations: none when it has none, the same one as before, or is hidden. */\n #exitAnimations(): Animation[] {\n const element = this.#element\n const styles = this.#styles\n const current = animationName(styles)\n if (!element || current === 'none' || styles?.display === 'none') return []\n if (current === this.#previousAnimation) return []\n\n const names = current.split(',').map(name => name.trim())\n return element\n .getAnimations()\n .filter(\n animation => animation instanceof CSSAnimation && names.includes(animation.animationName),\n )\n }\n\n <template>\n {{#if this.isRendered}}\n {{yield\n (hash ref=(modifier PresenceRef presence=this) isPresent=@present isExiting=this.isExiting)\n }}\n {{/if}}\n </template>\n}\n"],"names":["PresenceState","State","Present","of","Exiting","Exited","PresenceChart","Machine","host","constructor","enter","n","prototype","transition","to","exit","from","absent","waitForExit","signal","invoke","onDone","onError","presenceChart","owner","machine","animationName","styles","PresenceRef","Modifier","modify","element","_","presence","registerDestructor","release","observe","Presence","Component","g","tracked","i","args","present","clearTimeout","isRendered","forceMount","matches","observed","isExiting","removeEventListener","undefined","isDestroying","isDestroyed","#setObserved","#attach","getComputedStyle","addEventListener","event","target","#afterRender","look","queueMicrotask","#enter","style","animationFillMode","#exit","#waitForExit","running","length","Promise","allSettled","map","animation","finished","aborted","setTimeout","#exitAnimations","current","display","names","split","name","trim","getAnimations","filter","CSSAnimation","includes","setComponentTemplate","precompileTemplate","strictMode","scope","hash"],"mappings":";;;;;;;;;;;AAGO,MAAM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AAqBa,YAAA,IAAgBN,KAAA,CAAMO,QAAQ,CAACd,UAAU/C,aAAa,CAAA,CAAA;AAE9F,EAAA;AAEA,EAAA;IAAA8D,oBAAA,CAAAC,kBAAA,CAAA,2IAAA,EAMA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;AAAAhE,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -0,0 +1,106 @@
1
+ import Component from '@glimmer/component';
2
+ import { hash } from '@ember/helper';
3
+ import { isNumber } from '@sindresorhus/is';
4
+ import { precompileTemplate } from '@ember/template-compilation';
5
+ import { setComponentTemplate } from '@ember/component';
6
+ import templateOnly from '@ember/component/template-only';
7
+
8
+ /** Names a value for assistive technology (`aria-valuetext`), as Radix's `getValueLabel`. */
9
+ /** A progress bar's value, resolved from its arguments. */
10
+ const DEFAULT_MAX = 100;
11
+ /** `@max`, when it is a finite number above 0 (Radix's rule), else 100. */
12
+ function maxOf(max) {
13
+ return isNumber(max) && Number.isFinite(max) && max > 0 ? max : DEFAULT_MAX;
14
+ }
15
+ /**
16
+ * The value: `null` (indeterminate) when none is given, as Radix's; otherwise clamped to
17
+ * `[0, max]`, and 0 when it isn't a finite number, as ember-primitives' is.
18
+ */
19
+ function valueOf(value, max) {
20
+ if (value === null || value === undefined) return null;
21
+ if (!isNumber(value) || !Number.isFinite(value) || value < 0) return 0;
22
+ return Math.min(value, max);
23
+ }
24
+ /** Radix's `data-state` for a value and its max. */
25
+ function progressState(value, max) {
26
+ if (value === null || value === undefined) return 'indeterminate';
27
+ return value === max ? 'complete' : 'loading';
28
+ }
29
+ /** The value as a whole percentage, `33%`: Radix's and ember-primitives' default value label. */
30
+ function defaultProgressLabel(value, max) {
31
+ return `${Math.round(value / max * 100)}%`;
32
+ }
33
+ /** What a progress bar renders for a value and a max, as `<Progress>` resolves them. */
34
+ function resolveProgress(value, max) {
35
+ const resolvedMax = maxOf(max);
36
+ const resolved = valueOf(value, resolvedMax);
37
+ const decimal = resolved === null ? 0 : resolved / resolvedMax;
38
+ return {
39
+ value: resolved,
40
+ max: resolvedMax,
41
+ percent: Math.round(decimal * 100 * 100) / 100,
42
+ decimal,
43
+ state: progressState(resolved, resolvedMax)
44
+ };
45
+ }
46
+ /** An attribute's value, or `undefined` to leave it off. */
47
+ function present(value) {
48
+ return value === null ? undefined : value;
49
+ }
50
+ /** `data-percent`, left off with the value while the bar is indeterminate. */
51
+ function percentOf(progress) {
52
+ return progress.value === null ? undefined : progress.percent;
53
+ }
54
+ /**
55
+ * The bar inside a progress bar, as Radix's `Progress.Indicator` and ember-primitives'
56
+ * `Indicator`: a `div` with the progress bar's state, for you to size or move with CSS
57
+ * (`width: {{p.percent}}%`, or a transform, as the styled Progress does).
58
+ */
59
+ const ProgressIndicator = setComponentTemplate(precompileTemplate("<div data-state={{@progress.state}} data-value={{present @progress.value}} data-max={{@progress.max}} data-percent={{percentOf @progress}} data-test-jn-part=\"indicator\" ...attributes>{{yield}}</div>", {
60
+ strictMode: true,
61
+ scope: () => ({
62
+ present,
63
+ percentOf
64
+ })
65
+ }), templateOnly());
66
+ /** What `<Progress>` yields. */
67
+
68
+ /**
69
+ * Shows how far along a task is, as ember-primitives' and Radix's `Progress`: a `div` with the
70
+ * `progressbar` role, its value in ARIA and data attributes, and an `Indicator` to draw. It has
71
+ * no styles; the styled Progress is built on it.
72
+ *
73
+ * <Progress @value={{this.uploaded}} aria-label="Upload" as |p|>
74
+ * <p.Indicator style="width: {{p.percent}}%" />
75
+ * </Progress>
76
+ *
77
+ * Give it a name: `aria-label`, or `aria-labelledby` naming its label (a `<label for>` doesn't
78
+ * name a progress bar).
79
+ */
80
+ class Progress extends Component {
81
+ get progress() {
82
+ return resolveProgress(this.args.value, this.args.max);
83
+ }
84
+ get valueText() {
85
+ const {
86
+ value,
87
+ max
88
+ } = this.progress;
89
+ if (value === null) return undefined;
90
+ return (this.args.getValueLabel ?? defaultProgressLabel)(value, max);
91
+ }
92
+ static {
93
+ setComponentTemplate(precompileTemplate("{{#let this.progress as |progress|}}\n <div role=\"progressbar\" aria-valuemin=\"0\" aria-valuemax={{progress.max}} aria-valuenow={{present progress.value}} aria-valuetext={{this.valueText}} data-state={{progress.state}} data-value={{present progress.value}} data-max={{progress.max}} data-min=\"0\" data-percent={{percentOf progress}} data-test-jn=\"progress\" data-test-jn-name={{@name}} ...attributes>\n {{yield (hash Indicator=(component ProgressIndicator progress=progress) value=progress.value max=progress.max percent=progress.percent decimal=progress.decimal state=progress.state)}}\n </div>\n{{/let}}", {
94
+ strictMode: true,
95
+ scope: () => ({
96
+ present,
97
+ percentOf,
98
+ hash,
99
+ ProgressIndicator
100
+ })
101
+ }), this);
102
+ }
103
+ }
104
+
105
+ export { Progress, ProgressIndicator, Progress as default, defaultProgressLabel, progressState, resolveProgress };
106
+ //# sourceMappingURL=progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress.js","sources":["../src/progress.gts"],"sourcesContent":["import Component from '@glimmer/component'\nimport { hash } from '@ember/helper'\nimport type { TOC } from '@ember/component/template-only'\nimport type { WithBoundArgs } from '@glint/template'\nimport { isNumber } from '@sindresorhus/is'\n\n/**\n * Where a progress bar is, as Radix's `data-state`: `indeterminate` without a value, `complete`\n * at its max, and `loading` in between.\n */\nexport type ProgressState = 'indeterminate' | 'loading' | 'complete'\n\n/** Names a value for assistive technology (`aria-valuetext`), as Radix's `getValueLabel`. */\nexport type ProgressValueLabel = (value: number, max: number) => string\n\n/** A progress bar's value, resolved from its arguments. */\nexport interface ResolvedProgress {\n /** The value, clamped to `[0, max]`, or `null` when it is indeterminate. */\n value: number | null\n /** The max: `@max`, or 100 when that isn't a number above 0. */\n max: number\n /** How far along it is, from 0 to 100, rounded to two places (0 when indeterminate). */\n percent: number\n /** How far along it is, from 0 to 1 (0 when indeterminate). */\n decimal: number\n state: ProgressState\n}\n\nconst DEFAULT_MAX = 100\n\n/** `@max`, when it is a finite number above 0 (Radix's rule), else 100. */\nfunction maxOf(max: number | null | undefined): number {\n return isNumber(max) && Number.isFinite(max) && max > 0 ? max : DEFAULT_MAX\n}\n\n/**\n * The value: `null` (indeterminate) when none is given, as Radix's; otherwise clamped to\n * `[0, max]`, and 0 when it isn't a finite number, as ember-primitives' is.\n */\nfunction valueOf(value: number | null | undefined, max: number): number | null {\n if (value === null || value === undefined) return null\n if (!isNumber(value) || !Number.isFinite(value) || value < 0) return 0\n return Math.min(value, max)\n}\n\n/** Radix's `data-state` for a value and its max. */\nexport function progressState(value: number | null | undefined, max: number): ProgressState {\n if (value === null || value === undefined) return 'indeterminate'\n return value === max ? 'complete' : 'loading'\n}\n\n/** The value as a whole percentage, `33%`: Radix's and ember-primitives' default value label. */\nexport function defaultProgressLabel(value: number, max: number): string {\n return `${Math.round((value / max) * 100)}%`\n}\n\n/** What a progress bar renders for a value and a max, as `<Progress>` resolves them. */\nexport function resolveProgress(\n value: number | null | undefined,\n max: number | null | undefined,\n): ResolvedProgress {\n const resolvedMax = maxOf(max)\n const resolved = valueOf(value, resolvedMax)\n const decimal = resolved === null ? 0 : resolved / resolvedMax\n return {\n value: resolved,\n max: resolvedMax,\n percent: Math.round(decimal * 100 * 100) / 100,\n decimal,\n state: progressState(resolved, resolvedMax),\n }\n}\n\n/** An attribute's value, or `undefined` to leave it off. */\nfunction present(value: number | null): number | undefined {\n return value === null ? undefined : value\n}\n\n/** `data-percent`, left off with the value while the bar is indeterminate. */\nfunction percentOf(progress: ResolvedProgress): number | undefined {\n return progress.value === null ? undefined : progress.percent\n}\n\nexport interface ProgressIndicatorSignature {\n Args: {\n /** Set by `<Progress>`. */\n progress: ResolvedProgress\n }\n Blocks: { default: [] }\n Element: HTMLDivElement\n}\n\n/**\n * The bar inside a progress bar, as Radix's `Progress.Indicator` and ember-primitives'\n * `Indicator`: a `div` with the progress bar's state, for you to size or move with CSS\n * (`width: {{p.percent}}%`, or a transform, as the styled Progress does).\n */\nexport const ProgressIndicator: TOC<ProgressIndicatorSignature> = <template>\n <div\n data-state={{@progress.state}}\n data-value={{present @progress.value}}\n data-max={{@progress.max}}\n data-percent={{percentOf @progress}}\n data-test-jn-part=\"indicator\"\n ...attributes\n >{{yield}}</div>\n</template>\n\n/** What `<Progress>` yields. */\nexport interface ProgressYield {\n /** The bar, with the progress bar's state on it. */\n Indicator: WithBoundArgs<typeof ProgressIndicator, 'progress'>\n /** The value, clamped to `[0, max]`, or `null` while it is indeterminate. */\n value: number | null\n /** The max. */\n max: number\n /** How far along it is, from 0 to 100, rounded to two places. */\n percent: number\n /** How far along it is, from 0 to 1. */\n decimal: number\n state: ProgressState\n}\n\nexport interface ProgressSignature {\n Args: {\n /**\n * How far along it is, from 0 to `@max`. A value outside that range is clamped into it;\n * leave it out (or pass `null`) while there's no telling, and the bar is indeterminate.\n */\n value?: number | null\n /** The value it completes at. Default 100. */\n max?: number\n /**\n * Names the value for assistive technology (`aria-valuetext`). Default the whole\n * percentage, `33%`.\n */\n getValueLabel?: ProgressValueLabel\n /** Its name, for its harness (`data-test-jn-name`). */\n name?: string\n }\n Blocks: { default: [ProgressYield] }\n Element: HTMLDivElement\n}\n\n/**\n * Shows how far along a task is, as ember-primitives' and Radix's `Progress`: a `div` with the\n * `progressbar` role, its value in ARIA and data attributes, and an `Indicator` to draw. It has\n * no styles; the styled Progress is built on it.\n *\n * <Progress @value={{this.uploaded}} aria-label=\"Upload\" as |p|>\n * <p.Indicator style=\"width: {{p.percent}}%\" />\n * </Progress>\n *\n * Give it a name: `aria-label`, or `aria-labelledby` naming its label (a `<label for>` doesn't\n * name a progress bar).\n */\nexport class Progress extends Component<ProgressSignature> {\n get progress(): ResolvedProgress {\n return resolveProgress(this.args.value, this.args.max)\n }\n\n get valueText(): string | undefined {\n const { value, max } = this.progress\n if (value === null) return undefined\n return (this.args.getValueLabel ?? defaultProgressLabel)(value, max)\n }\n\n <template>\n {{#let this.progress as |progress|}}\n <div\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax={{progress.max}}\n aria-valuenow={{present progress.value}}\n aria-valuetext={{this.valueText}}\n data-state={{progress.state}}\n data-value={{present progress.value}}\n data-max={{progress.max}}\n data-min=\"0\"\n data-percent={{percentOf progress}}\n data-test-jn=\"progress\"\n data-test-jn-name={{@name}}\n ...attributes\n >\n {{yield\n (hash\n Indicator=(component ProgressIndicator progress=progress)\n value=progress.value\n max=progress.max\n percent=progress.percent\n decimal=progress.decimal\n state=progress.state\n )\n }}\n </div>\n {{/let}}\n </template>\n}\n\nexport default Progress\n"],"names":["DEFAULT_MAX","maxOf","max","isNumber","Number","isFinite","valueOf","value","undefined","Math","min","progressState","defaultProgressLabel","round","resolveProgress","resolvedMax","resolved","decimal","percent","state","present","percentOf","progress","ProgressIndicator","setComponentTemplate","precompileTemplate","strictMode","scope","templateOnly","Progress","Component","args","valueText","getValueLabel","hash"],"mappings":";;;;;;;AAYA;AAGA;AAaA,MAAMA,WAAA,GAAc,GAAA;AAEpB;AACA,SAASC,KAAAA,CAAMC,GAA8B,EAAS;AACpD,EAAA,OAAOC,QAAA,CAASD,QAAQE,MAAA,CAAOC,QAAQ,CAACH,GAAA,CAAA,IAAQA,GAAA,GAAM,IAAIA,GAAA,GAAMF,WAAA;AAClE;AAEA;;;AAGC;AACD,SAASM,OAAAA,CAAQC,KAAgC,EAAEL,GAAW,EAAgB;EAC5E,IAAIK,KAAA,KAAU,IAAA,IAAQA,KAAA,KAAUC,SAAA,EAAW,OAAO,IAAA;AAClD,EAAA,IAAI,CAACL,QAAA,CAASI,KAAA,CAAA,IAAU,CAACH,MAAA,CAAOC,QAAQ,CAACE,KAAA,CAAA,IAAUA,KAAA,GAAQ,CAAA,EAAG,OAAO,CAAA;AACrE,EAAA,OAAOE,IAAA,CAAKC,GAAG,CAACH,KAAA,EAAOL,GAAA,CAAA;AACzB;AAEA;AACO,SAASS,aAAAA,CAAcJ,KAAgC,EAAEL,GAAW,EAAG;EAC5E,IAAIK,KAAA,KAAU,IAAA,IAAQA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AoCA;;;;;;;;;;;;AAYO,MAAMC,QAAA,SAAiBC,SAAA,CAAU;EACtC,IAAIR,WAA6B;AAC/B,IAAA,OAAOR,eAAA,CAAgB,IAAI,CAACiB,IAAI,CAACxB,KAAK,EAAE,IAAI,CAACwB,IAAI,CAAC7B,GAAG,CAAA;AACvD,EAAA;EAEA,IAAI8B,SAAAA,GAAgC;IAClC,MAAM;MAAEzB,KAAK;AAAEL,MAAAA;KAAK,GAAG,IAAI,CAACoB,QAAQ;AACpC,IAAA,IAAIf,KAAA,KAAU,MAAM,OAAOC,SAAA;AAC3B,IAAA,OAAO,CAAC,IAAI,CAACuB,IAAI,CAACE,aAAa,IAAIrB,oBAAoB,EAAEL,KAAA,EAAOL,GAAA,CAAA;AAClE,EAAA;AAEA,EAAA;IAAAsB,oBAAA,CAAAC,kBAAA,CAAA,wmBAAA,EA6BA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAP,OAAA;QAAAC,SAAA;QAAAa,IAAA;AAAAX,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -0,0 +1,91 @@
1
+ import { tracked } from '@glimmer/tracking';
2
+ import { waitForPromise } from '@ember/test-waiters';
3
+ import { isFunction, isObject } from '@sindresorhus/is';
4
+ import { g, i } from 'decorator-transforms/runtime';
5
+
6
+ const REASON_FUNCTION_EXCEPTION = 'Passed function threw an exception';
7
+ const REASON_PROMISE_REJECTION = 'Promise rejected while waiting to resolve';
8
+ function isThenable(value) {
9
+ return isObject(value) && !isFunction(value) && isFunction(value.then);
10
+ }
11
+
12
+ /**
13
+ * Tracks a value, a promise, or a function returning either: `isLoading` while a promise is
14
+ * pending, then `resolved` or `error`. A function is called once, here; a value that isn't a
15
+ * promise is resolved at once, so nothing renders a loading state for it. Tests wait for the
16
+ * promise (it is registered with `@ember/test-waiters`).
17
+ *
18
+ * `transform` turns what the promise resolves with into the value (an import's module into its
19
+ * default export, a class into its instance).
20
+ */
21
+ class PromiseState {
22
+ static {
23
+ g(this.prototype, "isLoading", [tracked], function () {
24
+ return false;
25
+ });
26
+ }
27
+ #isLoading = (i(this, "isLoading"), void 0);
28
+ static {
29
+ g(this.prototype, "error", [tracked], function () {
30
+ return null;
31
+ });
32
+ }
33
+ #error = (i(this, "error"), void 0);
34
+ static {
35
+ g(this.prototype, "resolved", [tracked], function () {
36
+ return undefined;
37
+ });
38
+ }
39
+ #resolved = (i(this, "resolved"), void 0);
40
+ constructor(input, transform = value => value) {
41
+ let value;
42
+ try {
43
+ value = isFunction(input) ? input() : input;
44
+ } catch (original) {
45
+ this.error = {
46
+ reason: REASON_FUNCTION_EXCEPTION,
47
+ original
48
+ };
49
+ return;
50
+ }
51
+ if (!isThenable(value)) {
52
+ this.#settle(value, transform);
53
+ return;
54
+ }
55
+ this.isLoading = true;
56
+ void waitForPromise(Promise.resolve(value).then(result => {
57
+ this.#settle(result, transform);
58
+ this.isLoading = false;
59
+ }, original => {
60
+ this.error = {
61
+ reason: REASON_PROMISE_REJECTION,
62
+ original
63
+ };
64
+ this.isLoading = false;
65
+ }));
66
+ }
67
+ #settle(value, transform) {
68
+ try {
69
+ this.resolved = transform(value);
70
+ } catch (original) {
71
+ this.error = {
72
+ reason: REASON_FUNCTION_EXCEPTION,
73
+ original
74
+ };
75
+ }
76
+ }
77
+ }
78
+
79
+ /**
80
+ * The default export of an `import()`ed module, or the value itself. A module namespace is the
81
+ * only kind of object treated as a module.
82
+ */
83
+ function unwrapModule(value) {
84
+ if (isObject(value) && !isFunction(value) && value[Symbol.toStringTag] === 'Module' && 'default' in value) {
85
+ return value.default;
86
+ }
87
+ return value;
88
+ }
89
+
90
+ export { PromiseState as P, unwrapModule as u };
91
+ //# sourceMappingURL=promise-state-BMi2zVoT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promise-state-BMi2zVoT.js","sources":["../src/-private/promise-state.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking'\nimport { waitForPromise } from '@ember/test-waiters'\nimport { isFunction, isObject } from '@sindresorhus/is'\n\n/** Why a load failed, and what was thrown. reactiveweb's `getPromiseState` error, as is. */\nexport interface LoadError {\n /** Which step failed: the function threw, or its promise rejected. */\n reason: string\n /** What was thrown, or what the promise rejected with. */\n original: unknown\n}\n\n/** The reactive state of a value that may still be on its way. */\nexport interface LoadState<T> {\n /** `true` until the promise settles. */\n readonly isLoading: boolean\n /** Why it failed, once it has; otherwise `null`. */\n readonly error: LoadError | null\n /** The value, once there is one. */\n readonly resolved: T | undefined\n}\n\nexport const REASON_FUNCTION_EXCEPTION = 'Passed function threw an exception'\nexport const REASON_PROMISE_REJECTION = 'Promise rejected while waiting to resolve'\n\nexport type LoadInput<T> = T | Promise<T> | (() => T | Promise<T>)\n\nfunction isThenable(value: unknown): value is PromiseLike<unknown> {\n return isObject(value) && !isFunction(value) && isFunction((value as { then?: unknown }).then)\n}\n\n/**\n * Tracks a value, a promise, or a function returning either: `isLoading` while a promise is\n * pending, then `resolved` or `error`. A function is called once, here; a value that isn't a\n * promise is resolved at once, so nothing renders a loading state for it. Tests wait for the\n * promise (it is registered with `@ember/test-waiters`).\n *\n * `transform` turns what the promise resolves with into the value (an import's module into its\n * default export, a class into its instance).\n */\nexport class PromiseState<T> implements LoadState<T> {\n @tracked isLoading = false\n @tracked error: LoadError | null = null\n @tracked resolved: T | undefined = undefined\n\n constructor(input: LoadInput<unknown>, transform: (value: unknown) => T = value => value as T) {\n let value: unknown\n try {\n value = isFunction(input) ? (input as () => unknown)() : input\n } catch (original) {\n this.error = { reason: REASON_FUNCTION_EXCEPTION, original }\n return\n }\n if (!isThenable(value)) {\n this.#settle(value, transform)\n return\n }\n this.isLoading = true\n void waitForPromise(\n Promise.resolve(value).then(\n result => {\n this.#settle(result, transform)\n this.isLoading = false\n },\n (original: unknown) => {\n this.error = { reason: REASON_PROMISE_REJECTION, original }\n this.isLoading = false\n },\n ),\n )\n }\n\n #settle(value: unknown, transform: (value: unknown) => T): void {\n try {\n this.resolved = transform(value)\n } catch (original) {\n this.error = { reason: REASON_FUNCTION_EXCEPTION, original }\n }\n }\n}\n\n/**\n * The default export of an `import()`ed module, or the value itself. A module namespace is the\n * only kind of object treated as a module.\n */\nexport function unwrapModule(value: unknown): unknown {\n if (\n isObject(value) &&\n !isFunction(value) &&\n (value as { [Symbol.toStringTag]?: unknown })[Symbol.toStringTag] === 'Module' &&\n 'default' in value\n ) {\n return (value as { default: unknown }).default\n }\n return value\n}\n"],"names":["REASON_FUNCTION_EXCEPTION","REASON_PROMISE_REJECTION","isThenable","value","isObject","isFunction","then","PromiseState","g","prototype","tracked","i","undefined","constructor","input","transform","original","error","reason","isLoading","waitForPromise","Promise","resolve","result","#settle","resolved","unwrapModule","Symbol","toStringTag","default"],"mappings":";;;;;AAsBO,MAAMA,yBAAyB,GAAG,oCAAoC;AACtE,MAAMC,wBAAwB,GAAG,2CAA2C;AAInF,SAASC,UAAUA,CAACC,KAAc,EAAiC;AACjE,EAAA,OAAOC,QAAQ,CAACD,KAAK,CAAC,IAAI,CAACE,UAAU,CAACF,KAAK,CAAC,IAAIE,UAAU,CAAEF,KAAK,CAAwBG,IAAI,CAAC;AAChG;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,CAA4B;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,WAAA,EAAA,CAClDC,OAAO,CAAA,EAAA,YAAA;AAAA,MAAA,OAAa,KAAK;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,UAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,WAAA,CAAA,EAAA,MAAA;AAAA,EAAA;IAAAH,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,OAAA,EAAA,CACzBC,OAAO,CAAA,EAAA,YAAA;AAAA,MAAA,OAA2B,IAAI;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,MAAA,IAAAC,CAAA,CAAA,IAAA,EA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,MAAA,IAAI,CAACU,QAAQ,GAAGV,SAAS,CAACZ,KAAK,CAAC;IAClC,CAAC,CAAC,OAAOa,QAAQ,EAAE;MACjB,IAAI,CAACC,KAAK,GAAG;AAAEC,QAAAA,MAAM,EAAElB,yBAAyB;AAAEgB,QAAAA;OAAU;AAC9D,IAAA;AACF,EAAA;AACF;;AAEA;AACA;AACA;AACA;AACO,SAASU,YAAYA,CAACvB,KAAc,EAAW;EACpD,IACEC,QAAQ,CAACD,KAAK,CAAC,IACf,CAACE,UAAU,CAACF,KAAK,CAAC,IACjBA,KAAK,CAAwCwB,MAAM,CAACC,WAAW,CAAC,KAAK,QAAQ,IAC9E,SAAS,IAAIzB,KAAK,EAClB;IACA,OAAQA,KAAK,CAA0B0B,OAAO;AAChD,EAAA;AACA,EAAA,OAAO1B,KAAK;AACd;;"}
@@ -0,0 +1,136 @@
1
+ import { registerDestructor } from '@ember/destroyable';
2
+ import { f as findOwner } from './store-BjiAd-KP.js';
3
+ import { isFunction } from '@sindresorhus/is';
4
+
5
+ /** Paths a plain link leaves to the browser: a string or a RegExp, matched against the path. */
6
+
7
+ /**
8
+ * The `<a>` a click was in, if any: the clicked element may be a `<span>` or an `<svg>` inside
9
+ * the link. Reads the event's composed path, so it finds the link even when the click removed
10
+ * it (a menu item that closes its menu) or it sits in a shadow root.
11
+ */
12
+ function getAnchor(event) {
13
+ for (const target of event.composedPath()) {
14
+ const name = target.nodeName;
15
+ if (!name) return undefined;
16
+ if (name.toUpperCase() === 'A') return target;
17
+ }
18
+ return undefined;
19
+ }
20
+
21
+ /**
22
+ * Whether the app's router should take a click on `anchor` (`true`), or leave it to the browser
23
+ * (`false`). The browser keeps a link with a `target`, `rel="external"` or `download`; a click
24
+ * that isn't a plain left click (a middle click, or with Cmd, Ctrl, Shift or Alt); a click
25
+ * another handler has already handled; a link to another origin; a link to a heading on the
26
+ * current page; and a path in `ignore`.
27
+ *
28
+ * It is should-handle-link's `shouldHandle`, which ember-primitives' `properLinks` uses.
29
+ *
30
+ * @param href the page's URL now (`location.href`)
31
+ */
32
+ function shouldHandle(href, anchor, event, ignore = []) {
33
+ if (!anchor?.href) return false;
34
+ if (anchor.target) return false;
35
+ if (anchor.rel === 'external') return false;
36
+ if (anchor.hasAttribute('download')) return false;
37
+ if (event.button !== 0) return false;
38
+ if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return false;
39
+ if (event.defaultPrevented) return false;
40
+ const url = new URL(anchor.href);
41
+ const here = new URL(href);
42
+ if (url.origin !== here.origin) return false;
43
+
44
+ // A jump to a heading on this page is the browser's; going from /page#part to /page is not,
45
+ // since the browser would reload the page for it.
46
+ const [path, hash] = url.href.split('#');
47
+ if (hash !== undefined && path === here.href.split('#')[0]) return false;
48
+ if (ignore.some(pattern => url.pathname.match(pattern))) return false;
49
+ return true;
50
+ }
51
+
52
+ /**
53
+ * Turns a click on `anchor` into a router transition when the router should take it (see
54
+ * `shouldHandle`) and the URL is one of the app's routes, under its `rootURL`. Returns whether
55
+ * it did; when it did, the click's default (a page load) is prevented.
56
+ */
57
+ function handleLink(router, anchor, event, ignore = []) {
58
+ if (!shouldHandle(location.href, anchor, event, ignore)) return false;
59
+ const url = new URL(anchor.href);
60
+ const fullPath = `${url.pathname}${url.search}${url.hash}`;
61
+ const rootURL = router.rootURL ?? '/';
62
+ const root = rootURL.endsWith('/') ? rootURL : `${rootURL}/`;
63
+ // A path outside the app (served from the same origin by something else) is the browser's.
64
+ if (fullPath !== root.slice(0, -1) && !fullPath.startsWith(root)) return false;
65
+ const appPath = fullPath.slice(root.length);
66
+ let routed;
67
+ try {
68
+ routed = router.recognize(`${root}${appPath}`);
69
+ } catch (error) {
70
+ if (error instanceof Error && error.name === 'UnrecognizedURLError') return false;
71
+ throw error;
72
+ }
73
+ if (!routed) return false;
74
+ event.preventDefault();
75
+ void router.transitionTo(`/${appPath}`);
76
+ return true;
77
+ }
78
+
79
+ /**
80
+ * Makes plain `<a href>` links in the app transitions instead of page loads, until `context`
81
+ * is destroyed: a click on a link to one of the app's routes goes through the router. Links
82
+ * the browser should keep (see `shouldHandle`) still do what the browser does.
83
+ *
84
+ * For the whole app, decorate the router with `properLinks`. This is the same without a
85
+ * decorator, for anything with an owner (the application route, or a test's owner):
86
+ *
87
+ * setupProperLinks(this.owner)
88
+ *
89
+ * @param context anything with an owner, or the owner; its destruction removes the listener
90
+ */
91
+ function setupProperLinks(context, options = {}) {
92
+ const ignore = options.ignore ?? [];
93
+ const handler = event => {
94
+ const anchor = getAnchor(event);
95
+ if (!anchor) return;
96
+ const owner = findOwner(context);
97
+ if (!owner) throw new Error('Joinery: setupProperLinks() found no owner to route with');
98
+ handleLink(owner.lookup('service:router'), anchor, event, ignore);
99
+ };
100
+ document.body.addEventListener('click', handler);
101
+ registerDestructor(context, () => document.body.removeEventListener('click', handler));
102
+ }
103
+ function withProperLinks(Base, options) {
104
+ class RouterWithProperLinks extends Base {
105
+ constructor(...args) {
106
+ super(...args);
107
+ setupProperLinks(this, options);
108
+ }
109
+ }
110
+ return RouterWithProperLinks;
111
+ }
112
+
113
+ /**
114
+ * Lets the app use plain `<a href>` links: decorate the router with it, and a click on a link
115
+ * to one of the app's routes becomes a transition, with no `<LinkTo>` needed.
116
+ *
117
+ * import EmberRouter from '@embroider/router'
118
+ * import { properLinks } from '@ember-joinery/primitives/proper-links'
119
+ *
120
+ * @properLinks
121
+ * export default class Router extends EmberRouter { … }
122
+ *
123
+ * // or, with paths the router should leave to the server:
124
+ * @properLinks({ ignore: ['/legacy'] })
125
+ *
126
+ * Without decorators, call it: `export default properLinks(class Router extends EmberRouter {…})`.
127
+ * It is ember-primitives' `properLinks`.
128
+ */
129
+
130
+ function properLinks(baseOrOptions) {
131
+ if (isFunction(baseOrOptions)) return withProperLinks(baseOrOptions, {});
132
+ return Base => withProperLinks(Base, baseOrOptions);
133
+ }
134
+
135
+ export { getAnchor, handleLink, properLinks, setupProperLinks, shouldHandle };
136
+ //# sourceMappingURL=proper-links.js.map