@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,886 @@
1
+ import { modifier } from 'ember-modifier';
2
+ import Component from '@glimmer/component';
3
+ import { tracked } from '@glimmer/tracking';
4
+ import { hash } from '@ember/helper';
5
+ import { assert } from '@ember/debug';
6
+ import { buildWaiter, waitForPromise } from '@ember/test-waiters';
7
+ import { flip, detectOverflow, autoUpdate, offset, shift, limitShift, size, arrow, hide, computePosition } from '@floating-ui/dom';
8
+ import { ignoreROError } from './resize-observer.js';
9
+ import { isNumber, isObject, isFunction, isUndefined, isString } from '@sindresorhus/is';
10
+ import { precompileTemplate } from '@ember/template-compilation';
11
+ import { setComponentTemplate } from '@ember/component';
12
+ import { g, i } from 'decorator-transforms/runtime';
13
+
14
+ /**
15
+ * Middleware that passes the whole middleware state on, as ember-primitives' `exposeMetadata`:
16
+ * it lands in `middlewareData.metadata`.
17
+ */
18
+ function exposeMetadata() {
19
+ return {
20
+ name: 'metadata',
21
+ fn: data => ({
22
+ data
23
+ })
24
+ };
25
+ }
26
+ async function detectOverflowOfBoth(state, options) {
27
+ const floating = await detectOverflow(state, {
28
+ ...options,
29
+ elementContext: 'floating'
30
+ });
31
+ const reference = await detectOverflow(state, {
32
+ ...options,
33
+ elementContext: 'reference'
34
+ });
35
+ return {
36
+ top: Math.max(floating.top, reference.top),
37
+ right: Math.max(floating.right, reference.right),
38
+ bottom: Math.max(floating.bottom, reference.bottom),
39
+ left: Math.max(floating.left, reference.left)
40
+ };
41
+ }
42
+
43
+ /**
44
+ * Floating UI's `flip`, with ember-primitives' `elementContext: 'both'`: two flips would
45
+ * disagree and undo each other, so `both` feeds the overflow of both elements into one.
46
+ */
47
+ function flipTo(options = {}) {
48
+ const {
49
+ elementContext,
50
+ ...flipOptions
51
+ } = options;
52
+ if (elementContext !== 'both') return flip({
53
+ ...flipOptions,
54
+ elementContext
55
+ });
56
+ const middleware = flip(flipOptions);
57
+ return {
58
+ ...middleware,
59
+ fn: state => middleware.fn({
60
+ ...state,
61
+ platform: {
62
+ ...state.platform,
63
+ detectOverflow: detectOverflowOfBoth
64
+ }
65
+ })
66
+ };
67
+ }
68
+
69
+ /** The arrow's measured size, for `transformOrigin`. */
70
+
71
+ /**
72
+ * The point the floating element grows from: the arrow's tip, or the edge facing the anchor
73
+ * (its start, centre or end), as Radix's Popper works it out. Shared by both modes.
74
+ */
75
+ function originFor(placement, floatingSize, arrow, arrowSize) {
76
+ const [side, align = 'center'] = placement.split('-');
77
+ const hidden = !arrow || arrow.centerOffset !== 0;
78
+ const width = hidden ? 0 : arrowSize.width;
79
+ const height = hidden ? 0 : arrowSize.height;
80
+ const noArrow = {
81
+ start: '0%',
82
+ center: '50%',
83
+ end: '100%'
84
+ }[align] ?? '50%';
85
+ const arrowX = `${(arrow?.x ?? 0) + width / 2}px`;
86
+ const arrowY = `${(arrow?.y ?? 0) + height / 2}px`;
87
+ switch (side) {
88
+ case 'top':
89
+ return {
90
+ x: hidden ? noArrow : arrowX,
91
+ y: `${floatingSize.height + height}px`
92
+ };
93
+ case 'right':
94
+ return {
95
+ x: `${-height}px`,
96
+ y: hidden ? noArrow : arrowY
97
+ };
98
+ case 'left':
99
+ return {
100
+ x: `${floatingSize.width + height}px`,
101
+ y: hidden ? noArrow : arrowY
102
+ };
103
+ default:
104
+ return {
105
+ x: hidden ? noArrow : arrowX,
106
+ y: `${-height}px`
107
+ };
108
+ }
109
+ }
110
+
111
+ /**
112
+ * Middleware that works out the transform origin, as Radix's Popper does, into
113
+ * `middlewareData.transformOrigin` (`{ x, y }`, as CSS lengths).
114
+ */
115
+ function transformOrigin(arrowSize = {
116
+ width: 0,
117
+ height: 0
118
+ }) {
119
+ return {
120
+ name: 'transformOrigin',
121
+ fn: ({
122
+ placement,
123
+ rects,
124
+ middlewareData
125
+ }) => ({
126
+ data: originFor(placement, rects.floating, middlewareData.arrow, arrowSize)
127
+ })
128
+ };
129
+ }
130
+
131
+ /** A side of the anchor, as Radix's `side`. */
132
+
133
+ /** Where along that side, as Radix's `align`: `start` is the inline start (left, in LTR). */
134
+
135
+ /** What a floating element is anchored to: an element, a selector for one, or a virtual element. */
136
+
137
+ /** How a floating element was positioned: by the browser, or by Floating UI. */
138
+
139
+ /**
140
+ * Where the floating element ended up, as Floating UI's middleware state has it, plus the mode
141
+ * that put it there. With CSS anchor positioning it is measured from the page.
142
+ */
143
+
144
+ /**
145
+ * How to place a floating element against its anchor. It takes Radix's Popper arguments
146
+ * (`side`, `align`, `sideOffset`…), which Joinery's components use, and ember-primitives'
147
+ * floating-ui ones (`placement`, `offsetOptions`, `flipOptions`…); where both name the same
148
+ * thing, Radix's win.
149
+ */
150
+
151
+ /** The options with every default filled in. */
152
+
153
+ const SIDES = ['top', 'right', 'bottom', 'left'];
154
+ function sideAndAlign(placement) {
155
+ const [side, align] = placement.split('-');
156
+ return [SIDES.includes(side) ? side : 'bottom', align === 'start' || align === 'end' ? align : 'center'];
157
+ }
158
+ function placementOf(side, align) {
159
+ return align === 'center' ? side : `${side}-${align}`;
160
+ }
161
+ function isVertical(side) {
162
+ return side === 'top' || side === 'bottom';
163
+ }
164
+ function resolve(options) {
165
+ const [placedSide, placedAlign] = sideAndAlign(options.placement ?? 'bottom');
166
+ const side = options.side ?? placedSide;
167
+ const align = options.align ?? placedAlign;
168
+ let mainAxis = options.sideOffset ?? 0;
169
+ let rawCrossAxis = 0;
170
+ let alignmentAxis = options.alignOffset ?? null;
171
+ const given = options.offsetOptions;
172
+ if (isNumber(given)) {
173
+ mainAxis = given;
174
+ } else if (given && isObject(given) && !isFunction(given)) {
175
+ mainAxis = given.mainAxis ?? mainAxis;
176
+ rawCrossAxis = given.crossAxis ?? 0;
177
+ alignmentAxis = given.alignmentAxis ?? alignmentAxis;
178
+ }
179
+ // Floating UI's rule: for start and end, alignmentAxis replaces crossAxis, and counts from
180
+ // the aligned edge, so it is negated for end.
181
+ const crossAxis = align !== 'center' && isNumber(alignmentAxis) ? align === 'end' ? -alignmentAxis : alignmentAxis : rawCrossAxis;
182
+ return {
183
+ side,
184
+ align,
185
+ mainAxis,
186
+ crossAxis,
187
+ offsetAxes: {
188
+ mainAxis,
189
+ crossAxis: rawCrossAxis,
190
+ alignmentAxis
191
+ },
192
+ strategy: options.strategy ?? 'fixed',
193
+ avoidCollisions: options.avoidCollisions ?? true,
194
+ padding: options.collisionPadding ?? 0,
195
+ flipOptions: options.flipOptions ?? {},
196
+ shiftOptions: options.shiftOptions ?? {},
197
+ sticky: options.sticky ?? 'always',
198
+ hide: options.hideWhenDetached ?? true,
199
+ hideOptions: options.hideOptions ?? {},
200
+ arrow: options.arrow ?? null,
201
+ arrowPadding: options.arrowPadding ?? 0,
202
+ middleware: options.middleware ?? [],
203
+ offset: isFunction(given) ? given : undefined,
204
+ setData: options.setData
205
+ };
206
+ }
207
+ function hasPadding(padding) {
208
+ if (padding === undefined) return false;
209
+ if (isNumber(padding)) return padding !== 0;
210
+ return Object.values(padding).some(value => isNumber(value) && value !== 0);
211
+ }
212
+
213
+ /** The Floating UI settings CSS anchor positioning has no equivalent for. */
214
+ function needsFloatingUI(reference, resolved) {
215
+ if (!(reference instanceof Element)) return true;
216
+ if (resolved.middleware.length || resolved.offset) return true;
217
+ // CSS centres the margin box, so a cross-axis shift of a centred element can't be a margin.
218
+ if (resolved.align === 'center' && resolved.crossAxis !== 0) return true;
219
+ if (hasPadding(resolved.padding)) return true;
220
+ const {
221
+ padding: flipPadding,
222
+ mainAxis,
223
+ crossAxis,
224
+ flipAlignment,
225
+ ...flipRest
226
+ } = resolved.flipOptions;
227
+ if (hasPadding(flipPadding) || Object.keys(flipRest).length) return true;
228
+ const {
229
+ padding: shiftPadding,
230
+ ...shiftRest
231
+ } = resolved.shiftOptions;
232
+ if (hasPadding(shiftPadding) || Object.keys(shiftRest).length) return true;
233
+ if (Object.keys(resolved.hideOptions).length) return true;
234
+ return false;
235
+ }
236
+ /** Whether the browser has CSS anchor positioning, with the fallbacks Joinery uses. */
237
+ function supportsAnchorPositioning() {
238
+ try {
239
+ return !isUndefined(globalThis.CSS) && CSS.supports('anchor-name: --jn-test') && CSS.supports('position-area: bottom span-right') && CSS.supports('position-try-fallbacks: flip-block, flip-inline');
240
+ } catch {
241
+ return false;
242
+ }
243
+ }
244
+
245
+ /**
246
+ * Whether the Floating UI fallback is forced: `globalThis.JOINERY_ANCHOR_FALLBACK === true`,
247
+ * which CI's fallback run (and `pnpm test:anchor-fallback`) sets. Read on every call.
248
+ */
249
+ function isAnchorFallbackForced() {
250
+ return globalThis.JOINERY_ANCHOR_FALLBACK === true;
251
+ }
252
+
253
+ /**
254
+ * How a floating element would be positioned now: `css` where the browser has CSS anchor
255
+ * positioning, `floating-ui` where it hasn't, where the fallback is forced, or where an option
256
+ * needs Floating UI (custom `middleware`, an `offsetOptions` function, a virtual reference,
257
+ * collision padding, or Floating UI-only `flipOptions`, `shiftOptions` or `hideOptions`).
258
+ */
259
+ function anchorMode(reference, options = {}) {
260
+ if (isAnchorFallbackForced() || !supportsAnchorPositioning()) return 'floating-ui';
261
+ return needsFloatingUI(reference ?? document.documentElement, resolve(options)) ? 'floating-ui' : 'css';
262
+ }
263
+
264
+ const waiter = buildWaiter('@ember-joinery/primitives:anchor');
265
+
266
+ /** The custom properties a floating element gets, for its styles to use. */
267
+ const ANCHOR_PROPERTIES = {
268
+ /** The room between the anchor and the viewport's edge, across and along the side. */
269
+ availableWidth: '--jn-anchor-available-width',
270
+ availableHeight: '--jn-anchor-available-height',
271
+ /** The anchor's size, to make a menu as wide as its trigger. */
272
+ width: '--jn-anchor-width',
273
+ height: '--jn-anchor-height',
274
+ /** Where the element grows from: the arrow's tip, or the edge facing the anchor. */
275
+ transformOrigin: '--jn-anchor-transform-origin'
276
+ };
277
+ const OPPOSITE = {
278
+ top: 'bottom',
279
+ right: 'left',
280
+ bottom: 'top',
281
+ left: 'right'
282
+ };
283
+
284
+ /** Inline styles set on an element, with the values they replaced, to put back afterwards. */
285
+ class Styles {
286
+ element;
287
+ #saved = new Map();
288
+ #hadAttribute;
289
+ constructor(element) {
290
+ this.element = element;
291
+ this.#hadAttribute = element.hasAttribute('style');
292
+ }
293
+ set(property, value) {
294
+ const style = this.element.style;
295
+ if (!this.#saved.has(property)) {
296
+ this.#saved.set(property, [style.getPropertyValue(property), style.getPropertyPriority(property)]);
297
+ }
298
+ if (style.getPropertyValue(property) !== value) style.setProperty(property, value);
299
+ }
300
+
301
+ /** Puts them back, last set first, so a shorthand (`margin`) goes after its longhands. */
302
+ restore() {
303
+ const style = this.element.style;
304
+ for (const [property, [value, priority]] of [...this.#saved].reverse()) {
305
+ if (value) style.setProperty(property, value, priority);else style.removeProperty(property);
306
+ }
307
+ this.#saved.clear();
308
+ if (!this.#hadAttribute && !style.length) this.element.removeAttribute('style');
309
+ }
310
+ }
311
+
312
+ /** Attributes set on an element, with their old values, to put back afterwards. */
313
+ class Attributes {
314
+ element;
315
+ #saved = new Map();
316
+ constructor(element) {
317
+ this.element = element;
318
+ }
319
+ set(name, value) {
320
+ if (!this.#saved.has(name)) this.#saved.set(name, this.element.getAttribute(name));
321
+ if (this.element.getAttribute(name) !== value) this.element.setAttribute(name, value);
322
+ }
323
+ restore() {
324
+ for (const [name, value] of this.#saved) {
325
+ if (value === null) this.element.removeAttribute(name);else this.element.setAttribute(name, value);
326
+ }
327
+ this.#saved.clear();
328
+ }
329
+ }
330
+ function isDisplayed(element) {
331
+ return element.isConnected && element.getClientRects().length > 0;
332
+ }
333
+
334
+ /** The properties anchoring places an element with: its inset, its margins and its visibility. */
335
+ const PLACING = /^(?:left|top|right|bottom|inset|margin|visibility)/;
336
+
337
+ /**
338
+ * Cuts short any transition of the element's own that would slide it into its place. Radix
339
+ * places a wrapper, which has no transitions; Joinery places the element itself, and upstream's
340
+ * classes give it a `transition-duration` (`duration-100`, for its animation) with
341
+ * `transition-property` left at its initial `all`. Its other transitions carry on.
342
+ */
343
+ function arrive(element) {
344
+ if (!isFunction(element.getAnimations) || isUndefined(globalThis.CSSTransition)) return;
345
+ // getAnimations() brings the style up to date first, so it sees the transitions just started.
346
+ for (const animation of element.getAnimations()) {
347
+ if (animation instanceof CSSTransition && PLACING.test(animation.transitionProperty)) {
348
+ animation.cancel();
349
+ }
350
+ }
351
+ }
352
+
353
+ /** The anchor's size, as the floating element's custom properties. */
354
+ function setAnchorSize(styles, size) {
355
+ styles.set(ANCHOR_PROPERTIES.width, `${size.width}px`);
356
+ styles.set(ANCHOR_PROPERTIES.height, `${size.height}px`);
357
+ }
358
+ function isRTL(element) {
359
+ return getComputedStyle(element).direction === 'rtl';
360
+ }
361
+ function arrowSizeOf(arrow) {
362
+ return arrow ? {
363
+ width: arrow.offsetWidth,
364
+ height: arrow.offsetHeight
365
+ } : {
366
+ width: 0,
367
+ height: 0
368
+ };
369
+ }
370
+ function lookUp(reference) {
371
+ if (!isString(reference)) return reference;
372
+ const found = document.querySelector(reference);
373
+ assert(`Joinery: anchorTo found no element for the selector \`${reference}\``, found);
374
+ return found;
375
+ }
376
+ /** What both modes do once they know where the element went: its data, variables and arrow. */
377
+ function applyPlaced(floating, resolved, placed, mode, styles, attributes, arrowStyles, arrowSize) {
378
+ const [side, align] = sideAndAlign(placed.placement);
379
+ attributes.set('data-side', side);
380
+ attributes.set('data-align', align);
381
+ const origin = originFor(placed.placement, placed.floating, placed.arrow, arrowSize);
382
+ styles.set(ANCHOR_PROPERTIES.availableWidth, `${placed.available.width}px`);
383
+ styles.set(ANCHOR_PROPERTIES.availableHeight, `${placed.available.height}px`);
384
+ setAnchorSize(styles, placed.reference);
385
+ styles.set(ANCHOR_PROPERTIES.transformOrigin, `${origin.x} ${origin.y}`);
386
+ const arrow = resolved.arrow;
387
+ if (arrow && arrowStyles) {
388
+ // As Radix's PopperArrow: on the edge facing the anchor, its bottom towards the anchor.
389
+ const {
390
+ x,
391
+ y,
392
+ centerOffset
393
+ } = placed.arrow ?? {};
394
+ arrowStyles.set('position', 'absolute');
395
+ arrowStyles.set('left', x != null ? `${x}px` : '');
396
+ arrowStyles.set('top', y != null ? `${y}px` : '');
397
+ arrowStyles.set('right', '');
398
+ arrowStyles.set('bottom', '');
399
+ arrowStyles.set(OPPOSITE[side], '0');
400
+ arrowStyles.set('transform-origin', {
401
+ top: '',
402
+ right: '0 0',
403
+ bottom: 'center 0',
404
+ left: '100% 0'
405
+ }[side]);
406
+ arrowStyles.set('transform', {
407
+ top: 'translateY(100%)',
408
+ right: 'translateY(50%) rotate(90deg) translateX(-50%)',
409
+ bottom: 'rotate(180deg)',
410
+ left: 'translateY(50%) rotate(-90deg) translateX(50%)'
411
+ }[side]);
412
+ arrowStyles.set('visibility', centerOffset !== 0 ? 'hidden' : '');
413
+ }
414
+ if (resolved.setData) {
415
+ resolved.setData(placed.metadata ?? {
416
+ mode,
417
+ x: placed.x,
418
+ y: placed.y,
419
+ placement: placed.placement,
420
+ initialPlacement: placementOf(resolved.side, resolved.align),
421
+ strategy: resolved.strategy,
422
+ middlewareData: {
423
+ ...(placed.arrow ? {
424
+ arrow: placed.arrow
425
+ } : {}),
426
+ transformOrigin: origin,
427
+ ...(placed.referenceHidden !== undefined ? {
428
+ hide: {
429
+ referenceHidden: placed.referenceHidden
430
+ }
431
+ } : {})
432
+ },
433
+ rects: {
434
+ reference: placed.reference,
435
+ floating: {
436
+ x: 0,
437
+ y: 0,
438
+ ...placed.floating
439
+ }
440
+ }
441
+ });
442
+ }
443
+ }
444
+
445
+ /** `position-area` for a side and alignment, in physical terms. */
446
+ function positionArea(side, align, rtl) {
447
+ if (align === 'center') return side;
448
+ if (isVertical(side)) {
449
+ const left = align === 'start' !== rtl;
450
+ return `${side} ${left ? 'span-right' : 'span-left'}`;
451
+ }
452
+ return `${side} ${align === 'start' ? 'span-bottom' : 'span-top'}`;
453
+ }
454
+
455
+ /** The fallbacks Floating UI's flip tries, in its order, as `position-try-fallbacks`. */
456
+ function tryFallbacks(resolved) {
457
+ if (!resolved.avoidCollisions) return 'none';
458
+ const {
459
+ mainAxis = true,
460
+ crossAxis = true,
461
+ flipAlignment = true
462
+ } = resolved.flipOptions;
463
+ const vertical = isVertical(resolved.side);
464
+ const flipSide = vertical ? 'flip-block' : 'flip-inline';
465
+ const flipAlign = vertical ? 'flip-inline' : 'flip-block';
466
+ const tries = [];
467
+ const aligned = resolved.align !== 'center' && flipAlignment && crossAxis !== false;
468
+ if (aligned) tries.push(flipAlign);
469
+ if (mainAxis !== false) tries.push(flipSide);
470
+ if (aligned && mainAxis !== false) tries.push(`${flipSide} ${flipAlign}`);
471
+ return tries.length ? tries.join(', ') : 'none';
472
+ }
473
+ let anchorNames = 0;
474
+
475
+ /** Adds a name to the reference's `anchor-name` list (it may already anchor other elements). */
476
+ function addAnchorName(reference, name) {
477
+ const style = reference.style;
478
+ const names = (style.getPropertyValue('anchor-name') || '').split(',').map(each => each.trim()).filter(each => each && each !== 'none');
479
+ style.setProperty('anchor-name', [...names, name].join(', '));
480
+ return () => {
481
+ const rest = (style.getPropertyValue('anchor-name') || '').split(',').map(each => each.trim()).filter(each => each && each !== name && each !== 'none');
482
+ if (rest.length) style.setProperty('anchor-name', rest.join(', '));else style.removeProperty('anchor-name');
483
+ };
484
+ }
485
+ function viewport() {
486
+ const root = document.documentElement;
487
+ return {
488
+ width: root.clientWidth,
489
+ height: root.clientHeight
490
+ };
491
+ }
492
+ function paddingOf(padding) {
493
+ if (isNumber(padding)) {
494
+ return {
495
+ top: padding,
496
+ right: padding,
497
+ bottom: padding,
498
+ left: padding
499
+ };
500
+ }
501
+ return {
502
+ top: 0,
503
+ right: 0,
504
+ bottom: 0,
505
+ left: 0,
506
+ ...padding
507
+ };
508
+ }
509
+
510
+ /**
511
+ * Where CSS anchor positioning put the element: the side its centre is on (after any
512
+ * `position-try` fallback), and the edge it lines up with.
513
+ */
514
+ function measurePlacement(resolved, reference, floating, rtl) {
515
+ const vertical = isVertical(resolved.side);
516
+ let side;
517
+ if (vertical) {
518
+ side = floating.top + floating.height / 2 >= reference.top + reference.height / 2 ? 'bottom' : 'top';
519
+ } else {
520
+ side = floating.left + floating.width / 2 >= reference.left + reference.width / 2 ? 'right' : 'left';
521
+ }
522
+ let align = resolved.align;
523
+ if (align !== 'center') {
524
+ // The edge it lines up with: a fallback may have flipped the alignment.
525
+ const nearStart = vertical ? Math.abs(floating.left - reference.left) : Math.abs(floating.top - reference.top);
526
+ const nearEnd = vertical ? Math.abs(floating.right - reference.right) : Math.abs(floating.bottom - reference.bottom);
527
+ if (nearStart !== nearEnd) {
528
+ // For top and bottom, the physical start (left) is the logical end in RTL.
529
+ const physicalStart = nearStart < nearEnd;
530
+ align = (vertical && rtl ? !physicalStart : physicalStart) ? 'start' : 'end';
531
+ }
532
+ }
533
+ return placementOf(side, align);
534
+ }
535
+
536
+ /** The arrow's offset along the edge, centred on the anchor and kept off the corners. */
537
+ function measureArrow(side, reference, floating, arrowSize, padding) {
538
+ const vertical = isVertical(side);
539
+ const length = vertical ? arrowSize.width : arrowSize.height;
540
+ const extent = vertical ? floating.width : floating.height;
541
+ const ideal = vertical ? reference.left + reference.width / 2 - floating.left - length / 2 : reference.top + reference.height / 2 - floating.top - length / 2;
542
+ const min = padding;
543
+ const max = extent - length - padding;
544
+ const clamped = Math.min(Math.max(ideal, min), Math.max(min, max));
545
+ const centerOffset = Math.round(ideal - clamped);
546
+ return vertical ? {
547
+ x: clamped,
548
+ centerOffset
549
+ } : {
550
+ y: clamped,
551
+ centerOffset
552
+ };
553
+ }
554
+
555
+ /**
556
+ * Positions `floating` against `reference` until the returned function is called: with CSS
557
+ * anchor positioning where the browser has it (an `anchor-name` on the reference, and
558
+ * `position-anchor`, `position-area` and `position-try-fallbacks` on the floating element), and
559
+ * with Floating UI's `computePosition` (offset, flip, shift, size, arrow and hide) where it
560
+ * hasn't, where the fallback is forced, or where an option needs Floating UI (see `anchorMode`).
561
+ *
562
+ * Either way the floating element gets `data-side` and `data-align` (where it ended up, after
563
+ * any flip), the `--jn-anchor-*` custom properties (`ANCHOR_PROPERTIES`), and the arrow its
564
+ * place, and `setData` hears where it went. The anchor's size is set before anything is
565
+ * measured, and Floating UI places the element again when those properties change its size, as
566
+ * Radix's Popper does, so an element sized by them (a menu as wide as its trigger) is placed at
567
+ * its own size the first time. It goes straight to its place: a transition of the element's
568
+ * own on the properties that place it is cut short. It follows the anchor as the page scrolls
569
+ * and resizes, and the browser's "ResizeObserver loop" message, which an element sized by its
570
+ * anchor can cause, isn't an error (`ignoreROError()`). Everything it set is put back when it
571
+ * stops.
572
+ *
573
+ * const stop = anchor(menu, trigger, { side: 'bottom', align: 'start', sideOffset: 4 })
574
+ *
575
+ * Tests wait for it: `settled()` resolves once the element is in place.
576
+ */
577
+ function anchor(floating, referenceOrSelector, options = {}) {
578
+ const reference = lookUp(referenceOrSelector);
579
+ assert('Joinery: an element can’t be anchored to itself', floating !== reference);
580
+ const resolved = resolve(options);
581
+ const mode = anchorMode(reference, options);
582
+ const styles = new Styles(floating);
583
+ const attributes = new Attributes(floating);
584
+ const arrowStyles = resolved.arrow ? new Styles(resolved.arrow) : undefined;
585
+ ignoreROError();
586
+ // Before anything is measured, so an element sized by its anchor has that size from the start.
587
+ setAnchorSize(styles, reference.getBoundingClientRect());
588
+ let stopped = false;
589
+ let token = waiter.beginAsync();
590
+ const ready = () => {
591
+ if (token === undefined) return;
592
+ waiter.endAsync(token);
593
+ token = undefined;
594
+ };
595
+ // Until the element has a box (a popover is shown once the render is over), keep tests
596
+ // waiting, for a few frames at most.
597
+ let frames = 0;
598
+ let frame = 0;
599
+ const waitForBox = () => {
600
+ frame = requestAnimationFrame(() => {
601
+ if (stopped || token === undefined) return;
602
+ update();
603
+ if (++frames >= 10) ready();else if (token !== undefined) waitForBox();
604
+ });
605
+ };
606
+ let update;
607
+ let teardown;
608
+ if (mode === 'css' && reference instanceof Element) {
609
+ const name = `--jn-anchor-${anchorNames += 1}`;
610
+ const removeName = addAnchorName(reference, name);
611
+ const rtl = isRTL(floating);
612
+ const {
613
+ side,
614
+ align,
615
+ mainAxis,
616
+ crossAxis
617
+ } = resolved;
618
+ styles.set('position', resolved.strategy);
619
+ styles.set('inset', 'auto');
620
+ styles.set('margin', '0');
621
+ styles.set('position-anchor', name);
622
+ styles.set('position-area', positionArea(side, align, rtl));
623
+ styles.set('position-try-fallbacks', tryFallbacks(resolved));
624
+ styles.set('position-visibility', resolved.hide ? 'anchors-visible' : 'always');
625
+ update = () => {
626
+ if (stopped || !isDisplayed(floating)) return;
627
+ const arrowSize = arrowSizeOf(resolved.arrow);
628
+ // Away from the anchor: the margin on the side facing it. The try fallbacks flip margins
629
+ // with the position, as Floating UI's flip recomputes its offset.
630
+ styles.set(`margin-${OPPOSITE[side]}`, `${mainAxis + arrowSize.height}px`);
631
+ if (crossAxis !== 0) {
632
+ const shift = isVertical(side) ? rtl ? -crossAxis : crossAxis : crossAxis;
633
+ const startEdge = positionArea(side, align, rtl).includes(isVertical(side) ? 'span-right' : 'span-bottom');
634
+ const property = isVertical(side) ? startEdge ? 'margin-left' : 'margin-right' : startEdge ? 'margin-top' : 'margin-bottom';
635
+ styles.set(property, `${startEdge ? shift : -shift}px`);
636
+ }
637
+ const referenceRect = reference.getBoundingClientRect();
638
+ // The anchor's size first, so an element sized by it is measured at that size.
639
+ setAnchorSize(styles, referenceRect);
640
+ const floatingRect = floating.getBoundingClientRect();
641
+ const placement = measurePlacement(resolved, referenceRect, floatingRect, rtl);
642
+ const [placedSide] = sideAndAlign(placement);
643
+ const room = viewport();
644
+ const padding = paddingOf(resolved.padding);
645
+ const offsetAway = mainAxis + arrowSize.height;
646
+ const available = isVertical(placedSide) ? {
647
+ width: room.width - padding.left - padding.right,
648
+ height: placedSide === 'bottom' ? room.height - referenceRect.bottom - offsetAway - padding.bottom : referenceRect.top - offsetAway - padding.top
649
+ } : {
650
+ width: placedSide === 'right' ? room.width - referenceRect.right - offsetAway - padding.right : referenceRect.left - offsetAway - padding.left,
651
+ height: room.height - padding.top - padding.bottom
652
+ };
653
+ applyPlaced(floating, resolved, {
654
+ placement,
655
+ x: floatingRect.left,
656
+ y: floatingRect.top,
657
+ arrow: resolved.arrow ? measureArrow(placedSide, referenceRect, floatingRect, arrowSize, resolved.arrowPadding) : undefined,
658
+ available: {
659
+ width: Math.max(0, available.width),
660
+ height: Math.max(0, available.height)
661
+ },
662
+ reference: {
663
+ x: referenceRect.x,
664
+ y: referenceRect.y,
665
+ width: referenceRect.width,
666
+ height: referenceRect.height
667
+ },
668
+ floating: {
669
+ width: floatingRect.width,
670
+ height: floatingRect.height
671
+ }
672
+ }, mode, styles, attributes, arrowStyles, arrowSize);
673
+ arrive(floating);
674
+ ready();
675
+ };
676
+ const stopUpdates = autoUpdate(reference, floating, update);
677
+ teardown = () => {
678
+ stopUpdates();
679
+ removeName();
680
+ };
681
+ } else {
682
+ styles.set('position', resolved.strategy);
683
+ styles.set('inset', 'auto');
684
+ styles.set('margin', '0');
685
+ styles.set('top', '0');
686
+ styles.set('left', '0');
687
+ let latest = 0;
688
+ update = () => {
689
+ if (stopped) return;
690
+ const run = latest += 1;
691
+ const arrowSize = arrowSizeOf(resolved.arrow);
692
+ const padding = resolved.padding;
693
+ // size() hands over the room it measured, for the custom properties.
694
+ let available = {
695
+ width: 0,
696
+ height: 0
697
+ };
698
+ const middleware = [offset(resolved.offset ?? {
699
+ ...resolved.offsetAxes,
700
+ mainAxis: resolved.offsetAxes.mainAxis + arrowSize.height
701
+ }), resolved.avoidCollisions && flipTo({
702
+ padding,
703
+ ...resolved.flipOptions
704
+ }), resolved.avoidCollisions && shift({
705
+ padding,
706
+ limiter: resolved.sticky === 'partial' ? limitShift() : undefined,
707
+ ...resolved.shiftOptions
708
+ }), size({
709
+ padding,
710
+ apply: ({
711
+ availableWidth,
712
+ availableHeight,
713
+ rects
714
+ }) => {
715
+ available = {
716
+ width: availableWidth,
717
+ height: availableHeight
718
+ };
719
+ if (stopped || run !== latest) return;
720
+ // As Radix's Popper: the properties go on here, so an element they size has its
721
+ // size before it is placed. When they change it, size() measures it again and the
722
+ // middleware runs once more, so flip, shift and the alignment see its real size.
723
+ styles.set(ANCHOR_PROPERTIES.availableWidth, `${availableWidth}px`);
724
+ styles.set(ANCHOR_PROPERTIES.availableHeight, `${availableHeight}px`);
725
+ setAnchorSize(styles, rects.reference);
726
+ }
727
+ }), ...resolved.middleware, resolved.arrow !== null && arrow({
728
+ element: resolved.arrow,
729
+ padding: resolved.arrowPadding
730
+ }), transformOrigin(arrowSize), resolved.hide && hide({
731
+ strategy: 'referenceHidden',
732
+ padding,
733
+ ...resolved.hideOptions
734
+ }), exposeMetadata()];
735
+ const done = computePosition(reference, floating, {
736
+ placement: placementOf(resolved.side, resolved.align),
737
+ strategy: resolved.strategy,
738
+ middleware: middleware.filter(each => each !== false)
739
+ }).then(({
740
+ x,
741
+ y,
742
+ placement,
743
+ middlewareData
744
+ }) => {
745
+ if (stopped || run !== latest) return;
746
+ const metadata = middlewareData['metadata'];
747
+ const rects = metadata?.rects ?? {
748
+ reference: {
749
+ x: 0,
750
+ y: 0,
751
+ width: 0,
752
+ height: 0
753
+ },
754
+ floating: {
755
+ x: 0,
756
+ y: 0,
757
+ width: floating.offsetWidth,
758
+ height: floating.offsetHeight
759
+ }
760
+ };
761
+ styles.set('left', `${x}px`);
762
+ styles.set('top', `${y}px`);
763
+ const referenceHidden = middlewareData.hide?.referenceHidden;
764
+ if (resolved.hide) styles.set('visibility', referenceHidden ? 'hidden' : '');
765
+ applyPlaced(floating, resolved, {
766
+ placement,
767
+ x,
768
+ y,
769
+ arrow: middlewareData.arrow,
770
+ referenceHidden,
771
+ available,
772
+ reference: rects.reference,
773
+ floating: rects.floating,
774
+ metadata: metadata && {
775
+ ...metadata,
776
+ x,
777
+ y,
778
+ placement,
779
+ middlewareData,
780
+ mode
781
+ }
782
+ }, mode, styles, attributes, arrowStyles, arrowSize);
783
+ arrive(floating);
784
+ if (isDisplayed(floating)) ready();
785
+ });
786
+ void waitForPromise(done);
787
+ };
788
+ teardown = autoUpdate(reference, floating, update);
789
+ }
790
+ if (token !== undefined) waitForBox();
791
+ return () => {
792
+ if (stopped) return;
793
+ stopped = true;
794
+ cancelAnimationFrame(frame);
795
+ teardown();
796
+ ready();
797
+ styles.restore();
798
+ attributes.restore();
799
+ arrowStyles?.restore();
800
+ };
801
+ }
802
+
803
+ /**
804
+ * Anchors the element it is on to another, as ember-primitives' `anchorTo` does, with CSS
805
+ * anchor positioning where the browser has it and Floating UI otherwise (see `anchor`). It
806
+ * takes ember-primitives' arguments (`placement`, `offsetOptions`, `flipOptions`…) and
807
+ * Radix's (`side`, `align`, `sideOffset`, `arrow`…):
808
+ *
809
+ * <button id="trigger">…</button>
810
+ * <div {{anchorTo "#trigger" side="bottom" align="start" sideOffset=4}}>…</div>
811
+ *
812
+ * When an argument changes, it positions the element again from scratch.
813
+ */
814
+ const anchorTo = modifier((floating, [reference], options) => {
815
+ if (!reference) return;
816
+ return anchor(floating, reference, options);
817
+ });
818
+
819
+ /**
820
+ * ember-primitives' `<FloatingUI>`: no element of its own, it yields a modifier for the
821
+ * reference and one for the floating element, anchored to it as `anchorTo` does.
822
+ *
823
+ * <FloatingUI @placement="bottom-start" @offsetOptions={{8}} as |reference floating util|>
824
+ * <button type="button" {{reference}}>More</button>
825
+ * <div {{floating}} data-side={{util.data.placement}}>…</div>
826
+ * </FloatingUI>
827
+ */
828
+ class FloatingUI extends Component {
829
+ static {
830
+ g(this.prototype, "referenceElement", [tracked]);
831
+ }
832
+ #referenceElement = (i(this, "referenceElement"), void 0);
833
+ static {
834
+ g(this.prototype, "data", [tracked]);
835
+ }
836
+ #data = (i(this, "data"), void 0);
837
+ setReference = element => {
838
+ this.referenceElement = element;
839
+ };
840
+ /** The reference's modifier. */
841
+ reference = modifier(element => {
842
+ this.setReference(element);
843
+ });
844
+ setData = data => {
845
+ this.data = data;
846
+ };
847
+ /** The floating element's modifier: positions it again whenever an argument changes. */
848
+ floating = modifier(element => {
849
+ const {
850
+ referenceElement: reference,
851
+ args
852
+ } = this;
853
+ if (!reference) return;
854
+ return anchor(element, reference, {
855
+ placement: args.placement,
856
+ side: args.side,
857
+ align: args.align,
858
+ sideOffset: args.sideOffset,
859
+ alignOffset: args.alignOffset,
860
+ offsetOptions: args.offsetOptions,
861
+ strategy: args.strategy,
862
+ avoidCollisions: args.avoidCollisions,
863
+ collisionPadding: args.collisionPadding,
864
+ flipOptions: args.flipOptions,
865
+ shiftOptions: args.shiftOptions,
866
+ sticky: args.sticky,
867
+ hideWhenDetached: args.hideWhenDetached,
868
+ hideOptions: args.hideOptions,
869
+ arrow: args.arrow,
870
+ arrowPadding: args.arrowPadding,
871
+ middleware: args.middleware,
872
+ setData: this.setData
873
+ });
874
+ });
875
+ static {
876
+ setComponentTemplate(precompileTemplate("{{yield this.reference (if this.referenceElement this.floating) (hash setReference=this.setReference data=this.data)}}", {
877
+ strictMode: true,
878
+ scope: () => ({
879
+ hash
880
+ })
881
+ }), this);
882
+ }
883
+ }
884
+
885
+ export { ANCHOR_PROPERTIES as A, FloatingUI as F, anchor as a, anchorMode as b, anchorTo as c, exposeMetadata as e, flipTo as f, isAnchorFallbackForced as i, originFor as o, supportsAnchorPositioning as s, transformOrigin as t };
886
+ //# sourceMappingURL=component-DqLt83fo.js.map