@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,1109 @@
1
+ import Component from '@glimmer/component';
2
+ import { tracked } from '@glimmer/tracking';
3
+ import { hash } from '@ember/helper';
4
+ import { on } from '@ember/modifier';
5
+ import Modifier, { modifier } from 'ember-modifier';
6
+ import { registerDestructor, isDestroying, isDestroyed } from '@ember/destroyable';
7
+ import { As } from './as.js';
8
+ import { controllable } from './controllable-state.js';
9
+ import { getDirection } from './direction.js';
10
+ import { dismissable } from './dismiss.js';
11
+ import { focusFirst } from './focus.js';
12
+ import { addFocusGuards, createFocusScope } from './focus-scope.js';
13
+ import { inertOthers } from './hide-others.js';
14
+ import { idFor } from './id.js';
15
+ import { topLayer } from './layer.js';
16
+ import { link } from './link-helper.js';
17
+ import { part } from './part.js';
18
+ import { Presence } from './presence.js';
19
+ import { scrollLock } from './scroll-lock.js';
20
+ import { Typeahead, isTypeaheadKey, getNextMatch } from './typeahead.js';
21
+ import { a as anchor } from './component-DqLt83fo.js';
22
+ import '@floating-ui/dom';
23
+ import { isUndefined } from '@sindresorhus/is';
24
+ import { P as PopperArrow, p as popperOptions, c as exposeProperties, E as ElementRef, i as isPointInPolygon, e as ensureId } from './popper-BbTzV8dP.js';
25
+ import { State, Machine, transition, after } from '@switchyard-ts/core';
26
+ import { w as windowClock } from './delay-group-B1K03gBL.js';
27
+ import { h as hoverIntent, I as IntentState } from './hover-intent-Bxb83fgX.js';
28
+ import { precompileTemplate } from '@ember/template-compilation';
29
+ import { setComponentTemplate } from '@ember/component';
30
+ import templateOnly from '@ember/component/template-only';
31
+ import { n, g, i } from 'decorator-transforms/runtime';
32
+
33
+ // What Radix's DropdownMenu, ContextMenu and Menubar share, its `Menu`: a menu's content (focus, keys,
34
+ // typeahead and the pointer's grace area on the way to a submenu), its items, checkbox and radio
35
+ // items, labels, groups and separators, and its submenus. dropdown-menu.gts, context-menu.gts and
36
+ // menubar.gts are the public modules; this file is bundled into them.
37
+ //
38
+ // The parts find each other through the DOM rather than through what binds them: an item is the
39
+ // item of the nearest `role="menu"` above it (a submenu's content is rendered inside its
40
+ // parent's, as there is no portal), so `<m.Item>` works at any depth.
41
+ const SELECTION_KEYS = ['Enter', ' '];
42
+ const FIRST_KEYS = ['ArrowDown', 'PageUp', 'Home'];
43
+ const LAST_KEYS = ['ArrowUp', 'PageDown', 'End'];
44
+ const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
45
+ /** The keys that open a submenu from its trigger, as Radix's: the arrow pointing into it. */
46
+ const SUB_OPEN_KEYS = {
47
+ ltr: [...SELECTION_KEYS, 'ArrowRight'],
48
+ rtl: [...SELECTION_KEYS, 'ArrowLeft']
49
+ };
50
+ /** The keys that close a submenu from inside it: the arrow pointing back to its trigger. */
51
+ const SUB_CLOSE_KEYS = {
52
+ ltr: ['ArrowLeft'],
53
+ rtl: ['ArrowRight']
54
+ };
55
+ const ITEM = '[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]';
56
+ const MENU = '[role="menu"]';
57
+ // ----- State --------------------------------------------------------------------------------
58
+ /** A checkbox item's state: checked, unchecked, or `indeterminate` (shown as mixed). */
59
+ /** Radix's `data-state` for a checked state. */function checkedState(checked) {
60
+ if (checked === 'indeterminate') return 'indeterminate';
61
+ return checked ? 'checked' : 'unchecked';
62
+ }
63
+ /** A level of a menu, the root or a submenu, as its content and its own submenus see it. */
64
+
65
+ /**
66
+ * What every part of a menu reads from its root: a dropdown menu, a context menu, or a
67
+ * menubar's menu. dropdown-menu.gts, context-menu.gts and menubar.gts each implement it.
68
+ */
69
+
70
+ /**
71
+ * Whether the user is using the keyboard, as Radix's Menu tracks it for each root: a key press
72
+ * turns it on, and the pointer going down or moving turns it off. A menu opened by the keyboard
73
+ * moves focus to its first item, and one opened by the pointer doesn't. Where there is no
74
+ * document (a server render, as in FastBoot), it listens for nothing: no menu opens there.
75
+ */
76
+ class KeyboardIntent {
77
+ isUsingKeyboard = false;
78
+ constructor(owner) {
79
+ if (isUndefined(globalThis.document)) return;
80
+ const onPointer = () => this.isUsingKeyboard = false;
81
+ const onKeyDown = () => {
82
+ this.isUsingKeyboard = true;
83
+ document.addEventListener('pointerdown', onPointer, {
84
+ capture: true,
85
+ once: true
86
+ });
87
+ document.addEventListener('pointermove', onPointer, {
88
+ capture: true,
89
+ once: true
90
+ });
91
+ };
92
+ document.addEventListener('keydown', onKeyDown, {
93
+ capture: true
94
+ });
95
+ registerDestructor(owner, () => {
96
+ document.removeEventListener('keydown', onKeyDown, {
97
+ capture: true
98
+ });
99
+ document.removeEventListener('pointerdown', onPointer, {
100
+ capture: true
101
+ });
102
+ document.removeEventListener('pointermove', onPointer, {
103
+ capture: true
104
+ });
105
+ });
106
+ }
107
+ }
108
+ // ----- Content ------------------------------------------------------------------------------
109
+ /** The polygon a pointer may cross on its way from a submenu's trigger to its content. */
110
+
111
+ class GraceState extends State {
112
+ static Idle = GraceState.of('idle');
113
+ /** A grace intent is set, until `clearAfter` runs out. */
114
+ static Held = GraceState.of('held');
115
+ }
116
+ /** How long a grace intent lasts: `hold(ms)` drops it after `ms`, as Radix's timer does. */
117
+ class GraceTimer extends Machine {
118
+ // A window, not pending work: `settled()` doesn't wait for it to close.
119
+ static clock = windowClock;
120
+ #clearAfter = 0;
121
+ #expire;
122
+ constructor(expire) {
123
+ super();
124
+ this.#expire = expire;
125
+ }
126
+ get clearAfter() {
127
+ return this.#clearAfter;
128
+ }
129
+ hold(ms) {
130
+ this.#clearAfter = ms;
131
+ }
132
+ static {
133
+ n(this.prototype, "hold", [transition({
134
+ to: GraceState.Held,
135
+ reenter: true
136
+ })]);
137
+ }
138
+ cancel() {}
139
+ static {
140
+ n(this.prototype, "cancel", [transition({
141
+ to: GraceState.Idle
142
+ })]);
143
+ }
144
+ expired() {
145
+ this.#expire();
146
+ }
147
+ static {
148
+ n(this.prototype, "expired", [after('clearAfter', {
149
+ from: GraceState.Held,
150
+ to: GraceState.Idle
151
+ })]);
152
+ }
153
+ }
154
+ /** Whether an event came from a mouse: Radix's menus ignore pens and touch for hover. */
155
+ function isMouse(event) {
156
+ return event.pointerType === 'mouse';
157
+ }
158
+ /** The text an item matches typeahead with: `@textValue`, or its own text, trimmed. */
159
+ const textValues = new WeakMap();
160
+ function textOf(item) {
161
+ return textValues.get(item) ?? (item.textContent ?? '').replace(/\s+/g, ' ').trim();
162
+ }
163
+ function isDisabled(item) {
164
+ return item.hasAttribute('data-disabled');
165
+ }
166
+ /** The menu content an element is in: the nearest `role="menu"` above it. */
167
+ function contentElementOf(element) {
168
+ return element.closest(MENU);
169
+ }
170
+ const contents = new WeakMap();
171
+ /** The state of the menu content an element is in, if it is in one. */
172
+ function contentOf(element) {
173
+ const content = contentElementOf(element);
174
+ return content ? contents.get(content) : undefined;
175
+ }
176
+ /**
177
+ * One menu content's behaviour, as Radix's `MenuContentImpl`: the arrow keys, Home and End
178
+ * between its items, typeahead, Tab kept inside, focus moving to the first item when the
179
+ * keyboard opened it, and the pointer's grace area towards a submenu. It listens on the
180
+ * content's element, so it hears its items' events as they bubble.
181
+ */
182
+ class MenuContentState {
183
+ element;
184
+ level;
185
+ root;
186
+ #loop;
187
+ #typeahead = new Typeahead();
188
+ #pointerDir = 'right';
189
+ #lastPointerX = 0;
190
+ #graceIntent = null;
191
+ #graceTimer = new GraceTimer(() => this.#graceIntent = null);
192
+ constructor(element, level, root, {
193
+ loop
194
+ }) {
195
+ this.element = element;
196
+ this.level = level;
197
+ this.root = root;
198
+ this.#loop = loop;
199
+ }
200
+ /** Starts listening; returns the cleanup. */
201
+ install() {
202
+ const {
203
+ element
204
+ } = this;
205
+ contents.set(element, this);
206
+ this.#graceTimer.start();
207
+ const onKeyDown = event => this.#onKeyDown(event);
208
+ const onPointerMove = event => this.#onPointerMove(event);
209
+ const onFocusIn = event => this.#onFocusIn(event);
210
+ const onFocusOut = event => {
211
+ const next = event.relatedTarget;
212
+ if (!(next instanceof Node) || !element.contains(next)) this.#typeahead.reset();
213
+ };
214
+ element.addEventListener('keydown', onKeyDown);
215
+ element.addEventListener('pointermove', onPointerMove);
216
+ element.addEventListener('focusin', onFocusIn);
217
+ element.addEventListener('focusout', onFocusOut);
218
+ return () => {
219
+ element.removeEventListener('keydown', onKeyDown);
220
+ element.removeEventListener('pointermove', onPointerMove);
221
+ element.removeEventListener('focusin', onFocusIn);
222
+ element.removeEventListener('focusout', onFocusOut);
223
+ this.#typeahead.dispose();
224
+ this.#graceTimer.stop();
225
+ if (contents.get(element) === this) contents.delete(element);
226
+ };
227
+ }
228
+ /** Its own items (not a submenu's), in order, the disabled ones too. */
229
+ allItems() {
230
+ return [...this.element.querySelectorAll(ITEM)].filter(item => contentElementOf(item) === this.element);
231
+ }
232
+ /** Its items focus can go to, in order. */
233
+ items() {
234
+ return this.allItems().filter(item => !isDisabled(item));
235
+ }
236
+ /** Whether a search is under way, so Space types rather than presses the item. */
237
+ get isTypingAhead() {
238
+ return this.#typeahead.isTyping;
239
+ }
240
+ /** Focuses the first item, or the last (`reverse`), as Radix's `focusFirst`. */
241
+ focusEdge(last = false) {
242
+ const items = this.items();
243
+ if (last) items.reverse();
244
+ focusFirst(items, {
245
+ preventScroll: true
246
+ });
247
+ }
248
+ #onKeyDown(event) {
249
+ if (event.defaultPrevented) return;
250
+ const target = event.target;
251
+ const content = this.element;
252
+ // A key in a submenu inside this content bubbles here too; it is that submenu's.
253
+ const isInside = contentElementOf(target) === content;
254
+ if (isInside) {
255
+ if (event.key === 'Tab') event.preventDefault();
256
+ if (isTypeaheadKey(event)) this.#typeAhead(event.key);
257
+ if (target !== content && target.matches(ITEM)) this.#moveFocus(event, target);
258
+ }
259
+ if (target !== content || !FIRST_LAST_KEYS.includes(event.key)) return;
260
+ event.preventDefault();
261
+ this.focusEdge(LAST_KEYS.includes(event.key));
262
+ }
263
+ /** The arrow keys, Home and End, between the items, as Radix's vertical roving focus. */
264
+ #moveFocus(event, item) {
265
+ if (event.defaultPrevented) return;
266
+ const intent = INTENTS[event.key];
267
+ if (!intent) return;
268
+ if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
269
+ event.preventDefault();
270
+ let candidates = this.items();
271
+ if (intent === 'last') candidates.reverse();else if (intent === 'prev' || intent === 'next') {
272
+ if (intent === 'prev') candidates.reverse();
273
+ const index = candidates.indexOf(item);
274
+ candidates = this.#loop() ? candidates.map((_, offset) => candidates[(index + 1 + offset) % candidates.length]) : candidates.slice(index + 1);
275
+ }
276
+ focusFirst(candidates);
277
+ }
278
+ #typeAhead(key) {
279
+ const items = this.items();
280
+ const active = document.activeElement;
281
+ const current = items.find(item => item === active);
282
+ const match = getNextMatch(items, this.#typeahead.type(key), current, textOf);
283
+ match?.focus();
284
+ }
285
+ /**
286
+ * Focus on the content itself, not an item: move on to the first item when the keyboard is
287
+ * in use, as Radix's roving focus does on entry. The pointer leaves focus on the content.
288
+ */
289
+ #onFocusIn(event) {
290
+ if (event.target !== this.element || !this.root.isUsingKeyboard) return;
291
+ if (this.level === this.root && this.root.preventsEntryFocus) return;
292
+ this.focusEdge();
293
+ }
294
+ #onPointerMove(event) {
295
+ if (!isMouse(event)) return;
296
+ const target = event.target;
297
+ if (contentElementOf(target) !== this.element || this.#lastPointerX === event.clientX) return;
298
+ this.#pointerDir = event.clientX > this.#lastPointerX ? 'right' : 'left';
299
+ this.#lastPointerX = event.clientX;
300
+ }
301
+ // ----- The pointer's grace area, as Radix's menu works it out ----------------------------
302
+ /** Whether the pointer is heading into the submenu that is opening, through its grace area. */
303
+ isPointerMovingToSubmenu(event) {
304
+ const intent = this.#graceIntent;
305
+ if (!intent || this.#pointerDir !== intent.side) return false;
306
+ return isPointInPolygon({
307
+ x: event.clientX,
308
+ y: event.clientY
309
+ }, intent.area);
310
+ }
311
+ setGraceIntent(intent, clearAfter) {
312
+ this.#graceIntent = intent;
313
+ if (clearAfter === undefined) this.#graceTimer.cancel();else this.#graceTimer.hold(clearAfter);
314
+ }
315
+ // Radix's cancel the pointer event to say "on its way to a submenu", which React's events
316
+ // allow even when the browser's can't be cancelled (`pointerleave`); these return it instead.
317
+ /** The pointer moved onto an item: on its way to a submenu, it doesn't take focus (`true`). */
318
+ onItemEnter(event) {
319
+ return this.isPointerMovingToSubmenu(event);
320
+ }
321
+ /** The pointer left an item: focus goes back to the content, unless it is on its way to a submenu. */
322
+ onItemLeave(event) {
323
+ if (this.isPointerMovingToSubmenu(event)) return;
324
+ this.element.focus({
325
+ preventScroll: true
326
+ });
327
+ }
328
+ /** The pointer left a submenu's trigger: whether it is on its way to an open submenu. */
329
+ onTriggerLeave(event) {
330
+ return this.isPointerMovingToSubmenu(event);
331
+ }
332
+ }
333
+ const INTENTS = {
334
+ ArrowUp: 'prev',
335
+ ArrowDown: 'next',
336
+ PageUp: 'first',
337
+ Home: 'first',
338
+ PageDown: 'last',
339
+ End: 'last'
340
+ };
341
+ // ----- Content modifiers ----------------------------------------------------------------------
342
+
343
+ /**
344
+ * A content's focus scope, as Radix's menu has it: it takes focus in when it opens (the content
345
+ * decides where), keeps it inside while a modal menu is open, and decides where it goes when it
346
+ * closes; with focus guards at the ends of `<body>` meanwhile. One scope for the content's life.
347
+ */
348
+ class MenuFocus extends Modifier {
349
+ #scope;
350
+ #releaseGuards;
351
+ #installed = false;
352
+ modify(element, _, {
353
+ enabled,
354
+ trapped,
355
+ onMountAutoFocus,
356
+ onUnmountAutoFocus
357
+ }) {
358
+ if (!this.#installed) {
359
+ this.#installed = true;
360
+ registerDestructor(this, () => this.#stop());
361
+ }
362
+ const options = {
363
+ trapped,
364
+ loop: false,
365
+ onMountAutoFocus,
366
+ onUnmountAutoFocus
367
+ };
368
+ if (!enabled) return this.#stop();
369
+ if (this.#scope) return this.#scope.update(options);
370
+ this.#releaseGuards = addFocusGuards();
371
+ this.#scope = createFocusScope(element, options);
372
+ }
373
+ #stop() {
374
+ this.#scope?.destroy();
375
+ this.#scope = undefined;
376
+ this.#releaseGuards?.();
377
+ this.#releaseGuards = undefined;
378
+ }
379
+ }
380
+ /**
381
+ * While a modal menu is open, makes the rest of the page inert (its submenus are inside its
382
+ * content): nothing there can be focused or read by assistive technology. Radix's modal menu
383
+ * hides the page with `aria-hidden` instead, which leaves its buttons focusable but hidden, as
384
+ * axe reports; `inert` is what a modal `<dialog>` does, as Joinery's Dialog. A press there still
385
+ * reaches the document, so it closes the menu.
386
+ */
387
+ class InertOutside extends Modifier {
388
+ #undo;
389
+ #installed = false;
390
+ modify(element, _, {
391
+ enabled
392
+ }) {
393
+ if (!this.#installed) {
394
+ this.#installed = true;
395
+ registerDestructor(this, () => this.#release());
396
+ }
397
+ if (!enabled) return this.#release();
398
+ this.#undo ??= inertOthers(element);
399
+ }
400
+ #release() {
401
+ this.#undo?.();
402
+ this.#undo = undefined;
403
+ }
404
+ }
405
+ /** Anchors a content to its reference (an element, or a context menu's point), again on change. */const anchorMenu = modifier((element, [reference, options]) => {
406
+ if (!reference || reference === element) return;
407
+ return anchor(element, reference, options);
408
+ });
409
+ // ----- Items --------------------------------------------------------------------------------
410
+ /** The arguments every item takes, as its part modifier's named arguments too. */
411
+
412
+ /** Items a pointer went down on, so the pointer coming up doesn't select them twice. */const pressed = new WeakSet();
413
+ /** Selects an item, as Radix's `MenuItem` does: `onSelect`, then the menu closes unless it was prevented. */
414
+ function select(root, item, {
415
+ disabled,
416
+ onSelect
417
+ }, internal) {
418
+ if (disabled) return;
419
+ const event = new CustomEvent('menu.itemSelect', {
420
+ bubbles: true,
421
+ cancelable: true
422
+ });
423
+ item.addEventListener('menu.itemSelect', selected => {
424
+ onSelect?.(selected);
425
+ internal?.();
426
+ }, {
427
+ once: true
428
+ });
429
+ item.dispatchEvent(event);
430
+ if (event.defaultPrevented) pressed.delete(item);else root.close();
431
+ }
432
+ /** The listeners an item and a submenu's trigger both have: pointer focus, highlight, disabled presses. */
433
+ function hoverListeners(disabled) {
434
+ return {
435
+ pointermove: event => {
436
+ if (!isMouse(event)) return;
437
+ const item = event.currentTarget;
438
+ const content = contentOf(item);
439
+ if (disabled) return content?.onItemLeave(event);
440
+ if (!content?.onItemEnter(event)) item.focus({
441
+ preventScroll: true
442
+ });
443
+ },
444
+ pointerleave: event => {
445
+ if (isMouse(event)) contentOf(event.currentTarget)?.onItemLeave(event);
446
+ },
447
+ // A disabled item takes no focus from a click either.
448
+ mousedown: event => {
449
+ if (disabled) event.preventDefault();
450
+ },
451
+ focus: event => event.currentTarget.setAttribute('data-highlighted', ''),
452
+ blur: event => event.currentTarget.removeAttribute('data-highlighted')
453
+ };
454
+ }
455
+ /** What an item's part sets, whatever its role: `menuitem`, `menuitemcheckbox`, `menuitemradio`. */
456
+ function itemSpec(root, options, {
457
+ part: partName,
458
+ role,
459
+ attributes = {},
460
+ onSelect
461
+ }) {
462
+ const disabled = options.disabled ?? false;
463
+ return {
464
+ attributes: {
465
+ role,
466
+ tabindex: '-1',
467
+ 'aria-disabled': disabled ? 'true' : undefined,
468
+ 'data-disabled': disabled ? '' : undefined,
469
+ 'data-test-jn-part': partName,
470
+ ...attributes
471
+ },
472
+ on: {
473
+ ...hoverListeners(disabled),
474
+ click: event => select(root, event.currentTarget, options, onSelect),
475
+ pointerdown: event => void pressed.add(event.currentTarget),
476
+ // Pressed elsewhere (on the trigger) and let go here: select it, as Radix's menus do.
477
+ pointerup: event => {
478
+ const item = event.currentTarget;
479
+ if (!pressed.has(item)) item.click();
480
+ pressed.delete(item);
481
+ },
482
+ keydown: event => {
483
+ const item = event.currentTarget;
484
+ if (disabled) return;
485
+ if (contentOf(item)?.isTypingAhead && event.key === ' ') return;
486
+ if (!SELECTION_KEYS.includes(event.key)) return;
487
+ item.click();
488
+ event.preventDefault();
489
+ }
490
+ }
491
+ };
492
+ }
493
+ /**
494
+ * A part modifier that also keeps the item's `textValue` for typeahead: `part()`'s spec sees
495
+ * only the arguments, not the element.
496
+ */
497
+ function withTextValue(Base) {
498
+ return class extends Base {
499
+ modify(element, positional, named) {
500
+ if (named.textValue === undefined) textValues.delete(element);else textValues.set(element, named.textValue);
501
+ super.modify(element, positional, named);
502
+ }
503
+ };
504
+ }
505
+ /**
506
+ * What a styled layer adds to an item's modifier: its classes and attributes (`data-slot`,
507
+ * `data-variant`…), from the modifier's own arguments.
508
+ */
509
+
510
+ /**
511
+ * What a styled layer adds to a modifier a part yields (a Sub's `trigger`, a RadioGroup's
512
+ * `item`, a Context Menu's `trigger`), from the modifier's arguments: the primitive's own and
513
+ * any the styled layer adds (`inset`). It takes it as `@triggerLook` or `@itemLook`, so the
514
+ * modifier renders what the styled part does.
515
+ */
516
+ function withLook(spec, named, look) {
517
+ if (!look) return spec;
518
+ const extra = look(named);
519
+ return {
520
+ ...spec,
521
+ class: extra.class,
522
+ attributes: {
523
+ ...extra.attributes,
524
+ ...spec.attributes
525
+ }
526
+ };
527
+ }
528
+ /**
529
+ * A plain item's modifier for a menu's root: `<a {{m.item}}>`, `<LinkTo {{m.item onSelect=…}}>`.
530
+ * A styled layer passes its `look`, so the modifier renders what its Item does.
531
+ */
532
+ function itemPart(root, look) {
533
+ return withTextValue(part(options => withLook(itemSpec(root, options, {
534
+ part: 'item',
535
+ role: 'menuitem'
536
+ }), options, look)));
537
+ }
538
+ /** What a checkbox item's modifier takes: its state, controlled. */
539
+
540
+ /** A checkbox item's modifier: `role="menuitemcheckbox"`, its `aria-checked` and `data-state`. */function checkboxItemPart(root, look) {
541
+ return withTextValue(part(options => {
542
+ const checked = options.checked ?? false;
543
+ const spec = itemSpec(root, options, {
544
+ part: 'checkbox-item',
545
+ role: 'menuitemcheckbox',
546
+ attributes: {
547
+ 'aria-checked': checked === 'indeterminate' ? 'mixed' : String(checked),
548
+ 'data-state': checkedState(checked)
549
+ },
550
+ onSelect: () => options.onCheckedChange?.(checked === 'indeterminate' ? true : !checked)
551
+ });
552
+ return withLook(spec, options, look);
553
+ }));
554
+ }
555
+ /** The parts with no state of their own: a group, a label, a separator. */
556
+ const groupPart = part(() => ({
557
+ attributes: {
558
+ role: 'group',
559
+ 'data-test-jn-part': 'group'
560
+ }
561
+ }));
562
+ const labelPart = part(() => ({
563
+ attributes: {
564
+ 'data-test-jn-part': 'label'
565
+ }
566
+ }));
567
+ const separatorPart = part(() => ({
568
+ attributes: {
569
+ role: 'separator',
570
+ 'aria-orientation': 'horizontal',
571
+ 'data-test-jn-part': 'separator'
572
+ }
573
+ }));
574
+ // ----- The part components ------------------------------------------------------------------
575
+
576
+ /** An item: selecting it calls `@onSelect` and closes the menu. */const MenuItem = setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"div\" ...attributes {{@part disabled=@disabled onSelect=@onSelect textValue=@textValue}}>{{yield}}</As>", {
577
+ strictMode: true,
578
+ scope: () => ({
579
+ As
580
+ })
581
+ }), templateOnly());
582
+ /**
583
+ * ember-primitives' `LinkItem`: an item that is a link, active-aware (`data-active`,
584
+ * `aria-current`), opening a link to another origin in a new tab. Selecting it closes the menu
585
+ * and follows the link.
586
+ */
587
+ const MenuLinkItem = setComponentTemplate(precompileTemplate("{{#let (link @href includeActiveQueryParams=@includeActiveQueryParams activeOnSubPaths=@activeOnSubPaths) as |l|}}\n {{#if l.isExternal}}\n <a href={{@href}} target=\"_blank\" rel=\"noreferrer noopener\" ...attributes {{@part disabled=@disabled onSelect=@onSelect textValue=@textValue}}>{{yield (hash isActive=false isExternal=true)}}</a>\n {{else}}\n <a href={{@href}} data-active={{l.isActive}} aria-current={{if l.isActive (if @activeOnSubPaths \"true\" \"page\")}} ...attributes {{@part disabled=@disabled onSelect=@onSelect textValue=@textValue}} {{on \"click\" l.handleClick}}>{{yield (hash isActive=l.isActive isExternal=false)}}</a>\n {{/if}}\n{{/let}}", {
588
+ strictMode: true,
589
+ scope: () => ({
590
+ link,
591
+ hash,
592
+ on
593
+ })
594
+ }), templateOnly());
595
+ function shows(checked, forceMount) {
596
+ return Boolean(forceMount) || checked === true || checked === 'indeterminate';
597
+ }
598
+ /** Radix's `ItemIndicator`: a `<span>` shown while its item is checked (or indeterminate). */
599
+ const MenuItemIndicator = setComponentTemplate(precompileTemplate("<Presence @present={{shows @checked @forceMount}} as |presence|>\n <span data-state={{checkedState @checked}} data-test-jn-part=\"item-indicator\" ...attributes {{presence.ref}}>{{yield}}</span>\n</Presence>", {
600
+ strictMode: true,
601
+ scope: () => ({
602
+ Presence,
603
+ shows,
604
+ checkedState
605
+ })
606
+ }), templateOnly());
607
+ /** What a checkbox item yields: its indicator, bound to its state, and the state. */
608
+
609
+ /**
610
+ * A checkbox item: selecting it asks for the other state (an indeterminate one, for checked)
611
+ * and closes the menu. As Radix's, its state is yours: `@checked` with `@onCheckedChange`. (A
612
+ * menu's content is gone while it is closed, so it has nowhere to keep a state of its own.)
613
+ */
614
+ class MenuCheckboxItem extends Component {
615
+ get checked() {
616
+ return this.args.checked ?? false;
617
+ }
618
+ static {
619
+ setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"div\" ...attributes {{@part checked=this.checked onCheckedChange=@onCheckedChange disabled=@disabled onSelect=@onSelect textValue=@textValue}}>{{yield (hash Indicator=(component MenuItemIndicator checked=this.checked) checked=this.checked)}}</As>", {
620
+ strictMode: true,
621
+ scope: () => ({
622
+ As,
623
+ hash,
624
+ MenuItemIndicator
625
+ })
626
+ }), this);
627
+ }
628
+ }
629
+ /** What a radio item's modifier takes. */
630
+
631
+ /** A radio item: selecting it makes its value the group's, and closes the menu. */class MenuRadioItem extends Component {
632
+ get checked() {
633
+ return this.args.group.value === this.args.value;
634
+ }
635
+ static {
636
+ setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"div\" ...attributes {{@group.item value=@value disabled=@disabled onSelect=@onSelect textValue=@textValue}}>{{yield (hash Indicator=(component MenuItemIndicator checked=this.checked) checked=this.checked)}}</As>", {
637
+ strictMode: true,
638
+ scope: () => ({
639
+ As,
640
+ hash,
641
+ MenuItemIndicator
642
+ })
643
+ }), this);
644
+ }
645
+ }
646
+ /** What a radio group yields: its items, and its value. */
647
+
648
+ /**
649
+ * A group of radio items, the one whose value is `@value` checked; selecting another calls
650
+ * `@onValueChange` with its value. As Radix's, its state is yours. A `role="group"`.
651
+ */
652
+ class MenuRadioGroup extends Component {
653
+ get value() {
654
+ return this.args.value;
655
+ }
656
+ item = withTextValue(part(options => {
657
+ const checked = this.value !== undefined && this.value === options.value;
658
+ const spec = itemSpec(this.args.menu, options, {
659
+ part: 'radio-item',
660
+ role: 'menuitemradio',
661
+ attributes: {
662
+ 'aria-checked': String(checked),
663
+ 'data-state': checkedState(checked),
664
+ 'data-test-jn-value': options.value
665
+ },
666
+ onSelect: () => this.args.onValueChange?.(options.value)
667
+ });
668
+ return withLook(spec, {
669
+ ...options
670
+ }, this.args.itemLook);
671
+ }));
672
+ static {
673
+ setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"div\" role=\"group\" data-test-jn-part=\"radio-group\" ...attributes>{{yield (hash Item=(component MenuRadioItem group=this) item=this.item value=this.value)}}</As>", {
674
+ strictMode: true,
675
+ scope: () => ({
676
+ As,
677
+ hash,
678
+ MenuRadioItem
679
+ })
680
+ }), this);
681
+ }
682
+ }
683
+ /** A group of items: a `role="group"`. */const MenuGroup = setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"div\" ...attributes {{@part}}>{{yield}}</As>", {
684
+ strictMode: true,
685
+ scope: () => ({
686
+ As
687
+ })
688
+ }), templateOnly());
689
+ /** A label for the items after it (Radix's is a plain `div`, which nothing names). */
690
+ const MenuLabel = setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"div\" ...attributes {{@part}}>{{yield}}</As>", {
691
+ strictMode: true,
692
+ scope: () => ({
693
+ As
694
+ })
695
+ }), templateOnly());
696
+ /** A line between items: a horizontal `role="separator"`. */const MenuSeparator = setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"div\" ...attributes {{@part}} />", {
697
+ strictMode: true,
698
+ scope: () => ({
699
+ As
700
+ })
701
+ }), templateOnly());
702
+ /**
703
+ * Radix's `Portal`, kept so upstream's markup ports line for line: it renders its block where
704
+ * it is. A menu's contents are in the top layer, above everything, so they need no portal.
705
+ */
706
+ const MenuPortal = setComponentTemplate(precompileTemplate("{{yield}}", {
707
+ strictMode: true
708
+ }), templateOnly());
709
+ /** Radix's `Arrow`: an `<svg>` triangle on the content's edge, pointing at the trigger. */const MenuArrow = setComponentTemplate(precompileTemplate("{{#if (has-block)}}\n <PopperArrow @arrow={{@arrow}} @width={{@width}} @height={{@height}} ...attributes>\n {{yield}}\n </PopperArrow>\n{{else}}\n <PopperArrow @arrow={{@arrow}} @width={{@width}} @height={{@height}} ...attributes />\n{{/if}}", {
710
+ strictMode: true,
711
+ scope: () => ({
712
+ PopperArrow
713
+ })
714
+ }), templateOnly());
715
+ // ----- Submenus -----------------------------------------------------------------------------
716
+ /** What a submenu's content takes: Radix's Popper arguments but its side, and its handlers. */
717
+
718
+ /** The item that opens a submenu: hovering it, clicking it, or the arrow pointing into it. */const MenuSubTrigger = setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"div\" ...attributes {{@part disabled=@disabled textValue=@textValue}}>{{yield}}</As>", {
719
+ strictMode: true,
720
+ scope: () => ({
721
+ As
722
+ })
723
+ }), templateOnly());
724
+ /**
725
+ * A submenu's content: beside its trigger (on the right, or the left right to left), aligned
726
+ * with its top, in the top layer while open. ArrowLeft (ArrowRight right to left) goes back to
727
+ * the trigger; Escape closes the whole menu.
728
+ */
729
+ class MenuSubContent extends Component {
730
+ get sub() {
731
+ return this.args.sub;
732
+ }
733
+ /** Radix's: beside the trigger, on the side the text reads towards, aligned with its top. */
734
+ get anchorOptions() {
735
+ const {
736
+ sub
737
+ } = this;
738
+ const rtl = getDirection(sub.triggerRef.value, sub.root.explicitDir) === 'rtl';
739
+ const options = popperOptions(this.args, {}, {}, {});
740
+ return {
741
+ ...options,
742
+ side: rtl ? 'left' : 'right',
743
+ align: 'start'
744
+ };
745
+ }
746
+ get inside() {
747
+ return [this.sub.triggerRef.value];
748
+ }
749
+ contentPart = part(() => {
750
+ const {
751
+ sub
752
+ } = this;
753
+ return {
754
+ attributes: {
755
+ id: sub.contentId,
756
+ role: 'menu',
757
+ 'aria-orientation': 'vertical',
758
+ 'aria-labelledby': sub.triggerId,
759
+ 'data-state': sub.isOpen ? 'open' : 'closed',
760
+ dir: sub.root.explicitDir,
761
+ tabindex: '-1',
762
+ 'data-test-jn-part': 'sub-content',
763
+ 'data-test-jn-owner': sub.root.id
764
+ },
765
+ element: element => {
766
+ const restore = exposeProperties(element, sub.root.cssName);
767
+ const state = new MenuContentState(element, sub, sub.root, {
768
+ loop: () => this.args.loop ?? false
769
+ });
770
+ const uninstall = state.install();
771
+ sub.contentRef.set(element);
772
+ const onKeyDown = event => this.#onKeyDown(event, element);
773
+ element.addEventListener('keydown', onKeyDown);
774
+ return () => {
775
+ element.removeEventListener('keydown', onKeyDown);
776
+ sub.contentRef.release(element);
777
+ uninstall();
778
+ restore();
779
+ };
780
+ }
781
+ };
782
+ });
783
+ /** The arrow back towards the trigger closes it and puts focus back there. */
784
+ #onKeyDown(event, element) {
785
+ if (event.defaultPrevented) return;
786
+ const target = event.target;
787
+ const dir = getDirection(element, this.sub.root.explicitDir);
788
+ if (!element.contains(target) || !SUB_CLOSE_KEYS[dir].includes(event.key)) return;
789
+ this.sub.setOpen(false);
790
+ this.sub.triggerRef.current?.focus();
791
+ event.preventDefault();
792
+ }
793
+ onOpenAutoFocus = event => {
794
+ // Opened by the keyboard: focus goes in (and on to the first item); by the pointer, it stays.
795
+ if (this.sub.root.isUsingKeyboard) this.sub.contentRef.current?.focus({
796
+ preventScroll: true
797
+ });
798
+ event.preventDefault();
799
+ };
800
+ onCloseAutoFocus = event => event.preventDefault();
801
+ onEscapeKeyDown = event => {
802
+ this.args.onEscapeKeyDown?.(event);
803
+ if (event.defaultPrevented) return;
804
+ this.sub.root.close();
805
+ event.preventDefault();
806
+ };
807
+ onFocusOutside = event => this.args.onFocusOutside?.(event);
808
+ /** Focus leaving it closes it; a press outside leaves that to the menu it is in. */
809
+ onDismiss = reason => {
810
+ if (reason === 'focus-outside') this.sub.setOpen(false);
811
+ };
812
+ static {
813
+ setComponentTemplate(precompileTemplate("<Presence @present={{this.sub.isOpen}} @forceMount={{@forceMount}} as |presence|>\n <As @as={{@as}} @tag=\"div\" ...attributes {{presence.ref}} {{this.contentPart}} {{topLayer}} {{anchorMenu this.sub.triggerRef.value this.anchorOptions}} {{dismissable enabled=this.sub.isOpen onDismiss=this.onDismiss onEscapeKeyDown=this.onEscapeKeyDown onPointerDownOutside=@onPointerDownOutside onFocusOutside=this.onFocusOutside onInteractOutside=@onInteractOutside inside=this.inside}} {{MenuFocus enabled=this.sub.isOpen trapped=false onMountAutoFocus=this.onOpenAutoFocus onUnmountAutoFocus=this.onCloseAutoFocus}}>{{yield}}</As>\n</Presence>", {
814
+ strictMode: true,
815
+ scope: () => ({
816
+ Presence,
817
+ As,
818
+ topLayer,
819
+ anchorMenu,
820
+ dismissable,
821
+ MenuFocus
822
+ })
823
+ }), this);
824
+ }
825
+ }
826
+ /** What a submenu yields: its trigger and content, the trigger's modifier, and its state. */
827
+
828
+ /**
829
+ * A submenu, as Radix's `Sub`: it yields its Trigger and Content. Its state is its own, or
830
+ * yours (`@open`, `@onOpenChange`, `@defaultOpen`), and it is shown only while every menu it is
831
+ * in is open. As Radix's, it closes (`@onOpenChange(false)`) when the menu it is in closes and
832
+ * when it goes away, so a submenu your state holds open isn't open again the next time its menu
833
+ * opens.
834
+ */
835
+ class MenuSub extends Component {
836
+ openState = controllable(this, 'open', false);
837
+ triggerRef = new ElementRef();
838
+ contentRef = new ElementRef();
839
+ /** The pointer resting on the trigger opens it after `openDelay`. */
840
+ openDelay = 100;
841
+ closeDelay = 0;
842
+ openTimer = hoverIntent(this, this);
843
+ /** The menu it is in, found from its trigger's place once it renders. */
844
+ static {
845
+ g(this.prototype, "parent", [tracked]);
846
+ }
847
+ #parent = (i(this, "parent"), void 0);
848
+ constructor(owner, args) {
849
+ super(owner, args);
850
+ registerDestructor(this, () => {
851
+ // Radix's MenuSub calls `onOpenChange(false)` as it unmounts.
852
+ this.setOpen(false);
853
+ });
854
+ }
855
+ get root() {
856
+ return this.args.menu;
857
+ }
858
+ /** The menu it is in: the submenu its trigger is in, or the root. */
859
+ get parentLevel() {
860
+ return this.parent ?? this.root;
861
+ }
862
+ get isOpen() {
863
+ return this.openState.value && this.parentLevel.isOpen;
864
+ }
865
+ /**
866
+ * Radix's "prevent the parent menu from reopening with open submenus": while the menu it is in
867
+ * is closed, it closes too. The template calls it with that menu's state, so it runs whenever
868
+ * the state changes, however it changed (`@open` in your state, too); the close waits for the
869
+ * render to end, which can't change state it has read.
870
+ */
871
+ closeWithParent = parentOpen => {
872
+ if (parentOpen) return undefined;
873
+ queueMicrotask(() => {
874
+ if (isDestroying(this) || isDestroyed(this) || this.parentLevel.isOpen) return;
875
+ this.setOpen(false);
876
+ });
877
+ return undefined;
878
+ };
879
+ get contentId() {
880
+ return idFor(this, 'content');
881
+ }
882
+ get triggerId() {
883
+ return this.triggerRef.value?.id || idFor(this, 'trigger');
884
+ }
885
+ setOpen = open => {
886
+ if (!open) this.openTimer.cancel();
887
+ this.openState.set(open);
888
+ };
889
+ trigger = withTextValue(part(options => {
890
+ const disabled = options.disabled ?? false;
891
+ const open = this.isOpen;
892
+ const hover = hoverListeners(disabled);
893
+ const spec = {
894
+ attributes: {
895
+ role: 'menuitem',
896
+ tabindex: '-1',
897
+ 'aria-haspopup': 'menu',
898
+ 'aria-expanded': String(open),
899
+ 'aria-controls': this.contentId,
900
+ 'aria-disabled': disabled ? 'true' : undefined,
901
+ 'data-disabled': disabled ? '' : undefined,
902
+ 'data-state': open ? 'open' : 'closed',
903
+ 'data-test-jn-part': 'sub-trigger'
904
+ },
905
+ on: {
906
+ ...hover,
907
+ click: event => {
908
+ if (disabled) return;
909
+ event.currentTarget.focus();
910
+ if (!this.isOpen) this.setOpen(true);
911
+ },
912
+ pointermove: event => {
913
+ if (!isMouse(event)) return;
914
+ const content = contentOf(event.currentTarget);
915
+ if (content?.onItemEnter(event)) return;
916
+ if (!disabled && !this.isOpen && !this.openTimer.matches(IntentState.Opening)) {
917
+ content?.setGraceIntent(null);
918
+ this.openTimer.enter();
919
+ }
920
+ hover.pointermove?.(event);
921
+ },
922
+ pointerleave: event => {
923
+ if (!isMouse(event)) return;
924
+ this.openTimer.cancel();
925
+ const content = contentOf(event.currentTarget);
926
+ const sub = this.contentRef.current;
927
+ const rect = sub?.getBoundingClientRect();
928
+ if (sub && rect) {
929
+ const side = sub.dataset['side'];
930
+ const right = side === 'right';
931
+ const bleed = right ? -5 : 5;
932
+ const near = rect[right ? 'left' : 'right'];
933
+ const far = rect[right ? 'right' : 'left'];
934
+ content?.setGraceIntent({
935
+ area: [
936
+ // A little back towards the trigger, so the exit point is inside the area.
937
+ {
938
+ x: event.clientX + bleed,
939
+ y: event.clientY
940
+ }, {
941
+ x: near,
942
+ y: rect.top
943
+ }, {
944
+ x: far,
945
+ y: rect.top
946
+ }, {
947
+ x: far,
948
+ y: rect.bottom
949
+ }, {
950
+ x: near,
951
+ y: rect.bottom
952
+ }],
953
+ side
954
+ }, 300);
955
+ } else {
956
+ if (content?.onTriggerLeave(event)) return;
957
+ content?.setGraceIntent(null);
958
+ }
959
+ hover.pointerleave?.(event);
960
+ },
961
+ keydown: event => {
962
+ const trigger = event.currentTarget;
963
+ if (disabled) return;
964
+ if (contentOf(trigger)?.isTypingAhead && event.key === ' ') return;
965
+ const dir = getDirection(trigger, this.root.explicitDir);
966
+ if (!SUB_OPEN_KEYS[dir].includes(event.key)) return;
967
+ this.setOpen(true);
968
+ this.contentRef.current?.focus();
969
+ event.preventDefault();
970
+ }
971
+ },
972
+ element: element => {
973
+ this.triggerRef.set(element);
974
+ const restoreId = ensureId(element, idFor(this, 'trigger'));
975
+ queueMicrotask(() => {
976
+ const level = contentOf(element)?.level;
977
+ if (level && level !== this.parent) this.parent = level;
978
+ });
979
+ return () => {
980
+ restoreId();
981
+ this.triggerRef.release(element);
982
+ };
983
+ }
984
+ };
985
+ return withLook(spec, {
986
+ ...options
987
+ }, this.args.triggerLook);
988
+ }));
989
+ static {
990
+ setComponentTemplate(precompileTemplate("{{this.closeWithParent this.parentLevel.isOpen}}\n{{yield (hash Trigger=(component MenuSubTrigger part=this.trigger) Content=(component MenuSubContent sub=this) trigger=this.trigger isOpen=this.isOpen setOpen=this.setOpen)}}", {
991
+ strictMode: true,
992
+ scope: () => ({
993
+ hash,
994
+ MenuSubTrigger,
995
+ MenuSubContent
996
+ })
997
+ }), this);
998
+ }
999
+ }
1000
+ // ----- The root content -----------------------------------------------------------------------
1001
+ /** What a menu's content takes: where it goes (Radix's Popper arguments) and what it does. */
1002
+
1003
+ /** What a root does for its content, which differs between a dropdown and a context menu. */
1004
+
1005
+ /** What a menu's content yields, as ember-primitives' Menu's Content does. */
1006
+
1007
+ /**
1008
+ * A menu's content, as Radix's `MenuContent`: a `role="menu"` in the top layer while open,
1009
+ * placed against its trigger, with focus moving in (to the first item, when the keyboard
1010
+ * opened it), the arrow keys and typeahead between its items, Escape or a press outside closing
1011
+ * it, and focus going back when it closes. A modal menu (the default) keeps focus inside, the
1012
+ * pointer off the rest of the page, makes it inert and stops it scrolling.
1013
+ */
1014
+ class MenuContent extends Component {
1015
+ get menu() {
1016
+ return this.args.menu;
1017
+ }
1018
+ get anchorOptions() {
1019
+ const {
1020
+ menu
1021
+ } = this;
1022
+ const options = popperOptions(this.args, menu.positioning, menu.contentDefaults, {
1023
+ arrow: menu.arrowRef.value
1024
+ });
1025
+ return {
1026
+ ...options,
1027
+ ...menu.contentForced
1028
+ };
1029
+ }
1030
+ /** While a modal menu is open, the rest of the page is out of reach. */
1031
+ get isModalOpen() {
1032
+ return this.menu.isModal && this.menu.isOpen;
1033
+ }
1034
+ /** Focus is taken in and kept while it is shown; a force-mounted content that is closed is left alone. */
1035
+ get scopesFocus() {
1036
+ return this.menu.isOpen || !this.args.forceMount;
1037
+ }
1038
+ contentPart = part(() => {
1039
+ const {
1040
+ menu
1041
+ } = this;
1042
+ return {
1043
+ attributes: {
1044
+ id: menu.contentId,
1045
+ role: 'menu',
1046
+ 'aria-orientation': 'vertical',
1047
+ 'aria-labelledby': menu.labelledBy,
1048
+ 'data-state': menu.isOpen ? 'open' : 'closed',
1049
+ dir: menu.explicitDir,
1050
+ tabindex: '-1',
1051
+ 'data-test-jn-part': 'content',
1052
+ 'data-test-jn-owner': menu.id
1053
+ },
1054
+ element: element => {
1055
+ const restore = exposeProperties(element, menu.cssName);
1056
+ const state = new MenuContentState(element, menu, menu, {
1057
+ loop: () => this.args.loop ?? false
1058
+ });
1059
+ const uninstall = state.install();
1060
+ const onKeyDown = event => this.menu.onContentKeyDown?.(event);
1061
+ element.addEventListener('keydown', onKeyDown);
1062
+ return () => {
1063
+ element.removeEventListener('keydown', onKeyDown);
1064
+ uninstall();
1065
+ restore();
1066
+ };
1067
+ }
1068
+ };
1069
+ });
1070
+ /** Focus goes to the content itself, and on to the first item when the keyboard is in use. */
1071
+ onOpenAutoFocus = event => {
1072
+ event.preventDefault();
1073
+ const content = event.target;
1074
+ content.focus({
1075
+ preventScroll: true
1076
+ });
1077
+ };
1078
+ onCloseAutoFocus = event => this.menu.closeAutoFocus(event, this.args.onCloseAutoFocus);
1079
+ onEscapeKeyDown = event => this.args.onEscapeKeyDown?.(event);
1080
+ onFocusOutside = event => {
1081
+ this.args.onFocusOutside?.(event);
1082
+ // Focus stays inside a modal menu, so focus outside never closes one.
1083
+ if (this.menu.isModal) event.preventDefault();
1084
+ };
1085
+ onInteractOutside = event => this.menu.interactOutside(event, this.args.onInteractOutside);
1086
+ static {
1087
+ setComponentTemplate(precompileTemplate("<Presence @present={{this.menu.isOpen}} @forceMount={{@forceMount}} as |presence|>\n <As @as={{@as}} @tag=\"div\" ...attributes {{presence.ref}} {{this.contentPart}} {{topLayer}} {{anchorMenu this.menu.reference this.anchorOptions}} {{dismissable enabled=this.menu.isOpen onDismiss=this.menu.dismiss onEscapeKeyDown=this.onEscapeKeyDown onPointerDownOutside=@onPointerDownOutside onFocusOutside=this.onFocusOutside onInteractOutside=this.onInteractOutside disableOutsidePointerEvents=this.isModalOpen inside=this.menu.inside}} {{MenuFocus enabled=this.scopesFocus trapped=this.isModalOpen onMountAutoFocus=this.onOpenAutoFocus onUnmountAutoFocus=this.onCloseAutoFocus}} {{InertOutside enabled=this.isModalOpen}} {{scrollLock enabled=this.isModalOpen}}>{{yield (hash Item=(component MenuItem part=@itemPart) LinkItem=(component MenuLinkItem part=@itemPart) Separator=(component MenuSeparator part=separatorPart))}}</As>\n</Presence>", {
1088
+ strictMode: true,
1089
+ scope: () => ({
1090
+ Presence,
1091
+ As,
1092
+ topLayer,
1093
+ anchorMenu,
1094
+ dismissable,
1095
+ MenuFocus,
1096
+ InertOutside,
1097
+ scrollLock,
1098
+ hash,
1099
+ MenuItem,
1100
+ MenuLinkItem,
1101
+ MenuSeparator,
1102
+ separatorPart
1103
+ })
1104
+ }), this);
1105
+ }
1106
+ }
1107
+
1108
+ export { KeyboardIntent as K, MenuArrow as M, MenuSub as a, MenuSeparator as b, checkboxItemPart as c, MenuRadioGroup as d, MenuCheckboxItem as e, MenuLinkItem as f, MenuItem as g, MenuLabel as h, itemPart as i, groupPart as j, MenuGroup as k, labelPart as l, MenuPortal as m, MenuContent as n, separatorPart as s, withLook as w };
1109
+ //# sourceMappingURL=menu-Da1LFCet.js.map