@fangxinyan/lumina 0.6.2 → 0.6.4
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 +2 -1
- package/dist/{Alert-JJ7GB3UU.css → Alert-HVPI6L4V.css} +9 -2
- package/dist/Alert.cjs +3 -3
- package/dist/Alert.d.cts +3 -2
- package/dist/Alert.d.ts +3 -2
- package/dist/Alert.js +2 -2
- package/dist/{AppShell-RCALXUCZ.css → AppShell-FZCD4C56.css} +4 -4
- package/dist/AppShell.cjs +5 -5
- package/dist/AppShell.js +1 -1
- package/dist/{AutoComplete-P5KZMZO5.css → AutoComplete-4YZBMW4E.css} +2 -2
- package/dist/AutoComplete.cjs +5 -5
- package/dist/AutoComplete.js +4 -4
- package/dist/{Avatar-R5A4AFKZ.css → Avatar-TNPOHVY5.css} +1 -1
- package/dist/Avatar.cjs +2 -2
- package/dist/Avatar.js +1 -1
- package/dist/Badge.cjs +2 -2
- package/dist/Badge.d.cts +1 -0
- package/dist/Badge.d.ts +1 -0
- package/dist/Badge.js +1 -1
- package/dist/Button-TUMZUQLI.css +118 -0
- package/dist/Button.cjs +3 -3
- package/dist/Button.d.cts +6 -5
- package/dist/Button.d.ts +6 -5
- package/dist/Button.js +2 -2
- package/dist/{Calendar-LHZELUDL.css → Calendar-RUTPKREW.css} +4 -4
- package/dist/Calendar.cjs +3 -3
- package/dist/Calendar.js +2 -2
- package/dist/{Card-6RMVIHWX.css → Card-MA6SV7D5.css} +6 -6
- package/dist/Card.cjs +2 -2
- package/dist/Card.js +1 -1
- package/dist/{Cascader-C2DFSMKJ.css → Cascader-ANEQUPMI.css} +21 -8
- package/dist/Cascader.cjs +5 -5
- package/dist/Cascader.d.cts +4 -2
- package/dist/Cascader.d.ts +4 -2
- package/dist/Cascader.js +4 -4
- package/dist/{Checkbox-U5EUDSYS.css → Checkbox-EDNPZRIP.css} +3 -3
- package/dist/Checkbox.cjs +3 -3
- package/dist/Checkbox.js +2 -2
- package/dist/{Collapse-66U5YJFY.css → Collapse-UNBHEPYP.css} +2 -2
- package/dist/Collapse.cjs +3 -3
- package/dist/Collapse.js +2 -2
- package/dist/{ColorPicker-SDDQGHCM.css → ColorPicker-LPG6QPYF.css} +7 -7
- package/dist/ColorPicker.cjs +2 -2
- package/dist/ColorPicker.js +1 -1
- package/dist/{CommandPalette-T45DBMPY.css → CommandPalette-RTKWNH2D.css} +3 -3
- package/dist/CommandPalette.cjs +5 -5
- package/dist/CommandPalette.js +4 -4
- package/dist/{ContextMenu-FKW6CQW4.css → ContextMenu-WRR2SSWL.css} +3 -3
- package/dist/ContextMenu.cjs +2 -2
- package/dist/ContextMenu.js +1 -1
- package/dist/{Divider-OEE4Q2KS.css → Divider-RPQCVH3J.css} +2 -2
- package/dist/Divider.cjs +2 -2
- package/dist/Divider.js +1 -1
- package/dist/{Drawer-IPGB4CXH.css → Drawer-7N3URAJ6.css} +8 -5
- package/dist/Drawer.cjs +3 -3
- package/dist/Drawer.js +2 -2
- package/dist/{Empty-DC2LPORC.css → Empty-CZTRZMZQ.css} +1 -1
- package/dist/Empty.cjs +2 -2
- package/dist/Empty.js +1 -1
- package/dist/{Form-5GRVZNDO.css → Form-NGCQWTMZ.css} +1 -1
- package/dist/Form.cjs +4 -4
- package/dist/Form.js +1 -1
- package/dist/Icon.cjs +55 -47
- package/dist/Icon.d.cts +9 -1
- package/dist/Icon.d.ts +9 -1
- package/dist/Icon.js +1 -1
- package/dist/{Image-4MN34O6P.css → Image-SGSRTHQX.css} +81 -3
- package/dist/Image.cjs +12 -4
- package/dist/Image.d.cts +79 -6
- package/dist/Image.d.ts +79 -6
- package/dist/Image.js +2 -2
- package/dist/{Input-3G4ONWNU.css → Input-7GDPGP3E.css} +22 -12
- package/dist/Input.cjs +5 -5
- package/dist/Input.d.cts +4 -3
- package/dist/Input.d.ts +4 -3
- package/dist/Input.js +3 -3
- package/dist/InputNumber.cjs +5 -5
- package/dist/InputNumber.js +4 -4
- package/dist/{List-W5BW4D2P.css → List-LSMU5QAC.css} +3 -3
- package/dist/List.cjs +2 -2
- package/dist/List.js +1 -1
- package/dist/{Message-2MZ3LFPU.css → Message-H222YGR6.css} +1 -1
- package/dist/Message.cjs +6 -6
- package/dist/Message.js +2 -2
- package/dist/{Modal-2QNDW4SO.css → Modal-MCFDYVUQ.css} +3 -3
- package/dist/Modal.cjs +4 -4
- package/dist/Modal.d.cts +1 -0
- package/dist/Modal.d.ts +1 -0
- package/dist/Modal.js +3 -3
- package/dist/{Pagination-YIRYJUXP.css → Pagination-YSZSNFHG.css} +5 -5
- package/dist/Pagination.cjs +7 -7
- package/dist/Pagination.js +6 -6
- package/dist/{Popover-DVGQGWX6.css → Popover-Y3LDCJPW.css} +1 -1
- package/dist/Popover.cjs +2 -2
- package/dist/Popover.js +1 -1
- package/dist/{Progress-CHV7DN6Y.css → Progress-CZNXCYGW.css} +1 -1
- package/dist/Progress.cjs +2 -2
- package/dist/Progress.js +1 -1
- package/dist/{Radio-GVFDPAZM.css → Radio-IQKASYDF.css} +4 -4
- package/dist/Radio.cjs +3 -3
- package/dist/Radio.js +1 -1
- package/dist/{Select-JVBQAZBG.css → Select-YZ2NUJSX.css} +44 -19
- package/dist/Select.cjs +6 -6
- package/dist/Select.d.cts +4 -3
- package/dist/Select.d.ts +4 -3
- package/dist/Select.js +5 -5
- package/dist/Skeleton.cjs +2 -2
- package/dist/Skeleton.js +1 -1
- package/dist/{Slider-3JKA5EW6.css → Slider-UM2IZZBH.css} +7 -7
- package/dist/Slider.cjs +2 -2
- package/dist/Slider.js +1 -1
- package/dist/{Spin-3GJNMSIH.css → Spin-GONGPV4Q.css} +1 -1
- package/dist/Spin.cjs +2 -2
- package/dist/Spin.js +1 -1
- package/dist/Splitter.cjs +2 -2
- package/dist/Splitter.js +1 -1
- package/dist/{StatusBar-CDS2GPSI.css → StatusBar-FJKEEPXU.css} +3 -7
- package/dist/StatusBar.cjs +3 -3
- package/dist/StatusBar.js +1 -1
- package/dist/Surface-UDDN3DGL.css +42 -0
- package/dist/Surface.cjs +16 -0
- package/dist/Surface.d.cts +60 -0
- package/dist/Surface.d.ts +60 -0
- package/dist/Surface.js +3 -0
- package/dist/{Switch-36KJNDXM.css → Switch-COAQIOMH.css} +8 -5
- package/dist/Switch.cjs +2 -2
- package/dist/Switch.js +1 -1
- package/dist/{Table-ATJJQLKU.css → Table-IYJTPY6J.css} +16 -16
- package/dist/Table.cjs +9 -9
- package/dist/Table.js +8 -8
- package/dist/{TablePro-3XVHYLSL.css → TablePro-JRSBPXB5.css} +1 -1
- package/dist/TablePro.cjs +10 -10
- package/dist/TablePro.js +9 -9
- package/dist/{Tabs-BLSNI2T5.css → Tabs-X5U5PCPV.css} +2 -2
- package/dist/Tabs.cjs +2 -2
- package/dist/Tabs.js +1 -1
- package/dist/{Tag-LB3OOJAO.css → Tag-G2XWAL7A.css} +15 -2
- package/dist/Tag.cjs +3 -3
- package/dist/Tag.d.cts +4 -3
- package/dist/Tag.d.ts +4 -3
- package/dist/Tag.js +2 -2
- package/dist/{Textarea-YNET7IBH.css → Textarea-YHWKHIFE.css} +3 -3
- package/dist/Textarea.cjs +4 -4
- package/dist/Textarea.js +2 -2
- package/dist/Theme.cjs +14 -10
- package/dist/Theme.d.cts +34 -7
- package/dist/Theme.d.ts +34 -7
- package/dist/Theme.js +1 -1
- package/dist/ThemePanel-76LB3YA5.css +509 -0
- package/dist/ThemePanel.cjs +29 -0
- package/dist/ThemePanel.d.cts +80 -0
- package/dist/ThemePanel.d.ts +80 -0
- package/dist/ThemePanel.js +12 -0
- package/dist/{Timeline-3ZHOHPXT.css → Timeline-ZIM7QFQC.css} +1 -1
- package/dist/Timeline.cjs +3 -3
- package/dist/Timeline.js +2 -2
- package/dist/{Tooltip-DMKUPC24.css → Tooltip-WI23DSRQ.css} +1 -1
- package/dist/Tooltip.cjs +2 -2
- package/dist/Tooltip.js +1 -1
- package/dist/{Typography-NKPWTJCV.css → Typography-GQNIJ4XD.css} +5 -5
- package/dist/Typography.cjs +7 -7
- package/dist/Typography.d.cts +1 -0
- package/dist/Typography.d.ts +1 -0
- package/dist/Typography.js +2 -2
- package/dist/chunk-2NT5QKEX.js +243 -0
- package/dist/{chunk-6BWELOCT.js → chunk-2SCXQ7QS.js} +2 -2
- package/dist/{chunk-5WAXZJG5.cjs → chunk-2ZADGBUN.cjs} +6 -6
- package/dist/{chunk-7NGMQIST.js → chunk-2ZFJTMEF.js} +4 -4
- package/dist/{chunk-UMDGS4BP.js → chunk-3YP7CBJT.js} +5 -5
- package/dist/{chunk-UUHFKIWP.cjs → chunk-4UKM4KAC.cjs} +2 -2
- package/dist/{chunk-WGZ2KJTZ.js → chunk-56PHETWO.js} +3 -3
- package/dist/{chunk-MQV2XN4B.cjs → chunk-5JPAUQ5H.cjs} +7 -7
- package/dist/{chunk-OQBDU5I2.cjs → chunk-5NFSDFBB.cjs} +4 -4
- package/dist/{chunk-SKMP2A5O.cjs → chunk-66GXZQKL.cjs} +4 -4
- package/dist/{chunk-TZJH5HBT.cjs → chunk-66T76GII.cjs} +6 -6
- package/dist/chunk-6EOSMK34.cjs +194 -0
- package/dist/{chunk-WNM5RVXR.cjs → chunk-6GQPF3EI.cjs} +2 -2
- package/dist/{chunk-TJII7BQ2.cjs → chunk-6LARTGLP.cjs} +11 -1
- package/dist/chunk-6SPMHY54.js +191 -0
- package/dist/{chunk-YLIQ37KY.cjs → chunk-6XVLERA3.cjs} +2 -2
- package/dist/{chunk-WKKSAGYH.js → chunk-7D76MI37.js} +8 -8
- package/dist/chunk-7NZ2A4MA.js +495 -0
- package/dist/{chunk-KLEKKZ73.js → chunk-7ZNGHWVS.js} +1 -1
- package/dist/{chunk-4WTU5P3O.cjs → chunk-ACQSRMLF.cjs} +5 -5
- package/dist/{chunk-FFZ6OMZI.js → chunk-AJH2O4WC.js} +3 -3
- package/dist/{chunk-CXWEOAVU.js → chunk-BCFCSVGJ.js} +3 -3
- package/dist/{chunk-NTS5L4NQ.cjs → chunk-BJ6WUVEG.cjs} +4 -4
- package/dist/{chunk-S3VXH5L4.cjs → chunk-C24W6PTJ.cjs} +2 -2
- package/dist/{chunk-GMN74OEY.cjs → chunk-CBKJXKVI.cjs} +2 -2
- package/dist/{chunk-33NCTOEB.js → chunk-CEZ2DR4R.js} +3 -3
- package/dist/{chunk-JD7A6VM3.js → chunk-CNGKJYGZ.js} +6 -6
- package/dist/{chunk-TEG7NJHS.cjs → chunk-D5PCIVID.cjs} +4 -4
- package/dist/{chunk-K2KYM7LW.cjs → chunk-D64IPDUE.cjs} +4 -4
- package/dist/chunk-DYHNOYRC.cjs +271 -0
- package/dist/{chunk-CUXV6QNN.cjs → chunk-DYSGXQUK.cjs} +7 -7
- package/dist/{chunk-3YJU3D5S.cjs → chunk-F3LHLYX6.cjs} +2 -2
- package/dist/{chunk-HPFQXYKG.cjs → chunk-GBKUGKIY.cjs} +11 -11
- package/dist/{chunk-MUXP7ASL.js → chunk-GUZ2DNDC.js} +3 -3
- package/dist/{chunk-K6F25JXT.js → chunk-GZCU6HXD.js} +2 -2
- package/dist/{chunk-USQ43DJ5.js → chunk-HFUHQUPQ.js} +2 -2
- package/dist/{chunk-7JN6FJ55.js → chunk-HU7T64Y3.js} +2 -2
- package/dist/{chunk-OYMJVU66.cjs → chunk-IDJCFYPP.cjs} +16 -16
- package/dist/{chunk-KD4YYIIO.cjs → chunk-IHK2FRTS.cjs} +2 -2
- package/dist/{chunk-Q5SZIU7Z.cjs → chunk-JFQ53MO4.cjs} +1 -1
- package/dist/{chunk-7PQJCLIR.js → chunk-KMG7OMOS.js} +2 -2
- package/dist/{chunk-MT7UWY6T.cjs → chunk-L27C5O4W.cjs} +4 -4
- package/dist/chunk-LFTCK2VM.cjs +1194 -0
- package/dist/{chunk-EJBHR2P5.js → chunk-LI4XJTEA.js} +3 -3
- package/dist/{chunk-45VJGBGN.js → chunk-LQLOOUS3.js} +2 -2
- package/dist/{chunk-PL6DRFUO.cjs → chunk-MOMLQP7B.cjs} +2 -2
- package/dist/{chunk-OF7JIYBY.cjs → chunk-MYHBC3HA.cjs} +2 -2
- package/dist/{chunk-LKK2AA7W.js → chunk-MYRLCN6V.js} +2 -2
- package/dist/{chunk-6ACKL3WH.cjs → chunk-N2BTMKF2.cjs} +5 -5
- package/dist/chunk-N2COYOXE.cjs +526 -0
- package/dist/{chunk-2TL37AP5.cjs → chunk-N3OLFKV5.cjs} +1 -1
- package/dist/{chunk-5JSDQ6QQ.cjs → chunk-NDO22RER.cjs} +2 -2
- package/dist/{chunk-XD3JGL5O.js → chunk-NE7IUGMK.js} +3 -3
- package/dist/{chunk-F6RYCBQG.js → chunk-NFXHIO3G.js} +1 -1
- package/dist/chunk-NJCHFXGC.js +1170 -0
- package/dist/chunk-NT6CJYI3.cjs +129 -0
- package/dist/chunk-O43DOE7V.js +106 -0
- package/dist/{chunk-GNEZD7KE.cjs → chunk-O4BOBOYV.cjs} +2 -2
- package/dist/{chunk-3AS5B7MQ.cjs → chunk-OGPDCBPD.cjs} +12 -12
- package/dist/{chunk-6YQTMI55.js → chunk-OHFZ7L4T.js} +2 -2
- package/dist/{chunk-CEJ7VBR6.js → chunk-OHIFKN4E.js} +4 -4
- package/dist/{chunk-46VXFTEC.js → chunk-OQU3TJCF.js} +3 -3
- package/dist/{chunk-5TKC6IEN.js → chunk-PEJLXJQD.js} +1 -1
- package/dist/{chunk-HWFM4MAT.js → chunk-PKHITACT.js} +2 -2
- package/dist/{chunk-CHMCL7AV.js → chunk-PNZJFLMY.js} +3 -3
- package/dist/{chunk-XRR3CYQL.js → chunk-QP7RXZES.js} +2 -2
- package/dist/{chunk-QGHYQCF3.cjs → chunk-QY76WTO5.cjs} +9 -9
- package/dist/{chunk-EIY7KEJ3.cjs → chunk-R74TZKJS.cjs} +4 -4
- package/dist/{chunk-GNEZQMKH.js → chunk-REMJWNAT.js} +5 -5
- package/dist/{chunk-SWBWZIL4.cjs → chunk-S6OKX4H7.cjs} +2 -2
- package/dist/{chunk-EC4WGEAJ.js → chunk-SABWUELE.js} +2 -2
- package/dist/{chunk-QKQHZIF3.cjs → chunk-SG42F5VB.cjs} +2 -2
- package/dist/{chunk-5C2AI2SD.js → chunk-SQIWPU6V.js} +2 -2
- package/dist/{chunk-ZIP7F4UF.cjs → chunk-SYWTT5TY.cjs} +5 -5
- package/dist/{chunk-OBEKX4VR.js → chunk-TVUBGXWA.js} +2 -2
- package/dist/{chunk-7PNJI5UE.cjs → chunk-U2H4DRMV.cjs} +2 -2
- package/dist/{chunk-6LZ54NPO.cjs → chunk-VAXWWJJP.cjs} +34 -24
- package/dist/{chunk-DQTSTJ6O.js → chunk-VNNQYJLT.js} +4 -4
- package/dist/{chunk-KGSADAOD.cjs → chunk-VSUMJX6Z.cjs} +2 -2
- package/dist/{chunk-ON4DEDMI.js → chunk-W5CJC7S7.js} +3 -3
- package/dist/{chunk-AXZ7ELMA.js → chunk-WEJKY3DF.js} +2 -2
- package/dist/{chunk-EQEJTN3V.js → chunk-WXWFMWWF.js} +3 -3
- package/dist/{chunk-TEEFR2FD.js → chunk-XHQGMMH7.js} +2 -2
- package/dist/{chunk-XTIN5545.js → chunk-XVP7IKLZ.js} +32 -22
- package/dist/{chunk-ELNT3CFO.js → chunk-Y5F7ZTBH.js} +2 -2
- package/dist/{chunk-QCILPZWP.js → chunk-YJEXAO2I.js} +2 -2
- package/dist/{chunk-7ABFUIOB.cjs → chunk-YNCDTKAE.cjs} +2 -2
- package/dist/{chunk-35ZGBAA3.cjs → chunk-YSCIMHOI.cjs} +6 -6
- package/dist/{chunk-AWXCSX6J.js → chunk-YSXD344H.js} +5 -5
- package/dist/{chunk-OF3SGLZY.js → chunk-YT5NLCRC.js} +10 -2
- package/dist/{chunk-HZSIUOCN.cjs → chunk-YUKXNWVE.cjs} +1 -1
- package/dist/{chunk-65FIH5A3.js → chunk-YVTLHTG6.js} +2 -2
- package/dist/{chunk-GENABQYA.cjs → chunk-Z4PZ2ZHI.cjs} +2 -2
- package/dist/{chunk-FBVVRTX2.cjs → chunk-ZPKHGKVL.cjs} +4 -4
- package/dist/{chunk-FJNWUELL.js → chunk-ZPP7LTHP.js} +3 -3
- package/dist/{chunk-IZOHYJUQ.cjs → chunk-ZWCDB5PP.cjs} +2 -2
- package/dist/index.cjs +226 -183
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +49 -46
- package/dist/styles.css +873 -200
- package/dist/{tokens-BIIUTPKN.css → tokens-EF34LSWI.css} +42 -17
- package/dist/tokens.css +42 -17
- package/docs/llms/alert.md +4 -3
- package/docs/llms/button.md +4 -3
- package/docs/llms/cascader.md +3 -0
- package/docs/llms/image.md +72 -1
- package/docs/llms/input.md +3 -2
- package/docs/llms/select.md +2 -2
- package/docs/llms/surface.md +90 -0
- package/docs/llms/tag.md +3 -2
- package/docs/llms/theme.md +65 -6
- package/docs/llms/themepanel.md +128 -0
- package/docs/llms.md +6 -4
- package/package.json +16 -1
- package/dist/Button-SDQD25AG.css +0 -98
- package/dist/chunk-B2KEZQ6S.cjs +0 -116
- package/dist/chunk-NN25YMOL.js +0 -251
- package/dist/chunk-PH3YECMF.js +0 -90
- package/dist/chunk-RF2EY5JS.cjs +0 -281
package/dist/chunk-NN25YMOL.js
DELETED
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import './tokens-BIIUTPKN.css';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
// src/components/Theme/Theme.tsx
|
|
6
|
-
var ACCENT_PRESETS = {
|
|
7
|
-
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)" },
|
|
8
|
-
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)" },
|
|
9
|
-
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)" },
|
|
10
|
-
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)" },
|
|
11
|
-
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)" },
|
|
12
|
-
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)" }
|
|
13
|
-
};
|
|
14
|
-
var ACCENT_PRESETS_DARK = {
|
|
15
|
-
sky: { soft: "oklch(35% 0.08 235)", ink: "oklch(82% 0.10 235)", glow: "oklch(68% 0.14 235 / 0.18)" },
|
|
16
|
-
coral: { soft: "oklch(38% 0.09 35)", ink: "oklch(84% 0.10 35)", glow: "oklch(72% 0.16 35 / 0.18)" },
|
|
17
|
-
mint: { soft: "oklch(36% 0.08 165)", ink: "oklch(83% 0.10 165)", glow: "oklch(72% 0.13 165 / 0.18)" },
|
|
18
|
-
violet: { soft: "oklch(36% 0.09 290)", ink: "oklch(82% 0.11 290)", glow: "oklch(66% 0.16 290 / 0.18)" },
|
|
19
|
-
amber: { soft: "oklch(38% 0.08 75)", ink: "oklch(85% 0.10 75)", glow: "oklch(76% 0.14 75 / 0.18)" },
|
|
20
|
-
rose: { soft: "oklch(38% 0.09 10)", ink: "oklch(84% 0.11 10)", glow: "oklch(68% 0.17 10 / 0.18)" }
|
|
21
|
-
};
|
|
22
|
-
var FONT_STACKS = {
|
|
23
|
-
system: '-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif',
|
|
24
|
-
sf: '"SF Pro Display", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif',
|
|
25
|
-
serif: 'Cambria, Georgia, "Songti SC", "STSong", serif',
|
|
26
|
-
mono: 'ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace'
|
|
27
|
-
};
|
|
28
|
-
var DEFAULT_CONFIG = {
|
|
29
|
-
mode: "light",
|
|
30
|
-
accent: "sky",
|
|
31
|
-
density: "comfortable",
|
|
32
|
-
intensity: 5,
|
|
33
|
-
radius: 20,
|
|
34
|
-
font: "sf",
|
|
35
|
-
tokens: {}
|
|
36
|
-
};
|
|
37
|
-
var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
|
|
38
|
-
function resolveThemeMode(mode) {
|
|
39
|
-
if (mode !== "system") return mode;
|
|
40
|
-
if (!isBrowser) return "light";
|
|
41
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
42
|
-
}
|
|
43
|
-
function normalizeAccentInput(input, resolvedMode) {
|
|
44
|
-
if (typeof input === "string" && input in ACCENT_PRESETS) {
|
|
45
|
-
const key = input;
|
|
46
|
-
const base = ACCENT_PRESETS[key];
|
|
47
|
-
if (resolvedMode === "dark") {
|
|
48
|
-
return { key, palette: { ...base, ...ACCENT_PRESETS_DARK[key] } };
|
|
49
|
-
}
|
|
50
|
-
return { key, palette: base };
|
|
51
|
-
}
|
|
52
|
-
const raw = typeof input === "string" ? { accent: input } : input;
|
|
53
|
-
const { accent } = raw;
|
|
54
|
-
const ink = raw.ink ?? `color-mix(in oklch, ${accent} 65%, black)`;
|
|
55
|
-
const soft = raw.soft ?? (resolvedMode === "dark" ? `color-mix(in oklch, ${accent} 30%, black)` : `color-mix(in oklch, ${accent} 15%, white)`);
|
|
56
|
-
const glow = raw.glow ?? (resolvedMode === "dark" ? `color-mix(in oklch, ${accent} 18%, transparent)` : `color-mix(in oklch, ${accent} 35%, transparent)`);
|
|
57
|
-
return { key: "custom", palette: { accent, ink, soft, glow } };
|
|
58
|
-
}
|
|
59
|
-
function toVar(key) {
|
|
60
|
-
return key.startsWith("--") ? key : `--${key}`;
|
|
61
|
-
}
|
|
62
|
-
function applyTheme(target, config) {
|
|
63
|
-
const cfg = { ...DEFAULT_CONFIG, ...config };
|
|
64
|
-
const resolvedMode = resolveThemeMode(cfg.mode);
|
|
65
|
-
const { key, palette } = normalizeAccentInput(cfg.accent, resolvedMode);
|
|
66
|
-
target.dataset.theme = resolvedMode;
|
|
67
|
-
target.dataset.density = cfg.density;
|
|
68
|
-
if (key === "custom") {
|
|
69
|
-
delete target.dataset.accent;
|
|
70
|
-
} else {
|
|
71
|
-
target.dataset.accent = key;
|
|
72
|
-
}
|
|
73
|
-
target.style.setProperty("--accent", palette.accent);
|
|
74
|
-
target.style.setProperty("--accent-ink", palette.ink);
|
|
75
|
-
target.style.setProperty("--accent-soft", palette.soft);
|
|
76
|
-
target.style.setProperty("--accent-glow", palette.glow);
|
|
77
|
-
const intensity = cfg.intensity ?? DEFAULT_CONFIG.intensity;
|
|
78
|
-
target.style.setProperty("--d", String(0.4 + intensity * 0.12));
|
|
79
|
-
const r = cfg.radius ?? DEFAULT_CONFIG.radius;
|
|
80
|
-
target.style.setProperty("--r-xs", `${Math.max(4, r - 16)}px`);
|
|
81
|
-
target.style.setProperty("--r-sm", `${Math.max(6, r - 12)}px`);
|
|
82
|
-
target.style.setProperty("--r-md", `${Math.max(8, r - 6)}px`);
|
|
83
|
-
target.style.setProperty("--r-lg", `${r}px`);
|
|
84
|
-
target.style.setProperty("--r-xl", `${r + 10}px`);
|
|
85
|
-
const font = cfg.font ?? DEFAULT_CONFIG.font;
|
|
86
|
-
if (typeof font === "string") {
|
|
87
|
-
const stack = FONT_STACKS[font] ?? font;
|
|
88
|
-
target.style.setProperty("--font-sans", stack);
|
|
89
|
-
if (font === "mono") target.style.setProperty("--font-display", FONT_STACKS.mono);
|
|
90
|
-
} else {
|
|
91
|
-
if (font.sans) target.style.setProperty("--font-sans", font.sans);
|
|
92
|
-
if (font.display) target.style.setProperty("--font-display", font.display);
|
|
93
|
-
if (font.mono) target.style.setProperty("--font-mono", font.mono);
|
|
94
|
-
}
|
|
95
|
-
if (cfg.tokens) {
|
|
96
|
-
for (const [k, v] of Object.entries(cfg.tokens)) {
|
|
97
|
-
target.style.setProperty(toVar(k), v);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
var ThemeCtx = React.createContext(null);
|
|
102
|
-
function useTheme() {
|
|
103
|
-
const ctx = React.useContext(ThemeCtx);
|
|
104
|
-
if (!ctx) {
|
|
105
|
-
throw new Error(
|
|
106
|
-
"useTheme() must be used inside <ThemeProvider>. Wrap your app (or a subtree) with <ThemeProvider>."
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
return ctx;
|
|
110
|
-
}
|
|
111
|
-
function useThemeOptional() {
|
|
112
|
-
return React.useContext(ThemeCtx);
|
|
113
|
-
}
|
|
114
|
-
function loadPersisted(key) {
|
|
115
|
-
if (!key || !isBrowser) return null;
|
|
116
|
-
try {
|
|
117
|
-
const raw = localStorage.getItem(key);
|
|
118
|
-
if (!raw) return null;
|
|
119
|
-
return JSON.parse(raw);
|
|
120
|
-
} catch {
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
function persist(key, cfg) {
|
|
125
|
-
if (!key || !isBrowser) return;
|
|
126
|
-
try {
|
|
127
|
-
localStorage.setItem(key, JSON.stringify(cfg));
|
|
128
|
-
} catch {
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
var ThemeProvider = (props) => {
|
|
132
|
-
const {
|
|
133
|
-
children,
|
|
134
|
-
target = "root",
|
|
135
|
-
as: Tag = "div",
|
|
136
|
-
className,
|
|
137
|
-
style,
|
|
138
|
-
storageKey,
|
|
139
|
-
onChange,
|
|
140
|
-
...configProps
|
|
141
|
-
} = props;
|
|
142
|
-
const initialConfig = React.useMemo(() => {
|
|
143
|
-
const fromProps = {
|
|
144
|
-
mode: configProps.mode ?? DEFAULT_CONFIG.mode,
|
|
145
|
-
accent: configProps.accent ?? DEFAULT_CONFIG.accent,
|
|
146
|
-
density: configProps.density ?? DEFAULT_CONFIG.density,
|
|
147
|
-
intensity: configProps.intensity ?? DEFAULT_CONFIG.intensity,
|
|
148
|
-
radius: configProps.radius ?? DEFAULT_CONFIG.radius,
|
|
149
|
-
font: configProps.font ?? DEFAULT_CONFIG.font,
|
|
150
|
-
tokens: configProps.tokens ?? {}
|
|
151
|
-
};
|
|
152
|
-
const persisted = loadPersisted(storageKey);
|
|
153
|
-
return persisted ? { ...fromProps, ...persisted } : fromProps;
|
|
154
|
-
}, []);
|
|
155
|
-
const [config, setConfig] = React.useState(initialConfig);
|
|
156
|
-
React.useEffect(() => {
|
|
157
|
-
setConfig((c) => {
|
|
158
|
-
const next = {
|
|
159
|
-
mode: configProps.mode ?? c.mode,
|
|
160
|
-
accent: configProps.accent ?? c.accent,
|
|
161
|
-
density: configProps.density ?? c.density,
|
|
162
|
-
intensity: configProps.intensity ?? c.intensity,
|
|
163
|
-
radius: configProps.radius ?? c.radius,
|
|
164
|
-
font: configProps.font ?? c.font,
|
|
165
|
-
tokens: configProps.tokens ?? c.tokens
|
|
166
|
-
};
|
|
167
|
-
if (next.mode === c.mode && next.accent === c.accent && next.density === c.density && next.intensity === c.intensity && next.radius === c.radius && next.font === c.font && next.tokens === c.tokens) {
|
|
168
|
-
return c;
|
|
169
|
-
}
|
|
170
|
-
return next;
|
|
171
|
-
});
|
|
172
|
-
}, [
|
|
173
|
-
configProps.mode,
|
|
174
|
-
configProps.accent,
|
|
175
|
-
configProps.density,
|
|
176
|
-
configProps.intensity,
|
|
177
|
-
configProps.radius,
|
|
178
|
-
configProps.font,
|
|
179
|
-
configProps.tokens
|
|
180
|
-
]);
|
|
181
|
-
const [systemDark, setSystemDark] = React.useState(
|
|
182
|
-
() => isBrowser && window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
183
|
-
);
|
|
184
|
-
React.useEffect(() => {
|
|
185
|
-
if (!isBrowser) return;
|
|
186
|
-
const mql = window.matchMedia("(prefers-color-scheme: dark)");
|
|
187
|
-
const handler = (e) => setSystemDark(e.matches);
|
|
188
|
-
mql.addEventListener?.("change", handler);
|
|
189
|
-
return () => mql.removeEventListener?.("change", handler);
|
|
190
|
-
}, []);
|
|
191
|
-
const resolvedMode = config.mode === "system" ? systemDark ? "dark" : "light" : config.mode;
|
|
192
|
-
const { key: accentKey, palette: accentPalette } = React.useMemo(
|
|
193
|
-
() => normalizeAccentInput(config.accent, resolvedMode),
|
|
194
|
-
[config.accent, resolvedMode]
|
|
195
|
-
);
|
|
196
|
-
const scopeRef = React.useRef(null);
|
|
197
|
-
React.useEffect(() => {
|
|
198
|
-
if (!isBrowser) return;
|
|
199
|
-
const el = target === "root" ? document.documentElement : scopeRef.current;
|
|
200
|
-
if (!el) return;
|
|
201
|
-
applyTheme(el, { ...config, mode: resolvedMode });
|
|
202
|
-
persist(storageKey, config);
|
|
203
|
-
}, [config, resolvedMode, target, storageKey]);
|
|
204
|
-
const value = React.useMemo(() => {
|
|
205
|
-
const patch = (p) => setConfig((c) => ({ ...c, ...p }));
|
|
206
|
-
return {
|
|
207
|
-
mode: config.mode,
|
|
208
|
-
resolvedMode,
|
|
209
|
-
accent: accentKey,
|
|
210
|
-
accentPalette,
|
|
211
|
-
density: config.density,
|
|
212
|
-
intensity: config.intensity,
|
|
213
|
-
radius: config.radius,
|
|
214
|
-
font: config.font,
|
|
215
|
-
tokens: config.tokens ?? {},
|
|
216
|
-
setMode: (m) => patch({ mode: m }),
|
|
217
|
-
toggleMode: () => setConfig((c) => ({
|
|
218
|
-
...c,
|
|
219
|
-
mode: c.mode === "dark" ? "light" : "dark"
|
|
220
|
-
})),
|
|
221
|
-
setAccent: (a) => patch({ accent: a }),
|
|
222
|
-
setDensity: (d) => patch({ density: d }),
|
|
223
|
-
setIntensity: (n) => patch({ intensity: n }),
|
|
224
|
-
setRadius: (n) => patch({ radius: n }),
|
|
225
|
-
setFont: (f) => patch({ font: f }),
|
|
226
|
-
setTokens: (t) => patch({ tokens: t }),
|
|
227
|
-
update: patch,
|
|
228
|
-
reset: () => setConfig(initialConfig)
|
|
229
|
-
};
|
|
230
|
-
}, [config, resolvedMode, accentKey, accentPalette, initialConfig]);
|
|
231
|
-
const onChangeRef = React.useRef(onChange);
|
|
232
|
-
onChangeRef.current = onChange;
|
|
233
|
-
React.useEffect(() => {
|
|
234
|
-
onChangeRef.current?.(value);
|
|
235
|
-
}, [value]);
|
|
236
|
-
if (target === "scope") {
|
|
237
|
-
const Component = Tag;
|
|
238
|
-
return /* @__PURE__ */ jsx(ThemeCtx.Provider, { value, children: /* @__PURE__ */ jsx(
|
|
239
|
-
Component,
|
|
240
|
-
{
|
|
241
|
-
ref: scopeRef,
|
|
242
|
-
className,
|
|
243
|
-
style,
|
|
244
|
-
children
|
|
245
|
-
}
|
|
246
|
-
) });
|
|
247
|
-
}
|
|
248
|
-
return /* @__PURE__ */ jsx(ThemeCtx.Provider, { value, children });
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
export { ACCENT_PRESETS, ACCENT_PRESETS_DARK, FONT_STACKS, ThemeProvider, applyTheme, normalizeAccentInput, resolveThemeMode, useTheme, useThemeOptional };
|
package/dist/chunk-PH3YECMF.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { Icon } from './chunk-OF3SGLZY.js';
|
|
2
|
-
import './tokens-BIIUTPKN.css';
|
|
3
|
-
import './shared-NJHRNLRH.css';
|
|
4
|
-
import './Image-4MN34O6P.css';
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
import ReactDOM from 'react-dom';
|
|
7
|
-
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
8
|
-
|
|
9
|
-
var Image = React.forwardRef(({
|
|
10
|
-
src,
|
|
11
|
-
alt,
|
|
12
|
-
width = 200,
|
|
13
|
-
height = 140,
|
|
14
|
-
preview = true,
|
|
15
|
-
hover = true,
|
|
16
|
-
placeholder,
|
|
17
|
-
className = "",
|
|
18
|
-
style,
|
|
19
|
-
...rest
|
|
20
|
-
}, ref) => {
|
|
21
|
-
const [loaded, setLoaded] = React.useState(false);
|
|
22
|
-
const [err, setErr] = React.useState(false);
|
|
23
|
-
const [open, setOpen] = React.useState(false);
|
|
24
|
-
const canPreview = preview && loaded && !err;
|
|
25
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26
|
-
/* @__PURE__ */ jsx(
|
|
27
|
-
"div",
|
|
28
|
-
{
|
|
29
|
-
ref,
|
|
30
|
-
className: `n-image ${hover ? "hover" : ""} ${canPreview ? "clickable" : ""} ${className}`,
|
|
31
|
-
style: { width, ...style },
|
|
32
|
-
onClick: () => canPreview && setOpen(true),
|
|
33
|
-
...rest,
|
|
34
|
-
children: /* @__PURE__ */ jsxs("div", { className: "n-image-frame", style: { width: "100%", height }, children: [
|
|
35
|
-
!err && src && /* @__PURE__ */ jsx("img", { src, alt, onLoad: () => setLoaded(true), onError: () => setErr(true) }),
|
|
36
|
-
/* @__PURE__ */ jsx("div", { className: `n-image-placeholder ${loaded && !err ? "loaded" : ""}`, children: placeholder ?? /* @__PURE__ */ jsx(Icon, { name: "image", size: 28 }) }),
|
|
37
|
-
canPreview && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38
|
-
/* @__PURE__ */ jsxs("div", { className: "image-hint", children: [
|
|
39
|
-
/* @__PURE__ */ jsx(Icon, { name: "eye", size: 14 }),
|
|
40
|
-
/* @__PURE__ */ jsx("span", { children: "\u70B9\u51FB\u67E5\u770B" })
|
|
41
|
-
] }),
|
|
42
|
-
/* @__PURE__ */ jsxs("div", { className: "image-actions", onClick: (e) => e.stopPropagation(), children: [
|
|
43
|
-
/* @__PURE__ */ jsx(
|
|
44
|
-
"button",
|
|
45
|
-
{
|
|
46
|
-
type: "button",
|
|
47
|
-
className: "ia-btn",
|
|
48
|
-
onClick: () => setOpen(true),
|
|
49
|
-
"aria-label": "\u9884\u89C8",
|
|
50
|
-
children: /* @__PURE__ */ jsx(Icon, { name: "eye", size: 13 })
|
|
51
|
-
}
|
|
52
|
-
),
|
|
53
|
-
src && /* @__PURE__ */ jsx("a", { className: "ia-btn", href: src, download: true, "aria-label": "\u4E0B\u8F7D", children: /* @__PURE__ */ jsx(Icon, { name: "download", size: 13 }) })
|
|
54
|
-
] })
|
|
55
|
-
] })
|
|
56
|
-
] })
|
|
57
|
-
}
|
|
58
|
-
),
|
|
59
|
-
open && typeof document !== "undefined" && ReactDOM.createPortal(
|
|
60
|
-
/* @__PURE__ */ jsx("div", { className: "image-preview-overlay", onClick: () => setOpen(false), children: /* @__PURE__ */ jsx("img", { src, alt, onClick: (e) => e.stopPropagation() }) }),
|
|
61
|
-
document.body
|
|
62
|
-
)
|
|
63
|
-
] });
|
|
64
|
-
});
|
|
65
|
-
Image.displayName = "Image";
|
|
66
|
-
var ImageGrid = React.forwardRef(({
|
|
67
|
-
images,
|
|
68
|
-
columns,
|
|
69
|
-
itemHeight = 130,
|
|
70
|
-
className = "",
|
|
71
|
-
style,
|
|
72
|
-
...rest
|
|
73
|
-
}, ref) => /* @__PURE__ */ jsx(
|
|
74
|
-
"div",
|
|
75
|
-
{
|
|
76
|
-
ref,
|
|
77
|
-
className,
|
|
78
|
-
style: {
|
|
79
|
-
display: "grid",
|
|
80
|
-
gap: 14,
|
|
81
|
-
gridTemplateColumns: columns ? `repeat(${columns}, 1fr)` : "repeat(auto-fill, minmax(160px, 1fr))",
|
|
82
|
-
...style
|
|
83
|
-
},
|
|
84
|
-
...rest,
|
|
85
|
-
children: images.map((img, i) => /* @__PURE__ */ jsx(Image, { src: img.src, alt: img.alt, width: "100%", height: itemHeight }, i))
|
|
86
|
-
}
|
|
87
|
-
));
|
|
88
|
-
ImageGrid.displayName = "ImageGrid";
|
|
89
|
-
|
|
90
|
-
export { Image, ImageGrid };
|
package/dist/chunk-RF2EY5JS.cjs
DELETED
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
require('./tokens-BIIUTPKN.css');
|
|
4
|
-
var React = 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 React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
|
-
|
|
27
|
-
// src/components/Theme/Theme.tsx
|
|
28
|
-
var ACCENT_PRESETS = {
|
|
29
|
-
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)" },
|
|
30
|
-
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)" },
|
|
31
|
-
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)" },
|
|
32
|
-
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)" },
|
|
33
|
-
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)" },
|
|
34
|
-
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)" }
|
|
35
|
-
};
|
|
36
|
-
var ACCENT_PRESETS_DARK = {
|
|
37
|
-
sky: { soft: "oklch(35% 0.08 235)", ink: "oklch(82% 0.10 235)", glow: "oklch(68% 0.14 235 / 0.18)" },
|
|
38
|
-
coral: { soft: "oklch(38% 0.09 35)", ink: "oklch(84% 0.10 35)", glow: "oklch(72% 0.16 35 / 0.18)" },
|
|
39
|
-
mint: { soft: "oklch(36% 0.08 165)", ink: "oklch(83% 0.10 165)", glow: "oklch(72% 0.13 165 / 0.18)" },
|
|
40
|
-
violet: { soft: "oklch(36% 0.09 290)", ink: "oklch(82% 0.11 290)", glow: "oklch(66% 0.16 290 / 0.18)" },
|
|
41
|
-
amber: { soft: "oklch(38% 0.08 75)", ink: "oklch(85% 0.10 75)", glow: "oklch(76% 0.14 75 / 0.18)" },
|
|
42
|
-
rose: { soft: "oklch(38% 0.09 10)", ink: "oklch(84% 0.11 10)", glow: "oklch(68% 0.17 10 / 0.18)" }
|
|
43
|
-
};
|
|
44
|
-
var FONT_STACKS = {
|
|
45
|
-
system: '-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif',
|
|
46
|
-
sf: '"SF Pro Display", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif',
|
|
47
|
-
serif: 'Cambria, Georgia, "Songti SC", "STSong", serif',
|
|
48
|
-
mono: 'ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace'
|
|
49
|
-
};
|
|
50
|
-
var DEFAULT_CONFIG = {
|
|
51
|
-
mode: "light",
|
|
52
|
-
accent: "sky",
|
|
53
|
-
density: "comfortable",
|
|
54
|
-
intensity: 5,
|
|
55
|
-
radius: 20,
|
|
56
|
-
font: "sf",
|
|
57
|
-
tokens: {}
|
|
58
|
-
};
|
|
59
|
-
var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
|
|
60
|
-
function resolveThemeMode(mode) {
|
|
61
|
-
if (mode !== "system") return mode;
|
|
62
|
-
if (!isBrowser) return "light";
|
|
63
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
64
|
-
}
|
|
65
|
-
function normalizeAccentInput(input, resolvedMode) {
|
|
66
|
-
if (typeof input === "string" && input in ACCENT_PRESETS) {
|
|
67
|
-
const key = input;
|
|
68
|
-
const base = ACCENT_PRESETS[key];
|
|
69
|
-
if (resolvedMode === "dark") {
|
|
70
|
-
return { key, palette: { ...base, ...ACCENT_PRESETS_DARK[key] } };
|
|
71
|
-
}
|
|
72
|
-
return { key, palette: base };
|
|
73
|
-
}
|
|
74
|
-
const raw = typeof input === "string" ? { accent: input } : input;
|
|
75
|
-
const { accent } = raw;
|
|
76
|
-
const ink = raw.ink ?? `color-mix(in oklch, ${accent} 65%, black)`;
|
|
77
|
-
const soft = raw.soft ?? (resolvedMode === "dark" ? `color-mix(in oklch, ${accent} 30%, black)` : `color-mix(in oklch, ${accent} 15%, white)`);
|
|
78
|
-
const glow = raw.glow ?? (resolvedMode === "dark" ? `color-mix(in oklch, ${accent} 18%, transparent)` : `color-mix(in oklch, ${accent} 35%, transparent)`);
|
|
79
|
-
return { key: "custom", palette: { accent, ink, soft, glow } };
|
|
80
|
-
}
|
|
81
|
-
function toVar(key) {
|
|
82
|
-
return key.startsWith("--") ? key : `--${key}`;
|
|
83
|
-
}
|
|
84
|
-
function applyTheme(target, config) {
|
|
85
|
-
const cfg = { ...DEFAULT_CONFIG, ...config };
|
|
86
|
-
const resolvedMode = resolveThemeMode(cfg.mode);
|
|
87
|
-
const { key, palette } = normalizeAccentInput(cfg.accent, resolvedMode);
|
|
88
|
-
target.dataset.theme = resolvedMode;
|
|
89
|
-
target.dataset.density = cfg.density;
|
|
90
|
-
if (key === "custom") {
|
|
91
|
-
delete target.dataset.accent;
|
|
92
|
-
} else {
|
|
93
|
-
target.dataset.accent = key;
|
|
94
|
-
}
|
|
95
|
-
target.style.setProperty("--accent", palette.accent);
|
|
96
|
-
target.style.setProperty("--accent-ink", palette.ink);
|
|
97
|
-
target.style.setProperty("--accent-soft", palette.soft);
|
|
98
|
-
target.style.setProperty("--accent-glow", palette.glow);
|
|
99
|
-
const intensity = cfg.intensity ?? DEFAULT_CONFIG.intensity;
|
|
100
|
-
target.style.setProperty("--d", String(0.4 + intensity * 0.12));
|
|
101
|
-
const r = cfg.radius ?? DEFAULT_CONFIG.radius;
|
|
102
|
-
target.style.setProperty("--r-xs", `${Math.max(4, r - 16)}px`);
|
|
103
|
-
target.style.setProperty("--r-sm", `${Math.max(6, r - 12)}px`);
|
|
104
|
-
target.style.setProperty("--r-md", `${Math.max(8, r - 6)}px`);
|
|
105
|
-
target.style.setProperty("--r-lg", `${r}px`);
|
|
106
|
-
target.style.setProperty("--r-xl", `${r + 10}px`);
|
|
107
|
-
const font = cfg.font ?? DEFAULT_CONFIG.font;
|
|
108
|
-
if (typeof font === "string") {
|
|
109
|
-
const stack = FONT_STACKS[font] ?? font;
|
|
110
|
-
target.style.setProperty("--font-sans", stack);
|
|
111
|
-
if (font === "mono") target.style.setProperty("--font-display", FONT_STACKS.mono);
|
|
112
|
-
} else {
|
|
113
|
-
if (font.sans) target.style.setProperty("--font-sans", font.sans);
|
|
114
|
-
if (font.display) target.style.setProperty("--font-display", font.display);
|
|
115
|
-
if (font.mono) target.style.setProperty("--font-mono", font.mono);
|
|
116
|
-
}
|
|
117
|
-
if (cfg.tokens) {
|
|
118
|
-
for (const [k, v] of Object.entries(cfg.tokens)) {
|
|
119
|
-
target.style.setProperty(toVar(k), v);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
var ThemeCtx = React__namespace.createContext(null);
|
|
124
|
-
function useTheme() {
|
|
125
|
-
const ctx = React__namespace.useContext(ThemeCtx);
|
|
126
|
-
if (!ctx) {
|
|
127
|
-
throw new Error(
|
|
128
|
-
"useTheme() must be used inside <ThemeProvider>. Wrap your app (or a subtree) with <ThemeProvider>."
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
return ctx;
|
|
132
|
-
}
|
|
133
|
-
function useThemeOptional() {
|
|
134
|
-
return React__namespace.useContext(ThemeCtx);
|
|
135
|
-
}
|
|
136
|
-
function loadPersisted(key) {
|
|
137
|
-
if (!key || !isBrowser) return null;
|
|
138
|
-
try {
|
|
139
|
-
const raw = localStorage.getItem(key);
|
|
140
|
-
if (!raw) return null;
|
|
141
|
-
return JSON.parse(raw);
|
|
142
|
-
} catch {
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
function persist(key, cfg) {
|
|
147
|
-
if (!key || !isBrowser) return;
|
|
148
|
-
try {
|
|
149
|
-
localStorage.setItem(key, JSON.stringify(cfg));
|
|
150
|
-
} catch {
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
var ThemeProvider = (props) => {
|
|
154
|
-
const {
|
|
155
|
-
children,
|
|
156
|
-
target = "root",
|
|
157
|
-
as: Tag = "div",
|
|
158
|
-
className,
|
|
159
|
-
style,
|
|
160
|
-
storageKey,
|
|
161
|
-
onChange,
|
|
162
|
-
...configProps
|
|
163
|
-
} = props;
|
|
164
|
-
const initialConfig = React__namespace.useMemo(() => {
|
|
165
|
-
const fromProps = {
|
|
166
|
-
mode: configProps.mode ?? DEFAULT_CONFIG.mode,
|
|
167
|
-
accent: configProps.accent ?? DEFAULT_CONFIG.accent,
|
|
168
|
-
density: configProps.density ?? DEFAULT_CONFIG.density,
|
|
169
|
-
intensity: configProps.intensity ?? DEFAULT_CONFIG.intensity,
|
|
170
|
-
radius: configProps.radius ?? DEFAULT_CONFIG.radius,
|
|
171
|
-
font: configProps.font ?? DEFAULT_CONFIG.font,
|
|
172
|
-
tokens: configProps.tokens ?? {}
|
|
173
|
-
};
|
|
174
|
-
const persisted = loadPersisted(storageKey);
|
|
175
|
-
return persisted ? { ...fromProps, ...persisted } : fromProps;
|
|
176
|
-
}, []);
|
|
177
|
-
const [config, setConfig] = React__namespace.useState(initialConfig);
|
|
178
|
-
React__namespace.useEffect(() => {
|
|
179
|
-
setConfig((c) => {
|
|
180
|
-
const next = {
|
|
181
|
-
mode: configProps.mode ?? c.mode,
|
|
182
|
-
accent: configProps.accent ?? c.accent,
|
|
183
|
-
density: configProps.density ?? c.density,
|
|
184
|
-
intensity: configProps.intensity ?? c.intensity,
|
|
185
|
-
radius: configProps.radius ?? c.radius,
|
|
186
|
-
font: configProps.font ?? c.font,
|
|
187
|
-
tokens: configProps.tokens ?? c.tokens
|
|
188
|
-
};
|
|
189
|
-
if (next.mode === c.mode && next.accent === c.accent && next.density === c.density && next.intensity === c.intensity && next.radius === c.radius && next.font === c.font && next.tokens === c.tokens) {
|
|
190
|
-
return c;
|
|
191
|
-
}
|
|
192
|
-
return next;
|
|
193
|
-
});
|
|
194
|
-
}, [
|
|
195
|
-
configProps.mode,
|
|
196
|
-
configProps.accent,
|
|
197
|
-
configProps.density,
|
|
198
|
-
configProps.intensity,
|
|
199
|
-
configProps.radius,
|
|
200
|
-
configProps.font,
|
|
201
|
-
configProps.tokens
|
|
202
|
-
]);
|
|
203
|
-
const [systemDark, setSystemDark] = React__namespace.useState(
|
|
204
|
-
() => isBrowser && window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
205
|
-
);
|
|
206
|
-
React__namespace.useEffect(() => {
|
|
207
|
-
if (!isBrowser) return;
|
|
208
|
-
const mql = window.matchMedia("(prefers-color-scheme: dark)");
|
|
209
|
-
const handler = (e) => setSystemDark(e.matches);
|
|
210
|
-
mql.addEventListener?.("change", handler);
|
|
211
|
-
return () => mql.removeEventListener?.("change", handler);
|
|
212
|
-
}, []);
|
|
213
|
-
const resolvedMode = config.mode === "system" ? systemDark ? "dark" : "light" : config.mode;
|
|
214
|
-
const { key: accentKey, palette: accentPalette } = React__namespace.useMemo(
|
|
215
|
-
() => normalizeAccentInput(config.accent, resolvedMode),
|
|
216
|
-
[config.accent, resolvedMode]
|
|
217
|
-
);
|
|
218
|
-
const scopeRef = React__namespace.useRef(null);
|
|
219
|
-
React__namespace.useEffect(() => {
|
|
220
|
-
if (!isBrowser) return;
|
|
221
|
-
const el = target === "root" ? document.documentElement : scopeRef.current;
|
|
222
|
-
if (!el) return;
|
|
223
|
-
applyTheme(el, { ...config, mode: resolvedMode });
|
|
224
|
-
persist(storageKey, config);
|
|
225
|
-
}, [config, resolvedMode, target, storageKey]);
|
|
226
|
-
const value = React__namespace.useMemo(() => {
|
|
227
|
-
const patch = (p) => setConfig((c) => ({ ...c, ...p }));
|
|
228
|
-
return {
|
|
229
|
-
mode: config.mode,
|
|
230
|
-
resolvedMode,
|
|
231
|
-
accent: accentKey,
|
|
232
|
-
accentPalette,
|
|
233
|
-
density: config.density,
|
|
234
|
-
intensity: config.intensity,
|
|
235
|
-
radius: config.radius,
|
|
236
|
-
font: config.font,
|
|
237
|
-
tokens: config.tokens ?? {},
|
|
238
|
-
setMode: (m) => patch({ mode: m }),
|
|
239
|
-
toggleMode: () => setConfig((c) => ({
|
|
240
|
-
...c,
|
|
241
|
-
mode: c.mode === "dark" ? "light" : "dark"
|
|
242
|
-
})),
|
|
243
|
-
setAccent: (a) => patch({ accent: a }),
|
|
244
|
-
setDensity: (d) => patch({ density: d }),
|
|
245
|
-
setIntensity: (n) => patch({ intensity: n }),
|
|
246
|
-
setRadius: (n) => patch({ radius: n }),
|
|
247
|
-
setFont: (f) => patch({ font: f }),
|
|
248
|
-
setTokens: (t) => patch({ tokens: t }),
|
|
249
|
-
update: patch,
|
|
250
|
-
reset: () => setConfig(initialConfig)
|
|
251
|
-
};
|
|
252
|
-
}, [config, resolvedMode, accentKey, accentPalette, initialConfig]);
|
|
253
|
-
const onChangeRef = React__namespace.useRef(onChange);
|
|
254
|
-
onChangeRef.current = onChange;
|
|
255
|
-
React__namespace.useEffect(() => {
|
|
256
|
-
onChangeRef.current?.(value);
|
|
257
|
-
}, [value]);
|
|
258
|
-
if (target === "scope") {
|
|
259
|
-
const Component = Tag;
|
|
260
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ThemeCtx.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
261
|
-
Component,
|
|
262
|
-
{
|
|
263
|
-
ref: scopeRef,
|
|
264
|
-
className,
|
|
265
|
-
style,
|
|
266
|
-
children
|
|
267
|
-
}
|
|
268
|
-
) });
|
|
269
|
-
}
|
|
270
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ThemeCtx.Provider, { value, children });
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
exports.ACCENT_PRESETS = ACCENT_PRESETS;
|
|
274
|
-
exports.ACCENT_PRESETS_DARK = ACCENT_PRESETS_DARK;
|
|
275
|
-
exports.FONT_STACKS = FONT_STACKS;
|
|
276
|
-
exports.ThemeProvider = ThemeProvider;
|
|
277
|
-
exports.applyTheme = applyTheme;
|
|
278
|
-
exports.normalizeAccentInput = normalizeAccentInput;
|
|
279
|
-
exports.resolveThemeMode = resolveThemeMode;
|
|
280
|
-
exports.useTheme = useTheme;
|
|
281
|
-
exports.useThemeOptional = useThemeOptional;
|