@wirekyt/dom 0.0.1 → 0.0.2
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.
- package/dist/anatomy-DMuSMbOP.d.cts +18 -0
- package/dist/anatomy-DMuSMbOP.d.ts +18 -0
- package/dist/anatomy.cjs +3 -0
- package/dist/anatomy.d.cts +2 -0
- package/dist/anatomy.d.ts +2 -0
- package/dist/anatomy.js +2 -0
- package/dist/angle-3hqP0Mp5.cjs +13 -0
- package/dist/angle-oNt8uGHQ.js +8 -0
- package/dist/aria-hidden-CEXexb2I.js +127 -0
- package/dist/aria-hidden-Y7iJHPMr.cjs +132 -0
- package/dist/aria-hidden.cjs +3 -0
- package/dist/aria-hidden.d.cts +10 -0
- package/dist/aria-hidden.d.ts +10 -0
- package/dist/aria-hidden.js +2 -0
- package/dist/array-BGtygd0o.cjs +198 -0
- package/dist/array-C4KbHsha.js +73 -0
- package/dist/auto-resize-5F5iiKZb.cjs +106 -0
- package/dist/auto-resize-KkNfCcBt.js +95 -0
- package/dist/auto-resize.cjs +4 -0
- package/dist/auto-resize.d.cts +7 -0
- package/dist/auto-resize.d.ts +7 -0
- package/dist/auto-resize.js +2 -0
- package/dist/caret-CHqaP4XG.cjs +30 -0
- package/dist/caret-aiDJ6mAS.js +19 -0
- package/dist/closest-Clo6ODcK.js +117 -0
- package/dist/closest-IiRz1GIJ.cjs +176 -0
- package/dist/collection-CJU0oDtX.js +1295 -0
- package/dist/collection-CwzUJwBJ.cjs +1342 -0
- package/dist/collection.cjs +15 -0
- package/dist/collection.d.cts +34 -0
- package/dist/collection.d.ts +34 -0
- package/dist/collection.js +3 -0
- package/dist/color-CsugZjq6.d.cts +60 -0
- package/dist/color-CsugZjq6.d.ts +60 -0
- package/dist/color-utils-DzeOVYlL.cjs +662 -0
- package/dist/color-utils-lDDg9FEh.js +639 -0
- package/dist/color-utils.cjs +6 -0
- package/dist/color-utils.d.cts +18 -0
- package/dist/color-utils.d.ts +18 -0
- package/dist/color-utils.js +2 -0
- package/dist/computed-style-B1MKlCoo.js +9 -0
- package/dist/computed-style-DLArEFNw.cjs +14 -0
- package/dist/controller-B8E8ZJCI.cjs +133 -0
- package/dist/controller-Dv7lWHDr.js +92 -0
- package/dist/core-BF6G2RiC.d.cts +1 -0
- package/dist/core-BNMw-JId.cjs +372 -0
- package/dist/core-BdeZuSX6.d.ts +1 -0
- package/dist/core-CJ0MZr3D.js +289 -0
- package/dist/core.cjs +19 -0
- package/dist/core.d.cts +3 -0
- package/dist/core.d.ts +3 -0
- package/dist/core.js +3 -0
- package/dist/create-anatomy-B2q3wiaw.js +22 -0
- package/dist/create-anatomy-BwDn25ph.cjs +27 -0
- package/dist/create-props-CgtcN_Qu.js +4 -0
- package/dist/create-props-CjLx2oS8.cjs +9 -0
- package/dist/data-url-C-Uk31Q9.cjs +42 -0
- package/dist/data-url-DHUHj7UF.js +37 -0
- package/dist/data-url-Gx_SWG-k.d.cts +10 -0
- package/dist/data-url-Gx_SWG-k.d.ts +10 -0
- package/dist/date-utils-D-JJHedx.cjs +868 -0
- package/dist/date-utils-D5zXW-Cs.js +569 -0
- package/dist/date-utils.cjs +52 -0
- package/dist/date-utils.d.cts +7 -0
- package/dist/date-utils.d.ts +7 -0
- package/dist/date-utils.js +2 -0
- package/dist/dismissable-C0bixtzl.cjs +348 -0
- package/dist/dismissable-KM1jPtNQ.js +337 -0
- package/dist/dismissable-layer-BTX5EvXw.d.ts +40 -0
- package/dist/dismissable-layer-Ch5niVaq.d.cts +40 -0
- package/dist/dismissable.cjs +4 -0
- package/dist/dismissable.d.cts +3 -0
- package/dist/dismissable.d.ts +3 -0
- package/dist/dismissable.js +2 -0
- package/dist/dom-query-CQzY93XU.cjs +488 -0
- package/dist/dom-query-e7fh0TEH.js +243 -0
- package/dist/dom-query.cjs +180 -0
- package/dist/dom-query.d.cts +142 -0
- package/dist/dom-query.d.ts +142 -0
- package/dist/dom-query.js +43 -0
- package/dist/equal-C927y7MN.cjs +30 -0
- package/dist/equal-DtrP8DPh.js +25 -0
- package/dist/event-DDz-mMhM.cjs +242 -0
- package/dist/event-bTItRgiw.js +117 -0
- package/dist/file-utils-6EXCdfHx.js +116 -0
- package/dist/file-utils-B7OJigQq.cjs +151 -0
- package/dist/file-utils.cjs +92 -0
- package/dist/file-utils.d.cts +40 -0
- package/dist/file-utils.d.ts +40 -0
- package/dist/file-utils.js +82 -0
- package/dist/focus-trap-89E5I9nm.js +487 -0
- package/dist/focus-trap-D7jKsfHW.cjs +498 -0
- package/dist/focus-trap.cjs +4 -0
- package/dist/focus-trap.d.cts +89 -0
- package/dist/focus-trap.d.ts +89 -0
- package/dist/focus-trap.js +2 -0
- package/dist/focus-visible-DWdQf__4.js +176 -0
- package/dist/focus-visible-G4cmlWqq.cjs +217 -0
- package/dist/focus-visible.cjs +9 -0
- package/dist/focus-visible.d.cts +32 -0
- package/dist/focus-visible.d.ts +32 -0
- package/dist/focus-visible.js +2 -0
- package/dist/form-B1DW_w_3.js +89 -0
- package/dist/form-CoupKpuP.cjs +130 -0
- package/dist/from-window-5ZhzSURC.js +68 -0
- package/dist/from-window-B9DKtaoR.cjs +115 -0
- package/dist/functions-isw5Ovcx.d.cts +16 -0
- package/dist/functions-isw5Ovcx.d.ts +16 -0
- package/dist/highlight-word.cjs +95 -0
- package/dist/highlight-word.d.cts +24 -0
- package/dist/highlight-word.d.ts +24 -0
- package/dist/highlight-word.js +94 -0
- package/dist/hotkeys.cjs +1183 -0
- package/dist/hotkeys.d.cts +199 -0
- package/dist/hotkeys.d.ts +199 -0
- package/dist/hotkeys.js +1173 -0
- package/dist/i18n-utils-BD4VtonY.cjs +345 -0
- package/dist/i18n-utils-C4FQZ39m.js +280 -0
- package/dist/i18n-utils.cjs +216 -0
- package/dist/i18n-utils.d.cts +71 -0
- package/dist/i18n-utils.d.ts +71 -0
- package/dist/i18n-utils.js +204 -0
- package/dist/index-3tNJficI.d.cts +117 -0
- package/dist/index-3tNJficI.d.ts +117 -0
- package/dist/index-BEfvdGE2.d.cts +116 -0
- package/dist/index-BEfvdGE2.d.ts +116 -0
- package/dist/index-BF6G2RiC.d.cts +1 -0
- package/dist/index-BKgxIVbE.d.cts +285 -0
- package/dist/index-BMtpmaRD.d.cts +16 -0
- package/dist/index-BMtpmaRD.d.ts +16 -0
- package/dist/index-BWiYePx8.d.cts +216 -0
- package/dist/index-BXfunVyD.d.cts +1342 -0
- package/dist/index-BXfunVyD.d.ts +1342 -0
- package/dist/index-BdeZuSX6.d.ts +1 -0
- package/dist/index-C2865AJq.d.cts +25 -0
- package/dist/index-C2865AJq.d.ts +25 -0
- package/dist/index-CFoN0L3C.d.ts +285 -0
- package/dist/index-vPrqYDHu.d.ts +216 -0
- package/dist/index.cjs +19 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/initial-focus-BQxRRFPa.cjs +37 -0
- package/dist/initial-focus-BrN5tT2X.js +26 -0
- package/dist/interact-outside-BjqIunFx.js +211 -0
- package/dist/interact-outside-Dphjr2Zh.cjs +216 -0
- package/dist/interact-outside.cjs +3 -0
- package/dist/interact-outside.d.cts +2 -0
- package/dist/interact-outside.d.ts +2 -0
- package/dist/interact-outside.js +2 -0
- package/dist/json-tree-utils.cjs +1518 -0
- package/dist/json-tree-utils.d.cts +117 -0
- package/dist/json-tree-utils.d.ts +117 -0
- package/dist/json-tree-utils.js +1469 -0
- package/dist/list-collection-D_eNKrot.d.cts +60 -0
- package/dist/list-collection-RqYEWHb4.d.ts +60 -0
- package/dist/live-region-BD0OgmrH.cjs +68 -0
- package/dist/live-region-F8YMmbrY.js +63 -0
- package/dist/live-region.cjs +3 -0
- package/dist/live-region.d.cts +2 -0
- package/dist/live-region.d.ts +2 -0
- package/dist/live-region.js +2 -0
- package/dist/machines/accordion/index.cjs +328 -0
- package/dist/machines/accordion/index.d.cts +83 -0
- package/dist/machines/accordion/index.d.ts +83 -0
- package/dist/machines/accordion/index.js +321 -0
- package/dist/machines/angle-slider/index.cjs +420 -0
- package/dist/machines/angle-slider/index.d.cts +84 -0
- package/dist/machines/angle-slider/index.d.ts +84 -0
- package/dist/machines/angle-slider/index.js +415 -0
- package/dist/machines/async-list/index.cjs +310 -0
- package/dist/machines/async-list/index.d.cts +90 -0
- package/dist/machines/async-list/index.d.ts +90 -0
- package/dist/machines/async-list/index.js +308 -0
- package/dist/machines/avatar/index.cjs +165 -0
- package/dist/machines/avatar/index.d.cts +63 -0
- package/dist/machines/avatar/index.d.ts +63 -0
- package/dist/machines/avatar/index.js +160 -0
- package/dist/machines/carousel/index.cjs +929 -0
- package/dist/machines/carousel/index.d.cts +146 -0
- package/dist/machines/carousel/index.d.ts +146 -0
- package/dist/machines/carousel/index.js +920 -0
- package/dist/machines/cascade-select/index.cjs +1426 -0
- package/dist/machines/cascade-select/index.d.cts +167 -0
- package/dist/machines/cascade-select/index.d.ts +167 -0
- package/dist/machines/cascade-select/index.js +1419 -0
- package/dist/machines/checkbox/index.cjs +316 -0
- package/dist/machines/checkbox/index.d.cts +81 -0
- package/dist/machines/checkbox/index.d.ts +81 -0
- package/dist/machines/checkbox/index.js +311 -0
- package/dist/machines/clipboard/index.cjs +228 -0
- package/dist/machines/clipboard/index.d.cts +72 -0
- package/dist/machines/clipboard/index.d.ts +72 -0
- package/dist/machines/clipboard/index.js +221 -0
- package/dist/machines/collapsible/index.cjs +363 -0
- package/dist/machines/collapsible/index.d.cts +82 -0
- package/dist/machines/collapsible/index.d.ts +82 -0
- package/dist/machines/collapsible/index.js +358 -0
- package/dist/machines/color-picker/index.cjs +1534 -0
- package/dist/machines/color-picker/index.d.cts +207 -0
- package/dist/machines/color-picker/index.d.ts +207 -0
- package/dist/machines/color-picker/index.js +1518 -0
- package/dist/machines/combobox/index.cjs +1554 -0
- package/dist/machines/combobox/index.d.cts +219 -0
- package/dist/machines/combobox/index.d.ts +219 -0
- package/dist/machines/combobox/index.js +1542 -0
- package/dist/machines/date-input/index.cjs +1974 -0
- package/dist/machines/date-input/index.d.cts +230 -0
- package/dist/machines/date-input/index.d.ts +230 -0
- package/dist/machines/date-input/index.js +1958 -0
- package/dist/machines/date-picker/index.cjs +2424 -0
- package/dist/machines/date-picker/index.d.cts +378 -0
- package/dist/machines/date-picker/index.d.ts +378 -0
- package/dist/machines/date-picker/index.js +2408 -0
- package/dist/machines/dialog/index.cjs +378 -0
- package/dist/machines/dialog/index.d.cts +94 -0
- package/dist/machines/dialog/index.d.ts +94 -0
- package/dist/machines/dialog/index.js +373 -0
- package/dist/machines/drawer/index.cjs +2066 -0
- package/dist/machines/drawer/index.d.cts +334 -0
- package/dist/machines/drawer/index.d.ts +334 -0
- package/dist/machines/drawer/index.js +2059 -0
- package/dist/machines/editable/index.cjs +550 -0
- package/dist/machines/editable/index.d.cts +114 -0
- package/dist/machines/editable/index.d.ts +114 -0
- package/dist/machines/editable/index.js +545 -0
- package/dist/machines/file-upload/index.cjs +648 -0
- package/dist/machines/file-upload/index.d.cts +150 -0
- package/dist/machines/file-upload/index.d.ts +150 -0
- package/dist/machines/file-upload/index.js +641 -0
- package/dist/machines/floating-panel/index.cjs +1020 -0
- package/dist/machines/floating-panel/index.d.cts +149 -0
- package/dist/machines/floating-panel/index.d.ts +149 -0
- package/dist/machines/floating-panel/index.js +1012 -0
- package/dist/machines/hover-card/index.cjs +441 -0
- package/dist/machines/hover-card/index.d.cts +82 -0
- package/dist/machines/hover-card/index.d.ts +82 -0
- package/dist/machines/hover-card/index.js +436 -0
- package/dist/machines/image-cropper/index.cjs +2082 -0
- package/dist/machines/image-cropper/index.d.cts +182 -0
- package/dist/machines/image-cropper/index.d.ts +182 -0
- package/dist/machines/image-cropper/index.js +2076 -0
- package/dist/machines/listbox/index.cjs +873 -0
- package/dist/machines/listbox/index.d.cts +175 -0
- package/dist/machines/listbox/index.d.ts +175 -0
- package/dist/machines/listbox/index.js +860 -0
- package/dist/machines/marquee/index.cjs +387 -0
- package/dist/machines/marquee/index.d.cts +102 -0
- package/dist/machines/marquee/index.d.ts +102 -0
- package/dist/machines/marquee/index.js +382 -0
- package/dist/machines/menu/index.cjs +1562 -0
- package/dist/machines/menu/index.d.cts +188 -0
- package/dist/machines/menu/index.d.ts +188 -0
- package/dist/machines/menu/index.js +1549 -0
- package/dist/machines/navigation-menu/index.cjs +860 -0
- package/dist/machines/navigation-menu/index.d.cts +131 -0
- package/dist/machines/navigation-menu/index.d.ts +131 -0
- package/dist/machines/navigation-menu/index.js +855 -0
- package/dist/machines/number-input/index.cjs +1014 -0
- package/dist/machines/number-input/index.d.cts +136 -0
- package/dist/machines/number-input/index.d.ts +136 -0
- package/dist/machines/number-input/index.js +1009 -0
- package/dist/machines/pagination/index.cjs +413 -0
- package/dist/machines/pagination/index.d.cts +139 -0
- package/dist/machines/pagination/index.d.ts +139 -0
- package/dist/machines/pagination/index.js +404 -0
- package/dist/machines/password-input/index.cjs +224 -0
- package/dist/machines/password-input/index.d.cts +71 -0
- package/dist/machines/password-input/index.d.ts +71 -0
- package/dist/machines/password-input/index.js +219 -0
- package/dist/machines/pin-input/index.cjs +595 -0
- package/dist/machines/pin-input/index.d.cts +107 -0
- package/dist/machines/pin-input/index.d.ts +107 -0
- package/dist/machines/pin-input/index.js +590 -0
- package/dist/machines/popover/index.cjs +516 -0
- package/dist/machines/popover/index.d.cts +107 -0
- package/dist/machines/popover/index.d.ts +107 -0
- package/dist/machines/popover/index.js +511 -0
- package/dist/machines/presence/index.cjs +193 -0
- package/dist/machines/presence/index.d.cts +44 -0
- package/dist/machines/presence/index.d.ts +44 -0
- package/dist/machines/presence/index.js +190 -0
- package/dist/machines/progress/index.cjs +282 -0
- package/dist/machines/progress/index.d.cts +96 -0
- package/dist/machines/progress/index.d.ts +96 -0
- package/dist/machines/progress/index.js +277 -0
- package/dist/machines/qr-code/index.cjs +167 -0
- package/dist/machines/qr-code/index.d.cts +71 -0
- package/dist/machines/qr-code/index.d.ts +71 -0
- package/dist/machines/qr-code/index.js +162 -0
- package/dist/machines/radio-group/index.cjs +465 -0
- package/dist/machines/radio-group/index.d.cts +218 -0
- package/dist/machines/radio-group/index.d.ts +218 -0
- package/dist/machines/radio-group/index.js +458 -0
- package/dist/machines/rating-group/index.cjs +405 -0
- package/dist/machines/rating-group/index.d.cts +101 -0
- package/dist/machines/rating-group/index.d.ts +101 -0
- package/dist/machines/rating-group/index.js +398 -0
- package/dist/machines/scroll-area/index.cjs +865 -0
- package/dist/machines/scroll-area/index.d.cts +126 -0
- package/dist/machines/scroll-area/index.d.ts +126 -0
- package/dist/machines/scroll-area/index.js +860 -0
- package/dist/machines/select/index.cjs +1226 -0
- package/dist/machines/select/index.d.cts +190 -0
- package/dist/machines/select/index.d.ts +190 -0
- package/dist/machines/select/index.js +1214 -0
- package/dist/machines/signature-pad/index.cjs +337 -0
- package/dist/machines/signature-pad/index.d.cts +108 -0
- package/dist/machines/signature-pad/index.d.ts +108 -0
- package/dist/machines/signature-pad/index.js +330 -0
- package/dist/machines/slider/index.cjs +1103 -0
- package/dist/machines/slider/index.d.cts +154 -0
- package/dist/machines/slider/index.d.ts +154 -0
- package/dist/machines/slider/index.js +1094 -0
- package/dist/machines/splitter/index.cjs +1686 -0
- package/dist/machines/splitter/index.d.cts +282 -0
- package/dist/machines/splitter/index.d.ts +282 -0
- package/dist/machines/splitter/index.js +1675 -0
- package/dist/machines/steps/index.cjs +330 -0
- package/dist/machines/steps/index.d.cts +109 -0
- package/dist/machines/steps/index.d.ts +109 -0
- package/dist/machines/steps/index.js +325 -0
- package/dist/machines/switch/index.cjs +307 -0
- package/dist/machines/switch/index.d.cts +80 -0
- package/dist/machines/switch/index.d.ts +80 -0
- package/dist/machines/switch/index.js +302 -0
- package/dist/machines/tabs/index.cjs +542 -0
- package/dist/machines/tabs/index.d.cts +113 -0
- package/dist/machines/tabs/index.d.ts +113 -0
- package/dist/machines/tabs/index.js +533 -0
- package/dist/machines/tags-input/index.cjs +1151 -0
- package/dist/machines/tags-input/index.d.cts +182 -0
- package/dist/machines/tags-input/index.d.ts +182 -0
- package/dist/machines/tags-input/index.js +1144 -0
- package/dist/machines/timer/index.cjs +329 -0
- package/dist/machines/timer/index.d.cts +102 -0
- package/dist/machines/timer/index.d.ts +102 -0
- package/dist/machines/timer/index.js +323 -0
- package/dist/machines/toast/index.cjs +1185 -0
- package/dist/machines/toast/index.d.cts +204 -0
- package/dist/machines/toast/index.d.ts +204 -0
- package/dist/machines/toast/index.js +1180 -0
- package/dist/machines/toc/index.cjs +358 -0
- package/dist/machines/toc/index.d.cts +98 -0
- package/dist/machines/toc/index.d.ts +98 -0
- package/dist/machines/toc/index.js +351 -0
- package/dist/machines/toggle/index.cjs +99 -0
- package/dist/machines/toggle/index.d.cts +46 -0
- package/dist/machines/toggle/index.d.ts +46 -0
- package/dist/machines/toggle/index.js +94 -0
- package/dist/machines/toggle-group/index.cjs +329 -0
- package/dist/machines/toggle-group/index.d.cts +81 -0
- package/dist/machines/toggle-group/index.d.ts +81 -0
- package/dist/machines/toggle-group/index.js +322 -0
- package/dist/machines/tooltip/index.cjs +638 -0
- package/dist/machines/tooltip/index.d.cts +84 -0
- package/dist/machines/tooltip/index.d.ts +84 -0
- package/dist/machines/tooltip/index.js +633 -0
- package/dist/machines/tour/index.cjs +1123 -0
- package/dist/machines/tour/index.d.cts +207 -0
- package/dist/machines/tour/index.d.ts +207 -0
- package/dist/machines/tour/index.js +1115 -0
- package/dist/machines/tree-view/index.cjs +1288 -0
- package/dist/machines/tree-view/index.d.cts +221 -0
- package/dist/machines/tree-view/index.d.ts +221 -0
- package/dist/machines/tree-view/index.js +1279 -0
- package/dist/mutation-observer-_LbwtN3W.cjs +61 -0
- package/dist/mutation-observer-qObPUo3D.js +50 -0
- package/dist/navigate-CJOaL3vx.js +31 -0
- package/dist/navigate-uJG-006f.cjs +42 -0
- package/dist/overflow-BBihfMxX.cjs +67 -0
- package/dist/overflow-C-zO1CWA.js +44 -0
- package/dist/platform-BDB0wXUk.js +26 -0
- package/dist/platform-BZS-dkZN.cjs +109 -0
- package/dist/point-C9A4dk1i.js +27 -0
- package/dist/point-DxnCrJBy.cjs +32 -0
- package/dist/pointer-lock-BvfSjt_s.cjs +31 -0
- package/dist/pointer-lock-WezxTqu-.js +26 -0
- package/dist/pointer-move-CGzan38r.cjs +42 -0
- package/dist/pointer-move-Tijb8Ptk.js +37 -0
- package/dist/polygon-BvdwYRBw.js +76 -0
- package/dist/polygon-CTR1kEoU.cjs +93 -0
- package/dist/popper-DkAAS9VE.cjs +487 -0
- package/dist/popper-DzBZzAe4.js +464 -0
- package/dist/popper.cjs +6 -0
- package/dist/popper.d.cts +2 -0
- package/dist/popper.d.ts +2 -0
- package/dist/popper.js +2 -0
- package/dist/press-B7XLrLGR.js +65 -0
- package/dist/press-BdD5suLQ.cjs +70 -0
- package/dist/proxy-tab-focus-DWMXvAfO.js +54 -0
- package/dist/proxy-tab-focus-NthYgHdY.cjs +59 -0
- package/dist/raf-BSDcY4UD.cjs +85 -0
- package/dist/raf-DgINgykK.d.cts +15 -0
- package/dist/raf-DgINgykK.d.ts +15 -0
- package/dist/raf-Dhvm7f1e.js +62 -0
- package/dist/rect-utils-DiT4k3jS.cjs +548 -0
- package/dist/rect-utils-d_3gZVsc.js +459 -0
- package/dist/rect-utils.cjs +165 -0
- package/dist/rect-utils.d.cts +197 -0
- package/dist/rect-utils.d.ts +197 -0
- package/dist/rect-utils.js +116 -0
- package/dist/remove-scroll-DTVA5f4w.cjs +86 -0
- package/dist/remove-scroll-WEheFCiq.js +81 -0
- package/dist/remove-scroll.cjs +3 -0
- package/dist/remove-scroll.d.cts +4 -0
- package/dist/remove-scroll.d.ts +4 -0
- package/dist/remove-scroll.js +2 -0
- package/dist/rolldown-runtime-D6vf50IK.cjs +28 -0
- package/dist/scale-C5BBHVgH.js +17 -0
- package/dist/scale-C7iiUGhS.cjs +22 -0
- package/dist/scope-CysKlKe9.cjs +28 -0
- package/dist/scope-D1873Mzi.js +23 -0
- package/dist/scroll-CVJ40w2e.js +46 -0
- package/dist/scroll-Dyd1QLrc.cjs +63 -0
- package/dist/scroll-snap-Cuaqdevf.cjs +224 -0
- package/dist/scroll-snap-DqMiFASa.js +201 -0
- package/dist/scroll-snap.cjs +6 -0
- package/dist/scroll-snap.d.cts +14 -0
- package/dist/scroll-snap.d.ts +14 -0
- package/dist/scroll-snap.js +2 -0
- package/dist/selection-ClKhnWit.d.cts +49 -0
- package/dist/selection-DzLiSVkg.d.ts +49 -0
- package/dist/selection-map-962WvX2k.js +45 -0
- package/dist/selection-map-BwlZr1LH.cjs +68 -0
- package/dist/set-CFNGOW5W.js +50 -0
- package/dist/set-DrtWCLFb.cjs +73 -0
- package/dist/store-BLpJlMxz.js +257 -0
- package/dist/store-Btfrm2bs.cjs +47 -0
- package/dist/store-C5HvdLyc.js +42 -0
- package/dist/store-Wg8KVwNv.cjs +298 -0
- package/dist/store.cjs +9 -0
- package/dist/store.d.cts +26 -0
- package/dist/store.d.ts +26 -0
- package/dist/store.js +2 -0
- package/dist/stringify-state.cjs +48 -0
- package/dist/stringify-state.d.cts +8 -0
- package/dist/stringify-state.d.ts +8 -0
- package/dist/stringify-state.js +44 -0
- package/dist/tabbable-Bz1-1GAY.cjs +206 -0
- package/dist/tabbable-CDA1YMjZ.js +147 -0
- package/dist/text-selection-B3OQpQGy.cjs +75 -0
- package/dist/text-selection-DXvWvm6k.js +64 -0
- package/dist/timers-BRyPrXIX.js +82 -0
- package/dist/timers-Beu4SfAj.cjs +99 -0
- package/dist/tree-collection-3QX3EIhq.d.ts +77 -0
- package/dist/tree-collection-C6oDQGUJ.d.cts +77 -0
- package/dist/typeahead-DremEgML.d.cts +45 -0
- package/dist/typeahead-DremEgML.d.ts +45 -0
- package/dist/types-BFuHIo7S.js +10 -0
- package/dist/types-CczqoQLL.d.cts +57 -0
- package/dist/types-CczqoQLL.d.ts +57 -0
- package/dist/types-CjocssbC.d.cts +13 -0
- package/dist/types-CjocssbC.d.ts +13 -0
- package/dist/types-D7oF7eWh.d.cts +54 -0
- package/dist/types-D7oF7eWh.d.ts +54 -0
- package/dist/types-HCvp3Bhv.cjs +21 -0
- package/dist/types.cjs +14 -0
- package/dist/types.d.cts +6 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.js +12 -0
- package/dist/utils-BH-oBBz2.cjs +614 -0
- package/dist/utils-Cht5XaHf.js +267 -0
- package/dist/utils.cjs +95 -0
- package/dist/utils.d.cts +144 -0
- package/dist/utils.d.ts +144 -0
- package/dist/utils.js +7 -0
- package/dist/visually-hidden-BgSCFLz_.cjs +29 -0
- package/dist/visually-hidden-yDJ517KZ.js +18 -0
- package/dist/wait-for-3n85JcCU.d.cts +15 -0
- package/dist/wait-for-3n85JcCU.d.ts +15 -0
- package/dist/wait-for-CI5Ye-Lo.js +69 -0
- package/dist/wait-for-Db73VpZQ.cjs +86 -0
- package/dist/warning-CrzBpWT1.js +19 -0
- package/dist/warning-HAmFXLHm.cjs +42 -0
- package/package.json +349 -6
|
@@ -0,0 +1,1686 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_create_anatomy = require("../../create-anatomy-BwDn25ph.cjs");
|
|
3
|
+
const require_dom_query = require("../../dom-query-CQzY93XU.cjs");
|
|
4
|
+
const require_computed_style = require("../../computed-style-DLArEFNw.cjs");
|
|
5
|
+
const require_event = require("../../event-DDz-mMhM.cjs");
|
|
6
|
+
const require_mutation_observer = require("../../mutation-observer-_LbwtN3W.cjs");
|
|
7
|
+
const require_pointer_move = require("../../pointer-move-CGzan38r.cjs");
|
|
8
|
+
const require_array = require("../../array-BGtygd0o.cjs");
|
|
9
|
+
const require_equal = require("../../equal-C927y7MN.cjs");
|
|
10
|
+
const require_utils = require("../../utils-BH-oBBz2.cjs");
|
|
11
|
+
const require_timers = require("../../timers-Beu4SfAj.cjs");
|
|
12
|
+
const require_warning = require("../../warning-HAmFXLHm.cjs");
|
|
13
|
+
const require_core = require("../../core-BNMw-JId.cjs");
|
|
14
|
+
const require_create_props = require("../../create-props-CjLx2oS8.cjs");
|
|
15
|
+
//#region src/machines/splitter/anatomy.ts
|
|
16
|
+
const anatomy = require_create_anatomy.createAnatomy("splitter").parts("root", "panel", "resizeTrigger", "resizeTriggerIndicator");
|
|
17
|
+
const parts = anatomy.build();
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/machines/splitter/dom.ts
|
|
20
|
+
const getRootId = (ctx) => ctx.ids?.root ?? `splitter:${ctx.id}`;
|
|
21
|
+
const getResizeTriggerId = (ctx, id) => ctx.ids?.resizeTrigger?.(id) ?? `splitter:${ctx.id}:splitter:${id}`;
|
|
22
|
+
const getPanelId = (ctx, id) => ctx.ids?.panel?.(id) ?? `splitter:${ctx.id}:panel:${id}`;
|
|
23
|
+
const getGlobalCursorId = (ctx) => `splitter:${ctx.id}:global-cursor`;
|
|
24
|
+
const getRootEl = (ctx) => ctx.getById(getRootId(ctx));
|
|
25
|
+
const getResizeTriggerEl = (ctx, id) => id != null ? ctx.getById(getResizeTriggerId(ctx, id)) : null;
|
|
26
|
+
const getPanelIdFromEl = (el) => {
|
|
27
|
+
return require_dom_query.isHTMLElement(el) && el.dataset.part === "panel" ? el.dataset.id : void 0;
|
|
28
|
+
};
|
|
29
|
+
const getPrevPanelId = (el) => {
|
|
30
|
+
let prev = el?.previousElementSibling ?? null;
|
|
31
|
+
while (prev) {
|
|
32
|
+
const id = getPanelIdFromEl(prev);
|
|
33
|
+
if (id) return id;
|
|
34
|
+
prev = prev.previousElementSibling;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const getNextPanelId = (el) => {
|
|
38
|
+
let next = el?.nextElementSibling ?? null;
|
|
39
|
+
while (next) {
|
|
40
|
+
const id = getPanelIdFromEl(next);
|
|
41
|
+
if (id) return id;
|
|
42
|
+
next = next.nextElementSibling;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const resolveResizeTriggerId = (ctx, id) => {
|
|
46
|
+
const [beforeId, afterId] = id.split(":");
|
|
47
|
+
if (beforeId && afterId) return id;
|
|
48
|
+
const triggerEl = getResizeTriggerEl(ctx, id);
|
|
49
|
+
const resolvedBeforeId = beforeId || getPrevPanelId(triggerEl);
|
|
50
|
+
const resolvedAfterId = afterId || getNextPanelId(triggerEl);
|
|
51
|
+
return resolvedBeforeId && resolvedAfterId ? `${resolvedBeforeId}:${resolvedAfterId}` : null;
|
|
52
|
+
};
|
|
53
|
+
const getCursor = (state, x) => {
|
|
54
|
+
let cursor = x ? "col-resize" : "row-resize";
|
|
55
|
+
if (state.isAtMin) cursor = x ? "e-resize" : "s-resize";
|
|
56
|
+
if (state.isAtMax) cursor = x ? "w-resize" : "n-resize";
|
|
57
|
+
return cursor;
|
|
58
|
+
};
|
|
59
|
+
const getResizeTriggerEls = (ctx) => {
|
|
60
|
+
return require_dom_query.queryAll(getRootEl(ctx), `[role=separator][data-ownedby='${CSS.escape(getRootId(ctx))}']`);
|
|
61
|
+
};
|
|
62
|
+
const getGlobalCursorEl = (ctx) => {
|
|
63
|
+
return ctx.getDoc().getElementById(getGlobalCursorId(ctx));
|
|
64
|
+
};
|
|
65
|
+
const setupGlobalCursor = (ctx, state, x, nonce) => {
|
|
66
|
+
const styleEl = getGlobalCursorEl(ctx);
|
|
67
|
+
const textContent = `* { cursor: ${getCursor(state, x)} !important; }`;
|
|
68
|
+
if (styleEl) styleEl.textContent = textContent;
|
|
69
|
+
else {
|
|
70
|
+
const style = ctx.getDoc().createElement("style");
|
|
71
|
+
if (nonce) style.nonce = nonce;
|
|
72
|
+
style.id = getGlobalCursorId(ctx);
|
|
73
|
+
style.textContent = textContent;
|
|
74
|
+
ctx.getDoc().head.appendChild(style);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const removeGlobalCursor = (ctx) => {
|
|
78
|
+
getGlobalCursorEl(ctx)?.remove();
|
|
79
|
+
};
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/machines/splitter/utils/aria.ts
|
|
82
|
+
function calculateAriaValues({ size, panels, pivotIndices }) {
|
|
83
|
+
let currentMinSize = 0;
|
|
84
|
+
let currentMaxSize = 100;
|
|
85
|
+
let totalMinSize = 0;
|
|
86
|
+
let totalMaxSize = 0;
|
|
87
|
+
const firstIndex = pivotIndices[0];
|
|
88
|
+
require_warning.ensure(firstIndex, () => "No pivot index found");
|
|
89
|
+
panels.forEach((panel, index) => {
|
|
90
|
+
const { maxSize = 100, minSize = 0 } = panel;
|
|
91
|
+
if (index === firstIndex) {
|
|
92
|
+
currentMinSize = minSize;
|
|
93
|
+
currentMaxSize = maxSize;
|
|
94
|
+
} else {
|
|
95
|
+
totalMinSize += minSize;
|
|
96
|
+
totalMaxSize += maxSize;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return {
|
|
100
|
+
valueMax: Math.min(currentMaxSize, 100 - totalMinSize),
|
|
101
|
+
valueMin: Math.max(currentMinSize, 100 - totalMaxSize),
|
|
102
|
+
valueNow: size[firstIndex]
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function getAriaValue(size, panels, handleId) {
|
|
106
|
+
const [beforeId, afterId] = handleId.split(":");
|
|
107
|
+
const beforeIndex = panels.findIndex((panel) => panel.id === beforeId);
|
|
108
|
+
const afterIndex = panels.findIndex((panel) => panel.id === afterId);
|
|
109
|
+
if (beforeIndex === -1 || afterIndex === -1) return {
|
|
110
|
+
beforeId: beforeId || void 0,
|
|
111
|
+
afterId: afterId || void 0,
|
|
112
|
+
valueMax: void 0,
|
|
113
|
+
valueMin: void 0,
|
|
114
|
+
valueNow: void 0
|
|
115
|
+
};
|
|
116
|
+
const { valueMax, valueMin, valueNow } = calculateAriaValues({
|
|
117
|
+
size,
|
|
118
|
+
panels,
|
|
119
|
+
pivotIndices: [beforeIndex, afterIndex]
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
beforeId,
|
|
123
|
+
afterId,
|
|
124
|
+
valueMax: Math.round(valueMax),
|
|
125
|
+
valueMin: Math.round(valueMin),
|
|
126
|
+
valueNow: valueNow != null ? Math.round(valueNow) : void 0
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function fuzzyCompareNumbers(actual, expected, fractionDigits = 10) {
|
|
130
|
+
if (actual.toFixed(fractionDigits) === expected.toFixed(fractionDigits)) return 0;
|
|
131
|
+
else return actual > expected ? 1 : -1;
|
|
132
|
+
}
|
|
133
|
+
function fuzzyNumbersEqual(actual, expected, fractionDigits = 10) {
|
|
134
|
+
if (actual == null || expected == null) return false;
|
|
135
|
+
return fuzzyCompareNumbers(actual, expected, fractionDigits) === 0;
|
|
136
|
+
}
|
|
137
|
+
function fuzzySizeEqual(actual, expected, fractionDigits) {
|
|
138
|
+
if (actual.length !== expected.length) return false;
|
|
139
|
+
for (let index = 0; index < actual.length; index++) {
|
|
140
|
+
const actualSize = actual[index];
|
|
141
|
+
const expectedSize = expected[index];
|
|
142
|
+
if (!fuzzyNumbersEqual(actualSize, expectedSize, fractionDigits)) return false;
|
|
143
|
+
}
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/machines/splitter/utils/size.ts
|
|
148
|
+
const sizeRegex = /^(-?\d*\.?\d+)(%|px|em|rem|vw|vh)?$/;
|
|
149
|
+
const percentRegex = /^(-?\d*\.?\d+)%$/;
|
|
150
|
+
function getRootSize(rootEl, orientation) {
|
|
151
|
+
if (!rootEl) return 0;
|
|
152
|
+
const rect = rootEl.getBoundingClientRect();
|
|
153
|
+
return orientation === "horizontal" ? rect.width : rect.height;
|
|
154
|
+
}
|
|
155
|
+
function getGroupSize(rootEl, orientation) {
|
|
156
|
+
return getRootSize(rootEl, orientation);
|
|
157
|
+
}
|
|
158
|
+
function toPixelValue(value, unit, rootEl) {
|
|
159
|
+
const win = rootEl.ownerDocument.defaultView;
|
|
160
|
+
if (!win) return void 0;
|
|
161
|
+
switch (unit) {
|
|
162
|
+
case "px": return value;
|
|
163
|
+
case "em": return value * Number.parseFloat(win.getComputedStyle(rootEl).fontSize);
|
|
164
|
+
case "rem": return value * Number.parseFloat(win.getComputedStyle(rootEl.ownerDocument.documentElement).fontSize);
|
|
165
|
+
case "vw": return value / 100 * win.innerWidth;
|
|
166
|
+
case "vh": return value / 100 * win.innerHeight;
|
|
167
|
+
default: return;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function parsePanelSize(size, rootEl, orientation) {
|
|
171
|
+
if (size == null) return void 0;
|
|
172
|
+
if (typeof size === "number") return size;
|
|
173
|
+
const match = size.trim().match(sizeRegex);
|
|
174
|
+
if (!match) return void 0;
|
|
175
|
+
const value = Number.parseFloat(match[1]);
|
|
176
|
+
if (!Number.isFinite(value)) return void 0;
|
|
177
|
+
const unit = match[2];
|
|
178
|
+
if (unit == null || unit === "%") return value;
|
|
179
|
+
if (!rootEl) return void 0;
|
|
180
|
+
const rootSize = getRootSize(rootEl, orientation);
|
|
181
|
+
if (rootSize === 0) return void 0;
|
|
182
|
+
const px = toPixelValue(value, unit, rootEl);
|
|
183
|
+
return px == null ? void 0 : px / rootSize * 100;
|
|
184
|
+
}
|
|
185
|
+
function toCssPanelSize(size) {
|
|
186
|
+
if (size == null) return void 0;
|
|
187
|
+
if (typeof size === "number") return `${size}%`;
|
|
188
|
+
const trimmed = size.trim();
|
|
189
|
+
if (percentRegex.test(trimmed)) return trimmed;
|
|
190
|
+
const match = trimmed.match(sizeRegex);
|
|
191
|
+
if (!match) return void 0;
|
|
192
|
+
const value = Number.parseFloat(match[1]);
|
|
193
|
+
if (!Number.isFinite(value)) return void 0;
|
|
194
|
+
const unit = match[2];
|
|
195
|
+
return unit == null ? `${value}%` : `${value}${unit}`;
|
|
196
|
+
}
|
|
197
|
+
function resolvePanelSizes({ sizes, panels, rootEl, orientation }) {
|
|
198
|
+
const nextSize = Array(panels.length);
|
|
199
|
+
let remainingSize = 100;
|
|
200
|
+
let numPanelsWithSizes = 0;
|
|
201
|
+
for (let index = 0; index < panels.length; index++) {
|
|
202
|
+
const size = parsePanelSize(sizes?.[index], rootEl, orientation);
|
|
203
|
+
if (size == null) continue;
|
|
204
|
+
numPanelsWithSizes++;
|
|
205
|
+
nextSize[index] = size;
|
|
206
|
+
remainingSize -= size;
|
|
207
|
+
}
|
|
208
|
+
for (let index = 0; index < panels.length; index++) {
|
|
209
|
+
if (nextSize[index] != null) continue;
|
|
210
|
+
const numRemainingPanels = panels.length - numPanelsWithSizes;
|
|
211
|
+
const size = numRemainingPanels > 0 ? remainingSize / numRemainingPanels : 0;
|
|
212
|
+
numPanelsWithSizes++;
|
|
213
|
+
nextSize[index] = size;
|
|
214
|
+
remainingSize -= size;
|
|
215
|
+
}
|
|
216
|
+
return nextSize;
|
|
217
|
+
}
|
|
218
|
+
function normalizePanels(panels, rootEl, orientation) {
|
|
219
|
+
return panels.map((panel) => ({
|
|
220
|
+
...panel,
|
|
221
|
+
minSize: parsePanelSize(panel.minSize, rootEl, orientation),
|
|
222
|
+
maxSize: parsePanelSize(panel.maxSize, rootEl, orientation),
|
|
223
|
+
collapsedSize: parsePanelSize(panel.collapsedSize, rootEl, orientation)
|
|
224
|
+
}));
|
|
225
|
+
}
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/machines/splitter/utils/panel.ts
|
|
228
|
+
function getPanelById(panels, id) {
|
|
229
|
+
const panel = panels.find((panel) => panel.id === id);
|
|
230
|
+
require_warning.ensure(panel, () => `Panel data not found for id "${id}"`);
|
|
231
|
+
return panel;
|
|
232
|
+
}
|
|
233
|
+
function findPanelDataIndex(panels, panel) {
|
|
234
|
+
return panels.findIndex((prevPanel) => prevPanel === panel || prevPanel.id === panel.id);
|
|
235
|
+
}
|
|
236
|
+
function findPanelIndex(panels, id) {
|
|
237
|
+
return panels.findIndex((panel) => panel.id === id);
|
|
238
|
+
}
|
|
239
|
+
function panelDataHelper(panels, panel, sizes) {
|
|
240
|
+
const index = findPanelIndex(panels, panel.id);
|
|
241
|
+
const pivotIndices = index === panels.length - 1 ? [index - 1, index] : [index, index + 1];
|
|
242
|
+
const panelSize = sizes[index];
|
|
243
|
+
return {
|
|
244
|
+
...panel,
|
|
245
|
+
panelSize,
|
|
246
|
+
pivotIndices
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function sortPanels(panels) {
|
|
250
|
+
return panels.sort((panelA, panelB) => {
|
|
251
|
+
const orderA = panelA.order;
|
|
252
|
+
const orderB = panelB.order;
|
|
253
|
+
if (orderA == null && orderB == null) return 0;
|
|
254
|
+
else if (orderA == null) return -1;
|
|
255
|
+
else if (orderB == null) return 1;
|
|
256
|
+
else return orderA - orderB;
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function getPanelLayout(panels) {
|
|
260
|
+
return panels.map((panel) => panel.id).sort().join(":");
|
|
261
|
+
}
|
|
262
|
+
function serializePanels(panels) {
|
|
263
|
+
return panels.map((panel) => panel.id).sort().map((key) => {
|
|
264
|
+
const panel = panels.find((panel) => panel.id === key);
|
|
265
|
+
return JSON.stringify(panel);
|
|
266
|
+
}).join(",");
|
|
267
|
+
}
|
|
268
|
+
function getPanelFlexBoxStyle({ size, defaultSize, dragState, resolvedSizes, panels, panelIndex, horizontal, precision = 3 }) {
|
|
269
|
+
const resolvedSize = resolvedSizes[panelIndex];
|
|
270
|
+
const layoutSize = size ?? defaultSize;
|
|
271
|
+
const panel = panels[panelIndex];
|
|
272
|
+
let flexGrow;
|
|
273
|
+
let flexBasis;
|
|
274
|
+
let flexShrink = 1;
|
|
275
|
+
const constraintAxis = horizontal ? "Width" : "Height";
|
|
276
|
+
const minSize = panel ? toCssPanelSize(panel.minSize) : void 0;
|
|
277
|
+
const maxSize = panel ? toCssPanelSize(panel.maxSize) : void 0;
|
|
278
|
+
const layoutCssSize = toCssPanelSize(layoutSize);
|
|
279
|
+
if (resolvedSize == null) if (layoutCssSize != null) if (layoutCssSize.endsWith("%")) flexGrow = Number.parseFloat(layoutCssSize).toPrecision(precision);
|
|
280
|
+
else {
|
|
281
|
+
flexBasis = getClampedFlexBasis({
|
|
282
|
+
basis: layoutCssSize,
|
|
283
|
+
minSize,
|
|
284
|
+
maxSize
|
|
285
|
+
});
|
|
286
|
+
flexGrow = "0";
|
|
287
|
+
flexShrink = 0;
|
|
288
|
+
}
|
|
289
|
+
else flexGrow = "1";
|
|
290
|
+
else if (panels.length === 1) flexGrow = "1";
|
|
291
|
+
else flexGrow = resolvedSize.toPrecision(precision);
|
|
292
|
+
return {
|
|
293
|
+
flexBasis: flexBasis ?? 0,
|
|
294
|
+
flexGrow,
|
|
295
|
+
flexShrink,
|
|
296
|
+
...minSize ? { [`min${constraintAxis}`]: minSize } : {},
|
|
297
|
+
...maxSize ? { [`max${constraintAxis}`]: maxSize } : {},
|
|
298
|
+
overflow: "hidden",
|
|
299
|
+
pointerEvents: dragState !== null ? "none" : void 0
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function getClampedFlexBasis({ basis, minSize, maxSize }) {
|
|
303
|
+
return `clamp(${minSize ?? "0%"}, ${basis}, ${maxSize ?? "100%"})`;
|
|
304
|
+
}
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/machines/splitter/connect.ts
|
|
307
|
+
function connect(service, normalize) {
|
|
308
|
+
const { state, send, prop, computed, context, scope } = service;
|
|
309
|
+
const horizontal = computed("horizontal");
|
|
310
|
+
const dragging = state.matches("dragging");
|
|
311
|
+
const registry = prop("registry");
|
|
312
|
+
const orientation = prop("orientation");
|
|
313
|
+
const rawPanels = prop("panels");
|
|
314
|
+
const panels = context.get("panels");
|
|
315
|
+
const getResolvedSizes = () => {
|
|
316
|
+
const sizes = context.get("size");
|
|
317
|
+
if (sizes.length > 0) return sizes;
|
|
318
|
+
return resolvePanelSizes({
|
|
319
|
+
sizes: prop("size") ?? prop("defaultSize"),
|
|
320
|
+
panels: rawPanels,
|
|
321
|
+
rootEl: null,
|
|
322
|
+
orientation
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
const getPanelStyle = (id) => {
|
|
326
|
+
const panelIndex = rawPanels.findIndex((panel) => panel.id === id);
|
|
327
|
+
const size = prop("size")?.[panelIndex];
|
|
328
|
+
const defaultSize = prop("defaultSize")?.[panelIndex];
|
|
329
|
+
return getPanelFlexBoxStyle({
|
|
330
|
+
size,
|
|
331
|
+
defaultSize,
|
|
332
|
+
dragState: context.get("dragState"),
|
|
333
|
+
resolvedSizes: context.get("size"),
|
|
334
|
+
panels: rawPanels,
|
|
335
|
+
panelIndex,
|
|
336
|
+
horizontal
|
|
337
|
+
});
|
|
338
|
+
};
|
|
339
|
+
const resolveResizeTriggerId = (id) => {
|
|
340
|
+
const [beforeId, afterId] = id.split(":");
|
|
341
|
+
if (beforeId && afterId) return id;
|
|
342
|
+
if (beforeId) {
|
|
343
|
+
const index = rawPanels.findIndex((panel) => panel.id === beforeId);
|
|
344
|
+
const nextPanel = rawPanels[index + 1];
|
|
345
|
+
return nextPanel ? `${beforeId}:${nextPanel.id}` : id;
|
|
346
|
+
}
|
|
347
|
+
if (afterId) {
|
|
348
|
+
const index = rawPanels.findIndex((panel) => panel.id === afterId);
|
|
349
|
+
const prevPanel = rawPanels[index - 1];
|
|
350
|
+
return prevPanel ? `${prevPanel.id}:${afterId}` : id;
|
|
351
|
+
}
|
|
352
|
+
return id;
|
|
353
|
+
};
|
|
354
|
+
const getResizeTriggerState = (props) => {
|
|
355
|
+
const { id, disabled } = props;
|
|
356
|
+
const dragging = context.get("dragState")?.resizeTriggerId === id;
|
|
357
|
+
return {
|
|
358
|
+
dragging,
|
|
359
|
+
focused: dragging || state.matches("focused") && context.get("keyboardState")?.resizeTriggerId === id,
|
|
360
|
+
disabled: !!disabled
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
return {
|
|
364
|
+
dragging,
|
|
365
|
+
orientation,
|
|
366
|
+
getPanels() {
|
|
367
|
+
return rawPanels;
|
|
368
|
+
},
|
|
369
|
+
getPanelById(id) {
|
|
370
|
+
return getPanelById(rawPanels, id);
|
|
371
|
+
},
|
|
372
|
+
getItems() {
|
|
373
|
+
return rawPanels.flatMap((panel, index, arr) => {
|
|
374
|
+
const nextPanel = arr[index + 1];
|
|
375
|
+
if (panel && nextPanel) return [{
|
|
376
|
+
type: "panel",
|
|
377
|
+
id: panel.id
|
|
378
|
+
}, {
|
|
379
|
+
type: "handle",
|
|
380
|
+
id: `${panel.id}:${nextPanel.id}`
|
|
381
|
+
}];
|
|
382
|
+
return [{
|
|
383
|
+
type: "panel",
|
|
384
|
+
id: panel.id
|
|
385
|
+
}];
|
|
386
|
+
});
|
|
387
|
+
},
|
|
388
|
+
getSizes() {
|
|
389
|
+
return getResolvedSizes();
|
|
390
|
+
},
|
|
391
|
+
setSizes(size) {
|
|
392
|
+
send({
|
|
393
|
+
type: "SIZE.SET",
|
|
394
|
+
size
|
|
395
|
+
});
|
|
396
|
+
},
|
|
397
|
+
resetSizes() {
|
|
398
|
+
send({ type: "SIZE.RESET" });
|
|
399
|
+
},
|
|
400
|
+
collapsePanel(id) {
|
|
401
|
+
send({
|
|
402
|
+
type: "PANEL.COLLAPSE",
|
|
403
|
+
id
|
|
404
|
+
});
|
|
405
|
+
},
|
|
406
|
+
expandPanel(id, minSize) {
|
|
407
|
+
send({
|
|
408
|
+
type: "PANEL.EXPAND",
|
|
409
|
+
id,
|
|
410
|
+
minSize
|
|
411
|
+
});
|
|
412
|
+
},
|
|
413
|
+
resizePanel(id, unsafePanelSize) {
|
|
414
|
+
send({
|
|
415
|
+
type: "PANEL.RESIZE",
|
|
416
|
+
id,
|
|
417
|
+
size: unsafePanelSize
|
|
418
|
+
});
|
|
419
|
+
},
|
|
420
|
+
getPanelSize(id) {
|
|
421
|
+
const panels = context.get("panels");
|
|
422
|
+
const size = getResolvedSizes();
|
|
423
|
+
const panelData = getPanelById(panels, id);
|
|
424
|
+
const { panelSize } = panelDataHelper(panels, panelData, size);
|
|
425
|
+
require_warning.ensure(panelSize != null, () => `Panel size not found for panel "${panelData.id}"`);
|
|
426
|
+
return panelSize;
|
|
427
|
+
},
|
|
428
|
+
isPanelCollapsed(id) {
|
|
429
|
+
const panels = context.get("panels");
|
|
430
|
+
const size = getResolvedSizes();
|
|
431
|
+
const panelData = getPanelById(panels, id);
|
|
432
|
+
const { collapsedSize = 0, collapsible, panelSize } = panelDataHelper(panels, panelData, size);
|
|
433
|
+
require_warning.ensure(panelSize != null, () => `Panel size not found for panel "${panelData.id}"`);
|
|
434
|
+
return collapsible === true && fuzzyNumbersEqual(panelSize, collapsedSize);
|
|
435
|
+
},
|
|
436
|
+
isPanelExpanded(id) {
|
|
437
|
+
const panels = context.get("panels");
|
|
438
|
+
const size = getResolvedSizes();
|
|
439
|
+
const panelData = getPanelById(panels, id);
|
|
440
|
+
const { collapsedSize = 0, collapsible, panelSize } = panelDataHelper(panels, panelData, size);
|
|
441
|
+
require_warning.ensure(panelSize != null, () => `Panel size not found for panel "${panelData.id}"`);
|
|
442
|
+
return !collapsible || fuzzyCompareNumbers(panelSize, collapsedSize) > 0;
|
|
443
|
+
},
|
|
444
|
+
getLayout() {
|
|
445
|
+
return getPanelLayout(prop("panels"));
|
|
446
|
+
},
|
|
447
|
+
getRootProps() {
|
|
448
|
+
return normalize.element({
|
|
449
|
+
...parts.root.attrs,
|
|
450
|
+
"data-orientation": orientation,
|
|
451
|
+
"data-dragging": require_dom_query.dataAttr(dragging),
|
|
452
|
+
id: getRootId(scope),
|
|
453
|
+
dir: prop("dir"),
|
|
454
|
+
style: {
|
|
455
|
+
display: "flex",
|
|
456
|
+
flexDirection: horizontal ? "row" : "column",
|
|
457
|
+
height: "100%",
|
|
458
|
+
width: "100%",
|
|
459
|
+
overflow: "hidden"
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
},
|
|
463
|
+
getPanelProps(props) {
|
|
464
|
+
const { id } = props;
|
|
465
|
+
return normalize.element({
|
|
466
|
+
...parts.panel.attrs,
|
|
467
|
+
"data-orientation": orientation,
|
|
468
|
+
"data-dragging": require_dom_query.dataAttr(dragging),
|
|
469
|
+
dir: prop("dir"),
|
|
470
|
+
"data-id": id,
|
|
471
|
+
"data-index": findPanelIndex(prop("panels"), id),
|
|
472
|
+
id: getPanelId(scope, id),
|
|
473
|
+
"data-ownedby": getRootId(scope),
|
|
474
|
+
style: getPanelStyle(id)
|
|
475
|
+
});
|
|
476
|
+
},
|
|
477
|
+
getResizeTriggerState,
|
|
478
|
+
getResizeTriggerIndicator(props) {
|
|
479
|
+
const triggerState = getResizeTriggerState(props);
|
|
480
|
+
return normalize.element({
|
|
481
|
+
...parts.resizeTriggerIndicator.attrs,
|
|
482
|
+
"data-orientation": orientation,
|
|
483
|
+
"data-focus": require_dom_query.dataAttr(triggerState.focused),
|
|
484
|
+
"data-dragging": require_dom_query.dataAttr(triggerState.dragging),
|
|
485
|
+
"data-disabled": require_dom_query.dataAttr(triggerState.disabled),
|
|
486
|
+
"data-ownedby": getRootId(scope)
|
|
487
|
+
});
|
|
488
|
+
},
|
|
489
|
+
getResizeTriggerProps(props) {
|
|
490
|
+
const { id } = props;
|
|
491
|
+
const triggerState = getResizeTriggerState(props);
|
|
492
|
+
const resolvedId = resolveResizeTriggerId(id);
|
|
493
|
+
const aria = getAriaValue(getResolvedSizes(), panels, resolvedId);
|
|
494
|
+
return normalize.element({
|
|
495
|
+
...parts.resizeTrigger.attrs,
|
|
496
|
+
dir: prop("dir"),
|
|
497
|
+
id: getResizeTriggerId(scope, id),
|
|
498
|
+
role: "separator",
|
|
499
|
+
"data-id": id,
|
|
500
|
+
"data-ownedby": getRootId(scope),
|
|
501
|
+
tabIndex: triggerState.disabled ? void 0 : 0,
|
|
502
|
+
"aria-valuenow": aria.valueNow,
|
|
503
|
+
"aria-valuemin": aria.valueMin,
|
|
504
|
+
"aria-valuemax": aria.valueMax,
|
|
505
|
+
"data-orientation": orientation,
|
|
506
|
+
"aria-orientation": orientation,
|
|
507
|
+
"aria-controls": aria.beforeId && aria.afterId ? `${getPanelId(scope, aria.beforeId)} ${getPanelId(scope, aria.afterId)}` : void 0,
|
|
508
|
+
"data-focus": require_dom_query.dataAttr(triggerState.focused),
|
|
509
|
+
"data-dragging": require_dom_query.dataAttr(triggerState.dragging),
|
|
510
|
+
"data-disabled": require_dom_query.dataAttr(triggerState.disabled),
|
|
511
|
+
style: {
|
|
512
|
+
touchAction: "none",
|
|
513
|
+
userSelect: "none",
|
|
514
|
+
WebkitUserSelect: "none",
|
|
515
|
+
flex: "0 0 auto",
|
|
516
|
+
pointerEvents: triggerState.disabled ? "none" : triggerState.dragging && !triggerState.focused ? "none" : void 0,
|
|
517
|
+
cursor: triggerState.disabled || registry ? void 0 : horizontal ? "col-resize" : "row-resize",
|
|
518
|
+
[horizontal ? "minHeight" : "minWidth"]: "0"
|
|
519
|
+
},
|
|
520
|
+
onPointerDown(event) {
|
|
521
|
+
if (!require_event.isLeftClick(event)) return;
|
|
522
|
+
if (triggerState.disabled) {
|
|
523
|
+
event.preventDefault();
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
event.currentTarget.focus({ preventScroll: true });
|
|
527
|
+
if (registry) return;
|
|
528
|
+
const point = require_event.getEventPoint(event);
|
|
529
|
+
send({
|
|
530
|
+
type: "POINTER_DOWN",
|
|
531
|
+
id,
|
|
532
|
+
point
|
|
533
|
+
});
|
|
534
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
535
|
+
event.preventDefault();
|
|
536
|
+
event.stopPropagation();
|
|
537
|
+
},
|
|
538
|
+
onPointerUp(event) {
|
|
539
|
+
if (triggerState.disabled) return;
|
|
540
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) event.currentTarget.releasePointerCapture(event.pointerId);
|
|
541
|
+
},
|
|
542
|
+
onPointerOver() {
|
|
543
|
+
if (triggerState.disabled || registry) return;
|
|
544
|
+
send({
|
|
545
|
+
type: "POINTER_OVER",
|
|
546
|
+
id
|
|
547
|
+
});
|
|
548
|
+
},
|
|
549
|
+
onPointerLeave() {
|
|
550
|
+
if (triggerState.disabled || registry) return;
|
|
551
|
+
send({
|
|
552
|
+
type: "POINTER_LEAVE",
|
|
553
|
+
id
|
|
554
|
+
});
|
|
555
|
+
},
|
|
556
|
+
onBlur() {
|
|
557
|
+
if (triggerState.disabled) return;
|
|
558
|
+
send({ type: "BLUR" });
|
|
559
|
+
},
|
|
560
|
+
onFocus() {
|
|
561
|
+
if (triggerState.disabled) return;
|
|
562
|
+
send({
|
|
563
|
+
type: "FOCUS",
|
|
564
|
+
id
|
|
565
|
+
});
|
|
566
|
+
},
|
|
567
|
+
onKeyDown(event) {
|
|
568
|
+
if (event.defaultPrevented) return;
|
|
569
|
+
if (triggerState.disabled) return;
|
|
570
|
+
const keyboardResizeBy = prop("keyboardResizeBy");
|
|
571
|
+
let delta = 0;
|
|
572
|
+
if (event.shiftKey) delta = 10;
|
|
573
|
+
else if (keyboardResizeBy != null) delta = keyboardResizeBy;
|
|
574
|
+
else delta = 1;
|
|
575
|
+
const exec = {
|
|
576
|
+
Enter() {
|
|
577
|
+
send({
|
|
578
|
+
type: "ENTER",
|
|
579
|
+
id
|
|
580
|
+
});
|
|
581
|
+
},
|
|
582
|
+
ArrowUp() {
|
|
583
|
+
send({
|
|
584
|
+
type: "KEYBOARD_MOVE",
|
|
585
|
+
id,
|
|
586
|
+
delta: horizontal ? 0 : -delta
|
|
587
|
+
});
|
|
588
|
+
},
|
|
589
|
+
ArrowDown() {
|
|
590
|
+
send({
|
|
591
|
+
type: "KEYBOARD_MOVE",
|
|
592
|
+
id,
|
|
593
|
+
delta: horizontal ? 0 : delta
|
|
594
|
+
});
|
|
595
|
+
},
|
|
596
|
+
ArrowLeft() {
|
|
597
|
+
send({
|
|
598
|
+
type: "KEYBOARD_MOVE",
|
|
599
|
+
id,
|
|
600
|
+
delta: horizontal ? -delta : 0
|
|
601
|
+
});
|
|
602
|
+
},
|
|
603
|
+
ArrowRight() {
|
|
604
|
+
send({
|
|
605
|
+
type: "KEYBOARD_MOVE",
|
|
606
|
+
id,
|
|
607
|
+
delta: horizontal ? delta : 0
|
|
608
|
+
});
|
|
609
|
+
},
|
|
610
|
+
Home() {
|
|
611
|
+
send({
|
|
612
|
+
type: "KEYBOARD_MOVE",
|
|
613
|
+
id,
|
|
614
|
+
delta: -100
|
|
615
|
+
});
|
|
616
|
+
},
|
|
617
|
+
End() {
|
|
618
|
+
send({
|
|
619
|
+
type: "KEYBOARD_MOVE",
|
|
620
|
+
id,
|
|
621
|
+
delta: 100
|
|
622
|
+
});
|
|
623
|
+
},
|
|
624
|
+
F6() {
|
|
625
|
+
send({
|
|
626
|
+
type: "FOCUS.CYCLE",
|
|
627
|
+
id,
|
|
628
|
+
shiftKey: event.shiftKey
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
}[require_event.getEventKey(event, {
|
|
632
|
+
dir: prop("dir"),
|
|
633
|
+
orientation
|
|
634
|
+
})];
|
|
635
|
+
if (exec) {
|
|
636
|
+
exec(event);
|
|
637
|
+
event.preventDefault();
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
//#endregion
|
|
645
|
+
//#region src/machines/splitter/utils/preserve-fixed-panel-sizes.ts
|
|
646
|
+
function preserveFixedPanelSizes({ panels, prevLayout, prevGroupSize, nextGroupSize }) {
|
|
647
|
+
if (prevGroupSize <= 0 || nextGroupSize <= 0) return prevLayout;
|
|
648
|
+
const nextLayout = [...prevLayout];
|
|
649
|
+
const relativeIndices = [];
|
|
650
|
+
let fixedTotal = 0;
|
|
651
|
+
let relativeTotal = 0;
|
|
652
|
+
panels.forEach((panel, index) => {
|
|
653
|
+
if (panel.resizeBehavior === "preserve-pixel-size") {
|
|
654
|
+
const nextPercentSize = prevLayout[index] / 100 * prevGroupSize / nextGroupSize * 100;
|
|
655
|
+
nextLayout[index] = nextPercentSize;
|
|
656
|
+
fixedTotal += nextPercentSize;
|
|
657
|
+
} else {
|
|
658
|
+
relativeIndices.push(index);
|
|
659
|
+
relativeTotal += prevLayout[index];
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
if (relativeIndices.length === 0) {
|
|
663
|
+
const total = nextLayout.reduce((accumulated, current) => accumulated + current, 0);
|
|
664
|
+
if (fuzzyNumbersEqual(total, 100)) return nextLayout;
|
|
665
|
+
if (total <= 0) return prevLayout;
|
|
666
|
+
const scale = 100 / total;
|
|
667
|
+
return nextLayout.map((size) => size * scale);
|
|
668
|
+
}
|
|
669
|
+
const remainingSize = 100 - fixedTotal;
|
|
670
|
+
if (remainingSize <= 0) {
|
|
671
|
+
const total = nextLayout.reduce((accumulated, current) => accumulated + current, 0);
|
|
672
|
+
if (fuzzyNumbersEqual(total, 100)) return nextLayout;
|
|
673
|
+
const scale = 100 / Math.max(total, 1);
|
|
674
|
+
return nextLayout.map((size) => size * scale);
|
|
675
|
+
}
|
|
676
|
+
if (fuzzyNumbersEqual(relativeTotal, 0)) {
|
|
677
|
+
const size = remainingSize / relativeIndices.length;
|
|
678
|
+
relativeIndices.forEach((index) => {
|
|
679
|
+
nextLayout[index] = size;
|
|
680
|
+
});
|
|
681
|
+
return nextLayout;
|
|
682
|
+
}
|
|
683
|
+
relativeIndices.forEach((index) => {
|
|
684
|
+
nextLayout[index] = prevLayout[index] / relativeTotal * remainingSize;
|
|
685
|
+
});
|
|
686
|
+
const total = nextLayout.reduce((accumulated, current) => accumulated + current, 0);
|
|
687
|
+
if (fuzzyNumbersEqual(total, 100)) return nextLayout;
|
|
688
|
+
const scale = 100 / total;
|
|
689
|
+
return nextLayout.map((size) => size * scale);
|
|
690
|
+
}
|
|
691
|
+
//#endregion
|
|
692
|
+
//#region src/machines/splitter/utils/resize-panel.ts
|
|
693
|
+
function resizePanel({ panels, index, size }) {
|
|
694
|
+
const panel = panels[index];
|
|
695
|
+
require_warning.ensure(panel, () => `Panel data not found for index ${index}`);
|
|
696
|
+
let { collapsedSize = 0, collapsible, maxSize = 100, minSize = 0 } = panel;
|
|
697
|
+
if (fuzzyCompareNumbers(size, minSize) < 0) if (collapsible) {
|
|
698
|
+
const halfwayPoint = (collapsedSize + minSize) / 2;
|
|
699
|
+
if (fuzzyCompareNumbers(size, halfwayPoint) < 0) size = collapsedSize;
|
|
700
|
+
else size = minSize;
|
|
701
|
+
} else size = minSize;
|
|
702
|
+
size = Math.min(maxSize, size);
|
|
703
|
+
size = parseFloat(size.toFixed(10));
|
|
704
|
+
return size;
|
|
705
|
+
}
|
|
706
|
+
//#endregion
|
|
707
|
+
//#region src/machines/splitter/utils/resize-by-delta.ts
|
|
708
|
+
function resizeByDelta(props) {
|
|
709
|
+
let { delta, initialSize, panels, pivotIndices, prevSize, trigger } = props;
|
|
710
|
+
if (fuzzyNumbersEqual(delta, 0)) return initialSize;
|
|
711
|
+
const nextSize = [...initialSize];
|
|
712
|
+
const [firstPivotIndex, secondPivotIndex] = pivotIndices;
|
|
713
|
+
require_warning.ensure(firstPivotIndex, () => "Invalid first pivot index");
|
|
714
|
+
require_warning.ensure(secondPivotIndex, () => "Invalid second pivot index");
|
|
715
|
+
let deltaApplied = 0;
|
|
716
|
+
if (trigger === "keyboard") {
|
|
717
|
+
{
|
|
718
|
+
const index = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
719
|
+
const panel = panels[index];
|
|
720
|
+
require_warning.ensure(panel, () => `Panel data not found for index ${index}`);
|
|
721
|
+
const { collapsedSize = 0, collapsible, minSize = 0 } = panel;
|
|
722
|
+
if (collapsible) {
|
|
723
|
+
const prevSize = initialSize[index];
|
|
724
|
+
require_warning.ensure(prevSize, () => `Previous size not found for panel index ${index}`);
|
|
725
|
+
if (fuzzyNumbersEqual(prevSize, collapsedSize)) {
|
|
726
|
+
const localDelta = minSize - prevSize;
|
|
727
|
+
if (fuzzyCompareNumbers(localDelta, Math.abs(delta)) > 0) delta = delta < 0 ? 0 - localDelta : localDelta;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
{
|
|
732
|
+
const index = delta < 0 ? firstPivotIndex : secondPivotIndex;
|
|
733
|
+
const panel = panels[index];
|
|
734
|
+
require_warning.ensure(panel, () => `No panel data found for index ${index}`);
|
|
735
|
+
const { collapsedSize = 0, collapsible, minSize = 0 } = panel;
|
|
736
|
+
if (collapsible) {
|
|
737
|
+
const prevSize = initialSize[index];
|
|
738
|
+
require_warning.ensure(prevSize, () => `Previous size not found for panel index ${index}`);
|
|
739
|
+
if (fuzzyNumbersEqual(prevSize, minSize)) {
|
|
740
|
+
const localDelta = prevSize - collapsedSize;
|
|
741
|
+
if (fuzzyCompareNumbers(localDelta, Math.abs(delta)) > 0) delta = delta < 0 ? 0 - localDelta : localDelta;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
{
|
|
747
|
+
const increment = delta < 0 ? 1 : -1;
|
|
748
|
+
let index = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
749
|
+
let maxAvailableDelta = 0;
|
|
750
|
+
while (true) {
|
|
751
|
+
const prevSize = initialSize[index];
|
|
752
|
+
require_warning.ensure(prevSize, () => `Previous size not found for panel index ${index}`);
|
|
753
|
+
const delta = resizePanel({
|
|
754
|
+
panels,
|
|
755
|
+
index,
|
|
756
|
+
size: 100
|
|
757
|
+
}) - prevSize;
|
|
758
|
+
maxAvailableDelta += delta;
|
|
759
|
+
index += increment;
|
|
760
|
+
if (index < 0 || index >= panels.length) break;
|
|
761
|
+
}
|
|
762
|
+
const minAbsDelta = Math.min(Math.abs(delta), Math.abs(maxAvailableDelta));
|
|
763
|
+
delta = delta < 0 ? 0 - minAbsDelta : minAbsDelta;
|
|
764
|
+
}
|
|
765
|
+
{
|
|
766
|
+
let index = delta < 0 ? firstPivotIndex : secondPivotIndex;
|
|
767
|
+
while (index >= 0 && index < panels.length) {
|
|
768
|
+
const deltaRemaining = Math.abs(delta) - Math.abs(deltaApplied);
|
|
769
|
+
const prevSize = initialSize[index];
|
|
770
|
+
require_warning.ensure(prevSize, () => `Previous size not found for panel index ${index}`);
|
|
771
|
+
const unsafeSize = prevSize - deltaRemaining;
|
|
772
|
+
const safeSize = resizePanel({
|
|
773
|
+
panels,
|
|
774
|
+
index,
|
|
775
|
+
size: unsafeSize
|
|
776
|
+
});
|
|
777
|
+
if (!fuzzyNumbersEqual(prevSize, safeSize)) {
|
|
778
|
+
deltaApplied += prevSize - safeSize;
|
|
779
|
+
nextSize[index] = safeSize;
|
|
780
|
+
if (deltaApplied.toPrecision(3).localeCompare(Math.abs(delta).toPrecision(3), void 0, { numeric: true }) >= 0) break;
|
|
781
|
+
}
|
|
782
|
+
if (delta < 0) index--;
|
|
783
|
+
else index++;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
if (fuzzySizeEqual(prevSize, nextSize)) return prevSize;
|
|
787
|
+
{
|
|
788
|
+
const pivotIndex = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
789
|
+
const prevSize = initialSize[pivotIndex];
|
|
790
|
+
require_warning.ensure(prevSize, () => `Previous size not found for panel index ${pivotIndex}`);
|
|
791
|
+
const unsafeSize = prevSize + deltaApplied;
|
|
792
|
+
const safeSize = resizePanel({
|
|
793
|
+
panels,
|
|
794
|
+
index: pivotIndex,
|
|
795
|
+
size: unsafeSize
|
|
796
|
+
});
|
|
797
|
+
nextSize[pivotIndex] = safeSize;
|
|
798
|
+
if (!fuzzyNumbersEqual(safeSize, unsafeSize)) {
|
|
799
|
+
let deltaRemaining = unsafeSize - safeSize;
|
|
800
|
+
let index = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
801
|
+
while (index >= 0 && index < panels.length) {
|
|
802
|
+
const prevSize = nextSize[index];
|
|
803
|
+
require_warning.ensure(prevSize, () => `Previous size not found for panel index ${index}`);
|
|
804
|
+
const unsafeSize = prevSize + deltaRemaining;
|
|
805
|
+
const safeSize = resizePanel({
|
|
806
|
+
panels,
|
|
807
|
+
index,
|
|
808
|
+
size: unsafeSize
|
|
809
|
+
});
|
|
810
|
+
if (!fuzzyNumbersEqual(prevSize, safeSize)) {
|
|
811
|
+
deltaRemaining -= safeSize - prevSize;
|
|
812
|
+
nextSize[index] = safeSize;
|
|
813
|
+
}
|
|
814
|
+
if (fuzzyNumbersEqual(deltaRemaining, 0)) break;
|
|
815
|
+
if (delta > 0) index--;
|
|
816
|
+
else index++;
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
if (!fuzzyNumbersEqual(nextSize.reduce((total, size) => size + total, 0), 100)) return prevSize;
|
|
821
|
+
return nextSize;
|
|
822
|
+
}
|
|
823
|
+
//#endregion
|
|
824
|
+
//#region src/machines/splitter/utils/validate-sizes.ts
|
|
825
|
+
function validateSizes({ size: prevSize, panels }) {
|
|
826
|
+
const nextSize = [...prevSize];
|
|
827
|
+
const nextSizeTotalSize = nextSize.reduce((accumulated, current) => accumulated + current, 0);
|
|
828
|
+
if (nextSize.length !== panels.length) throw Error(`Invalid ${panels.length} panel size: ${nextSize.map((size) => `${size}%`).join(", ")}`);
|
|
829
|
+
else if (!fuzzyNumbersEqual(nextSizeTotalSize, 100) && nextSize.length > 0) for (let index = 0; index < panels.length; index++) {
|
|
830
|
+
const unsafeSize = nextSize[index];
|
|
831
|
+
require_warning.ensure(unsafeSize, () => `No size data found for index ${index}`);
|
|
832
|
+
nextSize[index] = 100 / nextSizeTotalSize * unsafeSize;
|
|
833
|
+
}
|
|
834
|
+
let remainingSize = 0;
|
|
835
|
+
for (let index = 0; index < panels.length; index++) {
|
|
836
|
+
const unsafeSize = nextSize[index];
|
|
837
|
+
require_warning.ensure(unsafeSize, () => `No size data found for index ${index}`);
|
|
838
|
+
const safeSize = resizePanel({
|
|
839
|
+
panels,
|
|
840
|
+
index,
|
|
841
|
+
size: unsafeSize
|
|
842
|
+
});
|
|
843
|
+
if (unsafeSize != safeSize) {
|
|
844
|
+
remainingSize += unsafeSize - safeSize;
|
|
845
|
+
nextSize[index] = safeSize;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
if (!fuzzyNumbersEqual(remainingSize, 0)) for (let index = 0; index < panels.length; index++) {
|
|
849
|
+
const prevSize = nextSize[index];
|
|
850
|
+
require_warning.ensure(prevSize, () => `No size data found for index ${index}`);
|
|
851
|
+
const unsafeSize = prevSize + remainingSize;
|
|
852
|
+
const safeSize = resizePanel({
|
|
853
|
+
panels,
|
|
854
|
+
index,
|
|
855
|
+
size: unsafeSize
|
|
856
|
+
});
|
|
857
|
+
if (prevSize !== safeSize) {
|
|
858
|
+
remainingSize -= safeSize - prevSize;
|
|
859
|
+
nextSize[index] = safeSize;
|
|
860
|
+
if (fuzzyNumbersEqual(remainingSize, 0)) break;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
return nextSize;
|
|
864
|
+
}
|
|
865
|
+
//#endregion
|
|
866
|
+
//#region src/machines/splitter/machine.ts
|
|
867
|
+
const machine = require_core.createMachine({
|
|
868
|
+
props({ props }) {
|
|
869
|
+
require_warning.ensureProps(props, ["panels"]);
|
|
870
|
+
return {
|
|
871
|
+
orientation: "horizontal",
|
|
872
|
+
defaultSize: [],
|
|
873
|
+
dir: "ltr",
|
|
874
|
+
...props,
|
|
875
|
+
panels: sortPanels(props.panels)
|
|
876
|
+
};
|
|
877
|
+
},
|
|
878
|
+
initialState() {
|
|
879
|
+
return "idle";
|
|
880
|
+
},
|
|
881
|
+
context({ prop, bindable, getContext, getRefs }) {
|
|
882
|
+
return {
|
|
883
|
+
panels: bindable(() => ({ defaultValue: normalizePanels(prop("panels"), null, prop("orientation")) })),
|
|
884
|
+
size: bindable(() => ({
|
|
885
|
+
defaultValue: [],
|
|
886
|
+
isEqual(a, b) {
|
|
887
|
+
return b != null && fuzzySizeEqual(a, b);
|
|
888
|
+
},
|
|
889
|
+
onChange(value) {
|
|
890
|
+
const ctx = getContext();
|
|
891
|
+
const refs = getRefs();
|
|
892
|
+
if (refs.get("suppressOnResize")) return;
|
|
893
|
+
const sizesBeforeCollapse = refs.get("panelSizeBeforeCollapse");
|
|
894
|
+
const expandToSizes = Object.fromEntries(sizesBeforeCollapse.entries());
|
|
895
|
+
const resizeTriggerId = ctx.get("dragState")?.resizeTriggerId ?? null;
|
|
896
|
+
const layout = getPanelLayout(prop("panels"));
|
|
897
|
+
prop("onResize")?.({
|
|
898
|
+
size: value,
|
|
899
|
+
layout,
|
|
900
|
+
resizeTriggerId,
|
|
901
|
+
expandToSizes
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
})),
|
|
905
|
+
dragState: bindable(() => ({ defaultValue: null })),
|
|
906
|
+
keyboardState: bindable(() => ({ defaultValue: null }))
|
|
907
|
+
};
|
|
908
|
+
},
|
|
909
|
+
watch({ track, action, prop }) {
|
|
910
|
+
track([
|
|
911
|
+
() => serializePanels(prop("panels")),
|
|
912
|
+
() => JSON.stringify(prop("size") ?? []),
|
|
913
|
+
() => JSON.stringify(prop("defaultSize") ?? [])
|
|
914
|
+
], () => {
|
|
915
|
+
action(["syncSize"]);
|
|
916
|
+
});
|
|
917
|
+
},
|
|
918
|
+
refs() {
|
|
919
|
+
return {
|
|
920
|
+
panelSizeBeforeCollapse: /* @__PURE__ */ new Map(),
|
|
921
|
+
prevDelta: 0,
|
|
922
|
+
panelIdToLastNotifiedSizeMap: /* @__PURE__ */ new Map(),
|
|
923
|
+
initialSize: null,
|
|
924
|
+
prevInitialLayout: null,
|
|
925
|
+
prevGroupSize: null,
|
|
926
|
+
lastRequestedSize: null,
|
|
927
|
+
suppressOnResize: false
|
|
928
|
+
};
|
|
929
|
+
},
|
|
930
|
+
computed: { horizontal({ prop }) {
|
|
931
|
+
return prop("orientation") === "horizontal";
|
|
932
|
+
} },
|
|
933
|
+
on: {
|
|
934
|
+
"SIZE.SET": { actions: ["setSize"] },
|
|
935
|
+
"SIZE.RESET": { actions: ["resetSize"] },
|
|
936
|
+
"PANEL.COLLAPSE": { actions: ["collapsePanel"] },
|
|
937
|
+
"PANEL.EXPAND": { actions: ["expandPanel"] },
|
|
938
|
+
"PANEL.RESIZE": { actions: ["resizePanel"] },
|
|
939
|
+
"ROOT.RESIZE": { actions: ["syncSize"] }
|
|
940
|
+
},
|
|
941
|
+
entry: ["syncSize"],
|
|
942
|
+
exit: ["clearGlobalCursor"],
|
|
943
|
+
effects: ["trackResizeHandles", "trackRootResize"],
|
|
944
|
+
states: {
|
|
945
|
+
idle: {
|
|
946
|
+
entry: ["clearDraggingState", "clearKeyboardState"],
|
|
947
|
+
on: {
|
|
948
|
+
POINTER_OVER: {
|
|
949
|
+
target: "hover:temp",
|
|
950
|
+
actions: ["setKeyboardState"]
|
|
951
|
+
},
|
|
952
|
+
FOCUS: {
|
|
953
|
+
target: "focused",
|
|
954
|
+
actions: ["setKeyboardState"]
|
|
955
|
+
},
|
|
956
|
+
POINTER_DOWN: {
|
|
957
|
+
target: "dragging",
|
|
958
|
+
actions: ["setDraggingState"]
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
},
|
|
962
|
+
"hover:temp": {
|
|
963
|
+
effects: ["waitForHoverDelay"],
|
|
964
|
+
on: {
|
|
965
|
+
HOVER_DELAY: { target: "hover" },
|
|
966
|
+
POINTER_DOWN: {
|
|
967
|
+
target: "dragging",
|
|
968
|
+
actions: ["setDraggingState"]
|
|
969
|
+
},
|
|
970
|
+
POINTER_LEAVE: { target: "idle" }
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
|
+
hover: {
|
|
974
|
+
tags: ["focus"],
|
|
975
|
+
on: {
|
|
976
|
+
POINTER_DOWN: {
|
|
977
|
+
target: "dragging",
|
|
978
|
+
actions: ["setDraggingState"]
|
|
979
|
+
},
|
|
980
|
+
POINTER_LEAVE: { target: "idle" }
|
|
981
|
+
}
|
|
982
|
+
},
|
|
983
|
+
focused: {
|
|
984
|
+
tags: ["focus"],
|
|
985
|
+
on: {
|
|
986
|
+
BLUR: { target: "idle" },
|
|
987
|
+
ENTER: { actions: ["collapseOrExpandPanel"] },
|
|
988
|
+
POINTER_DOWN: {
|
|
989
|
+
target: "dragging",
|
|
990
|
+
actions: ["setDraggingState"]
|
|
991
|
+
},
|
|
992
|
+
KEYBOARD_MOVE: { actions: [
|
|
993
|
+
"invokeOnResizeStart",
|
|
994
|
+
"setKeyboardValue",
|
|
995
|
+
"invokeOnResizeEnd"
|
|
996
|
+
] },
|
|
997
|
+
"FOCUS.CYCLE": { actions: ["focusNextResizeTrigger"] }
|
|
998
|
+
}
|
|
999
|
+
},
|
|
1000
|
+
dragging: {
|
|
1001
|
+
tags: ["focus"],
|
|
1002
|
+
effects: ["trackPointerMove"],
|
|
1003
|
+
entry: ["invokeOnResizeStart"],
|
|
1004
|
+
on: {
|
|
1005
|
+
POINTER_MOVE: { actions: ["setPointerValue", "setGlobalCursor"] },
|
|
1006
|
+
POINTER_UP: [{
|
|
1007
|
+
guard: "isResizeTriggerFocused",
|
|
1008
|
+
target: "focused",
|
|
1009
|
+
actions: [
|
|
1010
|
+
"invokeOnResizeEnd",
|
|
1011
|
+
"setKeyboardState",
|
|
1012
|
+
"clearDraggingState",
|
|
1013
|
+
"clearGlobalCursor"
|
|
1014
|
+
]
|
|
1015
|
+
}, {
|
|
1016
|
+
target: "idle",
|
|
1017
|
+
actions: ["invokeOnResizeEnd", "clearGlobalCursor"]
|
|
1018
|
+
}]
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
},
|
|
1022
|
+
implementations: {
|
|
1023
|
+
guards: { isResizeTriggerFocused({ context, scope }) {
|
|
1024
|
+
const dragState = context.get("dragState");
|
|
1025
|
+
return scope.isActiveElement(getResizeTriggerEl(scope, dragState?.resizeTriggerId));
|
|
1026
|
+
} },
|
|
1027
|
+
effects: {
|
|
1028
|
+
trackResizeHandles: ({ prop, scope, send }) => {
|
|
1029
|
+
const registry = prop("registry");
|
|
1030
|
+
if (!registry) return;
|
|
1031
|
+
let cleanups = [];
|
|
1032
|
+
const exec = () => {
|
|
1033
|
+
cleanups.forEach((fn) => fn());
|
|
1034
|
+
cleanups = getResizeTriggerEls(scope).map((resizeTriggerEl) => {
|
|
1035
|
+
const id = resizeTriggerEl.dataset.id;
|
|
1036
|
+
if (!id) return;
|
|
1037
|
+
return registry.register({
|
|
1038
|
+
id: getResizeTriggerId(scope, id),
|
|
1039
|
+
element: resizeTriggerEl,
|
|
1040
|
+
orientation: prop("orientation"),
|
|
1041
|
+
onActivate(point) {
|
|
1042
|
+
send({
|
|
1043
|
+
type: "POINTER_DOWN",
|
|
1044
|
+
id,
|
|
1045
|
+
point
|
|
1046
|
+
});
|
|
1047
|
+
},
|
|
1048
|
+
onDeactivate() {
|
|
1049
|
+
send({ type: "POINTER_UP" });
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
}).filter(Boolean);
|
|
1053
|
+
};
|
|
1054
|
+
exec();
|
|
1055
|
+
const observeCleanup = require_mutation_observer.observeChildren(getRootEl(scope), { callback: exec });
|
|
1056
|
+
return () => {
|
|
1057
|
+
cleanups.forEach((fn) => fn());
|
|
1058
|
+
observeCleanup?.();
|
|
1059
|
+
};
|
|
1060
|
+
},
|
|
1061
|
+
trackRootResize: ({ scope, send }) => {
|
|
1062
|
+
const rootEl = getRootEl(scope);
|
|
1063
|
+
if (!rootEl) return;
|
|
1064
|
+
return require_dom_query.resizeObserverBorderBox.observe(rootEl, () => {
|
|
1065
|
+
send({ type: "ROOT.RESIZE" });
|
|
1066
|
+
});
|
|
1067
|
+
},
|
|
1068
|
+
waitForHoverDelay: ({ send }) => {
|
|
1069
|
+
return require_timers.setRafTimeout(() => {
|
|
1070
|
+
send({ type: "HOVER_DELAY" });
|
|
1071
|
+
}, 250);
|
|
1072
|
+
},
|
|
1073
|
+
trackPointerMove: ({ scope, send }) => {
|
|
1074
|
+
return require_pointer_move.trackPointerMove(scope.getDoc(), {
|
|
1075
|
+
onPointerMove(info) {
|
|
1076
|
+
send({
|
|
1077
|
+
type: "POINTER_MOVE",
|
|
1078
|
+
point: info.point
|
|
1079
|
+
});
|
|
1080
|
+
},
|
|
1081
|
+
onPointerUp() {
|
|
1082
|
+
send({ type: "POINTER_UP" });
|
|
1083
|
+
}
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
},
|
|
1087
|
+
actions: {
|
|
1088
|
+
setSize(params) {
|
|
1089
|
+
const { context, event, prop, scope } = params;
|
|
1090
|
+
const unsafeSize = event.size;
|
|
1091
|
+
const prevSize = context.get("size");
|
|
1092
|
+
const panels = context.get("panels");
|
|
1093
|
+
const safeSize = validateSizes({
|
|
1094
|
+
size: resolvePanelSizes({
|
|
1095
|
+
sizes: unsafeSize,
|
|
1096
|
+
panels: prop("panels"),
|
|
1097
|
+
rootEl: getRootEl(scope),
|
|
1098
|
+
orientation: prop("orientation")
|
|
1099
|
+
}),
|
|
1100
|
+
panels
|
|
1101
|
+
});
|
|
1102
|
+
if (!require_equal.isEqual(prevSize, safeSize)) setSize(params, safeSize);
|
|
1103
|
+
},
|
|
1104
|
+
resetSize(params) {
|
|
1105
|
+
const { refs, context, prop, scope } = params;
|
|
1106
|
+
setSize(params, refs.get("initialSize") ?? validateSizes({
|
|
1107
|
+
size: resolvePanelSizes({
|
|
1108
|
+
sizes: prop("size") ?? prop("defaultSize"),
|
|
1109
|
+
panels: prop("panels"),
|
|
1110
|
+
rootEl: getRootEl(scope),
|
|
1111
|
+
orientation: prop("orientation")
|
|
1112
|
+
}),
|
|
1113
|
+
panels: context.get("panels")
|
|
1114
|
+
}));
|
|
1115
|
+
},
|
|
1116
|
+
syncSize(params) {
|
|
1117
|
+
const { context, scope, prop, refs } = params;
|
|
1118
|
+
const rootEl = getRootEl(scope);
|
|
1119
|
+
if (!rootEl) return;
|
|
1120
|
+
const orientation = prop("orientation");
|
|
1121
|
+
const nextGroupSize = getGroupSize(rootEl, orientation);
|
|
1122
|
+
if (nextGroupSize <= 0) return;
|
|
1123
|
+
const panels = normalizePanels(prop("panels"), rootEl, prop("orientation"));
|
|
1124
|
+
context.set("panels", panels);
|
|
1125
|
+
const sizeSpec = prop("size") ?? prop("defaultSize");
|
|
1126
|
+
const initialLayout = `${getPanelLayout(prop("panels"))}:${JSON.stringify(prop("size") ?? [])}:${JSON.stringify(prop("defaultSize") ?? [])}`;
|
|
1127
|
+
const prevGroupSize = refs.get("prevGroupSize");
|
|
1128
|
+
const currentSize = context.get("size");
|
|
1129
|
+
const nextResolvedSize = resolvePanelSizes({
|
|
1130
|
+
sizes: sizeSpec,
|
|
1131
|
+
panels: prop("panels"),
|
|
1132
|
+
rootEl,
|
|
1133
|
+
orientation
|
|
1134
|
+
});
|
|
1135
|
+
const safeSize = validateSizes({
|
|
1136
|
+
size: prevGroupSize != null && prevGroupSize !== nextGroupSize && currentSize.length === panels.length ? preserveFixedPanelSizes({
|
|
1137
|
+
panels,
|
|
1138
|
+
prevLayout: currentSize,
|
|
1139
|
+
prevGroupSize,
|
|
1140
|
+
nextGroupSize
|
|
1141
|
+
}) : nextResolvedSize,
|
|
1142
|
+
panels
|
|
1143
|
+
});
|
|
1144
|
+
if (refs.get("prevInitialLayout") !== initialLayout) {
|
|
1145
|
+
refs.set("initialSize", safeSize);
|
|
1146
|
+
refs.set("prevInitialLayout", initialLayout);
|
|
1147
|
+
}
|
|
1148
|
+
const prevSize = context.get("size");
|
|
1149
|
+
if (!require_equal.isEqual(prevSize, safeSize)) {
|
|
1150
|
+
refs.set("suppressOnResize", prop("size") != null || prevSize.length === 0);
|
|
1151
|
+
context.set("size", safeSize);
|
|
1152
|
+
refs.set("suppressOnResize", false);
|
|
1153
|
+
}
|
|
1154
|
+
refs.set("prevGroupSize", nextGroupSize);
|
|
1155
|
+
},
|
|
1156
|
+
setDraggingState({ context, event, prop, scope }) {
|
|
1157
|
+
const orientation = prop("orientation");
|
|
1158
|
+
const size = context.get("size");
|
|
1159
|
+
const resizeTriggerId = event.id;
|
|
1160
|
+
const resolvedResizeTriggerId = resolveResizeTriggerId(scope, resizeTriggerId);
|
|
1161
|
+
if (!resolvedResizeTriggerId) return;
|
|
1162
|
+
if (!getRootEl(scope)) return;
|
|
1163
|
+
const handleElement = getResizeTriggerEl(scope, resizeTriggerId);
|
|
1164
|
+
require_warning.ensure(handleElement, () => `Drag handle element not found for id "${resizeTriggerId}"`);
|
|
1165
|
+
const initialCursorPosition = orientation === "horizontal" ? event.point.x : event.point.y;
|
|
1166
|
+
context.set("dragState", {
|
|
1167
|
+
resizeTriggerId: event.id,
|
|
1168
|
+
resolvedResizeTriggerId,
|
|
1169
|
+
resizeTriggerRect: handleElement.getBoundingClientRect(),
|
|
1170
|
+
initialCursorPosition,
|
|
1171
|
+
initialSize: size
|
|
1172
|
+
});
|
|
1173
|
+
},
|
|
1174
|
+
clearDraggingState({ context }) {
|
|
1175
|
+
context.set("dragState", null);
|
|
1176
|
+
},
|
|
1177
|
+
setKeyboardState({ context, event, scope }) {
|
|
1178
|
+
const id = event.id ?? context.get("dragState")?.resizeTriggerId;
|
|
1179
|
+
if (id == null) return;
|
|
1180
|
+
context.set("keyboardState", {
|
|
1181
|
+
resizeTriggerId: id,
|
|
1182
|
+
resolvedResizeTriggerId: resolveResizeTriggerId(scope, id)
|
|
1183
|
+
});
|
|
1184
|
+
},
|
|
1185
|
+
clearKeyboardState({ context }) {
|
|
1186
|
+
context.set("keyboardState", null);
|
|
1187
|
+
},
|
|
1188
|
+
collapsePanel(params) {
|
|
1189
|
+
const { context, event, refs } = params;
|
|
1190
|
+
const prevSize = context.get("size");
|
|
1191
|
+
const panels = context.get("panels");
|
|
1192
|
+
const panel = panels.find((panel) => panel.id === event.id);
|
|
1193
|
+
require_warning.ensure(panel, () => `Panel data not found for id "${event.id}"`);
|
|
1194
|
+
if (panel.collapsible) {
|
|
1195
|
+
const { collapsedSize = 0, panelSize, pivotIndices } = panelDataHelper(panels, panel, prevSize);
|
|
1196
|
+
require_warning.ensure(panelSize != null, () => `Panel size not found for panel "${panel.id}"`);
|
|
1197
|
+
if (!fuzzyNumbersEqual(panelSize, collapsedSize)) {
|
|
1198
|
+
refs.get("panelSizeBeforeCollapse").set(panel.id, panelSize);
|
|
1199
|
+
const nextSize = resizeByDelta({
|
|
1200
|
+
delta: findPanelDataIndex(panels, panel) === panels.length - 1 ? panelSize - collapsedSize : collapsedSize - panelSize,
|
|
1201
|
+
initialSize: prevSize,
|
|
1202
|
+
panels,
|
|
1203
|
+
pivotIndices,
|
|
1204
|
+
prevSize,
|
|
1205
|
+
trigger: "imperative-api"
|
|
1206
|
+
});
|
|
1207
|
+
if (!require_equal.isEqual(prevSize, nextSize)) setSize(params, nextSize);
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
},
|
|
1211
|
+
expandPanel(params) {
|
|
1212
|
+
const { context, event, refs } = params;
|
|
1213
|
+
const panels = context.get("panels");
|
|
1214
|
+
const prevSize = context.get("size");
|
|
1215
|
+
const panel = panels.find((panel) => panel.id === event.id);
|
|
1216
|
+
require_warning.ensure(panel, () => `Panel data not found for id "${event.id}"`);
|
|
1217
|
+
if (panel.collapsible) {
|
|
1218
|
+
const { collapsedSize = 0, panelSize = 0, minSize: minSizeFromProps = 0, pivotIndices } = panelDataHelper(panels, panel, prevSize);
|
|
1219
|
+
const minSize = event.minSize ?? minSizeFromProps;
|
|
1220
|
+
if (fuzzyNumbersEqual(panelSize, collapsedSize)) {
|
|
1221
|
+
const prevPanelSize = refs.get("panelSizeBeforeCollapse").get(panel.id);
|
|
1222
|
+
const baseSize = prevPanelSize != null && prevPanelSize >= minSize ? prevPanelSize : minSize;
|
|
1223
|
+
const nextSize = resizeByDelta({
|
|
1224
|
+
delta: findPanelDataIndex(panels, panel) === panels.length - 1 ? panelSize - baseSize : baseSize - panelSize,
|
|
1225
|
+
initialSize: prevSize,
|
|
1226
|
+
panels,
|
|
1227
|
+
pivotIndices,
|
|
1228
|
+
prevSize,
|
|
1229
|
+
trigger: "imperative-api"
|
|
1230
|
+
});
|
|
1231
|
+
if (!require_equal.isEqual(prevSize, nextSize)) setSize(params, nextSize);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
},
|
|
1235
|
+
resizePanel(params) {
|
|
1236
|
+
const { context, event } = params;
|
|
1237
|
+
const prevSize = context.get("size");
|
|
1238
|
+
const panels = context.get("panels");
|
|
1239
|
+
const panel = getPanelById(panels, event.id);
|
|
1240
|
+
const unsafePanelSize = event.size;
|
|
1241
|
+
const { panelSize, pivotIndices } = panelDataHelper(panels, panel, prevSize);
|
|
1242
|
+
require_warning.ensure(panelSize != null, () => `Panel size not found for panel "${panel.id}"`);
|
|
1243
|
+
const nextSize = resizeByDelta({
|
|
1244
|
+
delta: findPanelDataIndex(panels, panel) === panels.length - 1 ? panelSize - unsafePanelSize : unsafePanelSize - panelSize,
|
|
1245
|
+
initialSize: prevSize,
|
|
1246
|
+
panels,
|
|
1247
|
+
pivotIndices,
|
|
1248
|
+
prevSize,
|
|
1249
|
+
trigger: "imperative-api"
|
|
1250
|
+
});
|
|
1251
|
+
if (!require_equal.isEqual(prevSize, nextSize)) setSize(params, nextSize);
|
|
1252
|
+
},
|
|
1253
|
+
setPointerValue(params) {
|
|
1254
|
+
const { context, event, prop, scope } = params;
|
|
1255
|
+
const dragState = context.get("dragState");
|
|
1256
|
+
if (!dragState) return;
|
|
1257
|
+
const { resolvedResizeTriggerId, initialSize, initialCursorPosition } = dragState;
|
|
1258
|
+
const panels = context.get("panels");
|
|
1259
|
+
const panelGroupElement = getRootEl(scope);
|
|
1260
|
+
require_warning.ensure(panelGroupElement, () => `Panel group element not found`);
|
|
1261
|
+
const pivotIndices = resolvedResizeTriggerId.split(":").map((id) => panels.findIndex((panel) => panel.id === id));
|
|
1262
|
+
const horizontal = prop("orientation") === "horizontal";
|
|
1263
|
+
const cursorPosition = horizontal ? event.point.x : event.point.y;
|
|
1264
|
+
const groupRect = panelGroupElement.getBoundingClientRect();
|
|
1265
|
+
const groupSizeInPixels = horizontal ? groupRect.width : groupRect.height;
|
|
1266
|
+
const offsetPercentage = (cursorPosition - initialCursorPosition) / groupSizeInPixels * 100;
|
|
1267
|
+
const prevSize = context.get("size");
|
|
1268
|
+
const nextSize = resizeByDelta({
|
|
1269
|
+
delta: offsetPercentage,
|
|
1270
|
+
initialSize: initialSize ?? prevSize,
|
|
1271
|
+
panels,
|
|
1272
|
+
pivotIndices,
|
|
1273
|
+
prevSize,
|
|
1274
|
+
trigger: "mouse-or-touch"
|
|
1275
|
+
});
|
|
1276
|
+
if (!require_equal.isEqual(prevSize, nextSize)) setSize(params, nextSize);
|
|
1277
|
+
},
|
|
1278
|
+
setKeyboardValue(params) {
|
|
1279
|
+
const { context, event } = params;
|
|
1280
|
+
const panelDataArray = context.get("panels");
|
|
1281
|
+
const resizeTriggerId = resolveResizeTriggerId(params.scope, event.id);
|
|
1282
|
+
if (!resizeTriggerId) return;
|
|
1283
|
+
const delta = event.delta;
|
|
1284
|
+
const pivotIndices = resizeTriggerId.split(":").map((id) => panelDataArray.findIndex((panelData) => panelData.id === id));
|
|
1285
|
+
const prevSize = context.get("size");
|
|
1286
|
+
const nextSize = resizeByDelta({
|
|
1287
|
+
delta,
|
|
1288
|
+
initialSize: prevSize,
|
|
1289
|
+
panels: panelDataArray,
|
|
1290
|
+
pivotIndices,
|
|
1291
|
+
prevSize,
|
|
1292
|
+
trigger: "keyboard"
|
|
1293
|
+
});
|
|
1294
|
+
if (!require_equal.isEqual(prevSize, nextSize)) setSize(params, nextSize);
|
|
1295
|
+
},
|
|
1296
|
+
invokeOnResizeEnd({ context, prop, refs }) {
|
|
1297
|
+
queueMicrotask(() => {
|
|
1298
|
+
const dragState = context.get("dragState");
|
|
1299
|
+
prop("onResizeEnd")?.({
|
|
1300
|
+
size: refs.get("lastRequestedSize") ?? context.get("size"),
|
|
1301
|
+
resizeTriggerId: dragState?.resizeTriggerId ?? null
|
|
1302
|
+
});
|
|
1303
|
+
});
|
|
1304
|
+
},
|
|
1305
|
+
invokeOnResizeStart({ prop }) {
|
|
1306
|
+
queueMicrotask(() => {
|
|
1307
|
+
prop("onResizeStart")?.();
|
|
1308
|
+
});
|
|
1309
|
+
},
|
|
1310
|
+
collapseOrExpandPanel(params) {
|
|
1311
|
+
const { context, refs } = params;
|
|
1312
|
+
const panelDataArray = context.get("panels");
|
|
1313
|
+
const sizes = context.get("size");
|
|
1314
|
+
const [idBefore, idAfter] = (context.get("keyboardState")?.resolvedResizeTriggerId)?.split(":") ?? [];
|
|
1315
|
+
const index = panelDataArray.findIndex((panelData) => panelData.id === idBefore);
|
|
1316
|
+
if (index === -1) return;
|
|
1317
|
+
const panelData = panelDataArray[index];
|
|
1318
|
+
require_warning.ensure(panelData, () => `No panel data found for index ${index}`);
|
|
1319
|
+
const size = sizes[index];
|
|
1320
|
+
const { collapsedSize = 0, collapsible, minSize = 0 } = panelData;
|
|
1321
|
+
if (size != null && collapsible) {
|
|
1322
|
+
const pivotIndices = [idBefore, idAfter].map((id) => panelDataArray.findIndex((panelData) => panelData.id === id));
|
|
1323
|
+
const nextSize = resizeByDelta({
|
|
1324
|
+
delta: fuzzyNumbersEqual(size, collapsedSize) ? minSize - collapsedSize : collapsedSize - size,
|
|
1325
|
+
initialSize: refs.get("initialSize") ?? sizes,
|
|
1326
|
+
panels: panelDataArray,
|
|
1327
|
+
pivotIndices,
|
|
1328
|
+
prevSize: sizes,
|
|
1329
|
+
trigger: "keyboard"
|
|
1330
|
+
});
|
|
1331
|
+
if (!require_equal.isEqual(sizes, nextSize)) setSize(params, nextSize);
|
|
1332
|
+
}
|
|
1333
|
+
},
|
|
1334
|
+
setGlobalCursor(params) {
|
|
1335
|
+
const { context, scope, prop } = params;
|
|
1336
|
+
if (prop("registry")) return;
|
|
1337
|
+
const dragState = context.get("dragState");
|
|
1338
|
+
if (!dragState) return;
|
|
1339
|
+
const panels = context.get("panels");
|
|
1340
|
+
const horizontal = prop("orientation") === "horizontal";
|
|
1341
|
+
const [idBefore] = dragState.resolvedResizeTriggerId.split(":");
|
|
1342
|
+
const panel = panels[panels.findIndex((panel) => panel.id === idBefore)];
|
|
1343
|
+
const aria = getAriaValue(context.get("size"), panels, dragState.resolvedResizeTriggerId);
|
|
1344
|
+
const cursorState = {
|
|
1345
|
+
isAtMin: fuzzyNumbersEqual(aria.valueNow, aria.valueMin) || fuzzyNumbersEqual(aria.valueNow, panel.collapsedSize),
|
|
1346
|
+
isAtMax: fuzzyNumbersEqual(aria.valueNow, aria.valueMax)
|
|
1347
|
+
};
|
|
1348
|
+
setupGlobalCursor(scope, cursorState, horizontal, prop("nonce"));
|
|
1349
|
+
},
|
|
1350
|
+
clearGlobalCursor({ scope }) {
|
|
1351
|
+
removeGlobalCursor(scope);
|
|
1352
|
+
},
|
|
1353
|
+
focusNextResizeTrigger({ event, scope }) {
|
|
1354
|
+
const resizeTriggers = getResizeTriggerEls(scope);
|
|
1355
|
+
const index = resizeTriggers.findIndex((el) => el.dataset.id === event.id);
|
|
1356
|
+
(event.shiftKey ? require_array.prev(resizeTriggers, index) : require_array.next(resizeTriggers, index))?.focus();
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
function setSize(params, sizes) {
|
|
1362
|
+
const { refs, prop, context } = params;
|
|
1363
|
+
const panelsArray = context.get("panels");
|
|
1364
|
+
const onCollapse = prop("onCollapse");
|
|
1365
|
+
const onExpand = prop("onExpand");
|
|
1366
|
+
const onResize = prop("onResize");
|
|
1367
|
+
const onResizeStart = prop("onResizeStart");
|
|
1368
|
+
const onResizeEnd = prop("onResizeEnd");
|
|
1369
|
+
const panelIdToLastNotifiedSizeMap = refs.get("panelIdToLastNotifiedSizeMap");
|
|
1370
|
+
const dragState = context.get("dragState");
|
|
1371
|
+
const keyboardState = context.get("keyboardState");
|
|
1372
|
+
const isProgrammatic = dragState === null && keyboardState === null;
|
|
1373
|
+
refs.set("lastRequestedSize", sizes);
|
|
1374
|
+
if (isProgrammatic && onResizeStart) queueMicrotask(() => {
|
|
1375
|
+
onResizeStart();
|
|
1376
|
+
});
|
|
1377
|
+
if (prop("size") == null) context.set("size", sizes);
|
|
1378
|
+
else if (onResize) {
|
|
1379
|
+
const sizesBeforeCollapse = refs.get("panelSizeBeforeCollapse");
|
|
1380
|
+
const expandToSizes = Object.fromEntries(sizesBeforeCollapse.entries());
|
|
1381
|
+
const resizeTriggerId = dragState?.resizeTriggerId ?? null;
|
|
1382
|
+
onResize({
|
|
1383
|
+
size: sizes,
|
|
1384
|
+
layout: getPanelLayout(prop("panels")),
|
|
1385
|
+
resizeTriggerId,
|
|
1386
|
+
expandToSizes
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
sizes.forEach((size, index) => {
|
|
1390
|
+
const panelData = panelsArray[index];
|
|
1391
|
+
require_warning.ensure(panelData, () => `Panel data not found for index ${index}`);
|
|
1392
|
+
const { collapsedSize = 0, collapsible, id: panelId } = panelData;
|
|
1393
|
+
const lastNotifiedSize = panelIdToLastNotifiedSizeMap.get(panelId);
|
|
1394
|
+
if (lastNotifiedSize == null || size !== lastNotifiedSize) {
|
|
1395
|
+
panelIdToLastNotifiedSizeMap.set(panelId, size);
|
|
1396
|
+
if (collapsible && lastNotifiedSize != null && (onCollapse || onExpand)) {
|
|
1397
|
+
if (fuzzyNumbersEqual(lastNotifiedSize, collapsedSize) && !fuzzyNumbersEqual(size, collapsedSize)) onExpand?.({
|
|
1398
|
+
panelId,
|
|
1399
|
+
size
|
|
1400
|
+
});
|
|
1401
|
+
if (!fuzzyNumbersEqual(lastNotifiedSize, collapsedSize) && fuzzyNumbersEqual(size, collapsedSize)) onCollapse?.({
|
|
1402
|
+
panelId,
|
|
1403
|
+
size
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
});
|
|
1408
|
+
if (isProgrammatic && onResizeEnd) queueMicrotask(() => {
|
|
1409
|
+
onResizeEnd({
|
|
1410
|
+
size: sizes,
|
|
1411
|
+
resizeTriggerId: null
|
|
1412
|
+
});
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1415
|
+
//#endregion
|
|
1416
|
+
//#region src/machines/splitter/props.ts
|
|
1417
|
+
const props = require_create_props.createProps()([
|
|
1418
|
+
"dir",
|
|
1419
|
+
"getRootNode",
|
|
1420
|
+
"id",
|
|
1421
|
+
"ids",
|
|
1422
|
+
"onResize",
|
|
1423
|
+
"onResizeStart",
|
|
1424
|
+
"onResizeEnd",
|
|
1425
|
+
"onCollapse",
|
|
1426
|
+
"onExpand",
|
|
1427
|
+
"orientation",
|
|
1428
|
+
"size",
|
|
1429
|
+
"defaultSize",
|
|
1430
|
+
"panels",
|
|
1431
|
+
"keyboardResizeBy",
|
|
1432
|
+
"nonce",
|
|
1433
|
+
"registry"
|
|
1434
|
+
]);
|
|
1435
|
+
const splitProps = require_utils.createSplitProps(props);
|
|
1436
|
+
const panelProps = require_create_props.createProps()(["id"]);
|
|
1437
|
+
const splitPanelProps = require_utils.createSplitProps(panelProps);
|
|
1438
|
+
const resizeTriggerProps = require_create_props.createProps()(["disabled", "id"]);
|
|
1439
|
+
const splitResizeTriggerProps = require_utils.createSplitProps(resizeTriggerProps);
|
|
1440
|
+
//#endregion
|
|
1441
|
+
//#region src/machines/splitter/utils/intersects.ts
|
|
1442
|
+
function intersects(r1, r2, strict = false) {
|
|
1443
|
+
if (strict) return r1.x < r2.x + r2.width && r1.x + r1.width > r2.x && r1.y < r2.y + r2.height && r1.y + r1.height > r2.y;
|
|
1444
|
+
return r1.x <= r2.x + r2.width && r1.x + r1.width >= r2.x && r1.y <= r2.y + r2.height && r1.y + r1.height >= r2.y;
|
|
1445
|
+
}
|
|
1446
|
+
function toRect(r) {
|
|
1447
|
+
return {
|
|
1448
|
+
x: r.x,
|
|
1449
|
+
y: r.y,
|
|
1450
|
+
width: r.width,
|
|
1451
|
+
height: r.height
|
|
1452
|
+
};
|
|
1453
|
+
}
|
|
1454
|
+
//#endregion
|
|
1455
|
+
//#region src/machines/splitter/utils/stacking-order.ts
|
|
1456
|
+
function compareStackingOrder(a, b) {
|
|
1457
|
+
if (a === b) throw new Error("Cannot compare node with itself");
|
|
1458
|
+
const ancestors = {
|
|
1459
|
+
a: require_dom_query.getAncestorElements(a),
|
|
1460
|
+
b: require_dom_query.getAncestorElements(b)
|
|
1461
|
+
};
|
|
1462
|
+
let commonAncestor = null;
|
|
1463
|
+
while (ancestors.a.at(-1) === ancestors.b.at(-1)) {
|
|
1464
|
+
const currentA = ancestors.a.pop();
|
|
1465
|
+
ancestors.b.pop();
|
|
1466
|
+
commonAncestor = currentA;
|
|
1467
|
+
}
|
|
1468
|
+
require_warning.ensure(commonAncestor, () => "[stacking-order] Stacking order can only be calculated for elements with a common ancestor");
|
|
1469
|
+
const zIndexes = {
|
|
1470
|
+
a: getZIndex(findStackingContext(ancestors.a)),
|
|
1471
|
+
b: getZIndex(findStackingContext(ancestors.b))
|
|
1472
|
+
};
|
|
1473
|
+
if (zIndexes.a === zIndexes.b) {
|
|
1474
|
+
const children = commonAncestor.childNodes;
|
|
1475
|
+
const furthestAncestors = {
|
|
1476
|
+
a: ancestors.a.at(-1),
|
|
1477
|
+
b: ancestors.b.at(-1)
|
|
1478
|
+
};
|
|
1479
|
+
let i = children.length;
|
|
1480
|
+
while (i--) {
|
|
1481
|
+
const child = children[i];
|
|
1482
|
+
if (child === furthestAncestors.a) return 1;
|
|
1483
|
+
if (child === furthestAncestors.b) return -1;
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
return Math.sign(zIndexes.a - zIndexes.b);
|
|
1487
|
+
}
|
|
1488
|
+
const STACKING_PROPS_REGEX = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
|
|
1489
|
+
function isFlexItem(node) {
|
|
1490
|
+
const display = require_computed_style.getComputedStyle(require_dom_query.getParentElement(node) ?? node).display;
|
|
1491
|
+
return display === "flex" || display === "inline-flex";
|
|
1492
|
+
}
|
|
1493
|
+
function createsStackingContext(node) {
|
|
1494
|
+
const style = require_computed_style.getComputedStyle(node);
|
|
1495
|
+
if (style.position === "fixed") return true;
|
|
1496
|
+
if (style.zIndex !== "auto" && (style.position !== "static" || isFlexItem(node))) return true;
|
|
1497
|
+
if (+style.opacity < 1) return true;
|
|
1498
|
+
if (require_utils.hasProp(style, "transform") && style.transform !== "none") return true;
|
|
1499
|
+
if (require_utils.hasProp(style, "webkitTransform") && style.webkitTransform !== "none") return true;
|
|
1500
|
+
if (require_utils.hasProp(style, "mixBlendMode") && style.mixBlendMode !== "normal") return true;
|
|
1501
|
+
if (require_utils.hasProp(style, "filter") && style.filter !== "none") return true;
|
|
1502
|
+
if (require_utils.hasProp(style, "webkitFilter") && style.webkitFilter !== "none") return true;
|
|
1503
|
+
if (require_utils.hasProp(style, "isolation") && style.isolation === "isolate") return true;
|
|
1504
|
+
if (STACKING_PROPS_REGEX.test(style.willChange)) return true;
|
|
1505
|
+
if (style.webkitOverflowScrolling === "touch") return true;
|
|
1506
|
+
return false;
|
|
1507
|
+
}
|
|
1508
|
+
function findStackingContext(nodes) {
|
|
1509
|
+
let i = nodes.length;
|
|
1510
|
+
while (i--) {
|
|
1511
|
+
const node = nodes[i];
|
|
1512
|
+
require_warning.ensure(node, () => "[stacking-order] missing node in findStackingContext");
|
|
1513
|
+
if (createsStackingContext(node)) return node;
|
|
1514
|
+
}
|
|
1515
|
+
return null;
|
|
1516
|
+
}
|
|
1517
|
+
const getZIndex = (node) => {
|
|
1518
|
+
return node && Number(require_computed_style.getComputedStyle(node).zIndex) || 0;
|
|
1519
|
+
};
|
|
1520
|
+
//#endregion
|
|
1521
|
+
//#region src/machines/splitter/utils/registry.ts
|
|
1522
|
+
var SplitterRegistry = class {
|
|
1523
|
+
handles = /* @__PURE__ */ new Map();
|
|
1524
|
+
state = {
|
|
1525
|
+
activeHandleIds: /* @__PURE__ */ new Set(),
|
|
1526
|
+
isPointerDown: false
|
|
1527
|
+
};
|
|
1528
|
+
listenerAttached = false;
|
|
1529
|
+
options;
|
|
1530
|
+
constructor(options = {}) {
|
|
1531
|
+
this.options = {
|
|
1532
|
+
nonce: options.nonce ?? "",
|
|
1533
|
+
hitAreaMargins: {
|
|
1534
|
+
coarse: options.hitAreaMargins?.coarse ?? 15,
|
|
1535
|
+
fine: options.hitAreaMargins?.fine ?? 5
|
|
1536
|
+
}
|
|
1537
|
+
};
|
|
1538
|
+
}
|
|
1539
|
+
register(data) {
|
|
1540
|
+
this.handles.set(data.id, data);
|
|
1541
|
+
this.attachGlobalListeners();
|
|
1542
|
+
return () => {
|
|
1543
|
+
this.handles.delete(data.id);
|
|
1544
|
+
this.state.activeHandleIds.delete(data.id);
|
|
1545
|
+
if (this.handles.size === 0) this.detachGlobalListeners();
|
|
1546
|
+
};
|
|
1547
|
+
}
|
|
1548
|
+
attachGlobalListeners() {
|
|
1549
|
+
if (this.listenerAttached) return;
|
|
1550
|
+
this.doc.addEventListener("pointermove", this.handlePointerMove, true);
|
|
1551
|
+
this.doc.addEventListener("pointerdown", this.handlePointerDown, true);
|
|
1552
|
+
this.doc.addEventListener("pointerup", this.handlePointerUp, true);
|
|
1553
|
+
this.listenerAttached = true;
|
|
1554
|
+
}
|
|
1555
|
+
detachGlobalListeners() {
|
|
1556
|
+
if (!this.listenerAttached) return;
|
|
1557
|
+
this.doc.removeEventListener("pointermove", this.handlePointerMove, true);
|
|
1558
|
+
this.doc.removeEventListener("pointerdown", this.handlePointerDown, true);
|
|
1559
|
+
this.doc.removeEventListener("pointerup", this.handlePointerUp, true);
|
|
1560
|
+
this.listenerAttached = false;
|
|
1561
|
+
}
|
|
1562
|
+
getPointerType(event) {
|
|
1563
|
+
return event.pointerType === "touch" || event.pointerType === "pen" ? "coarse" : "fine";
|
|
1564
|
+
}
|
|
1565
|
+
get doc() {
|
|
1566
|
+
const firstHandle = this.handles.values().next().value;
|
|
1567
|
+
return require_dom_query.getDocument(firstHandle?.element);
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* Fast hit-test: only checks pointer proximity to handles (no stacking order).
|
|
1571
|
+
* Used for pointermove cursor feedback.
|
|
1572
|
+
*/
|
|
1573
|
+
findHitHandles(x, y, pointerType) {
|
|
1574
|
+
const intersecting = [];
|
|
1575
|
+
const margin = this.options.hitAreaMargins[pointerType];
|
|
1576
|
+
this.handles.forEach((handle) => {
|
|
1577
|
+
const rect = handle.element.getBoundingClientRect();
|
|
1578
|
+
if (x >= rect.left - margin && x <= rect.right + margin && y >= rect.top - margin && y <= rect.bottom + margin) intersecting.push(handle);
|
|
1579
|
+
});
|
|
1580
|
+
return intersecting;
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* Full intersection check: hit-test + stacking order verification.
|
|
1584
|
+
* Used for pointerdown activation where correctness matters.
|
|
1585
|
+
*/
|
|
1586
|
+
findIntersectingHandles(x, y, pointerType, eventTarget) {
|
|
1587
|
+
const hits = this.findHitHandles(x, y, pointerType);
|
|
1588
|
+
const targetElement = require_dom_query.isElement(eventTarget) ? eventTarget : null;
|
|
1589
|
+
if (!targetElement || !require_dom_query.contains(this.doc, targetElement)) return hits;
|
|
1590
|
+
return hits.filter((handle) => {
|
|
1591
|
+
const dragHandleElement = handle.element;
|
|
1592
|
+
if (targetElement === dragHandleElement || require_dom_query.contains(dragHandleElement, targetElement) || require_dom_query.contains(targetElement, dragHandleElement)) return true;
|
|
1593
|
+
try {
|
|
1594
|
+
if (compareStackingOrder(targetElement, dragHandleElement) > 0) {
|
|
1595
|
+
const dragHandleRect = dragHandleElement.getBoundingClientRect();
|
|
1596
|
+
let currentElement = targetElement;
|
|
1597
|
+
while (currentElement) {
|
|
1598
|
+
if (currentElement.contains(dragHandleElement)) break;
|
|
1599
|
+
if (intersects(toRect(currentElement.getBoundingClientRect()), toRect(dragHandleRect), true)) return false;
|
|
1600
|
+
currentElement = require_dom_query.getParentElement(currentElement);
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
} catch {}
|
|
1604
|
+
return true;
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1607
|
+
handlePointerMove = (event) => {
|
|
1608
|
+
if (this.state.isPointerDown) return;
|
|
1609
|
+
const pointerType = this.getPointerType(event);
|
|
1610
|
+
const intersecting = this.findHitHandles(event.clientX, event.clientY, pointerType);
|
|
1611
|
+
const newActiveIds = new Set(intersecting.map((h) => h.id));
|
|
1612
|
+
if (newActiveIds.size !== this.state.activeHandleIds.size || [...newActiveIds].some((id) => !this.state.activeHandleIds.has(id))) {
|
|
1613
|
+
this.state.activeHandleIds = newActiveIds;
|
|
1614
|
+
this.updateCursor(intersecting);
|
|
1615
|
+
}
|
|
1616
|
+
};
|
|
1617
|
+
handlePointerDown = (event) => {
|
|
1618
|
+
const pointerType = this.getPointerType(event);
|
|
1619
|
+
const intersecting = this.findIntersectingHandles(event.clientX, event.clientY, pointerType, event.target);
|
|
1620
|
+
if (intersecting.length > 0) {
|
|
1621
|
+
this.state.isPointerDown = true;
|
|
1622
|
+
this.state.activeHandleIds = new Set(intersecting.map((h) => h.id));
|
|
1623
|
+
const point = {
|
|
1624
|
+
x: event.clientX,
|
|
1625
|
+
y: event.clientY
|
|
1626
|
+
};
|
|
1627
|
+
intersecting.forEach((handle) => {
|
|
1628
|
+
handle.onActivate(point);
|
|
1629
|
+
});
|
|
1630
|
+
this.updateCursor(intersecting);
|
|
1631
|
+
}
|
|
1632
|
+
};
|
|
1633
|
+
handlePointerUp = (_event) => {
|
|
1634
|
+
if (this.state.isPointerDown) {
|
|
1635
|
+
this.state.isPointerDown = false;
|
|
1636
|
+
this.handles.forEach((handle) => {
|
|
1637
|
+
if (this.state.activeHandleIds.has(handle.id)) handle.onDeactivate();
|
|
1638
|
+
});
|
|
1639
|
+
this.state.activeHandleIds.clear();
|
|
1640
|
+
this.clearGlobalCursor();
|
|
1641
|
+
}
|
|
1642
|
+
};
|
|
1643
|
+
updateCursor(intersecting) {
|
|
1644
|
+
if (intersecting.length === 0) {
|
|
1645
|
+
this.clearGlobalCursor();
|
|
1646
|
+
return;
|
|
1647
|
+
}
|
|
1648
|
+
const hasHorizontal = intersecting.some((h) => h.orientation === "horizontal");
|
|
1649
|
+
const hasVertical = intersecting.some((h) => h.orientation === "vertical");
|
|
1650
|
+
let cursor = "default";
|
|
1651
|
+
if (hasHorizontal && hasVertical) cursor = "move";
|
|
1652
|
+
else if (hasHorizontal) cursor = "ew-resize";
|
|
1653
|
+
else if (hasVertical) cursor = "ns-resize";
|
|
1654
|
+
this.setGlobalCursor(cursor);
|
|
1655
|
+
}
|
|
1656
|
+
globalCursorId = "splitter-registry-cursor";
|
|
1657
|
+
setGlobalCursor(cursor) {
|
|
1658
|
+
const doc = this.doc;
|
|
1659
|
+
let styleEl = doc.getElementById(this.globalCursorId);
|
|
1660
|
+
const textContent = `* { cursor: ${cursor} !important; }`;
|
|
1661
|
+
if (styleEl) styleEl.textContent = textContent;
|
|
1662
|
+
else {
|
|
1663
|
+
styleEl = doc.createElement("style");
|
|
1664
|
+
styleEl.id = this.globalCursorId;
|
|
1665
|
+
styleEl.textContent = textContent;
|
|
1666
|
+
if (this.options.nonce) styleEl.nonce = this.options.nonce;
|
|
1667
|
+
doc.head.appendChild(styleEl);
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
clearGlobalCursor() {
|
|
1671
|
+
this.doc.getElementById(this.globalCursorId)?.remove();
|
|
1672
|
+
}
|
|
1673
|
+
};
|
|
1674
|
+
const registry = (opts = {}) => new SplitterRegistry(opts);
|
|
1675
|
+
//#endregion
|
|
1676
|
+
exports.anatomy = anatomy;
|
|
1677
|
+
exports.connect = connect;
|
|
1678
|
+
exports.layout = getPanelLayout;
|
|
1679
|
+
exports.machine = machine;
|
|
1680
|
+
exports.panelProps = panelProps;
|
|
1681
|
+
exports.props = props;
|
|
1682
|
+
exports.registry = registry;
|
|
1683
|
+
exports.resizeTriggerProps = resizeTriggerProps;
|
|
1684
|
+
exports.splitPanelProps = splitPanelProps;
|
|
1685
|
+
exports.splitProps = splitProps;
|
|
1686
|
+
exports.splitResizeTriggerProps = splitResizeTriggerProps;
|