jaci-ui 0.9.3 → 1.0.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/CHANGELOG.md +19 -0
- package/README.md +11 -1
- package/dist/_virtual/_rolldown/runtime.cjs +1 -1
- package/dist/components/accordion/accordion.cjs.map +1 -1
- package/dist/components/accordion/accordion.js.map +1 -1
- package/dist/components/alert/alert.cjs.map +1 -1
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/alert-dialog/alert-dialog.cjs.map +1 -1
- package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/aspect-ratio/aspect-ratio.cjs.map +1 -1
- package/dist/components/avatar/avatar.cjs.map +1 -1
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/breadcrumbs/breadcrumbs.cjs.map +1 -1
- package/dist/components/button/button.cjs +1 -0
- package/dist/components/button/button.cjs.map +1 -1
- package/dist/components/button/button.d.cts +2 -1
- package/dist/components/button/button.d.ts +2 -1
- package/dist/components/button/button.js +1 -0
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/button-group/button-group.cjs.map +1 -1
- package/dist/components/calendar/calendar.cjs +4 -6
- package/dist/components/calendar/calendar.cjs.map +1 -1
- package/dist/components/calendar/calendar.js +4 -6
- package/dist/components/calendar/calendar.js.map +1 -1
- package/dist/components/card/card.cjs.map +1 -1
- package/dist/components/carousel/carousel.cjs.map +1 -1
- package/dist/components/carousel/carousel.js.map +1 -1
- package/dist/components/checkbox-group/checkbox-group.cjs +7 -3
- package/dist/components/checkbox-group/checkbox-group.cjs.map +1 -1
- package/dist/components/checkbox-group/checkbox-group.js +7 -3
- package/dist/components/checkbox-group/checkbox-group.js.map +1 -1
- package/dist/components/code/code.cjs.map +1 -1
- package/dist/components/code/code.js.map +1 -1
- package/dist/components/collapsible/collapsible.cjs.map +1 -1
- package/dist/components/collapsible/collapsible.js.map +1 -1
- package/dist/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/components/color-picker/color-picker.js.map +1 -1
- package/dist/components/color-swatch/color-swatch.cjs.map +1 -1
- package/dist/components/combobox/combobox.cjs +2 -1
- package/dist/components/combobox/combobox.cjs.map +1 -1
- package/dist/components/combobox/combobox.js +2 -1
- package/dist/components/combobox/combobox.js.map +1 -1
- package/dist/components/command/command.cjs.map +1 -1
- package/dist/components/command/command.js.map +1 -1
- package/dist/components/context-menu/context-menu.cjs.map +1 -1
- package/dist/components/controls/checkbox.cjs.map +1 -1
- package/dist/components/controls/checkbox.js.map +1 -1
- package/dist/components/controls/input.cjs.map +1 -1
- package/dist/components/controls/input.js.map +1 -1
- package/dist/components/controls/radio.cjs.map +1 -1
- package/dist/components/controls/switch.cjs.map +1 -1
- package/dist/components/controls/switch.js.map +1 -1
- package/dist/components/controls/textarea.cjs.map +1 -1
- package/dist/components/controls/textarea.js.map +1 -1
- package/dist/components/copyable/copyable.cjs.map +1 -1
- package/dist/components/copyable/copyable.js.map +1 -1
- package/dist/components/data-toolbar/data-toolbar.cjs.map +1 -1
- package/dist/components/data-toolbar/data-toolbar.js.map +1 -1
- package/dist/components/data-view/data-view.cjs.map +1 -1
- package/dist/components/date-picker/date-picker.cjs +4 -7
- package/dist/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/components/date-picker/date-picker.js +4 -7
- package/dist/components/date-picker/date-picker.js.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.cjs +4 -6
- package/dist/components/date-range-picker/date-range-picker.cjs.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.js +4 -6
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/dialog/dialog.cjs.map +1 -1
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/download-trigger/download-trigger.cjs.map +1 -1
- package/dist/components/drawer/drawer.cjs.map +1 -1
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/empty-state/empty-state.cjs.map +1 -1
- package/dist/components/feedback/badge.cjs.map +1 -1
- package/dist/components/feedback/badge.d.cts +2 -1
- package/dist/components/feedback/badge.d.ts +2 -1
- package/dist/components/feedback/badge.js.map +1 -1
- package/dist/components/field/field.cjs.map +1 -1
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/fieldset/fieldset.cjs.map +1 -1
- package/dist/components/figure/figure.cjs.map +1 -1
- package/dist/components/figure/figure.js.map +1 -1
- package/dist/components/form/form.cjs.map +1 -1
- package/dist/components/form/form.js.map +1 -1
- package/dist/components/icon-button/icon-button.cjs.map +1 -1
- package/dist/components/icon-button/icon-button.js.map +1 -1
- package/dist/components/image/image.cjs.map +1 -1
- package/dist/components/image/image.js.map +1 -1
- package/dist/components/input-group/input-group.cjs.map +1 -1
- package/dist/components/kbd/kbd.cjs.map +1 -1
- package/dist/components/layout/index.cjs.map +1 -1
- package/dist/components/list/list.cjs.map +1 -1
- package/dist/components/menu/menu.cjs.map +1 -1
- package/dist/components/menubar/menubar.cjs.map +1 -1
- package/dist/components/menubar/menubar.js.map +1 -1
- package/dist/components/meter/meter.cjs.map +1 -1
- package/dist/components/meter/meter.js.map +1 -1
- package/dist/components/navigation/navigation.cjs.map +1 -1
- package/dist/components/navigation/navigation.js.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.cjs.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/number-field/number-field.cjs +2 -1
- package/dist/components/number-field/number-field.cjs.map +1 -1
- package/dist/components/number-field/number-field.js +2 -1
- package/dist/components/number-field/number-field.js.map +1 -1
- package/dist/components/option-selector/option-selector.cjs.map +1 -1
- package/dist/components/option-selector/option-selector.js.map +1 -1
- package/dist/components/pagination/pagination.cjs.map +1 -1
- package/dist/components/pagination/pagination.js.map +1 -1
- package/dist/components/pin-input/pin-input.cjs.map +1 -1
- package/dist/components/pin-input/pin-input.js.map +1 -1
- package/dist/components/popover/popover.cjs.map +1 -1
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/progress/progress.cjs.map +1 -1
- package/dist/components/progress/progress.js.map +1 -1
- package/dist/components/qr-code/qr-code.cjs.map +1 -1
- package/dist/components/qr-code/qr-code.js.map +1 -1
- package/dist/components/quote/quote.cjs.map +1 -1
- package/dist/components/quote/quote.js.map +1 -1
- package/dist/components/radio-group/radio-group.cjs +7 -3
- package/dist/components/radio-group/radio-group.cjs.map +1 -1
- package/dist/components/radio-group/radio-group.js +7 -3
- package/dist/components/radio-group/radio-group.js.map +1 -1
- package/dist/components/range-slider/range-slider.cjs.map +1 -1
- package/dist/components/range-slider/range-slider.js.map +1 -1
- package/dist/components/scroll-area/scroll-area.cjs.map +1 -1
- package/dist/components/select/select.cjs.map +1 -1
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/sidebar/sidebar.cjs.map +1 -1
- package/dist/components/sidebar/sidebar.js.map +1 -1
- package/dist/components/skeleton/skeleton.cjs.map +1 -1
- package/dist/components/slider/slider.cjs.map +1 -1
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/spacer/spacer.cjs.map +1 -1
- package/dist/components/stat/stat.cjs.map +1 -1
- package/dist/components/stat/stat.js.map +1 -1
- package/dist/components/stepper/stepper.cjs +2 -1
- package/dist/components/stepper/stepper.cjs.map +1 -1
- package/dist/components/stepper/stepper.js +2 -1
- package/dist/components/stepper/stepper.js.map +1 -1
- package/dist/components/table/table.cjs.map +1 -1
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/tabs/tabs.cjs.map +1 -1
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/tags-input/tags-input.cjs.map +1 -1
- package/dist/components/tags-input/tags-input.js.map +1 -1
- package/dist/components/toast/toast.cjs.map +1 -1
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/toggle/toggle.cjs.map +1 -1
- package/dist/components/toggle-group/toggle-group.cjs.map +1 -1
- package/dist/components/toolbar/toolbar.cjs.map +1 -1
- package/dist/components/tooltip/tooltip.cjs.map +1 -1
- package/dist/components/tree-view/tree-view.cjs.map +1 -1
- package/dist/components/tree-view/tree-view.js.map +1 -1
- package/dist/components/typography/heading.cjs.map +1 -1
- package/dist/components/typography/link.cjs.map +1 -1
- package/dist/components/typography/paragraph.cjs.map +1 -1
- package/dist/components/typography/text.cjs.map +1 -1
- package/dist/components/upload/upload.cjs +2 -2
- package/dist/components/upload/upload.cjs.map +1 -1
- package/dist/components/upload/upload.js +2 -2
- package/dist/components/upload/upload.js.map +1 -1
- package/dist/components/visually-hidden/visually-hidden.cjs.map +1 -1
- package/dist/panda-preset.cjs.map +1 -1
- package/dist/styled-system/recipes/badge.cjs +4 -1
- package/dist/styled-system/recipes/badge.cjs.map +1 -1
- package/dist/styled-system/recipes/badge.js +4 -1
- package/dist/styled-system/recipes/badge.js.map +1 -1
- package/dist/styles/theme.cjs +88 -68
- package/dist/styles/theme.cjs.map +1 -1
- package/dist/styles/theme.js +88 -68
- package/dist/styles/theme.js.map +1 -1
- package/dist/styles.css +5 -19
- package/dist/theme/theme-provider.cjs.map +1 -1
- package/dist/theme/theme-provider.js.map +1 -1
- package/dist/theme/theme-scope.cjs.map +1 -1
- package/package.json +5 -5
package/dist/styles/theme.cjs
CHANGED
|
@@ -63,82 +63,102 @@ const jaciTheme = { extend: {
|
|
|
63
63
|
},
|
|
64
64
|
animations: { spin: { value: "spin 900ms linear infinite" } }
|
|
65
65
|
},
|
|
66
|
-
semanticTokens: {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
66
|
+
semanticTokens: {
|
|
67
|
+
colors: {
|
|
68
|
+
surface: {
|
|
69
|
+
canvas: { value: {
|
|
70
|
+
base: "{colors.neutral.50}",
|
|
71
|
+
_dark: "{colors.neutral.950}"
|
|
72
|
+
} },
|
|
73
|
+
default: { value: {
|
|
74
|
+
base: "{colors.neutral.100}",
|
|
75
|
+
_dark: "{colors.neutral.900}"
|
|
76
|
+
} },
|
|
77
|
+
raised: { value: {
|
|
78
|
+
base: "{colors.neutral.50}",
|
|
79
|
+
_dark: "{colors.neutral.800}"
|
|
80
|
+
} },
|
|
81
|
+
subtle: { value: {
|
|
82
|
+
base: "{colors.neutral.200}",
|
|
83
|
+
_dark: "{colors.neutral.800}"
|
|
84
|
+
} },
|
|
85
|
+
overlay: { value: {
|
|
86
|
+
base: "rgb(250 250 250 / 0.32)",
|
|
87
|
+
_dark: "rgb(9 9 11 / 0.4)"
|
|
88
|
+
} }
|
|
89
|
+
},
|
|
90
|
+
fg: {
|
|
91
|
+
default: { value: {
|
|
92
|
+
base: "{colors.neutral.900}",
|
|
93
|
+
_dark: "{colors.neutral.100}"
|
|
94
|
+
} },
|
|
95
|
+
muted: { value: {
|
|
96
|
+
base: "{colors.neutral.600}",
|
|
97
|
+
_dark: "{colors.neutral.400}"
|
|
98
|
+
} },
|
|
99
|
+
onAccent: { value: "{colors.neutral.50}" }
|
|
100
|
+
},
|
|
101
|
+
border: {
|
|
102
|
+
default: { value: {
|
|
103
|
+
base: "{colors.neutral.300}",
|
|
104
|
+
_dark: "{colors.neutral.700}"
|
|
105
|
+
} },
|
|
106
|
+
strong: { value: {
|
|
107
|
+
base: "{colors.neutral.500}",
|
|
108
|
+
_dark: "{colors.neutral.500}"
|
|
109
|
+
} },
|
|
110
|
+
interactive: { value: {
|
|
111
|
+
base: "{colors.neutral.900}",
|
|
112
|
+
_dark: "{colors.neutral.200}"
|
|
113
|
+
} }
|
|
114
|
+
},
|
|
115
|
+
accent: {
|
|
116
|
+
default: { value: "{colors.blue.600}" },
|
|
117
|
+
hover: { value: "{colors.blue.700}" }
|
|
118
|
+
},
|
|
119
|
+
success: { value: "{colors.green.700}" },
|
|
120
|
+
warning: { value: "{colors.amber.700}" },
|
|
121
|
+
danger: { value: "{colors.red.600}" },
|
|
122
|
+
info: { value: "{colors.blue.600}" },
|
|
123
|
+
focus: { value: "{colors.blue.600}" },
|
|
124
|
+
disabled: { value: {
|
|
125
|
+
base: "{colors.neutral.400}",
|
|
126
|
+
_dark: "{colors.neutral.600}"
|
|
93
127
|
} },
|
|
94
|
-
|
|
95
|
-
base: "{colors.
|
|
96
|
-
_dark: "{colors.
|
|
128
|
+
selected: { value: {
|
|
129
|
+
base: "{colors.blue.50}",
|
|
130
|
+
_dark: "{colors.blue.950}"
|
|
97
131
|
} },
|
|
98
|
-
|
|
132
|
+
link: {
|
|
133
|
+
default: { value: {
|
|
134
|
+
base: "{colors.neutral.600}",
|
|
135
|
+
_dark: "{colors.neutral.400}"
|
|
136
|
+
} },
|
|
137
|
+
hover: { value: {
|
|
138
|
+
base: "{colors.neutral.900}",
|
|
139
|
+
_dark: "{colors.neutral.200}"
|
|
140
|
+
} }
|
|
141
|
+
}
|
|
99
142
|
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
base: "
|
|
103
|
-
_dark: "
|
|
143
|
+
shadows: {
|
|
144
|
+
sm: { value: {
|
|
145
|
+
base: "0 1px 2px rgb(0 0 0 / 0.08)",
|
|
146
|
+
_dark: "0 1px 2px rgb(255 255 255 / 0.08)"
|
|
104
147
|
} },
|
|
105
|
-
|
|
106
|
-
base: "
|
|
107
|
-
_dark: "
|
|
148
|
+
md: { value: {
|
|
149
|
+
base: "0 10px 24px rgb(0 0 0 / 0.12)",
|
|
150
|
+
_dark: "0 10px 24px rgb(255 255 255 / 0.1)"
|
|
108
151
|
} },
|
|
109
|
-
|
|
110
|
-
base: "
|
|
111
|
-
_dark: "
|
|
112
|
-
} }
|
|
113
|
-
},
|
|
114
|
-
accent: {
|
|
115
|
-
default: { value: "{colors.blue.600}" },
|
|
116
|
-
hover: { value: "{colors.blue.700}" }
|
|
117
|
-
},
|
|
118
|
-
success: { value: "{colors.green.700}" },
|
|
119
|
-
warning: { value: "{colors.amber.700}" },
|
|
120
|
-
danger: { value: "{colors.red.600}" },
|
|
121
|
-
info: { value: "{colors.blue.600}" },
|
|
122
|
-
focus: { value: "{colors.blue.600}" },
|
|
123
|
-
disabled: { value: {
|
|
124
|
-
base: "{colors.neutral.400}",
|
|
125
|
-
_dark: "{colors.neutral.600}"
|
|
126
|
-
} },
|
|
127
|
-
selected: { value: {
|
|
128
|
-
base: "{colors.blue.50}",
|
|
129
|
-
_dark: "{colors.blue.950}"
|
|
130
|
-
} },
|
|
131
|
-
link: {
|
|
132
|
-
default: { value: {
|
|
133
|
-
base: "{colors.neutral.600}",
|
|
134
|
-
_dark: "{colors.neutral.400}"
|
|
152
|
+
lg: { value: {
|
|
153
|
+
base: "0 18px 42px rgb(0 0 0 / 0.16)",
|
|
154
|
+
_dark: "0 18px 42px rgb(255 255 255 / 0.12)"
|
|
135
155
|
} },
|
|
136
|
-
|
|
137
|
-
base: "
|
|
138
|
-
_dark: "
|
|
156
|
+
xl: { value: {
|
|
157
|
+
base: "0 24px 52px rgb(0 0 0 / 0.2)",
|
|
158
|
+
_dark: "0 24px 52px rgb(255 255 255 / 0.14)"
|
|
139
159
|
} }
|
|
140
160
|
}
|
|
141
|
-
}
|
|
161
|
+
},
|
|
142
162
|
textStyles: { body: { value: {
|
|
143
163
|
fontFamily: "system-ui, sans-serif",
|
|
144
164
|
lineHeight: "1.5"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.cjs","names":[],"sources":["../../src/styles/theme.ts"],"sourcesContent":["export const jaciConditions = {\n extend: {\n dark: '[data-jaci-theme=\"dark\"] &',\n },\n};\n\nexport const jaciTheme = {\n extend: {\n tokens: {\n colors: {\n neutral: {\n 50: { value: \"#fafafa\" },\n 100: { value: \"#f4f4f5\" },\n 200: { value: \"#e4e4e7\" },\n 300: { value: \"#d4d4d8\" },\n 400: { value: \"#a1a1aa\" },\n 500: { value: \"#71717a\" },\n 600: { value: \"#52525b\" },\n 700: { value: \"#3f3f46\" },\n 800: { value: \"#27272a\" },\n 900: { value: \"#18181b\" },\n 950: { value: \"#09090b\" },\n },\n blue: {\n 500: { value: \"#3b82f6\" },\n 600: { value: \"#2563eb\" },\n 700: { value: \"#1d4ed8\" },\n },\n green: {\n 500: { value: \"#22c55e\" },\n 600: { value: \"#16a34a\" },\n 700: { value: \"#15803d\" },\n },\n amber: {\n 500: { value: \"#f59e0b\" },\n 600: { value: \"#d97706\" },\n 700: { value: \"#b45309\" },\n },\n red: {\n 500: { value: \"#ef4444\" },\n 600: { value: \"#dc2626\" },\n },\n },\n radii: {\n sm: { value: \"0.375rem\" },\n md: { value: \"0.75rem\" },\n lg: { value: \"1rem\" },\n xl: { value: \"1.5rem\" },\n \"2xl\": { value: \"2rem\" },\n full: { value: \"9999px\" },\n },\n shadows: {\n sm: { value: \"0 1px 2px rgb(0 0 0 / 0.08)\" },\n md: { value: \"0 10px 24px rgb(0 0 0 / 0.12)\" },\n lg: { value: \"0 18px 42px rgb(0 0 0 / 0.16)\" },\n xl: { value: \"0 24px 52px rgb(0 0 0 / 0.2)\" },\n },\n durations: {\n fast: { value: \"150ms\" },\n normal: { value: \"250ms\" },\n slow: { value: \"500ms\" },\n },\n easings: {\n standard: { value: \"cubic-bezier(0.2, 0, 0, 1)\" },\n },\n transitions: {\n colors: { value: \"background-color, border-color, box-shadow, color\" },\n transform: { value: \"transform\" },\n standard: { value: \"background-color, border-color, box-shadow, color, transform\" },\n },\n animations: {\n spin: { value: \"spin 900ms linear infinite\" },\n },\n },\n semanticTokens: {\n colors: {\n surface: {\n canvas: {\n value: { base: \"{colors.neutral.50}\", _dark: \"{colors.neutral.950}\" },\n },\n default: {\n value: { base: \"{colors.neutral.100}\", _dark: \"{colors.neutral.900}\" },\n },\n raised: {\n value: { base: \"{colors.neutral.50}\", _dark: \"{colors.neutral.800}\" },\n },\n subtle: {\n value: { base: \"{colors.neutral.200}\", _dark: \"{colors.neutral.800}\" },\n },\n overlay: {\n value: {\n base: \"rgb(250 250 250 / 0.32)\",\n _dark: \"rgb(9 9 11 / 0.4)\",\n },\n },\n },\n fg: {\n default: {\n value: { base: \"{colors.neutral.900}\", _dark: \"{colors.neutral.100}\" },\n },\n muted: {\n value: { base: \"{colors.neutral.600}\", _dark: \"{colors.neutral.400}\" },\n },\n onAccent: { value: \"{colors.neutral.50}\" },\n },\n border: {\n default: {\n value: { base: \"{colors.neutral.300}\", _dark: \"{colors.neutral.700}\" },\n },\n strong: {\n value: { base: \"{colors.neutral.500}\", _dark: \"{colors.neutral.500}\" },\n },\n interactive: {\n value: { base: \"{colors.neutral.900}\", _dark: \"{colors.neutral.200}\" },\n },\n },\n accent: {\n default: { value: \"{colors.blue.600}\" },\n hover: { value: \"{colors.blue.700}\" },\n },\n success: { value: \"{colors.green.700}\" },\n warning: { value: \"{colors.amber.700}\" },\n danger: { value: \"{colors.red.600}\" },\n info: { value: \"{colors.blue.600}\" },\n focus: { value: \"{colors.blue.600}\" },\n disabled: {\n value: { base: \"{colors.neutral.400}\", _dark: \"{colors.neutral.600}\" },\n },\n selected: {\n value: { base: \"{colors.blue.50}\", _dark: \"{colors.blue.950}\" },\n },\n link: {\n default: {\n value: { base: \"{colors.neutral.600}\", _dark: \"{colors.neutral.400}\" },\n },\n hover: {\n value: { base: \"{colors.neutral.900}\", _dark: \"{colors.neutral.200}\" },\n },\n },\n },\n },\n textStyles: {\n body: {\n value: {\n fontFamily: \"system-ui, sans-serif\",\n lineHeight: \"1.5\",\n },\n },\n },\n keyframes: {\n spin: {\n to: {\n transform: \"rotate(360deg)\",\n },\n },\n },\n },\n};\n"],"mappings":";AAAA,MAAa,iBAAiB,EAC5B,QAAQ,EACN,MAAM,+BACR,EACF;AAEA,MAAa,YAAY,EACvB,QAAQ;CACN,QAAQ;EACN,QAAQ;GACN,SAAS;IACP,IAAI,EAAE,OAAO,UAAU;IACvB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAA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Y;GAChC,UAAU,EAAE,OAAO,+DAA+D;EACpF;EACA,YAAY,EACV,MAAM,EAAE,OAAO,6BAA6B,EAC9C;CACF;CACA,gBAAgB
|
|
1
|
+
{"version":3,"file":"theme.cjs","names":[],"sources":["../../src/styles/theme.ts"],"sourcesContent":["export const jaciConditions = {\n extend: {\n dark: '[data-jaci-theme=\"dark\"] &',\n },\n};\n\nexport const jaciTheme = {\n extend: {\n tokens: {\n colors: {\n neutral: {\n 50: { value: \"#fafafa\" },\n 100: { value: \"#f4f4f5\" },\n 200: { value: \"#e4e4e7\" },\n 300: { value: \"#d4d4d8\" },\n 400: { value: \"#a1a1aa\" },\n 500: { value: \"#71717a\" },\n 600: { value: \"#52525b\" },\n 700: { value: \"#3f3f46\" },\n 800: { value: \"#27272a\" },\n 900: { value: \"#18181b\" },\n 950: { value: \"#09090b\" },\n },\n blue: {\n 500: { value: \"#3b82f6\" },\n 600: { value: \"#2563eb\" },\n 700: { value: \"#1d4ed8\" },\n },\n green: {\n 500: { value: \"#22c55e\" },\n 600: { value: \"#16a34a\" },\n 700: { value: \"#15803d\" },\n },\n amber: {\n 500: { value: \"#f59e0b\" },\n 600: { value: \"#d97706\" },\n 700: { value: \"#b45309\" },\n },\n red: {\n 500: { value: \"#ef4444\" },\n 600: { value: \"#dc2626\" },\n },\n },\n radii: {\n sm: { value: \"0.375rem\" },\n md: { value: \"0.75rem\" },\n lg: { value: \"1rem\" },\n xl: { value: \"1.5rem\" },\n \"2xl\": { value: \"2rem\" },\n full: { value: \"9999px\" },\n },\n shadows: {\n sm: { value: \"0 1px 2px rgb(0 0 0 / 0.08)\" },\n md: { value: \"0 10px 24px rgb(0 0 0 / 0.12)\" },\n lg: { value: \"0 18px 42px rgb(0 0 0 / 0.16)\" },\n xl: { value: \"0 24px 52px rgb(0 0 0 / 0.2)\" },\n },\n durations: {\n fast: { value: \"150ms\" },\n normal: { value: \"250ms\" },\n slow: { value: \"500ms\" },\n },\n easings: {\n standard: { value: \"cubic-bezier(0.2, 0, 0, 1)\" },\n },\n transitions: {\n colors: { value: \"background-color, border-color, box-shadow, color\" },\n transform: { value: \"transform\" },\n standard: { value: \"background-color, border-color, box-shadow, color, transform\" },\n },\n animations: {\n spin: { value: \"spin 900ms linear infinite\" },\n },\n },\n semanticTokens: {\n colors: {\n surface: {\n canvas: {\n value: { base: \"{colors.neutral.50}\", _dark: \"{colors.neutral.950}\" },\n },\n default: {\n value: { base: \"{colors.neutral.100}\", _dark: \"{colors.neutral.900}\" },\n },\n raised: {\n value: { base: \"{colors.neutral.50}\", _dark: \"{colors.neutral.800}\" },\n },\n subtle: {\n value: { base: \"{colors.neutral.200}\", _dark: \"{colors.neutral.800}\" },\n },\n overlay: {\n value: {\n base: \"rgb(250 250 250 / 0.32)\",\n _dark: \"rgb(9 9 11 / 0.4)\",\n },\n },\n },\n fg: {\n default: {\n value: { base: \"{colors.neutral.900}\", _dark: \"{colors.neutral.100}\" },\n },\n muted: {\n value: { base: \"{colors.neutral.600}\", _dark: \"{colors.neutral.400}\" },\n },\n onAccent: { value: \"{colors.neutral.50}\" },\n },\n border: {\n default: {\n value: { base: \"{colors.neutral.300}\", _dark: \"{colors.neutral.700}\" },\n },\n strong: {\n value: { base: \"{colors.neutral.500}\", _dark: \"{colors.neutral.500}\" },\n },\n interactive: {\n value: { base: \"{colors.neutral.900}\", _dark: \"{colors.neutral.200}\" },\n },\n },\n accent: {\n default: { value: \"{colors.blue.600}\" },\n hover: { value: \"{colors.blue.700}\" },\n },\n success: { value: \"{colors.green.700}\" },\n warning: { value: \"{colors.amber.700}\" },\n danger: { value: \"{colors.red.600}\" },\n info: { value: \"{colors.blue.600}\" },\n focus: { value: \"{colors.blue.600}\" },\n disabled: {\n value: { base: \"{colors.neutral.400}\", _dark: \"{colors.neutral.600}\" },\n },\n selected: {\n value: { base: \"{colors.blue.50}\", _dark: \"{colors.blue.950}\" },\n },\n link: {\n default: {\n value: { base: \"{colors.neutral.600}\", _dark: \"{colors.neutral.400}\" },\n },\n hover: {\n value: { base: \"{colors.neutral.900}\", _dark: \"{colors.neutral.200}\" },\n },\n },\n },\n shadows: {\n sm: {\n value: {\n base: \"0 1px 2px rgb(0 0 0 / 0.08)\",\n _dark: \"0 1px 2px rgb(255 255 255 / 0.08)\",\n },\n },\n md: {\n value: {\n base: \"0 10px 24px rgb(0 0 0 / 0.12)\",\n _dark: \"0 10px 24px rgb(255 255 255 / 0.1)\",\n },\n },\n lg: {\n value: {\n base: \"0 18px 42px rgb(0 0 0 / 0.16)\",\n _dark: \"0 18px 42px rgb(255 255 255 / 0.12)\",\n },\n },\n xl: {\n value: {\n base: \"0 24px 52px rgb(0 0 0 / 0.2)\",\n _dark: \"0 24px 52px rgb(255 255 255 / 0.14)\",\n },\n },\n },\n },\n textStyles: {\n body: {\n value: {\n fontFamily: \"system-ui, sans-serif\",\n lineHeight: \"1.5\",\n },\n },\n },\n keyframes: {\n spin: {\n to: {\n transform: \"rotate(360deg)\",\n },\n },\n },\n },\n};\n"],"mappings":";AAAA,MAAa,iBAAiB,EAC5B,QAAQ,EACN,MAAM,+BACR,EACF;AAEA,MAAa,YAAY,EACvB,QAAQ;CACN,QAAQ;EACN,QAAQ;GACN,SAAS;IACP,IAAI,EAAE,OAAO,UAAU;IACvB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;GAC1B;GACA,MAAM;IACJ,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;GAC1B;GACA,OAAO;IACL,KAAK,EAAE,OAAO,UAAU;IACx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EACJ,IAAI,EACF,WAAW,iBACb,EACF,EACF;AACF,EACF"}
|
package/dist/styles/theme.js
CHANGED
|
@@ -63,82 +63,102 @@ const jaciTheme = { extend: {
|
|
|
63
63
|
},
|
|
64
64
|
animations: { spin: { value: "spin 900ms linear infinite" } }
|
|
65
65
|
},
|
|
66
|
-
semanticTokens: {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
66
|
+
semanticTokens: {
|
|
67
|
+
colors: {
|
|
68
|
+
surface: {
|
|
69
|
+
canvas: { value: {
|
|
70
|
+
base: "{colors.neutral.50}",
|
|
71
|
+
_dark: "{colors.neutral.950}"
|
|
72
|
+
} },
|
|
73
|
+
default: { value: {
|
|
74
|
+
base: "{colors.neutral.100}",
|
|
75
|
+
_dark: "{colors.neutral.900}"
|
|
76
|
+
} },
|
|
77
|
+
raised: { value: {
|
|
78
|
+
base: "{colors.neutral.50}",
|
|
79
|
+
_dark: "{colors.neutral.800}"
|
|
80
|
+
} },
|
|
81
|
+
subtle: { value: {
|
|
82
|
+
base: "{colors.neutral.200}",
|
|
83
|
+
_dark: "{colors.neutral.800}"
|
|
84
|
+
} },
|
|
85
|
+
overlay: { value: {
|
|
86
|
+
base: "rgb(250 250 250 / 0.32)",
|
|
87
|
+
_dark: "rgb(9 9 11 / 0.4)"
|
|
88
|
+
} }
|
|
89
|
+
},
|
|
90
|
+
fg: {
|
|
91
|
+
default: { value: {
|
|
92
|
+
base: "{colors.neutral.900}",
|
|
93
|
+
_dark: "{colors.neutral.100}"
|
|
94
|
+
} },
|
|
95
|
+
muted: { value: {
|
|
96
|
+
base: "{colors.neutral.600}",
|
|
97
|
+
_dark: "{colors.neutral.400}"
|
|
98
|
+
} },
|
|
99
|
+
onAccent: { value: "{colors.neutral.50}" }
|
|
100
|
+
},
|
|
101
|
+
border: {
|
|
102
|
+
default: { value: {
|
|
103
|
+
base: "{colors.neutral.300}",
|
|
104
|
+
_dark: "{colors.neutral.700}"
|
|
105
|
+
} },
|
|
106
|
+
strong: { value: {
|
|
107
|
+
base: "{colors.neutral.500}",
|
|
108
|
+
_dark: "{colors.neutral.500}"
|
|
109
|
+
} },
|
|
110
|
+
interactive: { value: {
|
|
111
|
+
base: "{colors.neutral.900}",
|
|
112
|
+
_dark: "{colors.neutral.200}"
|
|
113
|
+
} }
|
|
114
|
+
},
|
|
115
|
+
accent: {
|
|
116
|
+
default: { value: "{colors.blue.600}" },
|
|
117
|
+
hover: { value: "{colors.blue.700}" }
|
|
118
|
+
},
|
|
119
|
+
success: { value: "{colors.green.700}" },
|
|
120
|
+
warning: { value: "{colors.amber.700}" },
|
|
121
|
+
danger: { value: "{colors.red.600}" },
|
|
122
|
+
info: { value: "{colors.blue.600}" },
|
|
123
|
+
focus: { value: "{colors.blue.600}" },
|
|
124
|
+
disabled: { value: {
|
|
125
|
+
base: "{colors.neutral.400}",
|
|
126
|
+
_dark: "{colors.neutral.600}"
|
|
93
127
|
} },
|
|
94
|
-
|
|
95
|
-
base: "{colors.
|
|
96
|
-
_dark: "{colors.
|
|
128
|
+
selected: { value: {
|
|
129
|
+
base: "{colors.blue.50}",
|
|
130
|
+
_dark: "{colors.blue.950}"
|
|
97
131
|
} },
|
|
98
|
-
|
|
132
|
+
link: {
|
|
133
|
+
default: { value: {
|
|
134
|
+
base: "{colors.neutral.600}",
|
|
135
|
+
_dark: "{colors.neutral.400}"
|
|
136
|
+
} },
|
|
137
|
+
hover: { value: {
|
|
138
|
+
base: "{colors.neutral.900}",
|
|
139
|
+
_dark: "{colors.neutral.200}"
|
|
140
|
+
} }
|
|
141
|
+
}
|
|
99
142
|
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
base: "
|
|
103
|
-
_dark: "
|
|
143
|
+
shadows: {
|
|
144
|
+
sm: { value: {
|
|
145
|
+
base: "0 1px 2px rgb(0 0 0 / 0.08)",
|
|
146
|
+
_dark: "0 1px 2px rgb(255 255 255 / 0.08)"
|
|
104
147
|
} },
|
|
105
|
-
|
|
106
|
-
base: "
|
|
107
|
-
_dark: "
|
|
148
|
+
md: { value: {
|
|
149
|
+
base: "0 10px 24px rgb(0 0 0 / 0.12)",
|
|
150
|
+
_dark: "0 10px 24px rgb(255 255 255 / 0.1)"
|
|
108
151
|
} },
|
|
109
|
-
|
|
110
|
-
base: "
|
|
111
|
-
_dark: "
|
|
112
|
-
} }
|
|
113
|
-
},
|
|
114
|
-
accent: {
|
|
115
|
-
default: { value: "{colors.blue.600}" },
|
|
116
|
-
hover: { value: "{colors.blue.700}" }
|
|
117
|
-
},
|
|
118
|
-
success: { value: "{colors.green.700}" },
|
|
119
|
-
warning: { value: "{colors.amber.700}" },
|
|
120
|
-
danger: { value: "{colors.red.600}" },
|
|
121
|
-
info: { value: "{colors.blue.600}" },
|
|
122
|
-
focus: { value: "{colors.blue.600}" },
|
|
123
|
-
disabled: { value: {
|
|
124
|
-
base: "{colors.neutral.400}",
|
|
125
|
-
_dark: "{colors.neutral.600}"
|
|
126
|
-
} },
|
|
127
|
-
selected: { value: {
|
|
128
|
-
base: "{colors.blue.50}",
|
|
129
|
-
_dark: "{colors.blue.950}"
|
|
130
|
-
} },
|
|
131
|
-
link: {
|
|
132
|
-
default: { value: {
|
|
133
|
-
base: "{colors.neutral.600}",
|
|
134
|
-
_dark: "{colors.neutral.400}"
|
|
152
|
+
lg: { value: {
|
|
153
|
+
base: "0 18px 42px rgb(0 0 0 / 0.16)",
|
|
154
|
+
_dark: "0 18px 42px rgb(255 255 255 / 0.12)"
|
|
135
155
|
} },
|
|
136
|
-
|
|
137
|
-
base: "
|
|
138
|
-
_dark: "
|
|
156
|
+
xl: { value: {
|
|
157
|
+
base: "0 24px 52px rgb(0 0 0 / 0.2)",
|
|
158
|
+
_dark: "0 24px 52px rgb(255 255 255 / 0.14)"
|
|
139
159
|
} }
|
|
140
160
|
}
|
|
141
|
-
}
|
|
161
|
+
},
|
|
142
162
|
textStyles: { body: { value: {
|
|
143
163
|
fontFamily: "system-ui, sans-serif",
|
|
144
164
|
lineHeight: "1.5"
|
package/dist/styles/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","names":[],"sources":["../../src/styles/theme.ts"],"sourcesContent":["export const jaciConditions = {\n extend: {\n dark: '[data-jaci-theme=\"dark\"] &',\n },\n};\n\nexport const jaciTheme = {\n extend: {\n tokens: {\n colors: {\n neutral: {\n 50: { value: \"#fafafa\" },\n 100: { value: \"#f4f4f5\" },\n 200: { value: \"#e4e4e7\" },\n 300: { value: \"#d4d4d8\" },\n 400: { value: \"#a1a1aa\" },\n 500: { value: \"#71717a\" },\n 600: { value: \"#52525b\" },\n 700: { value: \"#3f3f46\" },\n 800: { value: \"#27272a\" },\n 900: { value: \"#18181b\" },\n 950: { value: \"#09090b\" },\n },\n blue: {\n 500: { value: \"#3b82f6\" },\n 600: { value: \"#2563eb\" },\n 700: { value: \"#1d4ed8\" },\n },\n green: {\n 500: { value: \"#22c55e\" },\n 600: { value: \"#16a34a\" },\n 700: { value: \"#15803d\" },\n },\n amber: {\n 500: { value: \"#f59e0b\" },\n 600: { value: \"#d97706\" },\n 700: { value: \"#b45309\" },\n },\n red: {\n 500: { value: \"#ef4444\" },\n 600: { value: \"#dc2626\" },\n },\n },\n radii: {\n sm: { value: \"0.375rem\" },\n md: { value: \"0.75rem\" },\n lg: { value: \"1rem\" },\n xl: { value: \"1.5rem\" },\n \"2xl\": { value: \"2rem\" },\n full: { value: \"9999px\" },\n },\n shadows: {\n sm: { value: \"0 1px 2px rgb(0 0 0 / 0.08)\" },\n md: { value: \"0 10px 24px rgb(0 0 0 / 0.12)\" },\n lg: { value: \"0 18px 42px rgb(0 0 0 / 0.16)\" },\n xl: { value: \"0 24px 52px rgb(0 0 0 / 0.2)\" },\n },\n durations: {\n fast: { value: \"150ms\" },\n normal: { value: \"250ms\" },\n slow: { value: \"500ms\" },\n },\n easings: {\n standard: { value: \"cubic-bezier(0.2, 0, 0, 1)\" },\n },\n transitions: {\n colors: { value: \"background-color, border-color, box-shadow, color\" },\n transform: { value: \"transform\" },\n standard: { value: \"background-color, border-color, box-shadow, color, transform\" },\n },\n animations: {\n spin: { value: \"spin 900ms linear infinite\" },\n },\n },\n semanticTokens: {\n colors: {\n surface: {\n canvas: {\n value: { base: \"{colors.neutral.50}\", _dark: \"{colors.neutral.950}\" },\n },\n default: {\n value: { base: \"{colors.neutral.100}\", _dark: \"{colors.neutral.900}\" },\n },\n raised: {\n value: { base: \"{colors.neutral.50}\", _dark: \"{colors.neutral.800}\" },\n },\n subtle: {\n value: { base: \"{colors.neutral.200}\", _dark: \"{colors.neutral.800}\" },\n },\n overlay: {\n value: {\n base: \"rgb(250 250 250 / 0.32)\",\n _dark: \"rgb(9 9 11 / 0.4)\",\n },\n },\n },\n fg: {\n default: {\n value: { base: \"{colors.neutral.900}\", _dark: \"{colors.neutral.100}\" },\n },\n muted: {\n value: { base: \"{colors.neutral.600}\", _dark: \"{colors.neutral.400}\" },\n },\n onAccent: { value: \"{colors.neutral.50}\" },\n },\n border: {\n default: {\n value: { base: \"{colors.neutral.300}\", _dark: \"{colors.neutral.700}\" },\n },\n strong: {\n value: { base: \"{colors.neutral.500}\", _dark: \"{colors.neutral.500}\" },\n },\n interactive: {\n value: { base: \"{colors.neutral.900}\", _dark: \"{colors.neutral.200}\" },\n },\n },\n accent: {\n default: { value: \"{colors.blue.600}\" },\n hover: { value: \"{colors.blue.700}\" },\n },\n success: { value: \"{colors.green.700}\" },\n warning: { value: \"{colors.amber.700}\" },\n danger: { value: \"{colors.red.600}\" },\n info: { value: \"{colors.blue.600}\" },\n focus: { value: \"{colors.blue.600}\" },\n disabled: {\n value: { base: \"{colors.neutral.400}\", _dark: \"{colors.neutral.600}\" },\n },\n selected: {\n value: { base: \"{colors.blue.50}\", _dark: \"{colors.blue.950}\" },\n },\n link: {\n default: {\n value: { base: \"{colors.neutral.600}\", _dark: \"{colors.neutral.400}\" },\n },\n hover: {\n value: { base: \"{colors.neutral.900}\", _dark: \"{colors.neutral.200}\" },\n },\n },\n },\n },\n textStyles: {\n body: {\n value: {\n fontFamily: \"system-ui, sans-serif\",\n lineHeight: \"1.5\",\n },\n },\n },\n keyframes: {\n spin: {\n to: {\n transform: \"rotate(360deg)\",\n },\n },\n },\n },\n};\n"],"mappings":";AAAA,MAAa,iBAAiB,EAC5B,QAAQ,EACN,MAAM,+BACR,EACF;AAEA,MAAa,YAAY,EACvB,QAAQ;CACN,QAAQ;EACN,QAAQ;GACN,SAAS;IACP,IAAI,EAAE,OAAO,UAAU;IACvB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;GAC1B;GACA,MAAM;IACJ,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;GAC1B;GACA,OAAO;IACL,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;GAC1B;GACA,OAAO;IACL,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;GAC1B;GACA,KAAK;IACH,KAAK,EAAE,OAAO,UAAU;IACxB,KAAK,EAAE,OAAO,UAAU;GAC1B;EACF;EACA,OAAO;GACL,IAAI,EAAE,OAAO,WAAW;GACxB,IAAI,EAAE,OAAO,UAAU;GACvB,IAAI,EAAE,OAAO,OAAO;GACpB,IAAI,EAAE,OAAO,SAAS;GACtB,OAAO,EAAE,OAAO,OAAO;GACvB,MAAM,EAAE,OAAO,SAAS;EAC1B;EACA,SAAS;GACP,IAAI,EAAE,OAAO,8BAA8B;GAC3C,IAAI,EAAE,OAAO,gCAAgC;GAC7C,IAAI,EAAE,OAAO,gCAAgC;GAC7C,IAAI,EAAE,OAAO,+BAA+B;EAC9C;EACA,WAAW;GACT,MAAM,EAAE,OAAO,QAAQ;GACvB,QAAQ,EAAE,OAAO,QAAQ;GACzB,MAAM,EAAE,OAAO,QAAQ;EACzB;EACA,SAAS,EACP,UAAU,EAAE,OAAO,6BAA6B,EAClD;EACA,aAAa;GACX,QAAQ,EAAE,OAAO,oDAAoD;GACrE,WAAW,EAAE,OAAO,YAAY;GAChC,UAAU,EAAE,OAAO,+DAA+D;EACpF;EACA,YAAY,EACV,MAAM,EAAE,OAAO,6BAA6B,EAC9C;CACF;CACA,gBAAgB
|
|
1
|
+
{"version":3,"file":"theme.js","names":[],"sources":["../../src/styles/theme.ts"],"sourcesContent":["export const jaciConditions = {\n extend: {\n dark: '[data-jaci-theme=\"dark\"] &',\n },\n};\n\nexport const jaciTheme = {\n extend: {\n tokens: {\n colors: {\n neutral: {\n 50: { value: \"#fafafa\" },\n 100: { value: \"#f4f4f5\" },\n 200: { value: \"#e4e4e7\" },\n 300: { value: \"#d4d4d8\" },\n 400: { value: \"#a1a1aa\" },\n 500: { value: \"#71717a\" },\n 600: { value: \"#52525b\" },\n 700: { value: \"#3f3f46\" },\n 800: { value: \"#27272a\" },\n 900: { value: \"#18181b\" },\n 950: { value: \"#09090b\" },\n },\n blue: {\n 500: { value: \"#3b82f6\" },\n 600: { value: \"#2563eb\" },\n 700: { value: \"#1d4ed8\" },\n },\n green: {\n 500: { value: \"#22c55e\" },\n 600: { value: \"#16a34a\" },\n 700: { value: \"#15803d\" },\n },\n amber: {\n 500: { value: \"#f59e0b\" },\n 600: { value: \"#d97706\" },\n 700: { value: \"#b45309\" },\n },\n red: {\n 500: { value: \"#ef4444\" },\n 600: { value: \"#dc2626\" },\n },\n },\n radii: {\n sm: { value: \"0.375rem\" },\n md: { value: \"0.75rem\" },\n lg: { value: \"1rem\" },\n xl: { value: \"1.5rem\" },\n \"2xl\": { value: \"2rem\" },\n full: { value: \"9999px\" },\n },\n shadows: {\n sm: { value: \"0 1px 2px rgb(0 0 0 / 0.08)\" },\n md: { value: \"0 10px 24px rgb(0 0 0 / 0.12)\" },\n lg: { value: \"0 18px 42px rgb(0 0 0 / 0.16)\" },\n xl: { value: \"0 24px 52px rgb(0 0 0 / 0.2)\" },\n },\n durations: {\n fast: { value: \"150ms\" },\n normal: { value: \"250ms\" },\n slow: { value: \"500ms\" },\n },\n easings: {\n standard: { value: \"cubic-bezier(0.2, 0, 0, 1)\" },\n },\n transitions: {\n colors: { value: \"background-color, border-color, box-shadow, color\" },\n transform: { value: \"transform\" },\n standard: { value: \"background-color, border-color, box-shadow, color, transform\" },\n },\n animations: {\n spin: { value: \"spin 900ms linear infinite\" },\n },\n },\n semanticTokens: {\n colors: {\n surface: {\n canvas: {\n value: { base: \"{colors.neutral.50}\", _dark: \"{colors.neutral.950}\" },\n },\n default: {\n value: { base: \"{colors.neutral.100}\", _dark: \"{colors.neutral.900}\" },\n },\n raised: {\n value: { base: \"{colors.neutral.50}\", _dark: \"{colors.neutral.800}\" },\n },\n subtle: {\n value: { base: \"{colors.neutral.200}\", _dark: \"{colors.neutral.800}\" },\n },\n overlay: {\n value: {\n base: \"rgb(250 250 250 / 0.32)\",\n _dark: \"rgb(9 9 11 / 0.4)\",\n },\n },\n },\n fg: {\n default: {\n value: { base: \"{colors.neutral.900}\", _dark: \"{colors.neutral.100}\" },\n },\n muted: {\n value: { base: \"{colors.neutral.600}\", _dark: \"{colors.neutral.400}\" },\n },\n onAccent: { value: \"{colors.neutral.50}\" },\n },\n border: {\n default: {\n value: { base: \"{colors.neutral.300}\", _dark: \"{colors.neutral.700}\" },\n },\n strong: {\n value: { base: \"{colors.neutral.500}\", _dark: \"{colors.neutral.500}\" },\n },\n interactive: {\n value: { base: \"{colors.neutral.900}\", _dark: \"{colors.neutral.200}\" },\n },\n },\n accent: {\n default: { value: \"{colors.blue.600}\" },\n hover: { value: \"{colors.blue.700}\" },\n },\n success: { value: \"{colors.green.700}\" },\n warning: { value: \"{colors.amber.700}\" },\n danger: { value: \"{colors.red.600}\" },\n info: { value: \"{colors.blue.600}\" },\n focus: { value: \"{colors.blue.600}\" },\n disabled: {\n value: { base: \"{colors.neutral.400}\", _dark: \"{colors.neutral.600}\" },\n },\n selected: {\n value: { base: \"{colors.blue.50}\", _dark: \"{colors.blue.950}\" },\n },\n link: {\n default: {\n value: { base: \"{colors.neutral.600}\", _dark: \"{colors.neutral.400}\" },\n },\n hover: {\n value: { base: \"{colors.neutral.900}\", _dark: \"{colors.neutral.200}\" },\n },\n },\n },\n shadows: {\n sm: {\n value: {\n base: \"0 1px 2px rgb(0 0 0 / 0.08)\",\n _dark: \"0 1px 2px rgb(255 255 255 / 0.08)\",\n },\n },\n md: {\n value: {\n base: \"0 10px 24px rgb(0 0 0 / 0.12)\",\n _dark: \"0 10px 24px rgb(255 255 255 / 0.1)\",\n },\n },\n lg: {\n value: {\n base: \"0 18px 42px rgb(0 0 0 / 0.16)\",\n _dark: \"0 18px 42px rgb(255 255 255 / 0.12)\",\n },\n },\n xl: {\n value: {\n base: \"0 24px 52px rgb(0 0 0 / 0.2)\",\n _dark: \"0 24px 52px rgb(255 255 255 / 0.14)\",\n },\n },\n },\n },\n textStyles: {\n body: {\n value: {\n fontFamily: \"system-ui, sans-serif\",\n lineHeight: \"1.5\",\n },\n },\n },\n keyframes: {\n spin: {\n to: {\n transform: \"rotate(360deg)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M,EAAE,OAAO,oBAAoB;GACnC,OAAO,EAAE,OAAO,oBAAoB;GACpC,UAAU,EACR,OAAO;IAAE,MAAM;IAAwB,OAAO;GAAuB,EACvE;GACA,UAAU,EACR,OAAO;IAAE,MAAM;IAAoB,OAAO;GAAoB,EAChE;GACA,MAAM;IACJ,SAAS,EACP,OAAO;KAAE,MAAM;KAAwB,OAAO;IAAuB,EACvE;IACA,OAAO,EACL,OAAO;KAAE,MAAM;KAAwB,OAAO;IAAuB,EACvE;GACF;EACF;EACA,SAAS;GACP,IAAI,EACF,OAAO;IACL,MAAM;IACN,OAAO;GACT,EACF;GACA,IAAI,EACF,OAAO;IACL,MAAM;IACN,OAAO;GACT,EACF;GACA,IAAI,EACF,OAAO;IACL,MAAM;IACN,OAAO;GACT,EACF;GACA,IAAI,EACF,OAAO;IACL,MAAM;IACN,OAAO;GACT,EACF;EACF;CACF;CACA,YAAY,EACV,MAAM,EACJ,OAAO;EACL,YAAY;EACZ,YAAY;CACd,EACF,EACF;CACA,WAAW,EACT,MAAM,EACJ,IAAI,EACF,WAAW,iBACb,EACF,EACF;AACF,EACF"}
|
package/dist/styles.css
CHANGED
|
@@ -525,23 +525,6 @@
|
|
|
525
525
|
--jaci-colors-link-hover: var(--jaci-colors-neutral-900);
|
|
526
526
|
}
|
|
527
527
|
|
|
528
|
-
[data-jaci-theme="dark"] {
|
|
529
|
-
--jaci-colors-surface-canvas: var(--jaci-colors-neutral-950);
|
|
530
|
-
--jaci-colors-surface-default: var(--jaci-colors-neutral-900);
|
|
531
|
-
--jaci-colors-surface-raised: var(--jaci-colors-neutral-800);
|
|
532
|
-
--jaci-colors-surface-subtle: var(--jaci-colors-neutral-800);
|
|
533
|
-
--jaci-colors-surface-overlay: rgb(9 9 11 / 0.4);
|
|
534
|
-
--jaci-colors-fg-default: var(--jaci-colors-neutral-100);
|
|
535
|
-
--jaci-colors-fg-muted: var(--jaci-colors-neutral-400);
|
|
536
|
-
--jaci-colors-border-default: var(--jaci-colors-neutral-700);
|
|
537
|
-
--jaci-colors-border-strong: var(--jaci-colors-neutral-500);
|
|
538
|
-
--jaci-colors-border-interactive: var(--jaci-colors-neutral-200);
|
|
539
|
-
--jaci-colors-disabled: var(--jaci-colors-neutral-600);
|
|
540
|
-
--jaci-colors-selected: var(--jaci-colors-blue-950);
|
|
541
|
-
--jaci-colors-link-default: var(--jaci-colors-neutral-400);
|
|
542
|
-
--jaci-colors-link-hover: var(--jaci-colors-neutral-200)
|
|
543
|
-
}
|
|
544
|
-
|
|
545
528
|
@keyframes ping {
|
|
546
529
|
75%,100% {
|
|
547
530
|
transform: scale(2);
|
|
@@ -1404,12 +1387,15 @@
|
|
|
1404
1387
|
|
|
1405
1388
|
.jaci-badge--tone_danger-outline {
|
|
1406
1389
|
border-color: var(--jaci-colors-danger);
|
|
1407
|
-
border-style: solid;
|
|
1408
|
-
border-width: 1px;
|
|
1409
1390
|
background-color: var(--jaci-colors-transparent);
|
|
1410
1391
|
color: var(--jaci-colors-danger);
|
|
1411
1392
|
}
|
|
1412
1393
|
|
|
1394
|
+
.jaci-badge--tone_danger-outline,.jaci-badge--tone_custom-outline {
|
|
1395
|
+
border-style: solid;
|
|
1396
|
+
border-width: 1px;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1413
1399
|
.jaci-iconButton--variant_outline {
|
|
1414
1400
|
background-color: var(--jaci-colors-transparent);
|
|
1415
1401
|
color: var(--jaci-colors-fg-default);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider.cjs","names":["ThemeScopeContext"],"sources":["../../src/theme/theme-provider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n createElement,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithoutRef, CSSProperties, ElementType, ReactNode, Ref } from \"react\";\n\nimport { ThemeScopeContext } from \"./theme-scope\";\n\nexport type ThemeMode = \"light\" | \"dark\" | \"system\";\n\n/** A leaf value accepted by the theme variable mapper. */\nexport type JaciThemeTokenValue = string | number;\n\n/**\n * Semantic theme values. The groups intentionally accept additional keys so\n * applications can extend the token vocabulary without waiting for a package\n * release. Known semantic groups are documented in the public README.\n */\nexport type JaciThemeTokenGroup = {\n readonly [key: string]: JaciThemeTokenValue | JaciThemeTokenGroup | undefined;\n};\n\nexport interface JaciThemeColorTokens extends JaciThemeTokenGroup {\n surface?: JaciThemeTokenGroup;\n fg?: JaciThemeTokenGroup;\n border?: JaciThemeTokenGroup;\n accent?: JaciThemeTokenGroup;\n success?: JaciThemeTokenValue;\n warning?: JaciThemeTokenValue;\n danger?: JaciThemeTokenValue;\n info?: JaciThemeTokenValue;\n link?: JaciThemeTokenGroup;\n focus?: JaciThemeTokenValue;\n disabled?: JaciThemeTokenValue;\n selected?: JaciThemeTokenValue;\n}\n\nexport interface JaciThemeTokens {\n colors?: JaciThemeColorTokens;\n radii?: JaciThemeTokenGroup;\n shadows?: JaciThemeTokenGroup;\n durations?: JaciThemeTokenGroup;\n easings?: JaciThemeTokenGroup;\n transitions?: JaciThemeTokenGroup;\n spacing?: JaciThemeTokenGroup;\n fontSizes?: JaciThemeTokenGroup;\n lineHeights?: JaciThemeTokenGroup;\n typography?: JaciThemeTokenGroup;\n textStyles?: JaciThemeTokenGroup;\n fonts?: JaciThemeTokenGroup;\n}\n\nexport interface ThemeProviderProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** The controlled color mode. */\n theme?: ThemeMode;\n /** The initial color mode for an uncontrolled provider. */\n defaultTheme?: ThemeMode;\n /** The deterministic mode used for `system` while rendering on the server. */\n ssrTheme?: \"light\" | \"dark\";\n /** Scoped semantic token overrides. */\n tokens?: JaciThemeTokens;\n /** Called when a controlled provider requests a mode change. */\n onThemeChange?: (theme: ThemeMode) => void;\n /** The element that owns the theme scope. */\n as?: ElementType;\n children?: ReactNode;\n}\n\nexport interface ThemeContextValue {\n theme: ThemeMode;\n resolvedTheme: \"light\" | \"dark\";\n setTheme: (theme: ThemeMode) => void;\n}\n\nconst defaultThemeContext: ThemeContextValue = {\n theme: \"light\",\n resolvedTheme: \"light\",\n setTheme: () => undefined,\n};\n\nconst ThemeContext = createContext<ThemeContextValue>(defaultThemeContext);\n\nfunction kebabCase(value: string) {\n return value\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .replace(/[\\s_]+/g, \"-\")\n .toLowerCase();\n}\n\nfunction flattenTokens(\n group: JaciThemeTokenGroup | undefined,\n path: string[],\n output: Record<string, string>,\n) {\n if (!group) return;\n\n for (const [key, value] of Object.entries(group)) {\n if (value === undefined) continue;\n const nextPath = [...path, kebabCase(key)];\n\n if (typeof value === \"object\") {\n flattenTokens(value, nextPath, output);\n } else {\n output[`--jaci-${nextPath.join(\"-\")}`] = String(value);\n }\n }\n}\n\nfunction tokenStyles(tokens: JaciThemeTokens | undefined): CSSProperties {\n if (!tokens) return {};\n\n const variables: Record<string, string> = {};\n for (const [group, values] of Object.entries(tokens)) {\n flattenTokens(values, [kebabCase(group)], variables);\n }\n\n return variables as CSSProperties;\n}\n\nfunction initialSystemTheme(ssrTheme: \"light\" | \"dark\" | undefined) {\n return ssrTheme ?? \"light\";\n}\n\nexport const ThemeProvider = forwardRef<HTMLElement, ThemeProviderProps>(function ThemeProvider(\n {\n as = \"div\",\n children,\n defaultTheme = \"light\",\n onThemeChange,\n ssrTheme,\n style,\n theme,\n tokens,\n ...props\n },\n ref,\n) {\n const [uncontrolledTheme, setUncontrolledTheme] = useState<ThemeMode>(defaultTheme);\n const [systemTheme, setSystemTheme] = useState<\"light\" | \"dark\">(() =>\n initialSystemTheme(ssrTheme),\n );\n const [scopeElement, setScopeElement] = useState<HTMLElement | null>(null);\n const [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null);\n const currentTheme = theme ?? uncontrolledTheme;\n\n useEffect(() => {\n if (currentTheme !== \"system\") return;\n\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return;\n\n const media = window.matchMedia(\"(prefers-color-scheme: dark)\");\n const update = () => setSystemTheme(media.matches ? \"dark\" : \"light\");\n update();\n if (typeof media.addEventListener === \"function\") media.addEventListener(\"change\", update);\n else media.addListener?.(update);\n\n return () => {\n if (typeof media.removeEventListener === \"function\")\n media.removeEventListener(\"change\", update);\n else media.removeListener?.(update);\n };\n }, [currentTheme]);\n\n const resolvedTheme = currentTheme === \"system\" ? systemTheme : currentTheme;\n const setTheme = useCallback(\n (nextTheme: ThemeMode) => {\n if (theme === undefined) setUncontrolledTheme(nextTheme);\n onThemeChange?.(nextTheme);\n },\n [onThemeChange, theme],\n );\n const contextValue = useMemo(\n () => ({ theme: currentTheme, resolvedTheme, setTheme }),\n [currentTheme, resolvedTheme, setTheme],\n );\n const mergedStyle = useMemo(() => ({ ...style, ...tokenStyles(tokens) }), [style, tokens]);\n const scopedTokenStyles = useMemo(() => tokenStyles(tokens), [tokens]);\n const Root = as;\n const setRootRef = useCallback(\n (element: HTMLElement | null) => {\n setScopeElement((current) => (current === element ? current : element));\n if (typeof ref === \"function\") ref(element);\n else if (ref) (ref as { current: HTMLElement | null }).current = element;\n },\n [ref],\n );\n\n useEffect(() => {\n if (!scopeElement || typeof document === \"undefined\") return;\n\n const host = document.createElement(\"div\");\n host.dataset.jaciThemePortal = \"true\";\n host.dataset.jaciComponent = \"theme-portal\";\n host.dataset.slot = \"theme-portal\";\n // Keep the host out of the Storybook/app layout. Its descendants still\n // inherit the theme attribute and scoped custom properties.\n host.style.display = \"contents\";\n document.body.append(host);\n setPortalContainer(host);\n\n return () => {\n setPortalContainer((current) => (current === host ? null : current));\n host.remove();\n };\n }, [scopeElement]);\n\n useEffect(() => {\n if (!portalContainer) return;\n\n portalContainer.dataset.jaciTheme = resolvedTheme;\n for (const [property, value] of Object.entries(scopedTokenStyles)) {\n portalContainer.style.setProperty(property, value);\n }\n\n return () => {\n for (const property of Object.keys(scopedTokenStyles)) {\n portalContainer.style.removeProperty(property);\n }\n };\n }, [portalContainer, resolvedTheme, scopedTokenStyles]);\n\n return (\n <ThemeContext.Provider value={contextValue}>\n <ThemeScopeContext.Provider value={{ container: portalContainer }}>\n {createElement(\n Root,\n {\n ...props,\n \"data-jaci-theme\": resolvedTheme,\n \"data-jaci-component\": \"theme-provider\",\n \"data-slot\": \"theme-provider\",\n ref: setRootRef as Ref<HTMLElement>,\n style: mergedStyle,\n },\n children,\n )}\n </ThemeScopeContext.Provider>\n </ThemeContext.Provider>\n );\n});\n\nexport function useTheme() {\n return useContext(ThemeContext);\n}\n"],"mappings":";;;;;AAwFA,MAAM,gBAAA,GAAA,MAAA,cAAA,CAAgD;CALpD,OAAO;CACP,eAAe;CACf,gBAAgB,KAAA;AAGsD,CAAC;AAEzE,SAAS,UAAU,OAAe;CAChC,OAAO,MACJ,QAAQ,sBAAsB,OAAO,CAAC,CACtC,QAAQ,WAAW,GAAG,CAAC,CACvB,YAAY;AACjB;AAEA,SAAS,cACP,OACA,MACA,QACA;CACA,IAAI,CAAC,OAAO;CAEZ,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAAG;EAChD,IAAI,UAAU,KAAA,GAAW;EACzB,MAAM,WAAW,CAAC,GAAG,MAAM,UAAU,GAAG,CAAC;EAEzC,IAAI,OAAO,UAAU,UACnB,cAAc,OAAO,UAAU,MAAM;OAErC,OAAO,UAAU,SAAS,KAAK,GAAG,OAAO,OAAO,KAAK;CAEzD;AACF;AAEA,SAAS,YAAY,QAAoD;CACvE,IAAI,CAAC,QAAQ,OAAO,CAAC;CAErB,MAAM,YAAoC,CAAC;CAC3C,KAAK,MAAM,CAAC,OAAO,WAAW,OAAO,QAAQ,MAAM,GACjD,cAAc,QAAQ,CAAC,UAAU,KAAK,CAAC,GAAG,SAAS;CAGrD,OAAO;AACT;AAEA,SAAS,mBAAmB,UAAwC;CAClE,OAAO,YAAY;AACrB;AAEA,MAAa,iBAAA,GAAA,MAAA,WAAA,CAA4D,SAAS,cAChF,EACE,KAAK,OACL,UACA,eAAe,SACf,eAC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ACA,QACF;EAC0B,CAAA;CACP,CAAA;AAE3B,CAAC;AAED,SAAgB,WAAW;CACzB,QAAA,GAAA,MAAA,WAAA,CAAkB,YAAY;AAChC"}
|
|
1
|
+
{"version":3,"file":"theme-provider.cjs","names":["createContext","forwardRef","useState","useCallback","useMemo","ThemeScopeContext","createElement","useContext"],"sources":["../../src/theme/theme-provider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n createElement,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithoutRef, CSSProperties, ElementType, ReactNode, Ref } from \"react\";\n\nimport { ThemeScopeContext } from \"./theme-scope\";\n\nexport type ThemeMode = \"light\" | \"dark\" | \"system\";\n\n/** A leaf value accepted by the theme variable mapper. */\nexport type JaciThemeTokenValue = string | number;\n\n/**\n * Semantic theme values. The groups intentionally accept additional keys so\n * applications can extend the token vocabulary without waiting for a package\n * release. Known semantic groups are documented in the public README.\n */\nexport type JaciThemeTokenGroup = {\n readonly [key: string]: JaciThemeTokenValue | JaciThemeTokenGroup | undefined;\n};\n\nexport interface JaciThemeColorTokens extends JaciThemeTokenGroup {\n surface?: JaciThemeTokenGroup;\n fg?: JaciThemeTokenGroup;\n border?: JaciThemeTokenGroup;\n accent?: JaciThemeTokenGroup;\n success?: JaciThemeTokenValue;\n warning?: JaciThemeTokenValue;\n danger?: JaciThemeTokenValue;\n info?: JaciThemeTokenValue;\n link?: JaciThemeTokenGroup;\n focus?: JaciThemeTokenValue;\n disabled?: JaciThemeTokenValue;\n selected?: JaciThemeTokenValue;\n}\n\nexport interface JaciThemeTokens {\n colors?: JaciThemeColorTokens;\n radii?: JaciThemeTokenGroup;\n shadows?: JaciThemeTokenGroup;\n durations?: JaciThemeTokenGroup;\n easings?: JaciThemeTokenGroup;\n transitions?: JaciThemeTokenGroup;\n spacing?: JaciThemeTokenGroup;\n fontSizes?: JaciThemeTokenGroup;\n lineHeights?: JaciThemeTokenGroup;\n typography?: JaciThemeTokenGroup;\n textStyles?: JaciThemeTokenGroup;\n fonts?: JaciThemeTokenGroup;\n}\n\nexport interface ThemeProviderProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** The controlled color mode. */\n theme?: ThemeMode;\n /** The initial color mode for an uncontrolled provider. */\n defaultTheme?: ThemeMode;\n /** The deterministic mode used for `system` while rendering on the server. */\n ssrTheme?: \"light\" | \"dark\";\n /** Scoped semantic token overrides. */\n tokens?: JaciThemeTokens;\n /** Called when a controlled provider requests a mode change. */\n onThemeChange?: (theme: ThemeMode) => void;\n /** The element that owns the theme scope. */\n as?: ElementType;\n children?: ReactNode;\n}\n\nexport interface ThemeContextValue {\n theme: ThemeMode;\n resolvedTheme: \"light\" | \"dark\";\n setTheme: (theme: ThemeMode) => void;\n}\n\nconst defaultThemeContext: ThemeContextValue = {\n theme: \"light\",\n resolvedTheme: \"light\",\n setTheme: () => undefined,\n};\n\nconst ThemeContext = createContext<ThemeContextValue>(defaultThemeContext);\n\nfunction kebabCase(value: string) {\n return value\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .replace(/[\\s_]+/g, \"-\")\n .toLowerCase();\n}\n\nfunction flattenTokens(\n group: JaciThemeTokenGroup | undefined,\n path: string[],\n output: Record<string, string>,\n) {\n if (!group) return;\n\n for (const [key, value] of Object.entries(group)) {\n if (value === undefined) continue;\n const nextPath = [...path, kebabCase(key)];\n\n if (typeof value === \"object\") {\n flattenTokens(value, nextPath, output);\n } else {\n output[`--jaci-${nextPath.join(\"-\")}`] = String(value);\n }\n }\n}\n\nfunction tokenStyles(tokens: JaciThemeTokens | undefined): CSSProperties {\n if (!tokens) return {};\n\n const variables: Record<string, string> = {};\n for (const [group, values] of Object.entries(tokens)) {\n flattenTokens(values, [kebabCase(group)], variables);\n }\n\n return variables as CSSProperties;\n}\n\nfunction initialSystemTheme(ssrTheme: \"light\" | \"dark\" | undefined) {\n return ssrTheme ?? \"light\";\n}\n\nexport const ThemeProvider = forwardRef<HTMLElement, ThemeProviderProps>(function ThemeProvider(\n {\n as = \"div\",\n children,\n defaultTheme = \"light\",\n onThemeChange,\n ssrTheme,\n style,\n theme,\n tokens,\n ...props\n },\n ref,\n) {\n const [uncontrolledTheme, setUncontrolledTheme] = useState<ThemeMode>(defaultTheme);\n const [systemTheme, setSystemTheme] = useState<\"light\" | \"dark\">(() =>\n initialSystemTheme(ssrTheme),\n );\n const [scopeElement, setScopeElement] = useState<HTMLElement | null>(null);\n const [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null);\n const currentTheme = theme ?? uncontrolledTheme;\n\n useEffect(() => {\n if (currentTheme !== \"system\") return;\n\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return;\n\n const media = window.matchMedia(\"(prefers-color-scheme: dark)\");\n const update = () => setSystemTheme(media.matches ? \"dark\" : \"light\");\n update();\n if (typeof media.addEventListener === \"function\") media.addEventListener(\"change\", update);\n else media.addListener?.(update);\n\n return () => {\n if (typeof media.removeEventListener === \"function\")\n media.removeEventListener(\"change\", update);\n else media.removeListener?.(update);\n };\n }, [currentTheme]);\n\n const resolvedTheme = currentTheme === \"system\" ? systemTheme : currentTheme;\n const setTheme = useCallback(\n (nextTheme: ThemeMode) => {\n if (theme === undefined) setUncontrolledTheme(nextTheme);\n onThemeChange?.(nextTheme);\n },\n [onThemeChange, theme],\n );\n const contextValue = useMemo(\n () => ({ theme: currentTheme, resolvedTheme, setTheme }),\n [currentTheme, resolvedTheme, setTheme],\n );\n const mergedStyle = useMemo(() => ({ ...style, ...tokenStyles(tokens) }), [style, tokens]);\n const scopedTokenStyles = useMemo(() => tokenStyles(tokens), [tokens]);\n const Root = as;\n const setRootRef = useCallback(\n (element: HTMLElement | null) => {\n setScopeElement((current) => (current === element ? current : element));\n if (typeof ref === \"function\") ref(element);\n else if (ref) (ref as { current: HTMLElement | null }).current = element;\n },\n [ref],\n );\n\n useEffect(() => {\n if (!scopeElement || typeof document === \"undefined\") return;\n\n const host = document.createElement(\"div\");\n host.dataset.jaciThemePortal = \"true\";\n host.dataset.jaciComponent = \"theme-portal\";\n host.dataset.slot = \"theme-portal\";\n // Keep the host out of the Storybook/app layout. Its descendants still\n // inherit the theme attribute and scoped custom properties.\n host.style.display = \"contents\";\n document.body.append(host);\n setPortalContainer(host);\n\n return () => {\n setPortalContainer((current) => (current === host ? null : current));\n host.remove();\n };\n }, [scopeElement]);\n\n useEffect(() => {\n if (!portalContainer) return;\n\n portalContainer.dataset.jaciTheme = resolvedTheme;\n for (const [property, value] of Object.entries(scopedTokenStyles)) {\n portalContainer.style.setProperty(property, value);\n }\n\n return () => {\n for (const property of Object.keys(scopedTokenStyles)) {\n portalContainer.style.removeProperty(property);\n }\n };\n }, [portalContainer, resolvedTheme, scopedTokenStyles]);\n\n return (\n <ThemeContext.Provider value={contextValue}>\n <ThemeScopeContext.Provider value={{ container: portalContainer }}>\n {createElement(\n Root,\n {\n ...props,\n \"data-jaci-theme\": resolvedTheme,\n \"data-jaci-component\": \"theme-provider\",\n \"data-slot\": \"theme-provider\",\n ref: setRootRef as Ref<HTMLElement>,\n style: mergedStyle,\n },\n children,\n )}\n </ThemeScopeContext.Provider>\n </ThemeContext.Provider>\n );\n});\n\nexport function useTheme() {\n return useContext(ThemeContext);\n}\n"],"mappings":";;;;;AAwFA,MAAM,gBAAA,GAAeA,MAAAA,cAAAA,CAAiC;CALpD,OAAO;CACP,eAAe;CACf,gBAAgB,KAAA;AAGsD,CAAC;AAEzE,SAAS,UAAU,OAAe;CAChC,OAAO,MACJ,QAAQ,sBAAsB,OAAO,CAAC,CACtC,QAAQ,WAAW,GAAG,CAAC,CACvB,YAAY;AACjB;AAEA,SAAS,cACP,OACA,MACA,QACA;CACA,IAAI,CAAC,OAAO;CAEZ,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAAG;EAChD,IAAI,UAAU,KAAA,GAAW;EACzB,MAAM,WAAW,CAAC,GAAG,MAAM,UAAU,GAAG,CAAC;EA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tB,gBAAgB,QAAQ,YAAY;EACpC,KAAK,MAAM,CAAC,UAAU,UAAU,OAAO,QAAQ,iBAAiB,GAC9D,gBAAgB,MAAM,YAAY,UAAU,KAAK;EAGnD,aAAa;GACX,KAAK,MAAM,YAAY,OAAO,KAAK,iBAAiB,GAClD,gBAAgB,MAAM,eAAe,QAAQ;EAEjD;CACF,GAAG;EAAC;EAAiB;EAAe;CAAiB,CAAC;CAEtD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAa,UAAd;EAAuB,OAAO;EAC5B,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACE,oBAAAA,kBAAkB,UAAnB;GAA4B,OAAO,EAAE,WAAW,gBAAgB;GAC7DC,WAAAA,GAAAA,MAAAA,cAAAA,CACC,MACA;IACE,GAAG;IACH,mBAAmB;IACnB,uBAAuB;IACvB,aAAa;IACb,KAAK;IACL,OAAO;GACT,GACA,QACF;EAC0B,CAAA;CACP,CAAA;AAE3B,CAAC;AAED,SAAgB,WAAW;CACzB,QAAA,GAAOC,MAAAA,WAAAA,CAAW,YAAY;AAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider.js","names":[],"sources":["../../src/theme/theme-provider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n createElement,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithoutRef, CSSProperties, ElementType, ReactNode, Ref } from \"react\";\n\nimport { ThemeScopeContext } from \"./theme-scope\";\n\nexport type ThemeMode = \"light\" | \"dark\" | \"system\";\n\n/** A leaf value accepted by the theme variable mapper. */\nexport type JaciThemeTokenValue = string | number;\n\n/**\n * Semantic theme values. The groups intentionally accept additional keys so\n * applications can extend the token vocabulary without waiting for a package\n * release. Known semantic groups are documented in the public README.\n */\nexport type JaciThemeTokenGroup = {\n readonly [key: string]: JaciThemeTokenValue | JaciThemeTokenGroup | undefined;\n};\n\nexport interface JaciThemeColorTokens extends JaciThemeTokenGroup {\n surface?: JaciThemeTokenGroup;\n fg?: JaciThemeTokenGroup;\n border?: JaciThemeTokenGroup;\n accent?: JaciThemeTokenGroup;\n success?: JaciThemeTokenValue;\n warning?: JaciThemeTokenValue;\n danger?: JaciThemeTokenValue;\n info?: JaciThemeTokenValue;\n link?: JaciThemeTokenGroup;\n focus?: JaciThemeTokenValue;\n disabled?: JaciThemeTokenValue;\n selected?: JaciThemeTokenValue;\n}\n\nexport interface JaciThemeTokens {\n colors?: JaciThemeColorTokens;\n radii?: JaciThemeTokenGroup;\n shadows?: JaciThemeTokenGroup;\n durations?: JaciThemeTokenGroup;\n easings?: JaciThemeTokenGroup;\n transitions?: JaciThemeTokenGroup;\n spacing?: JaciThemeTokenGroup;\n fontSizes?: JaciThemeTokenGroup;\n lineHeights?: JaciThemeTokenGroup;\n typography?: JaciThemeTokenGroup;\n textStyles?: JaciThemeTokenGroup;\n fonts?: JaciThemeTokenGroup;\n}\n\nexport interface ThemeProviderProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** The controlled color mode. */\n theme?: ThemeMode;\n /** The initial color mode for an uncontrolled provider. */\n defaultTheme?: ThemeMode;\n /** The deterministic mode used for `system` while rendering on the server. */\n ssrTheme?: \"light\" | \"dark\";\n /** Scoped semantic token overrides. */\n tokens?: JaciThemeTokens;\n /** Called when a controlled provider requests a mode change. */\n onThemeChange?: (theme: ThemeMode) => void;\n /** The element that owns the theme scope. */\n as?: ElementType;\n children?: ReactNode;\n}\n\nexport interface ThemeContextValue {\n theme: ThemeMode;\n resolvedTheme: \"light\" | \"dark\";\n setTheme: (theme: ThemeMode) => void;\n}\n\nconst defaultThemeContext: ThemeContextValue = {\n theme: \"light\",\n resolvedTheme: \"light\",\n setTheme: () => undefined,\n};\n\nconst ThemeContext = createContext<ThemeContextValue>(defaultThemeContext);\n\nfunction kebabCase(value: string) {\n return value\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .replace(/[\\s_]+/g, \"-\")\n .toLowerCase();\n}\n\nfunction flattenTokens(\n group: JaciThemeTokenGroup | undefined,\n path: string[],\n output: Record<string, string>,\n) {\n if (!group) return;\n\n for (const [key, value] of Object.entries(group)) {\n if (value === undefined) continue;\n const nextPath = [...path, kebabCase(key)];\n\n if (typeof value === \"object\") {\n flattenTokens(value, nextPath, output);\n } else {\n output[`--jaci-${nextPath.join(\"-\")}`] = String(value);\n }\n }\n}\n\nfunction tokenStyles(tokens: JaciThemeTokens | undefined): CSSProperties {\n if (!tokens) return {};\n\n const variables: Record<string, string> = {};\n for (const [group, values] of Object.entries(tokens)) {\n flattenTokens(values, [kebabCase(group)], variables);\n }\n\n return variables as CSSProperties;\n}\n\nfunction initialSystemTheme(ssrTheme: \"light\" | \"dark\" | undefined) {\n return ssrTheme ?? \"light\";\n}\n\nexport const ThemeProvider = forwardRef<HTMLElement, ThemeProviderProps>(function ThemeProvider(\n {\n as = \"div\",\n children,\n defaultTheme = \"light\",\n onThemeChange,\n ssrTheme,\n style,\n theme,\n tokens,\n ...props\n },\n ref,\n) {\n const [uncontrolledTheme, setUncontrolledTheme] = useState<ThemeMode>(defaultTheme);\n const [systemTheme, setSystemTheme] = useState<\"light\" | \"dark\">(() =>\n initialSystemTheme(ssrTheme),\n );\n const [scopeElement, setScopeElement] = useState<HTMLElement | null>(null);\n const [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null);\n const currentTheme = theme ?? uncontrolledTheme;\n\n useEffect(() => {\n if (currentTheme !== \"system\") return;\n\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return;\n\n const media = window.matchMedia(\"(prefers-color-scheme: dark)\");\n const update = () => setSystemTheme(media.matches ? \"dark\" : \"light\");\n update();\n if (typeof media.addEventListener === \"function\") media.addEventListener(\"change\", update);\n else media.addListener?.(update);\n\n return () => {\n if (typeof media.removeEventListener === \"function\")\n media.removeEventListener(\"change\", update);\n else media.removeListener?.(update);\n };\n }, [currentTheme]);\n\n const resolvedTheme = currentTheme === \"system\" ? systemTheme : currentTheme;\n const setTheme = useCallback(\n (nextTheme: ThemeMode) => {\n if (theme === undefined) setUncontrolledTheme(nextTheme);\n onThemeChange?.(nextTheme);\n },\n [onThemeChange, theme],\n );\n const contextValue = useMemo(\n () => ({ theme: currentTheme, resolvedTheme, setTheme }),\n [currentTheme, resolvedTheme, setTheme],\n );\n const mergedStyle = useMemo(() => ({ ...style, ...tokenStyles(tokens) }), [style, tokens]);\n const scopedTokenStyles = useMemo(() => tokenStyles(tokens), [tokens]);\n const Root = as;\n const setRootRef = useCallback(\n (element: HTMLElement | null) => {\n setScopeElement((current) => (current === element ? current : element));\n if (typeof ref === \"function\") ref(element);\n else if (ref) (ref as { current: HTMLElement | null }).current = element;\n },\n [ref],\n );\n\n useEffect(() => {\n if (!scopeElement || typeof document === \"undefined\") return;\n\n const host = document.createElement(\"div\");\n host.dataset.jaciThemePortal = \"true\";\n host.dataset.jaciComponent = \"theme-portal\";\n host.dataset.slot = \"theme-portal\";\n // Keep the host out of the Storybook/app layout. Its descendants still\n // inherit the theme attribute and scoped custom properties.\n host.style.display = \"contents\";\n document.body.append(host);\n setPortalContainer(host);\n\n return () => {\n setPortalContainer((current) => (current === host ? null : current));\n host.remove();\n };\n }, [scopeElement]);\n\n useEffect(() => {\n if (!portalContainer) return;\n\n portalContainer.dataset.jaciTheme = resolvedTheme;\n for (const [property, value] of Object.entries(scopedTokenStyles)) {\n portalContainer.style.setProperty(property, value);\n }\n\n return () => {\n for (const property of Object.keys(scopedTokenStyles)) {\n portalContainer.style.removeProperty(property);\n }\n };\n }, [portalContainer, resolvedTheme, scopedTokenStyles]);\n\n return (\n <ThemeContext.Provider value={contextValue}>\n <ThemeScopeContext.Provider value={{ container: portalContainer }}>\n {createElement(\n Root,\n {\n ...props,\n \"data-jaci-theme\": resolvedTheme,\n \"data-jaci-component\": \"theme-provider\",\n \"data-slot\": \"theme-provider\",\n ref: setRootRef as Ref<HTMLElement>,\n style: mergedStyle,\n },\n children,\n )}\n </ThemeScopeContext.Provider>\n </ThemeContext.Provider>\n );\n});\n\nexport function useTheme() {\n return useContext(ThemeContext);\n}\n"],"mappings":";;;;;AAwFA,MAAM,eAAe,cAAiC;CALpD,OAAO;CACP,eAAe;CACf,gBAAgB,KAAA;AAGsD,CAAC;AAEzE,SAAS,UAAU,OAAe;CAChC,OAAO,MACJ,QAAQ,sBAAsB,OAAO,CAAC,CACtC,QAAQ,WAAW,GAAG,CAAC,CACvB,YAAY;AACjB;AAEA,SAAS,cACP,OACA,MACA,QACA;CACA,IAAI,CAAC,OAAO;CAEZ,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAAG;EAChD,IAAI,UAAU,KAAA,GAAW;EACzB,MAAM,WAAW,CAAC,GAAG,MAAM,UAAU,GAAG,CAAC;EAEzC,IAAI,OAAO,UAAU,UACnB,cAAc,OAAO,UAAU,MAAM;OAErC,OAAO,UAAU,SAAS,KAAK,GAAG,OAAO,OAAO,KAAK;CAEzD;AACF;AAEA,SAAS,YAAY,QAAoD;CACvE,IAAI,CAAC,QAAQ,OAAO,CAAC;CAErB,MAAM,YAAoC,CAAC;CAC3C,KAAK,MAAM,CAAC,OAAO,WAAW,OAAO,QAAQ,MAAM,GACjD,cAAc,QAAQ,CAAC,UAAU,KAAK,CAAC,GAAG,SAAS;CAGrD,OAAO;AACT;AAEA,SAAS,mBAAmB,UAAwC;CAClE,OAAO,YAAY;AACrB;AAEA,MAAa,gBAAgB,WAA4C,SAAS,cAChF,EACE,KAAK,OACL,UACA,eAAe,SACf,eACA,UACA,OACA,OACA,QACA,GAAG,SAEL,KACA;CACA,MAAM,CAAC,mBAAmB,wBAAwB,SAAoB,YAAY;CAClF,MAAM,CAAC,aAAa,kBAAkB,eACpC,mBAAmB,QAAQ,CAC7B;CACA,MAAM,CAAC,cAAc,mBAAmB,SAA6B,IAAI;CACzE,MAAM,CAAC,iBAAiB,sBAAsB,SAA6B,IAAI;CAC/E,MAAM,eAAe,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B,KAAK,MAAM,UAAU;EACrB,SAAS,KAAK,OAAO,IAAI;EACzB,mBAAmB,IAAI;EAEvB,aAAa;GACX,oBAAoB,YAAa,YAAY,OAAO,OAAO,OAAQ;GACnE,KAAK,OAAO;EACd;CACF,GAAG,CAAC,YAAY,CAAC;CAEjB,gBAAgB;EACd,IAAI,CAAC,iBAAiB;EAEtB,gBAAgB,QAAQ,YAAY;EACpC,KAAK,MAAM,CAAC,UAAU,UAAU,OAAO,QAAQ,iBAAiB,GAC9D,gBAAgB,MAAM,YAAY,UAAU,KAAK;EAGnD,aAAa;GACX,KAAK,MAAM,YAAY,OAAO,KAAK,iBAAiB,GAClD,gBAAgB,MAAM,eAAe,QAAQ;EAEjD;CACF,GAAG;EAAC;EAAiB;EAAe;CAAiB,CAAC;CAEtD,OACE,oBAAC,aAAa,UAAd;EAAuB,OAAO;YAC5B,oBAAC,kBAAkB,UAAnB;GAA4B,OAAO,EAAE,WAAW,gBAAgB;aAC7D,cACC,MACA;IACE,GAAG;IACH,mBAAmB;IACnB,uBAAuB;IACvB,aAAa;IACb,KAAK;IACL,OAAO;GACT,GACA,QACF;EAC0B,CAAA;CACP,CAAA;AAE3B,CAAC;AAED,SAAgB,WAAW;CACzB,OAAO,WAAW,YAAY;AAChC"}
|
|
1
|
+
{"version":3,"file":"theme-provider.js","names":[],"sources":["../../src/theme/theme-provider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n createElement,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithoutRef, CSSProperties, ElementType, ReactNode, Ref } from \"react\";\n\nimport { ThemeScopeContext } from \"./theme-scope\";\n\nexport type ThemeMode = \"light\" | \"dark\" | \"system\";\n\n/** A leaf value accepted by the theme variable mapper. */\nexport type JaciThemeTokenValue = string | number;\n\n/**\n * Semantic theme values. The groups intentionally accept additional keys so\n * applications can extend the token vocabulary without waiting for a package\n * release. Known semantic groups are documented in the public README.\n */\nexport type JaciThemeTokenGroup = {\n readonly [key: string]: JaciThemeTokenValue | JaciThemeTokenGroup | undefined;\n};\n\nexport interface JaciThemeColorTokens extends JaciThemeTokenGroup {\n surface?: JaciThemeTokenGroup;\n fg?: JaciThemeTokenGroup;\n border?: JaciThemeTokenGroup;\n accent?: JaciThemeTokenGroup;\n success?: JaciThemeTokenValue;\n warning?: JaciThemeTokenValue;\n danger?: JaciThemeTokenValue;\n info?: JaciThemeTokenValue;\n link?: JaciThemeTokenGroup;\n focus?: JaciThemeTokenValue;\n disabled?: JaciThemeTokenValue;\n selected?: JaciThemeTokenValue;\n}\n\nexport interface JaciThemeTokens {\n colors?: JaciThemeColorTokens;\n radii?: JaciThemeTokenGroup;\n shadows?: JaciThemeTokenGroup;\n durations?: JaciThemeTokenGroup;\n easings?: JaciThemeTokenGroup;\n transitions?: JaciThemeTokenGroup;\n spacing?: JaciThemeTokenGroup;\n fontSizes?: JaciThemeTokenGroup;\n lineHeights?: JaciThemeTokenGroup;\n typography?: JaciThemeTokenGroup;\n textStyles?: JaciThemeTokenGroup;\n fonts?: JaciThemeTokenGroup;\n}\n\nexport interface ThemeProviderProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** The controlled color mode. */\n theme?: ThemeMode;\n /** The initial color mode for an uncontrolled provider. */\n defaultTheme?: ThemeMode;\n /** The deterministic mode used for `system` while rendering on the server. */\n ssrTheme?: \"light\" | \"dark\";\n /** Scoped semantic token overrides. */\n tokens?: JaciThemeTokens;\n /** Called when a controlled provider requests a mode change. */\n onThemeChange?: (theme: ThemeMode) => void;\n /** The element that owns the theme scope. */\n as?: ElementType;\n children?: ReactNode;\n}\n\nexport interface ThemeContextValue {\n theme: ThemeMode;\n resolvedTheme: \"light\" | \"dark\";\n setTheme: (theme: ThemeMode) => void;\n}\n\nconst defaultThemeContext: ThemeContextValue = {\n theme: \"light\",\n resolvedTheme: \"light\",\n setTheme: () => undefined,\n};\n\nconst ThemeContext = createContext<ThemeContextValue>(defaultThemeContext);\n\nfunction kebabCase(value: string) {\n return value\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .replace(/[\\s_]+/g, \"-\")\n .toLowerCase();\n}\n\nfunction flattenTokens(\n group: JaciThemeTokenGroup | undefined,\n path: string[],\n output: Record<string, string>,\n) {\n if (!group) return;\n\n for (const [key, value] of Object.entries(group)) {\n if (value === undefined) continue;\n const nextPath = [...path, kebabCase(key)];\n\n if (typeof value === \"object\") {\n flattenTokens(value, nextPath, output);\n } else {\n output[`--jaci-${nextPath.join(\"-\")}`] = String(value);\n }\n }\n}\n\nfunction tokenStyles(tokens: JaciThemeTokens | undefined): CSSProperties {\n if (!tokens) return {};\n\n const variables: Record<string, string> = {};\n for (const [group, values] of Object.entries(tokens)) {\n flattenTokens(values, [kebabCase(group)], variables);\n }\n\n return variables as CSSProperties;\n}\n\nfunction initialSystemTheme(ssrTheme: \"light\" | \"dark\" | undefined) {\n return ssrTheme ?? \"light\";\n}\n\nexport const ThemeProvider = forwardRef<HTMLElement, ThemeProviderProps>(function ThemeProvider(\n {\n as = \"div\",\n children,\n defaultTheme = \"light\",\n onThemeChange,\n ssrTheme,\n style,\n theme,\n tokens,\n ...props\n },\n ref,\n) {\n const [uncontrolledTheme, setUncontrolledTheme] = useState<ThemeMode>(defaultTheme);\n const [systemTheme, setSystemTheme] = useState<\"light\" | \"dark\">(() =>\n initialSystemTheme(ssrTheme),\n );\n const [scopeElement, setScopeElement] = useState<HTMLElement | null>(null);\n const [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null);\n const currentTheme = theme ?? uncontrolledTheme;\n\n useEffect(() => {\n if (currentTheme !== \"system\") return;\n\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return;\n\n const media = window.matchMedia(\"(prefers-color-scheme: dark)\");\n const update = () => setSystemTheme(media.matches ? \"dark\" : \"light\");\n update();\n if (typeof media.addEventListener === \"function\") media.addEventListener(\"change\", update);\n else media.addListener?.(update);\n\n return () => {\n if (typeof media.removeEventListener === \"function\")\n media.removeEventListener(\"change\", update);\n else media.removeListener?.(update);\n };\n }, [currentTheme]);\n\n const resolvedTheme = currentTheme === \"system\" ? systemTheme : currentTheme;\n const setTheme = useCallback(\n (nextTheme: ThemeMode) => {\n if (theme === undefined) setUncontrolledTheme(nextTheme);\n onThemeChange?.(nextTheme);\n },\n [onThemeChange, theme],\n );\n const contextValue = useMemo(\n () => ({ theme: currentTheme, resolvedTheme, setTheme }),\n [currentTheme, resolvedTheme, setTheme],\n );\n const mergedStyle = useMemo(() => ({ ...style, ...tokenStyles(tokens) }), [style, tokens]);\n const scopedTokenStyles = useMemo(() => tokenStyles(tokens), [tokens]);\n const Root = as;\n const setRootRef = useCallback(\n (element: HTMLElement | null) => {\n setScopeElement((current) => (current === element ? current : element));\n if (typeof ref === \"function\") ref(element);\n else if (ref) (ref as { current: HTMLElement | null }).current = element;\n },\n [ref],\n );\n\n useEffect(() => {\n if (!scopeElement || typeof document === \"undefined\") return;\n\n const host = document.createElement(\"div\");\n host.dataset.jaciThemePortal = \"true\";\n host.dataset.jaciComponent = \"theme-portal\";\n host.dataset.slot = \"theme-portal\";\n // Keep the host out of the Storybook/app layout. Its descendants still\n // inherit the theme attribute and scoped custom properties.\n host.style.display = \"contents\";\n document.body.append(host);\n setPortalContainer(host);\n\n return () => {\n setPortalContainer((current) => (current === host ? null : current));\n host.remove();\n };\n }, [scopeElement]);\n\n useEffect(() => {\n if (!portalContainer) return;\n\n portalContainer.dataset.jaciTheme = resolvedTheme;\n for (const [property, value] of Object.entries(scopedTokenStyles)) {\n portalContainer.style.setProperty(property, value);\n }\n\n return () => {\n for (const property of Object.keys(scopedTokenStyles)) {\n portalContainer.style.removeProperty(property);\n }\n };\n }, [portalContainer, resolvedTheme, scopedTokenStyles]);\n\n return (\n <ThemeContext.Provider value={contextValue}>\n <ThemeScopeContext.Provider value={{ container: portalContainer }}>\n {createElement(\n Root,\n {\n ...props,\n \"data-jaci-theme\": resolvedTheme,\n \"data-jaci-component\": \"theme-provider\",\n \"data-slot\": \"theme-provider\",\n ref: setRootRef as Ref<HTMLElement>,\n style: mergedStyle,\n },\n children,\n )}\n </ThemeScopeContext.Provider>\n </ThemeContext.Provider>\n );\n});\n\nexport function useTheme() {\n return useContext(ThemeContext);\n}\n"],"mappings":";;;;;AAwFA,MAAM,eAAe,cAAiC;CALpD,OAAO;CACP,eAAe;CACf,gBAAgB,KAAA;AAGsD,CAAC;AAEzE,SAAS,UAAU,OAAe;CAChC,OAAO,MACJ,QAAQ,sBAAsB,OAAO,CAAC,CACtC,QAAQ,WAAW,GAAG,CAAC,CACvB,YAAY;AACjB;AAEA,SAAS,cACP,OACA,MACA,QACA;CACA,IAAI,CAAC,OAAO;CAEZ,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAAG;EAChD,IAAI,UAAU,KAAA,GAAW;EACzB,MAAM,WAAW,CAAC,GAAG,MAAM,UAAU,GAAG,CAAC;EAEzC,IAAI,OAAO,UAAU,UACnB,cAAc,OAAO,UAAU,MAAM;OAErC,OAAO,UAAU,SAAS,KAAK,GAAG,OAAO,OAAO,KAAK;CAEzD;AACF;AAEA,SAAS,YAAY,QAAoD;CACvE,IAAI,CAAC,QAAQ,OAAO,CAAC;CAErB,MAAM,YAAoC,CAAC;CAC3C,KAAK,MAAM,CAAC,OAAO,WAAW,OAAO,QAAQ,MAAM,GACjD,cAAc,QAAQ,CAAC,UAAU,KAAK,CAAC,GAAG,SAAS;CAGrD,OAAO;AACT;AAEA,SAAS,mBAAmB,UAAwC;CAClE,OAAO,YAAY;AACrB;AAEA,MAAa,gBAAgB,WAA4C,SAAS,cAChF,EACE,KAAK,OACL,UACA,eAAe,SACf,eACA,UACA,OACA,OACA,QACA,GAAG,SAEL,KACA;CACA,MAAM,CAAC,mBAAmB,wBAAwB,SAAoB,YAAY;CAClF,MAAM,CAAC,aAAa,kBAAkB,eACpC,mBAAmB,QAAQ,CAC7B;CACA,MAAM,CAAC,cAAc,mB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ACzC,KAAK,QAAQ,kBAAkB;EAC/B,KAAK,QAAQ,gBAAgB;EAC7B,KAAK,QAAQ,OAAO;EAGpB,KAAK,MAAM,UAAU;EACrB,SAAS,KAAK,OAAO,IAAI;EACzB,mBAAmB,IAAI;EAEvB,aAAa;GACX,oBAAoB,YAAa,YAAY,OAAO,OAAO,OAAQ;GACnE,KAAK,OAAO;EACd;CACF,GAAG,CAAC,YAAY,CAAC;CAEjB,gBAAgB;EACd,IAAI,CAAC,iBAAiB;EAEtB,gBAAgB,QAAQ,YAAY;EACpC,KAAK,MAAM,CAAC,UAAU,UAAU,OAAO,QAAQ,iBAAiB,GAC9D,gBAAgB,MAAM,YAAY,UAAU,KAAK;EAGnD,aAAa;GACX,KAAK,MAAM,YAAY,OAAO,KAAK,iBAAiB,GAClD,gBAAgB,MAAM,eAAe,QAAQ;EAEjD;CACF,GAAG;EAAC;EAAiB;EAAe;CAAiB,CAAC;CAEtD,OACE,oBAAC,aAAa,UAAd;EAAuB,OAAO;EAC5B,UAAA,oBAAC,kBAAkB,UAAnB;GAA4B,OAAO,EAAE,WAAW,gBAAgB;GAC7D,UAAA,cACC,MACA;IACE,GAAG;IACH,mBAAmB;IACnB,uBAAuB;IACvB,aAAa;IACb,KAAK;IACL,OAAO;GACT,GACA,QACF;EAC0B,CAAA;CACP,CAAA;AAE3B,CAAC;AAED,SAAgB,WAAW;CACzB,OAAO,WAAW,YAAY;AAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-scope.cjs","names":[],"sources":["../../src/theme/theme-scope.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext } from \"react\";\nimport type { RefObject } from \"react\";\n\nexport type ThemePortalContainer =\n | HTMLElement\n | ShadowRoot\n | null\n | RefObject<HTMLElement | ShadowRoot | null>;\n\nexport interface ThemeScopeValue {\n container: HTMLElement | null;\n}\n\nexport const ThemeScopeContext = createContext<ThemeScopeValue>({ container: null });\n\nexport function useThemePortalContainer() {\n return useContext(ThemeScopeContext).container;\n}\n\nexport function useThemePortalProps<T extends { container?: ThemePortalContainer | undefined }>(\n props: T,\n): T {\n const scopedContainer = useThemePortalContainer();\n\n if (props.container !== undefined || scopedContainer === null) return props;\n\n return { ...props, container: scopedContainer };\n}\n"],"mappings":";;;AAeA,MAAa,qBAAA,
|
|
1
|
+
{"version":3,"file":"theme-scope.cjs","names":["createContext","useContext"],"sources":["../../src/theme/theme-scope.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext } from \"react\";\nimport type { RefObject } from \"react\";\n\nexport type ThemePortalContainer =\n | HTMLElement\n | ShadowRoot\n | null\n | RefObject<HTMLElement | ShadowRoot | null>;\n\nexport interface ThemeScopeValue {\n container: HTMLElement | null;\n}\n\nexport const ThemeScopeContext = createContext<ThemeScopeValue>({ container: null });\n\nexport function useThemePortalContainer() {\n return useContext(ThemeScopeContext).container;\n}\n\nexport function useThemePortalProps<T extends { container?: ThemePortalContainer | undefined }>(\n props: T,\n): T {\n const scopedContainer = useThemePortalContainer();\n\n if (props.container !== undefined || scopedContainer === null) return props;\n\n return { ...props, container: scopedContainer };\n}\n"],"mappings":";;;AAeA,MAAa,qBAAA,GAAoBA,MAAAA,cAAAA,CAA+B,EAAE,WAAW,KAAK,CAAC;AAEnF,SAAgB,0BAA0B;CACxC,QAAA,GAAOC,MAAAA,WAAAA,CAAW,iBAAiB,CAAC,CAAC;AACvC;AAEA,SAAgB,oBACd,OACG;CACH,MAAM,kBAAkB,wBAAwB;CAEhD,IAAI,MAAM,cAAc,KAAA,KAAa,oBAAoB,MAAM,OAAO;CAEtE,OAAO;EAAE,GAAG;EAAO,WAAW;CAAgB;AAChD"}
|