@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
package/dist/focus.js ADDED
@@ -0,0 +1,307 @@
1
+ import Modifier from 'ember-modifier';
2
+ import { registerDestructor } from '@ember/destroyable';
3
+
4
+ /*
5
+ * Finding and moving focus: what ember-primitives' components get from tabster, without tabster
6
+ * or any setup. ember-primitives asks an app to call `setupTabster()` before its keyboard support
7
+ * works; Joinery's components work as soon as they render. What tabster did for them:
8
+ *
9
+ * - its Mover (arrow keys between items) is `@ember-joinery/primitives/roving-focus`;
10
+ * - its Modalizer and focus trapping are `@ember-joinery/primitives/focus-scope`;
11
+ * - its Deloser (focus that doesn't fall to `<body>` when the focused element goes) is
12
+ * `restoreFocus`, below;
13
+ * - its `focusable.findFirst()` and friends are `focusable`, below.
14
+ */
15
+
16
+ /** Where `focusable` looks, and what it counts. */
17
+
18
+ /** A `FocusableQuery` that starts from an element, for `findNext` and `findPrev`. */
19
+
20
+ /**
21
+ * Whether nothing inside `element`, itself included, can take focus: it is inert, hidden, not
22
+ * displayed, or inside a closed `<details>` (all but its summary).
23
+ */
24
+ function hidesSubtree(element, styles) {
25
+ if (element.hasAttribute('inert')) return true;
26
+ if (element instanceof HTMLElement && element.hidden) return true;
27
+ if (styles.display === 'none') return true;
28
+ const parent = element.parentElement;
29
+ if (parent instanceof HTMLDetailsElement && !parent.open) {
30
+ return element !== parent.querySelector(':scope > summary');
31
+ }
32
+ return false;
33
+ }
34
+
35
+ /** Whether `element` itself can take focus, given that nothing above it hides it. */
36
+ function isCandidate(element, styles, programmatic) {
37
+ if (!(element instanceof HTMLElement)) return false;
38
+ // :disabled also covers the controls in a disabled <fieldset>, whose own `disabled` is false.
39
+ if (element.matches(':disabled')) return false;
40
+ if (element instanceof HTMLInputElement && element.type === 'hidden') return false;
41
+ if (styles.visibility === 'hidden') return false;
42
+ // A link without an href reports a tabIndex of 0, but takes no focus unless given a tabindex.
43
+ const hasTabindex = element.hasAttribute('tabindex');
44
+ if (element instanceof HTMLAnchorElement && !element.hasAttribute('href') && !hasTabindex) {
45
+ return false;
46
+ }
47
+ if (element.tabIndex >= 0) return true;
48
+ return programmatic && hasTabindex;
49
+ }
50
+
51
+ /**
52
+ * The focusable elements in `container`, in document order. An element counts when it is
53
+ * enabled, displayed, visible and not inert, and either the Tab key reaches it (`tabIndex` of 0
54
+ * or more) or, with `includeProgrammaticallyFocusable`, it has a `tabindex` of its own. Positive
55
+ * tabindexes don't reorder the list, as in Radix and tabster.
56
+ */
57
+ function findAll(query) {
58
+ const {
59
+ container,
60
+ accept
61
+ } = query;
62
+ const programmatic = query.includeProgrammaticallyFocusable ?? false;
63
+ const found = [];
64
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
65
+ acceptNode(node) {
66
+ const element = node;
67
+ const styles = getComputedStyle(element);
68
+ if (hidesSubtree(element, styles)) return NodeFilter.FILTER_REJECT;
69
+ if (!isCandidate(element, styles, programmatic)) return NodeFilter.FILTER_SKIP;
70
+ return accept && !accept(element) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
71
+ }
72
+ });
73
+ while (walker.nextNode()) found.push(walker.currentNode);
74
+ return found;
75
+ }
76
+ function precedes(a, b) {
77
+ return Boolean(a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING);
78
+ }
79
+
80
+ /**
81
+ * Finds focusable elements, as tabster's `focusable` API does for ember-primitives. Hidden,
82
+ * disabled and inert elements are skipped, by the same rules everywhere Joinery moves focus.
83
+ *
84
+ * focusable.findFirst({ container: this.element })
85
+ * focusable.findNext({ container: list, currentElement: option, includeProgrammaticallyFocusable: true })
86
+ */
87
+ const focusable = {
88
+ /** Every focusable element in the container, in document order. */
89
+ findAll,
90
+ /** The first focusable element in the container. */
91
+ findFirst(query) {
92
+ return findAll(query)[0];
93
+ },
94
+ /** The last focusable element in the container. */
95
+ findLast(query) {
96
+ return findAll(query).at(-1);
97
+ },
98
+ /** The first focusable element after `currentElement`, in document order. It doesn't wrap. */
99
+ findNext(query) {
100
+ const current = query.currentElement;
101
+ return findAll(query).find(element => element !== current && !element.contains(current) && precedes(current, element));
102
+ },
103
+ /** The last focusable element before `currentElement`, in document order. It doesn't wrap. */
104
+ findPrev(query) {
105
+ const current = query.currentElement;
106
+ return findAll(query).reverse().find(element => element !== current && precedes(element, current));
107
+ },
108
+ /**
109
+ * Whether an element can take focus now, by the same rules: it is connected, and neither it
110
+ * nor anything above it hides it. Elements with `tabindex="-1"` count unless
111
+ * `includeProgrammaticallyFocusable` is `false`.
112
+ */
113
+ isFocusable(element, options = {}) {
114
+ if (!element.isConnected) return false;
115
+ const styles = getComputedStyle(element);
116
+ if (!isCandidate(element, styles, options.includeProgrammaticallyFocusable ?? true)) {
117
+ return false;
118
+ }
119
+ for (let node = element; node; node = node.parentElement) {
120
+ if (hidesSubtree(node, node === element ? styles : getComputedStyle(node))) return false;
121
+ }
122
+ return true;
123
+ }
124
+ };
125
+
126
+ /** How `focusElement` and `focusFirst` focus. */
127
+
128
+ /**
129
+ * Focuses an element, if it's there and can take focus, selecting an input's text with
130
+ * `select`. Returns whether focus is on it afterwards.
131
+ */
132
+ function focusElement(element, {
133
+ select = false,
134
+ preventScroll = false
135
+ } = {}) {
136
+ if (!(element instanceof HTMLElement || element instanceof SVGElement)) return false;
137
+ const previous = document.activeElement;
138
+ element.focus({
139
+ preventScroll
140
+ });
141
+ if (element !== previous && select && element instanceof HTMLInputElement) element.select();
142
+ return document.activeElement === element;
143
+ }
144
+
145
+ /**
146
+ * Focuses the first of `candidates` that takes focus, as Radix's `focusFirst` does: each is
147
+ * tried in turn until focus moves. It stops at the element that already has focus, so a list of
148
+ * "the items after this one" never moves focus past where it started. Returns whether focus
149
+ * moved.
150
+ */
151
+ function focusFirst(candidates, options = {}) {
152
+ const previous = document.activeElement;
153
+ for (const candidate of candidates) {
154
+ if (!candidate) continue;
155
+ if (candidate === previous) return false;
156
+ focusElement(candidate, options);
157
+ if (document.activeElement !== previous) return true;
158
+ }
159
+ return false;
160
+ }
161
+
162
+ // ----- restoreFocus: tabster's Deloser -----------------------------------------------------------
163
+
164
+ const HISTORY_LENGTH = 10;
165
+
166
+ /** The elements focused most recently anywhere on the page, newest first, while anyone asks. */
167
+ let history = [];
168
+ let listening = 0;
169
+ function unshift(list, element) {
170
+ return [new WeakRef(element), ...list.filter(ref => ref.deref() !== element)].slice(0, HISTORY_LENGTH);
171
+ }
172
+ function remember(event) {
173
+ if (event.target instanceof HTMLElement) history = unshift(history, event.target);
174
+ }
175
+ function listen() {
176
+ if (listening++ === 0) document.addEventListener('focusin', remember, true);
177
+ return () => {
178
+ if (--listening > 0) return;
179
+ document.removeEventListener('focusin', remember, true);
180
+ history = [];
181
+ };
182
+ }
183
+
184
+ /** Whether focus has fallen to `<body>`: nothing is focused. */
185
+ function focusIsLost() {
186
+ const active = document.activeElement;
187
+ return !active || active === document.body || active === document.documentElement;
188
+ }
189
+ /**
190
+ * Keeps focus from falling to `<body>` when the focused element inside this one is removed, as
191
+ * tabster's Deloser does for ember-primitives' Tabs and Menu. Focus moves to, in order:
192
+ *
193
+ * 1. `preferred`, when it is inside and can take focus (tabster's default element);
194
+ * 2. the element focused most recently inside it that is still there and can take focus;
195
+ * 3. its first focusable element (or itself, if it can take focus);
196
+ * 4. and when this element itself is removed with focus inside, the element focused most
197
+ * recently outside it, such as the trigger that opened a menu.
198
+ *
199
+ * <ul {{restoreFocus}}>
200
+ * {{#each this.items as |item|}}
201
+ * <li><button type="button" {{on "click" (fn this.remove item)}}>Remove {{item}}</button></li>
202
+ * {{/each}}
203
+ * </ul>
204
+ *
205
+ * It acts only when the focused element was removed, so focus a user moves elsewhere (to
206
+ * `<body>`, by clicking the page) stays there.
207
+ */
208
+ class restoreFocus extends Modifier {
209
+ #onRestore;
210
+ #preferred;
211
+ #installed = false;
212
+ /** What was focused inside, newest first. */
213
+ #inside = [];
214
+ /** The element inside that has focus, as last seen, or `undefined` once focus moved out. */
215
+ #focused;
216
+ /** What had focus outside when this element appeared. */
217
+ #before;
218
+ modify(element, _, named) {
219
+ this.#onRestore = named.onRestore;
220
+ this.#preferred = named.preferred;
221
+ if (this.#installed) return;
222
+ this.#installed = true;
223
+ const active = document.activeElement;
224
+ if (active instanceof HTMLElement) {
225
+ if (element.contains(active)) this.#focused = active;else if (!focusIsLost()) this.#before = active;
226
+ }
227
+ const unlisten = listen();
228
+ const onFocusIn = event => {
229
+ if (!(event.target instanceof HTMLElement)) return;
230
+ this.#focused = event.target;
231
+ this.#inside = unshift(this.#inside, event.target);
232
+ };
233
+ const onFocusOut = event => {
234
+ const next = event.relatedTarget;
235
+ const target = event.target;
236
+ if (next instanceof Node && element.contains(next)) return;
237
+ if (next !== null) {
238
+ this.#focused = undefined;
239
+ return;
240
+ }
241
+ // Focus went nowhere: blurred, or its element removed. If it's still there, it was blurred.
242
+ queueMicrotask(() => {
243
+ if (this.#focused === target && target instanceof Node && target.isConnected) {
244
+ this.#focused = undefined;
245
+ }
246
+ });
247
+ };
248
+ element.addEventListener('focusin', onFocusIn);
249
+ element.addEventListener('focusout', onFocusOut);
250
+ const observer = new MutationObserver(() => {
251
+ if (!this.#lostInside(element)) return;
252
+ this.#focused = undefined;
253
+ this.#restore(this.#findInside(element));
254
+ });
255
+ observer.observe(element, {
256
+ childList: true,
257
+ subtree: true
258
+ });
259
+ registerDestructor(this, () => {
260
+ observer.disconnect();
261
+ element.removeEventListener('focusin', onFocusIn);
262
+ element.removeEventListener('focusout', onFocusOut);
263
+ const focused = this.#focused;
264
+ const outside = [...history.map(ref => ref.deref()), this.#before].filter(candidate => !!candidate && !element.contains(candidate));
265
+ unlisten();
266
+ // The element is on its way out. Once it's gone, if focus went with it, find focus a place.
267
+ queueMicrotask(() => {
268
+ if (!focused || element.isConnected || focused.isConnected || !focusIsLost()) return;
269
+ this.#restore(outside.find(candidate => focusable.isFocusable(candidate)));
270
+ });
271
+ });
272
+ }
273
+
274
+ /** Whether the element that had focus inside has been removed, and focus fell to `<body>`. */
275
+ #lostInside(element) {
276
+ const focused = this.#focused;
277
+ if (!focused || !focusIsLost()) return false;
278
+ return !focused.isConnected || !element.contains(focused);
279
+ }
280
+
281
+ /** Where focus goes when the focused element inside is removed. */
282
+ #findInside(element) {
283
+ const preferred = this.#preferred;
284
+ if (preferred && element.contains(preferred) && focusable.isFocusable(preferred)) {
285
+ return preferred;
286
+ }
287
+ for (const ref of this.#inside) {
288
+ const candidate = ref.deref();
289
+ if (candidate && element.contains(candidate) && focusable.isFocusable(candidate)) {
290
+ return candidate;
291
+ }
292
+ }
293
+ return focusable.findFirst({
294
+ container: element
295
+ }) ?? (focusable.isFocusable(element) ? element : undefined);
296
+ }
297
+ #restore(next) {
298
+ if (!next) return;
299
+ if (this.#onRestore?.(next) === false) return;
300
+ focusElement(next, {
301
+ preventScroll: true
302
+ });
303
+ }
304
+ }
305
+
306
+ export { focusElement, focusFirst, focusable, restoreFocus };
307
+ //# sourceMappingURL=focus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus.js","sources":["../src/focus.ts"],"sourcesContent":["import Modifier from 'ember-modifier'\nimport { registerDestructor } from '@ember/destroyable'\n\n/*\n * Finding and moving focus: what ember-primitives' components get from tabster, without tabster\n * or any setup. ember-primitives asks an app to call `setupTabster()` before its keyboard support\n * works; Joinery's components work as soon as they render. What tabster did for them:\n *\n * - its Mover (arrow keys between items) is `@ember-joinery/primitives/roving-focus`;\n * - its Modalizer and focus trapping are `@ember-joinery/primitives/focus-scope`;\n * - its Deloser (focus that doesn't fall to `<body>` when the focused element goes) is\n * `restoreFocus`, below;\n * - its `focusable.findFirst()` and friends are `focusable`, below.\n */\n\n/** Where `focusable` looks, and what it counts. */\nexport interface FocusableQuery {\n /** The element to look in. The container itself is never one of the results. */\n container: Element\n /**\n * Also count elements only script can focus, with `tabindex=\"-1\"` (menu items, listbox\n * options), as tabster's `includeProgrammaticallyFocusable`. Default: only those the Tab key\n * reaches.\n */\n includeProgrammaticallyFocusable?: boolean\n /** Count only the elements this accepts. */\n accept?: (element: HTMLElement) => boolean\n}\n\n/** A `FocusableQuery` that starts from an element, for `findNext` and `findPrev`. */\nexport interface FocusableQueryFrom extends FocusableQuery {\n /** The element to start from. It needn't be focusable itself. */\n currentElement: Element\n}\n\n/**\n * Whether nothing inside `element`, itself included, can take focus: it is inert, hidden, not\n * displayed, or inside a closed `<details>` (all but its summary).\n */\nfunction hidesSubtree(element: Element, styles: CSSStyleDeclaration): boolean {\n if (element.hasAttribute('inert')) return true\n if (element instanceof HTMLElement && element.hidden) return true\n if (styles.display === 'none') return true\n const parent = element.parentElement\n if (parent instanceof HTMLDetailsElement && !parent.open) {\n return element !== parent.querySelector(':scope > summary')\n }\n return false\n}\n\n/** Whether `element` itself can take focus, given that nothing above it hides it. */\nfunction isCandidate(\n element: Element,\n styles: CSSStyleDeclaration,\n programmatic: boolean,\n): element is HTMLElement {\n if (!(element instanceof HTMLElement)) return false\n // :disabled also covers the controls in a disabled <fieldset>, whose own `disabled` is false.\n if (element.matches(':disabled')) return false\n if (element instanceof HTMLInputElement && element.type === 'hidden') return false\n if (styles.visibility === 'hidden') return false\n // A link without an href reports a tabIndex of 0, but takes no focus unless given a tabindex.\n const hasTabindex = element.hasAttribute('tabindex')\n if (element instanceof HTMLAnchorElement && !element.hasAttribute('href') && !hasTabindex) {\n return false\n }\n if (element.tabIndex >= 0) return true\n return programmatic && hasTabindex\n}\n\n/**\n * The focusable elements in `container`, in document order. An element counts when it is\n * enabled, displayed, visible and not inert, and either the Tab key reaches it (`tabIndex` of 0\n * or more) or, with `includeProgrammaticallyFocusable`, it has a `tabindex` of its own. Positive\n * tabindexes don't reorder the list, as in Radix and tabster.\n */\nfunction findAll(query: FocusableQuery): HTMLElement[] {\n const { container, accept } = query\n const programmatic = query.includeProgrammaticallyFocusable ?? false\n const found: HTMLElement[] = []\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode(node) {\n const element = node as Element\n const styles = getComputedStyle(element)\n if (hidesSubtree(element, styles)) return NodeFilter.FILTER_REJECT\n if (!isCandidate(element, styles, programmatic)) return NodeFilter.FILTER_SKIP\n return accept && !accept(element) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT\n },\n })\n while (walker.nextNode()) found.push(walker.currentNode as HTMLElement)\n return found\n}\n\nfunction precedes(a: Node, b: Node): boolean {\n return Boolean(a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING)\n}\n\n/**\n * Finds focusable elements, as tabster's `focusable` API does for ember-primitives. Hidden,\n * disabled and inert elements are skipped, by the same rules everywhere Joinery moves focus.\n *\n * focusable.findFirst({ container: this.element })\n * focusable.findNext({ container: list, currentElement: option, includeProgrammaticallyFocusable: true })\n */\nexport const focusable = {\n /** Every focusable element in the container, in document order. */\n findAll,\n\n /** The first focusable element in the container. */\n findFirst(query: FocusableQuery): HTMLElement | undefined {\n return findAll(query)[0]\n },\n\n /** The last focusable element in the container. */\n findLast(query: FocusableQuery): HTMLElement | undefined {\n return findAll(query).at(-1)\n },\n\n /** The first focusable element after `currentElement`, in document order. It doesn't wrap. */\n findNext(query: FocusableQueryFrom): HTMLElement | undefined {\n const current = query.currentElement\n return findAll(query).find(\n element => element !== current && !element.contains(current) && precedes(current, element),\n )\n },\n\n /** The last focusable element before `currentElement`, in document order. It doesn't wrap. */\n findPrev(query: FocusableQueryFrom): HTMLElement | undefined {\n const current = query.currentElement\n return findAll(query)\n .reverse()\n .find(element => element !== current && precedes(element, current))\n },\n\n /**\n * Whether an element can take focus now, by the same rules: it is connected, and neither it\n * nor anything above it hides it. Elements with `tabindex=\"-1\"` count unless\n * `includeProgrammaticallyFocusable` is `false`.\n */\n isFocusable(element: Element, options: { includeProgrammaticallyFocusable?: boolean } = {}) {\n if (!element.isConnected) return false\n const styles = getComputedStyle(element)\n if (!isCandidate(element, styles, options.includeProgrammaticallyFocusable ?? true)) {\n return false\n }\n for (let node: Element | null = element; node; node = node.parentElement) {\n if (hidesSubtree(node, node === element ? styles : getComputedStyle(node))) return false\n }\n return true\n },\n}\n\n/** How `focusElement` and `focusFirst` focus. */\nexport interface FocusOptions {\n /** Select the text of an input it focuses, as Radix does when a focus scope moves focus. */\n select?: boolean\n /** Don't scroll the element into view. */\n preventScroll?: boolean\n}\n\n/**\n * Focuses an element, if it's there and can take focus, selecting an input's text with\n * `select`. Returns whether focus is on it afterwards.\n */\nexport function focusElement(\n element: Element | null | undefined,\n { select = false, preventScroll = false }: FocusOptions = {},\n): boolean {\n if (!(element instanceof HTMLElement || element instanceof SVGElement)) return false\n const previous = document.activeElement\n element.focus({ preventScroll })\n if (element !== previous && select && element instanceof HTMLInputElement) element.select()\n return document.activeElement === element\n}\n\n/**\n * Focuses the first of `candidates` that takes focus, as Radix's `focusFirst` does: each is\n * tried in turn until focus moves. It stops at the element that already has focus, so a list of\n * \"the items after this one\" never moves focus past where it started. Returns whether focus\n * moved.\n */\nexport function focusFirst(\n candidates: Iterable<Element | null | undefined>,\n options: FocusOptions = {},\n): boolean {\n const previous = document.activeElement\n for (const candidate of candidates) {\n if (!candidate) continue\n if (candidate === previous) return false\n focusElement(candidate, options)\n if (document.activeElement !== previous) return true\n }\n return false\n}\n\n// ----- restoreFocus: tabster's Deloser -----------------------------------------------------------\n\nconst HISTORY_LENGTH = 10\n\n/** The elements focused most recently anywhere on the page, newest first, while anyone asks. */\nlet history: WeakRef<HTMLElement>[] = []\nlet listening = 0\n\nfunction unshift(list: WeakRef<HTMLElement>[], element: HTMLElement): WeakRef<HTMLElement>[] {\n return [new WeakRef(element), ...list.filter(ref => ref.deref() !== element)].slice(\n 0,\n HISTORY_LENGTH,\n )\n}\n\nfunction remember(event: FocusEvent): void {\n if (event.target instanceof HTMLElement) history = unshift(history, event.target)\n}\n\nfunction listen(): () => void {\n if (listening++ === 0) document.addEventListener('focusin', remember, true)\n return () => {\n if (--listening > 0) return\n document.removeEventListener('focusin', remember, true)\n history = []\n }\n}\n\n/** Whether focus has fallen to `<body>`: nothing is focused. */\nfunction focusIsLost(): boolean {\n const active = document.activeElement\n return !active || active === document.body || active === document.documentElement\n}\n\ninterface RestoreFocusSignature {\n Element: HTMLElement\n Args: {\n Named: {\n /**\n * The element to move focus to first, when it is inside and can take focus: the selected\n * tab, say. tabster calls it the default.\n */\n preferred?: HTMLElement | null\n /**\n * Called with the element focus is about to move to. Return `false` to leave focus where\n * it fell and handle it yourself, as with tabster's `DeloserFocusLostEvent`.\n */\n onRestore?: (next: HTMLElement) => boolean | void\n }\n }\n}\n\n/**\n * Keeps focus from falling to `<body>` when the focused element inside this one is removed, as\n * tabster's Deloser does for ember-primitives' Tabs and Menu. Focus moves to, in order:\n *\n * 1. `preferred`, when it is inside and can take focus (tabster's default element);\n * 2. the element focused most recently inside it that is still there and can take focus;\n * 3. its first focusable element (or itself, if it can take focus);\n * 4. and when this element itself is removed with focus inside, the element focused most\n * recently outside it, such as the trigger that opened a menu.\n *\n * <ul {{restoreFocus}}>\n * {{#each this.items as |item|}}\n * <li><button type=\"button\" {{on \"click\" (fn this.remove item)}}>Remove {{item}}</button></li>\n * {{/each}}\n * </ul>\n *\n * It acts only when the focused element was removed, so focus a user moves elsewhere (to\n * `<body>`, by clicking the page) stays there.\n */\nexport class restoreFocus extends Modifier<RestoreFocusSignature> {\n #onRestore: ((next: HTMLElement) => boolean | void) | undefined\n #preferred: HTMLElement | null | undefined\n #installed = false\n /** What was focused inside, newest first. */\n #inside: WeakRef<HTMLElement>[] = []\n /** The element inside that has focus, as last seen, or `undefined` once focus moved out. */\n #focused: HTMLElement | undefined\n /** What had focus outside when this element appeared. */\n #before: HTMLElement | undefined\n\n override modify(element: HTMLElement, _: [], named: RestoreFocusSignature['Args']['Named']) {\n this.#onRestore = named.onRestore\n this.#preferred = named.preferred\n if (this.#installed) return\n this.#installed = true\n\n const active = document.activeElement\n if (active instanceof HTMLElement) {\n if (element.contains(active)) this.#focused = active\n else if (!focusIsLost()) this.#before = active\n }\n\n const unlisten = listen()\n const onFocusIn = (event: FocusEvent) => {\n if (!(event.target instanceof HTMLElement)) return\n this.#focused = event.target\n this.#inside = unshift(this.#inside, event.target)\n }\n const onFocusOut = (event: FocusEvent) => {\n const next = event.relatedTarget\n const target = event.target\n if (next instanceof Node && element.contains(next)) return\n if (next !== null) {\n this.#focused = undefined\n return\n }\n // Focus went nowhere: blurred, or its element removed. If it's still there, it was blurred.\n queueMicrotask(() => {\n if (this.#focused === target && target instanceof Node && target.isConnected) {\n this.#focused = undefined\n }\n })\n }\n element.addEventListener('focusin', onFocusIn)\n element.addEventListener('focusout', onFocusOut)\n\n const observer = new MutationObserver(() => {\n if (!this.#lostInside(element)) return\n this.#focused = undefined\n this.#restore(this.#findInside(element))\n })\n observer.observe(element, { childList: true, subtree: true })\n\n registerDestructor(this, () => {\n observer.disconnect()\n element.removeEventListener('focusin', onFocusIn)\n element.removeEventListener('focusout', onFocusOut)\n const focused = this.#focused\n const outside = [...history.map(ref => ref.deref()), this.#before].filter(\n (candidate): candidate is HTMLElement => !!candidate && !element.contains(candidate),\n )\n unlisten()\n // The element is on its way out. Once it's gone, if focus went with it, find focus a place.\n queueMicrotask(() => {\n if (!focused || element.isConnected || focused.isConnected || !focusIsLost()) return\n this.#restore(outside.find(candidate => focusable.isFocusable(candidate)))\n })\n })\n }\n\n /** Whether the element that had focus inside has been removed, and focus fell to `<body>`. */\n #lostInside(element: HTMLElement): boolean {\n const focused = this.#focused\n if (!focused || !focusIsLost()) return false\n return !focused.isConnected || !element.contains(focused)\n }\n\n /** Where focus goes when the focused element inside is removed. */\n #findInside(element: HTMLElement): HTMLElement | undefined {\n const preferred = this.#preferred\n if (preferred && element.contains(preferred) && focusable.isFocusable(preferred)) {\n return preferred\n }\n for (const ref of this.#inside) {\n const candidate = ref.deref()\n if (candidate && element.contains(candidate) && focusable.isFocusable(candidate)) {\n return candidate\n }\n }\n return (\n focusable.findFirst({ container: element }) ??\n (focusable.isFocusable(element) ? element : undefined)\n )\n }\n\n #restore(next: HTMLElement | undefined): void {\n if (!next) return\n if (this.#onRestore?.(next) === false) return\n focusElement(next, { preventScroll: true })\n }\n}\n"],"names":["hidesSubtree","element","styles","hasAttribute","HTMLElement","hidden","display","parent","parentElement","HTMLDetailsElement","open","querySelector","isCandidate","programmatic","matches","HTMLInputElement","type","visibility","hasTabindex","HTMLAnchorElement","tabIndex","findAll","query","container","accept","includeProgrammaticallyFocusable","found","walker","document","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","getComputedStyle","FILTER_REJECT","FILTER_SKIP","FILTER_ACCEPT","nextNode","push","currentNode","precedes","a","b","Boolean","compareDocumentPosition","Node","DOCUMENT_POSITION_FOLLOWING","focusable","findFirst","findLast","at","findNext","current","currentElement","find","contains","findPrev","reverse","isFocusable","options","isConnected","focusElement","select","preventScroll","SVGElement","previous","activeElement","focus","focusFirst","candidates","candidate","HISTORY_LENGTH","history","listening","unshift","list","WeakRef","filter","ref","deref","slice","remember","event","target","listen","addEventListener","removeEventListener","focusIsLost","active","body","documentElement","restoreFocus","Modifier","modify","_","named","onRestore","preferred","unlisten","onFocusIn","onFocusOut","next","relatedTarget","undefined","queueMicrotask","observer","MutationObserver","observe","childList","subtree","registerDestructor","disconnect","focused","outside","map","#lostInside","#findInside","#restore"],"mappings":";;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAcA;;AAMA;AACA;AACA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AIvB,SAAS,CAACW,WAAW,CAACY,SAAS,CAAC,EAAE;AAChF,QAAA,OAAOA,SAAS;AAClB,MAAA;AACF,IAAA;IACA,OACEvB,SAAS,CAACC,SAAS,CAAC;AAAE1B,MAAAA,SAAS,EAAEtB;AAAQ,KAAC,CAAC,KAC1C+C,SAAS,CAACW,WAAW,CAAC1D,OAAO,CAAC,GAAGA,OAAO,GAAGuG,SAAS,CAAC;AAE1D,EAAA;EAEA,QAAQc,CAAChB,IAA6B,EAAQ;IAC5C,IAAI,CAACA,IAAI,EAAE;IACX,IAAI,IAAI,CAAC,UAAU,GAAGA,IAAI,CAAC,KAAK,KAAK,EAAE;IACvCxC,YAAY,CAACwC,IAAI,EAAE;AAAEtC,MAAAA,aAAa,EAAE;AAAK,KAAC,CAAC;AAC7C,EAAA;AACF;;"}
@@ -0,0 +1,177 @@
1
+ import { tracked } from '@glimmer/tracking';
2
+ import { registerDestructor } from '@ember/destroyable';
3
+ import { waitForPromise } from '@ember/test-waiters';
4
+ import Modifier from 'ember-modifier';
5
+ import { g, i } from 'decorator-transforms/runtime';
6
+
7
+ const MIRRORED = ['name', 'value', 'form'];
8
+
9
+ /** The form an element belongs to: its `form` attribute's, else the nearest `<form>`. */
10
+ function formOf(element) {
11
+ const owner = element.form;
12
+ if (owner instanceof HTMLFormElement) return owner;
13
+ const id = element.getAttribute('form');
14
+ if (id) {
15
+ const named = element.ownerDocument.getElementById(id);
16
+ return named instanceof HTMLFormElement ? named : null;
17
+ }
18
+ return element.closest('form');
19
+ }
20
+
21
+ /** Enter doesn't check a checkbox or choose a radio: only Space does, as natively. */
22
+ function preventEnter(event) {
23
+ if (event.key === 'Enter') event.preventDefault();
24
+ }
25
+ /**
26
+ * A control's ties to its form, as Radix's Checkbox, Switch and RadioGroup keep them. Radix's
27
+ * controls are buttons, which a form doesn't submit, so in a form each renders a hidden native
28
+ * input beside it (Radix's "bubble input"): the form submits that, checks it when it is
29
+ * `required`, and resets it. This keeps what that input needs:
30
+ *
31
+ * - whether the control is in a form at all (its `form` attribute's, or the nearest `<form>`),
32
+ * so the input renders only there;
33
+ * - the `name`, `value` and `form` attributes the caller put on the control (or on a radio
34
+ * group's root), which the input repeats, and follows when they change.
35
+ *
36
+ * It reads them after the control renders, since a render can't change what it has read.
37
+ */
38
+ class FormControl {
39
+ static {
40
+ g(this.prototype, "isFormControl", [tracked], function () {
41
+ return false;
42
+ });
43
+ }
44
+ #isFormControl = (i(this, "isFormControl"), void 0);
45
+ /** Whether the control is in a form, so its hidden input should render. */
46
+ static {
47
+ g(this.prototype, "name", [tracked], function () {
48
+ return null;
49
+ });
50
+ }
51
+ #name = (i(this, "name"), void 0);
52
+ /** The caller's `name`, the form field the input submits. */
53
+ static {
54
+ g(this.prototype, "value", [tracked], function () {
55
+ return null;
56
+ });
57
+ }
58
+ #value = (i(this, "value"), void 0);
59
+ /** The caller's `value`, what the input submits when checked. */
60
+ static {
61
+ g(this.prototype, "form", [tracked], function () {
62
+ return null;
63
+ });
64
+ }
65
+ #form = (i(this, "form"), void 0);
66
+ /** The caller's `form`, the id of the form the control belongs to from outside it. */
67
+ /** The name the hidden input submits under: the `name` option's, else the `name` attribute's. */
68
+ get fieldName() {
69
+ return this.#options.name?.() ?? this.name;
70
+ }
71
+
72
+ /** Put it on the element whose `name`, `value` and `form` the hidden input repeats. */
73
+ source;
74
+ #options;
75
+ #element;
76
+ #formElement = null;
77
+ constructor(options = {}) {
78
+ this.#options = options;
79
+ this.source = sourceModifier(this);
80
+ }
81
+
82
+ /** @internal Starts reading `element`; returns what stops it. */
83
+ connect(element) {
84
+ this.#element = element;
85
+ const observer = new MutationObserver(() => this.#sync());
86
+ observer.observe(element, {
87
+ attributes: true,
88
+ attributeFilter: [...MIRRORED]
89
+ });
90
+ void waitForPromise(Promise.resolve().then(() => this.#sync()));
91
+ return () => {
92
+ observer.disconnect();
93
+ this.#listen(null);
94
+ if (this.#element === element) this.#element = undefined;
95
+ };
96
+ }
97
+ #sync() {
98
+ const element = this.#element;
99
+ if (!element) return;
100
+ for (const name of MIRRORED) {
101
+ const value = element.getAttribute(name);
102
+ if (this[name] !== value) this[name] = value;
103
+ }
104
+ const form = formOf(element);
105
+ this.#listen(form);
106
+ if (this.isFormControl !== Boolean(form)) this.isFormControl = Boolean(form);
107
+ }
108
+ #listen(form) {
109
+ if (this.#formElement === form) return;
110
+ this.#formElement?.removeEventListener('reset', this.#onReset);
111
+ this.#formElement = form;
112
+ form?.addEventListener('reset', this.#onReset);
113
+ }
114
+ #onReset = () => this.#options.onReset?.();
115
+ }
116
+ function sourceModifier(control) {
117
+ return class FormControlSource extends Modifier {
118
+ #installed = false;
119
+ modify(element) {
120
+ if (this.#installed) return;
121
+ this.#installed = true;
122
+ registerDestructor(this, control.connect(element));
123
+ }
124
+ };
125
+ }
126
+ /**
127
+ * Keeps the hidden input in step with its control, as Radix's bubble input does: it lies over
128
+ * the control (so the browser's "please check this box" points at it), unseen and out of the
129
+ * way of the pointer, checked when the control is, and it fires `input` and `change` at the
130
+ * form whenever that changes, as a native input would. Its styles go through the CSSOM, so a
131
+ * strict Content Security Policy allows them.
132
+ */
133
+ class BubbleInput extends Modifier {
134
+ #last;
135
+ modify(input, _, {
136
+ checked,
137
+ indeterminate = false,
138
+ announceUncheck = true
139
+ }) {
140
+ const last = this.#last;
141
+ if (input.indeterminate !== indeterminate) input.indeterminate = indeterminate;
142
+ if (input.checked !== checked) input.checked = checked;
143
+ this.#last = {
144
+ checked,
145
+ indeterminate
146
+ };
147
+ if (!last) return this.#place(input, checked);
148
+ if (last.checked === checked && last.indeterminate === indeterminate) return;
149
+ if (!checked && !announceUncheck) return;
150
+ input.dispatchEvent(new Event('input', {
151
+ bubbles: true
152
+ }));
153
+ input.dispatchEvent(new Event('change', {
154
+ bubbles: true
155
+ }));
156
+ }
157
+ #place(input, checked) {
158
+ // What a form reset goes back to.
159
+ input.defaultChecked = checked;
160
+ const control = input.previousElementSibling;
161
+ const box = control?.getBoundingClientRect();
162
+ const style = input.style;
163
+ style.setProperty('position', 'absolute');
164
+ style.setProperty('pointer-events', 'none');
165
+ style.setProperty('opacity', '0');
166
+ style.setProperty('margin', '0');
167
+ // It comes after the control, so this pulls it back over the control.
168
+ style.setProperty('transform', 'translateX(-100%)');
169
+ if (box) {
170
+ style.setProperty('width', `${box.width}px`);
171
+ style.setProperty('height', `${box.height}px`);
172
+ }
173
+ }
174
+ }
175
+
176
+ export { BubbleInput as B, FormControl as F, preventEnter as p };
177
+ //# sourceMappingURL=form-control-Ca_KHSKK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-control-Ca_KHSKK.js","sources":["../src/-private/form-control.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking'\nimport { registerDestructor } from '@ember/destroyable'\nimport { waitForPromise } from '@ember/test-waiters'\nimport Modifier from 'ember-modifier'\n\n/** The attributes of a control (or a radio group's root) that its hidden input repeats. */\nconst MIRRORED = ['name', 'value', 'form'] as const\n\n/** The form an element belongs to: its `form` attribute's, else the nearest `<form>`. */\nfunction formOf(element: HTMLElement): HTMLFormElement | null {\n const owner = (element as Partial<HTMLButtonElement>).form\n if (owner instanceof HTMLFormElement) return owner\n const id = element.getAttribute('form')\n if (id) {\n const named = element.ownerDocument.getElementById(id)\n return named instanceof HTMLFormElement ? named : null\n }\n return element.closest('form')\n}\n\n/** Enter doesn't check a checkbox or choose a radio: only Space does, as natively. */\nexport function preventEnter(event: KeyboardEvent): void {\n if (event.key === 'Enter') event.preventDefault()\n}\n\nexport interface FormControlOptions {\n /** Called when the control's form is reset: Radix's Checkbox goes back to its first state. */\n onReset?: () => void\n /**\n * The form field's name, when it comes from an argument rather than the element's `name`\n * attribute: a radio group's root is a `<div>`, which has none.\n */\n name?: () => string | null | undefined\n}\n\ninterface SourceSignature {\n Element: HTMLElement\n}\n\n/**\n * A control's ties to its form, as Radix's Checkbox, Switch and RadioGroup keep them. Radix's\n * controls are buttons, which a form doesn't submit, so in a form each renders a hidden native\n * input beside it (Radix's \"bubble input\"): the form submits that, checks it when it is\n * `required`, and resets it. This keeps what that input needs:\n *\n * - whether the control is in a form at all (its `form` attribute's, or the nearest `<form>`),\n * so the input renders only there;\n * - the `name`, `value` and `form` attributes the caller put on the control (or on a radio\n * group's root), which the input repeats, and follows when they change.\n *\n * It reads them after the control renders, since a render can't change what it has read.\n */\nexport class FormControl {\n /** Whether the control is in a form, so its hidden input should render. */\n @tracked isFormControl = false\n /** The caller's `name`, the form field the input submits. */\n @tracked name: string | null = null\n /** The caller's `value`, what the input submits when checked. */\n @tracked value: string | null = null\n /** The caller's `form`, the id of the form the control belongs to from outside it. */\n @tracked form: string | null = null\n\n /** The name the hidden input submits under: the `name` option's, else the `name` attribute's. */\n get fieldName(): string | null {\n return this.#options.name?.() ?? this.name\n }\n\n /** Put it on the element whose `name`, `value` and `form` the hidden input repeats. */\n readonly source: typeof Modifier<SourceSignature>\n\n readonly #options: FormControlOptions\n #element: HTMLElement | undefined\n #formElement: HTMLFormElement | null = null\n\n constructor(options: FormControlOptions = {}) {\n this.#options = options\n this.source = sourceModifier(this)\n }\n\n /** @internal Starts reading `element`; returns what stops it. */\n connect(element: HTMLElement): () => void {\n this.#element = element\n const observer = new MutationObserver(() => this.#sync())\n observer.observe(element, { attributes: true, attributeFilter: [...MIRRORED] })\n void waitForPromise(Promise.resolve().then(() => this.#sync()))\n return () => {\n observer.disconnect()\n this.#listen(null)\n if (this.#element === element) this.#element = undefined\n }\n }\n\n #sync(): void {\n const element = this.#element\n if (!element) return\n for (const name of MIRRORED) {\n const value = element.getAttribute(name)\n if (this[name] !== value) this[name] = value\n }\n const form = formOf(element)\n this.#listen(form)\n if (this.isFormControl !== Boolean(form)) this.isFormControl = Boolean(form)\n }\n\n #listen(form: HTMLFormElement | null): void {\n if (this.#formElement === form) return\n this.#formElement?.removeEventListener('reset', this.#onReset)\n this.#formElement = form\n form?.addEventListener('reset', this.#onReset)\n }\n\n #onReset = (): void => this.#options.onReset?.()\n}\n\nfunction sourceModifier(control: FormControl): typeof Modifier<SourceSignature> {\n return class FormControlSource extends Modifier<SourceSignature> {\n #installed = false\n\n override modify(element: HTMLElement): void {\n if (this.#installed) return\n this.#installed = true\n registerDestructor(this, control.connect(element))\n }\n }\n}\n\nexport interface BubbleInputModifierSignature {\n Element: HTMLInputElement\n Args: {\n Named: {\n checked: boolean\n indeterminate?: boolean\n /** Whether unchecking fires `input` and `change` too. A radio's doesn't, as natively. */\n announceUncheck?: boolean\n }\n }\n}\n\n/**\n * Keeps the hidden input in step with its control, as Radix's bubble input does: it lies over\n * the control (so the browser's \"please check this box\" points at it), unseen and out of the\n * way of the pointer, checked when the control is, and it fires `input` and `change` at the\n * form whenever that changes, as a native input would. Its styles go through the CSSOM, so a\n * strict Content Security Policy allows them.\n */\nexport class BubbleInput extends Modifier<BubbleInputModifierSignature> {\n #last: { checked: boolean; indeterminate: boolean } | undefined\n\n override modify(\n input: HTMLInputElement,\n _: [],\n {\n checked,\n indeterminate = false,\n announceUncheck = true,\n }: BubbleInputModifierSignature['Args']['Named'],\n ): void {\n const last = this.#last\n if (input.indeterminate !== indeterminate) input.indeterminate = indeterminate\n if (input.checked !== checked) input.checked = checked\n this.#last = { checked, indeterminate }\n if (!last) return this.#place(input, checked)\n if (last.checked === checked && last.indeterminate === indeterminate) return\n if (!checked && !announceUncheck) return\n input.dispatchEvent(new Event('input', { bubbles: true }))\n input.dispatchEvent(new Event('change', { bubbles: true }))\n }\n\n #place(input: HTMLInputElement, checked: boolean): void {\n // What a form reset goes back to.\n input.defaultChecked = checked\n const control = input.previousElementSibling\n const box = control?.getBoundingClientRect()\n const style = input.style\n style.setProperty('position', 'absolute')\n style.setProperty('pointer-events', 'none')\n style.setProperty('opacity', '0')\n style.setProperty('margin', '0')\n // It comes after the control, so this pulls it back over the control.\n style.setProperty('transform', 'translateX(-100%)')\n if (box) {\n style.setProperty('width', `${box.width}px`)\n style.setProperty('height', `${box.height}px`)\n }\n }\n}\n"],"names":["MIRRORED","formOf","element","owner","form","HTMLFormElement","id","getAttribute","named","ownerDocument","getElementById","closest","preventEnter","event","key","preventDefault","FormControl","g","prototype","tracked","i","fieldName","name","source","constructor","options","sourceModifier","connect","observer","MutationObserver","observe","attributes","attributeFilter","waitForPromise","Promise","resolve","then","disconnect","undefined","#sync","value","isFormControl","Boolean","#listen","removeEventListener","addEventListener","#onReset","onReset","control","FormControlSource","Modifier","modify","registerDestructor","BubbleInput","input","_","checked","indeterminate","announceUncheck","last","dispatchEvent","Event","bubbles","#place","defaultChecked","previousElementSibling","box","getBoundingClientRect","style","setProperty","width","height"],"mappings":";;;;;;AAMA,MAAMA,QAAQ,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAU;;AAEnD;AACA,SAASC,MAAMA,CAACC,OAAoB,EAA0B;AAC5D,EAAA,MAAMC,KAAK,GAAID,OAAO,CAAgCE,IAAI;AAC1D,EAAA,IAAID,KAAK,YAAYE,eAAe,EAAE,OAAOF,KAAK;AAClD,EAAA,MAAMG,EAAE,GAAGJ,OAAO,CAACK,YAAY,CAAC,MAAM,CAAC;AACvC,EAAA,IAAID,EAAE,EAAE;IACN,MAAME,KAAK,GAAGN,OAAO,CAACO,aAAa,CAACC,cAAc,CAACJ,EAAE,CAAC;AACtD,IAAA,OAAOE,KAAK,YAAYH,eAAe,GAAGG,KAAK,GAAG,IAAI;AACxD,EAAA;AACA,EAAA,OAAON,OAAO,CAACS,OAAO,CAAC,MAAM,CAAC;AAChC;;AAEA;AACO,SAASC,YAAYA,CAACC,KAAoB,EAAQ;EACvD,IAAIA,KAAK,CAACC,GAAG,KAAK,OAAO,EAAED,KAAK,CAACE,cAAc,EAAE;AACnD;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,WAAW,CAAC;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,eAAA,EAAA,CAEtBC,OAAO,CAAA,EAAA,YAAA;AAAA,MAAA,OAAiB,KAAK;A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ACK,MAAM,CAAA,EAAA,CAAI,CAAC;AAChD,IAAA;AACF,EAAA;AACF;;"}
package/dist/head.js ADDED
@@ -0,0 +1,25 @@
1
+ import { precompileTemplate } from '@ember/template-compilation';
2
+ import { setComponentTemplate } from '@ember/component';
3
+ import templateOnly from '@ember/component/template-only';
4
+
5
+ const documentHead = () => document.head;
6
+ /**
7
+ * Renders its block into the document's `<head>`, after what is already there, and takes it
8
+ * out again when it stops rendering. For a page's own `<meta>` tags, a stylesheet only one
9
+ * route needs, or a script loaded on demand:
10
+ *
11
+ * {{#if this.wantsPrint}}
12
+ * <InHead><link rel="stylesheet" href="/print.css" /></InHead>
13
+ * {{/if}}
14
+ *
15
+ * It is ember-primitives' `InHead`.
16
+ */
17
+ const InHead = setComponentTemplate(precompileTemplate("{{#in-element (documentHead) insertBefore=null}}\n {{yield}}\n{{/in-element}}", {
18
+ strictMode: true,
19
+ scope: () => ({
20
+ documentHead
21
+ })
22
+ }), templateOnly());
23
+
24
+ export { InHead };
25
+ //# sourceMappingURL=head.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"head.js","sources":["../src/head.gts"],"sourcesContent":["import type { TOC } from '@ember/component/template-only'\n\nexport interface InHeadSignature {\n Blocks: {\n /** What goes in the document's `<head>`: `<meta>`, `<link>`, `<script>`, `<style>`… */\n default: []\n }\n}\n\nconst documentHead = (): HTMLHeadElement => document.head\n\n/**\n * Renders its block into the document's `<head>`, after what is already there, and takes it\n * out again when it stops rendering. For a page's own `<meta>` tags, a stylesheet only one\n * route needs, or a script loaded on demand:\n *\n * {{#if this.wantsPrint}}\n * <InHead><link rel=\"stylesheet\" href=\"/print.css\" /></InHead>\n * {{/if}}\n *\n * It is ember-primitives' `InHead`.\n */\nexport const InHead: TOC<InHeadSignature> = <template>\n {{#in-element (documentHead) insertBefore=null}}\n {{yield}}\n {{/in-element}}\n</template>\n"],"names":["documentHead","document","head","InHead","setComponentTemplate","precompileTemplate","strictMode","scope","templateOnly"],"mappings":";;;;AASA,MAAMA,YAAA,GAAeA,MAAuBC,QAAA,CAASC,IAAI;AAEzD;;;;;;;;;;AAUC;MACYC,MAAY,GAAAC,oBAAA,CAAmBC,kBAAA,CAAA,gFAAA,EAI5C;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAP,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAQ,YAAA,EAAA;;"}