@fangxinyan/lumina 0.6.18 → 0.8.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/dist/{Alert-HVPI6L4V.css → Alert-DJ3K7N7L.css} +9 -9
- package/dist/Alert.cjs +5 -3
- package/dist/Alert.d.cts +2 -2
- package/dist/Alert.d.ts +2 -2
- package/dist/Alert.js +4 -2
- package/dist/{AppShell-FZCD4C56.css → AppShell-OWJRJ4ZD.css} +57 -22
- package/dist/AppShell.cjs +8 -5
- package/dist/AppShell.d.cts +19 -16
- package/dist/AppShell.d.ts +19 -16
- package/dist/AppShell.js +4 -1
- package/dist/{AutoComplete-4YZBMW4E.css → AutoComplete-PNCYHU2T.css} +8 -8
- package/dist/AutoComplete.cjs +9 -6
- package/dist/AutoComplete.d.cts +2 -1
- package/dist/AutoComplete.d.ts +2 -1
- package/dist/AutoComplete.js +8 -5
- package/dist/Avatar-YBU2YZTW.css +48 -0
- package/dist/Avatar.cjs +4 -2
- package/dist/Avatar.d.cts +6 -2
- package/dist/Avatar.d.ts +6 -2
- package/dist/Avatar.js +3 -1
- package/dist/Badge-DBWJEV4C.css +22 -0
- package/dist/Badge.cjs +4 -2
- package/dist/Badge.d.cts +6 -2
- package/dist/Badge.d.ts +6 -2
- package/dist/Badge.js +3 -1
- package/dist/{Button-TUMZUQLI.css → Button-ILNZUX2N.css} +28 -21
- package/dist/Button.cjs +6 -4
- package/dist/Button.d.cts +2 -14
- package/dist/Button.d.ts +2 -14
- package/dist/Button.js +4 -2
- package/dist/{Calendar-I6NHCXIB.css → Calendar-QJ5HWEJQ.css} +26 -26
- package/dist/Calendar.cjs +5 -3
- package/dist/Calendar.d.cts +8 -4
- package/dist/Calendar.d.ts +8 -4
- package/dist/Calendar.js +4 -2
- package/dist/Card-VPMTWAWZ.css +98 -0
- package/dist/Card.cjs +7 -3
- package/dist/Card.d.cts +8 -4
- package/dist/Card.d.ts +8 -4
- package/dist/Card.js +6 -2
- package/dist/Cascader-YBVDK6DC.css +168 -0
- package/dist/Cascader.cjs +9 -6
- package/dist/Cascader.d.cts +21 -3
- package/dist/Cascader.d.ts +21 -3
- package/dist/Cascader.js +8 -5
- package/dist/Checkbox-IHFML4FV.css +50 -0
- package/dist/Checkbox.cjs +5 -3
- package/dist/Checkbox.d.cts +10 -2
- package/dist/Checkbox.d.ts +10 -2
- package/dist/Checkbox.js +4 -2
- package/dist/{Collapse-UNBHEPYP.css → Collapse-BTSBHBSY.css} +12 -7
- package/dist/Collapse.cjs +5 -3
- package/dist/Collapse.d.cts +2 -2
- package/dist/Collapse.d.ts +2 -2
- package/dist/Collapse.js +4 -2
- package/dist/{ColorPicker-LPG6QPYF.css → ColorPicker-GRZOKR5O.css} +17 -32
- package/dist/ColorPicker.cjs +9 -3
- package/dist/ColorPicker.d.cts +7 -11
- package/dist/ColorPicker.d.ts +7 -11
- package/dist/ColorPicker.js +8 -2
- package/dist/{CommandPalette-RTKWNH2D.css → CommandPalette-GHTX7AAA.css} +22 -23
- package/dist/CommandPalette.cjs +8 -5
- package/dist/CommandPalette.d.cts +5 -28
- package/dist/CommandPalette.d.ts +5 -28
- package/dist/CommandPalette.js +7 -4
- package/dist/{ContextMenu-WRR2SSWL.css → ContextMenu-NG524Y2P.css} +17 -17
- package/dist/ContextMenu.cjs +5 -2
- package/dist/ContextMenu.d.cts +2 -19
- package/dist/ContextMenu.d.ts +2 -19
- package/dist/ContextMenu.js +4 -1
- package/dist/{DatePicker-VDVSIARF.css → DatePicker-ZSFDXAYD.css} +4 -4
- package/dist/DatePicker.cjs +11 -8
- package/dist/DatePicker.d.cts +4 -7
- package/dist/DatePicker.d.ts +4 -7
- package/dist/DatePicker.js +10 -7
- package/dist/{DateTimePicker-DRX7XA74.css → DateTimePicker-EWSISVIF.css} +17 -17
- package/dist/DateTimePicker.cjs +11 -8
- package/dist/DateTimePicker.d.cts +4 -8
- package/dist/DateTimePicker.d.ts +4 -8
- package/dist/DateTimePicker.js +10 -7
- package/dist/{Divider-RPQCVH3J.css → Divider-OI2BXPBU.css} +10 -10
- package/dist/Divider.cjs +4 -2
- package/dist/Divider.d.cts +2 -2
- package/dist/Divider.d.ts +2 -2
- package/dist/Divider.js +3 -1
- package/dist/{Drawer-7KICRM4L.css → Drawer-VCXAXWV6.css} +30 -17
- package/dist/Drawer.cjs +6 -3
- package/dist/Drawer.d.cts +25 -3
- package/dist/Drawer.d.ts +25 -3
- package/dist/Drawer.js +5 -2
- package/dist/{Empty-CZTRZMZQ.css → Empty-U5CBLCAL.css} +5 -5
- package/dist/Empty.cjs +4 -2
- package/dist/Empty.d.cts +2 -2
- package/dist/Empty.d.ts +2 -2
- package/dist/Empty.js +3 -1
- package/dist/{Form-NGCQWTMZ.css → Form-DNEDZRJA.css} +7 -7
- package/dist/Form.cjs +7 -4
- package/dist/Form.d.cts +4 -3
- package/dist/Form.d.ts +4 -3
- package/dist/Form.js +4 -1
- package/dist/Icon-HJSUVW4O.css +12 -0
- package/dist/Icon.cjs +51 -49
- package/dist/Icon.d.cts +8 -8
- package/dist/Icon.d.ts +8 -8
- package/dist/Icon.js +3 -1
- package/dist/{Image-NISJRUWX.css → Image-CZJPPURT.css} +25 -23
- package/dist/Image.cjs +10 -7
- package/dist/Image.d.cts +5 -24
- package/dist/Image.d.ts +5 -24
- package/dist/Image.js +6 -3
- package/dist/{Input-7GDPGP3E.css → Input-ZUASNDXM.css} +15 -15
- package/dist/Input.cjs +7 -5
- package/dist/Input.d.cts +2 -1
- package/dist/Input.d.ts +2 -1
- package/dist/Input.js +5 -3
- package/dist/{InputNumber-VXQIWLQC.css → InputNumber-6NHBMRT4.css} +7 -7
- package/dist/InputNumber.cjs +7 -5
- package/dist/InputNumber.d.cts +2 -1
- package/dist/InputNumber.d.ts +2 -1
- package/dist/InputNumber.js +6 -4
- package/dist/List-6BQIFAIT.css +42 -0
- package/dist/List.cjs +4 -2
- package/dist/List.d.cts +2 -2
- package/dist/List.d.ts +2 -2
- package/dist/List.js +3 -1
- package/dist/{Message-H222YGR6.css → Message-OTZWQTQ5.css} +13 -13
- package/dist/Message.cjs +9 -6
- package/dist/Message.d.cts +18 -2
- package/dist/Message.d.ts +18 -2
- package/dist/Message.js +5 -2
- package/dist/{Modal-ZFWNFEA5.css → Modal-UI2FXNDR.css} +29 -18
- package/dist/Modal.cjs +7 -4
- package/dist/Modal.d.cts +13 -2
- package/dist/Modal.d.ts +13 -2
- package/dist/Modal.js +6 -3
- package/dist/Pagination-POJTWMYR.css +70 -0
- package/dist/Pagination.cjs +11 -8
- package/dist/Pagination.d.cts +2 -2
- package/dist/Pagination.d.ts +2 -2
- package/dist/Pagination.js +10 -7
- package/dist/{Popover-Y3LDCJPW.css → Popover-LCXLR3EU.css} +13 -14
- package/dist/Popover.cjs +6 -3
- package/dist/Popover.d.cts +3 -10
- package/dist/Popover.d.ts +3 -10
- package/dist/Popover.js +5 -2
- package/dist/Progress-33WE2NI7.css +90 -0
- package/dist/Progress.cjs +4 -2
- package/dist/Progress.d.cts +4 -2
- package/dist/Progress.d.ts +4 -2
- package/dist/Progress.js +3 -1
- package/dist/{Radio-IQKASYDF.css → Radio-RL7232MZ.css} +21 -13
- package/dist/Radio.cjs +5 -3
- package/dist/Radio.d.cts +18 -5
- package/dist/Radio.d.ts +18 -5
- package/dist/Radio.js +3 -1
- package/dist/{Select-YZ2NUJSX.css → Select-TU37MAHZ.css} +64 -40
- package/dist/Select.cjs +10 -7
- package/dist/Select.d.cts +28 -3
- package/dist/Select.d.ts +28 -3
- package/dist/Select.js +9 -6
- package/dist/{Skeleton-CVWH2VWN.css → Skeleton-FMFE3BRI.css} +9 -4
- package/dist/Skeleton.cjs +4 -2
- package/dist/Skeleton.d.cts +2 -4
- package/dist/Skeleton.d.ts +2 -4
- package/dist/Skeleton.js +3 -1
- package/dist/Slider-FZ5MI4X2.css +145 -0
- package/dist/Slider.cjs +4 -2
- package/dist/Slider.d.cts +6 -5
- package/dist/Slider.d.ts +6 -5
- package/dist/Slider.js +3 -1
- package/dist/{Spin-GONGPV4Q.css → Spin-F5YIEENO.css} +15 -9
- package/dist/Spin.cjs +4 -2
- package/dist/Spin.d.cts +2 -2
- package/dist/Spin.d.ts +2 -2
- package/dist/Spin.js +3 -1
- package/dist/{Splitter-DHNOY4NC.css → Splitter-IQ3PFIKK.css} +4 -4
- package/dist/Splitter.cjs +4 -2
- package/dist/Splitter.d.cts +18 -12
- package/dist/Splitter.d.ts +18 -12
- package/dist/Splitter.js +3 -1
- package/dist/{StatusBar-FJKEEPXU.css → StatusBar-TCGR3LXP.css} +23 -9
- package/dist/StatusBar.cjs +5 -3
- package/dist/StatusBar.d.cts +5 -17
- package/dist/StatusBar.d.ts +5 -17
- package/dist/StatusBar.js +3 -1
- package/dist/{Surface-UDDN3DGL.css → Surface-CTN775GD.css} +10 -10
- package/dist/Surface.cjs +6 -5
- package/dist/Surface.d.cts +10 -1
- package/dist/Surface.d.ts +10 -1
- package/dist/Surface.js +4 -3
- package/dist/{Switch-COAQIOMH.css → Switch-TATU3LPB.css} +16 -8
- package/dist/Switch.cjs +4 -2
- package/dist/Switch.d.cts +10 -4
- package/dist/Switch.d.ts +10 -4
- package/dist/Switch.js +3 -1
- package/dist/{Table-IWHIIGRJ.css → Table-KB6EEBDJ.css} +105 -53
- package/dist/Table.cjs +14 -10
- package/dist/Table.d.cts +38 -3
- package/dist/Table.d.ts +38 -3
- package/dist/Table.js +13 -9
- package/dist/{TablePro-3NGWERWT.css → TablePro-WYE6TXWJ.css} +5 -5
- package/dist/TablePro.cjs +15 -11
- package/dist/TablePro.d.cts +1 -0
- package/dist/TablePro.d.ts +1 -0
- package/dist/TablePro.js +14 -10
- package/dist/{Tabs-X5U5PCPV.css → Tabs-FB2AMBWL.css} +24 -10
- package/dist/Tabs.cjs +4 -2
- package/dist/Tabs.d.cts +8 -2
- package/dist/Tabs.d.ts +8 -2
- package/dist/Tabs.js +3 -1
- package/dist/Tag-5GIZLRAH.css +42 -0
- package/dist/Tag.cjs +5 -3
- package/dist/Tag.d.cts +2 -2
- package/dist/Tag.d.ts +2 -2
- package/dist/Tag.js +4 -2
- package/dist/{Textarea-YHWKHIFE.css → Textarea-ZGHBZNLX.css} +10 -10
- package/dist/Textarea.cjs +6 -4
- package/dist/Textarea.d.cts +2 -4
- package/dist/Textarea.d.ts +2 -4
- package/dist/Textarea.js +4 -2
- package/dist/Theme-CLedeJ_C.d.ts +193 -0
- package/dist/Theme-uQq2B0Yk.d.cts +193 -0
- package/dist/Theme.cjs +57 -11
- package/dist/Theme.d.cts +26 -145
- package/dist/Theme.d.ts +26 -145
- package/dist/Theme.js +3 -1
- package/dist/{ThemePanel-TEHB2JCQ.css → ThemePanel-EHNAS4RN.css} +52 -52
- package/dist/ThemePanel.cjs +17 -15
- package/dist/ThemePanel.d.cts +3 -13
- package/dist/ThemePanel.d.ts +3 -13
- package/dist/ThemePanel.js +14 -12
- package/dist/{TimePicker-ZBJOXH3U.css → TimePicker-WJ3FSK6A.css} +17 -17
- package/dist/TimePicker.cjs +10 -7
- package/dist/TimePicker.d.cts +2 -8
- package/dist/TimePicker.d.ts +2 -8
- package/dist/TimePicker.js +9 -6
- package/dist/{Timeline-CRFZ3I2W.css → Timeline-FUFO2UGY.css} +28 -13
- package/dist/Timeline.cjs +5 -3
- package/dist/Timeline.d.cts +2 -7
- package/dist/Timeline.d.ts +2 -7
- package/dist/Timeline.js +4 -2
- package/dist/{Tooltip-5FSPJWLX.css → Tooltip-2EUNTOTW.css} +3 -3
- package/dist/Tooltip.cjs +6 -3
- package/dist/Tooltip.d.cts +2 -2
- package/dist/Tooltip.d.ts +2 -2
- package/dist/Tooltip.js +5 -2
- package/dist/{Typography-32QQLD4F.css → Typography-CQ2OZXQH.css} +105 -42
- package/dist/Typography.cjs +11 -8
- package/dist/Typography.d.cts +12 -36
- package/dist/Typography.d.ts +12 -36
- package/dist/Typography.js +6 -3
- package/dist/chunk-2A4GYSN4.js +294 -0
- package/dist/{chunk-QMX67CVT.cjs → chunk-2AUXUZ3Z.cjs} +56 -31
- package/dist/chunk-2BIOTRQC.js +40 -0
- package/dist/{chunk-A6O25EP2.js → chunk-2HIN5NFM.js} +14 -6
- package/dist/{chunk-I7TOBKJO.js → chunk-3DKFS44V.js} +84 -23
- package/dist/{chunk-X5MYHDEQ.cjs → chunk-3EMWDDWK.cjs} +372 -117
- package/dist/chunk-3F424R5P.js +143 -0
- package/dist/chunk-3IZZBM56.js +269 -0
- package/dist/{chunk-DUFRASGO.js → chunk-3QXP2ZNP.js} +18 -23
- package/dist/{chunk-5QEI7GGA.cjs → chunk-434Y2JVW.cjs} +60 -27
- package/dist/{chunk-SOCYOUGM.js → chunk-4SKHRPDH.js} +168 -64
- package/dist/{chunk-R3DTXVP2.js → chunk-5AXNUX3J.js} +8 -5
- package/dist/chunk-5CZA33BK.cjs +229 -0
- package/dist/{chunk-6K5YI4ZE.js → chunk-62VV5COT.js} +16 -6
- package/dist/{chunk-2FOC3D6X.js → chunk-63RSKQID.js} +23 -7
- package/dist/chunk-6DKPJ5LV.cjs +294 -0
- package/dist/{chunk-OTSDPQPV.js → chunk-6RQJXSWN.js} +50 -30
- package/dist/{chunk-V5KUC5VH.cjs → chunk-77HU7JWK.cjs} +40 -13
- package/dist/chunk-7QAVPVMW.js +180 -0
- package/dist/chunk-7VLAHOA7.cjs +191 -0
- package/dist/chunk-ALAG4ZUH.js +72 -0
- package/dist/chunk-ARUN2DMD.js +39 -0
- package/dist/chunk-AUO2YYHB.js +248 -0
- package/dist/{chunk-6MEOLYNQ.js → chunk-AURYNA6G.js} +6 -5
- package/dist/chunk-BIPOXOHP.cjs +287 -0
- package/dist/{chunk-BVQOJKRX.js → chunk-BKW5PXEO.js} +115 -72
- package/dist/chunk-DRDDQCDD.js +322 -0
- package/dist/chunk-DU2DSERH.js +190 -0
- package/dist/chunk-DURKCGEM.js +496 -0
- package/dist/{chunk-PSQ3HNZP.cjs → chunk-E66PSVBU.cjs} +106 -19
- package/dist/chunk-EAUB6FEN.js +262 -0
- package/dist/chunk-EE5KXDRK.cjs +1223 -0
- package/dist/chunk-EE7IJ3MB.js +1 -0
- package/dist/chunk-EUTK2ZRJ.cjs +61 -0
- package/dist/{chunk-HSAJUEO7.cjs → chunk-F7WUCOBP.cjs} +150 -86
- package/dist/{chunk-YB3IWIOJ.cjs → chunk-FJB3243S.cjs} +18 -23
- package/dist/chunk-FKCPSVC4.cjs +188 -0
- package/dist/chunk-FMUHLIHB.cjs +94 -0
- package/dist/chunk-FY73C7JK.js +520 -0
- package/dist/{chunk-6EOSMK34.cjs → chunk-G5LCOBOT.cjs} +20 -1
- package/dist/{chunk-5ERD3W24.cjs → chunk-GFKWSDD6.cjs} +18 -8
- package/dist/{chunk-T2O4DTDE.cjs → chunk-GTFP7HA3.cjs} +58 -32
- package/dist/chunk-HQFKXTX6.js +60 -0
- package/dist/{chunk-V5SQOZPF.js → chunk-HQNDVNTQ.js} +38 -20
- package/dist/chunk-HSDMJUB6.cjs +319 -0
- package/dist/chunk-HVPUGYBY.js +166 -0
- package/dist/chunk-HYHBCHFM.cjs +167 -0
- package/dist/chunk-HYJSMFZA.cjs +2 -0
- package/dist/chunk-I4YPBAQ5.js +163 -0
- package/dist/chunk-IJDM2U3B.js +100 -0
- package/dist/chunk-J5UEQ3ZQ.js +226 -0
- package/dist/chunk-JBS353O4.cjs +248 -0
- package/dist/{chunk-IPSNC5VZ.js → chunk-JHM7MN3G.js} +15 -7
- package/dist/{chunk-6Q76VLCE.cjs → chunk-JKUXA3U6.cjs} +50 -30
- package/dist/{chunk-D7GK6H6V.js → chunk-K5HGHOG7.js} +50 -21
- package/dist/chunk-KATJAJUU.js +78 -0
- package/dist/chunk-KCDOC3HS.cjs +100 -0
- package/dist/{chunk-M4NJTJKV.cjs → chunk-LDX6Q6RK.cjs} +8 -5
- package/dist/chunk-LEDESWNL.js +83 -0
- package/dist/chunk-LG62MPMU.cjs +213 -0
- package/dist/{chunk-7NTTRKNT.js → chunk-LJVQQEME.js} +54 -28
- package/dist/{chunk-FDZG27IG.js → chunk-LQMOYVQF.js} +57 -32
- package/dist/{chunk-P2OQTJZP.cjs → chunk-MCDW3VKZ.cjs} +17 -6
- package/dist/{chunk-BT2RXFT4.cjs → chunk-MUZQWIMR.cjs} +121 -78
- package/dist/chunk-NRJXZPZR.cjs +351 -0
- package/dist/chunk-O6G3F5L4.js +311 -0
- package/dist/{chunk-3VSHGM54.js → chunk-OLYSSZHP.js} +126 -68
- package/dist/{chunk-A4Z7PLHV.cjs → chunk-PIJV2FHO.cjs} +135 -77
- package/dist/{chunk-L6GIV5DQ.cjs → chunk-PJFYIXBX.cjs} +40 -22
- package/dist/{chunk-NXBFEIUX.cjs → chunk-PNKNZREC.cjs} +266 -130
- package/dist/{chunk-FYSXJXNW.js → chunk-PQOBBASY.js} +10 -9
- package/dist/chunk-Q565GDVK.cjs +205 -0
- package/dist/{chunk-FDUQPAQE.cjs → chunk-Q5HLC56A.cjs} +122 -28
- package/dist/chunk-QDCPVI3S.cjs +333 -0
- package/dist/{chunk-ZR4IMROK.js → chunk-QDMFXRPI.js} +122 -28
- package/dist/chunk-QDY56GGO.js +234 -0
- package/dist/{chunk-4KDABJSY.cjs → chunk-QNQSNVCU.cjs} +86 -25
- package/dist/chunk-QYPA77OI.cjs +55 -0
- package/dist/{chunk-BW76ENTW.cjs → chunk-RERMZNF3.cjs} +10 -9
- package/dist/chunk-RMGFRAZ2.cjs +270 -0
- package/dist/chunk-RPO7657K.js +228 -0
- package/dist/chunk-RR7KWH26.cjs +122 -0
- package/dist/chunk-SF7BPXDJ.cjs +518 -0
- package/dist/chunk-STQDKMS5.cjs +288 -0
- package/dist/{chunk-HG6YS4I7.js → chunk-SXLRWYQQ.js} +71 -24
- package/dist/{chunk-SW2HMNCA.cjs → chunk-T4RR6NVU.cjs} +17 -9
- package/dist/{chunk-6SPMHY54.js → chunk-TSL3F2K3.js} +20 -2
- package/dist/{chunk-BNY2NVTL.cjs → chunk-TYZ6L7E6.cjs} +48 -28
- package/dist/{chunk-MOZ52KN6.js → chunk-U3SG2YT2.js} +39 -12
- package/dist/{chunk-POU3W5J3.cjs → chunk-U5YYOOLC.cjs} +13 -6
- package/dist/chunk-UE4HFGJ6.js +264 -0
- package/dist/chunk-ULTDRMGN.js +1175 -0
- package/dist/{chunk-6HF6UF73.js → chunk-UQI4R32R.js} +368 -113
- package/dist/{chunk-MWEHU7YO.cjs → chunk-VA3JWOAB.cjs} +172 -68
- package/dist/chunk-VQEMMJHC.js +33 -0
- package/dist/{chunk-S2ZGXBUH.cjs → chunk-VVRXNGYL.cjs} +218 -42
- package/dist/{chunk-JMFHL7GN.cjs → chunk-VX6MZO4K.cjs} +100 -22
- package/dist/{chunk-4ACCOYBY.cjs → chunk-WHBKQZU5.cjs} +24 -8
- package/dist/{chunk-UGAN4BBW.js → chunk-WMISXERU.js} +262 -126
- package/dist/{chunk-MYW7LNB2.cjs → chunk-WROF2PVG.cjs} +40 -21
- package/dist/{chunk-5VOUUQF5.js → chunk-Y22PTPA7.js} +145 -81
- package/dist/chunk-Y2MT6PI6.js +207 -0
- package/dist/chunk-YAYSXZZZ.cjs +82 -0
- package/dist/{chunk-6LN4VVX7.js → chunk-YBGMTQ2V.js} +48 -28
- package/dist/{chunk-TYLDISRK.js → chunk-YKHIIC7M.js} +13 -6
- package/dist/{chunk-3VXGZ3SJ.js → chunk-YPMQC5HX.js} +57 -24
- package/dist/{chunk-UWL6DRZW.cjs → chunk-YUJ7Z6N2.cjs} +74 -27
- package/dist/{chunk-LEMMFFEY.cjs → chunk-ZEYK37VW.cjs} +15 -7
- package/dist/{chunk-ES7AWMNH.cjs → chunk-ZHVR4YPB.cjs} +6 -5
- package/dist/{chunk-MPOO5VPW.cjs → chunk-ZYIE3BH7.cjs} +50 -21
- package/dist/componentThemeTypes-Jt4B5aU8.d.cts +77 -0
- package/dist/componentThemeTypes-Jt4B5aU8.d.ts +77 -0
- package/dist/index.cjs +253 -206
- package/dist/index.d.cts +11 -9
- package/dist/index.d.ts +11 -9
- package/dist/index.js +56 -53
- package/dist/styles.css +1663 -695
- package/dist/{tokens-RYJ3DFTU.css → tokens-CEJVVA3G.css} +10 -0
- package/dist/tokens.css +10 -0
- package/docs/llms/appshell.md +9 -6
- package/docs/llms/autocomplete.md +8 -2
- package/docs/llms/avatar.md +2 -0
- package/docs/llms/badge.md +2 -0
- package/docs/llms/calendar.md +7 -2
- package/docs/llms/card.md +20 -1
- package/docs/llms/cascader.md +27 -5
- package/docs/llms/checkbox.md +13 -0
- package/docs/llms/collapse.md +13 -5
- package/docs/llms/colorpicker.md +4 -3
- package/docs/llms/commandpalette.md +10 -2
- package/docs/llms/contextmenu.md +14 -2
- package/docs/llms/datepicker.md +7 -0
- package/docs/llms/datetimepicker.md +7 -0
- package/docs/llms/drawer.md +27 -4
- package/docs/llms/form.md +5 -2
- package/docs/llms/icon.md +25 -1
- package/docs/llms/image.md +3 -3
- package/docs/llms/list.md +11 -0
- package/docs/llms/message.md +31 -8
- package/docs/llms/modal.md +20 -8
- package/docs/llms/pagination.md +12 -4
- package/docs/llms/popover.md +11 -1
- package/docs/llms/progress.md +1 -0
- package/docs/llms/radio.md +13 -0
- package/docs/llms/select.md +48 -2
- package/docs/llms/sidebar.md +24 -0
- package/docs/llms/slider.md +5 -2
- package/docs/llms/splitter.md +17 -3
- package/docs/llms/switch.md +13 -0
- package/docs/llms/table.md +7 -8
- package/docs/llms/tablepro.md +23 -1
- package/docs/llms/tabs.md +21 -0
- package/docs/llms/theme.md +83 -28
- package/docs/llms/themepanel.md +1 -0
- package/docs/llms/titlebar.md +1 -0
- package/docs/llms/tooltip.md +7 -2
- package/docs/llms/typography.md +27 -3
- package/docs/llms/windowcontrols.md +11 -3
- package/docs/llms.md +2 -2
- package/package.json +212 -2
- package/dist/Avatar-TNPOHVY5.css +0 -40
- package/dist/Badge-DPGLV3D3.css +0 -22
- package/dist/Card-W3ATFUJW.css +0 -77
- package/dist/Cascader-ANEQUPMI.css +0 -150
- package/dist/Checkbox-EDNPZRIP.css +0 -42
- package/dist/List-LSMU5QAC.css +0 -26
- package/dist/Pagination-YSZSNFHG.css +0 -68
- package/dist/Progress-CZNXCYGW.css +0 -80
- package/dist/Slider-UM2IZZBH.css +0 -127
- package/dist/Tag-G2XWAL7A.css +0 -42
- package/dist/chunk-262ED6WQ.cjs +0 -88
- package/dist/chunk-4HJBF4GY.js +0 -218
- package/dist/chunk-4TTRHEGM.cjs +0 -217
- package/dist/chunk-5A6KSYWA.cjs +0 -67
- package/dist/chunk-5MOYKVB7.js +0 -192
- package/dist/chunk-7IO3EOHN.cjs +0 -200
- package/dist/chunk-7QXP6DXC.cjs +0 -129
- package/dist/chunk-AAPZLBHQ.js +0 -165
- package/dist/chunk-ARUPS7JH.js +0 -66
- package/dist/chunk-ATUPFAPZ.cjs +0 -76
- package/dist/chunk-CFZVWY5N.js +0 -178
- package/dist/chunk-DSLYWX4O.js +0 -25
- package/dist/chunk-E22OIVYP.js +0 -349
- package/dist/chunk-FQJY4D3T.cjs +0 -47
- package/dist/chunk-GNV6W4BN.js +0 -495
- package/dist/chunk-HBO7ZDEQ.js +0 -29
- package/dist/chunk-I777JTTG.js +0 -150
- package/dist/chunk-IOAOG5L7.js +0 -191
- package/dist/chunk-IOUAZYK2.cjs +0 -116
- package/dist/chunk-IZHH6CVY.js +0 -123
- package/dist/chunk-JFL2WMJZ.js +0 -106
- package/dist/chunk-KMPFESEV.js +0 -41
- package/dist/chunk-KYV75JPQ.js +0 -147
- package/dist/chunk-N7OQNSII.cjs +0 -145
- package/dist/chunk-P64NPZBG.js +0 -113
- package/dist/chunk-PKNRTFNE.cjs +0 -526
- package/dist/chunk-PU7VXDAS.js +0 -64
- package/dist/chunk-RFI5R42I.cjs +0 -138
- package/dist/chunk-RR2BKV65.js +0 -39
- package/dist/chunk-RSSOX4RQ.cjs +0 -240
- package/dist/chunk-RZEFKXL3.cjs +0 -104
- package/dist/chunk-S7IHWY24.js +0 -81
- package/dist/chunk-SOQ56ZI2.cjs +0 -49
- package/dist/chunk-TBNPJPYG.cjs +0 -61
- package/dist/chunk-TJECLLN4.js +0 -344
- package/dist/chunk-ULUD3FED.cjs +0 -138
- package/dist/chunk-UW57F3UO.cjs +0 -371
- package/dist/chunk-VA2I7ZAL.cjs +0 -190
- package/dist/chunk-VS3I5OKA.cjs +0 -214
- package/dist/chunk-WMGMIE2D.js +0 -113
- package/dist/chunk-X7XP6GEI.cjs +0 -63
- package/dist/chunk-XCXUGHDF.js +0 -91
- package/dist/chunk-YAFDVNXT.js +0 -27
- package/dist/chunk-ZD3L4V3H.js +0 -54
- package/dist/chunk-ZTCRD2FL.js +0 -45
|
@@ -0,0 +1,1223 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('./tokens-CEJVVA3G.css');
|
|
4
|
+
var React3 = require('react');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n.default = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
|
|
26
|
+
|
|
27
|
+
// src/components/Theme/Theme.tsx
|
|
28
|
+
var PortalContainerContext = React3__namespace.createContext(null);
|
|
29
|
+
function PortalScopeProvider({ container, children }) {
|
|
30
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PortalContainerContext.Provider, { value: container, children });
|
|
31
|
+
}
|
|
32
|
+
function usePortalContainer() {
|
|
33
|
+
const scopedContainer = React3__namespace.useContext(PortalContainerContext);
|
|
34
|
+
if (scopedContainer) return scopedContainer;
|
|
35
|
+
if (typeof document === "undefined") return null;
|
|
36
|
+
return document.body;
|
|
37
|
+
}
|
|
38
|
+
var EMPTY_COMPONENT_OVERRIDES = Object.freeze({});
|
|
39
|
+
var VisualThemeContext = React3__namespace.createContext(null);
|
|
40
|
+
var ComponentOverridesContext = React3__namespace.createContext(
|
|
41
|
+
EMPTY_COMPONENT_OVERRIDES
|
|
42
|
+
);
|
|
43
|
+
var OwnerPortalThemeContext = React3__namespace.createContext(null);
|
|
44
|
+
var imperativeThemeChangeListeners = /* @__PURE__ */ new Set();
|
|
45
|
+
function subscribeImperativeThemeChange(listener) {
|
|
46
|
+
imperativeThemeChangeListeners.add(listener);
|
|
47
|
+
return () => imperativeThemeChangeListeners.delete(listener);
|
|
48
|
+
}
|
|
49
|
+
function notifyImperativeThemeChange(target) {
|
|
50
|
+
imperativeThemeChangeListeners.forEach((listener) => listener(target));
|
|
51
|
+
}
|
|
52
|
+
function mergeComponentOverride(parent, next) {
|
|
53
|
+
const styles = { ...parent?.styles ?? {} };
|
|
54
|
+
for (const [slot, style] of Object.entries(next.styles ?? {})) {
|
|
55
|
+
styles[slot] = { ...styles[slot] ?? {}, ...style };
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
...parent,
|
|
59
|
+
...next,
|
|
60
|
+
colors: { ...parent?.colors ?? {}, ...next.colors ?? {} },
|
|
61
|
+
tokens: { ...parent?.tokens ?? {}, ...next.tokens ?? {} },
|
|
62
|
+
styles
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function mergeComponentThemeOverrides(...sources) {
|
|
66
|
+
const result = {};
|
|
67
|
+
for (const source of sources) {
|
|
68
|
+
if (!source) continue;
|
|
69
|
+
for (const [name, override] of Object.entries(source)) {
|
|
70
|
+
if (!override) continue;
|
|
71
|
+
result[name] = mergeComponentOverride(result[name], override);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
function VisualThemeProvider({
|
|
77
|
+
value,
|
|
78
|
+
children
|
|
79
|
+
}) {
|
|
80
|
+
return /* @__PURE__ */ jsxRuntime.jsx(VisualThemeContext.Provider, { value, children });
|
|
81
|
+
}
|
|
82
|
+
function ComponentOverridesProvider({
|
|
83
|
+
value,
|
|
84
|
+
children
|
|
85
|
+
}) {
|
|
86
|
+
const inherited = React3__namespace.useContext(ComponentOverridesContext);
|
|
87
|
+
const merged = React3__namespace.useMemo(() => {
|
|
88
|
+
if (!value || Object.keys(value).length === 0) return inherited;
|
|
89
|
+
return mergeComponentThemeOverrides(inherited, value);
|
|
90
|
+
}, [inherited, value]);
|
|
91
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ComponentOverridesContext.Provider, { value: merged, children });
|
|
92
|
+
}
|
|
93
|
+
function OwnerPortalThemeProvider({
|
|
94
|
+
value,
|
|
95
|
+
children
|
|
96
|
+
}) {
|
|
97
|
+
return /* @__PURE__ */ jsxRuntime.jsx(OwnerPortalThemeContext.Provider, { value, children });
|
|
98
|
+
}
|
|
99
|
+
function useVisualThemeSnapshot() {
|
|
100
|
+
return React3__namespace.useContext(VisualThemeContext);
|
|
101
|
+
}
|
|
102
|
+
function useComponentOverrides() {
|
|
103
|
+
return React3__namespace.useContext(ComponentOverridesContext);
|
|
104
|
+
}
|
|
105
|
+
function useOwnerPortalTheme() {
|
|
106
|
+
return React3__namespace.useContext(OwnerPortalThemeContext);
|
|
107
|
+
}
|
|
108
|
+
var ACCENT_PRESETS = {
|
|
109
|
+
sky: { accent: "oklch(68% 0.14 235)", ink: "oklch(42% 0.12 235)", soft: "oklch(92% 0.04 235)", glow: "oklch(68% 0.14 235 / 0.35)" },
|
|
110
|
+
coral: { accent: "oklch(72% 0.16 35)", ink: "oklch(48% 0.14 35)", soft: "oklch(94% 0.04 35)", glow: "oklch(72% 0.16 35 / 0.35)" },
|
|
111
|
+
mint: { accent: "oklch(72% 0.13 165)", ink: "oklch(46% 0.11 165)", soft: "oklch(93% 0.04 165)", glow: "oklch(72% 0.13 165 / 0.35)" },
|
|
112
|
+
violet: { accent: "oklch(66% 0.16 290)", ink: "oklch(44% 0.14 290)", soft: "oklch(93% 0.04 290)", glow: "oklch(66% 0.16 290 / 0.35)" },
|
|
113
|
+
amber: { accent: "oklch(76% 0.14 75)", ink: "oklch(50% 0.12 75)", soft: "oklch(94% 0.05 75)", glow: "oklch(76% 0.14 75 / 0.35)" },
|
|
114
|
+
rose: { accent: "oklch(68% 0.17 10)", ink: "oklch(46% 0.15 10)", soft: "oklch(93% 0.04 10)", glow: "oklch(68% 0.17 10 / 0.35)" }
|
|
115
|
+
};
|
|
116
|
+
var ACCENT_PRESETS_DARK = {
|
|
117
|
+
sky: { soft: "oklch(35% 0.08 235)", ink: "oklch(82% 0.10 235)", glow: "oklch(68% 0.14 235 / 0.18)" },
|
|
118
|
+
coral: { soft: "oklch(38% 0.09 35)", ink: "oklch(84% 0.10 35)", glow: "oklch(72% 0.16 35 / 0.18)" },
|
|
119
|
+
mint: { soft: "oklch(36% 0.08 165)", ink: "oklch(83% 0.10 165)", glow: "oklch(72% 0.13 165 / 0.18)" },
|
|
120
|
+
violet: { soft: "oklch(36% 0.09 290)", ink: "oklch(82% 0.11 290)", glow: "oklch(66% 0.16 290 / 0.18)" },
|
|
121
|
+
amber: { soft: "oklch(38% 0.08 75)", ink: "oklch(85% 0.10 75)", glow: "oklch(76% 0.14 75 / 0.18)" },
|
|
122
|
+
rose: { soft: "oklch(38% 0.09 10)", ink: "oklch(84% 0.11 10)", glow: "oklch(68% 0.17 10 / 0.18)" }
|
|
123
|
+
};
|
|
124
|
+
var FONT_STACKS = {
|
|
125
|
+
system: '-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif',
|
|
126
|
+
sf: '"SF Pro Display", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif',
|
|
127
|
+
serif: 'Cambria, Georgia, "Songti SC", "STSong", serif',
|
|
128
|
+
mono: 'ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace'
|
|
129
|
+
};
|
|
130
|
+
var DEFAULT_CONFIG = {
|
|
131
|
+
mode: "light",
|
|
132
|
+
colorScheme: "light",
|
|
133
|
+
baseColor: void 0,
|
|
134
|
+
accent: "sky",
|
|
135
|
+
density: "comfortable",
|
|
136
|
+
intensity: 5,
|
|
137
|
+
radius: 20,
|
|
138
|
+
font: "sf",
|
|
139
|
+
colors: {},
|
|
140
|
+
tokens: {},
|
|
141
|
+
components: {},
|
|
142
|
+
themes: {},
|
|
143
|
+
accentExplicit: false
|
|
144
|
+
};
|
|
145
|
+
var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
|
|
146
|
+
var useIsomorphicLayoutEffect = isBrowser ? React3__namespace.useLayoutEffect : React3__namespace.useEffect;
|
|
147
|
+
function isThemeBaseMode(mode) {
|
|
148
|
+
return mode === "light" || mode === "dark";
|
|
149
|
+
}
|
|
150
|
+
function isBuiltInThemeMode(mode) {
|
|
151
|
+
return mode === "light" || mode === "dark" || mode === "system";
|
|
152
|
+
}
|
|
153
|
+
var TRANSIENT_THEME_MODES = /* @__PURE__ */ new Set(["__theme_panel_draft__"]);
|
|
154
|
+
function isTransientThemeMode(mode) {
|
|
155
|
+
return mode != null && TRANSIENT_THEME_MODES.has(mode);
|
|
156
|
+
}
|
|
157
|
+
function getThemePreset(themes, mode) {
|
|
158
|
+
if (!mode || isBuiltInThemeMode(mode)) return void 0;
|
|
159
|
+
return themes?.[mode];
|
|
160
|
+
}
|
|
161
|
+
function isThemePresetValueEqual(current, preset) {
|
|
162
|
+
if (current === preset) return true;
|
|
163
|
+
if (current == null || preset == null || typeof current !== "object" || typeof preset !== "object") {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
return JSON.stringify(current) === JSON.stringify(preset);
|
|
167
|
+
}
|
|
168
|
+
function clearActiveThemePreset(config) {
|
|
169
|
+
const preset = getThemePreset(config.themes, config.mode);
|
|
170
|
+
if (!preset) return config;
|
|
171
|
+
const next = { ...config };
|
|
172
|
+
const presetFields = [
|
|
173
|
+
["colorScheme", preset.base],
|
|
174
|
+
["baseColor", preset.baseColor],
|
|
175
|
+
["accent", preset.accent],
|
|
176
|
+
["density", preset.density],
|
|
177
|
+
["intensity", preset.intensity],
|
|
178
|
+
["radius", preset.radius],
|
|
179
|
+
["font", preset.font],
|
|
180
|
+
["colors", preset.colors],
|
|
181
|
+
["tokens", preset.tokens],
|
|
182
|
+
[
|
|
183
|
+
"components",
|
|
184
|
+
preset.components ? mergeComponentThemeOverrides(void 0, preset.components) : void 0
|
|
185
|
+
]
|
|
186
|
+
];
|
|
187
|
+
for (const [key, presetValue] of presetFields) {
|
|
188
|
+
if (presetValue !== void 0 && isThemePresetValueEqual(next[key], presetValue)) {
|
|
189
|
+
delete next[key];
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return next;
|
|
193
|
+
}
|
|
194
|
+
function applyThemePreset(config, mode) {
|
|
195
|
+
const base = clearActiveThemePreset(config);
|
|
196
|
+
const preset = getThemePreset(base.themes, mode);
|
|
197
|
+
if (!preset) {
|
|
198
|
+
return {
|
|
199
|
+
...base,
|
|
200
|
+
mode,
|
|
201
|
+
colorScheme: isThemeBaseMode(mode) ? mode : base.colorScheme
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
...base,
|
|
206
|
+
mode,
|
|
207
|
+
colorScheme: preset.base ?? base.colorScheme ?? DEFAULT_CONFIG.colorScheme,
|
|
208
|
+
baseColor: preset.baseColor ?? base.baseColor,
|
|
209
|
+
accent: preset.accent ?? base.accent,
|
|
210
|
+
density: preset.density ?? base.density,
|
|
211
|
+
intensity: preset.intensity ?? base.intensity,
|
|
212
|
+
radius: preset.radius ?? base.radius,
|
|
213
|
+
font: preset.font ?? base.font,
|
|
214
|
+
colors: preset.colors ? { ...preset.colors } : base.colors,
|
|
215
|
+
tokens: preset.tokens ? { ...preset.tokens } : base.tokens,
|
|
216
|
+
components: preset.components ? mergeComponentThemeOverrides(void 0, preset.components) : base.components
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function patchThemeConfig(current, patch) {
|
|
220
|
+
const themesChanged = Object.prototype.hasOwnProperty.call(patch, "themes");
|
|
221
|
+
const modeChanged = Object.prototype.hasOwnProperty.call(patch, "mode");
|
|
222
|
+
let base = themesChanged ? clearActiveThemePreset(current) : current;
|
|
223
|
+
if (themesChanged) {
|
|
224
|
+
base = { ...base, themes: patch.themes };
|
|
225
|
+
}
|
|
226
|
+
const mode = modeChanged ? patch.mode : base.mode;
|
|
227
|
+
const withMode = (modeChanged || themesChanged) && mode !== void 0 ? applyThemePreset(base, mode) : base;
|
|
228
|
+
return { ...withMode, ...patch };
|
|
229
|
+
}
|
|
230
|
+
function resolveThemeConfig(config) {
|
|
231
|
+
const mode = config.mode ?? DEFAULT_CONFIG.mode;
|
|
232
|
+
const themes = config.themes ?? DEFAULT_CONFIG.themes;
|
|
233
|
+
const preset = getThemePreset(themes, mode);
|
|
234
|
+
const accentExplicit = config.accent !== void 0 || preset?.accent !== void 0;
|
|
235
|
+
const presetConfig = preset ? {
|
|
236
|
+
...preset.base ? { colorScheme: preset.base } : null,
|
|
237
|
+
...preset.baseColor ? { baseColor: preset.baseColor } : null,
|
|
238
|
+
...preset.accent ? { accent: preset.accent } : null,
|
|
239
|
+
...preset.density ? { density: preset.density } : null,
|
|
240
|
+
...preset.intensity != null ? { intensity: preset.intensity } : null,
|
|
241
|
+
...preset.radius != null ? { radius: preset.radius } : null,
|
|
242
|
+
...preset.font ? { font: preset.font } : null
|
|
243
|
+
} : {};
|
|
244
|
+
const merged = {
|
|
245
|
+
...DEFAULT_CONFIG,
|
|
246
|
+
...presetConfig,
|
|
247
|
+
...config,
|
|
248
|
+
mode,
|
|
249
|
+
themes,
|
|
250
|
+
colors: {
|
|
251
|
+
...preset?.colors ?? {},
|
|
252
|
+
...config.colors ?? {}
|
|
253
|
+
},
|
|
254
|
+
components: mergeComponentThemeOverrides(preset?.components, config.components),
|
|
255
|
+
tokens: {
|
|
256
|
+
...preset?.tokens ?? {},
|
|
257
|
+
...config.tokens ?? {}
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
return {
|
|
261
|
+
...merged,
|
|
262
|
+
colorScheme: merged.colorScheme ?? preset?.base ?? DEFAULT_CONFIG.colorScheme,
|
|
263
|
+
baseColor: merged.baseColor ?? preset?.baseColor,
|
|
264
|
+
accent: merged.accent ?? preset?.accent ?? DEFAULT_CONFIG.accent,
|
|
265
|
+
density: merged.density ?? preset?.density ?? DEFAULT_CONFIG.density,
|
|
266
|
+
intensity: merged.intensity ?? preset?.intensity ?? DEFAULT_CONFIG.intensity,
|
|
267
|
+
radius: merged.radius ?? preset?.radius ?? DEFAULT_CONFIG.radius,
|
|
268
|
+
font: merged.font ?? preset?.font ?? DEFAULT_CONFIG.font,
|
|
269
|
+
accentExplicit
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
function resolveThemeMode(mode) {
|
|
273
|
+
if (mode !== "system") return mode;
|
|
274
|
+
if (!isBrowser) return "light";
|
|
275
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
276
|
+
}
|
|
277
|
+
function resolveThemeColorScheme(mode, themes, fallback) {
|
|
278
|
+
if (mode === "system") return fallback ?? resolveThemeMode(mode);
|
|
279
|
+
if (isThemeBaseMode(mode)) return mode;
|
|
280
|
+
return getThemePreset(themes, mode)?.base ?? fallback ?? DEFAULT_CONFIG.colorScheme;
|
|
281
|
+
}
|
|
282
|
+
function normalizeAccentInput(input, colorScheme) {
|
|
283
|
+
if (typeof input === "string" && input in ACCENT_PRESETS) {
|
|
284
|
+
const key = input;
|
|
285
|
+
const base = ACCENT_PRESETS[key];
|
|
286
|
+
if (colorScheme === "dark") {
|
|
287
|
+
return { key, palette: { ...base, ...ACCENT_PRESETS_DARK[key] } };
|
|
288
|
+
}
|
|
289
|
+
return { key, palette: base };
|
|
290
|
+
}
|
|
291
|
+
const raw = typeof input === "string" ? { accent: input } : input;
|
|
292
|
+
const { accent } = raw;
|
|
293
|
+
const ink = raw.ink ?? `color-mix(in oklch, ${accent} 65%, black)`;
|
|
294
|
+
const soft = raw.soft ?? (colorScheme === "dark" ? `color-mix(in oklch, ${accent} 30%, black)` : `color-mix(in oklch, ${accent} 15%, white)`);
|
|
295
|
+
const glow = raw.glow ?? (colorScheme === "dark" ? `color-mix(in oklch, ${accent} 18%, transparent)` : `color-mix(in oklch, ${accent} 35%, transparent)`);
|
|
296
|
+
return { key: "custom", palette: { accent, ink, soft, glow } };
|
|
297
|
+
}
|
|
298
|
+
var DEFAULT_THEME_COLORS = {
|
|
299
|
+
light: {
|
|
300
|
+
bg: "#e8eef5",
|
|
301
|
+
bgRaised: "#edf2f8",
|
|
302
|
+
bgSunken: "#dde4ed",
|
|
303
|
+
fg: "#3a4558",
|
|
304
|
+
fgMuted: "#7b8599",
|
|
305
|
+
fgSubtle: "#9ca7ba",
|
|
306
|
+
border: "rgba(130, 148, 175, 0.14)",
|
|
307
|
+
divider: "rgba(130, 148, 175, 0.18)",
|
|
308
|
+
shadowDark: "rgba(163, 177, 198, 0.55)",
|
|
309
|
+
shadowLight: "rgba(255, 255, 255, 0.95)",
|
|
310
|
+
accent: ACCENT_PRESETS.sky.accent,
|
|
311
|
+
accentInk: ACCENT_PRESETS.sky.ink,
|
|
312
|
+
accentSoft: ACCENT_PRESETS.sky.soft,
|
|
313
|
+
accentGlow: ACCENT_PRESETS.sky.glow,
|
|
314
|
+
info: "oklch(68% 0.14 235)",
|
|
315
|
+
success: "oklch(68% 0.14 150)",
|
|
316
|
+
warning: "oklch(75% 0.14 75)",
|
|
317
|
+
danger: "oklch(64% 0.18 25)"
|
|
318
|
+
},
|
|
319
|
+
dark: {
|
|
320
|
+
bg: "#1b2030",
|
|
321
|
+
bgRaised: "#242a3c",
|
|
322
|
+
bgSunken: "#151a27",
|
|
323
|
+
fg: "#d8deeb",
|
|
324
|
+
fgMuted: "#8b94ab",
|
|
325
|
+
fgSubtle: "#5f6a82",
|
|
326
|
+
border: "rgba(0, 0, 0, 0.35)",
|
|
327
|
+
divider: "rgba(255, 255, 255, 0.06)",
|
|
328
|
+
shadowDark: "rgba(0, 0, 0, 0.55)",
|
|
329
|
+
shadowLight: "rgba(130, 145, 180, 0.06)",
|
|
330
|
+
accent: ACCENT_PRESETS.sky.accent,
|
|
331
|
+
accentInk: ACCENT_PRESETS_DARK.sky.ink,
|
|
332
|
+
accentSoft: ACCENT_PRESETS_DARK.sky.soft,
|
|
333
|
+
accentGlow: ACCENT_PRESETS_DARK.sky.glow,
|
|
334
|
+
info: "oklch(78% 0.12 235)",
|
|
335
|
+
success: "oklch(78% 0.14 150)",
|
|
336
|
+
warning: "oklch(82% 0.14 75)",
|
|
337
|
+
danger: "oklch(76% 0.16 25)"
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
function mixColor(value, percent, other) {
|
|
341
|
+
return `color-mix(in srgb, ${value} ${percent}%, ${other})`;
|
|
342
|
+
}
|
|
343
|
+
function fadeColor(value, percent) {
|
|
344
|
+
return `color-mix(in srgb, ${value} ${percent}%, transparent)`;
|
|
345
|
+
}
|
|
346
|
+
function deriveThemeColors(baseColor, options = {}) {
|
|
347
|
+
const colorScheme = options.colorScheme ?? "light";
|
|
348
|
+
const dark = colorScheme === "dark";
|
|
349
|
+
const derivedAccent = dark ? mixColor(baseColor, 68, "white") : mixColor(baseColor, 62, "black");
|
|
350
|
+
const explicitAccent = options.accent ? normalizeAccentInput(options.accent, colorScheme).palette : null;
|
|
351
|
+
const accent = explicitAccent?.accent ?? derivedAccent;
|
|
352
|
+
return {
|
|
353
|
+
bg: baseColor,
|
|
354
|
+
bgRaised: mixColor(baseColor, dark ? 86 : 82, "white"),
|
|
355
|
+
bgSunken: mixColor(baseColor, dark ? 80 : 86, "black"),
|
|
356
|
+
fg: mixColor(baseColor, 18, dark ? "white" : "black"),
|
|
357
|
+
fgMuted: mixColor(baseColor, 38, dark ? "white" : "black"),
|
|
358
|
+
fgSubtle: mixColor(baseColor, 55, dark ? "white" : "black"),
|
|
359
|
+
border: mixColor(baseColor, 82, dark ? "white" : "black"),
|
|
360
|
+
divider: mixColor(baseColor, 88, dark ? "white" : "black"),
|
|
361
|
+
shadowDark: fadeColor(
|
|
362
|
+
mixColor(baseColor, dark ? 40 : 58, "black"),
|
|
363
|
+
dark ? 65 : 55
|
|
364
|
+
),
|
|
365
|
+
shadowLight: fadeColor(
|
|
366
|
+
mixColor(baseColor, dark ? 82 : 28, "white"),
|
|
367
|
+
dark ? 22 : 88
|
|
368
|
+
),
|
|
369
|
+
accent,
|
|
370
|
+
accentInk: explicitAccent?.ink ?? mixColor(accent, 65, dark ? "white" : "black"),
|
|
371
|
+
accentSoft: explicitAccent?.soft ?? mixColor(accent, dark ? 30 : 15, dark ? "black" : "white"),
|
|
372
|
+
accentGlow: explicitAccent?.glow ?? fadeColor(accent, dark ? 25 : 40)
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
var COLOR_TOKEN_KEYS = {
|
|
376
|
+
bg: "bg",
|
|
377
|
+
bgRaised: "bg-raised",
|
|
378
|
+
bgSunken: "bg-sunken",
|
|
379
|
+
fg: "fg",
|
|
380
|
+
fgMuted: "fg-muted",
|
|
381
|
+
fgSubtle: "fg-subtle",
|
|
382
|
+
border: "border",
|
|
383
|
+
divider: "divider",
|
|
384
|
+
shadowDark: "shadow-dark",
|
|
385
|
+
shadowLight: "shadow-light",
|
|
386
|
+
accent: "accent",
|
|
387
|
+
accentInk: "accent-ink",
|
|
388
|
+
accentSoft: "accent-soft",
|
|
389
|
+
accentGlow: "accent-glow",
|
|
390
|
+
info: "info",
|
|
391
|
+
success: "success",
|
|
392
|
+
warning: "warning",
|
|
393
|
+
danger: "danger"
|
|
394
|
+
};
|
|
395
|
+
function hasAccentColorOverride(config) {
|
|
396
|
+
return ["accent", "accentInk", "accentSoft", "accentGlow"].some((key) => {
|
|
397
|
+
const tokenKey = COLOR_TOKEN_KEYS[key];
|
|
398
|
+
return config.colors?.[key] !== void 0 || config.tokens?.[tokenKey] !== void 0 || config.tokens?.[`--${tokenKey}`] !== void 0;
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
function resolveThemeColors(config, colorScheme, inherited) {
|
|
402
|
+
const fallback = inherited ?? DEFAULT_THEME_COLORS[colorScheme];
|
|
403
|
+
const surface = config.baseColor ? deriveThemeColors(config.baseColor, { colorScheme, accent: config.accent }) : { ...fallback };
|
|
404
|
+
if (!config.baseColor && config.accent) {
|
|
405
|
+
const palette = normalizeAccentInput(config.accent, colorScheme).palette;
|
|
406
|
+
surface.accent = palette.accent;
|
|
407
|
+
surface.accentInk = palette.ink;
|
|
408
|
+
surface.accentSoft = palette.soft;
|
|
409
|
+
surface.accentGlow = palette.glow;
|
|
410
|
+
}
|
|
411
|
+
const resolved = {
|
|
412
|
+
...fallback,
|
|
413
|
+
...surface,
|
|
414
|
+
...config.colors ?? {}
|
|
415
|
+
};
|
|
416
|
+
for (const [colorKey, tokenKey] of Object.entries(COLOR_TOKEN_KEYS)) {
|
|
417
|
+
const value = config.tokens?.[tokenKey] ?? config.tokens?.[`--${tokenKey}`];
|
|
418
|
+
if (value !== void 0) resolved[colorKey] = value;
|
|
419
|
+
}
|
|
420
|
+
return resolved;
|
|
421
|
+
}
|
|
422
|
+
function themeColorsToStyle(colors, prefix = "") {
|
|
423
|
+
const style = {};
|
|
424
|
+
for (const [colorKey, tokenKey] of Object.entries(COLOR_TOKEN_KEYS)) {
|
|
425
|
+
style[`--${prefix}${tokenKey}`] = colors[colorKey];
|
|
426
|
+
}
|
|
427
|
+
return style;
|
|
428
|
+
}
|
|
429
|
+
function themeTokenToKebabCase(value) {
|
|
430
|
+
return value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
|
|
431
|
+
}
|
|
432
|
+
function visualThemeToStyle(snapshot, prefix = "") {
|
|
433
|
+
const style = themeColorsToStyle(snapshot.colors, prefix);
|
|
434
|
+
const variable = (name) => `--${prefix}${name}`;
|
|
435
|
+
const reference = (name) => `var(${variable(name)})`;
|
|
436
|
+
const inheritedReference = (name) => prefix ? `var(${variable(name)}, var(--${name}))` : `var(--${name})`;
|
|
437
|
+
const d = 0.4 + snapshot.intensity * 0.12;
|
|
438
|
+
const dark = snapshot.colorScheme === "dark";
|
|
439
|
+
style[variable("d")] = String(d);
|
|
440
|
+
style[variable("shadow-offset")] = `calc(${dark ? 4 : 6}px * ${reference("d")} * ${inheritedReference("shadow-scale")})`;
|
|
441
|
+
style[variable("shadow-blur")] = `calc(${dark ? 10 : 16}px * ${reference("d")} * ${inheritedReference("shadow-scale")})`;
|
|
442
|
+
style[variable("shadow-inset-offset")] = `calc(${dark ? 3 : 4}px * ${reference("d")} * ${inheritedReference("shadow-scale")})`;
|
|
443
|
+
style[variable("shadow-inset-blur")] = `calc(${dark ? 7 : 10}px * ${reference("d")} * ${inheritedReference("shadow-scale")})`;
|
|
444
|
+
style[variable("neu-shadow-panel")] = `${reference("shadow-offset")} ${reference("shadow-offset")} ${reference("shadow-blur")} ${reference("shadow-dark")}, calc(${reference("shadow-offset")} * -1) calc(${reference("shadow-offset")} * -1) ${reference("shadow-blur")} ${reference("shadow-light")}`;
|
|
445
|
+
style[variable("neu-shadow-control")] = `calc(${reference("shadow-offset")} * .5) calc(${reference("shadow-offset")} * .5) calc(${reference("shadow-blur")} * .6) ${reference("shadow-dark")}, calc(${reference("shadow-offset")} * -.5) calc(${reference("shadow-offset")} * -.5) calc(${reference("shadow-blur")} * .6) ${reference("shadow-light")}`;
|
|
446
|
+
style[variable("neu-shadow-lift")] = `calc(${reference("shadow-offset")} * 1.6) calc(${reference("shadow-offset")} * 1.6) calc(${reference("shadow-blur")} * 1.4) ${reference("shadow-dark")}, calc(${reference("shadow-offset")} * -1.6) calc(${reference("shadow-offset")} * -1.6) calc(${reference("shadow-blur")} * 1.4) ${reference("shadow-light")}`;
|
|
447
|
+
style[variable("neu-shadow-inset-strong")] = `inset ${reference("shadow-inset-offset")} ${reference("shadow-inset-offset")} ${reference("shadow-inset-blur")} ${reference("shadow-dark")}, inset calc(${reference("shadow-inset-offset")} * -1) calc(${reference("shadow-inset-offset")} * -1) ${reference("shadow-inset-blur")} ${reference("shadow-light")}`;
|
|
448
|
+
style[variable("neu-shadow-inset")] = `inset calc(${reference("shadow-inset-offset")} * .6) calc(${reference("shadow-inset-offset")} * .6) calc(${reference("shadow-inset-blur")} * .6) ${reference("shadow-dark")}, inset calc(${reference("shadow-inset-offset")} * -.6) calc(${reference("shadow-inset-offset")} * -.6) calc(${reference("shadow-inset-blur")} * .6) ${reference("shadow-light")}`;
|
|
449
|
+
style[variable("neu-shadow-subtle")] = `1px 1px 2px ${reference("shadow-dark")}, -1px -1px 2px ${reference("shadow-light")}`;
|
|
450
|
+
style[variable("neu-shadow-float")] = `0 calc(${reference("shadow-offset")} * 1.8 * ${inheritedReference("shadow-float-scale")}) calc(${reference("shadow-blur")} * 2.2 * ${inheritedReference("shadow-float-scale")}) ${reference("shadow-dark")}, 0 calc(${reference("shadow-offset")} * .4 * ${inheritedReference("shadow-float-scale")}) calc(${reference("shadow-blur")} * .7 * ${inheritedReference("shadow-float-scale")}) ${reference("shadow-dark")}`;
|
|
451
|
+
style[variable("neu-out")] = reference("neu-shadow-panel");
|
|
452
|
+
style[variable("neu-out-sm")] = reference("neu-shadow-control");
|
|
453
|
+
style[variable("neu-out-lg")] = reference("neu-shadow-lift");
|
|
454
|
+
style[variable("neu-in")] = reference("neu-shadow-inset-strong");
|
|
455
|
+
style[variable("neu-in-sm")] = reference("neu-shadow-inset");
|
|
456
|
+
style[variable("neu-flat")] = reference("neu-shadow-subtle");
|
|
457
|
+
style[variable("neu-float")] = reference("neu-shadow-float");
|
|
458
|
+
return style;
|
|
459
|
+
}
|
|
460
|
+
function componentTokensToStyle(tokens, prefix) {
|
|
461
|
+
if (!tokens) return {};
|
|
462
|
+
const style = {};
|
|
463
|
+
for (const [key, value] of Object.entries(tokens)) {
|
|
464
|
+
const property = key.startsWith("--") ? key : `--${prefix}${themeTokenToKebabCase(key)}`;
|
|
465
|
+
style[property] = value;
|
|
466
|
+
}
|
|
467
|
+
return style;
|
|
468
|
+
}
|
|
469
|
+
function resolveVisualThemeSnapshot(config, inherited) {
|
|
470
|
+
const colorScheme = config.colorScheme ?? inherited?.colorScheme ?? "light";
|
|
471
|
+
const inheritedColors = inherited?.colorScheme === colorScheme ? inherited.colors : DEFAULT_THEME_COLORS[colorScheme];
|
|
472
|
+
return {
|
|
473
|
+
colorScheme,
|
|
474
|
+
intensity: config.intensity ?? inherited?.intensity ?? DEFAULT_CONFIG.intensity,
|
|
475
|
+
colors: resolveThemeColors(config, colorScheme, inheritedColors)
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
function toVar(key) {
|
|
479
|
+
return key.startsWith("--") ? key : `--${key}`;
|
|
480
|
+
}
|
|
481
|
+
var LEGACY_SHADOW_TOKEN_ALIASES = {
|
|
482
|
+
"--neu-flat": "--neu-shadow-subtle",
|
|
483
|
+
"--neu-out-sm": "--neu-shadow-control",
|
|
484
|
+
"--neu-out": "--neu-shadow-panel",
|
|
485
|
+
"--neu-out-lg": "--neu-shadow-lift",
|
|
486
|
+
"--neu-in-sm": "--neu-shadow-inset",
|
|
487
|
+
"--neu-in": "--neu-shadow-inset-strong",
|
|
488
|
+
"--neu-float": "--neu-shadow-float"
|
|
489
|
+
};
|
|
490
|
+
function resolvedThemeConfigToStyle(config, snapshot) {
|
|
491
|
+
const style = { ...visualThemeToStyle(snapshot) };
|
|
492
|
+
const radius = config.radius ?? DEFAULT_CONFIG.radius;
|
|
493
|
+
style["--r-xs"] = `${Math.max(4, radius - 16)}px`;
|
|
494
|
+
style["--r-sm"] = `${Math.max(6, radius - 12)}px`;
|
|
495
|
+
style["--r-md"] = `${Math.max(8, radius - 6)}px`;
|
|
496
|
+
style["--r-lg"] = `${radius}px`;
|
|
497
|
+
style["--r-xl"] = `${radius + 10}px`;
|
|
498
|
+
const font = config.font ?? DEFAULT_CONFIG.font;
|
|
499
|
+
if (typeof font === "string") {
|
|
500
|
+
style["--font-sans"] = FONT_STACKS[font] ?? font;
|
|
501
|
+
if (font === "mono") style["--font-display"] = FONT_STACKS.mono;
|
|
502
|
+
} else {
|
|
503
|
+
if (font.sans) style["--font-sans"] = font.sans;
|
|
504
|
+
if (font.display) style["--font-display"] = font.display;
|
|
505
|
+
if (font.mono) style["--font-mono"] = font.mono;
|
|
506
|
+
}
|
|
507
|
+
const tokenVars = new Set(Object.keys(config.tokens).map(toVar));
|
|
508
|
+
for (const [key, value] of Object.entries(config.tokens)) {
|
|
509
|
+
const variable = toVar(key);
|
|
510
|
+
const semanticAlias = LEGACY_SHADOW_TOKEN_ALIASES[variable];
|
|
511
|
+
if (semanticAlias && !tokenVars.has(semanticAlias)) {
|
|
512
|
+
style[semanticAlias] = value;
|
|
513
|
+
}
|
|
514
|
+
style[variable] = value;
|
|
515
|
+
}
|
|
516
|
+
return style;
|
|
517
|
+
}
|
|
518
|
+
function resolvedThemeConfigToDataAttributes(config, colorScheme) {
|
|
519
|
+
const accentResult = normalizeAccentInput(config.accent, colorScheme);
|
|
520
|
+
const hidesAccent = config.baseColor && !config.accentExplicit || accentResult.key === "custom" || hasAccentColorOverride(config);
|
|
521
|
+
return {
|
|
522
|
+
"data-theme": colorScheme,
|
|
523
|
+
"data-theme-mode": config.mode,
|
|
524
|
+
"data-density": config.density,
|
|
525
|
+
"data-accent": hidesAccent ? void 0 : accentResult.key
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
var imperativeThemeStyleKeys = /* @__PURE__ */ new WeakMap();
|
|
529
|
+
var ROOT_THEME_ATTRIBUTES = [
|
|
530
|
+
"data-theme",
|
|
531
|
+
"data-theme-mode",
|
|
532
|
+
"data-density",
|
|
533
|
+
"data-accent"
|
|
534
|
+
];
|
|
535
|
+
function createRootThemeMutationState(target) {
|
|
536
|
+
const previousImperativeStyleKeys = imperativeThemeStyleKeys.get(target);
|
|
537
|
+
const styles = /* @__PURE__ */ new Map();
|
|
538
|
+
previousImperativeStyleKeys?.forEach((property) => {
|
|
539
|
+
styles.set(property, {
|
|
540
|
+
value: target.style.getPropertyValue(property),
|
|
541
|
+
priority: target.style.getPropertyPriority(property)
|
|
542
|
+
});
|
|
543
|
+
});
|
|
544
|
+
return {
|
|
545
|
+
target,
|
|
546
|
+
attributes: new Map(
|
|
547
|
+
ROOT_THEME_ATTRIBUTES.map((attribute) => [attribute, target.getAttribute(attribute)])
|
|
548
|
+
),
|
|
549
|
+
styles,
|
|
550
|
+
activeStyleKeys: /* @__PURE__ */ new Set(),
|
|
551
|
+
previousImperativeStyleKeys: previousImperativeStyleKeys ? new Set(previousImperativeStyleKeys) : void 0
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
function restoreRootThemeStyleProperty(state, property) {
|
|
555
|
+
const snapshot = state.styles.get(property);
|
|
556
|
+
if (!snapshot || snapshot.value === "") {
|
|
557
|
+
state.target.style.removeProperty(property);
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
state.target.style.setProperty(property, snapshot.value, snapshot.priority);
|
|
561
|
+
}
|
|
562
|
+
function applyProviderThemeToRoot(state, config, style) {
|
|
563
|
+
const nextStyleKeys = new Set(Object.keys(style));
|
|
564
|
+
for (const property of nextStyleKeys) {
|
|
565
|
+
if (state.styles.has(property)) continue;
|
|
566
|
+
state.styles.set(property, {
|
|
567
|
+
value: state.target.style.getPropertyValue(property),
|
|
568
|
+
priority: state.target.style.getPropertyPriority(property)
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
const removedStyleKeys = [...state.activeStyleKeys].filter(
|
|
572
|
+
(property) => !nextStyleKeys.has(property)
|
|
573
|
+
);
|
|
574
|
+
applyTheme(state.target, config);
|
|
575
|
+
removedStyleKeys.forEach((property) => restoreRootThemeStyleProperty(state, property));
|
|
576
|
+
state.activeStyleKeys = nextStyleKeys;
|
|
577
|
+
}
|
|
578
|
+
function restoreRootThemeMutationState(state) {
|
|
579
|
+
state.styles.forEach((_snapshot, property) => {
|
|
580
|
+
restoreRootThemeStyleProperty(state, property);
|
|
581
|
+
});
|
|
582
|
+
state.attributes.forEach((value, attribute) => {
|
|
583
|
+
if (value === null) state.target.removeAttribute(attribute);
|
|
584
|
+
else state.target.setAttribute(attribute, value);
|
|
585
|
+
});
|
|
586
|
+
if (state.previousImperativeStyleKeys) {
|
|
587
|
+
imperativeThemeStyleKeys.set(state.target, state.previousImperativeStyleKeys);
|
|
588
|
+
} else {
|
|
589
|
+
imperativeThemeStyleKeys.delete(state.target);
|
|
590
|
+
}
|
|
591
|
+
notifyImperativeThemeChange(state.target);
|
|
592
|
+
}
|
|
593
|
+
function applyTheme(target, config) {
|
|
594
|
+
const cfg = resolveThemeConfig(config);
|
|
595
|
+
const colorScheme = resolveThemeColorScheme(cfg.mode, cfg.themes, cfg.colorScheme);
|
|
596
|
+
const snapshot = resolveVisualThemeSnapshot({
|
|
597
|
+
baseColor: cfg.baseColor,
|
|
598
|
+
colorScheme,
|
|
599
|
+
accent: cfg.accentExplicit ? cfg.accent : void 0,
|
|
600
|
+
intensity: cfg.intensity,
|
|
601
|
+
colors: cfg.colors,
|
|
602
|
+
tokens: cfg.tokens
|
|
603
|
+
});
|
|
604
|
+
const dataAttributes = resolvedThemeConfigToDataAttributes(cfg, colorScheme);
|
|
605
|
+
for (const [attribute, value] of Object.entries(dataAttributes)) {
|
|
606
|
+
if (value === void 0) target.removeAttribute(attribute);
|
|
607
|
+
else target.setAttribute(attribute, value);
|
|
608
|
+
}
|
|
609
|
+
const style = resolvedThemeConfigToStyle(cfg, snapshot);
|
|
610
|
+
const nextStyleKeys = new Set(Object.keys(style));
|
|
611
|
+
for (const property of imperativeThemeStyleKeys.get(target) ?? []) {
|
|
612
|
+
if (!nextStyleKeys.has(property)) target.style.removeProperty(property);
|
|
613
|
+
}
|
|
614
|
+
for (const [property, value] of Object.entries(style)) {
|
|
615
|
+
target.style.setProperty(property, value);
|
|
616
|
+
}
|
|
617
|
+
imperativeThemeStyleKeys.set(target, nextStyleKeys);
|
|
618
|
+
notifyImperativeThemeChange(target);
|
|
619
|
+
}
|
|
620
|
+
var ThemeCtx = React3__namespace.createContext(null);
|
|
621
|
+
var ThemeInheritanceCtx = React3__namespace.createContext(void 0);
|
|
622
|
+
function useTheme() {
|
|
623
|
+
const ctx = React3__namespace.useContext(ThemeCtx);
|
|
624
|
+
if (!ctx) {
|
|
625
|
+
throw new Error(
|
|
626
|
+
"useTheme() must be used inside <ThemeProvider>. Wrap your app (or a subtree) with <ThemeProvider>."
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
return ctx;
|
|
630
|
+
}
|
|
631
|
+
function useThemeOptional() {
|
|
632
|
+
return React3__namespace.useContext(ThemeCtx);
|
|
633
|
+
}
|
|
634
|
+
function mergeThemeConfigs(inherited, local) {
|
|
635
|
+
const merged = { ...inherited ?? {} };
|
|
636
|
+
const themes = { ...inherited?.themes ?? {}, ...local.themes ?? {} };
|
|
637
|
+
const mode = local.mode ?? inherited?.mode;
|
|
638
|
+
const localDefinesActivePreset = mode !== void 0 && local.themes !== void 0 && Object.prototype.hasOwnProperty.call(local.themes, mode);
|
|
639
|
+
const preset = mode !== void 0 && (local.mode !== void 0 || localDefinesActivePreset) ? getThemePreset(themes, mode) : void 0;
|
|
640
|
+
if (mode !== void 0) merged.mode = mode;
|
|
641
|
+
if (local.mode !== void 0 && isThemeBaseMode(mode)) {
|
|
642
|
+
merged.colorScheme = mode;
|
|
643
|
+
}
|
|
644
|
+
if (preset) {
|
|
645
|
+
if (preset.base !== void 0) merged.colorScheme = preset.base;
|
|
646
|
+
if (preset.baseColor !== void 0) merged.baseColor = preset.baseColor;
|
|
647
|
+
if (preset.accent !== void 0) merged.accent = preset.accent;
|
|
648
|
+
if (preset.density !== void 0) merged.density = preset.density;
|
|
649
|
+
if (preset.intensity !== void 0) merged.intensity = preset.intensity;
|
|
650
|
+
if (preset.radius !== void 0) merged.radius = preset.radius;
|
|
651
|
+
if (preset.font !== void 0) merged.font = preset.font;
|
|
652
|
+
}
|
|
653
|
+
const scalarKeys = [
|
|
654
|
+
"mode",
|
|
655
|
+
"colorScheme",
|
|
656
|
+
"baseColor",
|
|
657
|
+
"accent",
|
|
658
|
+
"density",
|
|
659
|
+
"intensity",
|
|
660
|
+
"radius",
|
|
661
|
+
"font"
|
|
662
|
+
];
|
|
663
|
+
for (const key of scalarKeys) {
|
|
664
|
+
const value = local[key];
|
|
665
|
+
if (value !== void 0) {
|
|
666
|
+
merged[key] = value;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
if ((local.baseColor !== void 0 || preset?.baseColor !== void 0) && local.accent === void 0 && preset?.accent === void 0) {
|
|
670
|
+
delete merged.accent;
|
|
671
|
+
}
|
|
672
|
+
const inheritedColors = { ...inherited?.colors ?? {} };
|
|
673
|
+
const inheritedTokens = { ...inherited?.tokens ?? {} };
|
|
674
|
+
const resetColorKeys = /* @__PURE__ */ new Set();
|
|
675
|
+
if (local.baseColor !== void 0 || preset?.baseColor !== void 0) {
|
|
676
|
+
for (const key of Object.keys(COLOR_TOKEN_KEYS)) {
|
|
677
|
+
resetColorKeys.add(key);
|
|
678
|
+
}
|
|
679
|
+
} else {
|
|
680
|
+
for (const key of [
|
|
681
|
+
...Object.keys(preset?.colors ?? {}),
|
|
682
|
+
...Object.keys(local.colors ?? {})
|
|
683
|
+
]) {
|
|
684
|
+
resetColorKeys.add(key);
|
|
685
|
+
}
|
|
686
|
+
if (local.accent !== void 0 || preset?.accent !== void 0) {
|
|
687
|
+
resetColorKeys.add("accent");
|
|
688
|
+
resetColorKeys.add("accentInk");
|
|
689
|
+
resetColorKeys.add("accentSoft");
|
|
690
|
+
resetColorKeys.add("accentGlow");
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
for (const key of resetColorKeys) {
|
|
694
|
+
delete inheritedColors[key];
|
|
695
|
+
const tokenKey = COLOR_TOKEN_KEYS[key];
|
|
696
|
+
delete inheritedTokens[tokenKey];
|
|
697
|
+
delete inheritedTokens[`--${tokenKey}`];
|
|
698
|
+
}
|
|
699
|
+
merged.colors = {
|
|
700
|
+
...inheritedColors,
|
|
701
|
+
...preset?.colors ?? {},
|
|
702
|
+
...local.colors ?? {}
|
|
703
|
+
};
|
|
704
|
+
merged.tokens = {
|
|
705
|
+
...inheritedTokens,
|
|
706
|
+
...preset?.tokens ?? {},
|
|
707
|
+
...local.tokens ?? {}
|
|
708
|
+
};
|
|
709
|
+
merged.components = mergeComponentThemeOverrides(
|
|
710
|
+
inherited?.components,
|
|
711
|
+
preset?.components,
|
|
712
|
+
local.components
|
|
713
|
+
);
|
|
714
|
+
merged.themes = themes;
|
|
715
|
+
return merged;
|
|
716
|
+
}
|
|
717
|
+
var THEME_STORAGE_VERSION = 1;
|
|
718
|
+
function isPersistedThemeEnvelope(value) {
|
|
719
|
+
if (!value || typeof value !== "object") return false;
|
|
720
|
+
const candidate = value;
|
|
721
|
+
return typeof candidate.version === "number" && !!candidate.config && typeof candidate.config === "object";
|
|
722
|
+
}
|
|
723
|
+
function loadPersisted(key) {
|
|
724
|
+
if (!key || !isBrowser) return null;
|
|
725
|
+
try {
|
|
726
|
+
const raw = localStorage.getItem(key);
|
|
727
|
+
if (!raw) return null;
|
|
728
|
+
const parsed = JSON.parse(raw);
|
|
729
|
+
const persisted = isPersistedThemeEnvelope(parsed) ? parsed.config : parsed;
|
|
730
|
+
if (isTransientThemeMode(persisted.mode)) {
|
|
731
|
+
localStorage.removeItem(key);
|
|
732
|
+
return null;
|
|
733
|
+
}
|
|
734
|
+
return persisted;
|
|
735
|
+
} catch {
|
|
736
|
+
return null;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
function persist(key, cfg) {
|
|
740
|
+
if (!key || !isBrowser) return;
|
|
741
|
+
if (isTransientThemeMode(cfg.mode)) return;
|
|
742
|
+
try {
|
|
743
|
+
const payload = {
|
|
744
|
+
version: THEME_STORAGE_VERSION,
|
|
745
|
+
config: cfg
|
|
746
|
+
};
|
|
747
|
+
localStorage.setItem(key, JSON.stringify(payload));
|
|
748
|
+
} catch {
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
function applyExplicitThemeProps(base, props) {
|
|
752
|
+
return {
|
|
753
|
+
...base,
|
|
754
|
+
...props.mode !== void 0 ? { mode: props.mode } : null,
|
|
755
|
+
...props.colorScheme !== void 0 ? { colorScheme: props.colorScheme } : null,
|
|
756
|
+
...props.baseColor !== void 0 ? { baseColor: props.baseColor } : null,
|
|
757
|
+
...props.accent !== void 0 ? { accent: props.accent } : null,
|
|
758
|
+
...props.density !== void 0 ? { density: props.density } : null,
|
|
759
|
+
...props.intensity !== void 0 ? { intensity: props.intensity } : null,
|
|
760
|
+
...props.radius !== void 0 ? { radius: props.radius } : null,
|
|
761
|
+
...props.font !== void 0 ? { font: props.font } : null,
|
|
762
|
+
...props.colors !== void 0 ? { colors: props.colors } : null,
|
|
763
|
+
...props.tokens !== void 0 ? { tokens: props.tokens } : null,
|
|
764
|
+
...props.components !== void 0 ? { components: props.components } : null,
|
|
765
|
+
...props.themes !== void 0 ? { themes: props.themes } : null
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
function createThemeConfigFromProps(props, includeDefaults = true) {
|
|
769
|
+
if (!includeDefaults) {
|
|
770
|
+
return applyExplicitThemeProps({}, props);
|
|
771
|
+
}
|
|
772
|
+
const mode = props.mode ?? DEFAULT_CONFIG.mode;
|
|
773
|
+
const fromProps = {
|
|
774
|
+
mode,
|
|
775
|
+
colorScheme: props.colorScheme,
|
|
776
|
+
baseColor: props.baseColor,
|
|
777
|
+
accent: props.accent,
|
|
778
|
+
density: props.density ?? DEFAULT_CONFIG.density,
|
|
779
|
+
intensity: props.intensity ?? DEFAULT_CONFIG.intensity,
|
|
780
|
+
radius: props.radius ?? DEFAULT_CONFIG.radius,
|
|
781
|
+
font: props.font ?? DEFAULT_CONFIG.font,
|
|
782
|
+
colors: props.colors ?? {},
|
|
783
|
+
tokens: props.tokens ?? {},
|
|
784
|
+
components: props.components ?? {},
|
|
785
|
+
themes: props.themes ?? DEFAULT_CONFIG.themes
|
|
786
|
+
};
|
|
787
|
+
return applyExplicitThemeProps(applyThemePreset(fromProps, mode), props);
|
|
788
|
+
}
|
|
789
|
+
function mergeThemeScopeRefs(internalRef, childRef) {
|
|
790
|
+
return (node) => {
|
|
791
|
+
internalRef.current = node;
|
|
792
|
+
if (typeof childRef === "function") childRef(node);
|
|
793
|
+
else if (childRef) {
|
|
794
|
+
childRef.current = node;
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
var ThemeProvider = (props) => {
|
|
799
|
+
const {
|
|
800
|
+
children,
|
|
801
|
+
enabled = true,
|
|
802
|
+
target = "root",
|
|
803
|
+
as: Tag = "div",
|
|
804
|
+
asChild = false,
|
|
805
|
+
className,
|
|
806
|
+
style,
|
|
807
|
+
storageKey,
|
|
808
|
+
onChange,
|
|
809
|
+
...configProps
|
|
810
|
+
} = props;
|
|
811
|
+
const inheritedConfig = React3__namespace.useContext(ThemeInheritanceCtx);
|
|
812
|
+
const inheritedThemeValue = React3__namespace.useContext(ThemeCtx);
|
|
813
|
+
const inheritedVisualSnapshot = useVisualThemeSnapshot();
|
|
814
|
+
const inheritedPortalContainer = usePortalContainer();
|
|
815
|
+
const hasInheritedTheme = inheritedConfig !== void 0;
|
|
816
|
+
const initialConfig = React3__namespace.useMemo(() => {
|
|
817
|
+
const fromProps = createThemeConfigFromProps(configProps, !hasInheritedTheme);
|
|
818
|
+
const persisted = loadPersisted(storageKey);
|
|
819
|
+
const withExplicitProps = fromProps;
|
|
820
|
+
if (!persisted) return withExplicitProps;
|
|
821
|
+
let persistedForMerge = persisted;
|
|
822
|
+
if (configProps.themes !== void 0) {
|
|
823
|
+
const { themes: _persistedThemes, ...rest } = persisted;
|
|
824
|
+
persistedForMerge = rest;
|
|
825
|
+
}
|
|
826
|
+
const persistedMode = persistedForMerge.mode ?? withExplicitProps.mode;
|
|
827
|
+
const presetBase = persistedMode === void 0 ? withExplicitProps : applyThemePreset(
|
|
828
|
+
{ ...withExplicitProps, mode: persistedMode },
|
|
829
|
+
persistedMode
|
|
830
|
+
);
|
|
831
|
+
const withPersisted = {
|
|
832
|
+
...presetBase,
|
|
833
|
+
...persistedForMerge,
|
|
834
|
+
...configProps.themes !== void 0 ? { themes: configProps.themes } : null
|
|
835
|
+
};
|
|
836
|
+
const withControlledThemePreset = configProps.themes !== void 0 && persistedMode !== void 0 && !isBuiltInThemeMode(persistedMode) ? applyThemePreset(withPersisted, persistedMode) : withPersisted;
|
|
837
|
+
return applyExplicitThemeProps(withControlledThemePreset, configProps);
|
|
838
|
+
}, []);
|
|
839
|
+
const [config, setConfig] = React3__namespace.useState(initialConfig);
|
|
840
|
+
const previousPropsRef = React3__namespace.useRef({
|
|
841
|
+
mode: configProps.mode,
|
|
842
|
+
colorScheme: configProps.colorScheme,
|
|
843
|
+
baseColor: configProps.baseColor,
|
|
844
|
+
accent: configProps.accent,
|
|
845
|
+
density: configProps.density,
|
|
846
|
+
intensity: configProps.intensity,
|
|
847
|
+
radius: configProps.radius,
|
|
848
|
+
font: configProps.font,
|
|
849
|
+
colors: configProps.colors,
|
|
850
|
+
tokens: configProps.tokens,
|
|
851
|
+
components: configProps.components,
|
|
852
|
+
themes: configProps.themes
|
|
853
|
+
});
|
|
854
|
+
React3__namespace.useEffect(() => {
|
|
855
|
+
const previous = previousPropsRef.current;
|
|
856
|
+
const changedProps = {};
|
|
857
|
+
const assignIfChanged = (key, value2) => {
|
|
858
|
+
if (value2 !== previous[key]) changedProps[key] = value2;
|
|
859
|
+
};
|
|
860
|
+
assignIfChanged("mode", configProps.mode);
|
|
861
|
+
assignIfChanged("colorScheme", configProps.colorScheme);
|
|
862
|
+
assignIfChanged("baseColor", configProps.baseColor);
|
|
863
|
+
assignIfChanged("accent", configProps.accent);
|
|
864
|
+
assignIfChanged("density", configProps.density);
|
|
865
|
+
assignIfChanged("intensity", configProps.intensity);
|
|
866
|
+
assignIfChanged("radius", configProps.radius);
|
|
867
|
+
assignIfChanged("font", configProps.font);
|
|
868
|
+
assignIfChanged("colors", configProps.colors);
|
|
869
|
+
assignIfChanged("tokens", configProps.tokens);
|
|
870
|
+
assignIfChanged("components", configProps.components);
|
|
871
|
+
assignIfChanged("themes", configProps.themes);
|
|
872
|
+
previousPropsRef.current = {
|
|
873
|
+
mode: configProps.mode,
|
|
874
|
+
colorScheme: configProps.colorScheme,
|
|
875
|
+
baseColor: configProps.baseColor,
|
|
876
|
+
accent: configProps.accent,
|
|
877
|
+
density: configProps.density,
|
|
878
|
+
intensity: configProps.intensity,
|
|
879
|
+
radius: configProps.radius,
|
|
880
|
+
font: configProps.font,
|
|
881
|
+
colors: configProps.colors,
|
|
882
|
+
tokens: configProps.tokens,
|
|
883
|
+
components: configProps.components,
|
|
884
|
+
themes: configProps.themes
|
|
885
|
+
};
|
|
886
|
+
if (Object.keys(changedProps).length === 0) return;
|
|
887
|
+
setConfig((c) => {
|
|
888
|
+
const currentBase = Object.prototype.hasOwnProperty.call(changedProps, "themes") ? clearActiveThemePreset(c) : c;
|
|
889
|
+
const base = {
|
|
890
|
+
...currentBase,
|
|
891
|
+
...Object.prototype.hasOwnProperty.call(changedProps, "themes") ? { themes: configProps.themes ?? DEFAULT_CONFIG.themes } : null
|
|
892
|
+
};
|
|
893
|
+
const fallbackMode = hasInheritedTheme ? void 0 : DEFAULT_CONFIG.mode;
|
|
894
|
+
const mode = Object.prototype.hasOwnProperty.call(changedProps, "mode") ? configProps.mode ?? fallbackMode : c.mode ?? fallbackMode;
|
|
895
|
+
const shouldApplyPreset = mode !== void 0 && (Object.prototype.hasOwnProperty.call(changedProps, "mode") || Object.prototype.hasOwnProperty.call(changedProps, "themes") && !isBuiltInThemeMode(mode));
|
|
896
|
+
const shouldUseProp = (key) => Object.prototype.hasOwnProperty.call(changedProps, key) || configProps[key] !== void 0;
|
|
897
|
+
const nextFromMode = shouldApplyPreset ? applyThemePreset(base, mode) : base;
|
|
898
|
+
const next = {
|
|
899
|
+
...nextFromMode,
|
|
900
|
+
mode,
|
|
901
|
+
...shouldUseProp("colorScheme") ? { colorScheme: configProps.colorScheme } : null,
|
|
902
|
+
...shouldUseProp("baseColor") ? { baseColor: configProps.baseColor } : null,
|
|
903
|
+
...shouldUseProp("accent") ? { accent: configProps.accent } : null,
|
|
904
|
+
...shouldUseProp("density") ? { density: configProps.density } : null,
|
|
905
|
+
...shouldUseProp("intensity") ? { intensity: configProps.intensity } : null,
|
|
906
|
+
...shouldUseProp("radius") ? { radius: configProps.radius } : null,
|
|
907
|
+
...shouldUseProp("font") ? { font: configProps.font } : null,
|
|
908
|
+
...shouldUseProp("colors") ? { colors: configProps.colors } : null,
|
|
909
|
+
...shouldUseProp("tokens") ? { tokens: configProps.tokens } : null,
|
|
910
|
+
...shouldUseProp("components") ? { components: configProps.components } : null
|
|
911
|
+
};
|
|
912
|
+
if (next.mode === c.mode && next.colorScheme === c.colorScheme && next.baseColor === c.baseColor && next.accent === c.accent && next.density === c.density && next.intensity === c.intensity && next.radius === c.radius && next.font === c.font && next.colors === c.colors && next.tokens === c.tokens && next.components === c.components && next.themes === c.themes) {
|
|
913
|
+
return c;
|
|
914
|
+
}
|
|
915
|
+
return next;
|
|
916
|
+
});
|
|
917
|
+
}, [
|
|
918
|
+
configProps.mode,
|
|
919
|
+
configProps.colorScheme,
|
|
920
|
+
configProps.baseColor,
|
|
921
|
+
configProps.accent,
|
|
922
|
+
configProps.density,
|
|
923
|
+
configProps.intensity,
|
|
924
|
+
configProps.radius,
|
|
925
|
+
configProps.font,
|
|
926
|
+
configProps.colors,
|
|
927
|
+
configProps.tokens,
|
|
928
|
+
configProps.components,
|
|
929
|
+
configProps.themes,
|
|
930
|
+
hasInheritedTheme
|
|
931
|
+
]);
|
|
932
|
+
React3__namespace.useEffect(() => {
|
|
933
|
+
if (!storageKey || !isBrowser) return;
|
|
934
|
+
const handleStorage = (event) => {
|
|
935
|
+
if (event.key !== storageKey && event.key !== null) return;
|
|
936
|
+
if (event.newValue === null) {
|
|
937
|
+
setConfig(createThemeConfigFromProps(configProps, !hasInheritedTheme));
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
const persisted = loadPersisted(storageKey);
|
|
941
|
+
if (!persisted) return;
|
|
942
|
+
setConfig((current) => {
|
|
943
|
+
const persistedForMerge = { ...persisted };
|
|
944
|
+
if (configProps.themes !== void 0) delete persistedForMerge.themes;
|
|
945
|
+
const mode = configProps.mode ?? persistedForMerge.mode ?? current.mode ?? (hasInheritedTheme ? void 0 : DEFAULT_CONFIG.mode);
|
|
946
|
+
const persistedConfig = {
|
|
947
|
+
...current,
|
|
948
|
+
...persistedForMerge,
|
|
949
|
+
...configProps.themes !== void 0 ? { themes: configProps.themes } : null
|
|
950
|
+
};
|
|
951
|
+
const merged = mode === void 0 ? persistedConfig : applyThemePreset(persistedConfig, mode);
|
|
952
|
+
return applyExplicitThemeProps({
|
|
953
|
+
...merged,
|
|
954
|
+
...mode !== void 0 ? { mode } : null
|
|
955
|
+
}, configProps);
|
|
956
|
+
});
|
|
957
|
+
};
|
|
958
|
+
window.addEventListener("storage", handleStorage);
|
|
959
|
+
return () => window.removeEventListener("storage", handleStorage);
|
|
960
|
+
}, [
|
|
961
|
+
configProps.mode,
|
|
962
|
+
configProps.colorScheme,
|
|
963
|
+
configProps.baseColor,
|
|
964
|
+
configProps.accent,
|
|
965
|
+
configProps.density,
|
|
966
|
+
configProps.intensity,
|
|
967
|
+
configProps.radius,
|
|
968
|
+
configProps.font,
|
|
969
|
+
configProps.colors,
|
|
970
|
+
configProps.tokens,
|
|
971
|
+
configProps.components,
|
|
972
|
+
configProps.themes,
|
|
973
|
+
hasInheritedTheme,
|
|
974
|
+
storageKey
|
|
975
|
+
]);
|
|
976
|
+
const [systemDark, setSystemDark] = React3__namespace.useState(
|
|
977
|
+
() => isBrowser && window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
978
|
+
);
|
|
979
|
+
React3__namespace.useEffect(() => {
|
|
980
|
+
if (!isBrowser) return;
|
|
981
|
+
const mql = window.matchMedia("(prefers-color-scheme: dark)");
|
|
982
|
+
const handler = (e) => setSystemDark(e.matches);
|
|
983
|
+
mql.addEventListener?.("change", handler);
|
|
984
|
+
return () => mql.removeEventListener?.("change", handler);
|
|
985
|
+
}, []);
|
|
986
|
+
const effectiveConfig = React3__namespace.useMemo(
|
|
987
|
+
() => resolveThemeConfig(mergeThemeConfigs(inheritedConfig, config)),
|
|
988
|
+
[config, inheritedConfig]
|
|
989
|
+
);
|
|
990
|
+
const activeTheme = React3__namespace.useMemo(
|
|
991
|
+
() => getThemePreset(effectiveConfig.themes, effectiveConfig.mode) ?? null,
|
|
992
|
+
[effectiveConfig.mode, effectiveConfig.themes]
|
|
993
|
+
);
|
|
994
|
+
const colorScheme = effectiveConfig.mode === "system" ? systemDark ? "dark" : "light" : isThemeBaseMode(effectiveConfig.mode) ? effectiveConfig.mode : effectiveConfig.colorScheme ?? activeTheme?.base ?? DEFAULT_CONFIG.colorScheme;
|
|
995
|
+
const resolvedMode = effectiveConfig.mode === "system" ? colorScheme : effectiveConfig.mode;
|
|
996
|
+
const visualSnapshot = React3__namespace.useMemo(
|
|
997
|
+
() => resolveVisualThemeSnapshot({
|
|
998
|
+
baseColor: effectiveConfig.baseColor,
|
|
999
|
+
colorScheme,
|
|
1000
|
+
accent: effectiveConfig.accentExplicit ? effectiveConfig.accent : void 0,
|
|
1001
|
+
intensity: effectiveConfig.intensity,
|
|
1002
|
+
colors: effectiveConfig.colors,
|
|
1003
|
+
tokens: effectiveConfig.tokens
|
|
1004
|
+
}),
|
|
1005
|
+
[
|
|
1006
|
+
effectiveConfig.baseColor,
|
|
1007
|
+
effectiveConfig.accent,
|
|
1008
|
+
effectiveConfig.accentExplicit,
|
|
1009
|
+
effectiveConfig.intensity,
|
|
1010
|
+
effectiveConfig.colors,
|
|
1011
|
+
effectiveConfig.tokens,
|
|
1012
|
+
colorScheme
|
|
1013
|
+
]
|
|
1014
|
+
);
|
|
1015
|
+
const { key: accentKey, palette: accentPalette } = React3__namespace.useMemo(() => {
|
|
1016
|
+
if (effectiveConfig.baseColor && !effectiveConfig.accentExplicit || hasAccentColorOverride(effectiveConfig)) {
|
|
1017
|
+
return {
|
|
1018
|
+
key: "custom",
|
|
1019
|
+
palette: {
|
|
1020
|
+
accent: visualSnapshot.colors.accent,
|
|
1021
|
+
ink: visualSnapshot.colors.accentInk,
|
|
1022
|
+
soft: visualSnapshot.colors.accentSoft,
|
|
1023
|
+
glow: visualSnapshot.colors.accentGlow
|
|
1024
|
+
}
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
return normalizeAccentInput(effectiveConfig.accent, colorScheme);
|
|
1028
|
+
}, [
|
|
1029
|
+
effectiveConfig.baseColor,
|
|
1030
|
+
effectiveConfig.accent,
|
|
1031
|
+
effectiveConfig.accentExplicit,
|
|
1032
|
+
colorScheme,
|
|
1033
|
+
visualSnapshot.colors
|
|
1034
|
+
]);
|
|
1035
|
+
const scopeRef = React3__namespace.useRef(null);
|
|
1036
|
+
const scopeChild = target === "scope" && asChild ? React3__namespace.Children.only(children) : null;
|
|
1037
|
+
const scopeChildRef = scopeChild?.ref;
|
|
1038
|
+
const mergedScopeRef = React3__namespace.useMemo(
|
|
1039
|
+
() => mergeThemeScopeRefs(scopeRef, scopeChildRef),
|
|
1040
|
+
[scopeChildRef]
|
|
1041
|
+
);
|
|
1042
|
+
const [portalContainer, setPortalContainer] = React3__namespace.useState(null);
|
|
1043
|
+
const rootThemeMutationRef = React3__namespace.useRef(null);
|
|
1044
|
+
useIsomorphicLayoutEffect(() => {
|
|
1045
|
+
if (!isBrowser || !enabled || target !== "scope") {
|
|
1046
|
+
setPortalContainer(null);
|
|
1047
|
+
return;
|
|
1048
|
+
}
|
|
1049
|
+
const container = document.createElement("div");
|
|
1050
|
+
container.dataset.luminaPortalScope = "";
|
|
1051
|
+
container.style.display = "contents";
|
|
1052
|
+
document.body.appendChild(container);
|
|
1053
|
+
setPortalContainer(container);
|
|
1054
|
+
return () => {
|
|
1055
|
+
container.remove();
|
|
1056
|
+
};
|
|
1057
|
+
}, [enabled, target]);
|
|
1058
|
+
useIsomorphicLayoutEffect(() => {
|
|
1059
|
+
if (!isBrowser || !enabled || target !== "root") return;
|
|
1060
|
+
const state = createRootThemeMutationState(document.documentElement);
|
|
1061
|
+
rootThemeMutationRef.current = state;
|
|
1062
|
+
return () => {
|
|
1063
|
+
if (rootThemeMutationRef.current !== state) return;
|
|
1064
|
+
restoreRootThemeMutationState(state);
|
|
1065
|
+
rootThemeMutationRef.current = null;
|
|
1066
|
+
};
|
|
1067
|
+
}, [enabled, target]);
|
|
1068
|
+
useIsomorphicLayoutEffect(() => {
|
|
1069
|
+
if (!isBrowser || !enabled) return;
|
|
1070
|
+
const targets = (target === "root" ? [document.documentElement] : [portalContainer]).filter((element) => element != null);
|
|
1071
|
+
if (targets.length === 0) return;
|
|
1072
|
+
for (const el of targets) {
|
|
1073
|
+
const resolvedConfig = {
|
|
1074
|
+
...effectiveConfig,
|
|
1075
|
+
accent: effectiveConfig.accentExplicit ? effectiveConfig.accent : void 0,
|
|
1076
|
+
colorScheme
|
|
1077
|
+
};
|
|
1078
|
+
if (target === "root" && rootThemeMutationRef.current?.target === el) {
|
|
1079
|
+
applyProviderThemeToRoot(
|
|
1080
|
+
rootThemeMutationRef.current,
|
|
1081
|
+
resolvedConfig,
|
|
1082
|
+
resolvedThemeConfigToStyle(effectiveConfig, visualSnapshot)
|
|
1083
|
+
);
|
|
1084
|
+
} else {
|
|
1085
|
+
applyTheme(el, resolvedConfig);
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
persist(storageKey, config);
|
|
1089
|
+
}, [
|
|
1090
|
+
colorScheme,
|
|
1091
|
+
config,
|
|
1092
|
+
effectiveConfig,
|
|
1093
|
+
enabled,
|
|
1094
|
+
portalContainer,
|
|
1095
|
+
storageKey,
|
|
1096
|
+
target
|
|
1097
|
+
]);
|
|
1098
|
+
const value = React3__namespace.useMemo(() => {
|
|
1099
|
+
const patch = (p) => setConfig((c) => patchThemeConfig(c, p));
|
|
1100
|
+
return {
|
|
1101
|
+
mode: effectiveConfig.mode,
|
|
1102
|
+
resolvedMode,
|
|
1103
|
+
colorScheme,
|
|
1104
|
+
baseColor: effectiveConfig.baseColor,
|
|
1105
|
+
accent: accentKey,
|
|
1106
|
+
accentPalette,
|
|
1107
|
+
density: effectiveConfig.density,
|
|
1108
|
+
intensity: effectiveConfig.intensity,
|
|
1109
|
+
radius: effectiveConfig.radius,
|
|
1110
|
+
font: effectiveConfig.font,
|
|
1111
|
+
colors: effectiveConfig.colors,
|
|
1112
|
+
tokens: effectiveConfig.tokens,
|
|
1113
|
+
themes: effectiveConfig.themes,
|
|
1114
|
+
components: effectiveConfig.components,
|
|
1115
|
+
activeTheme,
|
|
1116
|
+
setMode: (m) => patch({ mode: m }),
|
|
1117
|
+
toggleMode: () => setConfig((currentConfig) => {
|
|
1118
|
+
const currentMode = currentConfig.mode ?? effectiveConfig.mode;
|
|
1119
|
+
return patchThemeConfig(currentConfig, {
|
|
1120
|
+
mode: currentMode === "dark" ? "light" : "dark"
|
|
1121
|
+
});
|
|
1122
|
+
}),
|
|
1123
|
+
setBaseColor: (baseColor) => patch({ baseColor }),
|
|
1124
|
+
setAccent: (a) => patch({ accent: a }),
|
|
1125
|
+
setDensity: (d) => patch({ density: d }),
|
|
1126
|
+
setIntensity: (n) => patch({ intensity: n }),
|
|
1127
|
+
setRadius: (n) => patch({ radius: n }),
|
|
1128
|
+
setFont: (f) => patch({ font: f }),
|
|
1129
|
+
setColors: (colors) => patch({ colors }),
|
|
1130
|
+
setTokens: (t) => patch({ tokens: t }),
|
|
1131
|
+
setThemes: (t) => patch({ themes: t }),
|
|
1132
|
+
setComponents: (components) => patch({ components }),
|
|
1133
|
+
update: patch,
|
|
1134
|
+
reset: () => setConfig(initialConfig)
|
|
1135
|
+
};
|
|
1136
|
+
}, [effectiveConfig, resolvedMode, colorScheme, accentKey, accentPalette, activeTheme, initialConfig]);
|
|
1137
|
+
const inheritanceConfig = React3__namespace.useMemo(() => ({
|
|
1138
|
+
mode: effectiveConfig.mode,
|
|
1139
|
+
colorScheme,
|
|
1140
|
+
baseColor: effectiveConfig.baseColor,
|
|
1141
|
+
...effectiveConfig.accentExplicit ? { accent: effectiveConfig.accent } : null,
|
|
1142
|
+
density: effectiveConfig.density,
|
|
1143
|
+
intensity: effectiveConfig.intensity,
|
|
1144
|
+
radius: effectiveConfig.radius,
|
|
1145
|
+
font: effectiveConfig.font,
|
|
1146
|
+
colors: effectiveConfig.colors,
|
|
1147
|
+
tokens: effectiveConfig.tokens,
|
|
1148
|
+
components: effectiveConfig.components,
|
|
1149
|
+
themes: effectiveConfig.themes
|
|
1150
|
+
}), [effectiveConfig, colorScheme]);
|
|
1151
|
+
const onChangeRef = React3__namespace.useRef(onChange);
|
|
1152
|
+
onChangeRef.current = onChange;
|
|
1153
|
+
React3__namespace.useEffect(() => {
|
|
1154
|
+
if (!enabled) return;
|
|
1155
|
+
onChangeRef.current?.(value);
|
|
1156
|
+
}, [enabled, value]);
|
|
1157
|
+
const activePortalContainer = enabled ? target === "scope" ? portalContainer : null : inheritedPortalContainer;
|
|
1158
|
+
const activeVisualSnapshot = enabled ? visualSnapshot : inheritedVisualSnapshot;
|
|
1159
|
+
const activeComponentOverrides = enabled ? effectiveConfig.components : void 0;
|
|
1160
|
+
const activeInheritanceConfig = enabled ? inheritanceConfig : inheritedConfig;
|
|
1161
|
+
const activeThemeValue = enabled ? value : inheritedThemeValue;
|
|
1162
|
+
if (target === "scope") {
|
|
1163
|
+
const Component = Tag;
|
|
1164
|
+
const scopeThemeStyle = enabled ? {
|
|
1165
|
+
color: "var(--fg)",
|
|
1166
|
+
fontFamily: "var(--font-sans)",
|
|
1167
|
+
...resolvedThemeConfigToStyle(effectiveConfig, visualSnapshot)
|
|
1168
|
+
} : {};
|
|
1169
|
+
const scopeDataAttributes = enabled ? resolvedThemeConfigToDataAttributes(effectiveConfig, colorScheme) : {};
|
|
1170
|
+
const scopeNode = asChild && scopeChild ? React3__namespace.cloneElement(scopeChild, {
|
|
1171
|
+
...scopeDataAttributes,
|
|
1172
|
+
ref: mergedScopeRef,
|
|
1173
|
+
className: [className, scopeChild.props.className].filter(Boolean).join(" ") || void 0,
|
|
1174
|
+
style: {
|
|
1175
|
+
...scopeThemeStyle,
|
|
1176
|
+
...style,
|
|
1177
|
+
...scopeChild.props.style
|
|
1178
|
+
}
|
|
1179
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1180
|
+
Component,
|
|
1181
|
+
{
|
|
1182
|
+
ref: scopeRef,
|
|
1183
|
+
className,
|
|
1184
|
+
...scopeDataAttributes,
|
|
1185
|
+
style: {
|
|
1186
|
+
...scopeThemeStyle,
|
|
1187
|
+
...style
|
|
1188
|
+
},
|
|
1189
|
+
children
|
|
1190
|
+
}
|
|
1191
|
+
);
|
|
1192
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PortalScopeProvider, { container: activePortalContainer, children: /* @__PURE__ */ jsxRuntime.jsx(VisualThemeProvider, { value: activeVisualSnapshot, children: /* @__PURE__ */ jsxRuntime.jsx(ComponentOverridesProvider, { value: activeComponentOverrides, children: /* @__PURE__ */ jsxRuntime.jsx(ThemeInheritanceCtx.Provider, { value: activeInheritanceConfig, children: /* @__PURE__ */ jsxRuntime.jsx(ThemeCtx.Provider, { value: activeThemeValue, children: scopeNode }) }) }) }) });
|
|
1193
|
+
}
|
|
1194
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PortalScopeProvider, { container: activePortalContainer, children: /* @__PURE__ */ jsxRuntime.jsx(VisualThemeProvider, { value: activeVisualSnapshot, children: /* @__PURE__ */ jsxRuntime.jsx(ComponentOverridesProvider, { value: activeComponentOverrides, children: /* @__PURE__ */ jsxRuntime.jsx(ThemeInheritanceCtx.Provider, { value: activeInheritanceConfig, children: /* @__PURE__ */ jsxRuntime.jsx(ThemeCtx.Provider, { value: activeThemeValue, children }) }) }) }) });
|
|
1195
|
+
};
|
|
1196
|
+
|
|
1197
|
+
exports.ACCENT_PRESETS = ACCENT_PRESETS;
|
|
1198
|
+
exports.ACCENT_PRESETS_DARK = ACCENT_PRESETS_DARK;
|
|
1199
|
+
exports.ComponentOverridesProvider = ComponentOverridesProvider;
|
|
1200
|
+
exports.DEFAULT_THEME_COLORS = DEFAULT_THEME_COLORS;
|
|
1201
|
+
exports.FONT_STACKS = FONT_STACKS;
|
|
1202
|
+
exports.OwnerPortalThemeProvider = OwnerPortalThemeProvider;
|
|
1203
|
+
exports.ThemeProvider = ThemeProvider;
|
|
1204
|
+
exports.VisualThemeProvider = VisualThemeProvider;
|
|
1205
|
+
exports.applyTheme = applyTheme;
|
|
1206
|
+
exports.componentTokensToStyle = componentTokensToStyle;
|
|
1207
|
+
exports.deriveThemeColors = deriveThemeColors;
|
|
1208
|
+
exports.mergeComponentThemeOverrides = mergeComponentThemeOverrides;
|
|
1209
|
+
exports.normalizeAccentInput = normalizeAccentInput;
|
|
1210
|
+
exports.resolveThemeColorScheme = resolveThemeColorScheme;
|
|
1211
|
+
exports.resolveThemeColors = resolveThemeColors;
|
|
1212
|
+
exports.resolveThemeMode = resolveThemeMode;
|
|
1213
|
+
exports.resolveVisualThemeSnapshot = resolveVisualThemeSnapshot;
|
|
1214
|
+
exports.subscribeImperativeThemeChange = subscribeImperativeThemeChange;
|
|
1215
|
+
exports.themeColorsToStyle = themeColorsToStyle;
|
|
1216
|
+
exports.themeTokenToKebabCase = themeTokenToKebabCase;
|
|
1217
|
+
exports.useComponentOverrides = useComponentOverrides;
|
|
1218
|
+
exports.useOwnerPortalTheme = useOwnerPortalTheme;
|
|
1219
|
+
exports.usePortalContainer = usePortalContainer;
|
|
1220
|
+
exports.useTheme = useTheme;
|
|
1221
|
+
exports.useThemeOptional = useThemeOptional;
|
|
1222
|
+
exports.useVisualThemeSnapshot = useVisualThemeSnapshot;
|
|
1223
|
+
exports.visualThemeToStyle = visualThemeToStyle;
|