omgkit 2.29.0 → 2.31.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/README.md +92 -10
- package/bin/omgkit.js +178 -0
- package/lib/cli.js +1 -1
- package/lib/generators/css.generator.js +151 -0
- package/lib/generators/figma.generator.js +311 -0
- package/lib/generators/index.js +135 -0
- package/lib/generators/scss.generator.js +249 -0
- package/lib/generators/style-dictionary.generator.js +456 -0
- package/lib/generators/tailwind.generator.js +251 -0
- package/lib/theme-v2.js +755 -0
- package/lib/theme.js +746 -4
- package/package.json +2 -2
- package/plugin/agents/fullstack-developer.md +1 -0
- package/plugin/agents/ui-ux-designer.md +163 -54
- package/plugin/commands/design/export.md +232 -0
- package/plugin/commands/design/rebuild.md +199 -0
- package/plugin/commands/design/rollback.md +179 -0
- package/plugin/commands/design/scan.md +155 -0
- package/plugin/commands/design/validate.md +223 -0
- package/plugin/registry.yaml +7 -3
- package/plugin/skills/frontend/design-system-context/SKILL.md +252 -0
- package/templates/design/schema/theme-v2.schema.json +384 -0
- package/templates/design/themes/tech-ai/electric-cyan-v2.json +362 -0
package/README.md
CHANGED
|
@@ -37,11 +37,11 @@ All coordinated through **Omega-level thinking** - a framework for finding break
|
|
|
37
37
|
| Component | Count | Description |
|
|
38
38
|
|-----------|-------|-------------|
|
|
39
39
|
| **Agents** | 41 | Specialized AI team members with distinct roles |
|
|
40
|
-
| **Commands** |
|
|
40
|
+
| **Commands** | 174 | Slash commands for every development task |
|
|
41
41
|
| **Workflows** | 69 | Complete development processes from idea to deploy |
|
|
42
|
-
| **Skills** |
|
|
42
|
+
| **Skills** | 162 | Domain expertise modules across 24 categories |
|
|
43
43
|
| **Modes** | 10 | Behavioral configurations for different contexts |
|
|
44
|
-
| **Themes** |
|
|
44
|
+
| **Themes** | 31 | Curated design system themes (V1 + V2 schemas) |
|
|
45
45
|
| **Archetypes** | 14 | Project templates for autonomous development |
|
|
46
46
|
|
|
47
47
|
---
|
|
@@ -166,23 +166,38 @@ testing:
|
|
|
166
166
|
target: 85
|
|
167
167
|
```
|
|
168
168
|
|
|
169
|
-
### 6. Design System (
|
|
169
|
+
### 6. Design System (Enhanced in 2.30.0)
|
|
170
170
|
|
|
171
|
-
OMGKIT includes a complete design system with
|
|
171
|
+
OMGKIT includes a complete design system with 31 curated themes for shadcn/ui integration. Now supports both **V1** (flat colors) and **V2** (color scales, effects, animations) theme schemas.
|
|
172
172
|
|
|
173
173
|
```bash
|
|
174
174
|
# Initialize with a theme (opt-in)
|
|
175
175
|
omgkit init --theme neo-tokyo
|
|
176
176
|
|
|
177
|
+
# Or use a V2 theme with advanced features
|
|
178
|
+
omgkit init --theme electric-cyan-v2
|
|
179
|
+
|
|
177
180
|
# Or explore themes first
|
|
178
181
|
omgkit init --with-design
|
|
179
182
|
```
|
|
180
183
|
|
|
184
|
+
#### Theme Schema Versions
|
|
185
|
+
|
|
186
|
+
| Feature | V1 | V2 |
|
|
187
|
+
|---------|----|----|
|
|
188
|
+
| Flat colors | ✓ | ✓ |
|
|
189
|
+
| 12-step color scales | - | ✓ |
|
|
190
|
+
| $ref token references | - | ✓ |
|
|
191
|
+
| Status colors (success/warning/info) | - | ✓ |
|
|
192
|
+
| Effects (glass, glow, gradient) | - | ✓ |
|
|
193
|
+
| Animations (keyframes) | - | ✓ |
|
|
194
|
+
| Alpha variants | - | ✓ |
|
|
195
|
+
|
|
181
196
|
#### 5 Theme Categories
|
|
182
197
|
|
|
183
198
|
| Category | Themes | Description |
|
|
184
199
|
|----------|--------|-------------|
|
|
185
|
-
| **Tech & AI** | neo-tokyo, electric-cyan, neural-dark, matrix-green, quantum-purple, hologram | Futuristic, cyberpunk-inspired |
|
|
200
|
+
| **Tech & AI** | neo-tokyo, electric-cyan, electric-cyan-v2, neural-dark, matrix-green, quantum-purple, hologram | Futuristic, cyberpunk-inspired |
|
|
186
201
|
| **Minimal & Clean** | minimal-slate, paper, mono, zen, nordic, swiss | Simple, elegant, distraction-free |
|
|
187
202
|
| **Corporate** | ocean-blue, corporate-indigo, finance, legal, healthcare, consulting | Professional, trustworthy |
|
|
188
203
|
| **Creative & Bold** | coral-sunset, candy, neon, gradient-dream, retro, studio | Vibrant, expressive |
|
|
@@ -192,7 +207,7 @@ omgkit init --with-design
|
|
|
192
207
|
|
|
193
208
|
| Command | Description |
|
|
194
209
|
|---------|-------------|
|
|
195
|
-
| `/design:themes` | List all
|
|
210
|
+
| `/design:themes` | List all 31 curated themes |
|
|
196
211
|
| `/design:theme <id>` | Apply a theme to your project |
|
|
197
212
|
| `/design:preview` | Preview current theme colors |
|
|
198
213
|
| `/design:builder` | Build custom theme interactively |
|
|
@@ -200,6 +215,73 @@ omgkit init --with-design
|
|
|
200
215
|
| `/design:from-url` | Extract theme from webpage |
|
|
201
216
|
| `/design:add <comp>` | Add shadcn/ui components |
|
|
202
217
|
| `/design:reset` | Reset to original theme |
|
|
218
|
+
| `/design:rebuild <id>` | Rebuild entire project with new theme |
|
|
219
|
+
| `/design:scan` | Scan for non-compliant colors |
|
|
220
|
+
| `/design:rollback` | Rollback to previous theme |
|
|
221
|
+
| `/design:export <format>` | Export to CSS, SCSS, Tailwind, Figma, Style Dictionary |
|
|
222
|
+
| `/design:validate` | Validate theme structure |
|
|
223
|
+
|
|
224
|
+
#### Theme Export (New in 2.30.0)
|
|
225
|
+
|
|
226
|
+
Export your theme to various design tools and framework formats:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# Export CSS
|
|
230
|
+
/design:export css
|
|
231
|
+
|
|
232
|
+
# Export Figma tokens
|
|
233
|
+
/design:export figma --output ./tokens/
|
|
234
|
+
|
|
235
|
+
# Export all formats
|
|
236
|
+
/design:export --all
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Supported formats: `css`, `scss`, `tailwind`, `figma`, `style-dictionary`
|
|
240
|
+
|
|
241
|
+
#### Theme Rebuild
|
|
242
|
+
|
|
243
|
+
Rebuild your entire project's UI with a single command:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
# Rebuild with new theme (scans and fixes hardcoded colors)
|
|
247
|
+
omgkit design:rebuild neo-tokyo
|
|
248
|
+
|
|
249
|
+
# Use V2 theme for advanced features
|
|
250
|
+
omgkit design:rebuild electric-cyan-v2
|
|
251
|
+
|
|
252
|
+
# Scan for non-compliant colors
|
|
253
|
+
omgkit design:scan
|
|
254
|
+
|
|
255
|
+
# Rollback if needed
|
|
256
|
+
omgkit design:rollback
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
The rebuild feature:
|
|
260
|
+
- Backs up current theme before changes
|
|
261
|
+
- Scans `app/`, `components/`, `src/`, `pages/` directories
|
|
262
|
+
- Replaces hardcoded colors (`bg-blue-500`) with theme variables (`bg-primary`)
|
|
263
|
+
- Reports unfixable patterns for manual review
|
|
264
|
+
- V2 themes generate 12-step color scales and status colors
|
|
265
|
+
|
|
266
|
+
#### V2 Theme Features
|
|
267
|
+
|
|
268
|
+
V2 themes provide additional CSS variables:
|
|
269
|
+
|
|
270
|
+
```css
|
|
271
|
+
/* 12-step color scales */
|
|
272
|
+
--cyan-1 through --cyan-12
|
|
273
|
+
--cyan-a1 through --cyan-a12 /* Alpha variants */
|
|
274
|
+
|
|
275
|
+
/* Status colors */
|
|
276
|
+
--success, --warning, --info
|
|
277
|
+
|
|
278
|
+
/* Effects */
|
|
279
|
+
--glass-blur, --glow
|
|
280
|
+
|
|
281
|
+
/* Animations */
|
|
282
|
+
@keyframes shimmer { ... }
|
|
283
|
+
--animation-shimmer
|
|
284
|
+
```
|
|
203
285
|
|
|
204
286
|
#### How It Works
|
|
205
287
|
|
|
@@ -346,7 +428,7 @@ Agents are specialized AI team members, each with distinct expertise and respons
|
|
|
346
428
|
|
|
347
429
|
---
|
|
348
430
|
|
|
349
|
-
## Commands (
|
|
431
|
+
## Commands (174)
|
|
350
432
|
|
|
351
433
|
Commands are slash-prefixed actions organized by namespace.
|
|
352
434
|
|
|
@@ -611,7 +693,7 @@ Workflows are orchestrated sequences of agents, commands, and skills.
|
|
|
611
693
|
|
|
612
694
|
---
|
|
613
695
|
|
|
614
|
-
## Skills (
|
|
696
|
+
## Skills (162)
|
|
615
697
|
|
|
616
698
|
Skills are domain expertise modules organized in 24 categories.
|
|
617
699
|
|
|
@@ -963,7 +1045,7 @@ If any sync issue is detected (missing pages, wrong counts, broken links), the v
|
|
|
963
1045
|
|
|
964
1046
|
## Validation & Testing
|
|
965
1047
|
|
|
966
|
-
OMGKIT has
|
|
1048
|
+
OMGKIT has 8200+ automated tests ensuring system integrity.
|
|
967
1049
|
|
|
968
1050
|
### Run Tests
|
|
969
1051
|
|
package/bin/omgkit.js
CHANGED
|
@@ -34,6 +34,13 @@ import {
|
|
|
34
34
|
log
|
|
35
35
|
} from '../lib/cli.js';
|
|
36
36
|
|
|
37
|
+
import {
|
|
38
|
+
scanProjectColors,
|
|
39
|
+
rebuildProjectTheme,
|
|
40
|
+
rollbackTheme,
|
|
41
|
+
listThemeBackups
|
|
42
|
+
} from '../lib/theme.js';
|
|
43
|
+
|
|
37
44
|
// Set package root for CLI context
|
|
38
45
|
const __filename = fileURLToPath(import.meta.url);
|
|
39
46
|
const __dirname = dirname(__filename);
|
|
@@ -69,6 +76,12 @@ ${COLORS.bright}CONFIG COMMANDS${COLORS.reset}
|
|
|
69
76
|
${COLORS.cyan}config list [section]${COLORS.reset} List all config or specific section
|
|
70
77
|
${COLORS.cyan}config reset <key>${COLORS.reset} Reset config key to default
|
|
71
78
|
|
|
79
|
+
${COLORS.bright}DESIGN SYSTEM COMMANDS${COLORS.reset}
|
|
80
|
+
${COLORS.cyan}design:rebuild <theme>${COLORS.reset} Rebuild project UI with new theme
|
|
81
|
+
${COLORS.cyan}design:scan${COLORS.reset} Scan for non-compliant colors
|
|
82
|
+
${COLORS.cyan}design:rollback [id]${COLORS.reset} Rollback to previous theme
|
|
83
|
+
${COLORS.cyan}design:backups${COLORS.reset} List available theme backups
|
|
84
|
+
|
|
72
85
|
${COLORS.bright}UPGRADE OPTIONS${COLORS.reset}
|
|
73
86
|
--dry Show what would change without applying
|
|
74
87
|
--force Skip confirmation prompts
|
|
@@ -91,6 +104,13 @@ ${COLORS.bright}CONFIG EXAMPLES${COLORS.reset}
|
|
|
91
104
|
omgkit config list testing
|
|
92
105
|
omgkit config reset testing.enforcement.level
|
|
93
106
|
|
|
107
|
+
${COLORS.bright}DESIGN EXAMPLES${COLORS.reset}
|
|
108
|
+
omgkit design:rebuild neo-tokyo # Rebuild with Neo Tokyo theme
|
|
109
|
+
omgkit design:rebuild --dry # Preview what would change
|
|
110
|
+
omgkit design:scan # Scan for non-compliant colors
|
|
111
|
+
omgkit design:rollback # Rollback to previous theme
|
|
112
|
+
omgkit design:backups # List theme backups
|
|
113
|
+
|
|
94
114
|
${COLORS.bright}AFTER INSTALLATION${COLORS.reset}
|
|
95
115
|
In Claude Code, type / to see all OMGKIT commands:
|
|
96
116
|
|
|
@@ -247,6 +267,164 @@ ${COLORS.bright}Examples:${COLORS.reset}
|
|
|
247
267
|
}
|
|
248
268
|
break;
|
|
249
269
|
}
|
|
270
|
+
case 'design:rebuild': {
|
|
271
|
+
console.log(BANNER);
|
|
272
|
+
const themeId = args.find(a => !a.startsWith('--'));
|
|
273
|
+
const dryRun = args.includes('--dry');
|
|
274
|
+
const force = args.includes('--force');
|
|
275
|
+
|
|
276
|
+
if (!themeId) {
|
|
277
|
+
log.error('Usage: omgkit design:rebuild <theme-id> [--dry] [--force]');
|
|
278
|
+
log.info('Run /design:themes in Claude Code to see available themes');
|
|
279
|
+
log.info('Example: omgkit design:rebuild neo-tokyo');
|
|
280
|
+
process.exit(1);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
console.log(`${COLORS.bright}🔮 Design Rebuild: ${themeId}${COLORS.reset}`);
|
|
284
|
+
console.log('━'.repeat(40));
|
|
285
|
+
|
|
286
|
+
if (dryRun) {
|
|
287
|
+
log.info('DRY RUN - No changes will be made\n');
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const result = rebuildProjectTheme(process.cwd(), themeId, { dryRun, force });
|
|
291
|
+
|
|
292
|
+
if (!result.success) {
|
|
293
|
+
log.error(result.error);
|
|
294
|
+
process.exit(1);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (!dryRun && result.backupId) {
|
|
298
|
+
console.log(`\n📦 ${COLORS.green}Backup created:${COLORS.reset} ${result.backupId}`);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
console.log(`\n🎨 ${COLORS.bright}Theme Applied:${COLORS.reset} ${result.newTheme}`);
|
|
302
|
+
|
|
303
|
+
if (result.changedFiles.length > 0) {
|
|
304
|
+
console.log(`\n${COLORS.bright}Changed Files:${COLORS.reset}`);
|
|
305
|
+
for (const f of result.changedFiles) {
|
|
306
|
+
console.log(` ${COLORS.green}✓${COLORS.reset} ${f}`);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (result.fixedColors.length > 0) {
|
|
311
|
+
console.log(`\n${COLORS.bright}Fixed Colors:${COLORS.reset}`);
|
|
312
|
+
for (const fc of result.fixedColors) {
|
|
313
|
+
console.log(` ${COLORS.cyan}${fc.file}${COLORS.reset}`);
|
|
314
|
+
for (const r of fc.replacements) {
|
|
315
|
+
if (r.count) {
|
|
316
|
+
console.log(` ${r.from} → ${r.to} (${r.count}x)`);
|
|
317
|
+
} else {
|
|
318
|
+
console.log(` ${r.from} → ${r.to}`);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if (result.warnings.length > 0) {
|
|
325
|
+
console.log(`\n${COLORS.yellow}⚠️ Warnings (manual review needed):${COLORS.reset}`);
|
|
326
|
+
for (const w of result.warnings.slice(0, 10)) {
|
|
327
|
+
console.log(` ${w}`);
|
|
328
|
+
}
|
|
329
|
+
if (result.warnings.length > 10) {
|
|
330
|
+
console.log(` ... and ${result.warnings.length - 10} more`);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
if (dryRun) {
|
|
335
|
+
log.info('\nTo apply changes, run without --dry flag');
|
|
336
|
+
} else {
|
|
337
|
+
log.success('\nRebuild complete!');
|
|
338
|
+
log.info('To rollback: omgkit design:rollback');
|
|
339
|
+
}
|
|
340
|
+
break;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
case 'design:scan': {
|
|
344
|
+
console.log(BANNER);
|
|
345
|
+
console.log(`${COLORS.bright}🔍 Scanning for non-compliant colors...${COLORS.reset}\n`);
|
|
346
|
+
|
|
347
|
+
const result = scanProjectColors(process.cwd());
|
|
348
|
+
|
|
349
|
+
console.log(`Scanned ${result.scannedFiles} files\n`);
|
|
350
|
+
|
|
351
|
+
if (result.nonCompliant.length === 0) {
|
|
352
|
+
log.success('All colors are theme-compliant!');
|
|
353
|
+
} else {
|
|
354
|
+
log.warn(`Found ${result.nonCompliant.length} non-compliant color references\n`);
|
|
355
|
+
|
|
356
|
+
// Group by file
|
|
357
|
+
const byFile = {};
|
|
358
|
+
for (const item of result.nonCompliant) {
|
|
359
|
+
if (!byFile[item.file]) byFile[item.file] = [];
|
|
360
|
+
byFile[item.file].push(item);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
for (const [file, items] of Object.entries(byFile)) {
|
|
364
|
+
console.log(`${COLORS.cyan}📁 ${file}${COLORS.reset}`);
|
|
365
|
+
for (const item of items.slice(0, 5)) {
|
|
366
|
+
const suggestion = item.suggestion ? ` → ${COLORS.green}${item.suggestion}${COLORS.reset}` : ` ${COLORS.yellow}(manual review)${COLORS.reset}`;
|
|
367
|
+
console.log(` Line ${item.line}: ${item.match}${suggestion}`);
|
|
368
|
+
}
|
|
369
|
+
if (items.length > 5) {
|
|
370
|
+
console.log(` ... and ${items.length - 5} more`);
|
|
371
|
+
}
|
|
372
|
+
console.log();
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
console.log('━'.repeat(40));
|
|
376
|
+
console.log(`Total: ${result.nonCompliant.length} violations in ${Object.keys(byFile).length} files`);
|
|
377
|
+
console.log(`\nRun ${COLORS.cyan}omgkit design:rebuild <theme-id>${COLORS.reset} to auto-fix`);
|
|
378
|
+
}
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
case 'design:rollback': {
|
|
383
|
+
console.log(BANNER);
|
|
384
|
+
const backupId = args[0];
|
|
385
|
+
|
|
386
|
+
console.log(`${COLORS.bright}🔄 Theme Rollback${COLORS.reset}\n`);
|
|
387
|
+
|
|
388
|
+
const result = rollbackTheme(process.cwd(), backupId);
|
|
389
|
+
|
|
390
|
+
if (!result.success) {
|
|
391
|
+
log.error(result.error);
|
|
392
|
+
if (result.error.includes('No theme backups')) {
|
|
393
|
+
log.info('No backups available. Rebuild a theme first to create backups.');
|
|
394
|
+
}
|
|
395
|
+
process.exit(1);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
log.success(`Rolled back to: ${result.restoredTheme}`);
|
|
399
|
+
console.log(`\n${COLORS.bright}Restored Files:${COLORS.reset}`);
|
|
400
|
+
for (const f of result.restoredFiles) {
|
|
401
|
+
console.log(` ${COLORS.green}✓${COLORS.reset} ${f}`);
|
|
402
|
+
}
|
|
403
|
+
console.log(`\nBackup used: ${result.backupUsed}`);
|
|
404
|
+
break;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
case 'design:backups': {
|
|
408
|
+
console.log(BANNER);
|
|
409
|
+
console.log(`${COLORS.bright}📦 Theme Backups${COLORS.reset}\n`);
|
|
410
|
+
|
|
411
|
+
const backups = listThemeBackups(process.cwd());
|
|
412
|
+
|
|
413
|
+
if (backups.length === 0) {
|
|
414
|
+
log.info('No theme backups found');
|
|
415
|
+
log.info('Run omgkit design:rebuild <theme-id> to create backups');
|
|
416
|
+
} else {
|
|
417
|
+
for (const b of backups) {
|
|
418
|
+
console.log(` ${COLORS.cyan}${b.id}${COLORS.reset}`);
|
|
419
|
+
console.log(` ${b.previousTheme} → ${b.newTheme}`);
|
|
420
|
+
console.log(` ${b.date} (${b.filesChanged} files)\n`);
|
|
421
|
+
}
|
|
422
|
+
console.log(`To rollback: ${COLORS.cyan}omgkit design:rollback${COLORS.reset}`);
|
|
423
|
+
console.log(`Or specify: ${COLORS.cyan}omgkit design:rollback <backup-id>${COLORS.reset}`);
|
|
424
|
+
}
|
|
425
|
+
break;
|
|
426
|
+
}
|
|
427
|
+
|
|
250
428
|
case 'version':
|
|
251
429
|
case '-v':
|
|
252
430
|
case '--version': {
|
package/lib/cli.js
CHANGED
|
@@ -58,7 +58,7 @@ ${COLORS.magenta}╔════════════════════
|
|
|
58
58
|
║ ║
|
|
59
59
|
║ 🔮 OMGKIT - Omega-Level Development Kit ║
|
|
60
60
|
║ ║
|
|
61
|
-
║ 41 Agents • 169 Commands •
|
|
61
|
+
║ 41 Agents • 169 Commands • 162 Skills • 10 Modes ║
|
|
62
62
|
║ "Think Omega. Build Omega. Be Omega." ║
|
|
63
63
|
║ ║
|
|
64
64
|
╚════════════════════════════════════════════════════════════╝${COLORS.reset}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS Generator
|
|
3
|
+
* Generates CSS variables from theme (v1 and v2 compatible)
|
|
4
|
+
*
|
|
5
|
+
* @module lib/generators/css
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { detectThemeVersion, isV2Theme } from '../theme.js';
|
|
9
|
+
import {
|
|
10
|
+
processTheme,
|
|
11
|
+
processAnimations,
|
|
12
|
+
generateKeyframesCSS
|
|
13
|
+
} from '../theme-v2.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Generate CSS from theme
|
|
17
|
+
* @param {Object} theme - Theme object (v1 or v2)
|
|
18
|
+
* @param {Object} options - Generation options
|
|
19
|
+
* @param {boolean} options.includeBase - Include @layer base wrapper (default: true)
|
|
20
|
+
* @param {boolean} options.includeReset - Include border-box reset (default: true)
|
|
21
|
+
* @param {boolean} options.includeAnimations - Include keyframes (default: true)
|
|
22
|
+
* @returns {string} CSS content
|
|
23
|
+
*/
|
|
24
|
+
export function generateCSS(theme, options = {}) {
|
|
25
|
+
const {
|
|
26
|
+
includeBase = true,
|
|
27
|
+
includeReset = true,
|
|
28
|
+
includeAnimations = true
|
|
29
|
+
} = options;
|
|
30
|
+
|
|
31
|
+
const result = processTheme(theme);
|
|
32
|
+
const { light: lightVars, dark: darkVars } = result.variables;
|
|
33
|
+
|
|
34
|
+
// Generate variable declarations
|
|
35
|
+
const generateVars = (vars) => {
|
|
36
|
+
return Object.entries(vars)
|
|
37
|
+
.map(([key, value]) => ` --${key}: ${value};`)
|
|
38
|
+
.join('\n');
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const lightCSS = generateVars(lightVars);
|
|
42
|
+
const darkCSS = generateVars(darkVars);
|
|
43
|
+
|
|
44
|
+
// Typography
|
|
45
|
+
const fontSans = theme.typography?.fontFamily?.sans ||
|
|
46
|
+
theme.fontFamily?.sans ||
|
|
47
|
+
'Inter, system-ui, sans-serif';
|
|
48
|
+
const fontMono = theme.typography?.fontFamily?.mono ||
|
|
49
|
+
theme.fontFamily?.mono ||
|
|
50
|
+
'JetBrains Mono, monospace';
|
|
51
|
+
const radius = theme.spacing?.radius || theme.radius || '0.5rem';
|
|
52
|
+
|
|
53
|
+
// Animations
|
|
54
|
+
let keyframesCSS = '';
|
|
55
|
+
let animationVars = '';
|
|
56
|
+
|
|
57
|
+
if (includeAnimations && theme.animations) {
|
|
58
|
+
const { keyframes, animations } = processAnimations(theme.animations);
|
|
59
|
+
keyframesCSS = generateKeyframesCSS(keyframes);
|
|
60
|
+
animationVars = Object.entries(animations)
|
|
61
|
+
.map(([name, value]) => ` --animation-${name}: ${value};`)
|
|
62
|
+
.join('\n');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Build CSS
|
|
66
|
+
const version = detectThemeVersion(theme);
|
|
67
|
+
let css = `/* OMGKIT Theme: ${theme.name} */
|
|
68
|
+
/* Theme ID: ${theme.id} */
|
|
69
|
+
/* Category: ${theme.category} */
|
|
70
|
+
/* Version: ${version} */
|
|
71
|
+
/* Generated by OMGKIT Design System */
|
|
72
|
+
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
// Add keyframes
|
|
76
|
+
if (keyframesCSS) {
|
|
77
|
+
css += keyframesCSS + '\n';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Root variables
|
|
81
|
+
if (includeBase) {
|
|
82
|
+
css += `@layer base {
|
|
83
|
+
:root {
|
|
84
|
+
${lightCSS}
|
|
85
|
+
--radius: ${radius};
|
|
86
|
+
--font-sans: ${fontSans};
|
|
87
|
+
--font-mono: ${fontMono};
|
|
88
|
+
${animationVars ? animationVars + '\n' : ''}}
|
|
89
|
+
|
|
90
|
+
.dark {
|
|
91
|
+
${darkCSS}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
} else {
|
|
96
|
+
css += `:root {
|
|
97
|
+
${lightCSS}
|
|
98
|
+
--radius: ${radius};
|
|
99
|
+
--font-sans: ${fontSans};
|
|
100
|
+
--font-mono: ${fontMono};
|
|
101
|
+
${animationVars ? animationVars + '\n' : ''}}
|
|
102
|
+
|
|
103
|
+
.dark {
|
|
104
|
+
${darkCSS}
|
|
105
|
+
}
|
|
106
|
+
`;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Reset styles
|
|
110
|
+
if (includeReset && includeBase) {
|
|
111
|
+
css += `
|
|
112
|
+
@layer base {
|
|
113
|
+
* {
|
|
114
|
+
@apply border-border;
|
|
115
|
+
}
|
|
116
|
+
body {
|
|
117
|
+
@apply bg-background text-foreground;
|
|
118
|
+
font-family: var(--font-sans);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
`;
|
|
122
|
+
} else if (includeReset) {
|
|
123
|
+
css += `
|
|
124
|
+
* {
|
|
125
|
+
border-color: hsl(var(--border));
|
|
126
|
+
}
|
|
127
|
+
body {
|
|
128
|
+
background-color: hsl(var(--background));
|
|
129
|
+
color: hsl(var(--foreground));
|
|
130
|
+
font-family: var(--font-sans);
|
|
131
|
+
}
|
|
132
|
+
`;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return css;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Generate CSS for a specific mode only
|
|
140
|
+
* @param {Object} theme - Theme object
|
|
141
|
+
* @param {string} mode - 'light' or 'dark'
|
|
142
|
+
* @returns {string} CSS content for that mode
|
|
143
|
+
*/
|
|
144
|
+
export function generateCSSForMode(theme, mode = 'light') {
|
|
145
|
+
const result = processTheme(theme, { mode });
|
|
146
|
+
const vars = result.variables[mode] || {};
|
|
147
|
+
|
|
148
|
+
return Object.entries(vars)
|
|
149
|
+
.map(([key, value]) => `--${key}: ${value};`)
|
|
150
|
+
.join('\n');
|
|
151
|
+
}
|