@ember-joinery/primitives 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (485) hide show
  1. package/CHANGELOG.md +472 -0
  2. package/LICENSE.md +9 -0
  3. package/NOTICE +532 -0
  4. package/README.md +11 -2
  5. package/addon-main.cjs +4 -0
  6. package/declarations/-private/combobox-list.d.ts +59 -0
  7. package/declarations/-private/combobox-list.d.ts.map +1 -0
  8. package/declarations/-private/command-score.d.ts +33 -0
  9. package/declarations/-private/command-score.d.ts.map +1 -0
  10. package/declarations/-private/delay-group.d.ts +47 -0
  11. package/declarations/-private/delay-group.d.ts.map +1 -0
  12. package/declarations/-private/dialog.d.ts +180 -0
  13. package/declarations/-private/dialog.d.ts.map +1 -0
  14. package/declarations/-private/form-control.d.ts +70 -0
  15. package/declarations/-private/form-control.d.ts.map +1 -0
  16. package/declarations/-private/form-data.d.ts +14 -0
  17. package/declarations/-private/form-data.d.ts.map +1 -0
  18. package/declarations/-private/hover-intent.d.ts +48 -0
  19. package/declarations/-private/hover-intent.d.ts.map +1 -0
  20. package/declarations/-private/image-loading.d.ts +77 -0
  21. package/declarations/-private/image-loading.d.ts.map +1 -0
  22. package/declarations/-private/indicator.d.ts +27 -0
  23. package/declarations/-private/indicator.d.ts.map +1 -0
  24. package/declarations/-private/instances.d.ts +11 -0
  25. package/declarations/-private/instances.d.ts.map +1 -0
  26. package/declarations/-private/layout-styles.d.ts +34 -0
  27. package/declarations/-private/layout-styles.d.ts.map +1 -0
  28. package/declarations/-private/menu.d.ts +616 -0
  29. package/declarations/-private/menu.d.ts.map +1 -0
  30. package/declarations/-private/observers.d.ts +35 -0
  31. package/declarations/-private/observers.d.ts.map +1 -0
  32. package/declarations/-private/popper.d.ts +149 -0
  33. package/declarations/-private/popper.d.ts.map +1 -0
  34. package/declarations/-private/presence-chart.d.ts +39 -0
  35. package/declarations/-private/presence-chart.d.ts.map +1 -0
  36. package/declarations/-private/promise-state.d.ts +41 -0
  37. package/declarations/-private/promise-state.d.ts.map +1 -0
  38. package/declarations/-private/scroll-end.d.ts +16 -0
  39. package/declarations/-private/scroll-end.d.ts.map +1 -0
  40. package/declarations/-private/scroll-visibility.d.ts +68 -0
  41. package/declarations/-private/scroll-visibility.d.ts.map +1 -0
  42. package/declarations/-private/toast.d.ts +119 -0
  43. package/declarations/-private/toast.d.ts.map +1 -0
  44. package/declarations/-private/typeahead-search.d.ts +29 -0
  45. package/declarations/-private/typeahead-search.d.ts.map +1 -0
  46. package/declarations/accordion.d.ts +284 -0
  47. package/declarations/accordion.d.ts.map +1 -0
  48. package/declarations/alert-dialog.d.ts +80 -0
  49. package/declarations/alert-dialog.d.ts.map +1 -0
  50. package/declarations/anchor/component.d.ts +63 -0
  51. package/declarations/anchor/component.d.ts.map +1 -0
  52. package/declarations/anchor/index.d.ts +7 -0
  53. package/declarations/anchor/index.d.ts.map +1 -0
  54. package/declarations/anchor/middleware.d.ts +46 -0
  55. package/declarations/anchor/middleware.d.ts.map +1 -0
  56. package/declarations/anchor/modifier.d.ts +34 -0
  57. package/declarations/anchor/modifier.d.ts.map +1 -0
  58. package/declarations/anchor/options.d.ts +112 -0
  59. package/declarations/anchor/options.d.ts.map +1 -0
  60. package/declarations/anchor/position.d.ts +36 -0
  61. package/declarations/anchor/position.d.ts.map +1 -0
  62. package/declarations/anchor.d.ts +2 -0
  63. package/declarations/as.d.ts +33 -0
  64. package/declarations/as.d.ts.map +1 -0
  65. package/declarations/aspect-ratio.d.ts +34 -0
  66. package/declarations/aspect-ratio.d.ts.map +1 -0
  67. package/declarations/avatar.d.ts +178 -0
  68. package/declarations/avatar.d.ts.map +1 -0
  69. package/declarations/body-class.d.ts +30 -0
  70. package/declarations/body-class.d.ts.map +1 -0
  71. package/declarations/breadcrumb.d.ts +64 -0
  72. package/declarations/breadcrumb.d.ts.map +1 -0
  73. package/declarations/calendar/dates.d.ts +142 -0
  74. package/declarations/calendar/dates.d.ts.map +1 -0
  75. package/declarations/calendar/index.d.ts +59 -0
  76. package/declarations/calendar/index.d.ts.map +1 -0
  77. package/declarations/calendar/state.d.ts +415 -0
  78. package/declarations/calendar/state.d.ts.map +1 -0
  79. package/declarations/calendar.d.ts +3 -0
  80. package/declarations/checkbox.d.ts +71 -0
  81. package/declarations/checkbox.d.ts.map +1 -0
  82. package/declarations/collapsible.d.ts +216 -0
  83. package/declarations/collapsible.d.ts.map +1 -0
  84. package/declarations/color-scheme.d.ts +115 -0
  85. package/declarations/color-scheme.d.ts.map +1 -0
  86. package/declarations/combobox.d.ts +569 -0
  87. package/declarations/combobox.d.ts.map +1 -0
  88. package/declarations/command.d.ts +410 -0
  89. package/declarations/command.d.ts.map +1 -0
  90. package/declarations/context-menu.d.ts +155 -0
  91. package/declarations/context-menu.d.ts.map +1 -0
  92. package/declarations/controllable-state.d.ts +85 -0
  93. package/declarations/controllable-state.d.ts.map +1 -0
  94. package/declarations/dialog.d.ts +80 -0
  95. package/declarations/dialog.d.ts.map +1 -0
  96. package/declarations/direction.d.ts +55 -0
  97. package/declarations/direction.d.ts.map +1 -0
  98. package/declarations/dismiss.d.ts +111 -0
  99. package/declarations/dismiss.d.ts.map +1 -0
  100. package/declarations/dom-context.d.ts +74 -0
  101. package/declarations/dom-context.d.ts.map +1 -0
  102. package/declarations/drawer/controller.d.ts +174 -0
  103. package/declarations/drawer/controller.d.ts.map +1 -0
  104. package/declarations/drawer/index.d.ts +105 -0
  105. package/declarations/drawer/index.d.ts.map +1 -0
  106. package/declarations/drawer/machine.d.ts +139 -0
  107. package/declarations/drawer/machine.d.ts.map +1 -0
  108. package/declarations/drawer/parts.d.ts +85 -0
  109. package/declarations/drawer/parts.d.ts.map +1 -0
  110. package/declarations/drawer.d.ts +2 -0
  111. package/declarations/dropdown-menu.d.ts +169 -0
  112. package/declarations/dropdown-menu.d.ts.map +1 -0
  113. package/declarations/external-link.d.ts +26 -0
  114. package/declarations/external-link.d.ts.map +1 -0
  115. package/declarations/file-drop.d.ts +119 -0
  116. package/declarations/file-drop.d.ts.map +1 -0
  117. package/declarations/focus-scope.d.ts +105 -0
  118. package/declarations/focus-scope.d.ts.map +1 -0
  119. package/declarations/focus.d.ts +114 -0
  120. package/declarations/focus.d.ts.map +1 -0
  121. package/declarations/head.d.ts +20 -0
  122. package/declarations/head.d.ts.map +1 -0
  123. package/declarations/heading.d.ts +59 -0
  124. package/declarations/heading.d.ts.map +1 -0
  125. package/declarations/hero.d.ts +32 -0
  126. package/declarations/hero.d.ts.map +1 -0
  127. package/declarations/hide-others.d.ts +35 -0
  128. package/declarations/hide-others.d.ts.map +1 -0
  129. package/declarations/hover-card.d.ts +148 -0
  130. package/declarations/hover-card.d.ts.map +1 -0
  131. package/declarations/i18n.d.ts +47 -0
  132. package/declarations/i18n.d.ts.map +1 -0
  133. package/declarations/id.d.ts +15 -0
  134. package/declarations/id.d.ts.map +1 -0
  135. package/declarations/iframe.d.ts +12 -0
  136. package/declarations/iframe.d.ts.map +1 -0
  137. package/declarations/incremental-each.d.ts +81 -0
  138. package/declarations/incremental-each.d.ts.map +1 -0
  139. package/declarations/index.d.ts +108 -0
  140. package/declarations/index.d.ts.map +1 -0
  141. package/declarations/input-otp.d.ts +201 -0
  142. package/declarations/input-otp.d.ts.map +1 -0
  143. package/declarations/keys.d.ts +50 -0
  144. package/declarations/keys.d.ts.map +1 -0
  145. package/declarations/label.d.ts +36 -0
  146. package/declarations/label.d.ts.map +1 -0
  147. package/declarations/layer.d.ts +56 -0
  148. package/declarations/layer.d.ts.map +1 -0
  149. package/declarations/link-helper.d.ts +73 -0
  150. package/declarations/link-helper.d.ts.map +1 -0
  151. package/declarations/link.d.ts +60 -0
  152. package/declarations/link.d.ts.map +1 -0
  153. package/declarations/load.d.ts +47 -0
  154. package/declarations/load.d.ts.map +1 -0
  155. package/declarations/menubar.d.ts +231 -0
  156. package/declarations/menubar.d.ts.map +1 -0
  157. package/declarations/message-scroller/components.d.ts +229 -0
  158. package/declarations/message-scroller/components.d.ts.map +1 -0
  159. package/declarations/message-scroller/geometry.d.ts +95 -0
  160. package/declarations/message-scroller/geometry.d.ts.map +1 -0
  161. package/declarations/message-scroller/index.d.ts +4 -0
  162. package/declarations/message-scroller/index.d.ts.map +1 -0
  163. package/declarations/message-scroller/state.d.ts +124 -0
  164. package/declarations/message-scroller/state.d.ts.map +1 -0
  165. package/declarations/message-scroller.d.ts +2 -0
  166. package/declarations/messages.d.ts +166 -0
  167. package/declarations/messages.d.ts.map +1 -0
  168. package/declarations/narrowing.d.ts +24 -0
  169. package/declarations/narrowing.d.ts.map +1 -0
  170. package/declarations/native-form.d.ts +56 -0
  171. package/declarations/native-form.d.ts.map +1 -0
  172. package/declarations/native-value.d.ts +47 -0
  173. package/declarations/native-value.d.ts.map +1 -0
  174. package/declarations/navigation-menu.d.ts +406 -0
  175. package/declarations/navigation-menu.d.ts.map +1 -0
  176. package/declarations/on-resize.d.ts +32 -0
  177. package/declarations/on-resize.d.ts.map +1 -0
  178. package/declarations/part.d.ts +99 -0
  179. package/declarations/part.d.ts.map +1 -0
  180. package/declarations/popover.d.ts +236 -0
  181. package/declarations/popover.d.ts.map +1 -0
  182. package/declarations/portal/index.d.ts +3 -0
  183. package/declarations/portal/index.d.ts.map +1 -0
  184. package/declarations/portal/portal.d.ts +46 -0
  185. package/declarations/portal/portal.d.ts.map +1 -0
  186. package/declarations/portal/targets.d.ts +40 -0
  187. package/declarations/portal/targets.d.ts.map +1 -0
  188. package/declarations/portal.d.ts +2 -0
  189. package/declarations/presence.d.ts +80 -0
  190. package/declarations/presence.d.ts.map +1 -0
  191. package/declarations/progress.d.ts +98 -0
  192. package/declarations/progress.d.ts.map +1 -0
  193. package/declarations/proper-links.d.ts +69 -0
  194. package/declarations/proper-links.d.ts.map +1 -0
  195. package/declarations/qp.d.ts +55 -0
  196. package/declarations/qp.d.ts.map +1 -0
  197. package/declarations/questionnaire/components.d.ts +348 -0
  198. package/declarations/questionnaire/components.d.ts.map +1 -0
  199. package/declarations/questionnaire/index.d.ts +4 -0
  200. package/declarations/questionnaire/index.d.ts.map +1 -0
  201. package/declarations/questionnaire/state.d.ts +400 -0
  202. package/declarations/questionnaire/state.d.ts.map +1 -0
  203. package/declarations/questionnaire/utils.d.ts +65 -0
  204. package/declarations/questionnaire/utils.d.ts.map +1 -0
  205. package/declarations/questionnaire.d.ts +2 -0
  206. package/declarations/radio-group.d.ts +115 -0
  207. package/declarations/radio-group.d.ts.map +1 -0
  208. package/declarations/rating.d.ts +214 -0
  209. package/declarations/rating.d.ts.map +1 -0
  210. package/declarations/resizable/components.d.ts +107 -0
  211. package/declarations/resizable/components.d.ts.map +1 -0
  212. package/declarations/resizable/index.d.ts +4 -0
  213. package/declarations/resizable/index.d.ts.map +1 -0
  214. package/declarations/resizable/layout.d.ts +93 -0
  215. package/declarations/resizable/layout.d.ts.map +1 -0
  216. package/declarations/resizable/state.d.ts +211 -0
  217. package/declarations/resizable/state.d.ts.map +1 -0
  218. package/declarations/resizable.d.ts +2 -0
  219. package/declarations/resize-observer.d.ts +40 -0
  220. package/declarations/resize-observer.d.ts.map +1 -0
  221. package/declarations/roving-focus.d.ts +204 -0
  222. package/declarations/roving-focus.d.ts.map +1 -0
  223. package/declarations/scroll-area/components.d.ts +125 -0
  224. package/declarations/scroll-area/components.d.ts.map +1 -0
  225. package/declarations/scroll-area/index.d.ts +3 -0
  226. package/declarations/scroll-area/index.d.ts.map +1 -0
  227. package/declarations/scroll-area/state.d.ts +147 -0
  228. package/declarations/scroll-area/state.d.ts.map +1 -0
  229. package/declarations/scroll-area.d.ts +2 -0
  230. package/declarations/scroll-lock.d.ts +69 -0
  231. package/declarations/scroll-lock.d.ts.map +1 -0
  232. package/declarations/scroller.d.ts +71 -0
  233. package/declarations/scroller.d.ts.map +1 -0
  234. package/declarations/select.d.ts +459 -0
  235. package/declarations/select.d.ts.map +1 -0
  236. package/declarations/separator.d.ts +71 -0
  237. package/declarations/separator.d.ts.map +1 -0
  238. package/declarations/service.d.ts +83 -0
  239. package/declarations/service.d.ts.map +1 -0
  240. package/declarations/shadowed.d.ts +63 -0
  241. package/declarations/shadowed.d.ts.map +1 -0
  242. package/declarations/slider.d.ts +283 -0
  243. package/declarations/slider.d.ts.map +1 -0
  244. package/declarations/sticky-footer.d.ts +43 -0
  245. package/declarations/sticky-footer.d.ts.map +1 -0
  246. package/declarations/store.d.ts +47 -0
  247. package/declarations/store.d.ts.map +1 -0
  248. package/declarations/switch.d.ts +76 -0
  249. package/declarations/switch.d.ts.map +1 -0
  250. package/declarations/tabs.d.ts +250 -0
  251. package/declarations/tabs.d.ts.map +1 -0
  252. package/declarations/toast/icons.d.ts +29 -0
  253. package/declarations/toast/icons.d.ts.map +1 -0
  254. package/declarations/toast/index.d.ts +4 -0
  255. package/declarations/toast/index.d.ts.map +1 -0
  256. package/declarations/toast/item.d.ts +162 -0
  257. package/declarations/toast/item.d.ts.map +1 -0
  258. package/declarations/toast/state.d.ts +276 -0
  259. package/declarations/toast/state.d.ts.map +1 -0
  260. package/declarations/toast/styles.d.ts +20 -0
  261. package/declarations/toast/styles.d.ts.map +1 -0
  262. package/declarations/toast/toaster.d.ts +173 -0
  263. package/declarations/toast/toaster.d.ts.map +1 -0
  264. package/declarations/toast.d.ts +2 -0
  265. package/declarations/toggle-group.d.ts +161 -0
  266. package/declarations/toggle-group.d.ts.map +1 -0
  267. package/declarations/toggle.d.ts +70 -0
  268. package/declarations/toggle.d.ts.map +1 -0
  269. package/declarations/tooltip.d.ts +227 -0
  270. package/declarations/tooltip.d.ts.map +1 -0
  271. package/declarations/typeahead.d.ts +97 -0
  272. package/declarations/typeahead.d.ts.map +1 -0
  273. package/declarations/viewport.d.ts +109 -0
  274. package/declarations/viewport.d.ts.map +1 -0
  275. package/declarations/visually-hidden.d.ts +42 -0
  276. package/declarations/visually-hidden.d.ts.map +1 -0
  277. package/declarations/zoetrope.d.ts +120 -0
  278. package/declarations/zoetrope.d.ts.map +1 -0
  279. package/dist/accordion.js +367 -0
  280. package/dist/accordion.js.map +1 -0
  281. package/dist/alert-dialog.js +122 -0
  282. package/dist/alert-dialog.js.map +1 -0
  283. package/dist/anchor.js +2 -0
  284. package/dist/anchor.js.map +1 -0
  285. package/dist/as.js +60 -0
  286. package/dist/as.js.map +1 -0
  287. package/dist/aspect-ratio.js +59 -0
  288. package/dist/aspect-ratio.js.map +1 -0
  289. package/dist/avatar.js +464 -0
  290. package/dist/avatar.js.map +1 -0
  291. package/dist/body-class.js +57 -0
  292. package/dist/body-class.js.map +1 -0
  293. package/dist/breadcrumb.js +59 -0
  294. package/dist/breadcrumb.js.map +1 -0
  295. package/dist/calendar.js +1494 -0
  296. package/dist/calendar.js.map +1 -0
  297. package/dist/checkbox.js +81 -0
  298. package/dist/checkbox.js.map +1 -0
  299. package/dist/collapsible.js +255 -0
  300. package/dist/collapsible.js.map +1 -0
  301. package/dist/color-scheme.js +306 -0
  302. package/dist/color-scheme.js.map +1 -0
  303. package/dist/combobox.js +1413 -0
  304. package/dist/combobox.js.map +1 -0
  305. package/dist/command.js +1054 -0
  306. package/dist/command.js.map +1 -0
  307. package/dist/component-DqLt83fo.js +886 -0
  308. package/dist/component-DqLt83fo.js.map +1 -0
  309. package/dist/components-CWfg0cFs.js +1745 -0
  310. package/dist/components-CWfg0cFs.js.map +1 -0
  311. package/dist/components-DBWszEI3.js +1285 -0
  312. package/dist/components-DBWszEI3.js.map +1 -0
  313. package/dist/components-DI8Azu05.js +1542 -0
  314. package/dist/components-DI8Azu05.js.map +1 -0
  315. package/dist/components-F0Ini448.js +875 -0
  316. package/dist/components-F0Ini448.js.map +1 -0
  317. package/dist/context-menu.js +207 -0
  318. package/dist/context-menu.js.map +1 -0
  319. package/dist/controllable-state.js +134 -0
  320. package/dist/controllable-state.js.map +1 -0
  321. package/dist/delay-group-B1K03gBL.js +75 -0
  322. package/dist/delay-group-B1K03gBL.js.map +1 -0
  323. package/dist/dialog-3gfz_8NA.js +349 -0
  324. package/dist/dialog-3gfz_8NA.js.map +1 -0
  325. package/dist/dialog.js +57 -0
  326. package/dist/dialog.js.map +1 -0
  327. package/dist/direction.js +75 -0
  328. package/dist/direction.js.map +1 -0
  329. package/dist/dismiss.js +329 -0
  330. package/dist/dismiss.js.map +1 -0
  331. package/dist/dom-context.js +104 -0
  332. package/dist/dom-context.js.map +1 -0
  333. package/dist/drawer.js +1456 -0
  334. package/dist/drawer.js.map +1 -0
  335. package/dist/dropdown-menu.js +201 -0
  336. package/dist/dropdown-menu.js.map +1 -0
  337. package/dist/external-link.js +21 -0
  338. package/dist/external-link.js.map +1 -0
  339. package/dist/file-drop.js +183 -0
  340. package/dist/file-drop.js.map +1 -0
  341. package/dist/focus-scope.js +292 -0
  342. package/dist/focus-scope.js.map +1 -0
  343. package/dist/focus.js +307 -0
  344. package/dist/focus.js.map +1 -0
  345. package/dist/form-control-Ca_KHSKK.js +177 -0
  346. package/dist/form-control-Ca_KHSKK.js.map +1 -0
  347. package/dist/head.js +25 -0
  348. package/dist/head.js.map +1 -0
  349. package/dist/heading.js +152 -0
  350. package/dist/heading.js.map +1 -0
  351. package/dist/hero.js +36 -0
  352. package/dist/hero.js.map +1 -0
  353. package/dist/hide-others.js +108 -0
  354. package/dist/hide-others.js.map +1 -0
  355. package/dist/hover-card.js +246 -0
  356. package/dist/hover-card.js.map +1 -0
  357. package/dist/hover-intent-Bxb83fgX.js +92 -0
  358. package/dist/hover-intent-Bxb83fgX.js.map +1 -0
  359. package/dist/i18n.js +72 -0
  360. package/dist/i18n.js.map +1 -0
  361. package/dist/id.js +24 -0
  362. package/dist/id.js.map +1 -0
  363. package/dist/iframe.js +19 -0
  364. package/dist/iframe.js.map +1 -0
  365. package/dist/incremental-each.js +181 -0
  366. package/dist/incremental-each.js.map +1 -0
  367. package/dist/index.js +87 -0
  368. package/dist/index.js.map +1 -0
  369. package/dist/indicator-sYuRuFJA.js +26 -0
  370. package/dist/indicator-sYuRuFJA.js.map +1 -0
  371. package/dist/input-otp.js +611 -0
  372. package/dist/input-otp.js.map +1 -0
  373. package/dist/keys.js +65 -0
  374. package/dist/keys.js.map +1 -0
  375. package/dist/label.js +41 -0
  376. package/dist/label.js.map +1 -0
  377. package/dist/layer.js +157 -0
  378. package/dist/layer.js.map +1 -0
  379. package/dist/layout-styles-DY86so8a.js +81 -0
  380. package/dist/layout-styles-DY86so8a.js.map +1 -0
  381. package/dist/link-helper.js +122 -0
  382. package/dist/link-helper.js.map +1 -0
  383. package/dist/link.js +39 -0
  384. package/dist/link.js.map +1 -0
  385. package/dist/load.js +54 -0
  386. package/dist/load.js.map +1 -0
  387. package/dist/menu-Da1LFCet.js +1109 -0
  388. package/dist/menu-Da1LFCet.js.map +1 -0
  389. package/dist/menubar.js +357 -0
  390. package/dist/menubar.js.map +1 -0
  391. package/dist/message-scroller.js +2 -0
  392. package/dist/message-scroller.js.map +1 -0
  393. package/dist/messages.js +168 -0
  394. package/dist/messages.js.map +1 -0
  395. package/dist/narrowing.js +29 -0
  396. package/dist/narrowing.js.map +1 -0
  397. package/dist/native-form.js +134 -0
  398. package/dist/native-form.js.map +1 -0
  399. package/dist/native-value.js +125 -0
  400. package/dist/native-value.js.map +1 -0
  401. package/dist/navigation-menu.js +872 -0
  402. package/dist/navigation-menu.js.map +1 -0
  403. package/dist/observers-aItWe029.js +113 -0
  404. package/dist/observers-aItWe029.js.map +1 -0
  405. package/dist/on-resize.js +47 -0
  406. package/dist/on-resize.js.map +1 -0
  407. package/dist/part.js +291 -0
  408. package/dist/part.js.map +1 -0
  409. package/dist/popover.js +419 -0
  410. package/dist/popover.js.map +1 -0
  411. package/dist/popper-BbTzV8dP.js +323 -0
  412. package/dist/popper-BbTzV8dP.js.map +1 -0
  413. package/dist/portal-U554WDI9.js +214 -0
  414. package/dist/portal-U554WDI9.js.map +1 -0
  415. package/dist/portal.js +2 -0
  416. package/dist/portal.js.map +1 -0
  417. package/dist/presence.js +243 -0
  418. package/dist/presence.js.map +1 -0
  419. package/dist/progress.js +106 -0
  420. package/dist/progress.js.map +1 -0
  421. package/dist/promise-state-BMi2zVoT.js +91 -0
  422. package/dist/promise-state-BMi2zVoT.js.map +1 -0
  423. package/dist/proper-links.js +136 -0
  424. package/dist/proper-links.js.map +1 -0
  425. package/dist/qp.js +77 -0
  426. package/dist/qp.js.map +1 -0
  427. package/dist/questionnaire.js +2 -0
  428. package/dist/questionnaire.js.map +1 -0
  429. package/dist/radio-group.js +149 -0
  430. package/dist/radio-group.js.map +1 -0
  431. package/dist/rating.js +261 -0
  432. package/dist/rating.js.map +1 -0
  433. package/dist/resizable.js +2 -0
  434. package/dist/resizable.js.map +1 -0
  435. package/dist/resize-observer.js +85 -0
  436. package/dist/resize-observer.js.map +1 -0
  437. package/dist/roving-focus.js +355 -0
  438. package/dist/roving-focus.js.map +1 -0
  439. package/dist/scroll-area.js +2 -0
  440. package/dist/scroll-area.js.map +1 -0
  441. package/dist/scroll-end-Cer8JSIB.js +87 -0
  442. package/dist/scroll-end-Cer8JSIB.js.map +1 -0
  443. package/dist/scroll-lock.js +267 -0
  444. package/dist/scroll-lock.js.map +1 -0
  445. package/dist/scroller.js +117 -0
  446. package/dist/scroller.js.map +1 -0
  447. package/dist/select.js +1223 -0
  448. package/dist/select.js.map +1 -0
  449. package/dist/separator.js +80 -0
  450. package/dist/separator.js.map +1 -0
  451. package/dist/service.js +160 -0
  452. package/dist/service.js.map +1 -0
  453. package/dist/shadowed.js +70 -0
  454. package/dist/shadowed.js.map +1 -0
  455. package/dist/slider.js +586 -0
  456. package/dist/slider.js.map +1 -0
  457. package/dist/sticky-footer.js +40 -0
  458. package/dist/sticky-footer.js.map +1 -0
  459. package/dist/store-BjiAd-KP.js +93 -0
  460. package/dist/store-BjiAd-KP.js.map +1 -0
  461. package/dist/store.js +4 -0
  462. package/dist/store.js.map +1 -0
  463. package/dist/switch.js +58 -0
  464. package/dist/switch.js.map +1 -0
  465. package/dist/tabs.js +458 -0
  466. package/dist/tabs.js.map +1 -0
  467. package/dist/toast.js +2 -0
  468. package/dist/toast.js.map +1 -0
  469. package/dist/toaster-DwprFZ1J.js +1518 -0
  470. package/dist/toaster-DwprFZ1J.js.map +1 -0
  471. package/dist/toggle-group.js +221 -0
  472. package/dist/toggle-group.js.map +1 -0
  473. package/dist/toggle.js +78 -0
  474. package/dist/toggle.js.map +1 -0
  475. package/dist/tooltip.js +422 -0
  476. package/dist/tooltip.js.map +1 -0
  477. package/dist/typeahead.js +233 -0
  478. package/dist/typeahead.js.map +1 -0
  479. package/dist/viewport.js +138 -0
  480. package/dist/viewport.js.map +1 -0
  481. package/dist/visually-hidden.js +49 -0
  482. package/dist/visually-hidden.js.map +1 -0
  483. package/dist/zoetrope.js +336 -0
  484. package/dist/zoetrope.js.map +1 -0
  485. package/package.json +101 -3
@@ -0,0 +1,1285 @@
1
+ import Component from '@glimmer/component';
2
+ import { hash } from '@ember/helper';
3
+ import Modifier, { modifier } from 'ember-modifier';
4
+ import { As } from './as.js';
5
+ import { Consume, Provide } from './dom-context.js';
6
+ import { tracked } from '@glimmer/tracking';
7
+ import { registerDestructor } from '@ember/destroyable';
8
+ import { buildWaiter } from '@ember/test-waiters';
9
+ import { getDirection } from './direction.js';
10
+ import { idFor } from './id.js';
11
+ import { ignoreROError } from './resize-observer.js';
12
+ import { isNumber } from '@sindresorhus/is';
13
+ import { g, i } from 'decorator-transforms/runtime';
14
+ import { precompileTemplate } from '@ember/template-compilation';
15
+ import { setComponentTemplate } from '@ember/component';
16
+ import templateOnly from '@ember/component/template-only';
17
+
18
+ // The layout math of a resizable group, as react-resizable-panels (v4) does it: a layout is
19
+ // one size per panel, in percent of the space the panels share, adding up to 100. Pure
20
+ // functions, so they are easy to follow and to test.
21
+
22
+ /** A size as a panel's arguments give it: a number of pixels, or a string with a unit. */
23
+
24
+ /** The units a size can be in. A string without a unit is a percentage. */
25
+
26
+ /** One panel's constraints, in percent of the group. */
27
+
28
+ /** What caused a change: it decides how collapsible panels snap. */
29
+
30
+ /** Sizes are rounded to three decimals, as react-resizable-panels' are, so float dust is equal. */
31
+ function round(value) {
32
+ return parseFloat(value.toFixed(3));
33
+ }
34
+
35
+ /** Whether two sizes are the same, within `tolerance` after rounding. */
36
+ function same(a, b, tolerance = 0) {
37
+ return Math.abs(round(a) - round(b)) <= tolerance;
38
+ }
39
+
40
+ /** -1, 0 or 1, comparing two sizes as `same()` does. */
41
+ function compare(a, b) {
42
+ if (same(a, b)) return 0;
43
+ return a > b ? 1 : -1;
44
+ }
45
+
46
+ /** Whether two layouts have the same sizes. */
47
+ function sameLayout(a, b) {
48
+ return a.length === b.length && a.every((size, index) => compare(size, b[index]) === 0);
49
+ }
50
+
51
+ /**
52
+ * A size argument's number and unit: a number is pixels, and a string is a percentage unless it
53
+ * ends in `%`, `px`, `rem`, `em`, `vh` or `vw`.
54
+ */
55
+ function parseSize(size) {
56
+ if (isNumber(size)) return [size, 'px'];
57
+ const value = parseFloat(size);
58
+ const trimmed = size.trim();
59
+ for (const unit of ['%', 'px', 'rem', 'vh', 'vw', 'em']) {
60
+ if (trimmed.endsWith(unit)) return [value, unit];
61
+ }
62
+ return [value, '%'];
63
+ }
64
+
65
+ /**
66
+ * A size in pixels: a percentage of `axisSize`, or pixels, `em` (the element's font size),
67
+ * `rem` (the root's), `vh` or `vw`.
68
+ */
69
+ function toPixels(size, axisSize, element) {
70
+ const [value, unit] = parseSize(size);
71
+ const view = element.ownerDocument.defaultView ?? window;
72
+ switch (unit) {
73
+ case '%':
74
+ return value / 100 * axisSize;
75
+ case 'px':
76
+ return value;
77
+ case 'em':
78
+ return value * parseFloat(view.getComputedStyle(element).fontSize);
79
+ case 'rem':
80
+ return value * parseFloat(view.getComputedStyle(element.ownerDocument.documentElement).fontSize);
81
+ case 'vh':
82
+ return value / 100 * view.innerHeight;
83
+ case 'vw':
84
+ return value / 100 * view.innerWidth;
85
+ }
86
+ }
87
+
88
+ /** A size in percent of `axisSize`, rounded. A percentage needs no `axisSize`. */
89
+ function toPercent(size, axisSize, element) {
90
+ const [value, unit] = parseSize(size);
91
+ if (unit === '%') return round(value);
92
+ if (axisSize <= 0) return 0;
93
+ return round(toPixels(size, axisSize, element) / axisSize * 100);
94
+ }
95
+
96
+ /** Whether a size depends on the group's size: anything but a percentage. */
97
+ function isAbsolute(size) {
98
+ return size !== undefined && parseSize(size)[1] !== '%';
99
+ }
100
+
101
+ /**
102
+ * The size a panel can take when asked for `size`: its minimum, or its collapsed size past the
103
+ * threshold, when below the minimum, and no more than its maximum. A disabled panel keeps
104
+ * `previous` unless `override` (an imperative resize, or validating a layout).
105
+ */
106
+ function constrain(constraints, previous, size, override = false) {
107
+ const {
108
+ collapsedSize,
109
+ collapsedThreshold,
110
+ collapsible,
111
+ disabled,
112
+ maxSize,
113
+ minSize
114
+ } = constraints;
115
+ if (disabled && !override) return previous;
116
+ if (compare(size, minSize) < 0) {
117
+ if (collapsible) {
118
+ const threshold = collapsedThreshold ?? (minSize - collapsedSize) / 2;
119
+ const wasCollapsed = compare(previous, collapsedSize) <= 0;
120
+ const boundary = wasCollapsed ? collapsedSize + threshold : minSize - threshold;
121
+ const side = compare(size, boundary);
122
+ const collapses = compare(size, collapsedSize) <= 0 || side < 0 || collapsedThreshold !== undefined && wasCollapsed && side === 0;
123
+ size = collapses ? collapsedSize : minSize;
124
+ } else {
125
+ size = minSize;
126
+ }
127
+ }
128
+ return round(Math.min(maxSize, size));
129
+ }
130
+
131
+ /**
132
+ * The first layout: each panel's `defaultSize`, and the space left shared equally by the panels
133
+ * that don't ask for one. Not yet validated.
134
+ */
135
+ function defaultLayout(constraints) {
136
+ let asked = 0;
137
+ let total = 0;
138
+ for (const panel of constraints) {
139
+ if (panel.defaultSize === undefined) continue;
140
+ asked += 1;
141
+ total += round(panel.defaultSize);
142
+ }
143
+ const share = constraints.length > asked ? round((100 - total) / (constraints.length - asked)) : 0;
144
+ return constraints.map(panel => panel.defaultSize === undefined ? share : round(panel.defaultSize));
145
+ }
146
+
147
+ /**
148
+ * A layout every panel's constraints accept, adding up to 100: scaled to 100 first, then each
149
+ * size constrained, and what that leaves over (or short) given to the first panels that can
150
+ * take it.
151
+ */
152
+ function validateLayout(layout, constraints) {
153
+ if (layout.length !== constraints.length) {
154
+ throw new Error(`Joinery: a layout of ${layout.length} sizes for ${constraints.length} resizable panels`);
155
+ }
156
+ const next = [...layout];
157
+ const total = next.reduce((sum, size) => sum + size, 0);
158
+ if (!same(total, 100) && next.length > 0) {
159
+ for (let index = 0; index < next.length; index++) {
160
+ next[index] = total > 0 ? 100 / total * next[index] : 100 / next.length;
161
+ }
162
+ }
163
+ let remaining = 0;
164
+ for (let index = 0; index < next.length; index++) {
165
+ const unsafe = next[index];
166
+ const safe = constrain(constraints[index], layout[index], unsafe, true);
167
+ if (unsafe !== safe) {
168
+ remaining += unsafe - safe;
169
+ next[index] = safe;
170
+ }
171
+ }
172
+ if (!same(remaining, 0)) {
173
+ for (let index = 0; index < next.length; index++) {
174
+ const previous = next[index];
175
+ const safe = constrain(constraints[index], previous, previous + remaining, true);
176
+ if (previous !== safe) {
177
+ remaining -= safe - previous;
178
+ next[index] = safe;
179
+ if (same(remaining, 0)) break;
180
+ }
181
+ }
182
+ }
183
+ return next;
184
+ }
185
+ /**
186
+ * Moves the boundary between two panels by `delta` percent, as react-resizable-panels'
187
+ * `adjustLayoutByDelta` does: the panel on the growing side grows, and the panels on the
188
+ * shrinking side give up the space, the nearest first, each down to its minimum (or collapsed,
189
+ * past its threshold). Constraints bound the move on both sides, so a drag past a limit stops
190
+ * there. Returns `previous` when nothing can change.
191
+ */
192
+ function adjustLayout({
193
+ delta,
194
+ initial,
195
+ previous,
196
+ constraints,
197
+ pivot: [before, after],
198
+ trigger
199
+ }) {
200
+ if (same(delta, 0)) return initial;
201
+ const override = trigger === 'imperative';
202
+ const next = [...initial];
203
+ let applied = 0;
204
+ if (trigger === 'keyboard') {
205
+ // A key press expands a collapsed panel to its minimum, and collapses one at its minimum,
206
+ // in one step.
207
+ {
208
+ const index = delta < 0 ? after : before;
209
+ const panel = constraints[index];
210
+ if (panel.collapsible && same(initial[index], panel.collapsedSize)) {
211
+ const local = panel.minSize - initial[index];
212
+ if (compare(local, Math.abs(delta)) > 0) delta = delta < 0 ? -local : local;
213
+ }
214
+ }
215
+ {
216
+ const index = delta < 0 ? before : after;
217
+ const panel = constraints[index];
218
+ if (panel.collapsible && same(initial[index], panel.minSize)) {
219
+ const local = initial[index] - panel.collapsedSize;
220
+ if (compare(local, Math.abs(delta)) > 0) delta = delta < 0 ? -local : local;
221
+ }
222
+ }
223
+ } else {
224
+ // A collapsed panel that a drag (or a resize) grows opens only past its threshold, and
225
+ // then all the way to its minimum.
226
+ const index = delta < 0 ? after : before;
227
+ const panel = constraints[index];
228
+ const size = initial[index];
229
+ if (panel.collapsible && compare(size, panel.minSize) < 0) {
230
+ const range = panel.minSize - panel.collapsedSize;
231
+ const threshold = panel.collapsedThreshold ?? range / 2;
232
+ if (compare(size + Math.abs(delta), panel.minSize) < 0) {
233
+ const side = compare(Math.abs(delta), threshold);
234
+ const opens = side > 0 || side === 0 && panel.collapsedThreshold === undefined && delta < 0;
235
+ delta = opens ? delta < 0 ? -range : range : 0;
236
+ }
237
+ }
238
+ }
239
+
240
+ // The most the growing side can take: no move goes further than that.
241
+ {
242
+ const step = delta < 0 ? 1 : -1;
243
+ let index = delta < 0 ? after : before;
244
+ let available = 0;
245
+ while (index >= 0 && index < constraints.length) {
246
+ const size = initial[index];
247
+ available += constrain(constraints[index], size, 100, override) - size;
248
+ index += step;
249
+ }
250
+ const limited = Math.min(Math.abs(delta), Math.abs(available));
251
+ delta = delta < 0 ? -limited : limited;
252
+ }
253
+
254
+ // The shrinking side gives up the space, the panel nearest the boundary first.
255
+ {
256
+ let index = delta < 0 ? before : after;
257
+ while (index >= 0 && index < constraints.length) {
258
+ const remaining = Math.abs(delta) - Math.abs(applied);
259
+ const size = initial[index];
260
+ const safe = constrain(constraints[index], size, size - remaining, override);
261
+ if (!same(size, safe)) {
262
+ applied += size - safe;
263
+ next[index] = safe;
264
+ if (compare(applied, Math.abs(delta)) >= 0) break;
265
+ }
266
+ index += delta < 0 ? -1 : 1;
267
+ }
268
+ }
269
+ if (sameLayout(previous, next)) return previous;
270
+
271
+ // The growing side takes what was given up: the panel nearest the boundary, then, if it
272
+ // can't take it all, the ones beyond it.
273
+ {
274
+ const index = delta < 0 ? after : before;
275
+ const size = initial[index];
276
+ const unsafe = size + applied;
277
+ const safe = constrain(constraints[index], size, unsafe, override);
278
+ next[index] = safe;
279
+ if (!same(safe, unsafe)) {
280
+ let remaining = unsafe - safe;
281
+ let other = index;
282
+ while (other >= 0 && other < constraints.length) {
283
+ const current = next[other];
284
+ const fitted = constrain(constraints[other], current, current + remaining, override);
285
+ if (!same(current, fitted)) {
286
+ remaining -= fitted - current;
287
+ next[other] = fitted;
288
+ }
289
+ if (same(remaining, 0)) break;
290
+ other += delta > 0 ? -1 : 1;
291
+ }
292
+ }
293
+ }
294
+ const total = next.reduce((sum, size) => sum + size, 0);
295
+ return same(total, 100, 0.1) ? next : previous;
296
+ }
297
+
298
+ /**
299
+ * The ARIA values of the handle after panel `index`: the panel's size now, and the smallest
300
+ * and largest it can reach by moving that handle (collapsed, or its minimum, to its maximum),
301
+ * given its neighbours' constraints.
302
+ */
303
+ function handleRange(layout, constraints, index) {
304
+ const panel = constraints[index];
305
+ const now = layout[index];
306
+ const pivot = [index, index + 1];
307
+ const reach = target => validateLayout(adjustLayout({
308
+ delta: target - now,
309
+ initial: layout,
310
+ previous: layout,
311
+ constraints,
312
+ pivot,
313
+ trigger: 'pointer'
314
+ }), constraints)[index];
315
+ return {
316
+ now,
317
+ min: reach(panel.collapsible ? panel.collapsedSize : panel.minSize),
318
+ max: reach(panel.maxSize)
319
+ };
320
+ }
321
+
322
+ const waiter = buildWaiter('@ember-joinery/primitives:resizable');
323
+
324
+ /** How far an arrow key moves a handle, in percent; Shift moves it further. */
325
+ const KEYBOARD_STEP = 5;
326
+ const KEYBOARD_STEP_SHIFT = 10;
327
+ function set(element, name, value) {
328
+ if (value === null) element.removeAttribute(name);else if (element.getAttribute(name) !== value) element.setAttribute(name, value);
329
+ }
330
+ function style(element, property, value) {
331
+ if (value === null) element.style.removeProperty(property);else if (element.style.getPropertyValue(property) !== value) element.style.setProperty(property, value);
332
+ }
333
+
334
+ /** A number for an ARIA value: three decimals at most, as react-resizable-panels gives. */
335
+ function ariaNumber(value) {
336
+ return String(round(value));
337
+ }
338
+
339
+ /** One style sheet for the resize cursor while a drag is on, adopted by the document. */
340
+ let cursorSheet;
341
+ function showCursor(document, cursor) {
342
+ if (!('adoptedStyleSheets' in document)) return;
343
+ cursorSheet ??= new CSSStyleSheet();
344
+ const sheets = document.adoptedStyleSheets.filter(sheet => sheet !== cursorSheet);
345
+ if (cursor === null) {
346
+ document.adoptedStyleSheets = sheets;
347
+ return;
348
+ }
349
+ cursorSheet.replaceSync(`*, *:hover { cursor: ${cursor} !important; user-select: none !important; -webkit-user-select: none !important; }`);
350
+ document.adoptedStyleSheets = [...sheets, cursorSheet];
351
+ }
352
+
353
+ /**
354
+ * The engine of a resizable group, as react-resizable-panels' `Group` (and ember-primitives'
355
+ * `Resizable`): panels side by side or stacked, sized in percent of the space they share, with
356
+ * a handle between each two that a pointer drags and the keyboard moves, as in APG's window
357
+ * splitter pattern.
358
+ *
359
+ * A component makes one and puts its modifiers on its elements: `group` on the group's,
360
+ * `panel` on each panel's and `handle` on each handle's. Panels and handles are the group
361
+ * element's children, in order: the handle between two panels resizes them. The group writes
362
+ * the panels' sizes into their style (`flex-grow`, so the handles keep their own size), and the
363
+ * handles' ARIA (`aria-valuenow` is the size of the panel before it, which it `aria-controls`).
364
+ *
365
+ * class Layout extends Component {
366
+ * group = new ResizableGroup({ orientation: () => this.args.orientation })
367
+ * <template>
368
+ * <div {{this.group.group}}>
369
+ * <div {{this.group.panel defaultSize="30%" minSize="20%"}}>…</div>
370
+ * <div {{this.group.handle}} aria-label="Resize the sidebar"></div>
371
+ * <div {{this.group.panel}}>…</div>
372
+ * </div>
373
+ * </template>
374
+ * }
375
+ */
376
+ class ResizableGroup {
377
+ #options;
378
+ #element = null;
379
+ #members = [];
380
+ /** Each panel's size now, in percent. */
381
+ #sizes = new Map();
382
+ #scheduled = false;
383
+ #laidOut = false;
384
+ #destroyed = false;
385
+ #drag = null;
386
+ /** The panels' total size in pixels at the last layout. */
387
+ #axis = 0;
388
+ #observer;
389
+
390
+ /** The sizes, in order, as last laid out. */
391
+ static {
392
+ g(this.prototype, "snapshot", [tracked], function () {
393
+ return {
394
+ panels: [],
395
+ sizes: []
396
+ };
397
+ });
398
+ }
399
+ #snapshot = (i(this, "snapshot"), void 0);
400
+ constructor(options = {}) {
401
+ this.#options = options;
402
+ }
403
+
404
+ /** `horizontal` or `vertical`. */
405
+ get orientation() {
406
+ return this.#options.orientation?.() ?? 'horizontal';
407
+ }
408
+ get #horizontal() {
409
+ return this.orientation === 'horizontal';
410
+ }
411
+
412
+ /** Whether the group can't be resized. */
413
+ get disabled() {
414
+ return Boolean(this.#options.disabled?.());
415
+ }
416
+
417
+ /** The panels' sizes in percent, in order. Tracked. */
418
+ get layout() {
419
+ return this.snapshot.sizes;
420
+ }
421
+
422
+ /** The panels' sizes by id, as react-resizable-panels' `getLayout()`. */
423
+ getLayout = () => {
424
+ const {
425
+ panels,
426
+ sizes
427
+ } = this.snapshot;
428
+ return Object.fromEntries(panels.map((panel, index) => [this.#idOf(panel), sizes[index]]));
429
+ };
430
+
431
+ /**
432
+ * Sets the sizes (in percent): one per panel in order, or by panel id. Constraints still
433
+ * apply, so the layout may differ; it returns the layout it set.
434
+ */
435
+ setLayout = layout => {
436
+ const panels = this.#panels();
437
+ const requested = this.#fromLayout(layout, panels);
438
+ if (requested) {
439
+ const next = validateLayout(requested, this.#constraints(panels));
440
+ this.#commit(panels, next, {
441
+ complete: true,
442
+ user: false
443
+ });
444
+ }
445
+ return this.getLayout();
446
+ };
447
+
448
+ /** The size of `panel` in percent, or `undefined` before the group lays it out. Tracked. */
449
+ sizeOf(panel) {
450
+ const {
451
+ panels,
452
+ sizes
453
+ } = this.snapshot;
454
+ const index = panels.indexOf(panel);
455
+ return index === -1 ? undefined : sizes[index];
456
+ }
457
+
458
+ // ----- Modifiers ---------------------------------------------------------------------------
459
+
460
+ /** The group's element. Takes the arguments it reacts to, so it updates when they change. */
461
+ group = groupModifier(this);
462
+
463
+ /** A panel: `<div {{group.panel defaultSize="30%"}}>`. */
464
+ panel = panelModifier(this);
465
+
466
+ /** A handle between two panels: `<div {{group.handle}}>`. */
467
+ handle = handleModifier(this);
468
+
469
+ // ----- Members -----------------------------------------------------------------------------
470
+
471
+ /** @internal */
472
+ attach(element) {
473
+ this.#element = element;
474
+ this.#destroyed = false;
475
+ ignoreROError();
476
+ this.#observer = new ResizeObserver(() => this.#onResize());
477
+ this.#observer.observe(element);
478
+ this.changed();
479
+ return () => {
480
+ this.#observer?.disconnect();
481
+ this.#observer = undefined;
482
+ this.#endDrag();
483
+ this.#element = null;
484
+ this.#destroyed = true;
485
+ };
486
+ }
487
+
488
+ /** @internal */
489
+ register(member) {
490
+ this.#members.push(member);
491
+ if (member.kind === 'handle') this.#listen(member);
492
+ this.changed();
493
+ return () => {
494
+ this.#members = this.#members.filter(other => other !== member);
495
+ if (member.kind === 'panel') {
496
+ this.#sizes.delete(member);
497
+ member.options.api?.unbind(member);
498
+ }
499
+ if (this.#drag && (this.#drag.handle === member || member.kind === 'panel')) this.#endDrag();
500
+ this.changed();
501
+ };
502
+ }
503
+
504
+ /** @internal Something changed that the layout depends on: lay it out again after the render. */
505
+ changed() {
506
+ if (this.#scheduled || this.#destroyed) return;
507
+ this.#scheduled = true;
508
+ // After the render that brought the change, so every member has come, and before the
509
+ // browser paints. The layout writes tracked state, which the render can't.
510
+ const token = waiter.beginAsync();
511
+ queueMicrotask(() => {
512
+ waiter.endAsync(token);
513
+ this.#flush();
514
+ });
515
+ }
516
+
517
+ /** The panels in document order (they are the group's children). */
518
+ #panels() {
519
+ return this.#ordered().filter(member => member.kind === 'panel');
520
+ }
521
+ #handles() {
522
+ return this.#ordered().filter(member => member.kind === 'handle');
523
+ }
524
+ #ordered() {
525
+ return [...this.#members].sort((a, b) => a.element.compareDocumentPosition(b.element) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1);
526
+ }
527
+
528
+ /** A panel's id: its `@id`, or its element's (one the group gives it, if it has none). */
529
+ #idOf(panel) {
530
+ return panel.options.id ?? (panel.element.id || idFor(panel, 'panel'));
531
+ }
532
+
533
+ /** The panels either side of a handle, as indices in `panels`. */
534
+ #pivot(handle, panels) {
535
+ let before = -1;
536
+ panels.forEach((panel, index) => {
537
+ if (panel.element.compareDocumentPosition(handle.element) & Node.DOCUMENT_POSITION_FOLLOWING) before = index;
538
+ });
539
+ if (before === -1 || before === panels.length - 1) return undefined;
540
+ return [before, before + 1];
541
+ }
542
+
543
+ // ----- Measuring ---------------------------------------------------------------------------
544
+
545
+ /** The space the panels share, in pixels: the group's, less the handles'. */
546
+ #measure() {
547
+ const element = this.#element;
548
+ if (!element) return 0;
549
+ const computed = getComputedStyle(element);
550
+ const horizontal = this.#horizontal;
551
+ let size = horizontal ? element.clientWidth - parseFloat(computed.paddingLeft) - parseFloat(computed.paddingRight) : element.clientHeight - parseFloat(computed.paddingTop) - parseFloat(computed.paddingBottom);
552
+ for (const handle of this.#handles()) {
553
+ const box = handle.element.getBoundingClientRect();
554
+ const own = getComputedStyle(handle.element);
555
+ size -= horizontal ? box.width + parseFloat(own.marginLeft) + parseFloat(own.marginRight) : box.height + parseFloat(own.marginTop) + parseFloat(own.marginBottom);
556
+ }
557
+ return Math.max(0, size);
558
+ }
559
+ #constraints(panels, axis = this.#axis) {
560
+ return panels.map(({
561
+ element,
562
+ options
563
+ }) => {
564
+ const percent = (size, fallback) => size === undefined ? fallback : toPercent(size, axis, element);
565
+ // Without a size, a group can't turn pixels into percent: only percentages hold.
566
+ const usable = size => axis > 0 || !isAbsolute(size) ? size : undefined;
567
+ return {
568
+ minSize: percent(usable(options.minSize), 0),
569
+ maxSize: percent(usable(options.maxSize), 100),
570
+ collapsible: Boolean(options.collapsible),
571
+ collapsedSize: percent(usable(options.collapsedSize), 0),
572
+ collapsedThreshold: usable(options.collapsedThreshold) === undefined ? undefined : percent(options.collapsedThreshold, 0),
573
+ defaultSize: usable(options.defaultSize) === undefined ? undefined : percent(options.defaultSize, 0),
574
+ disabled: Boolean(options.disabled)
575
+ };
576
+ });
577
+ }
578
+
579
+ /** A layout from `@defaultLayout` or `setLayout()`, if it names every panel. */
580
+ #fromLayout(layout, panels) {
581
+ if (!layout) return undefined;
582
+ if (Array.isArray(layout)) {
583
+ return layout.length === panels.length ? [...layout] : undefined;
584
+ }
585
+ const map = layout;
586
+ const sizes = panels.map(panel => map[this.#idOf(panel)]);
587
+ return sizes.every(size => isNumber(size)) ? sizes : undefined;
588
+ }
589
+
590
+ // ----- Layout ------------------------------------------------------------------------------
591
+
592
+ /** Lays the group out after members came or went, or their constraints changed. */
593
+ #flush() {
594
+ this.#scheduled = false;
595
+ const element = this.#element;
596
+ if (!element || this.#destroyed) return;
597
+ this.#styleGroup(element);
598
+ const panels = this.#panels();
599
+ // The panels share the space by flex-grow, from a flex-basis of 0: set that before measuring.
600
+ for (const panel of panels) this.#stylePanel(panel);
601
+ for (const handle of this.#handles()) this.#styleHandle(handle);
602
+ if (panels.length === 0) {
603
+ this.#commit(panels, [], {
604
+ complete: true,
605
+ user: false
606
+ });
607
+ return;
608
+ }
609
+ this.#axis = this.#measure();
610
+ const constraints = this.#constraints(panels);
611
+ let layout;
612
+ if (!this.#laidOut) layout = this.#fromLayout(this.#options.defaultLayout?.(), panels);
613
+ if (!layout) {
614
+ const known = panels.filter(panel => this.#sizes.has(panel));
615
+ if (known.length === 0) {
616
+ layout = defaultLayout(constraints);
617
+ } else {
618
+ // Panels that were there keep their size; new ones take theirs, or share what is left,
619
+ // or, with nothing left, take an equal share as the others make room (as a new window
620
+ // opens in a tiling window manager).
621
+ const sizes = panels.map(panel => this.#sizes.get(panel));
622
+ const fresh = sizes.flatMap((size, index) => size === undefined ? [index] : []);
623
+ const asked = fresh.filter(index => constraints[index].defaultSize !== undefined);
624
+ const unasked = fresh.filter(index => constraints[index].defaultSize === undefined);
625
+ const taken = sizes.reduce((sum, size) => sum + (size ?? 0), 0) + asked.reduce((sum, index) => sum + constraints[index].defaultSize, 0);
626
+ let share = unasked.length ? (100 - taken) / unasked.length : 0;
627
+ if (unasked.length && share < 1) share = 100 / panels.length;
628
+ layout = sizes.map((size, index) => size ?? constraints[index].defaultSize ?? share);
629
+ }
630
+ }
631
+ const next = validateLayout(layout, constraints);
632
+ const first = !this.#laidOut;
633
+ this.#laidOut = true;
634
+ this.#commit(panels, next, {
635
+ complete: true,
636
+ user: false,
637
+ force: first
638
+ });
639
+ }
640
+
641
+ /** The group changed size: panels sized in pixels keep their size, and constraints convert. */
642
+ #onResize() {
643
+ if (!this.#laidOut || this.#drag || !this.#element) return;
644
+ const panels = this.#panels();
645
+ if (!panels.length) return;
646
+ const previousAxis = this.#axis;
647
+ const axis = this.#measure();
648
+ if (same(axis, previousAxis, 0.5)) return;
649
+ const absolute = panels.some(({
650
+ options
651
+ }) => options.groupResizeBehavior === 'preserve-pixel-size' || [options.defaultSize, options.minSize, options.maxSize, options.collapsedSize, options.collapsedThreshold].some(isAbsolute));
652
+ this.#axis = axis;
653
+ if (!absolute) return;
654
+ let layout = panels.map(panel => this.#sizes.get(panel) ?? 0);
655
+ const fixed = panels.map(panel => panel.options.groupResizeBehavior === 'preserve-pixel-size' && previousAxis > 0);
656
+ if (fixed.some(Boolean) && axis > 0) {
657
+ const kept = layout.map((size, index) => fixed[index] ? size / 100 * (previousAxis / axis) * 100 : size);
658
+ const fixedTotal = kept.reduce((sum, size, index) => fixed[index] ? sum + size : sum, 0);
659
+ const relativeTotal = kept.reduce((sum, size, index) => fixed[index] ? sum : sum + size, 0);
660
+ const scale = relativeTotal > 0 ? Math.max(0, 100 - fixedTotal) / relativeTotal : 0;
661
+ layout = kept.map((size, index) => fixed[index] ? size : size * scale);
662
+ }
663
+ this.#commit(panels, validateLayout(layout, this.#constraints(panels, axis)), {
664
+ complete: true,
665
+ user: false
666
+ });
667
+ }
668
+
669
+ /** Writes a layout: the panels' sizes, the handles' ARIA, and tells whoever listens. */
670
+ #commit(panels, layout, {
671
+ complete,
672
+ user,
673
+ force = false
674
+ }) {
675
+ const before = panels.map(panel => this.#sizes.get(panel));
676
+ panels.forEach((panel, index) => this.#sizes.set(panel, layout[index]));
677
+ const changed = force || before.some((size, index) => size === undefined || !same(size, layout[index]));
678
+ const constraints = this.#constraints(panels);
679
+ panels.forEach((panel, index) => {
680
+ const size = layout[index];
681
+ style(panel.element, 'flex-grow', String(size));
682
+ const c = constraints[index];
683
+ const collapsed = c.collapsible && same(size, c.collapsedSize);
684
+ set(panel.element, 'data-collapsed', collapsed ? '' : null);
685
+ panel.options.api?.bind(this, panel);
686
+ });
687
+ this.#syncHandles(panels, layout, constraints);
688
+ if (!sameLayout(this.snapshot.sizes, layout) || this.snapshot.panels.length !== panels.length) this.snapshot = {
689
+ panels: [...panels],
690
+ sizes: [...layout]
691
+ };else if (this.snapshot.panels.some((panel, index) => panel !== panels[index])) this.snapshot = {
692
+ panels: [...panels],
693
+ sizes: [...layout]
694
+ };
695
+ if (!changed) return;
696
+ const sizes = [...layout];
697
+ const map = this.getLayout();
698
+ this.#options.onLayoutChange?.()?.(sizes, map);
699
+ panels.forEach((panel, index) => {
700
+ const size = {
701
+ asPercentage: layout[index],
702
+ inPixels: round(layout[index] / 100 * this.#axis)
703
+ };
704
+ const reported = panel.reported;
705
+ if (reported && same(reported.asPercentage, size.asPercentage)) return;
706
+ panel.reported = size;
707
+ panel.options.onResize?.(size, this.#idOf(panel), reported);
708
+ });
709
+ if (complete) this.#options.onLayoutChanged?.()?.(sizes, map, {
710
+ isUserInteraction: user
711
+ });
712
+ }
713
+ #syncHandles(panels, layout, constraints) {
714
+ for (const handle of this.#handles()) {
715
+ this.#styleHandle(handle);
716
+ const pivot = this.#pivot(handle, panels);
717
+ if (!pivot) {
718
+ for (const name of ['aria-controls', 'aria-valuenow', 'aria-valuemin', 'aria-valuemax']) set(handle.element, name, null);
719
+ continue;
720
+ }
721
+ const [index] = pivot;
722
+ const range = handleRange(layout, constraints, index);
723
+ set(handle.element, 'aria-controls', panels[index].element.id || null);
724
+ set(handle.element, 'aria-valuenow', ariaNumber(range.now));
725
+ set(handle.element, 'aria-valuemin', ariaNumber(range.min));
726
+ set(handle.element, 'aria-valuemax', ariaNumber(range.max));
727
+ }
728
+ }
729
+ #styleGroup(element) {
730
+ const horizontal = this.#horizontal;
731
+ style(element, 'display', 'flex');
732
+ style(element, 'flex-direction', horizontal ? 'row' : 'column');
733
+ style(element, 'flex-wrap', 'nowrap');
734
+ style(element, 'overflow', 'hidden');
735
+ // The group handles the drag along its axis; content still scrolls the other way.
736
+ style(element, 'touch-action', horizontal ? 'pan-y' : 'pan-x');
737
+ set(element, 'data-orientation', this.orientation);
738
+ set(element, 'data-group', '');
739
+ }
740
+ #stylePanel(panel) {
741
+ const {
742
+ element,
743
+ options
744
+ } = panel;
745
+ style(element, 'display', 'flex');
746
+ style(element, 'flex-basis', '0px');
747
+ style(element, 'flex-shrink', '1');
748
+ if (!element.style.getPropertyValue('flex-grow')) style(element, 'flex-grow', '1');
749
+ style(element, 'min-width', '0px');
750
+ style(element, 'min-height', '0px');
751
+ style(element, 'max-width', '100%');
752
+ style(element, 'max-height', '100%');
753
+ style(element, 'overflow', 'visible');
754
+ set(element, 'id', this.#idOf(panel));
755
+ set(element, 'data-panel', '');
756
+ set(element, 'data-disabled', options.disabled ? '' : null);
757
+ set(element, 'data-test-jn-part', 'panel');
758
+ set(element, 'data-test-jn-value', options.id ?? null);
759
+ }
760
+ #styleHandle(handle) {
761
+ const {
762
+ element
763
+ } = handle;
764
+ const disabled = this.disabled || Boolean(handle.options.disabled);
765
+ style(element, 'flex-grow', '0');
766
+ style(element, 'flex-shrink', '0');
767
+ style(element, 'touch-action', 'none');
768
+ const cursor = this.#options.disableCursor?.() ? null : disabled ? 'not-allowed' : this.#horizontal ? 'col-resize' : 'row-resize';
769
+ style(element, 'cursor', cursor);
770
+ set(element, 'role', 'separator');
771
+ set(element, 'tabindex', disabled ? null : '0');
772
+ set(element, 'aria-orientation', this.#horizontal ? 'vertical' : 'horizontal');
773
+ set(element, 'aria-disabled', disabled ? 'true' : null);
774
+ set(element, 'data-orientation', this.orientation);
775
+ set(element, 'data-separator', this.#handleState(handle));
776
+ set(element, 'data-resizing', this.#drag?.handle === handle ? '' : null);
777
+ set(element, 'data-test-jn-part', 'handle');
778
+ }
779
+ #handleState(handle) {
780
+ if (this.disabled || handle.options.disabled) return 'disabled';
781
+ if (this.#drag?.handle === handle) return 'active';
782
+ if (handle.focused) return 'focus';
783
+ if (handle.hovered) return 'hover';
784
+ return 'inactive';
785
+ }
786
+
787
+ /** Moves the boundary at `pivot` by `delta` percent, and commits the result. */
788
+ #move(panels, pivot, delta, trigger, {
789
+ complete,
790
+ user
791
+ }, initial, constraints = this.#constraints(panels)) {
792
+ const current = panels.map(panel => this.#sizes.get(panel) ?? 0);
793
+ const next = validateLayout(adjustLayout({
794
+ delta,
795
+ initial: initial ?? current,
796
+ previous: current,
797
+ constraints,
798
+ pivot,
799
+ trigger
800
+ }), constraints);
801
+ if (sameLayout(next, current)) return false;
802
+ const before = panels[pivot[0]];
803
+ const c = constraints[pivot[0]];
804
+ if (c.collapsible && same(next[pivot[0]], c.collapsedSize) && !same(current[pivot[0]], next[pivot[0]])) before.expandedSize = current[pivot[0]];
805
+ this.#commit(panels, next, {
806
+ complete,
807
+ user
808
+ });
809
+ return true;
810
+ }
811
+
812
+ // ----- Panel API ---------------------------------------------------------------------------
813
+
814
+ /** @internal Resizes a panel, as its API's `resize()`. */
815
+ resizePanel(panel, size) {
816
+ const panels = this.#panels();
817
+ const index = panels.indexOf(panel);
818
+ if (index === -1 || panels.length < 2) return;
819
+ const constraints = this.#constraints(panels);
820
+ const current = this.#sizes.get(panel) ?? 0;
821
+ const target = toPercent(size, this.#axis, panel.element);
822
+ const last = index === panels.length - 1;
823
+ const pivot = last ? [index - 1, index] : [index, index + 1];
824
+ const c = constraints[index];
825
+ if (c.collapsible && same(target, c.collapsedSize) && !same(current, target)) panel.expandedSize = current;
826
+ this.#move(panels, pivot, last ? current - target : target - current, 'imperative', {
827
+ complete: true,
828
+ user: false
829
+ }, undefined, constraints);
830
+ }
831
+
832
+ /** @internal */
833
+ isCollapsed(panel) {
834
+ const panels = this.snapshot.panels;
835
+ const index = panels.indexOf(panel);
836
+ if (index === -1 || !panel.options.collapsible) return false;
837
+ const c = this.#constraints([panel])[0];
838
+ return same(this.snapshot.sizes[index], c.collapsedSize);
839
+ }
840
+
841
+ /** @internal */
842
+ collapse(panel) {
843
+ if (!panel.options.collapsible || this.#isCollapsedNow(panel)) return;
844
+ panel.expandedSize = this.#sizes.get(panel);
845
+ this.resizePanel(panel, `${this.#constraints([panel])[0].collapsedSize}%`);
846
+ }
847
+
848
+ /** @internal */
849
+ expand(panel) {
850
+ if (!this.#isCollapsedNow(panel)) return;
851
+ const c = this.#constraints([panel])[0];
852
+ const size = Math.max(panel.expandedSize ?? c.minSize, c.minSize);
853
+ this.resizePanel(panel, `${size}%`);
854
+ }
855
+
856
+ /** @internal */
857
+ pixelsOf(panel) {
858
+ return round((this.#sizes.get(panel) ?? 0) / 100 * this.#axis);
859
+ }
860
+ #isCollapsedNow(panel) {
861
+ if (!panel.options.collapsible) return false;
862
+ const size = this.#sizes.get(panel);
863
+ return size !== undefined && same(size, this.#constraints([panel])[0].collapsedSize);
864
+ }
865
+
866
+ // ----- Handles -----------------------------------------------------------------------------
867
+
868
+ #listen(handle) {
869
+ const element = handle.element;
870
+ const listeners = [['pointerdown', event => this.#onPointerDown(handle, event)], ['keydown', event => this.#onKeyDown(handle, event)], ['dblclick', event => this.#onDoubleClick(handle, event)], ['pointerenter', () => this.#hover(handle, true)], ['pointerleave', () => this.#hover(handle, false)], ['focus', () => this.#focus(handle, true)], ['blur', () => this.#focus(handle, false)]];
871
+ for (const [type, listener] of listeners) element.addEventListener(type, listener);
872
+ handle.unlisten = () => {
873
+ for (const [type, listener] of listeners) element.removeEventListener(type, listener);
874
+ };
875
+ }
876
+ #hover(handle, hovered) {
877
+ handle.hovered = hovered;
878
+ this.#styleHandle(handle);
879
+ }
880
+ #focus(handle, focused) {
881
+ handle.focused = focused;
882
+ this.#styleHandle(handle);
883
+ }
884
+ #canMove(handle) {
885
+ return !this.disabled && !handle.options.disabled;
886
+ }
887
+ #direction() {
888
+ return getDirection(this.#element, this.#options.dir?.());
889
+ }
890
+ #onPointerDown(handle, event) {
891
+ if (event.defaultPrevented || event.button !== 0 || this.#drag || !this.#canMove(handle)) return;
892
+ const panels = this.#panels();
893
+ const pivot = this.#pivot(handle, panels);
894
+ if (!pivot) return;
895
+ const document = handle.element.ownerDocument;
896
+ const horizontal = this.#horizontal;
897
+ this.#axis = this.#measure();
898
+ const move = moveEvent => {
899
+ const drag = this.#drag;
900
+ if (!drag || moveEvent.pointerId !== drag.pointerId || drag.axis <= 0) return;
901
+ const coordinate = horizontal ? moveEvent.clientX : moveEvent.clientY;
902
+ let delta = (coordinate - drag.start) / drag.axis * 100;
903
+ if (horizontal && this.#direction() === 'rtl') delta = -delta;
904
+ this.#move(panels, drag.pivot, delta, 'pointer', {
905
+ complete: false,
906
+ user: true
907
+ }, drag.initial, drag.constraints);
908
+ };
909
+ const end = endEvent => {
910
+ const drag = this.#drag;
911
+ if (!drag || endEvent.pointerId !== drag.pointerId) return;
912
+ const moved = !sameLayout(drag.initial, panels.map(panel => this.#sizes.get(panel) ?? 0));
913
+ this.#endDrag();
914
+ if (moved) {
915
+ this.#options.onLayoutChanged?.()?.(this.layout, this.getLayout(), {
916
+ isUserInteraction: true
917
+ });
918
+ }
919
+ };
920
+ document.addEventListener('pointermove', move);
921
+ document.addEventListener('pointerup', end);
922
+ document.addEventListener('pointercancel', end);
923
+ try {
924
+ handle.element.setPointerCapture(event.pointerId);
925
+ } catch {
926
+ // An event a test made has no pointer to capture.
927
+ }
928
+ this.#drag = {
929
+ handle,
930
+ pointerId: event.pointerId,
931
+ start: horizontal ? event.clientX : event.clientY,
932
+ // In the pointer's pixels, which a transform on the page (a zoom, a scale) changes.
933
+ axis: panels.reduce((sum, panel) => {
934
+ const box = panel.element.getBoundingClientRect();
935
+ return sum + (horizontal ? box.width : box.height);
936
+ }, 0),
937
+ initial: panels.map(panel => this.#sizes.get(panel) ?? 0),
938
+ pivot,
939
+ constraints: this.#constraints(panels),
940
+ done: () => {
941
+ document.removeEventListener('pointermove', move);
942
+ document.removeEventListener('pointerup', end);
943
+ document.removeEventListener('pointercancel', end);
944
+ try {
945
+ if (handle.element.hasPointerCapture(event.pointerId)) handle.element.releasePointerCapture(event.pointerId);
946
+ } catch {
947
+ // As above.
948
+ }
949
+ if (!this.#options.disableCursor?.()) showCursor(document, null);
950
+ }
951
+ };
952
+ if (!this.#options.disableCursor?.()) showCursor(document, horizontal ? 'col-resize' : 'row-resize');
953
+ this.#styleHandle(handle);
954
+ }
955
+ #endDrag() {
956
+ const drag = this.#drag;
957
+ if (!drag) return;
958
+ this.#drag = null;
959
+ drag.done();
960
+ this.#styleHandle(drag.handle);
961
+ }
962
+ #onKeyDown(handle, event) {
963
+ if (event.defaultPrevented || !this.#canMove(handle)) return;
964
+ if (event.altKey || event.ctrlKey || event.metaKey) return;
965
+ const panels = this.#panels();
966
+ const pivot = this.#pivot(handle, panels);
967
+ if (!pivot) return;
968
+ const horizontal = this.#horizontal;
969
+ const step = event.shiftKey ? KEYBOARD_STEP_SHIFT : KEYBOARD_STEP;
970
+ const rtl = horizontal && this.#direction() === 'rtl';
971
+ const user = {
972
+ complete: true,
973
+ user: true
974
+ };
975
+ switch (event.key) {
976
+ case 'ArrowLeft':
977
+ case 'ArrowRight':
978
+ {
979
+ event.preventDefault();
980
+ if (!horizontal) return;
981
+ const forward = event.key === 'ArrowRight' ? !rtl : rtl;
982
+ this.#move(panels, pivot, forward ? step : -step, 'keyboard', user);
983
+ return;
984
+ }
985
+ case 'ArrowUp':
986
+ case 'ArrowDown':
987
+ {
988
+ event.preventDefault();
989
+ if (horizontal) return;
990
+ this.#move(panels, pivot, event.key === 'ArrowDown' ? step : -step, 'keyboard', user);
991
+ return;
992
+ }
993
+ case 'Home':
994
+ event.preventDefault();
995
+ this.#move(panels, pivot, -100, 'keyboard', user);
996
+ return;
997
+ case 'End':
998
+ event.preventDefault();
999
+ this.#move(panels, pivot, 100, 'keyboard', user);
1000
+ return;
1001
+ case 'Enter':
1002
+ {
1003
+ event.preventDefault();
1004
+ const [index] = pivot;
1005
+ const panel = panels[index];
1006
+ const constraints = this.#constraints(panels);
1007
+ const c = constraints[index];
1008
+ if (!c.collapsible) return;
1009
+ const current = this.#sizes.get(panel) ?? 0;
1010
+ const target = same(current, c.collapsedSize) ? Math.max(panel.expandedSize ?? c.minSize, c.minSize) : c.collapsedSize;
1011
+ this.#move(panels, pivot, target - current, 'keyboard', user, undefined, constraints);
1012
+ return;
1013
+ }
1014
+ case 'F6':
1015
+ {
1016
+ event.preventDefault();
1017
+ const handles = this.#handles().filter(other => this.#canMove(other));
1018
+ const index = handles.indexOf(handle);
1019
+ if (index === -1 || handles.length < 2) return;
1020
+ const next = event.shiftKey ? handles[(index - 1 + handles.length) % handles.length] : handles[(index + 1) % handles.length];
1021
+ next.element.focus({
1022
+ preventScroll: true
1023
+ });
1024
+ return;
1025
+ }
1026
+ }
1027
+ }
1028
+ #onDoubleClick(handle, event) {
1029
+ if (event.defaultPrevented || !this.#canMove(handle) || handle.options.disableDoubleClick) return;
1030
+ const panels = this.#panels();
1031
+ const pivot = this.#pivot(handle, panels);
1032
+ if (!pivot) return;
1033
+ const constraints = this.#constraints(panels);
1034
+ const index = pivot.find(i => constraints[i].defaultSize !== undefined);
1035
+ if (index === undefined) return;
1036
+ const panel = panels[index];
1037
+ const size = panel.options.defaultSize;
1038
+ if (size === undefined) return;
1039
+ event.preventDefault();
1040
+ this.resizePanel(panel, isNumber(size) ? size : `${constraints[index].defaultSize}%`);
1041
+ }
1042
+
1043
+ /** @internal A member's arguments changed. */
1044
+ update(member) {
1045
+ if (member.kind === 'handle') this.#styleHandle(member);
1046
+ this.changed();
1047
+ }
1048
+
1049
+ /** @internal */
1050
+ refresh() {
1051
+ const element = this.#element;
1052
+ if (!element) return;
1053
+ this.#styleGroup(element);
1054
+ for (const handle of this.#handles()) this.#styleHandle(handle);
1055
+ }
1056
+ }
1057
+
1058
+ /**
1059
+ * A panel's size and its imperative API, as react-resizable-panels' `panelRef` gives:
1060
+ * `<ResizablePanel as |panel|>` yields one.
1061
+ */
1062
+ class ResizablePanelApi {
1063
+ #group;
1064
+ #member;
1065
+ static {
1066
+ g(this.prototype, "bound", [tracked], function () {
1067
+ return 0;
1068
+ });
1069
+ }
1070
+ #bound = (i(this, "bound"), void 0);
1071
+ /** @internal */
1072
+ bind(group, member) {
1073
+ if (this.#group === group && this.#member === member) return;
1074
+ this.#group = group;
1075
+ this.#member = member;
1076
+ this.bound += 1;
1077
+ }
1078
+
1079
+ /** @internal */
1080
+ unbind(member) {
1081
+ if (this.#member !== member) return;
1082
+ this.#group = undefined;
1083
+ this.#member = undefined;
1084
+ }
1085
+
1086
+ /** Its size in percent of the group, or `undefined` before the group lays it out. Tracked. */
1087
+ get size() {
1088
+ void this.bound;
1089
+ const member = this.#member;
1090
+ return member ? this.#group?.sizeOf(member) : undefined;
1091
+ }
1092
+
1093
+ /** Whether it is collapsed now. Tracked. */
1094
+ get isCollapsed() {
1095
+ void this.bound;
1096
+ const member = this.#member;
1097
+ return member ? Boolean(this.#group?.isCollapsed(member)) : false;
1098
+ }
1099
+
1100
+ /** Its size in percent and in pixels. */
1101
+ getSize = () => {
1102
+ const member = this.#member;
1103
+ const group = this.#group;
1104
+ if (!member || !group) return {
1105
+ asPercentage: 0,
1106
+ inPixels: 0
1107
+ };
1108
+ return {
1109
+ asPercentage: group.sizeOf(member) ?? 0,
1110
+ inPixels: group.pixelsOf(member)
1111
+ };
1112
+ };
1113
+
1114
+ /** Resizes it, as its arguments take sizes: `resize("40%")`, `resize(200)` (pixels). */
1115
+ resize = size => {
1116
+ if (this.#member) this.#group?.resizePanel(this.#member, size);
1117
+ };
1118
+
1119
+ /** Collapses it to its collapsed size, if it is collapsible. */
1120
+ collapse = () => {
1121
+ if (this.#member) this.#group?.collapse(this.#member);
1122
+ };
1123
+
1124
+ /** Expands it back to the size it had, or its minimum. */
1125
+ expand = () => {
1126
+ if (this.#member) this.#group?.expand(this.#member);
1127
+ };
1128
+ }
1129
+ function groupModifier(group) {
1130
+ return class ResizableGroupModifier extends Modifier {
1131
+ #installed = false;
1132
+ modify(element, _, named) {
1133
+ // Read, so the modifier runs again when they change (ember-modifier consumes lazily).
1134
+ void named.orientation;
1135
+ void named.disabled;
1136
+ if (this.#installed) {
1137
+ group.refresh();
1138
+ group.changed();
1139
+ return;
1140
+ }
1141
+ this.#installed = true;
1142
+ const detach = group.attach(element);
1143
+ registerDestructor(this, detach);
1144
+ }
1145
+ };
1146
+ }
1147
+ function panelModifier(group) {
1148
+ return class ResizablePanelModifier extends Modifier {
1149
+ #member;
1150
+ modify(element, _, named) {
1151
+ const options = {
1152
+ ...named
1153
+ };
1154
+ const member = this.#member;
1155
+ if (member) {
1156
+ member.options = options;
1157
+ group.update(member);
1158
+ return;
1159
+ }
1160
+ const created = this.#member = {
1161
+ kind: 'panel',
1162
+ element,
1163
+ options
1164
+ };
1165
+ const unregister = group.register(created);
1166
+ registerDestructor(this, unregister);
1167
+ }
1168
+ };
1169
+ }
1170
+ function handleModifier(group) {
1171
+ return class ResizableHandleModifier extends Modifier {
1172
+ #member;
1173
+ modify(element, _, named) {
1174
+ const options = {
1175
+ ...named
1176
+ };
1177
+ const member = this.#member;
1178
+ if (member) {
1179
+ member.options = options;
1180
+ group.update(member);
1181
+ return;
1182
+ }
1183
+ const created = this.#member = {
1184
+ kind: 'handle',
1185
+ element,
1186
+ options,
1187
+ hovered: false,
1188
+ focused: false
1189
+ };
1190
+ const unregister = group.register(created);
1191
+ registerDestructor(this, () => {
1192
+ created.unlisten?.();
1193
+ unregister();
1194
+ });
1195
+ }
1196
+ };
1197
+ }
1198
+
1199
+ const panelContent = modifier((element, [orientation, collapsed]) => {
1200
+ element.style.setProperty('flex-grow', '1');
1201
+ element.style.setProperty('max-width', '100%');
1202
+ element.style.setProperty('max-height', '100%');
1203
+ // A collapsed panel shows nothing, so nothing in it scrolls (or takes focus as a scroller).
1204
+ element.style.setProperty('overflow', collapsed ? 'hidden' : 'auto');
1205
+ element.style.setProperty('touch-action', orientation === 'horizontal' ? 'pan-y' : 'pan-x');
1206
+ });
1207
+ /**
1208
+ * A panel of a `<Resizable>` group (react-resizable-panels' `Panel`): give it its sizes in
1209
+ * percent (`@defaultSize="30%"`) or with a unit (`"200px"`, `"10rem"`). It must be a child of
1210
+ * the group's element, and it finds its group there. It yields its size and its API:
1211
+ *
1212
+ * <ResizablePanel @defaultSize="25%" @collapsible={{true}} @minSize="15%" as |panel|>
1213
+ * <button type="button" {{on "click" panel.collapse}}>Hide</button>
1214
+ * </ResizablePanel>
1215
+ */
1216
+ class ResizablePanel extends Component {
1217
+ api = new ResizablePanelApi();
1218
+ static {
1219
+ setComponentTemplate(precompileTemplate("<Consume @key={{ResizableGroup}} as |context|>\n <As @as={{@as}} @tag=\"div\" id={{@id}} data-slot=\"resizable-panel\" data-test-jn-part=\"panel\" data-test-jn-value={{@id}} ...attributes {{context.data.panel id=@id defaultSize=@defaultSize minSize=@minSize maxSize=@maxSize collapsible=@collapsible collapsedSize=@collapsedSize collapsedThreshold=@collapsedThreshold disabled=@disabled groupResizeBehavior=@groupResizeBehavior onResize=@onResize api=this.api}}>\n <div {{panelContent context.data.orientation this.api.isCollapsed}}>{{yield this.api}}</div>\n </As>\n</Consume>", {
1220
+ strictMode: true,
1221
+ scope: () => ({
1222
+ Consume,
1223
+ ResizableGroup,
1224
+ As,
1225
+ panelContent
1226
+ })
1227
+ }), this);
1228
+ }
1229
+ }
1230
+ /**
1231
+ * The handle between two panels of a `<Resizable>` group (react-resizable-panels'
1232
+ * `Separator`): a `role="separator"` that a pointer drags and the arrow keys move, as in APG's
1233
+ * window splitter. It resizes the panels either side of it. Name it for what it resizes
1234
+ * (`aria-label="Resize the sidebar"`).
1235
+ */
1236
+ const ResizableHandle = setComponentTemplate(precompileTemplate("<Consume @key={{ResizableGroup}} as |context|>\n <As @as={{@as}} @tag=\"div\" role=\"separator\" tabindex=\"0\" data-slot=\"resizable-handle\" data-test-jn-part=\"handle\" ...attributes {{context.data.handle disabled=@disabled disableDoubleClick=@disableDoubleClick}}>{{yield}}</As>\n</Consume>", {
1237
+ strictMode: true,
1238
+ scope: () => ({
1239
+ Consume,
1240
+ ResizableGroup,
1241
+ As
1242
+ })
1243
+ }), templateOnly());
1244
+ /** What `<Resizable>` yields. */
1245
+
1246
+ /**
1247
+ * A group of resizable panels with handles between them, as react-resizable-panels' `Group`
1248
+ * and ember-primitives' `Resizable`. Panels and handles are its children; a panel can hold
1249
+ * another group, for a nested layout.
1250
+ *
1251
+ * <Resizable @orientation="horizontal" as |r|>
1252
+ * <r.Panel @defaultSize="25%" @minSize="15%">Sidebar</r.Panel>
1253
+ * <r.Handle aria-label="Resize the sidebar" />
1254
+ * <r.Panel>Content</r.Panel>
1255
+ * </Resizable>
1256
+ *
1257
+ * `ResizablePanel` and `ResizableHandle` are the same components, to import on their own.
1258
+ */
1259
+ class Resizable extends Component {
1260
+ group = new ResizableGroup({
1261
+ orientation: () => this.args.orientation,
1262
+ dir: () => this.args.dir,
1263
+ disabled: () => this.args.disabled,
1264
+ disableCursor: () => this.args.disableCursor,
1265
+ defaultLayout: () => this.args.defaultLayout,
1266
+ onLayoutChange: () => this.args.onLayoutChange,
1267
+ onLayoutChanged: () => this.args.onLayoutChanged
1268
+ });
1269
+ static {
1270
+ setComponentTemplate(precompileTemplate("<As @as={{@as}} @tag=\"div\" data-slot=\"resizable\" data-orientation={{this.group.orientation}} data-test-jn=\"resizable\" data-test-jn-name={{@name}} ...attributes {{this.group.group orientation=@orientation disabled=@disabled}}>\n <Provide @data={{this.group}} @key={{ResizableGroup}} @element={{false}}>\n {{yield (hash Panel=ResizablePanel Handle=ResizableHandle panel=this.group.panel handle=this.group.handle layout=this.group.layout getLayout=this.group.getLayout setLayout=this.group.setLayout)}}\n </Provide>\n</As>", {
1271
+ strictMode: true,
1272
+ scope: () => ({
1273
+ As,
1274
+ Provide,
1275
+ ResizableGroup,
1276
+ hash,
1277
+ ResizablePanel,
1278
+ ResizableHandle
1279
+ })
1280
+ }), this);
1281
+ }
1282
+ }
1283
+
1284
+ export { Resizable as R, ResizableGroup as a, ResizableHandle as b, ResizablePanel as c, ResizablePanelApi as d, adjustLayout as e, constrain as f, defaultLayout as g, parseSize as p, toPercent as t, validateLayout as v };
1285
+ //# sourceMappingURL=components-DBWszEI3.js.map