@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,1054 @@
1
+ import Component from '@glimmer/component';
2
+ import { tracked, cached } from '@glimmer/tracking';
3
+ import { hash } from '@ember/helper';
4
+ import { registerDestructor, isDestroying, isDestroyed } from '@ember/destroyable';
5
+ import { buildWaiter } from '@ember/test-waiters';
6
+ import Modifier, { modifier } from 'ember-modifier';
7
+ import { As } from './as.js';
8
+ import { controllable } from './controllable-state.js';
9
+ import { Dialog } from './dialog.js';
10
+ import { idFor } from './id.js';
11
+ import { isMac } from './keys.js';
12
+ import { part } from './part.js';
13
+ import { VisuallyHidden, visuallyHidden } from './visually-hidden.js';
14
+ import { translate, t } from './i18n.js';
15
+ import { messages } from './messages.js';
16
+ import { precompileTemplate } from '@ember/template-compilation';
17
+ import { setComponentTemplate } from '@ember/component';
18
+ import templateOnly from '@ember/component/template-only';
19
+ import { g, i, n } from 'decorator-transforms/runtime';
20
+
21
+ /*!
22
+ * The command score below is ported from cmdk 1.1.1 (https://github.com/dip/cmdk), which
23
+ * Joinery's Command follows as shadcn/ui's does.
24
+ *
25
+ * MIT License
26
+ *
27
+ * Copyright (c) 2022 Paco Coursey
28
+ *
29
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
30
+ * of this software and associated documentation files (the "Software"), to deal
31
+ * in the Software without restriction, including without limitation the rights
32
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
33
+ * copies of the Software, and to permit persons to whom the Software is
34
+ * furnished to do so, subject to the following conditions:
35
+ *
36
+ * The above copyright notice and this permission notice shall be included in all
37
+ * copies or substantial portions of the Software.
38
+ *
39
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
40
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
41
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
42
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
43
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
44
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
45
+ * SOFTWARE.
46
+ */
47
+
48
+ // How well a search matches an item's text: cmdk's `command-score`, itself after Superhuman's
49
+ // command-score, ported line for line so a Joinery Command ranks its items as shadcn's does.
50
+ // Bundled into command.gts. cmdk's notice is above and in NOTICE.
51
+
52
+ // The score when the characters match one after another, from the start.
53
+ const SCORE_CONTINUE_MATCH = 1;
54
+ // The search jumps to the start of a word after a space or a dash ("cut-|paste").
55
+ const SCORE_SPACE_WORD_JUMP = 0.9;
56
+ // It jumps to the start of a word after a symbol ("src/|index").
57
+ const SCORE_NON_SPACE_WORD_JUMP = 0.8;
58
+ // It jumps to a character in the middle of a word.
59
+ const SCORE_CHARACTER_JUMP = 0.17;
60
+ // Two characters of the search are swapped ("teh" for "the").
61
+ const SCORE_TRANSPOSITION = 0.1;
62
+ // Each character, or word break, skipped on the way.
63
+ const PENALTY_SKIPPED = 0.999;
64
+ // A character matches, but not in case.
65
+ const PENALTY_CASE_MISMATCH = 0.9999;
66
+ // The search is used up before the text is.
67
+ const PENALTY_NOT_COMPLETE = 0.99;
68
+ const IS_GAP_REGEXP = /[\\/_+.#"@[({&]/;
69
+ const COUNT_GAPS_REGEXP = /[\\/_+.#"@[({&]/g;
70
+ const IS_SPACE_REGEXP = /[\s-]/;
71
+ const COUNT_SPACE_REGEXP = /[\s-]/g;
72
+ function commandScoreInner(string, abbreviation, lowerString, lowerAbbreviation, stringIndex, abbreviationIndex, memoizedResults) {
73
+ if (abbreviationIndex === abbreviation.length) {
74
+ if (stringIndex === string.length) return SCORE_CONTINUE_MATCH;
75
+ return PENALTY_NOT_COMPLETE;
76
+ }
77
+ const memoizeKey = `${stringIndex},${abbreviationIndex}`;
78
+ const memoized = memoizedResults[memoizeKey];
79
+ if (memoized !== undefined) return memoized;
80
+ const abbreviationChar = lowerAbbreviation.charAt(abbreviationIndex);
81
+ let index = lowerString.indexOf(abbreviationChar, stringIndex);
82
+ let highScore = 0;
83
+ while (index >= 0) {
84
+ let score = commandScoreInner(string, abbreviation, lowerString, lowerAbbreviation, index + 1, abbreviationIndex + 1, memoizedResults);
85
+ if (score > highScore) {
86
+ if (index === stringIndex) {
87
+ score *= SCORE_CONTINUE_MATCH;
88
+ } else if (IS_GAP_REGEXP.test(string.charAt(index - 1))) {
89
+ score *= SCORE_NON_SPACE_WORD_JUMP;
90
+ const wordBreaks = string.slice(stringIndex, index - 1).match(COUNT_GAPS_REGEXP);
91
+ if (wordBreaks && stringIndex > 0) score *= Math.pow(PENALTY_SKIPPED, wordBreaks.length);
92
+ } else if (IS_SPACE_REGEXP.test(string.charAt(index - 1))) {
93
+ score *= SCORE_SPACE_WORD_JUMP;
94
+ const spaceBreaks = string.slice(stringIndex, index - 1).match(COUNT_SPACE_REGEXP);
95
+ if (spaceBreaks && stringIndex > 0) score *= Math.pow(PENALTY_SKIPPED, spaceBreaks.length);
96
+ } else {
97
+ score *= SCORE_CHARACTER_JUMP;
98
+ if (stringIndex > 0) score *= Math.pow(PENALTY_SKIPPED, index - stringIndex);
99
+ }
100
+ if (string.charAt(index) !== abbreviation.charAt(abbreviationIndex)) {
101
+ score *= PENALTY_CASE_MISMATCH;
102
+ }
103
+ }
104
+ if (score < SCORE_TRANSPOSITION && lowerString.charAt(index - 1) === lowerAbbreviation.charAt(abbreviationIndex + 1) || lowerAbbreviation.charAt(abbreviationIndex + 1) === lowerAbbreviation.charAt(abbreviationIndex) && lowerString.charAt(index - 1) !== lowerAbbreviation.charAt(abbreviationIndex)) {
105
+ const transposedScore = commandScoreInner(string, abbreviation, lowerString, lowerAbbreviation, index + 1, abbreviationIndex + 2, memoizedResults);
106
+ if (transposedScore * SCORE_TRANSPOSITION > score) {
107
+ score = transposedScore * SCORE_TRANSPOSITION;
108
+ }
109
+ }
110
+ if (score > highScore) highScore = score;
111
+ index = lowerString.indexOf(abbreviationChar, index + 1);
112
+ }
113
+ memoizedResults[memoizeKey] = highScore;
114
+ return highScore;
115
+ }
116
+ function formatInput(string) {
117
+ // convert all valid space characters to space so they match each other
118
+ return string.toLowerCase().replace(COUNT_SPACE_REGEXP, ' ');
119
+ }
120
+
121
+ /**
122
+ * How well `abbreviation` (what was typed) matches `string` (an item's value), from 0 (not at
123
+ * all) to 1 (exactly). Each typed character must appear in order; matches that run on, or start
124
+ * a word, score higher than ones that skip about. An item's keywords count as more of its text.
125
+ */
126
+ function commandScore(string, abbreviation, aliases) {
127
+ const text = aliases && aliases.length > 0 ? `${string} ${aliases.join(' ')}` : string;
128
+ return commandScoreInner(text, abbreviation, formatInput(text), formatInput(abbreviation), 0, 0, {});
129
+ }
130
+
131
+ const waiter = buildWaiter('@ember-joinery/primitives:command');
132
+ const ITEM = '[cmdk-item=""]';
133
+ const GROUP = '[cmdk-group=""]';
134
+ const GROUP_ITEMS = '[cmdk-group-items=""]';
135
+ const GROUP_HEADING = '[cmdk-group-heading=""]';
136
+ /**
137
+ * How well an item matches the search, from 0 (it doesn't, and is hidden) up: the item's value,
138
+ * what was typed, and the item's keywords. Items show highest first.
139
+ */
140
+
141
+ /**
142
+ * cmdk's own filter, which shadcn's Command uses: a fuzzy match of the typed characters, in
143
+ * order, scoring runs and word starts above skips (see `commandScore` in cmdk). Keywords count
144
+ * as more of the item's text.
145
+ */
146
+ const defaultFilter = (value, search, keywords) => commandScore(value, search, keywords);
147
+ /** Runs `callback` once the render that called it is over, holding the test waiter till then. */
148
+ function afterRender(owner, callback) {
149
+ const token = waiter.beginAsync();
150
+ queueMicrotask(() => {
151
+ try {
152
+ if (!isDestroying(owner) && !isDestroyed(owner)) callback();
153
+ } finally {
154
+ waiter.endAsync(token);
155
+ }
156
+ });
157
+ }
158
+ /**
159
+ * cmdk's marker attribute, which shadcn's styles select (`[cmdk-group-heading]`):
160
+ * `{{cmdk "group-heading"}}` gives the element `cmdk-group-heading=""`.
161
+ */
162
+ const cmdk = modifier((element, [name]) => {
163
+ element.setAttribute(`cmdk-${name}`, '');
164
+ });
165
+ // ----- The hotkey ----------------------------------------------------------------------------
166
+ /**
167
+ * Whether a key press is the hotkey: `"mod+k"`, `"ctrl+shift+p"`. `mod` is ⌘ on a Mac and Ctrl
168
+ * everywhere else, as ember-primitives' CommandPalette and `<KeyCombo>` have it; the other
169
+ * modifiers are `meta`, `ctrl`, `alt` and `shift`, and each one not named must be up.
170
+ */
171
+ function matchesHotkey(event, hotkey) {
172
+ const parts = hotkey.toLowerCase().split('+').map(part => part.trim());
173
+ const key = parts.pop();
174
+ const modifiers = new Set(parts);
175
+ const mod = modifiers.has('mod');
176
+ const mac = isMac();
177
+ return event.key.toLowerCase() === key && event.metaKey === (modifiers.has('meta') || mod && mac) && event.ctrlKey === (modifiers.has('ctrl') || mod && !mac) && event.altKey === modifiers.has('alt') && event.shiftKey === modifiers.has('shift');
178
+ }
179
+ /**
180
+ * Calls `callback` when the hotkey is pressed anywhere on the page: `{{hotkey "mod+k" this.open}}`
181
+ * on any element, for as long as the element is there. With no hotkey or no callback it listens
182
+ * for nothing.
183
+ */
184
+ class hotkey extends Modifier {
185
+ #hotkey;
186
+ #callback;
187
+ #document;
188
+ modify(element, [hotkey, callback]) {
189
+ this.#hotkey = hotkey;
190
+ this.#callback = callback;
191
+ if (this.#document) return;
192
+ const document = this.#document = element.ownerDocument;
193
+ document.addEventListener('keydown', this.#onKeyDown);
194
+ registerDestructor(this, () => document.removeEventListener('keydown', this.#onKeyDown));
195
+ }
196
+ #onKeyDown = event => {
197
+ const hotkey = this.#hotkey;
198
+ const callback = this.#callback;
199
+ if (!hotkey || !callback) return;
200
+ if (!matchesHotkey(event, hotkey)) return;
201
+ event.preventDefault();
202
+ callback();
203
+ };
204
+ }
205
+ // ----- The state -----------------------------------------------------------------------------
206
+ /** What a `<Command>` takes. */
207
+
208
+ /** What an item takes. */
209
+
210
+ /** An item, as the command knows it. */
211
+
212
+ /** A group, as the command knows it. */
213
+
214
+ /** What a group takes. */
215
+
216
+ /** What the search leaves: how many items match, each item's score, and the groups shown. */
217
+
218
+ /** The item's value: its `@value`, else its text, trimmed; `undefined` before it has rendered. */function valueOf(record) {
219
+ const own = record.args().value;
220
+ if (own !== undefined) return own.trim();
221
+ return record.text;
222
+ }
223
+ function keywordsOf(record) {
224
+ return (record.args().keywords ?? []).map(keyword => keyword.trim());
225
+ }
226
+ /**
227
+ * An item's text, as cmdk reads it (its `textContent`, trimmed), with each run of white space
228
+ * one space: a template keeps the line breaks between an item's icon, text and shortcut, which
229
+ * JSX drops.
230
+ */
231
+ function textOf(element) {
232
+ return (element.textContent ?? '').replace(/\s+/g, ' ').trim();
233
+ }
234
+ /** Whether a click opens a link somewhere else (a new tab, a download), leaving the page be. */
235
+ function opensElsewhere(event, element) {
236
+ if (!(event instanceof MouseEvent) || !element.closest('a')) return false;
237
+ return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0;
238
+ }
239
+ /**
240
+ * The elements in the order they show, which a search changes with CSS `order` (see
241
+ * `CommandState#arrange`): by each one's place among its siblings, from `within` down.
242
+ */
243
+ function inDisplayOrder(elements, within) {
244
+ const keys = new Map();
245
+ for (const element of elements) {
246
+ const key = [];
247
+ for (let node = element; node !== within;) {
248
+ const parent = node.parentElement;
249
+ if (!parent) break;
250
+ const order = node instanceof HTMLElement ? Number(node.style.order) || 0 : 0;
251
+ key.unshift(order, Array.prototype.indexOf.call(parent.children, node));
252
+ node = parent;
253
+ }
254
+ keys.set(element, key);
255
+ }
256
+ return [...elements].sort((a, b) => {
257
+ const left = keys.get(a);
258
+ const right = keys.get(b);
259
+ for (let index = 0; index < Math.min(left.length, right.length); index++) {
260
+ const difference = left[index] - right[index];
261
+ if (difference) return difference;
262
+ }
263
+ return left.length - right.length;
264
+ });
265
+ }
266
+ /** For `sort()`: `a` before `b` when it comes first in the document. */
267
+ function documentOrder(a, b) {
268
+ return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
269
+ }
270
+ /** The child of `container` that holds `element` (or is it). */
271
+ function childOf(container, element) {
272
+ let node = element;
273
+ while (node && node.parentElement !== container) node = node.parentElement;
274
+ return node;
275
+ }
276
+ /**
277
+ * One command menu's state and behaviour, as cmdk has them: the search, which items it shows
278
+ * and in what order, the selected item, and the keys. `<Command>` makes one, and so does the
279
+ * styled Command in `@ember-joinery/ember`, whose parts are these parts with shadcn's classes.
280
+ */
281
+ class CommandState {
282
+ #owner;
283
+ /** The selected item's value, or `''` for none: `@value`, `@defaultValue`, `@onValueChange`. */
284
+ selection;
285
+ /** The input's text: `@search`, `@defaultSearch`, `@onSearchChange`. */
286
+ searchState;
287
+ /** Bumped (after the render) whenever an item or group comes, goes, or changes its text. */
288
+ static {
289
+ g(this.prototype, "revision", [tracked], function () {
290
+ return 0;
291
+ });
292
+ }
293
+ #revision = (i(this, "revision"), void 0);
294
+ #items = new Set();
295
+ #records = new WeakMap();
296
+ #groups = new Map();
297
+ #invalidated = false;
298
+ #rootElement = null;
299
+ #inputElement = null;
300
+ #listElement = null;
301
+ #sizerElement = null;
302
+ /** Whether the next sync selects the first item (the search changed). */
303
+ #selectFirst = false;
304
+ #lastSearch = '';
305
+ #settling = false;
306
+ /** Whether the next sync scrolls the selected item into view. */
307
+ #scroll = false;
308
+ /** What the last arrangement changed: each element's `order`, and the containers it flexed. */
309
+ #ordered = new Set();
310
+ #flexed = new Map();
311
+ constructor(owner) {
312
+ this.#owner = owner;
313
+ this.selection = controllable(owner, 'value', '');
314
+ this.searchState = controllable(owner, 'search', '');
315
+ }
316
+ get args() {
317
+ return this.#owner.args;
318
+ }
319
+ get id() {
320
+ return idFor(this);
321
+ }
322
+ get inputId() {
323
+ return idFor(this, 'input');
324
+ }
325
+ get labelId() {
326
+ return idFor(this, 'label');
327
+ }
328
+ get listId() {
329
+ return idFor(this, 'list');
330
+ }
331
+ get shouldFilter() {
332
+ return this.args.shouldFilter !== false;
333
+ }
334
+ /** The input's text. */
335
+ get search() {
336
+ return this.searchState.value;
337
+ }
338
+ /** The selected item's value, or `''` when none is. */
339
+ get value() {
340
+ return this.selection.value;
341
+ }
342
+ /** Puts text in the input: a search of your own, or a "clear" button. */
343
+ setSearch = search => {
344
+ if (search === this.search) return;
345
+ this.#selectFirst = true;
346
+ this.searchState.set(search);
347
+ };
348
+ /** Selects the item with this value, as the arrow keys do. */
349
+ setValue = (value, {
350
+ scroll = true
351
+ } = {}) => {
352
+ if (value === this.value) return;
353
+ // Focus stays in the input: the root (a click on its padding) gives it back.
354
+ const active = this.#rootElement?.ownerDocument.activeElement;
355
+ if (active && active === this.#rootElement) this.#inputElement?.focus();
356
+ this.#scroll = scroll;
357
+ this.selection.set(value);
358
+ };
359
+ // ----- What the search shows ---------------------------------------------------------------
360
+ /** Which items the search shows, how they rank, and the groups that have one. */
361
+ get filtered() {
362
+ void this.revision;
363
+ const search = this.search;
364
+ const items = [...this.#items].filter(item => !item.args().forceMount);
365
+ const scores = new Map();
366
+ const groups = new Set();
367
+ if (!search || !this.shouldFilter) {
368
+ return {
369
+ filtering: false,
370
+ count: items.length,
371
+ scores,
372
+ groups
373
+ };
374
+ }
375
+ let count = 0;
376
+ for (const item of items) {
377
+ if (item.element) item.group = item.element.closest(GROUP);
378
+ const score = this.#score(item, search);
379
+ scores.set(item, score);
380
+ if (score <= 0) continue;
381
+ count++;
382
+ if (item.group) groups.add(item.group);
383
+ }
384
+ return {
385
+ filtering: true,
386
+ count,
387
+ scores,
388
+ groups
389
+ };
390
+ }
391
+ /** How many items the search shows (every item, with no search). */
392
+ static {
393
+ n(this.prototype, "filtered", [cached]);
394
+ }
395
+ get count() {
396
+ return this.filtered.count;
397
+ }
398
+ /** What `role="status"` says, for screen readers. */
399
+ get resultsText() {
400
+ const {
401
+ resultsText
402
+ } = this.args;
403
+ const count = this.count;
404
+ return resultsText ? resultsText(count) : translate(this.#owner, messages.commandResults, {
405
+ count
406
+ });
407
+ }
408
+ /** An item not rendered yet has no text to match: it shows, so it can render once. */
409
+ #score(item, search) {
410
+ const value = valueOf(item);
411
+ if (value === undefined) return Infinity;
412
+ if (!value) return 0;
413
+ return (this.args.filter ?? defaultFilter)(value, search, keywordsOf(item));
414
+ }
415
+ isItemShown = item => {
416
+ if (item.args().forceMount) return true;
417
+ const filtered = this.filtered;
418
+ if (!filtered.filtering) return true;
419
+ const score = filtered.scores.get(item) ?? this.#score(item, this.search);
420
+ return score > 0;
421
+ };
422
+ #isGroupShown(group, record) {
423
+ const filtered = this.filtered;
424
+ return Boolean(record.args().forceMount) || !filtered.filtering || filtered.groups.has(group);
425
+ }
426
+ /** A separator shows while there is no search, as cmdk's. */
427
+ isSeparatorShown = alwaysRender => {
428
+ return Boolean(alwaysRender) || !this.search;
429
+ };
430
+ /** Whether the list shows any option: a result, or an item shown whatever the search. */
431
+ get hasOptions() {
432
+ return this.count > 0 || [...this.#items].some(item => item.args().forceMount);
433
+ }
434
+ /** Whether nothing matches: Empty shows then. */
435
+ get isEmpty() {
436
+ return this.count === 0;
437
+ }
438
+ /** The id of the selected item while it is rendered, for `aria-activedescendant`. */
439
+ get selectedItemId() {
440
+ const value = this.value;
441
+ if (!value) return undefined;
442
+ void this.filtered;
443
+ const selected = [...this.#items].filter(item => item.element && valueOf(item) === value && this.isItemShown(item)).map(item => item.element).sort(documentOrder);
444
+ return selected[0]?.id;
445
+ }
446
+ // ----- Registration ------------------------------------------------------------------------
447
+ /** @internal An item comes; the returned function is for when it goes. */
448
+ registerItem(item) {
449
+ this.#items.add(item);
450
+ this.#invalidate();
451
+ return () => {
452
+ this.#items.delete(item);
453
+ this.#invalidate();
454
+ };
455
+ }
456
+ /**
457
+ * Registration happens while rendering, and the template has read what it changes, so the
458
+ * change shows in a render of its own, right after.
459
+ */
460
+ #invalidate() {
461
+ if (this.#invalidated) return;
462
+ this.#invalidated = true;
463
+ afterRender(this.#owner, () => {
464
+ this.#invalidated = false;
465
+ this.revision++;
466
+ });
467
+ }
468
+ // ----- The parts ---------------------------------------------------------------------------
469
+ root = part(() => ({
470
+ attributes: {
471
+ 'cmdk-root': '',
472
+ tabindex: '-1'
473
+ },
474
+ on: {
475
+ keydown: this.#onKeyDown
476
+ },
477
+ element: element => {
478
+ this.#rootElement = element;
479
+ return () => {
480
+ if (this.#rootElement === element) this.#rootElement = null;
481
+ };
482
+ }
483
+ }));
484
+ label = part(() => ({
485
+ attributes: {
486
+ 'cmdk-label': '',
487
+ for: this.inputId,
488
+ id: this.labelId,
489
+ 'data-test-jn-part': 'label'
490
+ }
491
+ }));
492
+ /**
493
+ * The input: a combobox over the list, as cmdk's, with focus staying in it while
494
+ * `aria-activedescendant` names the selected item. Its text is the search.
495
+ */
496
+ input = part(() => {
497
+ const search = this.search;
498
+ const input = this.#inputElement;
499
+ if (input && input.value !== search) input.value = search;
500
+ return {
501
+ attributes: {
502
+ 'cmdk-input': '',
503
+ autocomplete: 'off',
504
+ autocorrect: 'off',
505
+ autocapitalize: 'off',
506
+ spellcheck: 'false',
507
+ 'aria-autocomplete': 'list',
508
+ role: 'combobox',
509
+ 'aria-expanded': 'true',
510
+ 'aria-controls': this.listId,
511
+ 'aria-labelledby': this.args.label ? this.labelId : undefined,
512
+ 'aria-activedescendant': this.selectedItemId,
513
+ id: this.inputId,
514
+ type: 'text',
515
+ 'data-test-jn-part': 'input'
516
+ },
517
+ on: {
518
+ input: event => {
519
+ const element = event.currentTarget;
520
+ this.setSearch(element.value);
521
+ // A search you control and didn't take: the input shows yours again.
522
+ if (!event.isComposing && element.value !== this.search) {
523
+ element.value = this.search;
524
+ }
525
+ }
526
+ },
527
+ element: element => {
528
+ this.#inputElement = element;
529
+ if (element.value !== this.search) element.value = this.search;
530
+ return () => {
531
+ if (this.#inputElement === element) this.#inputElement = null;
532
+ };
533
+ }
534
+ };
535
+ });
536
+ list = part(({
537
+ label
538
+ }) => {
539
+ // A listbox must hold options, so with none to show (only Empty) it is a plain element.
540
+ const listbox = this.hasOptions;
541
+ return {
542
+ attributes: {
543
+ 'cmdk-list': '',
544
+ role: listbox ? 'listbox' : undefined,
545
+ tabindex: '-1',
546
+ 'aria-activedescendant': listbox ? this.selectedItemId : undefined,
547
+ 'aria-label': listbox ? label ?? translate(this.#owner, messages.commandListLabel) : undefined,
548
+ id: this.listId,
549
+ 'data-test-jn-part': 'list'
550
+ },
551
+ element: element => {
552
+ this.#listElement = element;
553
+ return () => {
554
+ if (this.#listElement === element) this.#listElement = null;
555
+ };
556
+ }
557
+ };
558
+ });
559
+ /** @internal The list's inner element: where items show, and where the command syncs. */
560
+ sizer = sizerModifier(this);
561
+ /** @internal An item. */
562
+ item = part(({
563
+ record
564
+ }) => {
565
+ void this.revision;
566
+ const value = valueOf(record) ?? '';
567
+ const disabled = Boolean(record.args().disabled);
568
+ const selected = Boolean(value) && value === this.value;
569
+ return {
570
+ attributes: {
571
+ id: idFor(record),
572
+ 'cmdk-item': '',
573
+ role: 'option',
574
+ 'aria-disabled': String(disabled),
575
+ 'aria-selected': String(selected),
576
+ 'data-disabled': String(disabled),
577
+ 'data-selected': String(selected),
578
+ 'data-value': value,
579
+ 'data-test-jn-part': 'item',
580
+ 'data-test-jn-value': value
581
+ },
582
+ on: {
583
+ pointermove: () => {
584
+ if (record.args().disabled || this.args.disablePointerSelection) return;
585
+ this.setValue(valueOf(record) ?? '', {
586
+ scroll: false
587
+ });
588
+ },
589
+ click: event => {
590
+ const element = event.currentTarget;
591
+ if (record.args().disabled || opensElsewhere(event, element)) return;
592
+ const chosen = valueOf(record) ?? '';
593
+ this.setValue(chosen, {
594
+ scroll: false
595
+ });
596
+ record.args().onSelect?.(chosen);
597
+ this.args.onSelect?.(chosen, event);
598
+ }
599
+ },
600
+ element: element => this.#installItem(record, element)
601
+ };
602
+ });
603
+ /** @internal A group: hidden while the search leaves it nothing. */
604
+ group = part(({
605
+ record
606
+ }) => {
607
+ const {
608
+ heading,
609
+ value
610
+ } = record.args();
611
+ const element = [...this.#groups].find(([, other]) => other === record)?.[0];
612
+ return {
613
+ attributes: {
614
+ 'cmdk-group': '',
615
+ role: 'presentation',
616
+ hidden: element ? !this.#isGroupShown(element, record) : this.filtered.filtering,
617
+ 'data-value': (value ?? heading)?.trim(),
618
+ 'data-test-jn-part': 'group',
619
+ 'data-test-jn-value': heading
620
+ },
621
+ element: element => {
622
+ this.#groups.set(element, record);
623
+ this.#invalidate();
624
+ return () => {
625
+ this.#groups.delete(element);
626
+ this.#invalidate();
627
+ };
628
+ }
629
+ };
630
+ });
631
+ /** Keeps what the item's element says, and where it is. */
632
+ #installItem(record, element) {
633
+ record.element = element;
634
+ this.#records.set(element, record);
635
+ record.group = element.closest(GROUP);
636
+ const read = () => {
637
+ const text = textOf(element);
638
+ if (text === record.text) return;
639
+ record.text = text;
640
+ this.#invalidate();
641
+ };
642
+ read();
643
+ // An item that has rendered before may come back with nothing new to say.
644
+ this.#invalidate();
645
+ const observer = new MutationObserver(read);
646
+ observer.observe(element, {
647
+ characterData: true,
648
+ childList: true,
649
+ subtree: true
650
+ });
651
+ return () => {
652
+ observer.disconnect();
653
+ if (record.element === element) record.element = null;
654
+ };
655
+ }
656
+ // ----- After each render -------------------------------------------------------------------
657
+ /**
658
+ * @internal Runs after every render that changed the search, the items or the selection,
659
+ * once the DOM shows it: puts the items in the search's order, then, once every part has
660
+ * rendered, selects the first item when the search changed (or what is selected isn't
661
+ * shown), and scrolls the selection into view.
662
+ */
663
+ sync(sizer) {
664
+ this.#sizerElement = sizer;
665
+ const filtered = this.filtered;
666
+ void this.value;
667
+ if (this.search !== this.#lastSearch) {
668
+ this.#lastSearch = this.search;
669
+ this.#selectFirst = true;
670
+ }
671
+ this.#arrange(sizer, filtered);
672
+ if (this.#settling) return;
673
+ this.#settling = true;
674
+ afterRender(this.#owner, () => {
675
+ this.#settling = false;
676
+ this.#settle();
677
+ });
678
+ }
679
+ /** Picks the selection the items now call for, as cmdk does after each change. */
680
+ #settle() {
681
+ const value = this.value;
682
+ const shown = this.#rendered().some(item => this.#valueOfElement(item) === value);
683
+ if (this.#selectFirst || !value || !shown) {
684
+ this.#selectFirst = false;
685
+ const first = this.#navigable()[0];
686
+ const next = first ? this.#valueOfElement(first) : '';
687
+ if (next !== value) return this.setValue(next);
688
+ }
689
+ if (this.#scroll) {
690
+ this.#scroll = false;
691
+ this.#scrollIntoView();
692
+ }
693
+ }
694
+ /**
695
+ * While a search filters them, the items show best first, as cmdk sorts them: in each group,
696
+ * and the groups by their best item, with items outside a group before the groups. cmdk moves
697
+ * the elements; Glimmer owns these, so they keep their place in the DOM and show in order
698
+ * through CSS `order`, their container a column of flex items. The keys follow the order
699
+ * they show in, and so does `aria-posinset`.
700
+ */
701
+ #arrange(sizer, filtered) {
702
+ const ordered = new Set();
703
+ const flexed = new Set();
704
+ if (filtered.filtering) {
705
+ const flex = container => {
706
+ if (flexed.has(container)) return;
707
+ flexed.add(container);
708
+ if (!this.#flexed.has(container)) {
709
+ const {
710
+ style
711
+ } = container;
712
+ this.#flexed.set(container, [style.getPropertyValue('display'), style.getPropertyValue('flex-direction')]);
713
+ }
714
+ container.style.setProperty('display', 'flex');
715
+ container.style.setProperty('flex-direction', 'column');
716
+ };
717
+ const counters = new Map();
718
+ const place = (container, node) => {
719
+ if (!node) return;
720
+ const order = (counters.get(container) ?? 0) + 1;
721
+ counters.set(container, order);
722
+ node.style.setProperty('order', String(order));
723
+ ordered.add(node);
724
+ flex(container);
725
+ };
726
+ const shown = [...this.#items].filter(item => item.element?.isConnected && sizer.contains(item.element));
727
+ const score = item => filtered.scores.get(item) ?? 0;
728
+ // Best first; items that score the same keep their order in the DOM.
729
+ const sorted = shown.sort((a, b) => documentOrder(a.element, b.element)).sort((a, b) => score(b) - score(a));
730
+ for (const item of sorted) {
731
+ const element = item.element;
732
+ const container = element.closest(GROUP_ITEMS) ?? sizer;
733
+ place(container, childOf(container, element));
734
+ }
735
+ const groups = [...this.#groups.keys()].filter(group => filtered.groups.has(group) && sizer.contains(group)).map(group => {
736
+ const best = Math.max(0, ...sorted.filter(i => i.group === group).map(score));
737
+ return [group, best];
738
+ });
739
+ for (const [group] of [...groups].sort((a, b) => b[1] - a[1])) {
740
+ place(sizer, childOf(sizer, group));
741
+ }
742
+ }
743
+ for (const node of this.#ordered) {
744
+ if (!ordered.has(node)) node.style.removeProperty('order');
745
+ }
746
+ for (const [container, [display, direction]] of this.#flexed) {
747
+ if (flexed.has(container)) continue;
748
+ if (display) container.style.setProperty('display', display);else container.style.removeProperty('display');
749
+ if (direction) container.style.setProperty('flex-direction', direction);else container.style.removeProperty('flex-direction');
750
+ this.#flexed.delete(container);
751
+ }
752
+ this.#ordered = ordered;
753
+ const items = this.#rendered();
754
+ items.forEach((element, index) => {
755
+ if (filtered.filtering) {
756
+ element.setAttribute('aria-posinset', String(index + 1));
757
+ element.setAttribute('aria-setsize', String(items.length));
758
+ } else {
759
+ element.removeAttribute('aria-posinset');
760
+ element.removeAttribute('aria-setsize');
761
+ }
762
+ });
763
+ }
764
+ // ----- The keys ----------------------------------------------------------------------------
765
+ /** Every item this command renders, in the order they show. */
766
+ #rendered() {
767
+ const sizer = this.#sizerElement;
768
+ if (!sizer) return [];
769
+ const root = sizer.closest('[cmdk-root=""]');
770
+ const items = [...sizer.querySelectorAll(ITEM)].filter(item => item.closest('[cmdk-root=""]') === root);
771
+ return this.#ordered.size ? inDisplayOrder(items, sizer) : items;
772
+ }
773
+ /** The items the keys move between: those rendered that aren't disabled, in order. */
774
+ #navigable() {
775
+ return this.#rendered().filter(item => item.getAttribute('aria-disabled') !== 'true');
776
+ }
777
+ #selected() {
778
+ return this.#rendered().find(item => item.getAttribute('aria-selected') === 'true');
779
+ }
780
+ #select(item) {
781
+ if (item) this.setValue(this.#valueOfElement(item));
782
+ }
783
+ /** An item element's value, from what the command knows of it. */
784
+ #valueOfElement(element) {
785
+ const record = this.#records.get(element);
786
+ return (record ? valueOf(record) : element.getAttribute('data-value')) ?? '';
787
+ }
788
+ /** The item `change` places from the selected one (wrapping round with `@loop`). */
789
+ #move(change) {
790
+ const items = this.#navigable();
791
+ const index = items.indexOf(this.#selected());
792
+ let next = items[index + change];
793
+ if (this.args.loop) {
794
+ next = index + change < 0 ? items[items.length - 1] : index + change === items.length ? items[0] : items[index + change];
795
+ }
796
+ this.#select(next);
797
+ }
798
+ /** The first item of the next (or previous) group, or else the next item. */
799
+ #moveGroup(change) {
800
+ const sizer = this.#sizerElement;
801
+ const group = this.#selected()?.closest(GROUP);
802
+ if (!sizer || !group) return this.#move(change);
803
+ const groups = inDisplayOrder([...sizer.querySelectorAll(GROUP)].filter(other => !other.hidden), sizer);
804
+ const navigable = this.#navigable();
805
+ for (let index = groups.indexOf(group) + change; index >= 0 && index < groups.length;) {
806
+ const first = navigable.find(item => groups[index].contains(item));
807
+ if (first) return this.#select(first);
808
+ index += change;
809
+ }
810
+ this.#move(change);
811
+ }
812
+ #last() {
813
+ const items = this.#navigable();
814
+ this.#select(items[items.length - 1]);
815
+ }
816
+ #next(event) {
817
+ event.preventDefault();
818
+ if (event.metaKey) this.#last();else if (event.altKey) this.#moveGroup(1);else this.#move(1);
819
+ }
820
+ #previous(event) {
821
+ event.preventDefault();
822
+ if (event.metaKey) this.#select(this.#navigable()[0]);else if (event.altKey) this.#moveGroup(-1);else this.#move(-1);
823
+ }
824
+ #onKeyDown = event => {
825
+ // While an input method composes, the keys are its own.
826
+ if (event.isComposing || event.keyCode === 229) return;
827
+ const vim = this.args.vimBindings !== false;
828
+ switch (event.key) {
829
+ case 'n':
830
+ case 'j':
831
+ if (vim && event.ctrlKey) this.#next(event);
832
+ break;
833
+ case 'ArrowDown':
834
+ this.#next(event);
835
+ break;
836
+ case 'p':
837
+ case 'k':
838
+ if (vim && event.ctrlKey) this.#previous(event);
839
+ break;
840
+ case 'ArrowUp':
841
+ this.#previous(event);
842
+ break;
843
+ case 'Home':
844
+ event.preventDefault();
845
+ this.#select(this.#navigable()[0]);
846
+ break;
847
+ case 'End':
848
+ event.preventDefault();
849
+ this.#last();
850
+ break;
851
+ case 'Enter':
852
+ {
853
+ event.preventDefault();
854
+ // A click, so one handler serves the pointer and the keys, and a link item navigates.
855
+ this.#selected()?.click();
856
+ break;
857
+ }
858
+ }
859
+ };
860
+ /** As cmdk: the first item of a group brings its heading into view with it. */
861
+ #scrollIntoView() {
862
+ const item = this.#selected();
863
+ if (!item) return;
864
+ if (item.parentElement?.firstElementChild === item) {
865
+ item.closest(GROUP)?.querySelector(GROUP_HEADING)?.scrollIntoView({
866
+ block: 'nearest'
867
+ });
868
+ }
869
+ item.scrollIntoView({
870
+ block: 'nearest'
871
+ });
872
+ }
873
+ /** @internal The list's height, as `--cmdk-list-height`, for animating it. */
874
+ measure(sizer) {
875
+ this.#listElement?.style.setProperty('--cmdk-list-height', `${sizer.offsetHeight.toFixed(1)}px`);
876
+ }
877
+ }
878
+ /** The sizer's modifier: syncs the command after each render, and measures the list. */
879
+ function sizerModifier(state) {
880
+ return class CommandSizer extends Modifier {
881
+ #observer;
882
+ modify(element) {
883
+ state.sync(element);
884
+ if (this.#observer) return;
885
+ const observer = this.#observer = new ResizeObserver(() => state.measure(element));
886
+ observer.observe(element);
887
+ registerDestructor(this, () => observer.disconnect());
888
+ }
889
+ };
890
+ }
891
+ // ----- The part components -------------------------------------------------------------------
892
+
893
+ /** The search box: a combobox over the list. Focus stays in it while the keys move. */const CommandInput = setComponentTemplate(precompileTemplate("<input ...attributes {{@command.input}} />", {
894
+ strictMode: true
895
+ }), templateOnly());
896
+ /** The listbox the items show in, with an inner element that measures them. */const CommandList = setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"div\" ...attributes {{@command.list label=@label}}>\n <div {{cmdk \"list-sizer\"}} {{@command.sizer}}>{{yield}}</div>\n</As>", {
897
+ strictMode: true,
898
+ scope: () => ({
899
+ As,
900
+ cmdk
901
+ })
902
+ }), templateOnly());
903
+ /**
904
+ * An option: chosen with a click or Enter, selected as the pointer moves over it or the keys
905
+ * reach it. It isn't rendered while the search hides it.
906
+ */
907
+ class CommandItem extends Component {
908
+ record = {
909
+ args: () => this.args,
910
+ element: null,
911
+ text: undefined,
912
+ group: null
913
+ };
914
+ constructor(owner, args) {
915
+ super(owner, args);
916
+ registerDestructor(this, args.command.registerItem(this.record));
917
+ }
918
+ static {
919
+ setComponentTemplate(precompileTemplate("{{#if (@command.isItemShown this.record)}}\n <As @as={{@as}} @tag=\"div\" ...attributes {{@command.item record=this.record}}>{{yield}}</As>\n{{/if}}", {
920
+ strictMode: true,
921
+ scope: () => ({
922
+ As
923
+ })
924
+ }), this);
925
+ }
926
+ }
927
+ /** Items under a heading. It stays rendered, `hidden` while the search leaves it nothing. */class CommandGroup extends Component {
928
+ record = {
929
+ args: () => this.args
930
+ };
931
+ get headingId() {
932
+ return idFor(this.record, 'heading');
933
+ }
934
+ static {
935
+ setComponentTemplate(precompileTemplate("<div ...attributes {{@command.group record=this.record}}>\n {{#if @heading}}\n <div aria-hidden=\"true\" {{cmdk \"group-heading\"}} id={{this.headingId}} data-test-jn-part=\"group-heading\">{{@heading}}</div>\n {{/if}}\n <div role=\"group\" aria-labelledby={{if @heading this.headingId}} {{cmdk \"group-items\"}}>{{yield}}</div>\n</div>", {
936
+ strictMode: true,
937
+ scope: () => ({
938
+ cmdk
939
+ })
940
+ }), this);
941
+ }
942
+ }
943
+ /**
944
+ * A line between groups, shown while there is no search. It is hidden from screen readers: a
945
+ * listbox holds only options and groups, and its groups are named.
946
+ */
947
+ const CommandSeparator = setComponentTemplate(precompileTemplate("{{#if (@command.isSeparatorShown @alwaysRender)}}\n <div role=\"separator\" aria-hidden=\"true\" data-test-jn-part=\"separator\" ...attributes {{cmdk \"separator\"}}></div>\n{{/if}}", {
948
+ strictMode: true,
949
+ scope: () => ({
950
+ cmdk
951
+ })
952
+ }), templateOnly());
953
+ /** What shows when nothing matches the search. */const CommandEmpty = setComponentTemplate(precompileTemplate("{{#if @command.isEmpty}}\n <div role=\"presentation\" data-test-jn-part=\"empty\" ...attributes {{cmdk \"empty\"}}>{{yield}}</div>\n{{/if}}", {
954
+ strictMode: true,
955
+ scope: () => ({
956
+ cmdk
957
+ })
958
+ }), templateOnly());
959
+ /** A progress bar, for while items load: render it while they do, as cmdk's Loading. */const CommandLoading = setComponentTemplate(precompileTemplate("<div role=\"progressbar\" aria-valuenow={{@progress}} aria-valuemin=\"0\" aria-valuemax=\"100\" aria-label={{if @label @label (t messages.commandLoading)}} data-test-jn-part=\"loading\" ...attributes {{cmdk \"loading\"}}>\n <div aria-hidden=\"true\">{{yield}}</div>\n</div>", {
960
+ strictMode: true,
961
+ scope: () => ({
962
+ t,
963
+ messages,
964
+ cmdk
965
+ })
966
+ }), templateOnly());
967
+ // ----- Command -------------------------------------------------------------------------------
968
+ /** What `<Command>` yields. */
969
+
970
+ /**
971
+ * A command menu: a search box over a list it filters and ranks as you type, as cmdk's
972
+ * (which shadcn's Command is built on), covering ember-primitives' CommandPalette too.
973
+ *
974
+ * <Command @label="Command Menu" as |c|>
975
+ * <c.Input placeholder="Type a command or search..." />
976
+ * <c.List>
977
+ * <c.Empty>No results found.</c.Empty>
978
+ * <c.Group @heading="Letters">
979
+ * <c.Item>a</c.Item>
980
+ * <c.Item>b</c.Item>
981
+ * </c.Group>
982
+ * <c.Separator />
983
+ * <c.Item @onSelect={{this.eat}}>Apple</c.Item>
984
+ * </c.List>
985
+ * </Command>
986
+ *
987
+ * - Typing filters the items by `@filter` (cmdk's fuzzy match by default) and shows the best
988
+ * first. A group with nothing left hides, and so do the separators; Empty shows when nothing
989
+ * matches.
990
+ * - One item is selected (`aria-selected`), the first of the results unless the keys or the
991
+ * pointer move it: ArrowUp and ArrowDown (Ctrl+P and Ctrl+N, Ctrl+K and Ctrl+J), Home and
992
+ * End, Alt with an arrow for the next group. Enter chooses it. Focus stays in the input.
993
+ * - A `role="status"` says how many results there are, for screen readers.
994
+ */
995
+ class Command extends Component {
996
+ state = new CommandState(this);
997
+ setValue = value => this.state.setValue(value);
998
+ static {
999
+ setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"div\" data-test-jn=\"command\" data-test-jn-name={{@name}} ...attributes {{this.state.root}} {{hotkey @hotkey @onOpen}}>\n {{#if @label}}\n <label {{this.state.label}} {{visuallyHidden}}>{{@label}}</label>\n {{/if}}\n {{yield (hash Input=(component CommandInput command=this.state) List=(component CommandList command=this.state) Item=(component CommandItem command=this.state) Group=(component CommandGroup command=this.state) Separator=(component CommandSeparator command=this.state) Empty=(component CommandEmpty command=this.state) Loading=CommandLoading input=this.state.input search=this.state.search setSearch=this.state.setSearch value=this.state.value setValue=this.setValue count=this.state.count)}}\n <VisuallyHidden role=\"status\" data-test-jn-part=\"status\">{{this.state.resultsText}}</VisuallyHidden>\n</As>", {
1000
+ strictMode: true,
1001
+ scope: () => ({
1002
+ As,
1003
+ hotkey,
1004
+ visuallyHidden,
1005
+ hash,
1006
+ CommandInput,
1007
+ CommandList,
1008
+ CommandItem,
1009
+ CommandGroup,
1010
+ CommandSeparator,
1011
+ CommandEmpty,
1012
+ CommandLoading,
1013
+ VisuallyHidden
1014
+ })
1015
+ }), this);
1016
+ }
1017
+ }
1018
+ // ----- CommandDialog -------------------------------------------------------------------------
1019
+ /** What `<CommandDialog>` takes. */
1020
+
1021
+ /** What `<CommandDialog>` yields, to open and close it from inside. */
1022
+
1023
+ /**
1024
+ * A `<Command>` in a modal dialog, as cmdk's `Command.Dialog`, on the primitives' Dialog: the
1025
+ * overlay, focus moving into the input and back, Escape and a press outside closing it. Put a
1026
+ * `<Command>` in it; `@hotkey` opens and closes it from anywhere. Its attributes, such as
1027
+ * `class`, go on the dialog (cmdk's `contentClassName`), and `@overlayClass` on the overlay:
1028
+ *
1029
+ * <CommandDialog @hotkey="mod+k" as |d|>
1030
+ * <Command @onSelect={{fn d.setOpen false}} as |c|>…</Command>
1031
+ * </CommandDialog>
1032
+ */
1033
+ class CommandDialog extends Component {
1034
+ openState = controllable(this, 'open', false);
1035
+ setOpen = open => this.openState.set(open);
1036
+ toggle = () => this.openState.set(open => !open);
1037
+ static {
1038
+ setComponentTemplate(precompileTemplate("<Dialog @open={{this.openState.value}} @onOpenChange={{this.setOpen}} @modal={{@modal}} @name={{@name}} data-test-jn=\"command-dialog\" {{hotkey @hotkey this.toggle}} as |d|>\n <d.Overlay class={{@overlayClass}} {{cmdk \"overlay\"}} />\n <d.Content ...attributes {{cmdk \"dialog\"}}>\n <d.Title {{visuallyHidden}}>{{if @title @title (t messages.commandDialogTitle)}}</d.Title>\n <d.Description {{visuallyHidden}}>{{if @description @description (t messages.commandDialogDescription)}}</d.Description>\n {{yield (hash isOpen=d.isOpen open=d.open toggle=this.toggle setOpen=this.setOpen)}}\n </d.Content>\n</Dialog>", {
1039
+ strictMode: true,
1040
+ scope: () => ({
1041
+ Dialog,
1042
+ hotkey,
1043
+ cmdk,
1044
+ visuallyHidden,
1045
+ t,
1046
+ messages,
1047
+ hash
1048
+ })
1049
+ }), this);
1050
+ }
1051
+ }
1052
+
1053
+ export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandState, Command as default, defaultFilter, hotkey, matchesHotkey };
1054
+ //# sourceMappingURL=command.js.map