@mesob/ui 0.2.4 → 0.3.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.d.ts CHANGED
@@ -1,3 +1,7 @@
1
- export { REQUIRED_THEME_VARS, THEME_VAR_NAMES, ThemeValidation, ThemeVarName, validateTheme } from './lib/theme-schema.js';
1
+ export { DEFAULT_LANGUAGE, LOCALE_INPUT_DEFAULT, LOCALE_OPTIONAL_INPUT_SCHEMA, LOCALE_REQUIRED_INPUT_SCHEMA, Locale, LocaleKey, SUPPORTED_LANGUAGES, SupportedLanguage, Translation, createLocalInputSchema, createLocalRequiredInputSchema } from './lib/locale.js';
2
+ export { StyleName, ThemeConfig, ThemeVars, buildTheme } from './lib/theme-config.js';
3
+ export { ComponentColor, ComponentRadius, ComponentSize, InputWrapperOrder, REQUIRED_THEME_VARS, THEME_VAR_NAMES, ThemeValidation, ThemeVarName, validateTheme } from './lib/theme-schema.js';
4
+ export { BASE_COLORS, BaseColorTheme, RADII, RadiusOption, getBaseColor, getRadius } from './lib/themes.js';
2
5
  export { cn } from './lib/utils.js';
6
+ import 'zod';
3
7
  import 'clsx';
package/dist/index.js CHANGED
@@ -1,17 +1,466 @@
1
- // src/lib/theme-schema.ts
2
- var SHADE_KEYS = [
3
- 50,
4
- 100,
5
- 200,
6
- 300,
7
- 400,
8
- 500,
9
- 600,
10
- 700,
11
- 800,
12
- 900,
13
- 950
1
+ // src/lib/locale.ts
2
+ import { z } from "zod";
3
+ var DEFAULT_LANGUAGE = "en";
4
+ var SUPPORTED_LANGUAGES = [
5
+ { value: "en", label: "English", key: "En" },
6
+ { value: "am", label: "\u12A0\u121B\u122D\u129B", key: "\u12A0\u121B" }
14
7
  ];
8
+ var LOCALE_INPUT_DEFAULT = Object.fromEntries(
9
+ SUPPORTED_LANGUAGES.map(({ value }) => [value, ""])
10
+ );
11
+ function createLocalInputSchema(defaultValidation, otherValidation) {
12
+ const schemaDefinition = SUPPORTED_LANGUAGES.reduce((acc, { value }) => {
13
+ acc[value] = value === DEFAULT_LANGUAGE ? defaultValidation : otherValidation;
14
+ return acc;
15
+ }, {});
16
+ return z.object(schemaDefinition);
17
+ }
18
+ function createLocalRequiredInputSchema(validation) {
19
+ const schemaDefinition = SUPPORTED_LANGUAGES.reduce((acc, { value }) => {
20
+ acc[value] = validation;
21
+ return acc;
22
+ }, {});
23
+ return z.object(schemaDefinition).superRefine((data, ctx) => {
24
+ const hasValue = Object.values(data).some(
25
+ (value) => typeof value === "string" && value.trim().length > 0
26
+ );
27
+ if (!hasValue) {
28
+ for (const { value } of SUPPORTED_LANGUAGES) {
29
+ ctx.addIssue({
30
+ code: z.ZodIssueCode.custom,
31
+ message: "field is required",
32
+ path: [value]
33
+ });
34
+ }
35
+ }
36
+ });
37
+ }
38
+ var LOCALE_REQUIRED_INPUT_SCHEMA = createLocalRequiredInputSchema(
39
+ z.string().optional()
40
+ );
41
+ var LOCALE_OPTIONAL_INPUT_SCHEMA = createLocalInputSchema(
42
+ z.string().optional(),
43
+ z.string().optional()
44
+ );
45
+
46
+ // src/lib/theme-config.ts
47
+ import { converter, wcagContrast } from "culori";
48
+
49
+ // src/lib/themes.ts
50
+ var BASE_COLORS = [
51
+ {
52
+ name: "neutral",
53
+ title: "Neutral",
54
+ cssVars: {
55
+ light: {
56
+ background: "oklch(1 0 0)",
57
+ foreground: "oklch(0.145 0 0)",
58
+ card: "oklch(1 0 0)",
59
+ "card-foreground": "oklch(0.145 0 0)",
60
+ popover: "oklch(1 0 0)",
61
+ "popover-foreground": "oklch(0.145 0 0)",
62
+ primary: "oklch(0.205 0 0)",
63
+ "primary-foreground": "oklch(0.985 0 0)",
64
+ secondary: "oklch(0.97 0 0)",
65
+ "secondary-foreground": "oklch(0.205 0 0)",
66
+ muted: "oklch(0.97 0 0)",
67
+ "muted-foreground": "oklch(0.556 0 0)",
68
+ accent: "oklch(0.97 0 0)",
69
+ "accent-foreground": "oklch(0.205 0 0)",
70
+ destructive: "oklch(0.58 0.22 27)",
71
+ border: "oklch(0.922 0 0)",
72
+ input: "oklch(0.922 0 0)",
73
+ ring: "oklch(0.708 0 0)",
74
+ "chart-1": "oklch(0.809 0.105 251.813)",
75
+ "chart-2": "oklch(0.623 0.214 259.815)",
76
+ "chart-3": "oklch(0.546 0.245 262.881)",
77
+ "chart-4": "oklch(0.488 0.243 264.376)",
78
+ "chart-5": "oklch(0.424 0.199 265.638)",
79
+ radius: "0.625rem",
80
+ sidebar: "oklch(0.985 0 0)",
81
+ "sidebar-foreground": "oklch(0.145 0 0)",
82
+ "sidebar-primary": "oklch(0.205 0 0)",
83
+ "sidebar-primary-foreground": "oklch(0.985 0 0)",
84
+ "sidebar-accent": "oklch(0.97 0 0)",
85
+ "sidebar-accent-foreground": "oklch(0.205 0 0)",
86
+ "sidebar-border": "oklch(0.922 0 0)",
87
+ "sidebar-ring": "oklch(0.708 0 0)"
88
+ },
89
+ dark: {
90
+ background: "oklch(0.145 0 0)",
91
+ foreground: "oklch(0.985 0 0)",
92
+ card: "oklch(0.205 0 0)",
93
+ "card-foreground": "oklch(0.985 0 0)",
94
+ popover: "oklch(0.205 0 0)",
95
+ "popover-foreground": "oklch(0.985 0 0)",
96
+ primary: "oklch(0.87 0.00 0)",
97
+ "primary-foreground": "oklch(0.205 0 0)",
98
+ secondary: "oklch(0.269 0 0)",
99
+ "secondary-foreground": "oklch(0.985 0 0)",
100
+ muted: "oklch(0.269 0 0)",
101
+ "muted-foreground": "oklch(0.708 0 0)",
102
+ accent: "oklch(0.371 0 0)",
103
+ "accent-foreground": "oklch(0.985 0 0)",
104
+ destructive: "oklch(0.704 0.191 22.216)",
105
+ border: "oklch(1 0 0 / 10%)",
106
+ input: "oklch(1 0 0 / 15%)",
107
+ ring: "oklch(0.556 0 0)",
108
+ "chart-1": "oklch(0.809 0.105 251.813)",
109
+ "chart-2": "oklch(0.623 0.214 259.815)",
110
+ "chart-3": "oklch(0.546 0.245 262.881)",
111
+ "chart-4": "oklch(0.488 0.243 264.376)",
112
+ "chart-5": "oklch(0.424 0.199 265.638)",
113
+ sidebar: "oklch(0.205 0 0)",
114
+ "sidebar-foreground": "oklch(0.985 0 0)",
115
+ "sidebar-primary": "oklch(0.488 0.243 264.376)",
116
+ "sidebar-primary-foreground": "oklch(0.985 0 0)",
117
+ "sidebar-accent": "oklch(0.269 0 0)",
118
+ "sidebar-accent-foreground": "oklch(0.985 0 0)",
119
+ "sidebar-border": "oklch(1 0 0 / 10%)",
120
+ "sidebar-ring": "oklch(0.556 0 0)"
121
+ }
122
+ }
123
+ },
124
+ {
125
+ name: "stone",
126
+ title: "Stone",
127
+ cssVars: {
128
+ light: {
129
+ background: "oklch(1 0 0)",
130
+ foreground: "oklch(0.147 0.004 49.25)",
131
+ card: "oklch(1 0 0)",
132
+ "card-foreground": "oklch(0.147 0.004 49.25)",
133
+ popover: "oklch(1 0 0)",
134
+ "popover-foreground": "oklch(0.147 0.004 49.25)",
135
+ primary: "oklch(0.216 0.006 56.043)",
136
+ "primary-foreground": "oklch(0.985 0.001 106.423)",
137
+ secondary: "oklch(0.97 0.001 106.424)",
138
+ "secondary-foreground": "oklch(0.216 0.006 56.043)",
139
+ muted: "oklch(0.97 0.001 106.424)",
140
+ "muted-foreground": "oklch(0.553 0.013 58.071)",
141
+ accent: "oklch(0.97 0.001 106.424)",
142
+ "accent-foreground": "oklch(0.216 0.006 56.043)",
143
+ destructive: "oklch(0.577 0.245 27.325)",
144
+ border: "oklch(0.923 0.003 48.717)",
145
+ input: "oklch(0.923 0.003 48.717)",
146
+ ring: "oklch(0.709 0.01 56.259)",
147
+ "chart-1": "oklch(0.646 0.222 41.116)",
148
+ "chart-2": "oklch(0.6 0.118 184.704)",
149
+ "chart-3": "oklch(0.398 0.07 227.392)",
150
+ "chart-4": "oklch(0.828 0.189 84.429)",
151
+ "chart-5": "oklch(0.769 0.188 70.08)",
152
+ radius: "0.625rem",
153
+ sidebar: "oklch(0.985 0.001 106.423)",
154
+ "sidebar-foreground": "oklch(0.147 0.004 49.25)",
155
+ "sidebar-primary": "oklch(0.216 0.006 56.043)",
156
+ "sidebar-primary-foreground": "oklch(0.985 0.001 106.423)",
157
+ "sidebar-accent": "oklch(0.97 0.001 106.424)",
158
+ "sidebar-accent-foreground": "oklch(0.216 0.006 56.043)",
159
+ "sidebar-border": "oklch(0.923 0.003 48.717)",
160
+ "sidebar-ring": "oklch(0.709 0.01 56.259)"
161
+ },
162
+ dark: {
163
+ background: "oklch(0.147 0.004 49.25)",
164
+ foreground: "oklch(0.985 0.001 106.423)",
165
+ card: "oklch(0.216 0.006 56.043)",
166
+ "card-foreground": "oklch(0.985 0.001 106.423)",
167
+ popover: "oklch(0.216 0.006 56.043)",
168
+ "popover-foreground": "oklch(0.985 0.001 106.423)",
169
+ primary: "oklch(0.923 0.003 48.717)",
170
+ "primary-foreground": "oklch(0.216 0.006 56.043)",
171
+ secondary: "oklch(0.268 0.007 34.298)",
172
+ "secondary-foreground": "oklch(0.985 0.001 106.423)",
173
+ muted: "oklch(0.268 0.007 34.298)",
174
+ "muted-foreground": "oklch(0.709 0.01 56.259)",
175
+ accent: "oklch(0.268 0.007 34.298)",
176
+ "accent-foreground": "oklch(0.985 0.001 106.423)",
177
+ destructive: "oklch(0.704 0.191 22.216)",
178
+ border: "oklch(1 0 0 / 10%)",
179
+ input: "oklch(1 0 0 / 15%)",
180
+ ring: "oklch(0.553 0.013 58.071)",
181
+ "chart-1": "oklch(0.488 0.243 264.376)",
182
+ "chart-2": "oklch(0.696 0.17 162.48)",
183
+ "chart-3": "oklch(0.769 0.188 70.08)",
184
+ "chart-4": "oklch(0.627 0.265 303.9)",
185
+ "chart-5": "oklch(0.645 0.246 16.439)",
186
+ sidebar: "oklch(0.216 0.006 56.043)",
187
+ "sidebar-foreground": "oklch(0.985 0.001 106.423)",
188
+ "sidebar-primary": "oklch(0.488 0.243 264.376)",
189
+ "sidebar-primary-foreground": "oklch(0.985 0.001 106.423)",
190
+ "sidebar-accent": "oklch(0.268 0.007 34.298)",
191
+ "sidebar-accent-foreground": "oklch(0.985 0.001 106.423)",
192
+ "sidebar-border": "oklch(1 0 0 / 10%)",
193
+ "sidebar-ring": "oklch(0.553 0.013 58.071)"
194
+ }
195
+ }
196
+ },
197
+ {
198
+ name: "zinc",
199
+ title: "Zinc",
200
+ cssVars: {
201
+ light: {
202
+ background: "oklch(1 0 0)",
203
+ foreground: "oklch(0.141 0.005 285.823)",
204
+ card: "oklch(1 0 0)",
205
+ "card-foreground": "oklch(0.141 0.005 285.823)",
206
+ popover: "oklch(1 0 0)",
207
+ "popover-foreground": "oklch(0.141 0.005 285.823)",
208
+ primary: "oklch(0.21 0.006 285.885)",
209
+ "primary-foreground": "oklch(0.985 0 0)",
210
+ secondary: "oklch(0.967 0.001 286.375)",
211
+ "secondary-foreground": "oklch(0.21 0.006 285.885)",
212
+ muted: "oklch(0.967 0.001 286.375)",
213
+ "muted-foreground": "oklch(0.552 0.016 285.938)",
214
+ accent: "oklch(0.967 0.001 286.375)",
215
+ "accent-foreground": "oklch(0.21 0.006 285.885)",
216
+ destructive: "oklch(0.577 0.245 27.325)",
217
+ border: "oklch(0.92 0.004 286.32)",
218
+ input: "oklch(0.92 0.004 286.32)",
219
+ ring: "oklch(0.705 0.015 286.067)",
220
+ "chart-1": "oklch(0.646 0.222 41.116)",
221
+ "chart-2": "oklch(0.6 0.118 184.704)",
222
+ "chart-3": "oklch(0.398 0.07 227.392)",
223
+ "chart-4": "oklch(0.828 0.189 84.429)",
224
+ "chart-5": "oklch(0.769 0.188 70.08)",
225
+ radius: "0.625rem",
226
+ sidebar: "oklch(0.985 0 0)",
227
+ "sidebar-foreground": "oklch(0.141 0.005 285.823)",
228
+ "sidebar-primary": "oklch(0.21 0.006 285.885)",
229
+ "sidebar-primary-foreground": "oklch(0.985 0 0)",
230
+ "sidebar-accent": "oklch(0.967 0.001 286.375)",
231
+ "sidebar-accent-foreground": "oklch(0.21 0.006 285.885)",
232
+ "sidebar-border": "oklch(0.92 0.004 286.32)",
233
+ "sidebar-ring": "oklch(0.705 0.015 286.067)"
234
+ },
235
+ dark: {
236
+ background: "oklch(0.141 0.005 285.823)",
237
+ foreground: "oklch(0.985 0 0)",
238
+ card: "oklch(0.21 0.006 285.885)",
239
+ "card-foreground": "oklch(0.985 0 0)",
240
+ popover: "oklch(0.21 0.006 285.885)",
241
+ "popover-foreground": "oklch(0.985 0 0)",
242
+ primary: "oklch(0.92 0.004 286.32)",
243
+ "primary-foreground": "oklch(0.21 0.006 285.885)",
244
+ secondary: "oklch(0.274 0.006 286.033)",
245
+ "secondary-foreground": "oklch(0.985 0 0)",
246
+ muted: "oklch(0.274 0.006 286.033)",
247
+ "muted-foreground": "oklch(0.705 0.015 286.067)",
248
+ accent: "oklch(0.274 0.006 286.033)",
249
+ "accent-foreground": "oklch(0.985 0 0)",
250
+ destructive: "oklch(0.704 0.191 22.216)",
251
+ border: "oklch(1 0 0 / 10%)",
252
+ input: "oklch(1 0 0 / 15%)",
253
+ ring: "oklch(0.552 0.016 285.938)",
254
+ "chart-1": "oklch(0.488 0.243 264.376)",
255
+ "chart-2": "oklch(0.696 0.17 162.48)",
256
+ "chart-3": "oklch(0.769 0.188 70.08)",
257
+ "chart-4": "oklch(0.627 0.265 303.9)",
258
+ "chart-5": "oklch(0.645 0.246 16.439)",
259
+ sidebar: "oklch(0.21 0.006 285.885)",
260
+ "sidebar-foreground": "oklch(0.985 0 0)",
261
+ "sidebar-primary": "oklch(0.488 0.243 264.376)",
262
+ "sidebar-primary-foreground": "oklch(0.985 0 0)",
263
+ "sidebar-accent": "oklch(0.274 0.006 286.033)",
264
+ "sidebar-accent-foreground": "oklch(0.985 0 0)",
265
+ "sidebar-border": "oklch(1 0 0 / 10%)",
266
+ "sidebar-ring": "oklch(0.552 0.016 285.938)"
267
+ }
268
+ }
269
+ },
270
+ {
271
+ name: "gray",
272
+ title: "Gray",
273
+ cssVars: {
274
+ light: {
275
+ background: "oklch(1 0 0)",
276
+ foreground: "oklch(0.13 0.028 261.692)",
277
+ card: "oklch(1 0 0)",
278
+ "card-foreground": "oklch(0.13 0.028 261.692)",
279
+ popover: "oklch(1 0 0)",
280
+ "popover-foreground": "oklch(0.13 0.028 261.692)",
281
+ primary: "oklch(0.21 0.034 264.665)",
282
+ "primary-foreground": "oklch(0.985 0.002 247.839)",
283
+ secondary: "oklch(0.967 0.003 264.542)",
284
+ "secondary-foreground": "oklch(0.21 0.034 264.665)",
285
+ muted: "oklch(0.967 0.003 264.542)",
286
+ "muted-foreground": "oklch(0.551 0.027 264.364)",
287
+ accent: "oklch(0.967 0.003 264.542)",
288
+ "accent-foreground": "oklch(0.21 0.034 264.665)",
289
+ destructive: "oklch(0.577 0.245 27.325)",
290
+ border: "oklch(0.928 0.006 264.531)",
291
+ input: "oklch(0.928 0.006 264.531)",
292
+ ring: "oklch(0.707 0.022 261.325)",
293
+ "chart-1": "oklch(0.646 0.222 41.116)",
294
+ "chart-2": "oklch(0.6 0.118 184.704)",
295
+ "chart-3": "oklch(0.398 0.07 227.392)",
296
+ "chart-4": "oklch(0.828 0.189 84.429)",
297
+ "chart-5": "oklch(0.769 0.188 70.08)",
298
+ radius: "0.625rem",
299
+ sidebar: "oklch(0.985 0.002 247.839)",
300
+ "sidebar-foreground": "oklch(0.13 0.028 261.692)",
301
+ "sidebar-primary": "oklch(0.21 0.034 264.665)",
302
+ "sidebar-primary-foreground": "oklch(0.985 0.002 247.839)",
303
+ "sidebar-accent": "oklch(0.967 0.003 264.542)",
304
+ "sidebar-accent-foreground": "oklch(0.21 0.034 264.665)",
305
+ "sidebar-border": "oklch(0.928 0.006 264.531)",
306
+ "sidebar-ring": "oklch(0.707 0.022 261.325)"
307
+ },
308
+ dark: {
309
+ background: "oklch(0.13 0.028 261.692)",
310
+ foreground: "oklch(0.985 0.002 247.839)",
311
+ card: "oklch(0.21 0.034 264.665)",
312
+ "card-foreground": "oklch(0.985 0.002 247.839)",
313
+ popover: "oklch(0.21 0.034 264.665)",
314
+ "popover-foreground": "oklch(0.985 0.002 247.839)",
315
+ primary: "oklch(0.928 0.006 264.531)",
316
+ "primary-foreground": "oklch(0.21 0.034 264.665)",
317
+ secondary: "oklch(0.278 0.033 256.848)",
318
+ "secondary-foreground": "oklch(0.985 0.002 247.839)",
319
+ muted: "oklch(0.278 0.033 256.848)",
320
+ "muted-foreground": "oklch(0.707 0.022 261.325)",
321
+ accent: "oklch(0.278 0.033 256.848)",
322
+ "accent-foreground": "oklch(0.985 0.002 247.839)",
323
+ destructive: "oklch(0.704 0.191 22.216)",
324
+ border: "oklch(1 0 0 / 10%)",
325
+ input: "oklch(1 0 0 / 15%)",
326
+ ring: "oklch(0.551 0.027 264.364)",
327
+ "chart-1": "oklch(0.488 0.243 264.376)",
328
+ "chart-2": "oklch(0.696 0.17 162.48)",
329
+ "chart-3": "oklch(0.769 0.188 70.08)",
330
+ "chart-4": "oklch(0.627 0.265 303.9)",
331
+ "chart-5": "oklch(0.645 0.246 16.439)",
332
+ sidebar: "oklch(0.21 0.034 264.665)",
333
+ "sidebar-foreground": "oklch(0.985 0.002 247.839)",
334
+ "sidebar-primary": "oklch(0.488 0.243 264.376)",
335
+ "sidebar-primary-foreground": "oklch(0.985 0.002 247.839)",
336
+ "sidebar-accent": "oklch(0.278 0.033 256.848)",
337
+ "sidebar-accent-foreground": "oklch(0.985 0.002 247.839)",
338
+ "sidebar-border": "oklch(1 0 0 / 10%)",
339
+ "sidebar-ring": "oklch(0.551 0.027 264.364)"
340
+ }
341
+ }
342
+ }
343
+ ];
344
+ var RADII = [
345
+ { name: "default", label: "Default", value: "" },
346
+ { name: "none", label: "None", value: "0" },
347
+ { name: "small", label: "Small", value: "0.45rem" },
348
+ { name: "medium", label: "Medium", value: "0.625rem" },
349
+ { name: "large", label: "Large", value: "0.875rem" }
350
+ ];
351
+ function getBaseColor(name) {
352
+ return BASE_COLORS.find((c) => c.name === name);
353
+ }
354
+ function getRadius(name) {
355
+ return RADII.find((r) => r.name === name);
356
+ }
357
+
358
+ // src/lib/theme-config.ts
359
+ var toOklch = converter("oklch");
360
+ function formatOklch(color) {
361
+ if (!color) {
362
+ return "oklch(0 0 0)";
363
+ }
364
+ const l = color.l ?? 0;
365
+ const c = color.c ?? 0;
366
+ const h = color.h ?? 0;
367
+ return `oklch(${l.toFixed(3)} ${c.toFixed(3)} ${h.toFixed(3)})`;
368
+ }
369
+ function generateChartColors(primaryOklch) {
370
+ if (!primaryOklch) {
371
+ return {
372
+ light: [
373
+ "oklch(0.646 0.222 41.116)",
374
+ "oklch(0.6 0.118 184.704)",
375
+ "oklch(0.398 0.07 227.392)",
376
+ "oklch(0.828 0.189 84.429)",
377
+ "oklch(0.769 0.188 70.08)"
378
+ ],
379
+ dark: [
380
+ "oklch(0.488 0.243 264.376)",
381
+ "oklch(0.696 0.17 162.48)",
382
+ "oklch(0.769 0.188 70.08)",
383
+ "oklch(0.627 0.265 303.9)",
384
+ "oklch(0.645 0.246 16.439)"
385
+ ]
386
+ };
387
+ }
388
+ const { l = 0.5, c = 0.1, h = 200 } = primaryOklch;
389
+ const lightCharts = [
390
+ formatOklch({ mode: "oklch", l: Math.min(l + 0.15, 0.95), c, h }),
391
+ formatOklch({ mode: "oklch", l: Math.min(l + 0.05, 0.9), c, h }),
392
+ formatOklch({ mode: "oklch", l, c, h }),
393
+ formatOklch({ mode: "oklch", l: Math.max(l - 0.1, 0.3), c: c * 0.9, h }),
394
+ formatOklch({ mode: "oklch", l: Math.max(l - 0.15, 0.25), c: c * 0.8, h })
395
+ ];
396
+ const darkCharts = [
397
+ formatOklch({ mode: "oklch", l: Math.max(l - 0.1, 0.4), c, h }),
398
+ formatOklch({
399
+ mode: "oklch",
400
+ l: Math.min(l + 0.1, 0.7),
401
+ c: c * 0.8,
402
+ h: (h + 30) % 360
403
+ }),
404
+ formatOklch({
405
+ mode: "oklch",
406
+ l: Math.min(l + 0.15, 0.75),
407
+ c: c * 0.9,
408
+ h: (h - 30 + 360) % 360
409
+ }),
410
+ formatOklch({
411
+ mode: "oklch",
412
+ l: Math.max(l, 0.6),
413
+ c: c * 1.1,
414
+ h: (h + 60) % 360
415
+ }),
416
+ formatOklch({
417
+ mode: "oklch",
418
+ l: Math.max(l + 0.05, 0.62),
419
+ c: c * 1.05,
420
+ h: (h - 60 + 360) % 360
421
+ })
422
+ ];
423
+ return { light: lightCharts, dark: darkCharts };
424
+ }
425
+ function buildTheme(config) {
426
+ const baseColorName = config.baseColor ?? "zinc";
427
+ const base = getBaseColor(baseColorName);
428
+ if (!base) {
429
+ throw new Error(`Base color "${baseColorName}" not found`);
430
+ }
431
+ const lightVars = { ...base.cssVars.light };
432
+ const darkVars = { ...base.cssVars.dark };
433
+ const primaryOklch = toOklch(config.color);
434
+ if (primaryOklch) {
435
+ const { l = 0.5, c = 0.1, h = 200 } = primaryOklch;
436
+ lightVars.primary = formatOklch({ mode: "oklch", l, c, h });
437
+ lightVars["primary-foreground"] = "oklch(0.985 0 0)";
438
+ const darkL = Math.min(l + 0.2, 0.9);
439
+ darkVars.primary = formatOklch({ mode: "oklch", l: darkL, c, h });
440
+ const darkPrimaryLightness = darkL;
441
+ const contrastDark = darkPrimaryLightness > 0.6 ? "oklch(0.145 0 0)" : "oklch(0.985 0 0)";
442
+ darkVars["primary-foreground"] = contrastDark;
443
+ lightVars["sidebar-primary"] = lightVars.primary;
444
+ lightVars["sidebar-primary-foreground"] = lightVars["primary-foreground"];
445
+ darkVars["sidebar-primary"] = darkVars.primary;
446
+ darkVars["sidebar-primary-foreground"] = darkVars["primary-foreground"];
447
+ const charts = generateChartColors(primaryOklch);
448
+ for (let i = 0; i < 5; i++) {
449
+ lightVars[`chart-${i + 1}`] = charts.light[i];
450
+ darkVars[`chart-${i + 1}`] = charts.dark[i];
451
+ }
452
+ }
453
+ if (config.radius && config.radius !== "default") {
454
+ const radius = getRadius(config.radius);
455
+ if (radius?.value) {
456
+ lightVars.radius = radius.value;
457
+ darkVars.radius = radius.value;
458
+ }
459
+ }
460
+ return { light: lightVars, dark: darkVars };
461
+ }
462
+
463
+ // src/lib/theme-schema.ts
15
464
  var THEME_VAR_NAMES = [
16
465
  "--background",
17
466
  "--foreground",
@@ -21,15 +470,12 @@ var THEME_VAR_NAMES = [
21
470
  "--popover-foreground",
22
471
  "--primary",
23
472
  "--primary-foreground",
24
- ...SHADE_KEYS.map((s) => `--primary-${s}`),
25
473
  "--secondary",
26
474
  "--secondary-foreground",
27
- ...SHADE_KEYS.map((s) => `--secondary-${s}`),
28
- "--accent",
29
- "--accent-foreground",
30
- ...SHADE_KEYS.map((s) => `--accent-${s}`),
31
475
  "--muted",
32
476
  "--muted-foreground",
477
+ "--accent",
478
+ "--accent-foreground",
33
479
  "--destructive",
34
480
  "--destructive-foreground",
35
481
  "--border",
@@ -41,31 +487,26 @@ var THEME_VAR_NAMES = [
41
487
  "--chart-4",
42
488
  "--chart-5",
43
489
  "--radius",
44
- "--spacing",
45
490
  "--sidebar",
46
491
  "--sidebar-foreground",
47
492
  "--sidebar-primary",
48
493
  "--sidebar-primary-foreground",
49
494
  "--sidebar-accent",
50
495
  "--sidebar-accent-foreground",
51
- "--sidebar-active",
52
496
  "--sidebar-border",
53
497
  "--sidebar-ring",
498
+ "--sidebar-active",
499
+ // mesob extension
54
500
  "--overlay"
501
+ // mesob extension
55
502
  ];
56
503
  var THEME_VAR_SET = new Set(THEME_VAR_NAMES);
57
504
  var REQUIRED_THEME_VARS = [
505
+ "--background",
506
+ "--foreground",
58
507
  "--primary",
59
508
  "--primary-foreground",
60
- ...SHADE_KEYS.map((s) => `--primary-${s}`),
61
- "--secondary",
62
- "--secondary-foreground",
63
- ...SHADE_KEYS.map((s) => `--secondary-${s}`),
64
- "--accent",
65
- "--accent-foreground",
66
- ...SHADE_KEYS.map((s) => `--accent-${s}`),
67
- "--radius",
68
- "--spacing"
509
+ "--radius"
69
510
  ];
70
511
  function validateTheme(theme) {
71
512
  const keys = new Set(Object.keys(theme));
@@ -95,9 +536,21 @@ function cn(...inputs) {
95
536
  return twMerge(clsx(inputs));
96
537
  }
97
538
  export {
539
+ BASE_COLORS,
540
+ DEFAULT_LANGUAGE,
541
+ LOCALE_INPUT_DEFAULT,
542
+ LOCALE_OPTIONAL_INPUT_SCHEMA,
543
+ LOCALE_REQUIRED_INPUT_SCHEMA,
544
+ RADII,
98
545
  REQUIRED_THEME_VARS,
546
+ SUPPORTED_LANGUAGES,
99
547
  THEME_VAR_NAMES,
548
+ buildTheme,
100
549
  cn,
550
+ createLocalInputSchema,
551
+ createLocalRequiredInputSchema,
552
+ getBaseColor,
553
+ getRadius,
101
554
  validateTheme
102
555
  };
103
556
  //# sourceMappingURL=index.js.map