basuicn 0.1.0 → 0.1.3

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.
@@ -135,6 +135,14 @@ const buildRegistry = () => {
135
135
  path: 'src/styles/index.css',
136
136
  content: fs.readFileSync('./src/styles/index.css', 'utf-8'),
137
137
  },
138
+ {
139
+ path: 'src/lib/theme/themes.ts',
140
+ content: fs.readFileSync('./src/lib/theme/themes.ts', 'utf-8'),
141
+ },
142
+ {
143
+ path: 'src/lib/theme/ThemeProvider.tsx',
144
+ content: fs.readFileSync('./src/lib/theme/ThemeProvider.tsx', 'utf-8'),
145
+ },
138
146
  ],
139
147
  },
140
148
  components: {},
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Syncs the default theme CSS variables from themes.ts → src/styles/index.css.
3
+ * Run via: npm run theme:sync
4
+ *
5
+ * Replaces the content between:
6
+ * /* GENERATED:theme-start *\/
7
+ * /* GENERATED:theme-end *\/
8
+ * in index.css with fresh values from themes[0].
9
+ */
10
+
11
+ import fs from 'fs';
12
+ import path from 'path';
13
+ import { themes } from '../src/lib/theme/themes';
14
+
15
+ const CSS_PATH = path.resolve('src/styles/index.css');
16
+ const START_MARKER = '/* GENERATED:theme-start */';
17
+ const END_MARKER = '/* GENERATED:theme-end */';
18
+
19
+ const INDENT = ' '; // 8 spaces — matches :root { } indentation in index.css
20
+
21
+ const { colors: c } = themes[0];
22
+ const vars: [string, string][] = [
23
+ ['--background', c.background],
24
+ ['--foreground', c.foreground],
25
+ ['--primary', c.primary],
26
+ ['--primary-foreground', c.primaryForeground],
27
+ ['--secondary', c.secondary],
28
+ ['--secondary-foreground', c.secondaryForeground],
29
+ ['--muted', c.muted],
30
+ ['--muted-foreground', c.mutedForeground],
31
+ ['--accent', c.accent],
32
+ ['--accent-foreground', c.accentForeground],
33
+ ['--success', c.success],
34
+ ['--success-foreground', c.successForeground],
35
+ ['--warning', c.warning],
36
+ ['--warning-foreground', c.warningForeground],
37
+ ['--danger', c.danger],
38
+ ['--danger-foreground', c.dangerForeground],
39
+ ['--destructive', c.danger],
40
+ ['--destructive-foreground', c.dangerForeground],
41
+ ['--border', c.border],
42
+ ['--input', c.input],
43
+ ['--ring', c.ring],
44
+ ['--popover', c.popover],
45
+ ['--popover-foreground', c.popoverForeground],
46
+ ];
47
+
48
+ const generated = [
49
+ START_MARKER,
50
+ `${INDENT}/* Auto-generated from themes.ts — run \`npm run theme:sync\` to update */`,
51
+ ...vars.map(([k, v]) => `${INDENT}${k}: ${v};`),
52
+ `${INDENT}${END_MARKER}`,
53
+ ].join('\n');
54
+
55
+ const css = fs.readFileSync(CSS_PATH, 'utf-8');
56
+
57
+ const startIdx = css.indexOf(START_MARKER);
58
+ const endIdx = css.indexOf(END_MARKER);
59
+
60
+ if (startIdx === -1 || endIdx === -1) {
61
+ console.error(
62
+ `[theme:sync] Markers not found in ${CSS_PATH}.\n` +
63
+ `Add these two comments inside @layer base :root { }:\n\n` +
64
+ ` ${START_MARKER}\n ${END_MARKER}\n`
65
+ );
66
+ process.exit(1);
67
+ }
68
+
69
+ const before = css.slice(0, startIdx);
70
+ const after = css.slice(endIdx + END_MARKER.length);
71
+ const result = before + generated + after;
72
+
73
+ fs.writeFileSync(CSS_PATH, result, 'utf-8');
74
+ console.log(`[theme:sync] Synced default theme "${themes[0].name}" → ${CSS_PATH}`);