@gemologic/sheen 0.1.0-rc.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -1
- package/THIRD_PARTY_NOTICES.md +18 -0
- package/dist/primitives/Accordion.js +1 -1
- package/dist/primitives/Collapsible.js +1 -1
- package/dist/primitives/Combobox.js +1 -1
- package/dist/primitives/CommandPalette.js +2 -2
- package/dist/primitives/ContextMenu.js +2 -2
- package/dist/primitives/Dialog.js +1 -1
- package/dist/primitives/DropdownMenu.js +2 -2
- package/dist/primitives/LinkTooltip.js +1 -1
- package/dist/primitives/Popover.js +1 -1
- package/dist/primitives/Select.js +1 -1
- package/dist/primitives/Tabs.js +1 -1
- package/dist/primitives/Tooltip.js +1 -1
- package/dist/primitives/tooltip-layer.js +1 -1
- package/dist/theme/ThemeProvider.js +30 -30
- package/dist/theme/intl.js +4 -4
- package/dist/utils/polymorphic.d.ts +1 -1
- package/dist/vite.d.ts +3 -0
- package/dist/vite.js +54 -0
- package/package.json +71 -5
- package/src/primitives/Accordion.tsx +1 -1
- package/src/primitives/Collapsible.tsx +1 -1
- package/src/primitives/Combobox.tsx +1 -1
- package/src/primitives/CommandPalette.tsx +2 -2
- package/src/primitives/ContextMenu.tsx +2 -2
- package/src/primitives/Dialog.tsx +1 -1
- package/src/primitives/DropdownMenu.tsx +2 -2
- package/src/primitives/LinkTooltip.tsx +1 -1
- package/src/primitives/Popover.tsx +1 -1
- package/src/primitives/Select.tsx +1 -1
- package/src/primitives/Tabs.tsx +1 -1
- package/src/primitives/Tooltip.tsx +1 -1
- package/src/primitives/tooltip-layer.tsx +1 -1
- package/src/theme/ThemeProvider.tsx +7 -3
- package/src/theme/intl.ts +4 -2
- package/src/utils/polymorphic.ts +1 -1
- package/src/vite.ts +51 -0
- package/vendor/cmdk-solid/LICENSE +14 -0
- package/vendor/cmdk-solid/chunk/5WIGIOAJ.jsx +98 -0
- package/vendor/cmdk-solid/chunk/IOVUHIGA.js +96 -0
- package/vendor/cmdk-solid/command-score.cjs +98 -0
- package/vendor/cmdk-solid/command-score.d.cts +4 -0
- package/vendor/cmdk-solid/command-score.d.ts +4 -0
- package/vendor/cmdk-solid/command-score.js +2 -0
- package/vendor/cmdk-solid/command-score.jsx +7 -0
- package/vendor/cmdk-solid/index.cjs +827 -0
- package/vendor/cmdk-solid/index.d.cts +184 -0
- package/vendor/cmdk-solid/index.d.ts +184 -0
- package/vendor/cmdk-solid/index.js +729 -0
- package/vendor/cmdk-solid/index.jsx +666 -0
- package/vendor/integrity.json +450 -0
- package/vendor/kobalte-core/LICENSE.md +21 -0
- package/vendor/kobalte-core/NOTICE.txt +231 -0
- package/vendor/kobalte-core/accordion/index.d.ts +10 -0
- package/vendor/kobalte-core/accordion/index.js +2 -0
- package/vendor/kobalte-core/accordion/index.jsx +33 -0
- package/vendor/kobalte-core/alert/index.d.ts +5 -0
- package/vendor/kobalte-core/alert/index.js +2 -0
- package/vendor/kobalte-core/alert/index.jsx +11 -0
- package/vendor/kobalte-core/alert-dialog/index.d.ts +10 -0
- package/vendor/kobalte-core/alert-dialog/index.js +3 -0
- package/vendor/kobalte-core/alert-dialog/index.jsx +40 -0
- package/vendor/kobalte-core/badge/index.d.ts +23 -0
- package/vendor/kobalte-core/badge/index.js +24 -0
- package/vendor/kobalte-core/badge/index.jsx +24 -0
- package/vendor/kobalte-core/breadcrumbs/index.d.ts +5 -0
- package/vendor/kobalte-core/breadcrumbs/index.js +2 -0
- package/vendor/kobalte-core/breadcrumbs/index.jsx +19 -0
- package/vendor/kobalte-core/button/index.d.ts +6 -0
- package/vendor/kobalte-core/button/index.js +2 -0
- package/vendor/kobalte-core/button/index.jsx +12 -0
- package/vendor/kobalte-core/button-root-da654b3e.d.ts +28 -0
- package/vendor/kobalte-core/checkbox/index.d.ts +8 -0
- package/vendor/kobalte-core/checkbox/index.js +2 -0
- package/vendor/kobalte-core/checkbox/index.jsx +35 -0
- package/vendor/kobalte-core/chunk/272QBW42.js +712 -0
- package/vendor/kobalte-core/chunk/27MLNS66.js +353 -0
- package/vendor/kobalte-core/chunk/2RVGL3MU.js +45 -0
- package/vendor/kobalte-core/chunk/2UV3VFID.jsx +431 -0
- package/vendor/kobalte-core/chunk/2X5XWQIS.js +19 -0
- package/vendor/kobalte-core/chunk/2YCOH52P.js +81 -0
- package/vendor/kobalte-core/chunk/3565MS4H.jsx +127 -0
- package/vendor/kobalte-core/chunk/3ARTUDH2.jsx +1633 -0
- package/vendor/kobalte-core/chunk/3D6FM2PJ.js +1001 -0
- package/vendor/kobalte-core/chunk/3DLZMX4Z.jsx +81 -0
- package/vendor/kobalte-core/chunk/3DZKSKAQ.jsx +366 -0
- package/vendor/kobalte-core/chunk/3JA5IX2L.jsx +52 -0
- package/vendor/kobalte-core/chunk/3NGA46QE.js +116 -0
- package/vendor/kobalte-core/chunk/3QQCO6IA.js +46 -0
- package/vendor/kobalte-core/chunk/3T74IGH6.js +860 -0
- package/vendor/kobalte-core/chunk/3XNSRO2W.jsx +226 -0
- package/vendor/kobalte-core/chunk/43XIKO67.js +99 -0
- package/vendor/kobalte-core/chunk/4VWIKJ7Q.jsx +842 -0
- package/vendor/kobalte-core/chunk/53Y5XP3B.js +61 -0
- package/vendor/kobalte-core/chunk/5WXHJDCZ.jsx +10 -0
- package/vendor/kobalte-core/chunk/5ZKAE4VZ.js +8 -0
- package/vendor/kobalte-core/chunk/66KLKSW3.js +36 -0
- package/vendor/kobalte-core/chunk/6TDKM7BK.jsx +815 -0
- package/vendor/kobalte-core/chunk/6Y7B2NEO.js +21 -0
- package/vendor/kobalte-core/chunk/7ABWW5DT.jsx +483 -0
- package/vendor/kobalte-core/chunk/7CVNMTYF.js +171 -0
- package/vendor/kobalte-core/chunk/7DPKSDZL.js +447 -0
- package/vendor/kobalte-core/chunk/7I44E2QD.js +190 -0
- package/vendor/kobalte-core/chunk/7LCANGHD.js +29 -0
- package/vendor/kobalte-core/chunk/7OVKXYPU.js +90 -0
- package/vendor/kobalte-core/chunk/7TPOQ36Z.js +202 -0
- package/vendor/kobalte-core/chunk/7ZHN3PYD.js +30 -0
- package/vendor/kobalte-core/chunk/ANN3A2QM.js +29 -0
- package/vendor/kobalte-core/chunk/AT6SKIG6.js +119 -0
- package/vendor/kobalte-core/chunk/AWVDBFMO.jsx +280 -0
- package/vendor/kobalte-core/chunk/B2CSS4CB.js +36 -0
- package/vendor/kobalte-core/chunk/BDJEWKR2.jsx +153 -0
- package/vendor/kobalte-core/chunk/BK63AFY4.js +348 -0
- package/vendor/kobalte-core/chunk/BLN63FDC.js +40 -0
- package/vendor/kobalte-core/chunk/BU4OFZP5.jsx +146 -0
- package/vendor/kobalte-core/chunk/CLZZ2KZC.js +152 -0
- package/vendor/kobalte-core/chunk/CODJDE4S.jsx +131 -0
- package/vendor/kobalte-core/chunk/CWAEFUDR.js +732 -0
- package/vendor/kobalte-core/chunk/DBKNBLZP.js +395 -0
- package/vendor/kobalte-core/chunk/DTAYBJDT.jsx +339 -0
- package/vendor/kobalte-core/chunk/DX4MAOJL.js +653 -0
- package/vendor/kobalte-core/chunk/E4R2EMM4.js +10 -0
- package/vendor/kobalte-core/chunk/E53DB7BS.jsx +34 -0
- package/vendor/kobalte-core/chunk/EHGSTO6V.jsx +138 -0
- package/vendor/kobalte-core/chunk/EJ5I5XML.jsx +1 -0
- package/vendor/kobalte-core/chunk/ET5T45DO.js +17 -0
- package/vendor/kobalte-core/chunk/EYO4IMPK.jsx +867 -0
- package/vendor/kobalte-core/chunk/FINWO3A5.jsx +21 -0
- package/vendor/kobalte-core/chunk/FKUFPCQ6.jsx +120 -0
- package/vendor/kobalte-core/chunk/FLVHQV4A.jsx +22 -0
- package/vendor/kobalte-core/chunk/FN6EICGO.jsx +44 -0
- package/vendor/kobalte-core/chunk/FOXVCQFV.jsx +48 -0
- package/vendor/kobalte-core/chunk/G3KI2B4X.js +228 -0
- package/vendor/kobalte-core/chunk/G4JQYERT.jsx +1 -0
- package/vendor/kobalte-core/chunk/GAVSAJBM.jsx +86 -0
- package/vendor/kobalte-core/chunk/GIRHAWVP.jsx +46 -0
- package/vendor/kobalte-core/chunk/GROIIANN.jsx +32 -0
- package/vendor/kobalte-core/chunk/GSF7SFRW.jsx +98 -0
- package/vendor/kobalte-core/chunk/GXANOQ5B.jsx +66 -0
- package/vendor/kobalte-core/chunk/H7BK6JF7.jsx +489 -0
- package/vendor/kobalte-core/chunk/HGKTPMYY.js +1332 -0
- package/vendor/kobalte-core/chunk/HWIPVJ7H.js +121 -0
- package/vendor/kobalte-core/chunk/I2LBZHJH.js +144 -0
- package/vendor/kobalte-core/chunk/ICNSTULC.js +33 -0
- package/vendor/kobalte-core/chunk/IGYOA2ZZ.jsx +33 -0
- package/vendor/kobalte-core/chunk/IN725QRS.js +175 -0
- package/vendor/kobalte-core/chunk/INFLGCRV.js +123 -0
- package/vendor/kobalte-core/chunk/JEP7F7FN.js +89 -0
- package/vendor/kobalte-core/chunk/JGNXQB3J.js +140 -0
- package/vendor/kobalte-core/chunk/JHMNWOLY.jsx +87 -0
- package/vendor/kobalte-core/chunk/JNCCF6MP.jsx +12 -0
- package/vendor/kobalte-core/chunk/K6ON3K7Z.js +93 -0
- package/vendor/kobalte-core/chunk/K6P57S75.js +23 -0
- package/vendor/kobalte-core/chunk/KEL2LLJM.jsx +244 -0
- package/vendor/kobalte-core/chunk/KQVCPTCE.js +316 -0
- package/vendor/kobalte-core/chunk/KR2RRKPK.jsx +197 -0
- package/vendor/kobalte-core/chunk/KVL5CS3M.jsx +37 -0
- package/vendor/kobalte-core/chunk/LP6E37CW.jsx +228 -0
- package/vendor/kobalte-core/chunk/LUHKRAPV.js +129 -0
- package/vendor/kobalte-core/chunk/LV6CC6HJ.js +226 -0
- package/vendor/kobalte-core/chunk/MUDPLHYE.js +56 -0
- package/vendor/kobalte-core/chunk/NEFPNRTI.jsx +426 -0
- package/vendor/kobalte-core/chunk/NY67XGGP.js +216 -0
- package/vendor/kobalte-core/chunk/OGE3DKII.jsx +413 -0
- package/vendor/kobalte-core/chunk/OK5BA5VH.jsx +533 -0
- package/vendor/kobalte-core/chunk/OPHDMVQK.jsx +217 -0
- package/vendor/kobalte-core/chunk/OPRD3XHK.js +207 -0
- package/vendor/kobalte-core/chunk/OU7DYFTQ.jsx +191 -0
- package/vendor/kobalte-core/chunk/OYES4GOP.jsx +21 -0
- package/vendor/kobalte-core/chunk/P6IXTWXS.jsx +197 -0
- package/vendor/kobalte-core/chunk/PBBM7A6R.jsx +113 -0
- package/vendor/kobalte-core/chunk/PKWJSNR5.js +474 -0
- package/vendor/kobalte-core/chunk/PTVG6YKC.js +148 -0
- package/vendor/kobalte-core/chunk/PTWD4LYA.jsx +537 -0
- package/vendor/kobalte-core/chunk/PYSNB6I6.jsx +324 -0
- package/vendor/kobalte-core/chunk/Q2T3QQUA.js +419 -0
- package/vendor/kobalte-core/chunk/QEMPLYZX.js +28 -0
- package/vendor/kobalte-core/chunk/QIRIOMOH.js +338 -0
- package/vendor/kobalte-core/chunk/QJIB6BDF.jsx +30 -0
- package/vendor/kobalte-core/chunk/QJK6CGTE.js +293 -0
- package/vendor/kobalte-core/chunk/R4V3527Z.js +130 -0
- package/vendor/kobalte-core/chunk/R5JXRO27.js +1 -0
- package/vendor/kobalte-core/chunk/RFN6X5VH.jsx +1058 -0
- package/vendor/kobalte-core/chunk/SD3NY4DU.js +344 -0
- package/vendor/kobalte-core/chunk/SLRA6PIF.jsx +263 -0
- package/vendor/kobalte-core/chunk/SOM3K36D.jsx +191 -0
- package/vendor/kobalte-core/chunk/STGRFJHZ.js +43 -0
- package/vendor/kobalte-core/chunk/T4C3DMHT.jsx +52 -0
- package/vendor/kobalte-core/chunk/TDH5Z2ZB.js +263 -0
- package/vendor/kobalte-core/chunk/TP2BLHDF.jsx +284 -0
- package/vendor/kobalte-core/chunk/TS4C47MF.js +22 -0
- package/vendor/kobalte-core/chunk/TSB6MOZK.jsx +242 -0
- package/vendor/kobalte-core/chunk/TVVHJCOX.js +204 -0
- package/vendor/kobalte-core/chunk/TY22MKYR.jsx +996 -0
- package/vendor/kobalte-core/chunk/UEEZAKDC.js +1 -0
- package/vendor/kobalte-core/chunk/UESR3MKV.jsx +743 -0
- package/vendor/kobalte-core/chunk/UGE6PPGT.jsx +220 -0
- package/vendor/kobalte-core/chunk/UKTBL2JL.jsx +88 -0
- package/vendor/kobalte-core/chunk/V25KEN4T.jsx +399 -0
- package/vendor/kobalte-core/chunk/VI7QYH27.jsx +33 -0
- package/vendor/kobalte-core/chunk/W4MWOWKG.js +310 -0
- package/vendor/kobalte-core/chunk/WAUM5GOD.jsx +68 -0
- package/vendor/kobalte-core/chunk/WHII6HHI.js +145 -0
- package/vendor/kobalte-core/chunk/WKVBAVXH.jsx +378 -0
- package/vendor/kobalte-core/chunk/WR5BIFYV.js +780 -0
- package/vendor/kobalte-core/chunk/XLBXJFYN.js +108 -0
- package/vendor/kobalte-core/chunk/XNF3WGZ2.jsx +176 -0
- package/vendor/kobalte-core/chunk/XOC6SOOC.jsx +53 -0
- package/vendor/kobalte-core/chunk/XTJD7L6B.jsx +101 -0
- package/vendor/kobalte-core/chunk/XUUROM4M.jsx +120 -0
- package/vendor/kobalte-core/chunk/YA7DCYMB.js +80 -0
- package/vendor/kobalte-core/chunk/YFEENJN5.jsx +41 -0
- package/vendor/kobalte-core/chunk/YGDQXQ2B.js +28 -0
- package/vendor/kobalte-core/chunk/YKGT7A57.js +85 -0
- package/vendor/kobalte-core/chunk/YPUNLYJC.js +268 -0
- package/vendor/kobalte-core/chunk/YSW4UOAR.js +40 -0
- package/vendor/kobalte-core/chunk/ZAGMEN2K.jsx +152 -0
- package/vendor/kobalte-core/chunk/ZG3NR5OC.jsx +120 -0
- package/vendor/kobalte-core/chunk/ZZYKR3VO.jsx +42 -0
- package/vendor/kobalte-core/collapsible/index.d.ts +7 -0
- package/vendor/kobalte-core/collapsible/index.js +2 -0
- package/vendor/kobalte-core/collapsible/index.jsx +23 -0
- package/vendor/kobalte-core/collapsible-trigger-6358fcd4.d.ts +84 -0
- package/vendor/kobalte-core/color-area/index.d.ts +189 -0
- package/vendor/kobalte-core/color-area/index.js +724 -0
- package/vendor/kobalte-core/color-area/index.jsx +777 -0
- package/vendor/kobalte-core/color-channel-field/index.d.ts +49 -0
- package/vendor/kobalte-core/color-channel-field/index.js +72 -0
- package/vendor/kobalte-core/color-channel-field/index.jsx +117 -0
- package/vendor/kobalte-core/color-field/index.d.ts +48 -0
- package/vendor/kobalte-core/color-field/index.js +114 -0
- package/vendor/kobalte-core/color-field/index.jsx +155 -0
- package/vendor/kobalte-core/color-mode/index.d.ts +78 -0
- package/vendor/kobalte-core/color-mode/index.js +2 -0
- package/vendor/kobalte-core/color-mode/index.jsx +28 -0
- package/vendor/kobalte-core/color-slider/index.d.ts +109 -0
- package/vendor/kobalte-core/color-slider/index.js +183 -0
- package/vendor/kobalte-core/color-slider/index.jsx +255 -0
- package/vendor/kobalte-core/color-swatch/index.d.ts +39 -0
- package/vendor/kobalte-core/color-swatch/index.js +48 -0
- package/vendor/kobalte-core/color-swatch/index.jsx +64 -0
- package/vendor/kobalte-core/color-wheel/index.d.ts +166 -0
- package/vendor/kobalte-core/color-wheel/index.js +620 -0
- package/vendor/kobalte-core/color-wheel/index.jsx +640 -0
- package/vendor/kobalte-core/colors/index.d.ts +15 -0
- package/vendor/kobalte-core/colors/index.js +2 -0
- package/vendor/kobalte-core/colors/index.jsx +17 -0
- package/vendor/kobalte-core/combobox/index.d.ts +20 -0
- package/vendor/kobalte-core/combobox/index.js +8 -0
- package/vendor/kobalte-core/combobox/index.jsx +80 -0
- package/vendor/kobalte-core/combobox-root-3702d1f6.d.ts +382 -0
- package/vendor/kobalte-core/context-menu/index.d.ts +15 -0
- package/vendor/kobalte-core/context-menu/index.js +5 -0
- package/vendor/kobalte-core/context-menu/index.jsx +75 -0
- package/vendor/kobalte-core/create-list-state-d9a0f1f2.d.ts +232 -0
- package/vendor/kobalte-core/dialog/index.d.ts +10 -0
- package/vendor/kobalte-core/dialog/index.js +2 -0
- package/vendor/kobalte-core/dialog/index.jsx +40 -0
- package/vendor/kobalte-core/dialog-trigger-f415bd9b.d.ts +184 -0
- package/vendor/kobalte-core/dismissable-layer/index.d.ts +51 -0
- package/vendor/kobalte-core/dismissable-layer/index.js +2 -0
- package/vendor/kobalte-core/dismissable-layer/index.jsx +12 -0
- package/vendor/kobalte-core/dropdown-menu/index.d.ts +18 -0
- package/vendor/kobalte-core/dropdown-menu/index.js +5 -0
- package/vendor/kobalte-core/dropdown-menu/index.jsx +73 -0
- package/vendor/kobalte-core/file-field/index.d.ts +221 -0
- package/vendor/kobalte-core/file-field/index.js +539 -0
- package/vendor/kobalte-core/file-field/index.jsx +564 -0
- package/vendor/kobalte-core/form-control-description-330657bc.d.ts +49 -0
- package/vendor/kobalte-core/form-control-error-message-9efcbea8.d.ts +25 -0
- package/vendor/kobalte-core/form-control-label-2a5ca7a3.d.ts +22 -0
- package/vendor/kobalte-core/hover-card/index.d.ts +11 -0
- package/vendor/kobalte-core/hover-card/index.js +3 -0
- package/vendor/kobalte-core/hover-card/index.jsx +33 -0
- package/vendor/kobalte-core/i18n/index.d.ts +81 -0
- package/vendor/kobalte-core/i18n/index.js +2 -0
- package/vendor/kobalte-core/i18n/index.jsx +28 -0
- package/vendor/kobalte-core/image/index.d.ts +5 -0
- package/vendor/kobalte-core/image/index.js +2 -0
- package/vendor/kobalte-core/image/index.jsx +17 -0
- package/vendor/kobalte-core/index-19a0ff67.d.ts +180 -0
- package/vendor/kobalte-core/index-1a4410b1.d.ts +184 -0
- package/vendor/kobalte-core/index-29c57b8d.d.ts +90 -0
- package/vendor/kobalte-core/index-2a97f0d5.d.ts +259 -0
- package/vendor/kobalte-core/index-339032c6.d.ts +24 -0
- package/vendor/kobalte-core/index-3a4165aa.d.ts +38 -0
- package/vendor/kobalte-core/index-45d19411.d.ts +181 -0
- package/vendor/kobalte-core/index-47114d4c.d.ts +153 -0
- package/vendor/kobalte-core/index-4933558f.d.ts +22 -0
- package/vendor/kobalte-core/index-4cb1a0c7.d.ts +178 -0
- package/vendor/kobalte-core/index-544033ad.d.ts +148 -0
- package/vendor/kobalte-core/index-5eae1bf9.d.ts +145 -0
- package/vendor/kobalte-core/index-64ed0578.d.ts +47 -0
- package/vendor/kobalte-core/index-68c6e688.d.ts +125 -0
- package/vendor/kobalte-core/index-71913923.d.ts +107 -0
- package/vendor/kobalte-core/index-774e18fb.d.ts +155 -0
- package/vendor/kobalte-core/index-78f1e72b.d.ts +22 -0
- package/vendor/kobalte-core/index-79050fd4.d.ts +22 -0
- package/vendor/kobalte-core/index-82a3d7cf.d.ts +76 -0
- package/vendor/kobalte-core/index-839e646d.d.ts +308 -0
- package/vendor/kobalte-core/index-8b78f50e.d.ts +96 -0
- package/vendor/kobalte-core/index-8dfcce13.d.ts +49 -0
- package/vendor/kobalte-core/index-929e4c7c.d.ts +109 -0
- package/vendor/kobalte-core/index-a6cbe732.d.ts +267 -0
- package/vendor/kobalte-core/index-a8504bc6.d.ts +105 -0
- package/vendor/kobalte-core/index-d652f235.d.ts +234 -0
- package/vendor/kobalte-core/index-d734f7ac.d.ts +120 -0
- package/vendor/kobalte-core/index-e3628d61.d.ts +405 -0
- package/vendor/kobalte-core/index-e8f9edc7.d.ts +484 -0
- package/vendor/kobalte-core/index-e96454a3.d.ts +113 -0
- package/vendor/kobalte-core/index-ed2fe8c4.d.ts +176 -0
- package/vendor/kobalte-core/index-f3e15e6a.d.ts +107 -0
- package/vendor/kobalte-core/index.d.ts +333 -0
- package/vendor/kobalte-core/index.js +56 -0
- package/vendor/kobalte-core/index.jsx +322 -0
- package/vendor/kobalte-core/link/index.d.ts +6 -0
- package/vendor/kobalte-core/link/index.js +2 -0
- package/vendor/kobalte-core/link/index.jsx +12 -0
- package/vendor/kobalte-core/link-root-bf54d4f3.d.ts +26 -0
- package/vendor/kobalte-core/listbox/index.d.ts +10 -0
- package/vendor/kobalte-core/listbox/index.js +2 -0
- package/vendor/kobalte-core/listbox/index.jsx +30 -0
- package/vendor/kobalte-core/listbox-item-indicator-b8390ce9.d.ts +27 -0
- package/vendor/kobalte-core/listbox-section-58338bda.d.ts +172 -0
- package/vendor/kobalte-core/menu/index.d.ts +41 -0
- package/vendor/kobalte-core/menu/index.js +2 -0
- package/vendor/kobalte-core/menu/index.jsx +72 -0
- package/vendor/kobalte-core/menu-sub-trigger-29a7ad75.d.ts +462 -0
- package/vendor/kobalte-core/menubar/index.d.ts +19 -0
- package/vendor/kobalte-core/menubar/index.js +6 -0
- package/vendor/kobalte-core/menubar/index.jsx +79 -0
- package/vendor/kobalte-core/menubar-context-c1a81ca0.d.ts +73 -0
- package/vendor/kobalte-core/meter/index.d.ts +15 -0
- package/vendor/kobalte-core/meter/index.js +2 -0
- package/vendor/kobalte-core/meter/index.jsx +23 -0
- package/vendor/kobalte-core/meter-value-label-797727cd.d.ts +117 -0
- package/vendor/kobalte-core/navigation-menu/index.d.ts +191 -0
- package/vendor/kobalte-core/navigation-menu/index.js +432 -0
- package/vendor/kobalte-core/navigation-menu/index.jsx +571 -0
- package/vendor/kobalte-core/number-field/index.d.ts +11 -0
- package/vendor/kobalte-core/number-field/index.js +5 -0
- package/vendor/kobalte-core/number-field/index.jsx +42 -0
- package/vendor/kobalte-core/number-field-root-3524531f.d.ts +128 -0
- package/vendor/kobalte-core/pagination/index.d.ts +6 -0
- package/vendor/kobalte-core/pagination/index.js +2 -0
- package/vendor/kobalte-core/pagination/index.jsx +26 -0
- package/vendor/kobalte-core/polymorphic/index.d.ts +29 -0
- package/vendor/kobalte-core/polymorphic/index.js +2 -0
- package/vendor/kobalte-core/polymorphic/index.jsx +8 -0
- package/vendor/kobalte-core/popover/index.d.ts +11 -0
- package/vendor/kobalte-core/popover/index.js +3 -0
- package/vendor/kobalte-core/popover/index.jsx +45 -0
- package/vendor/kobalte-core/popper/index.d.ts +42 -0
- package/vendor/kobalte-core/popper/index.js +2 -0
- package/vendor/kobalte-core/popper/index.jsx +20 -0
- package/vendor/kobalte-core/popper-arrow-89a19127.d.ts +24 -0
- package/vendor/kobalte-core/popper-root-c2da235c.d.ts +81 -0
- package/vendor/kobalte-core/primitives/create-collection/index.d.ts +16 -0
- package/vendor/kobalte-core/primitives/create-collection/index.js +3 -0
- package/vendor/kobalte-core/primitives/create-collection/index.jsx +12 -0
- package/vendor/kobalte-core/primitives/create-controllable-signal/index.d.ts +33 -0
- package/vendor/kobalte-core/primitives/create-controllable-signal/index.js +2 -0
- package/vendor/kobalte-core/primitives/create-controllable-signal/index.jsx +15 -0
- package/vendor/kobalte-core/primitives/create-disclosure-state/index.d.ts +31 -0
- package/vendor/kobalte-core/primitives/create-disclosure-state/index.js +2 -0
- package/vendor/kobalte-core/primitives/create-disclosure-state/index.jsx +10 -0
- package/vendor/kobalte-core/primitives/create-dom-collection/index.d.ts +32 -0
- package/vendor/kobalte-core/primitives/create-dom-collection/index.js +2 -0
- package/vendor/kobalte-core/primitives/create-dom-collection/index.jsx +17 -0
- package/vendor/kobalte-core/primitives/create-escape-key-down/index.d.ts +18 -0
- package/vendor/kobalte-core/primitives/create-escape-key-down/index.js +2 -0
- package/vendor/kobalte-core/primitives/create-escape-key-down/index.jsx +8 -0
- package/vendor/kobalte-core/primitives/create-focus-scope/index.d.ts +21 -0
- package/vendor/kobalte-core/primitives/create-focus-scope/index.js +2 -0
- package/vendor/kobalte-core/primitives/create-focus-scope/index.jsx +9 -0
- package/vendor/kobalte-core/primitives/create-form-reset-listener/index.d.ts +9 -0
- package/vendor/kobalte-core/primitives/create-form-reset-listener/index.js +2 -0
- package/vendor/kobalte-core/primitives/create-form-reset-listener/index.jsx +8 -0
- package/vendor/kobalte-core/primitives/create-hide-outside/index.d.ts +29 -0
- package/vendor/kobalte-core/primitives/create-hide-outside/index.js +2 -0
- package/vendor/kobalte-core/primitives/create-hide-outside/index.jsx +12 -0
- package/vendor/kobalte-core/primitives/create-interact-outside/index.d.ts +39 -0
- package/vendor/kobalte-core/primitives/create-interact-outside/index.js +2 -0
- package/vendor/kobalte-core/primitives/create-interact-outside/index.jsx +9 -0
- package/vendor/kobalte-core/primitives/create-register-id/index.d.ts +9 -0
- package/vendor/kobalte-core/primitives/create-register-id/index.js +2 -0
- package/vendor/kobalte-core/primitives/create-register-id/index.jsx +8 -0
- package/vendor/kobalte-core/primitives/create-size/index.d.ts +9 -0
- package/vendor/kobalte-core/primitives/create-size/index.js +2 -0
- package/vendor/kobalte-core/primitives/create-size/index.jsx +8 -0
- package/vendor/kobalte-core/primitives/create-tag-name/index.d.ts +15 -0
- package/vendor/kobalte-core/primitives/create-tag-name/index.js +2 -0
- package/vendor/kobalte-core/primitives/create-tag-name/index.jsx +9 -0
- package/vendor/kobalte-core/primitives/create-toggle-state/index.d.ts +33 -0
- package/vendor/kobalte-core/primitives/create-toggle-state/index.js +2 -0
- package/vendor/kobalte-core/primitives/create-toggle-state/index.jsx +10 -0
- package/vendor/kobalte-core/primitives/create-transition/index.d.ts +52 -0
- package/vendor/kobalte-core/primitives/create-transition/index.js +2 -0
- package/vendor/kobalte-core/primitives/create-transition/index.jsx +8 -0
- package/vendor/kobalte-core/progress/index.d.ts +6 -0
- package/vendor/kobalte-core/progress/index.js +2 -0
- package/vendor/kobalte-core/progress/index.jsx +24 -0
- package/vendor/kobalte-core/radio-group/index.d.ts +8 -0
- package/vendor/kobalte-core/radio-group/index.js +4 -0
- package/vendor/kobalte-core/radio-group/index.jsx +40 -0
- package/vendor/kobalte-core/radio-group-root-0af7f9b9.d.ts +195 -0
- package/vendor/kobalte-core/rating/index.d.ts +172 -0
- package/vendor/kobalte-core/rating/index.js +464 -0
- package/vendor/kobalte-core/rating/index.jsx +540 -0
- package/vendor/kobalte-core/search/index.d.ts +85 -0
- package/vendor/kobalte-core/search/index.js +177 -0
- package/vendor/kobalte-core/search/index.jsx +227 -0
- package/vendor/kobalte-core/segmented-control/index.d.ts +69 -0
- package/vendor/kobalte-core/segmented-control/index.js +162 -0
- package/vendor/kobalte-core/segmented-control/index.jsx +217 -0
- package/vendor/kobalte-core/select/index.d.ts +19 -0
- package/vendor/kobalte-core/select/index.js +6 -0
- package/vendor/kobalte-core/select/index.jsx +75 -0
- package/vendor/kobalte-core/separator/index.d.ts +6 -0
- package/vendor/kobalte-core/separator/index.js +2 -0
- package/vendor/kobalte-core/separator/index.jsx +12 -0
- package/vendor/kobalte-core/separator-root-cb685406.d.ts +25 -0
- package/vendor/kobalte-core/skeleton/index.d.ts +5 -0
- package/vendor/kobalte-core/skeleton/index.js +2 -0
- package/vendor/kobalte-core/skeleton/index.jsx +11 -0
- package/vendor/kobalte-core/slider/index.d.ts +11 -0
- package/vendor/kobalte-core/slider/index.js +5 -0
- package/vendor/kobalte-core/slider/index.jsx +43 -0
- package/vendor/kobalte-core/slider-value-label-2be90f59.d.ts +211 -0
- package/vendor/kobalte-core/spin-button/index.d.ts +10 -0
- package/vendor/kobalte-core/spin-button/index.js +2 -0
- package/vendor/kobalte-core/spin-button/index.jsx +12 -0
- package/vendor/kobalte-core/spin-button-root-3a44420a.d.ts +63 -0
- package/vendor/kobalte-core/switch/index.d.ts +8 -0
- package/vendor/kobalte-core/switch/index.js +2 -0
- package/vendor/kobalte-core/switch/index.jsx +35 -0
- package/vendor/kobalte-core/tabs/index.d.ts +8 -0
- package/vendor/kobalte-core/tabs/index.js +2 -0
- package/vendor/kobalte-core/tabs/index.jsx +27 -0
- package/vendor/kobalte-core/text-field/index.d.ts +9 -0
- package/vendor/kobalte-core/text-field/index.js +5 -0
- package/vendor/kobalte-core/text-field/index.jsx +34 -0
- package/vendor/kobalte-core/text-field-root-0b8dfa5a.d.ts +73 -0
- package/vendor/kobalte-core/time-field/index.d.ts +165 -0
- package/vendor/kobalte-core/time-field/index.js +818 -0
- package/vendor/kobalte-core/time-field/index.jsx +824 -0
- package/vendor/kobalte-core/toast/index.d.ts +6 -0
- package/vendor/kobalte-core/toast/index.js +2 -0
- package/vendor/kobalte-core/toast/index.jsx +33 -0
- package/vendor/kobalte-core/toggle-button/index.d.ts +7 -0
- package/vendor/kobalte-core/toggle-button/index.js +2 -0
- package/vendor/kobalte-core/toggle-button/index.jsx +16 -0
- package/vendor/kobalte-core/toggle-button-root-1cfacf95.d.ts +42 -0
- package/vendor/kobalte-core/toggle-group/index.d.ts +10 -0
- package/vendor/kobalte-core/toggle-group/index.js +2 -0
- package/vendor/kobalte-core/toggle-group/index.jsx +26 -0
- package/vendor/kobalte-core/tooltip/index.d.ts +10 -0
- package/vendor/kobalte-core/tooltip/index.js +3 -0
- package/vendor/kobalte-core/tooltip/index.jsx +32 -0
- package/vendor/kobalte-core/types-6adf33e1.d.ts +8 -0
- package/vendor/kobalte-core/types-877adc4a.d.ts +125 -0
- package/vendor/kobalte-core/types-f8ae18e5.d.ts +72 -0
- package/vendor/kobalte-core/utils-45fb8d63.d.ts +11 -0
- package/vendor/kobalte-utils/LICENSE.md +21 -0
- package/vendor/kobalte-utils/NOTICE.txt +231 -0
- package/vendor/kobalte-utils/index.cjs +878 -0
- package/vendor/kobalte-utils/index.d.cts +227 -0
- package/vendor/kobalte-utils/index.d.ts +227 -0
- package/vendor/kobalte-utils/index.js +791 -0
- package/vendor/origins.json +33 -0
- package/vendor/solid-web/LICENSE +21 -0
- package/vendor/solid-web/dev.cjs +896 -0
- package/vendor/solid-web/dev.js +784 -0
- package/vendor/solid-web/server.cjs +2 -0
- package/vendor/solid-web/server.js +2 -0
- package/vendor/solid-web/types/client.d.ts +93 -0
- package/vendor/solid-web/types/core.d.ts +2 -0
- package/vendor/solid-web/types/index.d.ts +50 -0
- package/vendor/solid-web/types/jsx.d.ts +1 -0
- package/vendor/solid-web/types/server-mock.d.ts +65 -0
- package/vendor/solid-web/types/server.d.ts +187 -0
- package/vendor/solid-web/web.cjs +885 -0
- package/vendor/solid-web/web.js +773 -0
|
@@ -0,0 +1,1001 @@
|
|
|
1
|
+
// Vendored and modified by Gemologic Sheen from @kobalte/core@0.13.13; see package THIRD_PARTY_NOTICES.md.
|
|
2
|
+
import { createCollection } from './3NGA46QE.js';
|
|
3
|
+
import { useLocale } from './7TPOQ36Z.js';
|
|
4
|
+
import { createControllableSignal } from './BLN63FDC.js';
|
|
5
|
+
import { mergeDefaultProps, access, createEventListener, scrollIntoView, focusWithoutScrolling, callHandler, getFocusableTreeWalker, isAppleDevice, isMac } from "#sheen-kobalte-utils";
|
|
6
|
+
import { createSignal, createMemo, createEffect, mergeProps, onMount, on, createComputed } from 'solid-js';
|
|
7
|
+
|
|
8
|
+
// src/selection/types.ts
|
|
9
|
+
var Selection = class _Selection extends Set {
|
|
10
|
+
anchorKey;
|
|
11
|
+
currentKey;
|
|
12
|
+
constructor(keys, anchorKey, currentKey) {
|
|
13
|
+
super(keys);
|
|
14
|
+
if (keys instanceof _Selection) {
|
|
15
|
+
this.anchorKey = anchorKey || keys.anchorKey;
|
|
16
|
+
this.currentKey = currentKey || keys.currentKey;
|
|
17
|
+
} else {
|
|
18
|
+
this.anchorKey = anchorKey;
|
|
19
|
+
this.currentKey = currentKey;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// src/selection/create-controllable-selection-signal.ts
|
|
25
|
+
function createControllableSelectionSignal(props) {
|
|
26
|
+
const [_value, setValue] = createControllableSignal(props);
|
|
27
|
+
const value = () => _value() ?? new Selection();
|
|
28
|
+
return [value, setValue];
|
|
29
|
+
}
|
|
30
|
+
function isNonContiguousSelectionModifier(e) {
|
|
31
|
+
return isAppleDevice() ? e.altKey : e.ctrlKey;
|
|
32
|
+
}
|
|
33
|
+
function isCtrlKeyPressed(e) {
|
|
34
|
+
if (isMac()) {
|
|
35
|
+
return e.metaKey;
|
|
36
|
+
}
|
|
37
|
+
return e.ctrlKey;
|
|
38
|
+
}
|
|
39
|
+
function convertSelection(selection) {
|
|
40
|
+
return new Selection(selection);
|
|
41
|
+
}
|
|
42
|
+
function isSameSelection(setA, setB) {
|
|
43
|
+
if (setA.size !== setB.size) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
for (const item of setA) {
|
|
47
|
+
if (!setB.has(item)) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/selection/create-multiple-selection-state.ts
|
|
55
|
+
function createMultipleSelectionState(props) {
|
|
56
|
+
const mergedProps = mergeDefaultProps(
|
|
57
|
+
{
|
|
58
|
+
selectionMode: "none",
|
|
59
|
+
selectionBehavior: "toggle"
|
|
60
|
+
},
|
|
61
|
+
props
|
|
62
|
+
);
|
|
63
|
+
const [isFocused, setFocused] = createSignal(false);
|
|
64
|
+
const [focusedKey, setFocusedKey] = createSignal();
|
|
65
|
+
const selectedKeysProp = createMemo(() => {
|
|
66
|
+
const selection = access(mergedProps.selectedKeys);
|
|
67
|
+
if (selection != null) {
|
|
68
|
+
return convertSelection(selection);
|
|
69
|
+
}
|
|
70
|
+
return selection;
|
|
71
|
+
});
|
|
72
|
+
const defaultSelectedKeys = createMemo(() => {
|
|
73
|
+
const defaultSelection = access(mergedProps.defaultSelectedKeys);
|
|
74
|
+
if (defaultSelection != null) {
|
|
75
|
+
return convertSelection(defaultSelection);
|
|
76
|
+
}
|
|
77
|
+
return new Selection();
|
|
78
|
+
});
|
|
79
|
+
const [selectedKeys, _setSelectedKeys] = createControllableSelectionSignal({
|
|
80
|
+
value: selectedKeysProp,
|
|
81
|
+
defaultValue: defaultSelectedKeys,
|
|
82
|
+
onChange: (value) => mergedProps.onSelectionChange?.(value)
|
|
83
|
+
});
|
|
84
|
+
const [selectionBehavior, setSelectionBehavior] = createSignal(access(mergedProps.selectionBehavior));
|
|
85
|
+
const selectionMode = () => access(mergedProps.selectionMode);
|
|
86
|
+
const disallowEmptySelection = () => access(mergedProps.disallowEmptySelection) ?? false;
|
|
87
|
+
const setSelectedKeys = (keys) => {
|
|
88
|
+
if (access(mergedProps.allowDuplicateSelectionEvents) || !isSameSelection(keys, selectedKeys())) {
|
|
89
|
+
_setSelectedKeys(keys);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
createEffect(() => {
|
|
93
|
+
const selection = selectedKeys();
|
|
94
|
+
if (access(mergedProps.selectionBehavior) === "replace" && selectionBehavior() === "toggle" && typeof selection === "object" && selection.size === 0) {
|
|
95
|
+
setSelectionBehavior("replace");
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
createEffect(() => {
|
|
99
|
+
setSelectionBehavior(access(mergedProps.selectionBehavior) ?? "toggle");
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
selectionMode,
|
|
103
|
+
disallowEmptySelection,
|
|
104
|
+
selectionBehavior,
|
|
105
|
+
setSelectionBehavior,
|
|
106
|
+
isFocused,
|
|
107
|
+
setFocused,
|
|
108
|
+
focusedKey,
|
|
109
|
+
setFocusedKey,
|
|
110
|
+
selectedKeys,
|
|
111
|
+
setSelectedKeys
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function createTypeSelect(props) {
|
|
115
|
+
const [search, setSearch] = createSignal("");
|
|
116
|
+
const [timeoutId, setTimeoutId] = createSignal(-1);
|
|
117
|
+
const onKeyDown = (e) => {
|
|
118
|
+
if (access(props.isDisabled)) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const delegate = access(props.keyboardDelegate);
|
|
122
|
+
const manager = access(props.selectionManager);
|
|
123
|
+
if (!delegate.getKeyForSearch) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const character = getStringForKey(e.key);
|
|
127
|
+
if (!character || e.ctrlKey || e.metaKey) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (character === " " && search().trim().length > 0) {
|
|
131
|
+
e.preventDefault();
|
|
132
|
+
e.stopPropagation();
|
|
133
|
+
}
|
|
134
|
+
let newSearch = setSearch((prev) => prev + character);
|
|
135
|
+
let key = delegate.getKeyForSearch(newSearch, manager.focusedKey()) ?? delegate.getKeyForSearch(newSearch);
|
|
136
|
+
if (key == null && isAllSameLetter(newSearch)) {
|
|
137
|
+
newSearch = newSearch[0];
|
|
138
|
+
key = delegate.getKeyForSearch(newSearch, manager.focusedKey()) ?? delegate.getKeyForSearch(newSearch);
|
|
139
|
+
}
|
|
140
|
+
if (key != null) {
|
|
141
|
+
manager.setFocusedKey(key);
|
|
142
|
+
props.onTypeSelect?.(key);
|
|
143
|
+
}
|
|
144
|
+
clearTimeout(timeoutId());
|
|
145
|
+
setTimeoutId(window.setTimeout(() => setSearch(""), 500));
|
|
146
|
+
};
|
|
147
|
+
return {
|
|
148
|
+
typeSelectHandlers: {
|
|
149
|
+
onKeyDown
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function getStringForKey(key) {
|
|
154
|
+
if (key.length === 1 || !/^[A-Z]/i.test(key)) {
|
|
155
|
+
return key;
|
|
156
|
+
}
|
|
157
|
+
return "";
|
|
158
|
+
}
|
|
159
|
+
function isAllSameLetter(search) {
|
|
160
|
+
return search.split("").every((letter) => letter === search[0]);
|
|
161
|
+
}
|
|
162
|
+
function createSelectableCollection(props, ref, scrollRef) {
|
|
163
|
+
const defaultProps = {
|
|
164
|
+
selectOnFocus: () => access(props.selectionManager).selectionBehavior() === "replace"
|
|
165
|
+
};
|
|
166
|
+
const mergedProps = mergeProps(defaultProps, props);
|
|
167
|
+
const finalScrollRef = () => scrollRef?.() ?? ref();
|
|
168
|
+
const { direction } = useLocale();
|
|
169
|
+
let scrollPos = { top: 0, left: 0 };
|
|
170
|
+
createEventListener(
|
|
171
|
+
() => !access(mergedProps.isVirtualized) ? finalScrollRef() : void 0,
|
|
172
|
+
"scroll",
|
|
173
|
+
() => {
|
|
174
|
+
const scrollEl = finalScrollRef();
|
|
175
|
+
if (!scrollEl) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
scrollPos = {
|
|
179
|
+
top: scrollEl.scrollTop,
|
|
180
|
+
left: scrollEl.scrollLeft
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
const { typeSelectHandlers } = createTypeSelect({
|
|
185
|
+
isDisabled: () => access(mergedProps.disallowTypeAhead),
|
|
186
|
+
keyboardDelegate: () => access(mergedProps.keyboardDelegate),
|
|
187
|
+
selectionManager: () => access(mergedProps.selectionManager)
|
|
188
|
+
});
|
|
189
|
+
const orientation = () => access(mergedProps.orientation) ?? "vertical";
|
|
190
|
+
const onKeyDown = (e) => {
|
|
191
|
+
callHandler(e, typeSelectHandlers.onKeyDown);
|
|
192
|
+
if (e.altKey && e.key === "Tab") {
|
|
193
|
+
e.preventDefault();
|
|
194
|
+
}
|
|
195
|
+
const refEl = ref();
|
|
196
|
+
if (!refEl?.contains(e.target)) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const manager = access(mergedProps.selectionManager);
|
|
200
|
+
const selectOnFocus = access(mergedProps.selectOnFocus);
|
|
201
|
+
const navigateToKey = (key) => {
|
|
202
|
+
if (key != null) {
|
|
203
|
+
manager.setFocusedKey(key);
|
|
204
|
+
if (e.shiftKey && manager.selectionMode() === "multiple") {
|
|
205
|
+
manager.extendSelection(key);
|
|
206
|
+
} else if (selectOnFocus && !isNonContiguousSelectionModifier(e)) {
|
|
207
|
+
manager.replaceSelection(key);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const delegate = access(mergedProps.keyboardDelegate);
|
|
212
|
+
const shouldFocusWrap = access(mergedProps.shouldFocusWrap);
|
|
213
|
+
const focusedKey = manager.focusedKey();
|
|
214
|
+
switch (e.key) {
|
|
215
|
+
case (orientation() === "vertical" ? "ArrowDown" : "ArrowRight"): {
|
|
216
|
+
if (delegate.getKeyBelow) {
|
|
217
|
+
e.preventDefault();
|
|
218
|
+
let nextKey;
|
|
219
|
+
if (focusedKey != null) {
|
|
220
|
+
nextKey = delegate.getKeyBelow(focusedKey);
|
|
221
|
+
} else {
|
|
222
|
+
nextKey = delegate.getFirstKey?.();
|
|
223
|
+
}
|
|
224
|
+
if (nextKey == null && shouldFocusWrap) {
|
|
225
|
+
nextKey = delegate.getFirstKey?.(focusedKey);
|
|
226
|
+
}
|
|
227
|
+
navigateToKey(nextKey);
|
|
228
|
+
}
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
case (orientation() === "vertical" ? "ArrowUp" : "ArrowLeft"): {
|
|
232
|
+
if (delegate.getKeyAbove) {
|
|
233
|
+
e.preventDefault();
|
|
234
|
+
let nextKey;
|
|
235
|
+
if (focusedKey != null) {
|
|
236
|
+
nextKey = delegate.getKeyAbove(focusedKey);
|
|
237
|
+
} else {
|
|
238
|
+
nextKey = delegate.getLastKey?.();
|
|
239
|
+
}
|
|
240
|
+
if (nextKey == null && shouldFocusWrap) {
|
|
241
|
+
nextKey = delegate.getLastKey?.(focusedKey);
|
|
242
|
+
}
|
|
243
|
+
navigateToKey(nextKey);
|
|
244
|
+
}
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
case (orientation() === "vertical" ? "ArrowLeft" : "ArrowUp"): {
|
|
248
|
+
if (delegate.getKeyLeftOf) {
|
|
249
|
+
e.preventDefault();
|
|
250
|
+
const isRTL = direction() === "rtl";
|
|
251
|
+
let nextKey;
|
|
252
|
+
if (focusedKey != null) {
|
|
253
|
+
nextKey = delegate.getKeyLeftOf(focusedKey);
|
|
254
|
+
} else {
|
|
255
|
+
nextKey = isRTL ? delegate.getFirstKey?.() : delegate.getLastKey?.();
|
|
256
|
+
}
|
|
257
|
+
navigateToKey(nextKey);
|
|
258
|
+
}
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
case (orientation() === "vertical" ? "ArrowRight" : "ArrowDown"): {
|
|
262
|
+
if (delegate.getKeyRightOf) {
|
|
263
|
+
e.preventDefault();
|
|
264
|
+
const isRTL = direction() === "rtl";
|
|
265
|
+
let nextKey;
|
|
266
|
+
if (focusedKey != null) {
|
|
267
|
+
nextKey = delegate.getKeyRightOf(focusedKey);
|
|
268
|
+
} else {
|
|
269
|
+
nextKey = isRTL ? delegate.getLastKey?.() : delegate.getFirstKey?.();
|
|
270
|
+
}
|
|
271
|
+
navigateToKey(nextKey);
|
|
272
|
+
}
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
case "Home":
|
|
276
|
+
if (delegate.getFirstKey) {
|
|
277
|
+
e.preventDefault();
|
|
278
|
+
const firstKey = delegate.getFirstKey(
|
|
279
|
+
focusedKey,
|
|
280
|
+
isCtrlKeyPressed(e)
|
|
281
|
+
);
|
|
282
|
+
if (firstKey != null) {
|
|
283
|
+
manager.setFocusedKey(firstKey);
|
|
284
|
+
if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode() === "multiple") {
|
|
285
|
+
manager.extendSelection(firstKey);
|
|
286
|
+
} else if (selectOnFocus) {
|
|
287
|
+
manager.replaceSelection(firstKey);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
break;
|
|
292
|
+
case "End":
|
|
293
|
+
if (delegate.getLastKey) {
|
|
294
|
+
e.preventDefault();
|
|
295
|
+
const lastKey = delegate.getLastKey(focusedKey, isCtrlKeyPressed(e));
|
|
296
|
+
if (lastKey != null) {
|
|
297
|
+
manager.setFocusedKey(lastKey);
|
|
298
|
+
if (isCtrlKeyPressed(e) && e.shiftKey && manager.selectionMode() === "multiple") {
|
|
299
|
+
manager.extendSelection(lastKey);
|
|
300
|
+
} else if (selectOnFocus) {
|
|
301
|
+
manager.replaceSelection(lastKey);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
break;
|
|
306
|
+
case "PageDown":
|
|
307
|
+
if (delegate.getKeyPageBelow && focusedKey != null) {
|
|
308
|
+
e.preventDefault();
|
|
309
|
+
const nextKey = delegate.getKeyPageBelow(focusedKey);
|
|
310
|
+
navigateToKey(nextKey);
|
|
311
|
+
}
|
|
312
|
+
break;
|
|
313
|
+
case "PageUp":
|
|
314
|
+
if (delegate.getKeyPageAbove && focusedKey != null) {
|
|
315
|
+
e.preventDefault();
|
|
316
|
+
const nextKey = delegate.getKeyPageAbove(focusedKey);
|
|
317
|
+
navigateToKey(nextKey);
|
|
318
|
+
}
|
|
319
|
+
break;
|
|
320
|
+
case "a":
|
|
321
|
+
if (isCtrlKeyPressed(e) && manager.selectionMode() === "multiple" && access(mergedProps.disallowSelectAll) !== true) {
|
|
322
|
+
e.preventDefault();
|
|
323
|
+
manager.selectAll();
|
|
324
|
+
}
|
|
325
|
+
break;
|
|
326
|
+
case "Escape":
|
|
327
|
+
if (!e.defaultPrevented && !access(mergedProps.disallowEmptySelection)) {
|
|
328
|
+
e.preventDefault();
|
|
329
|
+
manager.clearSelection();
|
|
330
|
+
}
|
|
331
|
+
break;
|
|
332
|
+
case "Tab": {
|
|
333
|
+
if (!access(mergedProps.allowsTabNavigation)) {
|
|
334
|
+
if (e.shiftKey) {
|
|
335
|
+
refEl.focus();
|
|
336
|
+
} else {
|
|
337
|
+
const walker = getFocusableTreeWalker(refEl, { tabbable: true });
|
|
338
|
+
let next;
|
|
339
|
+
let last;
|
|
340
|
+
do {
|
|
341
|
+
last = walker.lastChild();
|
|
342
|
+
if (last) {
|
|
343
|
+
next = last;
|
|
344
|
+
}
|
|
345
|
+
} while (last);
|
|
346
|
+
if (next && !next.contains(document.activeElement)) {
|
|
347
|
+
focusWithoutScrolling(next);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
const onFocusIn = (e) => {
|
|
356
|
+
const manager = access(mergedProps.selectionManager);
|
|
357
|
+
const delegate = access(mergedProps.keyboardDelegate);
|
|
358
|
+
const selectOnFocus = access(mergedProps.selectOnFocus);
|
|
359
|
+
if (manager.isFocused()) {
|
|
360
|
+
if (!e.currentTarget.contains(e.target)) {
|
|
361
|
+
manager.setFocused(false);
|
|
362
|
+
}
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
if (!e.currentTarget.contains(e.target)) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
manager.setFocused(true);
|
|
369
|
+
if (manager.focusedKey() == null) {
|
|
370
|
+
const navigateToFirstKey = (key) => {
|
|
371
|
+
if (key == null) {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
manager.setFocusedKey(key);
|
|
375
|
+
if (selectOnFocus) {
|
|
376
|
+
manager.replaceSelection(key);
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
const relatedTarget = e.relatedTarget;
|
|
380
|
+
if (relatedTarget && e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING) {
|
|
381
|
+
navigateToFirstKey(
|
|
382
|
+
manager.lastSelectedKey() ?? delegate.getLastKey?.()
|
|
383
|
+
);
|
|
384
|
+
} else {
|
|
385
|
+
navigateToFirstKey(
|
|
386
|
+
manager.firstSelectedKey() ?? delegate.getFirstKey?.()
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
} else if (!access(mergedProps.isVirtualized)) {
|
|
390
|
+
const scrollEl = finalScrollRef();
|
|
391
|
+
if (scrollEl) {
|
|
392
|
+
scrollEl.scrollTop = scrollPos.top;
|
|
393
|
+
scrollEl.scrollLeft = scrollPos.left;
|
|
394
|
+
const element = scrollEl.querySelector(
|
|
395
|
+
`[data-key="${manager.focusedKey()}"]`
|
|
396
|
+
);
|
|
397
|
+
if (element) {
|
|
398
|
+
focusWithoutScrolling(element);
|
|
399
|
+
scrollIntoView(scrollEl, element);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
const onFocusOut = (e) => {
|
|
405
|
+
const manager = access(mergedProps.selectionManager);
|
|
406
|
+
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
407
|
+
manager.setFocused(false);
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
const onMouseDown = (e) => {
|
|
411
|
+
if (finalScrollRef() === e.target) {
|
|
412
|
+
e.preventDefault();
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
const tryAutoFocus = () => {
|
|
416
|
+
const autoFocus = access(mergedProps.autoFocus);
|
|
417
|
+
if (!autoFocus) {
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
const manager = access(mergedProps.selectionManager);
|
|
421
|
+
const container = ref();
|
|
422
|
+
if (manager.isFocused() && manager.focusedKey() != null && container?.contains(container.ownerDocument.activeElement)) return;
|
|
423
|
+
const delegate = access(mergedProps.keyboardDelegate);
|
|
424
|
+
let focusedKey;
|
|
425
|
+
if (autoFocus === "first") {
|
|
426
|
+
focusedKey = delegate.getFirstKey?.();
|
|
427
|
+
}
|
|
428
|
+
if (autoFocus === "last") {
|
|
429
|
+
focusedKey = delegate.getLastKey?.();
|
|
430
|
+
}
|
|
431
|
+
const selectedKeys = manager.selectedKeys();
|
|
432
|
+
if (selectedKeys.size) {
|
|
433
|
+
focusedKey = selectedKeys.values().next().value;
|
|
434
|
+
}
|
|
435
|
+
manager.setFocused(true);
|
|
436
|
+
manager.setFocusedKey(focusedKey);
|
|
437
|
+
const refEl = ref();
|
|
438
|
+
if (refEl && focusedKey == null && !access(mergedProps.shouldUseVirtualFocus)) {
|
|
439
|
+
focusWithoutScrolling(refEl);
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
onMount(() => {
|
|
443
|
+
if (mergedProps.deferAutoFocus) {
|
|
444
|
+
setTimeout(tryAutoFocus, 0);
|
|
445
|
+
} else {
|
|
446
|
+
tryAutoFocus();
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
createEffect(
|
|
450
|
+
on(
|
|
451
|
+
[
|
|
452
|
+
finalScrollRef,
|
|
453
|
+
() => access(mergedProps.isVirtualized),
|
|
454
|
+
() => access(mergedProps.selectionManager).focusedKey()
|
|
455
|
+
],
|
|
456
|
+
(newValue) => {
|
|
457
|
+
const [scrollEl, isVirtualized, focusedKey] = newValue;
|
|
458
|
+
if (isVirtualized) {
|
|
459
|
+
focusedKey && mergedProps.scrollToKey?.(focusedKey);
|
|
460
|
+
} else {
|
|
461
|
+
if (focusedKey && scrollEl) {
|
|
462
|
+
const element = scrollEl.querySelector(
|
|
463
|
+
`[data-key="${focusedKey}"]`
|
|
464
|
+
);
|
|
465
|
+
if (element) {
|
|
466
|
+
scrollIntoView(scrollEl, element);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
)
|
|
472
|
+
);
|
|
473
|
+
const tabIndex = createMemo(() => {
|
|
474
|
+
if (access(mergedProps.shouldUseVirtualFocus)) {
|
|
475
|
+
return void 0;
|
|
476
|
+
}
|
|
477
|
+
return access(mergedProps.selectionManager).focusedKey() == null ? 0 : -1;
|
|
478
|
+
});
|
|
479
|
+
return {
|
|
480
|
+
tabIndex,
|
|
481
|
+
onKeyDown,
|
|
482
|
+
onMouseDown,
|
|
483
|
+
onFocusIn,
|
|
484
|
+
onFocusOut
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
function createSelectableItem(props, ref) {
|
|
488
|
+
const manager = () => access(props.selectionManager);
|
|
489
|
+
const key = () => access(props.key);
|
|
490
|
+
const shouldUseVirtualFocus = () => access(props.shouldUseVirtualFocus);
|
|
491
|
+
const onSelect = (e) => {
|
|
492
|
+
if (manager().selectionMode() === "none") {
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
if (manager().selectionMode() === "single") {
|
|
496
|
+
if (manager().isSelected(key()) && !manager().disallowEmptySelection()) {
|
|
497
|
+
manager().toggleSelection(key());
|
|
498
|
+
} else {
|
|
499
|
+
manager().replaceSelection(key());
|
|
500
|
+
}
|
|
501
|
+
} else if (e?.shiftKey) {
|
|
502
|
+
manager().extendSelection(key());
|
|
503
|
+
} else if (manager().selectionBehavior() === "toggle" || isCtrlKeyPressed(e) || "pointerType" in e && e.pointerType === "touch") {
|
|
504
|
+
manager().toggleSelection(key());
|
|
505
|
+
} else {
|
|
506
|
+
manager().replaceSelection(key());
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
const isSelected = () => manager().isSelected(key());
|
|
510
|
+
const isDisabled = () => access(props.disabled) || manager().isDisabled(key());
|
|
511
|
+
const allowsSelection = () => !isDisabled() && manager().canSelectItem(key());
|
|
512
|
+
let pointerDownType = null;
|
|
513
|
+
const onPointerDown = (e) => {
|
|
514
|
+
if (!allowsSelection()) {
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
pointerDownType = e.pointerType;
|
|
518
|
+
if (e.pointerType === "mouse" && e.button === 0 && !access(props.shouldSelectOnPressUp)) {
|
|
519
|
+
onSelect(e);
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
const onPointerUp = (e) => {
|
|
523
|
+
if (!allowsSelection()) {
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
if (e.pointerType === "mouse" && e.button === 0 && access(props.shouldSelectOnPressUp) && access(props.allowsDifferentPressOrigin)) {
|
|
527
|
+
onSelect(e);
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
const onClick = (e) => {
|
|
531
|
+
if (!allowsSelection()) {
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
if (access(props.shouldSelectOnPressUp) && !access(props.allowsDifferentPressOrigin) || pointerDownType !== "mouse") {
|
|
535
|
+
onSelect(e);
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
const onKeyDown = (e) => {
|
|
539
|
+
if (!allowsSelection() || !["Enter", " "].includes(e.key)) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
if (isNonContiguousSelectionModifier(e)) {
|
|
543
|
+
manager().toggleSelection(key());
|
|
544
|
+
} else {
|
|
545
|
+
onSelect(e);
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
const onMouseDown = (e) => {
|
|
549
|
+
if (isDisabled()) {
|
|
550
|
+
e.preventDefault();
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
const onFocus = (e) => {
|
|
554
|
+
const refEl = ref();
|
|
555
|
+
if (shouldUseVirtualFocus() || isDisabled() || !refEl) {
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
if (e.target === refEl) {
|
|
559
|
+
manager().setFocusedKey(key());
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
const tabIndex = createMemo(() => {
|
|
563
|
+
if (shouldUseVirtualFocus() || isDisabled()) {
|
|
564
|
+
return void 0;
|
|
565
|
+
}
|
|
566
|
+
return key() === manager().focusedKey() ? 0 : -1;
|
|
567
|
+
});
|
|
568
|
+
const dataKey = createMemo(() => {
|
|
569
|
+
return access(props.virtualized) ? void 0 : key();
|
|
570
|
+
});
|
|
571
|
+
createEffect(
|
|
572
|
+
on(
|
|
573
|
+
[
|
|
574
|
+
ref,
|
|
575
|
+
key,
|
|
576
|
+
shouldUseVirtualFocus,
|
|
577
|
+
() => manager().focusedKey(),
|
|
578
|
+
() => manager().isFocused()
|
|
579
|
+
],
|
|
580
|
+
([refEl, key2, shouldUseVirtualFocus2, focusedKey, isFocused]) => {
|
|
581
|
+
if (refEl && key2 === focusedKey && isFocused && !shouldUseVirtualFocus2 && document.activeElement !== refEl) {
|
|
582
|
+
if (props.focus) {
|
|
583
|
+
props.focus();
|
|
584
|
+
} else {
|
|
585
|
+
focusWithoutScrolling(refEl);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
)
|
|
590
|
+
);
|
|
591
|
+
return {
|
|
592
|
+
isSelected,
|
|
593
|
+
isDisabled,
|
|
594
|
+
allowsSelection,
|
|
595
|
+
tabIndex,
|
|
596
|
+
dataKey,
|
|
597
|
+
onPointerDown,
|
|
598
|
+
onPointerUp,
|
|
599
|
+
onClick,
|
|
600
|
+
onKeyDown,
|
|
601
|
+
onMouseDown,
|
|
602
|
+
onFocus
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
// src/selection/selection-manager.ts
|
|
607
|
+
var SelectionManager = class {
|
|
608
|
+
collection;
|
|
609
|
+
state;
|
|
610
|
+
constructor(collection, state) {
|
|
611
|
+
this.collection = collection;
|
|
612
|
+
this.state = state;
|
|
613
|
+
}
|
|
614
|
+
/** The type of selection that is allowed in the collection. */
|
|
615
|
+
selectionMode() {
|
|
616
|
+
return this.state.selectionMode();
|
|
617
|
+
}
|
|
618
|
+
/** Whether the collection allows empty selection. */
|
|
619
|
+
disallowEmptySelection() {
|
|
620
|
+
return this.state.disallowEmptySelection();
|
|
621
|
+
}
|
|
622
|
+
/** The selection behavior for the collection. */
|
|
623
|
+
selectionBehavior() {
|
|
624
|
+
return this.state.selectionBehavior();
|
|
625
|
+
}
|
|
626
|
+
/** Sets the selection behavior for the collection. */
|
|
627
|
+
setSelectionBehavior(selectionBehavior) {
|
|
628
|
+
this.state.setSelectionBehavior(selectionBehavior);
|
|
629
|
+
}
|
|
630
|
+
/** Whether the collection is currently focused. */
|
|
631
|
+
isFocused() {
|
|
632
|
+
return this.state.isFocused();
|
|
633
|
+
}
|
|
634
|
+
/** Sets whether the collection is focused. */
|
|
635
|
+
setFocused(isFocused) {
|
|
636
|
+
this.state.setFocused(isFocused);
|
|
637
|
+
}
|
|
638
|
+
/** The current focused key in the collection. */
|
|
639
|
+
focusedKey() {
|
|
640
|
+
return this.state.focusedKey();
|
|
641
|
+
}
|
|
642
|
+
/** Sets the focused key. */
|
|
643
|
+
setFocusedKey(key) {
|
|
644
|
+
if (key == null || this.collection().getItem(key)) {
|
|
645
|
+
this.state.setFocusedKey(key);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
/** The currently selected keys in the collection. */
|
|
649
|
+
selectedKeys() {
|
|
650
|
+
return this.state.selectedKeys();
|
|
651
|
+
}
|
|
652
|
+
/** Returns whether a key is selected. */
|
|
653
|
+
isSelected(key) {
|
|
654
|
+
if (this.state.selectionMode() === "none") {
|
|
655
|
+
return false;
|
|
656
|
+
}
|
|
657
|
+
const retrievedKey = this.getKey(key);
|
|
658
|
+
if (retrievedKey == null) {
|
|
659
|
+
return false;
|
|
660
|
+
}
|
|
661
|
+
return this.state.selectedKeys().has(retrievedKey);
|
|
662
|
+
}
|
|
663
|
+
/** Whether the selection is empty. */
|
|
664
|
+
isEmpty() {
|
|
665
|
+
return this.state.selectedKeys().size === 0;
|
|
666
|
+
}
|
|
667
|
+
/** Whether all items in the collection are selected. */
|
|
668
|
+
isSelectAll() {
|
|
669
|
+
if (this.isEmpty()) {
|
|
670
|
+
return false;
|
|
671
|
+
}
|
|
672
|
+
const selectedKeys = this.state.selectedKeys();
|
|
673
|
+
return this.getAllSelectableKeys().every((k) => selectedKeys.has(k));
|
|
674
|
+
}
|
|
675
|
+
firstSelectedKey() {
|
|
676
|
+
let first;
|
|
677
|
+
for (const key of this.state.selectedKeys()) {
|
|
678
|
+
const item = this.collection().getItem(key);
|
|
679
|
+
const isItemBeforeFirst = item?.index != null && first?.index != null && item.index < first.index;
|
|
680
|
+
if (!first || isItemBeforeFirst) {
|
|
681
|
+
first = item;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
return first?.key;
|
|
685
|
+
}
|
|
686
|
+
lastSelectedKey() {
|
|
687
|
+
let last;
|
|
688
|
+
for (const key of this.state.selectedKeys()) {
|
|
689
|
+
const item = this.collection().getItem(key);
|
|
690
|
+
const isItemAfterLast = item?.index != null && last?.index != null && item.index > last.index;
|
|
691
|
+
if (!last || isItemAfterLast) {
|
|
692
|
+
last = item;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
return last?.key;
|
|
696
|
+
}
|
|
697
|
+
/** Extends the selection to the given key. */
|
|
698
|
+
extendSelection(toKey) {
|
|
699
|
+
if (this.selectionMode() === "none") {
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
if (this.selectionMode() === "single") {
|
|
703
|
+
this.replaceSelection(toKey);
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
const retrievedToKey = this.getKey(toKey);
|
|
707
|
+
if (retrievedToKey == null) {
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
const selectedKeys = this.state.selectedKeys();
|
|
711
|
+
const anchorKey = selectedKeys.anchorKey || retrievedToKey;
|
|
712
|
+
const selection = new Selection(selectedKeys, anchorKey, retrievedToKey);
|
|
713
|
+
for (const key of this.getKeyRange(
|
|
714
|
+
anchorKey,
|
|
715
|
+
selectedKeys.currentKey || retrievedToKey
|
|
716
|
+
)) {
|
|
717
|
+
selection.delete(key);
|
|
718
|
+
}
|
|
719
|
+
for (const key of this.getKeyRange(retrievedToKey, anchorKey)) {
|
|
720
|
+
if (this.canSelectItem(key)) {
|
|
721
|
+
selection.add(key);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
this.state.setSelectedKeys(selection);
|
|
725
|
+
}
|
|
726
|
+
getKeyRange(from, to) {
|
|
727
|
+
const fromItem = this.collection().getItem(from);
|
|
728
|
+
const toItem = this.collection().getItem(to);
|
|
729
|
+
if (fromItem && toItem) {
|
|
730
|
+
if (fromItem.index != null && toItem.index != null && fromItem.index <= toItem.index) {
|
|
731
|
+
return this.getKeyRangeInternal(from, to);
|
|
732
|
+
}
|
|
733
|
+
return this.getKeyRangeInternal(to, from);
|
|
734
|
+
}
|
|
735
|
+
return [];
|
|
736
|
+
}
|
|
737
|
+
getKeyRangeInternal(from, to) {
|
|
738
|
+
const keys = [];
|
|
739
|
+
let key = from;
|
|
740
|
+
while (key != null) {
|
|
741
|
+
const item = this.collection().getItem(key);
|
|
742
|
+
if (item && item.type === "item") {
|
|
743
|
+
keys.push(key);
|
|
744
|
+
}
|
|
745
|
+
if (key === to) {
|
|
746
|
+
return keys;
|
|
747
|
+
}
|
|
748
|
+
key = this.collection().getKeyAfter(key);
|
|
749
|
+
}
|
|
750
|
+
return [];
|
|
751
|
+
}
|
|
752
|
+
getKey(key) {
|
|
753
|
+
const item = this.collection().getItem(key);
|
|
754
|
+
if (!item) {
|
|
755
|
+
return key;
|
|
756
|
+
}
|
|
757
|
+
if (!item || item.type !== "item") {
|
|
758
|
+
return null;
|
|
759
|
+
}
|
|
760
|
+
return item.key;
|
|
761
|
+
}
|
|
762
|
+
/** Toggles whether the given key is selected. */
|
|
763
|
+
toggleSelection(key) {
|
|
764
|
+
if (this.selectionMode() === "none") {
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
if (this.selectionMode() === "single" && !this.isSelected(key)) {
|
|
768
|
+
this.replaceSelection(key);
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
const retrievedKey = this.getKey(key);
|
|
772
|
+
if (retrievedKey == null) {
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
const keys = new Selection(this.state.selectedKeys());
|
|
776
|
+
if (keys.has(retrievedKey)) {
|
|
777
|
+
keys.delete(retrievedKey);
|
|
778
|
+
} else if (this.canSelectItem(retrievedKey)) {
|
|
779
|
+
keys.add(retrievedKey);
|
|
780
|
+
keys.anchorKey = retrievedKey;
|
|
781
|
+
keys.currentKey = retrievedKey;
|
|
782
|
+
}
|
|
783
|
+
if (this.disallowEmptySelection() && keys.size === 0) {
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
this.state.setSelectedKeys(keys);
|
|
787
|
+
}
|
|
788
|
+
/** Replaces the selection with only the given key. */
|
|
789
|
+
replaceSelection(key) {
|
|
790
|
+
if (this.selectionMode() === "none") {
|
|
791
|
+
return;
|
|
792
|
+
}
|
|
793
|
+
const retrievedKey = this.getKey(key);
|
|
794
|
+
if (retrievedKey == null) {
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
const selection = this.canSelectItem(retrievedKey) ? new Selection([retrievedKey], retrievedKey, retrievedKey) : new Selection();
|
|
798
|
+
this.state.setSelectedKeys(selection);
|
|
799
|
+
}
|
|
800
|
+
/** Replaces the selection with the given keys. */
|
|
801
|
+
setSelectedKeys(keys) {
|
|
802
|
+
if (this.selectionMode() === "none") {
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
const selection = new Selection();
|
|
806
|
+
for (const key of keys) {
|
|
807
|
+
const retrievedKey = this.getKey(key);
|
|
808
|
+
if (retrievedKey != null) {
|
|
809
|
+
selection.add(retrievedKey);
|
|
810
|
+
if (this.selectionMode() === "single") {
|
|
811
|
+
break;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
this.state.setSelectedKeys(selection);
|
|
816
|
+
}
|
|
817
|
+
/** Selects all items in the collection. */
|
|
818
|
+
selectAll() {
|
|
819
|
+
if (this.selectionMode() === "multiple") {
|
|
820
|
+
this.state.setSelectedKeys(new Set(this.getAllSelectableKeys()));
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* Removes all keys from the selection.
|
|
825
|
+
*/
|
|
826
|
+
clearSelection() {
|
|
827
|
+
const selectedKeys = this.state.selectedKeys();
|
|
828
|
+
if (!this.disallowEmptySelection() && selectedKeys.size > 0) {
|
|
829
|
+
this.state.setSelectedKeys(new Selection());
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* Toggles between select all and an empty selection.
|
|
834
|
+
*/
|
|
835
|
+
toggleSelectAll() {
|
|
836
|
+
if (this.isSelectAll()) {
|
|
837
|
+
this.clearSelection();
|
|
838
|
+
} else {
|
|
839
|
+
this.selectAll();
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
select(key, e) {
|
|
843
|
+
if (this.selectionMode() === "none") {
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
if (this.selectionMode() === "single") {
|
|
847
|
+
if (this.isSelected(key) && !this.disallowEmptySelection()) {
|
|
848
|
+
this.toggleSelection(key);
|
|
849
|
+
} else {
|
|
850
|
+
this.replaceSelection(key);
|
|
851
|
+
}
|
|
852
|
+
} else if (this.selectionBehavior() === "toggle" || e && e.pointerType === "touch") {
|
|
853
|
+
this.toggleSelection(key);
|
|
854
|
+
} else {
|
|
855
|
+
this.replaceSelection(key);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
/** Returns whether the current selection is equal to the given selection. */
|
|
859
|
+
isSelectionEqual(selection) {
|
|
860
|
+
if (selection === this.state.selectedKeys()) {
|
|
861
|
+
return true;
|
|
862
|
+
}
|
|
863
|
+
const selectedKeys = this.selectedKeys();
|
|
864
|
+
if (selection.size !== selectedKeys.size) {
|
|
865
|
+
return false;
|
|
866
|
+
}
|
|
867
|
+
for (const key of selection) {
|
|
868
|
+
if (!selectedKeys.has(key)) {
|
|
869
|
+
return false;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
for (const key of selectedKeys) {
|
|
873
|
+
if (!selection.has(key)) {
|
|
874
|
+
return false;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
return true;
|
|
878
|
+
}
|
|
879
|
+
canSelectItem(key) {
|
|
880
|
+
if (this.state.selectionMode() === "none") {
|
|
881
|
+
return false;
|
|
882
|
+
}
|
|
883
|
+
const item = this.collection().getItem(key);
|
|
884
|
+
return item != null && !item.disabled;
|
|
885
|
+
}
|
|
886
|
+
isDisabled(key) {
|
|
887
|
+
const item = this.collection().getItem(key);
|
|
888
|
+
return !item || item.disabled;
|
|
889
|
+
}
|
|
890
|
+
getAllSelectableKeys() {
|
|
891
|
+
const keys = [];
|
|
892
|
+
const addKeys = (key) => {
|
|
893
|
+
while (key != null) {
|
|
894
|
+
if (this.canSelectItem(key)) {
|
|
895
|
+
const item = this.collection().getItem(key);
|
|
896
|
+
if (!item) {
|
|
897
|
+
continue;
|
|
898
|
+
}
|
|
899
|
+
if (item.type === "item") {
|
|
900
|
+
keys.push(key);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
key = this.collection().getKeyAfter(key);
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
addKeys(this.collection().getFirstKey());
|
|
907
|
+
return keys;
|
|
908
|
+
}
|
|
909
|
+
};
|
|
910
|
+
|
|
911
|
+
// src/list/list-collection.ts
|
|
912
|
+
var ListCollection = class {
|
|
913
|
+
keyMap = /* @__PURE__ */ new Map();
|
|
914
|
+
iterable;
|
|
915
|
+
firstKey;
|
|
916
|
+
lastKey;
|
|
917
|
+
constructor(nodes) {
|
|
918
|
+
this.iterable = nodes;
|
|
919
|
+
for (const node of nodes) {
|
|
920
|
+
this.keyMap.set(node.key, node);
|
|
921
|
+
}
|
|
922
|
+
if (this.keyMap.size === 0) {
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
925
|
+
let last;
|
|
926
|
+
let index = 0;
|
|
927
|
+
for (const [key, node] of this.keyMap) {
|
|
928
|
+
if (last) {
|
|
929
|
+
last.nextKey = key;
|
|
930
|
+
node.prevKey = last.key;
|
|
931
|
+
} else {
|
|
932
|
+
this.firstKey = key;
|
|
933
|
+
node.prevKey = void 0;
|
|
934
|
+
}
|
|
935
|
+
if (node.type === "item") {
|
|
936
|
+
node.index = index++;
|
|
937
|
+
}
|
|
938
|
+
last = node;
|
|
939
|
+
last.nextKey = void 0;
|
|
940
|
+
}
|
|
941
|
+
this.lastKey = last.key;
|
|
942
|
+
}
|
|
943
|
+
*[Symbol.iterator]() {
|
|
944
|
+
yield* this.iterable;
|
|
945
|
+
}
|
|
946
|
+
getSize() {
|
|
947
|
+
return this.keyMap.size;
|
|
948
|
+
}
|
|
949
|
+
getKeys() {
|
|
950
|
+
return this.keyMap.keys();
|
|
951
|
+
}
|
|
952
|
+
getKeyBefore(key) {
|
|
953
|
+
return this.keyMap.get(key)?.prevKey;
|
|
954
|
+
}
|
|
955
|
+
getKeyAfter(key) {
|
|
956
|
+
return this.keyMap.get(key)?.nextKey;
|
|
957
|
+
}
|
|
958
|
+
getFirstKey() {
|
|
959
|
+
return this.firstKey;
|
|
960
|
+
}
|
|
961
|
+
getLastKey() {
|
|
962
|
+
return this.lastKey;
|
|
963
|
+
}
|
|
964
|
+
getItem(key) {
|
|
965
|
+
return this.keyMap.get(key);
|
|
966
|
+
}
|
|
967
|
+
at(idx) {
|
|
968
|
+
const keys = [...this.getKeys()];
|
|
969
|
+
return this.getItem(keys[idx]);
|
|
970
|
+
}
|
|
971
|
+
};
|
|
972
|
+
function createListState(props) {
|
|
973
|
+
const selectionState = createMultipleSelectionState(props);
|
|
974
|
+
const factory = (nodes) => {
|
|
975
|
+
return props.filter ? new ListCollection(props.filter(nodes)) : new ListCollection(nodes);
|
|
976
|
+
};
|
|
977
|
+
const collection = createCollection(
|
|
978
|
+
{
|
|
979
|
+
dataSource: () => access(props.dataSource),
|
|
980
|
+
getKey: () => access(props.getKey),
|
|
981
|
+
getTextValue: () => access(props.getTextValue),
|
|
982
|
+
getDisabled: () => access(props.getDisabled),
|
|
983
|
+
getSectionChildren: () => access(props.getSectionChildren),
|
|
984
|
+
factory
|
|
985
|
+
},
|
|
986
|
+
[() => props.filter]
|
|
987
|
+
);
|
|
988
|
+
const selectionManager = new SelectionManager(collection, selectionState);
|
|
989
|
+
createComputed(() => {
|
|
990
|
+
const focusedKey = selectionState.focusedKey();
|
|
991
|
+
if (focusedKey != null && !collection().getItem(focusedKey)) {
|
|
992
|
+
selectionState.setFocusedKey(void 0);
|
|
993
|
+
}
|
|
994
|
+
});
|
|
995
|
+
return {
|
|
996
|
+
collection,
|
|
997
|
+
selectionManager: () => selectionManager
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
export { ListCollection, Selection, SelectionManager, createListState, createMultipleSelectionState, createSelectableCollection, createSelectableItem, createTypeSelect, isSameSelection };
|