@gemologic/sheen 0.1.0-rc.0 → 0.1.0-rc.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/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,743 @@
|
|
|
1
|
+
// Vendored and modified by Gemologic Sheen from @kobalte/core@0.13.13; see package THIRD_PARTY_NOTICES.md.
|
|
2
|
+
import {
|
|
3
|
+
createNumberFormatter
|
|
4
|
+
} from "./LP6E37CW.jsx";
|
|
5
|
+
|
|
6
|
+
// src/colors/intl.ts
|
|
7
|
+
var COLOR_INTL_TRANSLATIONS = {
|
|
8
|
+
hue: "Hue",
|
|
9
|
+
saturation: "Saturation",
|
|
10
|
+
lightness: "Lightness",
|
|
11
|
+
brightness: "Brightness",
|
|
12
|
+
red: "Red",
|
|
13
|
+
green: "Green",
|
|
14
|
+
blue: "Blue",
|
|
15
|
+
alpha: "Alpha",
|
|
16
|
+
colorName: (lightness, chroma, hue) => `${lightness} ${chroma} ${hue}`,
|
|
17
|
+
transparentColorName: (lightness, chroma, hue, percentTransparent) => `${lightness} ${chroma} ${hue}, ${percentTransparent} transparent`,
|
|
18
|
+
"very dark": "very dark",
|
|
19
|
+
dark: "dark",
|
|
20
|
+
light: "light",
|
|
21
|
+
"very light": "very light",
|
|
22
|
+
pale: "pale",
|
|
23
|
+
grayish: "grayish",
|
|
24
|
+
vibrant: "vibrant",
|
|
25
|
+
black: "black",
|
|
26
|
+
white: "white",
|
|
27
|
+
gray: "gray",
|
|
28
|
+
pink: "pink",
|
|
29
|
+
"pink red": "pink red",
|
|
30
|
+
"red orange": "red orange",
|
|
31
|
+
brown: "brown",
|
|
32
|
+
orange: "orange",
|
|
33
|
+
"orange yellow": "orange yellow",
|
|
34
|
+
"brown yellow": "brown yellow",
|
|
35
|
+
yellow: "yellow",
|
|
36
|
+
"yellow green": "yellow green",
|
|
37
|
+
"green cyan": "green cyan",
|
|
38
|
+
cyan: "cyan",
|
|
39
|
+
"cyan blue": "cyan blue",
|
|
40
|
+
"blue purple": "blue purple",
|
|
41
|
+
purple: "purple",
|
|
42
|
+
"purple magenta": "purple magenta",
|
|
43
|
+
magenta: "magenta",
|
|
44
|
+
"magenta pink": "magenta pink"
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// src/colors/utils.ts
|
|
48
|
+
import { clamp } from "#sheen-kobalte-utils";
|
|
49
|
+
function parseColor(value) {
|
|
50
|
+
const res = RGBColor.parse(value) || HSBColor.parse(value) || HSLColor.parse(value);
|
|
51
|
+
if (res) {
|
|
52
|
+
return res;
|
|
53
|
+
}
|
|
54
|
+
throw new Error(`Invalid color value: ${value}`);
|
|
55
|
+
}
|
|
56
|
+
function normalizeColor(v) {
|
|
57
|
+
if (typeof v === "string") {
|
|
58
|
+
return parseColor(v);
|
|
59
|
+
}
|
|
60
|
+
return v;
|
|
61
|
+
}
|
|
62
|
+
function getColorChannels(colorSpace) {
|
|
63
|
+
switch (colorSpace) {
|
|
64
|
+
case "rgb":
|
|
65
|
+
return RGBColor.colorChannels;
|
|
66
|
+
case "hsl":
|
|
67
|
+
return HSLColor.colorChannels;
|
|
68
|
+
case "hsb":
|
|
69
|
+
return HSBColor.colorChannels;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function normalizeHue(hue) {
|
|
73
|
+
if (hue === 360) {
|
|
74
|
+
return hue;
|
|
75
|
+
}
|
|
76
|
+
return (hue % 360 + 360) % 360;
|
|
77
|
+
}
|
|
78
|
+
var ORANGE_LIGHTNESS_THRESHOLD = 0.68;
|
|
79
|
+
var YELLOW_GREEN_LIGHTNESS_THRESHOLD = 0.85;
|
|
80
|
+
var MAX_DARK_LIGHTNESS = 0.55;
|
|
81
|
+
var GRAY_THRESHOLD = 1e-3;
|
|
82
|
+
var OKLCH_HUES = [
|
|
83
|
+
[0, "pink"],
|
|
84
|
+
[15, "red"],
|
|
85
|
+
[48, "orange"],
|
|
86
|
+
[94, "yellow"],
|
|
87
|
+
[135, "green"],
|
|
88
|
+
[175, "cyan"],
|
|
89
|
+
[264, "blue"],
|
|
90
|
+
[284, "purple"],
|
|
91
|
+
[320, "magenta"],
|
|
92
|
+
[349, "pink"]
|
|
93
|
+
];
|
|
94
|
+
var Color = class {
|
|
95
|
+
toHexInt() {
|
|
96
|
+
return this.toFormat("rgb").toHexInt();
|
|
97
|
+
}
|
|
98
|
+
getChannelValue(channel) {
|
|
99
|
+
if (channel in this) {
|
|
100
|
+
return this[channel];
|
|
101
|
+
}
|
|
102
|
+
throw new Error(`Unsupported color channel: ${channel}`);
|
|
103
|
+
}
|
|
104
|
+
withChannelValue(channel, value) {
|
|
105
|
+
if (channel in this) {
|
|
106
|
+
const x = this.clone();
|
|
107
|
+
x[channel] = value;
|
|
108
|
+
return x;
|
|
109
|
+
}
|
|
110
|
+
throw new Error(`Unsupported color channel: ${channel}`);
|
|
111
|
+
}
|
|
112
|
+
getChannelName(channel, translations) {
|
|
113
|
+
return translations[channel];
|
|
114
|
+
}
|
|
115
|
+
getColorSpaceAxes(xyChannels) {
|
|
116
|
+
const { xChannel, yChannel } = xyChannels;
|
|
117
|
+
const xCh = xChannel || this.getColorChannels().find((c) => c !== yChannel);
|
|
118
|
+
const yCh = yChannel || this.getColorChannels().find((c) => c !== xCh);
|
|
119
|
+
const zCh = this.getColorChannels().find((c) => c !== xCh && c !== yCh);
|
|
120
|
+
return { xChannel: xCh, yChannel: yCh, zChannel: zCh };
|
|
121
|
+
}
|
|
122
|
+
getColorName(translations) {
|
|
123
|
+
let [l, c, h] = toOKLCH(this);
|
|
124
|
+
if (l > 0.999) {
|
|
125
|
+
return translations.white;
|
|
126
|
+
}
|
|
127
|
+
if (l < 1e-3) {
|
|
128
|
+
return translations.black;
|
|
129
|
+
}
|
|
130
|
+
let hue;
|
|
131
|
+
[hue, l] = this.getOklchHue(l, c, h, translations);
|
|
132
|
+
let lightness = "";
|
|
133
|
+
let chroma = "";
|
|
134
|
+
if (c <= 0.1 && c >= GRAY_THRESHOLD) {
|
|
135
|
+
if (l >= 0.7) {
|
|
136
|
+
chroma = "pale";
|
|
137
|
+
} else {
|
|
138
|
+
chroma = "grayish";
|
|
139
|
+
}
|
|
140
|
+
} else if (c >= 0.15) {
|
|
141
|
+
chroma = "vibrant";
|
|
142
|
+
}
|
|
143
|
+
if (l < 0.3) {
|
|
144
|
+
lightness = "very dark";
|
|
145
|
+
} else if (l < MAX_DARK_LIGHTNESS) {
|
|
146
|
+
lightness = "dark";
|
|
147
|
+
} else if (l < 0.7) {
|
|
148
|
+
} else if (l < 0.85) {
|
|
149
|
+
lightness = "light";
|
|
150
|
+
} else {
|
|
151
|
+
lightness = "very light";
|
|
152
|
+
}
|
|
153
|
+
if (chroma) {
|
|
154
|
+
chroma = translations[chroma];
|
|
155
|
+
}
|
|
156
|
+
if (lightness) {
|
|
157
|
+
lightness = translations[lightness];
|
|
158
|
+
}
|
|
159
|
+
const alpha = this.getChannelValue("alpha");
|
|
160
|
+
if (alpha < 1) {
|
|
161
|
+
const percentTransparent = createNumberFormatter(() => ({
|
|
162
|
+
style: "percent"
|
|
163
|
+
}))().format(1 - alpha);
|
|
164
|
+
return translations.transparentColorName(lightness, chroma, hue, percentTransparent).replace(/\s+/g, " ").trim();
|
|
165
|
+
}
|
|
166
|
+
return translations.colorName(lightness, chroma, hue).replace(/\s+/g, " ").trim();
|
|
167
|
+
}
|
|
168
|
+
getOklchHue(l, c, h, translations) {
|
|
169
|
+
if (c < GRAY_THRESHOLD) {
|
|
170
|
+
return [translations.gray, l];
|
|
171
|
+
}
|
|
172
|
+
for (let i = 0; i < OKLCH_HUES.length; i++) {
|
|
173
|
+
let [hue, hueName] = OKLCH_HUES[i];
|
|
174
|
+
const [nextHue, nextHueName] = OKLCH_HUES[i + 1] || [360, "pink"];
|
|
175
|
+
if (h >= hue && h < nextHue) {
|
|
176
|
+
if (hueName === "orange") {
|
|
177
|
+
if (l < ORANGE_LIGHTNESS_THRESHOLD) {
|
|
178
|
+
hueName = "brown";
|
|
179
|
+
} else {
|
|
180
|
+
l = l - ORANGE_LIGHTNESS_THRESHOLD + MAX_DARK_LIGHTNESS;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (h > hue + (nextHue - hue) / 2 && hueName !== nextHueName) {
|
|
184
|
+
hueName = `${hueName} ${nextHueName}`;
|
|
185
|
+
} else if (hueName === "yellow" && l < YELLOW_GREEN_LIGHTNESS_THRESHOLD) {
|
|
186
|
+
hueName = "yellow green";
|
|
187
|
+
}
|
|
188
|
+
const name = translations[hueName];
|
|
189
|
+
return [name, l];
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
throw new Error("Unexpected hue");
|
|
193
|
+
}
|
|
194
|
+
getHueName(translations) {
|
|
195
|
+
const [l, c, h] = toOKLCH(this);
|
|
196
|
+
const [name] = this.getOklchHue(l, c, h, translations);
|
|
197
|
+
return name;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
var RGBColor = class _RGBColor extends Color {
|
|
201
|
+
constructor(red, green, blue, alpha) {
|
|
202
|
+
super();
|
|
203
|
+
this.red = red;
|
|
204
|
+
this.green = green;
|
|
205
|
+
this.blue = blue;
|
|
206
|
+
this.alpha = alpha;
|
|
207
|
+
}
|
|
208
|
+
static parse(value) {
|
|
209
|
+
let colors = [];
|
|
210
|
+
if (/^#[\da-f]+$/i.test(value) && [4, 5, 7, 9].includes(value.length)) {
|
|
211
|
+
const values = (value.length < 6 ? value.replace(/[^#]/gi, "$&$&") : value).slice(1).split("");
|
|
212
|
+
while (values.length > 0) {
|
|
213
|
+
colors.push(Number.parseInt(values.splice(0, 2).join(""), 16));
|
|
214
|
+
}
|
|
215
|
+
colors[3] = colors[3] !== void 0 ? colors[3] / 255 : void 0;
|
|
216
|
+
}
|
|
217
|
+
const match = value.match(/^rgba?\((.*)\)$/);
|
|
218
|
+
if (match?.[1]) {
|
|
219
|
+
colors = match[1].replace(
|
|
220
|
+
/(\d+)%$/u,
|
|
221
|
+
(_substring, numberValue) => (Number(numberValue) / 100).toString()
|
|
222
|
+
).replaceAll(/,|\//gu, " ").replaceAll(/\s{2,}/gu, " ").split(" ").map((value2) => {
|
|
223
|
+
return Number(value2.trim());
|
|
224
|
+
});
|
|
225
|
+
colors = colors.map((num, i) => {
|
|
226
|
+
return clamp(num ?? 0, 0, i < 3 ? 255 : 1);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
if (colors[0] === void 0 || colors[1] === void 0 || colors[2] === void 0) {
|
|
230
|
+
return void 0;
|
|
231
|
+
}
|
|
232
|
+
return colors.length < 3 ? void 0 : new _RGBColor(colors[0], colors[1], colors[2], colors[3] ?? 1);
|
|
233
|
+
}
|
|
234
|
+
toString(format = "css") {
|
|
235
|
+
switch (format) {
|
|
236
|
+
case "hex":
|
|
237
|
+
return `#${(this.red.toString(16).padStart(2, "0") + this.green.toString(16).padStart(2, "0") + this.blue.toString(16).padStart(2, "0")).toUpperCase()}`;
|
|
238
|
+
case "hexa":
|
|
239
|
+
return `#${(this.red.toString(16).padStart(2, "0") + this.green.toString(16).padStart(2, "0") + this.blue.toString(16).padStart(2, "0") + Math.round(this.alpha * 255).toString(16).padStart(2, "0")).toUpperCase()}`;
|
|
240
|
+
case "css":
|
|
241
|
+
case "rgb":
|
|
242
|
+
return `rgb(${this.red}, ${this.green}, ${this.blue}${this.alpha !== 1 && this.alpha !== 100 ? ` / ${this?.alpha}` : ""})`;
|
|
243
|
+
case "rgba":
|
|
244
|
+
return `rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;
|
|
245
|
+
default:
|
|
246
|
+
return this.toFormat(format).toString(format);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
toFormat(format) {
|
|
250
|
+
switch (format) {
|
|
251
|
+
case "hex":
|
|
252
|
+
case "hexa":
|
|
253
|
+
case "rgb":
|
|
254
|
+
case "rgba":
|
|
255
|
+
return this;
|
|
256
|
+
case "hsb":
|
|
257
|
+
case "hsba":
|
|
258
|
+
return this.toHSB();
|
|
259
|
+
case "hsl":
|
|
260
|
+
case "hsla":
|
|
261
|
+
return this.toHSL();
|
|
262
|
+
default:
|
|
263
|
+
throw new Error(`Unsupported color conversion: rgb -> ${format}`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
toHexInt() {
|
|
267
|
+
return this.red << 16 | this.green << 8 | this.blue;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Converts an RGB color value to HSB.
|
|
271
|
+
* Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
|
|
272
|
+
* @returns An HSBColor object.
|
|
273
|
+
*/
|
|
274
|
+
toHSB() {
|
|
275
|
+
const red = this.red / 255;
|
|
276
|
+
const green = this.green / 255;
|
|
277
|
+
const blue = this.blue / 255;
|
|
278
|
+
const min = Math.min(red, green, blue);
|
|
279
|
+
const brightness = Math.max(red, green, blue);
|
|
280
|
+
const chroma = brightness - min;
|
|
281
|
+
const saturation = brightness === 0 ? 0 : chroma / brightness;
|
|
282
|
+
let hue = 0;
|
|
283
|
+
if (chroma !== 0) {
|
|
284
|
+
switch (brightness) {
|
|
285
|
+
case red:
|
|
286
|
+
hue = (green - blue) / chroma + (green < blue ? 6 : 0);
|
|
287
|
+
break;
|
|
288
|
+
case green:
|
|
289
|
+
hue = (blue - red) / chroma + 2;
|
|
290
|
+
break;
|
|
291
|
+
case blue:
|
|
292
|
+
hue = (red - green) / chroma + 4;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
hue /= 6;
|
|
296
|
+
}
|
|
297
|
+
return new HSBColor(
|
|
298
|
+
toFixedNumber(hue * 360, 2),
|
|
299
|
+
toFixedNumber(saturation * 100, 2),
|
|
300
|
+
toFixedNumber(brightness * 100, 2),
|
|
301
|
+
this.alpha
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Converts an RGB color value to HSL.
|
|
306
|
+
* Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#From_RGB.
|
|
307
|
+
* @returns An HSLColor object.
|
|
308
|
+
*/
|
|
309
|
+
toHSL() {
|
|
310
|
+
const red = this.red / 255;
|
|
311
|
+
const green = this.green / 255;
|
|
312
|
+
const blue = this.blue / 255;
|
|
313
|
+
const min = Math.min(red, green, blue);
|
|
314
|
+
const max = Math.max(red, green, blue);
|
|
315
|
+
const lightness = (max + min) / 2;
|
|
316
|
+
const chroma = max - min;
|
|
317
|
+
let hue;
|
|
318
|
+
let saturation;
|
|
319
|
+
if (chroma === 0) {
|
|
320
|
+
hue = saturation = 0;
|
|
321
|
+
} else {
|
|
322
|
+
saturation = chroma / (lightness < 0.5 ? max + min : 2 - max - min);
|
|
323
|
+
switch (max) {
|
|
324
|
+
case red:
|
|
325
|
+
hue = (green - blue) / chroma + (green < blue ? 6 : 0);
|
|
326
|
+
break;
|
|
327
|
+
case green:
|
|
328
|
+
hue = (blue - red) / chroma + 2;
|
|
329
|
+
break;
|
|
330
|
+
default:
|
|
331
|
+
hue = (red - green) / chroma + 4;
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
hue /= 6;
|
|
335
|
+
}
|
|
336
|
+
return new HSLColor(
|
|
337
|
+
toFixedNumber(hue * 360, 2),
|
|
338
|
+
toFixedNumber(saturation * 100, 2),
|
|
339
|
+
toFixedNumber(lightness * 100, 2),
|
|
340
|
+
this.alpha
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
clone() {
|
|
344
|
+
return new _RGBColor(this.red, this.green, this.blue, this.alpha);
|
|
345
|
+
}
|
|
346
|
+
getChannelRange(channel) {
|
|
347
|
+
switch (channel) {
|
|
348
|
+
case "red":
|
|
349
|
+
case "green":
|
|
350
|
+
case "blue":
|
|
351
|
+
return { minValue: 0, maxValue: 255, step: 1, pageSize: 17 };
|
|
352
|
+
case "alpha":
|
|
353
|
+
return { minValue: 0, maxValue: 1, step: 0.01, pageSize: 0.1 };
|
|
354
|
+
default:
|
|
355
|
+
throw new Error(`Unknown color channel: ${channel}`);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
getChannelFormatOptions(channel) {
|
|
359
|
+
switch (channel) {
|
|
360
|
+
case "red":
|
|
361
|
+
case "green":
|
|
362
|
+
case "blue":
|
|
363
|
+
return { style: "decimal" };
|
|
364
|
+
case "alpha":
|
|
365
|
+
return { style: "percent", maximumFractionDigits: 2 };
|
|
366
|
+
default:
|
|
367
|
+
throw new Error(`Unknown color channel: ${channel}`);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
formatChannelValue(channel) {
|
|
371
|
+
const options = this.getChannelFormatOptions(channel);
|
|
372
|
+
const value = this.getChannelValue(channel);
|
|
373
|
+
return createNumberFormatter(() => options)().format(value);
|
|
374
|
+
}
|
|
375
|
+
getColorSpace() {
|
|
376
|
+
return "rgb";
|
|
377
|
+
}
|
|
378
|
+
static colorChannels = [
|
|
379
|
+
"red",
|
|
380
|
+
"green",
|
|
381
|
+
"blue"
|
|
382
|
+
];
|
|
383
|
+
getColorChannels() {
|
|
384
|
+
return _RGBColor.colorChannels;
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
var HSB_REGEX = /hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;
|
|
388
|
+
var HSBColor = class _HSBColor extends Color {
|
|
389
|
+
constructor(hue, saturation, brightness, alpha) {
|
|
390
|
+
super();
|
|
391
|
+
this.hue = hue;
|
|
392
|
+
this.saturation = saturation;
|
|
393
|
+
this.brightness = brightness;
|
|
394
|
+
this.alpha = alpha;
|
|
395
|
+
}
|
|
396
|
+
static parse(value) {
|
|
397
|
+
let m;
|
|
398
|
+
if (m = value.match(HSB_REGEX)) {
|
|
399
|
+
const [h, s, b, a] = (m[1] ?? m[2]).split(",").map((n) => Number(n.trim().replace("%", "")));
|
|
400
|
+
return new _HSBColor(
|
|
401
|
+
normalizeHue(h),
|
|
402
|
+
clamp(s, 0, 100),
|
|
403
|
+
clamp(b, 0, 100),
|
|
404
|
+
clamp(a ?? 1, 0, 1)
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
toString(format = "css") {
|
|
409
|
+
switch (format) {
|
|
410
|
+
case "css":
|
|
411
|
+
return this.toHSL().toString("css");
|
|
412
|
+
case "hex":
|
|
413
|
+
return this.toRGB().toString("hex");
|
|
414
|
+
case "hexa":
|
|
415
|
+
return this.toRGB().toString("hexa");
|
|
416
|
+
case "hsb":
|
|
417
|
+
return `hsb(${this.hue} ${toFixedNumber(this.saturation, 2)}% ${toFixedNumber(this.brightness, 2)}%)`;
|
|
418
|
+
case "hsba":
|
|
419
|
+
return `hsba(${this.hue} ${toFixedNumber(this.saturation, 2)}% ${toFixedNumber(this.brightness, 2)}% ${this.alpha})`;
|
|
420
|
+
default:
|
|
421
|
+
return this.toFormat(format).toString(format);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
toFormat(format) {
|
|
425
|
+
switch (format) {
|
|
426
|
+
case "hsb":
|
|
427
|
+
case "hsba":
|
|
428
|
+
return this;
|
|
429
|
+
case "hsl":
|
|
430
|
+
case "hsla":
|
|
431
|
+
return this.toHSL();
|
|
432
|
+
case "rgb":
|
|
433
|
+
case "rgba":
|
|
434
|
+
return this.toRGB();
|
|
435
|
+
default:
|
|
436
|
+
throw new Error(`Unsupported color conversion: hsb -> ${format}`);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Converts a HSB color to HSL.
|
|
441
|
+
* Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_HSL.
|
|
442
|
+
* @returns An HSLColor object.
|
|
443
|
+
*/
|
|
444
|
+
toHSL() {
|
|
445
|
+
let saturation = this.saturation / 100;
|
|
446
|
+
const brightness = this.brightness / 100;
|
|
447
|
+
const lightness = brightness * (1 - saturation / 2);
|
|
448
|
+
saturation = lightness === 0 || lightness === 1 ? 0 : (brightness - lightness) / Math.min(lightness, 1 - lightness);
|
|
449
|
+
return new HSLColor(
|
|
450
|
+
toFixedNumber(this.hue, 2),
|
|
451
|
+
toFixedNumber(saturation * 100, 2),
|
|
452
|
+
toFixedNumber(lightness * 100, 2),
|
|
453
|
+
this.alpha
|
|
454
|
+
);
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Converts a HSV color value to RGB.
|
|
458
|
+
* Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSV_to_RGB_alternative.
|
|
459
|
+
* @returns An RGBColor object.
|
|
460
|
+
*/
|
|
461
|
+
toRGB() {
|
|
462
|
+
const hue = this.hue;
|
|
463
|
+
const saturation = this.saturation / 100;
|
|
464
|
+
const brightness = this.brightness / 100;
|
|
465
|
+
const fn = (n, k = (n + hue / 60) % 6) => brightness - saturation * brightness * Math.max(Math.min(k, 4 - k, 1), 0);
|
|
466
|
+
return new RGBColor(
|
|
467
|
+
Math.round(fn(5) * 255),
|
|
468
|
+
Math.round(fn(3) * 255),
|
|
469
|
+
Math.round(fn(1) * 255),
|
|
470
|
+
this.alpha
|
|
471
|
+
);
|
|
472
|
+
}
|
|
473
|
+
clone() {
|
|
474
|
+
return new _HSBColor(this.hue, this.saturation, this.brightness, this.alpha);
|
|
475
|
+
}
|
|
476
|
+
getChannelRange(channel) {
|
|
477
|
+
switch (channel) {
|
|
478
|
+
case "hue":
|
|
479
|
+
return { minValue: 0, maxValue: 360, step: 1, pageSize: 15 };
|
|
480
|
+
case "saturation":
|
|
481
|
+
case "brightness":
|
|
482
|
+
return { minValue: 0, maxValue: 100, step: 1, pageSize: 10 };
|
|
483
|
+
case "alpha":
|
|
484
|
+
return { minValue: 0, maxValue: 1, step: 0.01, pageSize: 0.1 };
|
|
485
|
+
default:
|
|
486
|
+
throw new Error(`Unknown color channel: ${channel}`);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
getChannelFormatOptions(channel) {
|
|
490
|
+
switch (channel) {
|
|
491
|
+
case "hue":
|
|
492
|
+
return { style: "unit", unit: "degree", unitDisplay: "narrow" };
|
|
493
|
+
case "saturation":
|
|
494
|
+
case "brightness":
|
|
495
|
+
case "alpha":
|
|
496
|
+
return { style: "percent", maximumFractionDigits: 2 };
|
|
497
|
+
default:
|
|
498
|
+
throw new Error(`Unknown color channel: ${channel}`);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
formatChannelValue(channel) {
|
|
502
|
+
const options = this.getChannelFormatOptions(channel);
|
|
503
|
+
let value = this.getChannelValue(channel);
|
|
504
|
+
if (channel === "saturation" || channel === "brightness") {
|
|
505
|
+
value /= 100;
|
|
506
|
+
}
|
|
507
|
+
return createNumberFormatter(() => options)().format(value);
|
|
508
|
+
}
|
|
509
|
+
getColorSpace() {
|
|
510
|
+
return "hsb";
|
|
511
|
+
}
|
|
512
|
+
static colorChannels = [
|
|
513
|
+
"hue",
|
|
514
|
+
"saturation",
|
|
515
|
+
"brightness"
|
|
516
|
+
];
|
|
517
|
+
getColorChannels() {
|
|
518
|
+
return _HSBColor.colorChannels;
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
var HSL_REGEX = /hsl\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsla\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;
|
|
522
|
+
var HSLColor = class _HSLColor extends Color {
|
|
523
|
+
constructor(hue, saturation, lightness, alpha) {
|
|
524
|
+
super();
|
|
525
|
+
this.hue = hue;
|
|
526
|
+
this.saturation = saturation;
|
|
527
|
+
this.lightness = lightness;
|
|
528
|
+
this.alpha = alpha;
|
|
529
|
+
}
|
|
530
|
+
static parse(value) {
|
|
531
|
+
let m;
|
|
532
|
+
if (m = value.match(HSL_REGEX)) {
|
|
533
|
+
const [h, s, l, a] = (m[1] ?? m[2]).split(",").map((n) => Number(n.trim().replace("%", "")));
|
|
534
|
+
return new _HSLColor(
|
|
535
|
+
normalizeHue(h),
|
|
536
|
+
clamp(s, 0, 100),
|
|
537
|
+
clamp(l, 0, 100),
|
|
538
|
+
clamp(a ?? 1, 0, 1)
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
toString(format = "css") {
|
|
543
|
+
switch (format) {
|
|
544
|
+
case "hex":
|
|
545
|
+
return this.toRGB().toString("hex");
|
|
546
|
+
case "hexa":
|
|
547
|
+
return this.toRGB().toString("hexa");
|
|
548
|
+
case "hsl":
|
|
549
|
+
return `hsl(${this.hue} ${toFixedNumber(this.saturation, 2)}% ${toFixedNumber(this.lightness, 2)}%${this.alpha !== 1 && this.alpha !== 100 ? ` / ${this.alpha}` : ""})`;
|
|
550
|
+
case "css":
|
|
551
|
+
case "hsla":
|
|
552
|
+
return `hsla(${this.hue} ${toFixedNumber(this.saturation, 2)}% ${toFixedNumber(this.lightness, 2)}% / ${this.alpha})`;
|
|
553
|
+
default:
|
|
554
|
+
return this.toFormat(format).toString(format);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
toFormat(format) {
|
|
558
|
+
switch (format) {
|
|
559
|
+
case "hsl":
|
|
560
|
+
case "hsla":
|
|
561
|
+
return this;
|
|
562
|
+
case "hsb":
|
|
563
|
+
case "hsba":
|
|
564
|
+
return this.toHSB();
|
|
565
|
+
case "rgb":
|
|
566
|
+
case "rgba":
|
|
567
|
+
return this.toRGB();
|
|
568
|
+
default:
|
|
569
|
+
throw new Error(`Unsupported color conversion: hsl -> ${format}`);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Converts a HSL color to HSB.
|
|
574
|
+
* Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_HSV.
|
|
575
|
+
* @returns An HSBColor object.
|
|
576
|
+
*/
|
|
577
|
+
toHSB() {
|
|
578
|
+
let saturation = this.saturation / 100;
|
|
579
|
+
const lightness = this.lightness / 100;
|
|
580
|
+
const brightness = lightness + saturation * Math.min(lightness, 1 - lightness);
|
|
581
|
+
saturation = brightness === 0 ? 0 : 2 * (1 - lightness / brightness);
|
|
582
|
+
return new HSBColor(
|
|
583
|
+
toFixedNumber(this.hue, 2),
|
|
584
|
+
toFixedNumber(saturation * 100, 2),
|
|
585
|
+
toFixedNumber(brightness * 100, 2),
|
|
586
|
+
this.alpha
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Converts a HSL color to RGB.
|
|
591
|
+
* Conversion formula adapted from https://en.wikipedia.org/wiki/HSL_and_HSV#HSL_to_RGB_alternative.
|
|
592
|
+
* @returns An RGBColor object.
|
|
593
|
+
*/
|
|
594
|
+
toRGB() {
|
|
595
|
+
const hue = this.hue;
|
|
596
|
+
const saturation = this.saturation / 100;
|
|
597
|
+
const lightness = this.lightness / 100;
|
|
598
|
+
const a = saturation * Math.min(lightness, 1 - lightness);
|
|
599
|
+
const fn = (n, k = (n + hue / 30) % 12) => lightness - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
600
|
+
return new RGBColor(
|
|
601
|
+
Math.round(fn(0) * 255),
|
|
602
|
+
Math.round(fn(8) * 255),
|
|
603
|
+
Math.round(fn(4) * 255),
|
|
604
|
+
this.alpha
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
clone() {
|
|
608
|
+
return new _HSLColor(this.hue, this.saturation, this.lightness, this.alpha);
|
|
609
|
+
}
|
|
610
|
+
getChannelRange(channel) {
|
|
611
|
+
switch (channel) {
|
|
612
|
+
case "hue":
|
|
613
|
+
return { minValue: 0, maxValue: 360, step: 1, pageSize: 15 };
|
|
614
|
+
case "saturation":
|
|
615
|
+
case "lightness":
|
|
616
|
+
return { minValue: 0, maxValue: 100, step: 1, pageSize: 10 };
|
|
617
|
+
case "alpha":
|
|
618
|
+
return { minValue: 0, maxValue: 1, step: 0.01, pageSize: 0.1 };
|
|
619
|
+
default:
|
|
620
|
+
throw new Error(`Unknown color channel: ${channel}`);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
getChannelFormatOptions(channel) {
|
|
624
|
+
switch (channel) {
|
|
625
|
+
case "hue":
|
|
626
|
+
return { style: "unit", unit: "degree", unitDisplay: "narrow" };
|
|
627
|
+
case "saturation":
|
|
628
|
+
case "lightness":
|
|
629
|
+
case "alpha":
|
|
630
|
+
return { style: "percent", maximumFractionDigits: 2 };
|
|
631
|
+
default:
|
|
632
|
+
throw new Error(`Unknown color channel: ${channel}`);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
formatChannelValue(channel) {
|
|
636
|
+
const options = this.getChannelFormatOptions(channel);
|
|
637
|
+
let value = this.getChannelValue(channel);
|
|
638
|
+
if (channel === "saturation" || channel === "lightness") {
|
|
639
|
+
value /= 100;
|
|
640
|
+
}
|
|
641
|
+
return createNumberFormatter(() => options)().format(value);
|
|
642
|
+
}
|
|
643
|
+
getColorSpace() {
|
|
644
|
+
return "hsl";
|
|
645
|
+
}
|
|
646
|
+
static colorChannels = [
|
|
647
|
+
"hue",
|
|
648
|
+
"saturation",
|
|
649
|
+
"lightness"
|
|
650
|
+
];
|
|
651
|
+
getColorChannels() {
|
|
652
|
+
return _HSLColor.colorChannels;
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
function toOKLCH(color) {
|
|
656
|
+
const rgb = color.toFormat("rgb");
|
|
657
|
+
let red = rgb.getChannelValue("red") / 255;
|
|
658
|
+
let green = rgb.getChannelValue("green") / 255;
|
|
659
|
+
let blue = rgb.getChannelValue("blue") / 255;
|
|
660
|
+
[red, green, blue] = lin_sRGB(red, green, blue);
|
|
661
|
+
const [x, y, z] = lin_sRGB_to_XYZ(red, green, blue);
|
|
662
|
+
const [l, a, b] = XYZ_to_OKLab(x, y, z);
|
|
663
|
+
return OKLab_to_OKLCH(l, a, b);
|
|
664
|
+
}
|
|
665
|
+
function OKLab_to_OKLCH(l, a, b) {
|
|
666
|
+
const hue = Math.atan2(b, a) * 180 / Math.PI;
|
|
667
|
+
return [
|
|
668
|
+
l,
|
|
669
|
+
Math.sqrt(a ** 2 + b ** 2),
|
|
670
|
+
// Chroma
|
|
671
|
+
hue >= 0 ? hue : hue + 360
|
|
672
|
+
// Hue, in degrees [0 to 360)
|
|
673
|
+
];
|
|
674
|
+
}
|
|
675
|
+
function lin_sRGB(r, g, b) {
|
|
676
|
+
return [lin_sRGB_component(r), lin_sRGB_component(g), lin_sRGB_component(b)];
|
|
677
|
+
}
|
|
678
|
+
function lin_sRGB_component(val) {
|
|
679
|
+
const sign = val < 0 ? -1 : 1;
|
|
680
|
+
const abs = Math.abs(val);
|
|
681
|
+
if (abs <= 0.04045) {
|
|
682
|
+
return val / 12.92;
|
|
683
|
+
}
|
|
684
|
+
return sign * ((abs + 0.055) / 1.055) ** 2.4;
|
|
685
|
+
}
|
|
686
|
+
function lin_sRGB_to_XYZ(r, g, b) {
|
|
687
|
+
const M = [
|
|
688
|
+
506752 / 1228815,
|
|
689
|
+
87881 / 245763,
|
|
690
|
+
12673 / 70218,
|
|
691
|
+
87098 / 409605,
|
|
692
|
+
175762 / 245763,
|
|
693
|
+
12673 / 175545,
|
|
694
|
+
7918 / 409605,
|
|
695
|
+
87881 / 737289,
|
|
696
|
+
1001167 / 1053270
|
|
697
|
+
];
|
|
698
|
+
return multiplyMatrix(M, r, g, b);
|
|
699
|
+
}
|
|
700
|
+
function XYZ_to_OKLab(x, y, z) {
|
|
701
|
+
const XYZtoLMS = [
|
|
702
|
+
0.819022437996703,
|
|
703
|
+
0.3619062600528904,
|
|
704
|
+
-0.1288737815209879,
|
|
705
|
+
0.0329836539323885,
|
|
706
|
+
0.9292868615863434,
|
|
707
|
+
0.0361446663506424,
|
|
708
|
+
0.0481771893596242,
|
|
709
|
+
0.2642395317527308,
|
|
710
|
+
0.6335478284694309
|
|
711
|
+
];
|
|
712
|
+
const LMStoOKLab = [
|
|
713
|
+
0.210454268309314,
|
|
714
|
+
0.7936177747023054,
|
|
715
|
+
-0.0040720430116193,
|
|
716
|
+
1.9779985324311684,
|
|
717
|
+
-2.42859224204858,
|
|
718
|
+
0.450593709617411,
|
|
719
|
+
0.0259040424655478,
|
|
720
|
+
0.7827717124575296,
|
|
721
|
+
-0.8086757549230774
|
|
722
|
+
];
|
|
723
|
+
const [a, b, c] = multiplyMatrix(XYZtoLMS, x, y, z);
|
|
724
|
+
return multiplyMatrix(LMStoOKLab, Math.cbrt(a), Math.cbrt(b), Math.cbrt(c));
|
|
725
|
+
}
|
|
726
|
+
function multiplyMatrix(m, x, y, z) {
|
|
727
|
+
const a = m[0] * x + m[1] * y + m[2] * z;
|
|
728
|
+
const b = m[3] * x + m[4] * y + m[5] * z;
|
|
729
|
+
const c = m[6] * x + m[7] * y + m[8] * z;
|
|
730
|
+
return [a, b, c];
|
|
731
|
+
}
|
|
732
|
+
function toFixedNumber(value, digits, base = 10) {
|
|
733
|
+
const pow = base ** digits;
|
|
734
|
+
return Math.round(value * pow) / pow;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
export {
|
|
738
|
+
COLOR_INTL_TRANSLATIONS,
|
|
739
|
+
parseColor,
|
|
740
|
+
normalizeColor,
|
|
741
|
+
getColorChannels,
|
|
742
|
+
normalizeHue
|
|
743
|
+
};
|