@structyl/themes 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/dist/index.cjs ADDED
@@ -0,0 +1,928 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule) return e;
8
+ var n = Object.create(null);
9
+ if (e) {
10
+ Object.keys(e).forEach(function (k) {
11
+ if (k !== 'default') {
12
+ var d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () { return e[k]; }
16
+ });
17
+ }
18
+ });
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+
24
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
25
+
26
+ // src/theme-provider.tsx
27
+
28
+ // src/palette.ts
29
+ var sharedSemanticLight = {
30
+ // Error
31
+ "error-light": "249 218 223",
32
+ "error-dark": "131 24 63",
33
+ "error-contrast": "255 255 255",
34
+ "error-dark-bg": "167 56 95",
35
+ "error-state-contained": "rgba(167, 56, 95, 0.9)",
36
+ "error-state-outlined": "rgba(221, 60, 113, 0.1)",
37
+ "error-state-resting": "rgba(221, 60, 113, 0.5)",
38
+ "error-alert-bg": "rgba(60, 47, 58, 0.9)",
39
+ "error-alert-content": "rgba(114, 52, 76, 1)",
40
+ "error-shade-12": "rgba(221, 60, 113, 0.12)",
41
+ "error-shade-16": "rgba(221, 60, 113, 0.16)",
42
+ // Warning
43
+ "warning-light": "249 220 210",
44
+ "warning-dark": "122 45 16",
45
+ "warning-contrast": "255 255 255",
46
+ "warning-dark-bg": "191 75 30",
47
+ "warning-state-contained": "rgba(191, 75, 30, 0.9)",
48
+ "warning-state-outlined": "rgba(255, 87, 20, 0.1)",
49
+ "warning-state-resting": "rgba(255, 87, 20, 0.5)",
50
+ "warning-alert-bg": "rgba(85, 54, 46, 0.9)",
51
+ "warning-alert-content": "rgba(127, 62, 39, 1)",
52
+ "warning-shade-12": "rgba(255, 87, 20, 0.12)",
53
+ "warning-shade-16": "rgba(255, 87, 20, 0.16)",
54
+ // Info
55
+ "info-light": "227 223 252",
56
+ "info-dark": "47 32 159",
57
+ "info-contrast": "255 255 255",
58
+ "info-dark-bg": "95 88 179",
59
+ "info-state-contained": "rgba(95, 88, 179, 0.9)",
60
+ "info-state-outlined": "rgba(117, 106, 234, 0.1)",
61
+ "info-state-resting": "rgba(117, 106, 234, 0.5)",
62
+ "info-alert-bg": "rgba(49, 52, 70, 0.9)",
63
+ "info-alert-content": "rgba(72, 70, 125, 1)",
64
+ "info-shade-12": "rgba(117, 106, 234, 0.12)",
65
+ "info-shade-16": "rgba(117, 106, 234, 0.16)",
66
+ // Success
67
+ "success-light": "153 252 128",
68
+ "success-dark": "33 82 25",
69
+ "success-contrast": "255 255 255",
70
+ "success-dark-bg": "33 82 25",
71
+ "success-state-contained": "rgba(56, 159, 63, 0.9)",
72
+ "success-state-outlined": "rgba(62, 208, 68, 0.1)",
73
+ "success-state-resting": "rgba(62, 208, 68, 0.5)",
74
+ "success-alert-bg": "rgba(44, 62, 54, 0.9)",
75
+ "success-alert-content": "rgba(50, 111, 58, 1)",
76
+ "success-shade-12": "rgba(62, 208, 68, 0.12)",
77
+ "success-shade-16": "rgba(62, 208, 68, 0.16)",
78
+ backdrop: "rgba(0, 0, 0, 0.5)",
79
+ "rating-active": "251 191 36"
80
+ };
81
+ var sharedSemanticDark = {
82
+ // Error
83
+ "error-light": "166 44 85",
84
+ "error-dark": "249 218 223",
85
+ "error-contrast": "143 0 63",
86
+ "error-dark-bg": "167 56 95",
87
+ "error-state-contained": "rgba(184, 140, 151, 0.9)",
88
+ "error-state-outlined": "rgba(221, 60, 113, 0.05)",
89
+ "error-state-resting": "rgba(221, 60, 113, 0.5)",
90
+ "error-alert-bg": "rgba(253, 240, 243, 1)",
91
+ "error-alert-content": "rgba(251, 225, 230, 1)",
92
+ "error-shade-12": "rgba(221, 60, 113, 0.12)",
93
+ "error-shade-16": "rgba(221, 60, 113, 0.16)",
94
+ // Warning
95
+ "warning-light": "159 61 25",
96
+ "warning-dark": "249 220 210",
97
+ "warning-contrast": "132 38 0",
98
+ "warning-dark-bg": "191 75 30",
99
+ "warning-state-contained": "rgba(184, 143, 128, 0.9)",
100
+ "warning-state-outlined": "rgba(244, 184, 161, 0.2)",
101
+ "warning-state-resting": "rgba(244, 184, 161, 0.6)",
102
+ "warning-alert-bg": "rgba(253, 241, 236, 1)",
103
+ "warning-alert-content": "rgba(251, 227, 217, 1)",
104
+ "warning-shade-12": "rgba(255, 87, 20, 0.12)",
105
+ "warning-shade-16": "rgba(255, 87, 20, 0.16)",
106
+ // Info
107
+ "info-light": "85 74 195",
108
+ "info-dark": "226 223 252",
109
+ "info-contrast": "63 47 177",
110
+ "info-dark-bg": "95 88 179",
111
+ "info-state-contained": "rgba(150, 148, 191, 1)",
112
+ "info-state-outlined": "rgba(196, 192, 250, 0.2)",
113
+ "info-state-resting": "rgba(196, 192, 250, 0.6)",
114
+ "info-alert-bg": "rgba(243, 242, 254, 1)",
115
+ "info-alert-content": "rgba(231, 230, 253, 1)",
116
+ "info-shade-12": "rgba(117, 106, 234, 0.12)",
117
+ "info-shade-16": "rgba(117, 106, 234, 0.16)",
118
+ // Success
119
+ "success-light": "46 108 36",
120
+ "success-dark": "153 252 128",
121
+ "success-contrast": "0 83 12",
122
+ "success-dark-bg": "46 108 36",
123
+ "success-state-contained": "rgba(100, 170, 88, 0.9)",
124
+ "success-state-outlined": "rgba(125, 223, 103, 0.2)",
125
+ "success-state-resting": "rgba(125, 223, 103, 0.6)",
126
+ "success-alert-bg": "rgba(229, 249, 225, 1)",
127
+ "success-alert-content": "rgba(203, 242, 194, 1)",
128
+ "success-shade-12": "rgba(62, 208, 68, 0.12)",
129
+ "success-shade-16": "rgba(62, 208, 68, 0.16)",
130
+ backdrop: "rgba(0, 0, 0, 0.5)",
131
+ "rating-active": "251 191 36"
132
+ };
133
+ var structylSubTokensLight = {
134
+ // Primary (#5754A3)
135
+ "primary-light": "195 192 250",
136
+ "primary-dark": "27 20 100",
137
+ "primary-contrast": "255 255 255",
138
+ "primary-dark-bg": "32 28 86",
139
+ "primary-state-contained": "rgba(42, 46, 52, 0.3)",
140
+ "primary-state-outlined": "rgba(87, 84, 163, 0.1)",
141
+ "primary-state-resting": "rgba(87, 84, 163, 0.5)",
142
+ "primary-shade-12": "rgba(27, 20, 100, 0.12)",
143
+ "primary-shade-16": "rgba(27, 20, 100, 0.16)",
144
+ // Secondary (#2578FF)
145
+ "secondary-light": "219 226 252",
146
+ "secondary-dark": "25 65 149",
147
+ "secondary-contrast": "255 255 255",
148
+ "secondary-dark-bg": "39 98 194",
149
+ "secondary-state-contained": "rgba(42, 46, 52, 0.3)",
150
+ "secondary-state-outlined": "rgba(37, 120, 255, 0.1)",
151
+ "secondary-state-resting": "rgba(37, 120, 255, 0.5)",
152
+ "secondary-shade-12": "rgba(37, 120, 255, 0.12)",
153
+ "secondary-shade-16": "rgba(37, 120, 255, 0.16)",
154
+ // Text
155
+ text: "42 46 52",
156
+ "text-secondary": "rgba(42, 46, 52, 0.6)",
157
+ "text-disabled": "rgba(42, 46, 52, 0.38)",
158
+ "text-info": "117 106 234",
159
+ "text-fill": "27 20 100",
160
+ "text-shade-12": "rgba(42, 46, 52, 0.12)",
161
+ "text-shade-16": "rgba(42, 46, 52, 0.16)",
162
+ // Surface
163
+ surface: "250 250 250",
164
+ "surface-paper": "255 255 255",
165
+ // Divider / borders
166
+ divider: "rgba(42, 46, 52, 0.23)",
167
+ "outlined-border": "rgba(42, 46, 52, 0.12)",
168
+ "input-line": "rgba(42, 46, 52, 0.42)",
169
+ // Action
170
+ "action-active": "rgba(42, 46, 52, 0.54)",
171
+ "action-hover": "rgba(37, 120, 255, 0.05)",
172
+ "action-selected": "rgba(42, 46, 52, 0.08)",
173
+ "action-disabled": "rgba(42, 46, 52, 0.26)",
174
+ "action-disabled-bg": "rgba(42, 46, 52, 0.12)",
175
+ "action-focus": "rgba(42, 46, 52, 0.12)",
176
+ // Misc
177
+ "snackbar-bg": "42 46 52",
178
+ "map-grid": "255 255 255",
179
+ // Table
180
+ "table-top-header": "238 245 255",
181
+ "table-header": "238 239 239",
182
+ "table-row": "255 255 255",
183
+ "table-col-border": "250 250 250",
184
+ "table-border": "rgba(229, 229, 230, 1)",
185
+ ...sharedSemanticLight
186
+ };
187
+ var structylSubTokensDark = {
188
+ // Primary (#C3C0FA in dark)
189
+ "primary-light": "75 72 150",
190
+ "primary-dark": "219 226 252",
191
+ "primary-contrast": "27 20 100",
192
+ "primary-dark-bg": "32 28 86",
193
+ "primary-state-contained": "rgba(42, 46, 52, 0.3)",
194
+ "primary-state-outlined": "rgba(195, 192, 250, 0.2)",
195
+ "primary-state-resting": "rgba(195, 192, 250, 0.6)",
196
+ "primary-shade-12": "rgba(27, 20, 100, 0.12)",
197
+ "primary-shade-16": "rgba(27, 20, 100, 0.16)",
198
+ // Secondary (#B4C5FA in dark)
199
+ "secondary-light": "36 87 195",
200
+ "secondary-dark": "219 226 252",
201
+ "secondary-contrast": "0 45 110",
202
+ "secondary-dark-bg": "39 98 194",
203
+ "secondary-state-contained": "rgba(42, 46, 52, 0.3)",
204
+ "secondary-state-outlined": "rgba(180, 197, 250, 0.2)",
205
+ "secondary-state-resting": "rgba(180, 197, 250, 0.6)",
206
+ "secondary-shade-12": "rgba(37, 120, 255, 0.12)",
207
+ "secondary-shade-16": "rgba(37, 120, 255, 0.16)",
208
+ // Text
209
+ text: "255 255 255",
210
+ "text-secondary": "rgba(255, 255, 255, 0.7)",
211
+ "text-disabled": "rgba(255, 255, 255, 0.5)",
212
+ "text-info": "117 106 234",
213
+ "text-fill": "255 255 255",
214
+ "text-shade-12": "rgba(42, 46, 52, 0.12)",
215
+ "text-shade-16": "rgba(42, 46, 52, 0.16)",
216
+ // Surface
217
+ surface: "42 46 52",
218
+ "surface-paper": "46 50 56",
219
+ // Divider / borders
220
+ divider: "rgba(255, 255, 255, 0.23)",
221
+ "outlined-border": "rgba(255, 255, 255, 0.12)",
222
+ "input-line": "rgba(255, 255, 255, 0.42)",
223
+ // Action
224
+ "action-active": "rgba(255, 255, 255, 0.54)",
225
+ "action-hover": "rgba(180, 197, 250, 0.05)",
226
+ "action-selected": "rgba(255, 255, 255, 0.08)",
227
+ "action-disabled": "rgba(255, 255, 255, 0.26)",
228
+ "action-disabled-bg": "rgba(255, 255, 255, 0.12)",
229
+ "action-focus": "rgba(255, 255, 255, 0.12)",
230
+ // Misc
231
+ "snackbar-bg": "255 255 255",
232
+ "map-grid": "37 120 255",
233
+ // Table
234
+ "table-top-header": "50 52 65",
235
+ "table-header": "57 60 66",
236
+ "table-row": "46 50 56",
237
+ "table-col-border": "42 46 52",
238
+ "table-border": "rgba(81, 81, 81, 1)",
239
+ ...sharedSemanticDark
240
+ };
241
+ var staticPalette = {
242
+ yellow: { "50": "#fffde7", "100": "#fff9c4", "200": "#fff59d", "300": "#fff176", "400": "#ffee58", "500": "#ffeb3b", "600": "#fdd835", "700": "#fbc02d", "800": "#f9a825", "900": "#f57f17", A100: "#ffff8d", A200: "#ffff00", A400: "#ffea00", A700: "#ffd600" },
243
+ amber: { "50": "#fff8e1", "100": "#ffecb3", "200": "#ffe082", "300": "#ffd54f", "400": "#ffca28", "500": "#ffc107", "600": "#ffb300", "700": "#ffa000", "800": "#ff8f00", "900": "#ff6f00", A100: "#ffe57f", A200: "#ffd740", A400: "#ffc400", A700: "#ffab00" },
244
+ blue: { "50": "#e3f2fd", "100": "#bbdefb", "200": "#90caf9", "300": "#64b5f6", "400": "#42a5f5", "500": "#2196f3", "600": "#1e88e5", "700": "#1976d2", "800": "#1565c0", "900": "#0d47a1", A100: "#82b1ff", A200: "#448aff", A400: "#2979ff", A700: "#2962ff" },
245
+ blueGrey: { "50": "#eceff1", "100": "#cfd8dc", "200": "#b0bec5", "300": "#90a4ae", "400": "#78909c", "500": "#607d8b", "600": "#546e7a", "700": "#455a64", "800": "#37474f", "900": "#263238", A100: "#cfd8dc", A200: "#b0bec5", A400: "#78909c", A700: "#455a64" },
246
+ brown: { "50": "#efebe9", "100": "#d7ccc8", "200": "#bcaaa4", "300": "#a1887f", "400": "#8d6e63", "500": "#795548", "600": "#6d4c41", "700": "#5d4037", "800": "#4e342e", "900": "#3e2723", A100: "#d7ccc8", A200: "#bcaaa4", A400: "#8d6e63", A700: "#5d4037" },
247
+ teal: { "50": "#e0f2f1", "100": "#b2dfdb", "200": "#80cbc4", "300": "#4db6ac", "400": "#26a69a", "500": "#009688", "600": "#00897b", "700": "#00796b", "800": "#00695c", "900": "#004d40", A100: "#a7ffeb", A200: "#64ffda", A400: "#1de9b6", A700: "#00bfa5" },
248
+ red: { "50": "#ffebee", "100": "#ffcdd2", "200": "#ef9a9a", "300": "#e57373", "400": "#ef5350", "500": "#f44336", "600": "#e53935", "700": "#d32f2f", "800": "#c62828", "900": "#b71c1c", A100: "#ff8a80", A200: "#ff5252", A400: "#ff1744", A700: "#d50000" },
249
+ purple: { "50": "#f3e5f5", "100": "#e1bee7", "200": "#ce93d8", "300": "#ba68c8", "400": "#ab47bc", "500": "#9c27b0", "600": "#8e24aa", "700": "#7b1fa2", "800": "#6a1b9a", "900": "#4a148c", A100: "#ea80fc", A200: "#e040fb", A400: "#d500f9", A700: "#aa00ff" },
250
+ pink: { "50": "#fce4ec", "100": "#f8bbd0", "200": "#f48fb1", "300": "#f06292", "400": "#ec407a", "500": "#e91e63", "600": "#d81b60", "700": "#c2185b", "800": "#ad1457", "900": "#880e4f", A100: "#ff80ab", A200: "#ff4081", A400: "#f50057", A700: "#c51162" },
251
+ orange: { "50": "#fff3e0", "100": "#ffe0b2", "200": "#ffcc80", "300": "#ffb74d", "400": "#ffa726", "500": "#ff9800", "600": "#fb8c00", "700": "#f57c00", "800": "#ef6c00", "900": "#e65100", A100: "#ffd180", A200: "#ffab40", A400: "#ff9100", A700: "#ff6d00" },
252
+ lime: { "50": "#f9fbe7", "100": "#f0f4c3", "200": "#e6ee9c", "300": "#dce775", "400": "#d4e157", "500": "#cddc39", "600": "#c0ca33", "700": "#afb42b", "800": "#9e9d24", "900": "#827717", A100: "#f4ff81", A200: "#eeff41", A400: "#c6ff00", A700: "#aeea00" },
253
+ lightGreen: { "50": "#f1f8e9", "100": "#dcedc8", "200": "#c5e1a5", "300": "#aed581", "400": "#9ccc65", "500": "#8bc34a", "600": "#7cb342", "700": "#689f38", "800": "#558b2f", "900": "#33691e", A100: "#ccff90", A200: "#b2ff59", A400: "#76ff03", A700: "#64dd17" },
254
+ cyan: { "50": "#e0f7fa", "100": "#b2ebf2", "200": "#80deea", "300": "#4dd0e1", "400": "#26c6da", "500": "#00bcd4", "600": "#00acc1", "700": "#0097a7", "800": "#00838f", "900": "#006064", A100: "#84ffff", A200: "#18ffff", A400: "#00e5ff", A700: "#00b8d4" },
255
+ deepOrange: { "50": "#fbe9e7", "100": "#ffccbc", "200": "#ffab91", "300": "#ff8a65", "400": "#ff7043", "500": "#ff5722", "600": "#f4511e", "700": "#e64a19", "800": "#d84315", "900": "#bf360c", A100: "#ff9e80", A200: "#ff6e40", A400: "#ff3d00", A700: "#dd2c00" },
256
+ deepPurple: { "50": "#ede7f6", "100": "#d1c4e9", "200": "#b39ddb", "300": "#9575cd", "400": "#7e57c2", "500": "#673ab7", "600": "#5e35b1", "700": "#512da8", "800": "#4527a0", "900": "#311b92", A100: "#b388ff", A200: "#7c4dff", A400: "#651fff", A700: "#6200ea" },
257
+ green: { "50": "#e8f5e9", "100": "#c8e6c9", "200": "#a5d6a7", "300": "#81c784", "400": "#66bb6a", "500": "#4caf50", "600": "#43a047", "700": "#388e3c", "800": "#2e7d32", "900": "#1b5e20", A100: "#b9f6ca", A200: "#69f0ae", A400: "#00e676", A700: "#00c853" },
258
+ grey: { "50": "#fafafa", "100": "#f5f5f5", "200": "#eeeeee", "300": "#e0e0e0", "400": "#bdbdbd", "500": "#9e9e9e", "600": "#757575", "700": "#616161", "800": "#424242", "900": "#212121", A100: "#f5f5f5", A200: "#eeeeee", A400: "#bdbdbd", A700: "#616161" },
259
+ indigo: { "50": "#e8eaf6", "100": "#c5cae9", "200": "#9fa8da", "300": "#7986cb", "400": "#5c6bc0", "500": "#3f51b5", "600": "#3949ab", "700": "#303f9f", "800": "#283593", "900": "#1a237e", A100: "#8c9eff", A200: "#536dfe", A400: "#3d5afe", A700: "#304ffe" },
260
+ lightBlue: { "50": "#e1f5fe", "100": "#b3e5fc", "200": "#81d4fa", "300": "#4fc3f7", "400": "#29b6f6", "500": "#03a9f4", "600": "#039be5", "700": "#0288d1", "800": "#0277bd", "900": "#01579b", A100: "#80d8ff", A200: "#40c4ff", A400: "#00b0ff", A700: "#0091ea" }
261
+ };
262
+ var generalColors = {
263
+ "yellow-golden": "rgba(255, 215, 0, 0.6)",
264
+ "yellow-pale": "rgba(255, 255, 153, 0.4)",
265
+ "yellow-amber": "rgba(255, 191, 0, 0.7)",
266
+ "yellow-sunshine": "rgba(255, 239, 0, 0.5)",
267
+ "yellow-light": "rgba(255, 255, 0, 0.5)",
268
+ "yellow-warm": "rgba(255, 204, 0, 0.8)",
269
+ "yellow-soft": "rgba(255, 229, 153, 0.7)",
270
+ "red-rose": "rgba(255, 51, 51, 0.5)",
271
+ "red-crimson": "rgba(220, 20, 60, 0.6)",
272
+ "red-light-coral": "rgba(240, 128, 128, 0.5)",
273
+ "red-fire-brick": "rgba(178, 34, 34, 0.8)",
274
+ "red-bright": "rgba(255, 0, 0, 0.7)",
275
+ "red-soft-coral": "rgba(255, 102, 102, 0.6)",
276
+ "red-dark": "rgba(204, 0, 0, 0.8)",
277
+ "blue-turquoise": "rgba(64, 224, 208, 0.6)",
278
+ "blue-dodger": "rgba(30, 144, 255, 0.5)",
279
+ "blue-navy": "rgba(0, 0, 128, 0.8)",
280
+ "blue-steel": "rgba(70, 130, 180, 0.7)",
281
+ "blue-sky": "rgba(0, 153, 255, 0.5)",
282
+ "blue-light": "rgba(51, 204, 255, 0.7)",
283
+ "blue-deep": "rgba(0, 51, 204, 0.8)",
284
+ "green-lime": "rgba(50, 205, 50, 0.5)",
285
+ "green-pale": "rgba(152, 251, 152, 0.4)",
286
+ "green-forest": "rgba(34, 139, 34, 0.7)",
287
+ "green-olive": "rgba(128, 128, 0, 0.6)",
288
+ "green-fresh": "rgba(0, 204, 0, 0.6)",
289
+ "green-soft-mint": "rgba(102, 255, 153, 0.7)",
290
+ "green-dark": "rgba(0, 153, 76, 0.8)",
291
+ "orange-tangerine": "rgba(255, 140, 0, 0.6)",
292
+ "orange-apricot": "rgba(251, 206, 177, 0.5)",
293
+ "orange-burnt": "rgba(204, 85, 0, 0.7)",
294
+ "orange-carrot": "rgba(237, 145, 33, 0.6)",
295
+ "orange-bright": "rgba(255, 102, 0, 0.7)",
296
+ "orange-soft-peach": "rgba(255, 178, 102, 0.6)",
297
+ "orange-deep": "rgba(204, 85, 0, 0.8)"
298
+ };
299
+
300
+ // src/themes.ts
301
+ function primarySubTokensLight(lightRgb, darkRgb, contrastRgb, darkBgRgb, mainRgb) {
302
+ return {
303
+ "primary-light": lightRgb,
304
+ "primary-dark": darkRgb,
305
+ "primary-contrast": contrastRgb,
306
+ "primary-dark-bg": darkBgRgb,
307
+ "primary-state-contained": `rgba(${mainRgb.split(" ").join(", ")}, 0.3)`,
308
+ "primary-state-outlined": `rgba(${mainRgb.split(" ").join(", ")}, 0.1)`,
309
+ "primary-state-resting": `rgba(${mainRgb.split(" ").join(", ")}, 0.5)`,
310
+ "primary-shade-12": `rgba(${darkRgb.split(" ").join(", ")}, 0.12)`,
311
+ "primary-shade-16": `rgba(${darkRgb.split(" ").join(", ")}, 0.16)`
312
+ };
313
+ }
314
+ function secondarySubTokensLight(lightRgb, darkRgb, contrastRgb, darkBgRgb, mainRgb) {
315
+ return {
316
+ "secondary-light": lightRgb,
317
+ "secondary-dark": darkRgb,
318
+ "secondary-contrast": contrastRgb,
319
+ "secondary-dark-bg": darkBgRgb,
320
+ "secondary-state-contained": `rgba(${mainRgb.split(" ").join(", ")}, 0.3)`,
321
+ "secondary-state-outlined": `rgba(${mainRgb.split(" ").join(", ")}, 0.1)`,
322
+ "secondary-state-resting": `rgba(${mainRgb.split(" ").join(", ")}, 0.5)`,
323
+ "secondary-shade-12": `rgba(${mainRgb.split(" ").join(", ")}, 0.12)`,
324
+ "secondary-shade-16": `rgba(${mainRgb.split(" ").join(", ")}, 0.16)`
325
+ };
326
+ }
327
+ function textSurfaceTokens(fgRgb, bgRgb, paperRgb, infoRgb, snackbarRgb) {
328
+ return {
329
+ text: fgRgb,
330
+ "text-secondary": `rgba(${fgRgb.split(" ").join(", ")}, 0.6)`,
331
+ "text-disabled": `rgba(${fgRgb.split(" ").join(", ")}, 0.38)`,
332
+ "text-info": infoRgb,
333
+ "text-fill": fgRgb,
334
+ "text-shade-12": `rgba(${fgRgb.split(" ").join(", ")}, 0.12)`,
335
+ "text-shade-16": `rgba(${fgRgb.split(" ").join(", ")}, 0.16)`,
336
+ surface: bgRgb,
337
+ "surface-paper": paperRgb,
338
+ divider: `rgba(${fgRgb.split(" ").join(", ")}, 0.23)`,
339
+ "outlined-border": `rgba(${fgRgb.split(" ").join(", ")}, 0.12)`,
340
+ "input-line": `rgba(${fgRgb.split(" ").join(", ")}, 0.42)`,
341
+ "action-active": `rgba(${fgRgb.split(" ").join(", ")}, 0.54)`,
342
+ "action-hover": `rgba(${fgRgb.split(" ").join(", ")}, 0.05)`,
343
+ "action-selected": `rgba(${fgRgb.split(" ").join(", ")}, 0.08)`,
344
+ "action-disabled": `rgba(${fgRgb.split(" ").join(", ")}, 0.26)`,
345
+ "action-disabled-bg": `rgba(${fgRgb.split(" ").join(", ")}, 0.12)`,
346
+ "action-focus": `rgba(${fgRgb.split(" ").join(", ")}, 0.12)`,
347
+ "snackbar-bg": snackbarRgb,
348
+ "map-grid": "255 255 255"
349
+ };
350
+ }
351
+ function tableTokens({ topHeader, header, row, colBorder, border }) {
352
+ return {
353
+ "table-top-header": topHeader,
354
+ "table-header": header,
355
+ "table-row": row,
356
+ "table-col-border": colBorder,
357
+ "table-border": border
358
+ };
359
+ }
360
+ var slate = {
361
+ light: {
362
+ bg: "0 0% 100%",
363
+ fg: "222 47% 11%",
364
+ card: "0 0% 100%",
365
+ "card-fg": "222 47% 11%",
366
+ popover: "0 0% 100%",
367
+ "popover-fg": "222 47% 11%",
368
+ primary: "222 47% 11%",
369
+ "primary-fg": "210 40% 98%",
370
+ "primary-hover": "222 47% 20%",
371
+ "primary-active": "222 47% 8%",
372
+ secondary: "210 40% 96%",
373
+ "secondary-fg": "222 47% 11%",
374
+ muted: "210 40% 96%",
375
+ "muted-fg": "215 16% 47%",
376
+ accent: "210 40% 96%",
377
+ "accent-fg": "222 47% 11%",
378
+ destructive: "0 84% 60%",
379
+ "destructive-fg": "0 0% 5%",
380
+ success: "142 71% 45%",
381
+ "success-fg": "0 0% 5%",
382
+ warning: "38 92% 50%",
383
+ "warning-fg": "38 92% 8%",
384
+ info: "199 89% 48%",
385
+ "info-fg": "0 0% 5%",
386
+ border: "214 32% 91%",
387
+ "border-strong": "214 24% 80%",
388
+ input: "214 32% 91%",
389
+ ring: "222 47% 11%",
390
+ overlay: "222 47% 11%",
391
+ shadow: "222 47% 11%",
392
+ // New sub-tokens — primary: '222 47% 11%' ≈ RGB(15, 23, 41)
393
+ ...primarySubTokensLight("124 149 208", "7 10 19", "255 255 255", "11 15 26", "15 23 41"),
394
+ // secondary: '210 40% 96%' ≈ RGB(237, 241, 247)
395
+ ...secondarySubTokensLight("245 248 252", "180 196 220", "15 23 41", "200 210 225", "201 212 228"),
396
+ // fg ≈ RGB(15, 23, 41); bg = white; info = sky blue
397
+ ...textSurfaceTokens("15 23 41", "255 255 255", "255 255 255", "14 165 233", "15 23 41"),
398
+ ...tableTokens({ topHeader: "238 242 255", header: "241 245 249", row: "255 255 255", colBorder: "250 250 250", border: "rgba(214, 219, 228, 1)" }),
399
+ ...sharedSemanticLight
400
+ },
401
+ dark: {
402
+ bg: "222 47% 6%",
403
+ fg: "210 40% 98%",
404
+ card: "222 47% 8%",
405
+ "card-fg": "210 40% 98%",
406
+ popover: "222 35% 10%",
407
+ "popover-fg": "210 40% 98%",
408
+ primary: "210 40% 98%",
409
+ "primary-fg": "222 47% 11%",
410
+ "primary-hover": "210 40% 90%",
411
+ "primary-active": "210 40% 95%",
412
+ secondary: "217 33% 17%",
413
+ "secondary-fg": "210 40% 98%",
414
+ muted: "217 33% 17%",
415
+ "muted-fg": "215 20% 65%",
416
+ accent: "217 33% 20%",
417
+ "accent-fg": "210 40% 98%",
418
+ destructive: "0 70% 50%",
419
+ "destructive-fg": "0 0% 100%",
420
+ success: "142 65% 50%",
421
+ "success-fg": "0 0% 5%",
422
+ warning: "38 92% 55%",
423
+ "warning-fg": "38 92% 8%",
424
+ info: "199 89% 55%",
425
+ "info-fg": "0 0% 5%",
426
+ border: "217 33% 20%",
427
+ "border-strong": "217 25% 30%",
428
+ input: "217 33% 20%",
429
+ ring: "213 27% 84%",
430
+ overlay: "0 0% 0%",
431
+ shadow: "0 0% 0%",
432
+ // primary dark: '210 40% 98%' ≈ RGB(248, 251, 254)
433
+ ...primarySubTokensLight("210 220 235", "255 255 255", "15 23 41", "25 35 55", "248 251 254"),
434
+ // secondary dark: '217 33% 17%' ≈ RGB(29, 40, 58)
435
+ ...secondarySubTokensLight("22 30 45", "44 60 87", "248 251 254", "35 50 72", "29 40 58"),
436
+ // fg dark ≈ RGB(248, 251, 254)
437
+ ...textSurfaceTokens("248 251 254", "8 11 22", "12 16 30", "56 189 248", "248 251 254"),
438
+ ...tableTokens({ topHeader: "17 25 41", header: "22 31 51", row: "12 16 30", colBorder: "8 11 22", border: "rgba(51, 65, 86, 1)" }),
439
+ ...sharedSemanticDark,
440
+ "map-grid": "248 251 254"
441
+ }
442
+ };
443
+ var zinc = {
444
+ light: {
445
+ bg: "0 0% 100%",
446
+ fg: "240 10% 4%",
447
+ card: "0 0% 100%",
448
+ "card-fg": "240 10% 4%",
449
+ popover: "0 0% 100%",
450
+ "popover-fg": "240 10% 4%",
451
+ primary: "240 6% 10%",
452
+ "primary-fg": "0 0% 98%",
453
+ "primary-hover": "240 6% 20%",
454
+ "primary-active": "240 6% 6%",
455
+ secondary: "240 5% 96%",
456
+ "secondary-fg": "240 6% 10%",
457
+ muted: "240 5% 96%",
458
+ "muted-fg": "240 4% 46%",
459
+ accent: "240 5% 96%",
460
+ "accent-fg": "240 6% 10%",
461
+ destructive: "0 84% 60%",
462
+ "destructive-fg": "0 0% 5%",
463
+ success: "142 71% 45%",
464
+ "success-fg": "0 0% 5%",
465
+ warning: "38 92% 50%",
466
+ "warning-fg": "38 92% 8%",
467
+ info: "199 89% 48%",
468
+ "info-fg": "0 0% 5%",
469
+ border: "240 6% 90%",
470
+ "border-strong": "240 5% 80%",
471
+ input: "240 6% 90%",
472
+ ring: "240 10% 4%",
473
+ overlay: "240 10% 4%",
474
+ shadow: "240 10% 4%",
475
+ // primary: '240 6% 10%' ≈ RGB(24, 24, 27)
476
+ ...primarySubTokensLight("158 158 164", "10 10 11", "255 255 255", "18 18 22", "24 24 27"),
477
+ // secondary: '240 5% 96%' ≈ RGB(245, 245, 246)
478
+ ...secondarySubTokensLight("248 248 249", "186 186 191", "24 24 27", "196 196 201", "186 186 191"),
479
+ // fg ≈ RGB(10, 10, 11)
480
+ ...textSurfaceTokens("10 10 11", "255 255 255", "255 255 255", "14 165 233", "10 10 11"),
481
+ ...tableTokens({ topHeader: "240 240 244", header: "244 244 245", row: "255 255 255", colBorder: "250 250 250", border: "rgba(228, 228, 231, 1)" }),
482
+ ...sharedSemanticLight
483
+ },
484
+ dark: {
485
+ bg: "240 10% 6%",
486
+ fg: "0 0% 98%",
487
+ card: "240 10% 8%",
488
+ "card-fg": "0 0% 98%",
489
+ popover: "240 8% 10%",
490
+ "popover-fg": "0 0% 98%",
491
+ primary: "0 0% 98%",
492
+ "primary-fg": "240 6% 10%",
493
+ "primary-hover": "0 0% 90%",
494
+ "primary-active": "0 0% 95%",
495
+ secondary: "240 4% 16%",
496
+ "secondary-fg": "0 0% 98%",
497
+ muted: "240 4% 16%",
498
+ "muted-fg": "240 5% 65%",
499
+ accent: "240 4% 20%",
500
+ "accent-fg": "0 0% 98%",
501
+ destructive: "0 70% 50%",
502
+ "destructive-fg": "0 0% 100%",
503
+ success: "142 65% 50%",
504
+ "success-fg": "0 0% 5%",
505
+ warning: "38 92% 55%",
506
+ "warning-fg": "38 92% 8%",
507
+ info: "199 89% 55%",
508
+ "info-fg": "0 0% 5%",
509
+ border: "240 4% 20%",
510
+ "border-strong": "240 5% 30%",
511
+ input: "240 4% 20%",
512
+ ring: "240 5% 84%",
513
+ overlay: "0 0% 0%",
514
+ shadow: "0 0% 0%",
515
+ // primary dark: '0 0% 98%' ≈ RGB(250, 250, 250)
516
+ ...primarySubTokensLight("200 200 202", "255 255 255", "10 10 11", "20 20 24", "250 250 250"),
517
+ // secondary dark: '240 4% 16%' ≈ RGB(38, 38, 42)
518
+ ...secondarySubTokensLight("30 30 34", "52 52 58", "250 250 250", "44 44 49", "38 38 42"),
519
+ // fg dark ≈ RGB(250, 250, 250)
520
+ ...textSurfaceTokens("250 250 250", "14 14 17", "19 19 22", "56 189 248", "250 250 250"),
521
+ ...tableTokens({ topHeader: "22 22 26", header: "28 28 32", row: "19 19 22", colBorder: "14 14 17", border: "rgba(63, 63, 70, 1)" }),
522
+ ...sharedSemanticDark,
523
+ "map-grid": "250 250 250"
524
+ }
525
+ };
526
+ var rose = {
527
+ light: {
528
+ bg: "0 0% 100%",
529
+ fg: "240 10% 4%",
530
+ card: "0 0% 100%",
531
+ "card-fg": "240 10% 4%",
532
+ popover: "0 0% 100%",
533
+ "popover-fg": "240 10% 4%",
534
+ primary: "347 77% 50%",
535
+ "primary-fg": "356 100% 97%",
536
+ "primary-hover": "347 80% 56%",
537
+ "primary-active": "347 75% 44%",
538
+ secondary: "240 5% 96%",
539
+ "secondary-fg": "240 6% 10%",
540
+ muted: "240 5% 96%",
541
+ "muted-fg": "240 4% 46%",
542
+ accent: "240 5% 96%",
543
+ "accent-fg": "240 6% 10%",
544
+ destructive: "0 84% 60%",
545
+ "destructive-fg": "0 0% 5%",
546
+ success: "142 71% 45%",
547
+ "success-fg": "0 0% 5%",
548
+ warning: "38 92% 50%",
549
+ "warning-fg": "38 92% 8%",
550
+ info: "199 89% 48%",
551
+ "info-fg": "0 0% 5%",
552
+ border: "240 6% 90%",
553
+ "border-strong": "240 5% 80%",
554
+ input: "240 6% 90%",
555
+ ring: "347 77% 50%",
556
+ overlay: "240 10% 4%",
557
+ shadow: "347 60% 30%",
558
+ // primary: '347 77% 50%' ≈ RGB(226, 29, 72)
559
+ ...primarySubTokensLight("237 120 145", "135 18 43", "255 255 255", "107 14 34", "226 29 72"),
560
+ // secondary: same as zinc secondary
561
+ ...secondarySubTokensLight("248 248 249", "186 186 191", "10 10 11", "196 196 201", "186 186 191"),
562
+ // fg ≈ RGB(10, 10, 11)
563
+ ...textSurfaceTokens("10 10 11", "255 255 255", "255 255 255", "14 165 233", "10 10 11"),
564
+ ...tableTokens({ topHeader: "255 241 242", header: "255 245 246", row: "255 255 255", colBorder: "250 250 250", border: "rgba(244, 227, 229, 1)" }),
565
+ ...sharedSemanticLight
566
+ },
567
+ dark: {
568
+ bg: "20 14% 5%",
569
+ fg: "0 0% 95%",
570
+ card: "24 10% 8%",
571
+ "card-fg": "0 0% 95%",
572
+ popover: "0 0% 9%",
573
+ "popover-fg": "0 0% 95%",
574
+ primary: "347 77% 50%",
575
+ "primary-fg": "356 100% 97%",
576
+ "primary-hover": "347 80% 56%",
577
+ "primary-active": "347 75% 44%",
578
+ secondary: "240 4% 16%",
579
+ "secondary-fg": "0 0% 98%",
580
+ muted: "0 0% 15%",
581
+ "muted-fg": "240 5% 65%",
582
+ accent: "12 7% 15%",
583
+ "accent-fg": "0 0% 98%",
584
+ destructive: "0 70% 50%",
585
+ "destructive-fg": "0 86% 97%",
586
+ success: "142 65% 50%",
587
+ "success-fg": "0 0% 5%",
588
+ warning: "38 92% 55%",
589
+ "warning-fg": "38 92% 8%",
590
+ info: "199 89% 55%",
591
+ "info-fg": "0 0% 5%",
592
+ border: "240 4% 16%",
593
+ "border-strong": "240 5% 26%",
594
+ input: "240 4% 20%",
595
+ ring: "347 77% 50%",
596
+ overlay: "0 0% 0%",
597
+ shadow: "0 0% 0%",
598
+ // primary rose same in dark: '347 77% 50%' ≈ RGB(226, 29, 72)
599
+ ...primarySubTokensLight("237 120 145", "135 18 43", "255 255 255", "107 14 34", "226 29 72"),
600
+ // secondary dark: '240 4% 16%' ≈ RGB(38, 38, 42)
601
+ ...secondarySubTokensLight("30 30 34", "52 52 58", "242 242 242", "44 44 49", "38 38 42"),
602
+ // fg ≈ RGB(242, 242, 242) ('0 0% 95%')
603
+ ...textSurfaceTokens("242 242 242", "14 12 10", "22 20 17", "56 189 248", "242 242 242"),
604
+ ...tableTokens({ topHeader: "28 20 20", header: "36 28 28", row: "22 20 17", colBorder: "14 12 10", border: "rgba(70, 55, 55, 1)" }),
605
+ ...sharedSemanticDark,
606
+ "map-grid": "242 242 242"
607
+ }
608
+ };
609
+ var structyl = {
610
+ light: {
611
+ bg: "0 0% 98%",
612
+ fg: "217 11% 18%",
613
+ card: "0 0% 100%",
614
+ "card-fg": "217 11% 18%",
615
+ popover: "0 0% 100%",
616
+ "popover-fg": "217 11% 18%",
617
+ primary: "242 32% 48%",
618
+ "primary-fg": "0 0% 100%",
619
+ "primary-hover": "242 32% 55%",
620
+ "primary-active": "245 67% 24%",
621
+ secondary: "217 100% 57%",
622
+ "secondary-fg": "0 0% 100%",
623
+ muted: "0 0% 96%",
624
+ "muted-fg": "0 0% 62%",
625
+ accent: "253 80% 94%",
626
+ "accent-fg": "253 76% 67%",
627
+ destructive: "340 71% 55%",
628
+ "destructive-fg": "0 0% 5%",
629
+ success: "123 57% 53%",
630
+ "success-fg": "0 0% 5%",
631
+ warning: "17 100% 54%",
632
+ "warning-fg": "38 92% 8%",
633
+ info: "253 76% 67%",
634
+ "info-fg": "0 0% 5%",
635
+ border: "240 2% 90%",
636
+ "border-strong": "0 0% 78%",
637
+ input: "240 2% 90%",
638
+ ring: "242 32% 48%",
639
+ overlay: "217 11% 18%",
640
+ shadow: "217 11% 18%",
641
+ ...structylSubTokensLight
642
+ },
643
+ dark: {
644
+ bg: "217 11% 18%",
645
+ fg: "0 0% 100%",
646
+ card: "216 10% 20%",
647
+ "card-fg": "0 0% 100%",
648
+ popover: "216 10% 20%",
649
+ "popover-fg": "0 0% 100%",
650
+ primary: "243 85% 87%",
651
+ "primary-fg": "245 67% 24%",
652
+ "primary-hover": "243 85% 80%",
653
+ "primary-active": "243 85% 91%",
654
+ secondary: "225 87% 84%",
655
+ "secondary-fg": "215 100% 22%",
656
+ muted: "217 12% 26%",
657
+ "muted-fg": "207 12% 63%",
658
+ accent: "217 13% 28%",
659
+ "accent-fg": "243 85% 87%",
660
+ destructive: "348 75% 83%",
661
+ "destructive-fg": "334 100% 28%",
662
+ success: "109 65% 64%",
663
+ "success-fg": "127 100% 16%",
664
+ warning: "17 79% 79%",
665
+ "warning-fg": "18 100% 26%",
666
+ info: "243 85% 87%",
667
+ "info-fg": "247 58% 44%",
668
+ border: "0 0% 32%",
669
+ "border-strong": "0 0% 39%",
670
+ input: "217 12% 26%",
671
+ ring: "243 85% 87%",
672
+ overlay: "0 0% 0%",
673
+ shadow: "0 0% 0%",
674
+ ...structylSubTokensDark
675
+ }
676
+ };
677
+ var defaultThemes = { slate, zinc, rose, structyl };
678
+
679
+ // src/theme-provider.tsx
680
+ var ThemeContext = React__namespace.createContext(void 0);
681
+ function ThemeProvider(props) {
682
+ const {
683
+ children,
684
+ defaultTheme = "slate",
685
+ defaultMode = "system",
686
+ storageKey = "structyl-theme",
687
+ enableTransitions = true,
688
+ themes: customThemes,
689
+ attribute = "data-theme"
690
+ } = props;
691
+ const themes = React__namespace.useMemo(
692
+ () => ({ ...defaultThemes, ...customThemes }),
693
+ [customThemes]
694
+ );
695
+ const [theme, setThemeState] = React__namespace.useState(defaultTheme);
696
+ const [mode, setModeState] = React__namespace.useState(defaultMode);
697
+ const [systemMode, setSystemMode] = React__namespace.useState("light");
698
+ React__namespace.useEffect(() => {
699
+ if (!storageKey || typeof window === "undefined") return;
700
+ try {
701
+ const stored = window.localStorage.getItem(storageKey);
702
+ if (stored) {
703
+ const parsed = JSON.parse(stored);
704
+ if (parsed.theme) setThemeState(parsed.theme);
705
+ if (parsed.mode) setModeState(parsed.mode);
706
+ }
707
+ } catch {
708
+ }
709
+ }, [storageKey]);
710
+ React__namespace.useEffect(() => {
711
+ if (typeof window === "undefined") return;
712
+ const mql = window.matchMedia("(prefers-color-scheme: dark)");
713
+ const update = () => setSystemMode(mql.matches ? "dark" : "light");
714
+ update();
715
+ mql.addEventListener("change", update);
716
+ return () => mql.removeEventListener("change", update);
717
+ }, []);
718
+ const resolvedMode = mode === "system" ? systemMode : mode;
719
+ React__namespace.useEffect(() => {
720
+ if (typeof document === "undefined") return;
721
+ const root = document.documentElement;
722
+ if (!enableTransitions) {
723
+ const css = document.createElement("style");
724
+ css.appendChild(
725
+ document.createTextNode(
726
+ "*,*::before,*::after{transition:none!important;animation:none!important}"
727
+ )
728
+ );
729
+ document.head.appendChild(css);
730
+ void window.getComputedStyle(document.body);
731
+ requestAnimationFrame(() => document.head.removeChild(css));
732
+ }
733
+ root.setAttribute(attribute, theme);
734
+ root.setAttribute("data-mode", resolvedMode);
735
+ root.style.colorScheme = resolvedMode;
736
+ const cfg = themes[theme];
737
+ if (cfg) {
738
+ const tokens = cfg[resolvedMode];
739
+ for (const [key, value2] of Object.entries(tokens)) {
740
+ root.style.setProperty(`--color-${key}`, value2);
741
+ }
742
+ }
743
+ }, [theme, resolvedMode, themes, attribute, enableTransitions]);
744
+ React__namespace.useEffect(() => {
745
+ if (!storageKey || typeof window === "undefined") return;
746
+ try {
747
+ window.localStorage.setItem(storageKey, JSON.stringify({ theme, mode }));
748
+ } catch {
749
+ }
750
+ }, [theme, mode, storageKey]);
751
+ const value = React__namespace.useMemo(
752
+ () => ({
753
+ theme,
754
+ setTheme: setThemeState,
755
+ mode,
756
+ setMode: setModeState,
757
+ resolvedMode,
758
+ themes: Object.keys(themes)
759
+ }),
760
+ [theme, mode, resolvedMode, themes]
761
+ );
762
+ return /* @__PURE__ */ React__namespace.createElement(ThemeContext.Provider, { value }, children);
763
+ }
764
+ function useTheme() {
765
+ const context = React__namespace.useContext(ThemeContext);
766
+ if (!context) {
767
+ throw new Error("useTheme must be used within a <ThemeProvider>");
768
+ }
769
+ return context;
770
+ }
771
+ function tokensToVars(tokens) {
772
+ return Object.entries(tokens).map(([k, v]) => `--color-${k}:${v}`).join(";");
773
+ }
774
+ function ThemeScript({
775
+ defaultTheme = "slate",
776
+ defaultMode = "system",
777
+ storageKey = "structyl-theme",
778
+ attribute = "data-theme"
779
+ }) {
780
+ const cfg = defaultThemes[defaultTheme];
781
+ const lightVars = cfg ? tokensToVars(cfg.light) : "";
782
+ const darkVars = cfg ? tokensToVars(cfg.dark) : "";
783
+ const staticCss = lightVars ? `:root{${lightVars}}:root[data-mode="dark"]{${darkVars}}` : "";
784
+ const script = `
785
+ (function(){
786
+ try {
787
+ var stored = JSON.parse(localStorage.getItem(${JSON.stringify(storageKey)}) || '{}');
788
+ var theme = stored.theme || ${JSON.stringify(defaultTheme)};
789
+ var mode = stored.mode || ${JSON.stringify(defaultMode)};
790
+ var resolved = mode === 'system'
791
+ ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
792
+ : mode;
793
+ var root = document.documentElement;
794
+ root.setAttribute(${JSON.stringify(attribute)}, theme);
795
+ root.setAttribute('data-mode', resolved);
796
+ root.style.colorScheme = resolved;
797
+ } catch (e) {}
798
+ })();`.trim();
799
+ return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, staticCss && /* @__PURE__ */ React__namespace.createElement("style", { dangerouslySetInnerHTML: { __html: staticCss }, suppressHydrationWarning: true }), /* @__PURE__ */ React__namespace.createElement("script", { dangerouslySetInnerHTML: { __html: script }, suppressHydrationWarning: true }));
800
+ }
801
+
802
+ // src/color-presets.ts
803
+ var COLOR_PRESETS = [
804
+ { id: "structyl", name: "Structyl", hex: "#5754a3" },
805
+ { id: "indigo", name: "Indigo", hex: "#6366f1" },
806
+ { id: "ocean", name: "Ocean", hex: "#0284c7" },
807
+ { id: "rose", name: "Rose", hex: "#e11d48" },
808
+ { id: "forest", name: "Forest", hex: "#16a34a" },
809
+ { id: "sunset", name: "Sunset", hex: "#f97316" },
810
+ { id: "violet", name: "Violet", hex: "#7c3aed" },
811
+ { id: "slate", name: "Slate", hex: "#475569" },
812
+ { id: "ember", name: "Ember", hex: "#be123c" },
813
+ { id: "zinc", name: "Zinc", hex: "#71717a" }
814
+ ];
815
+ function createColorPreset(id, name, hex) {
816
+ return { id, name, hex };
817
+ }
818
+ function hexToHslParts(hex) {
819
+ const h = hex.replace("#", "");
820
+ const r = parseInt(h.slice(0, 2), 16) / 255;
821
+ const g = parseInt(h.slice(2, 4), 16) / 255;
822
+ const b = parseInt(h.slice(4, 6), 16) / 255;
823
+ const max = Math.max(r, g, b);
824
+ const min = Math.min(r, g, b);
825
+ let hue = 0;
826
+ let sat = 0;
827
+ const lum = (max + min) / 2;
828
+ if (max !== min) {
829
+ const d = max - min;
830
+ sat = lum > 0.5 ? d / (2 - max - min) : d / (max + min);
831
+ if (max === r) hue = ((g - b) / d + (g < b ? 6 : 0)) / 6;
832
+ else if (max === g) hue = ((b - r) / d + 2) / 6;
833
+ else hue = ((r - g) / d + 4) / 6;
834
+ }
835
+ return { h: Math.round(hue * 360), s: Math.round(sat * 100), l: Math.round(lum * 100) };
836
+ }
837
+ function hslStr({ h, s, l }) {
838
+ return `${h} ${s}% ${l}%`;
839
+ }
840
+ function shiftL(p, d) {
841
+ return { ...p, l: Math.max(2, Math.min(97, p.l + d)) };
842
+ }
843
+ function relativeLuminance(hex) {
844
+ const h = hex.replace("#", "");
845
+ const lin = (c) => {
846
+ const v = c / 255;
847
+ return v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
848
+ };
849
+ return 0.2126 * lin(parseInt(h.slice(0, 2), 16)) + 0.7152 * lin(parseInt(h.slice(2, 4), 16)) + 0.0722 * lin(parseInt(h.slice(4, 6), 16));
850
+ }
851
+ var PRESET_CSS_VARS = [
852
+ "--color-primary",
853
+ "--color-ring",
854
+ "--color-primary-hover",
855
+ "--color-primary-active",
856
+ "--color-primary-fg"
857
+ ];
858
+ function applyColorPreset(hex) {
859
+ if (typeof document === "undefined") return;
860
+ const root = document.documentElement;
861
+ const p = hexToHslParts(hex);
862
+ const fg = relativeLuminance(hex) > 0.179 ? "222 47% 11%" : "0 0% 100%";
863
+ root.style.setProperty("--color-primary", hslStr(p));
864
+ root.style.setProperty("--color-ring", hslStr(p));
865
+ root.style.setProperty("--color-primary-hover", hslStr(shiftL(p, 6)));
866
+ root.style.setProperty("--color-primary-active", hslStr(shiftL(p, -8)));
867
+ root.style.setProperty("--color-primary-fg", fg);
868
+ }
869
+ function clearColorPreset() {
870
+ if (typeof document === "undefined") return;
871
+ const root = document.documentElement;
872
+ PRESET_CSS_VARS.forEach((k) => root.style.removeProperty(k));
873
+ }
874
+ var DEFAULT_STORAGE_KEY = "structyl-color-preset";
875
+ function useColorPreset(options = {}) {
876
+ const { extraPresets = [], storageKey = DEFAULT_STORAGE_KEY } = options;
877
+ const { theme, resolvedMode } = useTheme();
878
+ const [activeId, setActiveId] = React.useState(null);
879
+ const allPresets = [...COLOR_PRESETS, ...extraPresets];
880
+ React.useEffect(() => {
881
+ try {
882
+ const stored = localStorage.getItem(storageKey);
883
+ if (stored && allPresets.some((p) => p.id === stored)) {
884
+ setActiveId(stored);
885
+ }
886
+ } catch {
887
+ }
888
+ }, [storageKey]);
889
+ React.useEffect(() => {
890
+ if (!activeId) return;
891
+ const preset = allPresets.find((p) => p.id === activeId);
892
+ if (preset) applyColorPreset(preset.hex);
893
+ }, [activeId, theme, resolvedMode]);
894
+ const setPreset = React.useCallback((id, hex) => {
895
+ setActiveId(id);
896
+ applyColorPreset(hex);
897
+ try {
898
+ localStorage.setItem(storageKey, id);
899
+ } catch {
900
+ }
901
+ }, [storageKey]);
902
+ const clearPreset = React.useCallback(() => {
903
+ setActiveId(null);
904
+ clearColorPreset();
905
+ try {
906
+ localStorage.removeItem(storageKey);
907
+ } catch {
908
+ }
909
+ }, [storageKey]);
910
+ const activePreset = allPresets.find((p) => p.id === activeId) ?? null;
911
+ return { presets: allPresets, activeId, activePreset, setPreset, clearPreset };
912
+ }
913
+
914
+ exports.COLOR_PRESETS = COLOR_PRESETS;
915
+ exports.ThemeProvider = ThemeProvider;
916
+ exports.ThemeScript = ThemeScript;
917
+ exports.applyColorPreset = applyColorPreset;
918
+ exports.clearColorPreset = clearColorPreset;
919
+ exports.createColorPreset = createColorPreset;
920
+ exports.defaultThemes = defaultThemes;
921
+ exports.generalColors = generalColors;
922
+ exports.sharedSemanticDark = sharedSemanticDark;
923
+ exports.sharedSemanticLight = sharedSemanticLight;
924
+ exports.staticPalette = staticPalette;
925
+ exports.useColorPreset = useColorPreset;
926
+ exports.useTheme = useTheme;
927
+ //# sourceMappingURL=index.cjs.map
928
+ //# sourceMappingURL=index.cjs.map