omgkit 2.30.0 → 2.32.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 +60 -9
- 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 +97 -4
- package/package.json +2 -2
- package/plugin/commands/design/export.md +232 -0
- package/plugin/commands/design/rebuild.md +46 -0
- package/plugin/commands/design/validate.md +223 -0
- package/plugin/registry.yaml +2 -2
- package/templates/design/schema/theme-v2.schema.json +384 -0
- package/templates/design/themes/corporate-enterprise/consulting.json +457 -1
- package/templates/design/themes/corporate-enterprise/corporate-indigo.json +457 -1
- package/templates/design/themes/corporate-enterprise/finance.json +457 -1
- package/templates/design/themes/corporate-enterprise/healthcare.json +457 -1
- package/templates/design/themes/corporate-enterprise/legal.json +457 -1
- package/templates/design/themes/corporate-enterprise/ocean-blue.json +457 -1
- package/templates/design/themes/creative-bold/candy.json +457 -1
- package/templates/design/themes/creative-bold/coral-sunset.json +457 -1
- package/templates/design/themes/creative-bold/gradient-dream.json +457 -1
- package/templates/design/themes/creative-bold/neon.json +457 -1
- package/templates/design/themes/creative-bold/retro.json +457 -1
- package/templates/design/themes/creative-bold/studio.json +457 -1
- package/templates/design/themes/minimal-clean/minimal-slate.json +457 -1
- package/templates/design/themes/minimal-clean/mono.json +457 -1
- package/templates/design/themes/minimal-clean/nordic.json +457 -1
- package/templates/design/themes/minimal-clean/paper.json +457 -1
- package/templates/design/themes/minimal-clean/swiss.json +457 -1
- package/templates/design/themes/minimal-clean/zen.json +457 -1
- package/templates/design/themes/nature-organic/arctic.json +457 -1
- package/templates/design/themes/nature-organic/autumn.json +457 -1
- package/templates/design/themes/nature-organic/desert.json +457 -1
- package/templates/design/themes/nature-organic/forest.json +457 -1
- package/templates/design/themes/nature-organic/lavender.json +457 -1
- package/templates/design/themes/nature-organic/ocean.json +457 -1
- package/templates/design/themes/tech-ai/electric-cyan.json +459 -29
- package/templates/design/themes/tech-ai/hologram.json +457 -1
- package/templates/design/themes/tech-ai/matrix-green.json +457 -1
- package/templates/design/themes/tech-ai/neo-tokyo.json +457 -1
- package/templates/design/themes/tech-ai/neural-dark.json +457 -1
- package/templates/design/themes/tech-ai/quantum-purple.json +457 -1
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** | 30 | Curated design system themes
|
|
44
|
+
| **Themes** | 30 | Curated design system themes (V2 schema with color scales) |
|
|
45
45
|
| **Archetypes** | 14 | Project templates for autonomous development |
|
|
46
46
|
|
|
47
47
|
---
|
|
@@ -166,9 +166,9 @@ testing:
|
|
|
166
166
|
target: 85
|
|
167
167
|
```
|
|
168
168
|
|
|
169
|
-
### 6. Design System
|
|
169
|
+
### 6. Design System
|
|
170
170
|
|
|
171
|
-
OMGKIT includes a complete design system with 30 curated themes for shadcn/ui integration
|
|
171
|
+
OMGKIT includes a complete design system with **30 curated V2 themes** for shadcn/ui integration. All themes use the V2 schema with 12-step color scales, effects, and animations.
|
|
172
172
|
|
|
173
173
|
```bash
|
|
174
174
|
# Initialize with a theme (opt-in)
|
|
@@ -178,6 +178,19 @@ omgkit init --theme neo-tokyo
|
|
|
178
178
|
omgkit init --with-design
|
|
179
179
|
```
|
|
180
180
|
|
|
181
|
+
#### V2 Theme Features
|
|
182
|
+
|
|
183
|
+
All 30 themes include:
|
|
184
|
+
|
|
185
|
+
| Feature | Description |
|
|
186
|
+
|---------|-------------|
|
|
187
|
+
| 12-step color scales | `--primary-1` through `--primary-12` |
|
|
188
|
+
| Alpha variants | `--primary-a1` through `--primary-a12` |
|
|
189
|
+
| Status colors | `--success`, `--warning`, `--info`, `--destructive` |
|
|
190
|
+
| Effects | glassMorphism, glow, gradients |
|
|
191
|
+
| Animations | shimmer, pulse-glow, fade-in, slide-up |
|
|
192
|
+
| Backward compatibility | Includes flat `colors` block for legacy support |
|
|
193
|
+
|
|
181
194
|
#### 5 Theme Categories
|
|
182
195
|
|
|
183
196
|
| Category | Themes | Description |
|
|
@@ -203,6 +216,25 @@ omgkit init --with-design
|
|
|
203
216
|
| `/design:rebuild <id>` | Rebuild entire project with new theme |
|
|
204
217
|
| `/design:scan` | Scan for non-compliant colors |
|
|
205
218
|
| `/design:rollback` | Rollback to previous theme |
|
|
219
|
+
| `/design:export <format>` | Export to CSS, SCSS, Tailwind, Figma, Style Dictionary |
|
|
220
|
+
| `/design:validate` | Validate theme structure |
|
|
221
|
+
|
|
222
|
+
#### Theme Export
|
|
223
|
+
|
|
224
|
+
Export your theme to various design tools and framework formats:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# Export CSS
|
|
228
|
+
/design:export css
|
|
229
|
+
|
|
230
|
+
# Export Figma tokens
|
|
231
|
+
/design:export figma --output ./tokens/
|
|
232
|
+
|
|
233
|
+
# Export all formats
|
|
234
|
+
/design:export --all
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Supported formats: `css`, `scss`, `tailwind`, `figma`, `style-dictionary`
|
|
206
238
|
|
|
207
239
|
#### Theme Rebuild
|
|
208
240
|
|
|
@@ -224,13 +256,32 @@ The rebuild feature:
|
|
|
224
256
|
- Scans `app/`, `components/`, `src/`, `pages/` directories
|
|
225
257
|
- Replaces hardcoded colors (`bg-blue-500`) with theme variables (`bg-primary`)
|
|
226
258
|
- Reports unfixable patterns for manual review
|
|
259
|
+
- Generates 12-step color scales and status colors
|
|
260
|
+
|
|
261
|
+
#### Generated CSS Variables
|
|
262
|
+
|
|
263
|
+
```css
|
|
264
|
+
/* 12-step color scales */
|
|
265
|
+
--rose-1 through --rose-12
|
|
266
|
+
--rose-a1 through --rose-a12 /* Alpha variants */
|
|
267
|
+
|
|
268
|
+
/* Status colors */
|
|
269
|
+
--success, --warning, --info
|
|
270
|
+
|
|
271
|
+
/* Effects */
|
|
272
|
+
--glass-blur, --glow
|
|
273
|
+
|
|
274
|
+
/* Animations */
|
|
275
|
+
@keyframes shimmer { ... }
|
|
276
|
+
--animation-shimmer
|
|
277
|
+
```
|
|
227
278
|
|
|
228
279
|
#### How It Works
|
|
229
280
|
|
|
230
281
|
OMGKIT provides CSS variables that shadcn/ui components consume:
|
|
231
282
|
|
|
232
283
|
```
|
|
233
|
-
.omgkit/design/theme.json → Theme configuration
|
|
284
|
+
.omgkit/design/theme.json → Theme configuration (V2)
|
|
234
285
|
.omgkit/design/theme.css → CSS variables (:root + .dark)
|
|
235
286
|
```
|
|
236
287
|
|
|
@@ -370,7 +421,7 @@ Agents are specialized AI team members, each with distinct expertise and respons
|
|
|
370
421
|
|
|
371
422
|
---
|
|
372
423
|
|
|
373
|
-
## Commands (
|
|
424
|
+
## Commands (174)
|
|
374
425
|
|
|
375
426
|
Commands are slash-prefixed actions organized by namespace.
|
|
376
427
|
|
|
@@ -635,7 +686,7 @@ Workflows are orchestrated sequences of agents, commands, and skills.
|
|
|
635
686
|
|
|
636
687
|
---
|
|
637
688
|
|
|
638
|
-
## Skills (
|
|
689
|
+
## Skills (162)
|
|
639
690
|
|
|
640
691
|
Skills are domain expertise modules organized in 24 categories.
|
|
641
692
|
|
|
@@ -987,7 +1038,7 @@ If any sync issue is detected (missing pages, wrong counts, broken links), the v
|
|
|
987
1038
|
|
|
988
1039
|
## Validation & Testing
|
|
989
1040
|
|
|
990
|
-
OMGKIT has
|
|
1041
|
+
OMGKIT has 8200+ automated tests ensuring system integrity.
|
|
991
1042
|
|
|
992
1043
|
### Run Tests
|
|
993
1044
|
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Figma Tokens Generator
|
|
3
|
+
* Generates Figma design tokens format
|
|
4
|
+
*
|
|
5
|
+
* @module lib/generators/figma
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { detectThemeVersion } from '../theme.js';
|
|
9
|
+
import { processTheme, hslToHex } from '../theme-v2.js';
|
|
10
|
+
|
|
11
|
+
// Import hex converter from theme.js
|
|
12
|
+
import { hslToHex as themeHslToHex } from '../theme.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Convert HSL string to hex
|
|
16
|
+
* @param {string} hsl - HSL string (e.g., '220 14.3% 95.9%')
|
|
17
|
+
* @returns {string} Hex color
|
|
18
|
+
*/
|
|
19
|
+
function convertHslToHex(hsl) {
|
|
20
|
+
if (!hsl || typeof hsl !== 'string') return '#000000';
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
// Handle HSL with alpha
|
|
24
|
+
if (hsl.includes('/')) {
|
|
25
|
+
const [hslPart] = hsl.split('/');
|
|
26
|
+
return themeHslToHex(hslPart.trim());
|
|
27
|
+
}
|
|
28
|
+
return themeHslToHex(hsl);
|
|
29
|
+
} catch {
|
|
30
|
+
return '#000000';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Generate Figma design tokens
|
|
36
|
+
* @param {Object} theme - Theme object (v1 or v2)
|
|
37
|
+
* @param {Object} options - Generation options
|
|
38
|
+
* @param {string} options.format - 'figma' or 'tokens-studio' (default: 'figma')
|
|
39
|
+
* @param {boolean} options.includeHex - Include hex values (default: true)
|
|
40
|
+
* @param {boolean} options.includeMeta - Include metadata (default: true)
|
|
41
|
+
* @returns {string} JSON string of Figma tokens
|
|
42
|
+
*/
|
|
43
|
+
export function generateFigmaTokens(theme, options = {}) {
|
|
44
|
+
const {
|
|
45
|
+
format = 'figma',
|
|
46
|
+
includeHex = true,
|
|
47
|
+
includeMeta = true
|
|
48
|
+
} = options;
|
|
49
|
+
|
|
50
|
+
const version = detectThemeVersion(theme);
|
|
51
|
+
const result = processTheme(theme);
|
|
52
|
+
const { light: lightVars, dark: darkVars } = result.variables;
|
|
53
|
+
|
|
54
|
+
const tokens = {
|
|
55
|
+
$themes: [],
|
|
56
|
+
$metadata: includeMeta ? {
|
|
57
|
+
tokenSetOrder: ['global', 'light', 'dark'],
|
|
58
|
+
generator: 'OMGKIT Design System',
|
|
59
|
+
themeId: theme.id,
|
|
60
|
+
themeName: theme.name,
|
|
61
|
+
version: version
|
|
62
|
+
} : undefined
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// Global tokens
|
|
66
|
+
tokens.global = {
|
|
67
|
+
typography: buildTypographyTokens(theme),
|
|
68
|
+
spacing: buildSpacingTokens(theme),
|
|
69
|
+
borderRadius: buildRadiusTokens(theme)
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Light mode tokens
|
|
73
|
+
tokens.light = {
|
|
74
|
+
colors: buildColorTokens(lightVars, includeHex)
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// Dark mode tokens
|
|
78
|
+
tokens.dark = {
|
|
79
|
+
colors: buildColorTokens(darkVars, includeHex)
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// Add effects if present
|
|
83
|
+
if (theme.effects) {
|
|
84
|
+
tokens.global.effects = buildEffectTokens(theme.effects);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Theme sets for Figma
|
|
88
|
+
tokens.$themes = [
|
|
89
|
+
{
|
|
90
|
+
id: `${theme.id}-light`,
|
|
91
|
+
name: `${theme.name} Light`,
|
|
92
|
+
selectedTokenSets: { global: 'enabled', light: 'enabled' }
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: `${theme.id}-dark`,
|
|
96
|
+
name: `${theme.name} Dark`,
|
|
97
|
+
selectedTokenSets: { global: 'enabled', dark: 'enabled' }
|
|
98
|
+
}
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
// Remove undefined values
|
|
102
|
+
if (!includeMeta) {
|
|
103
|
+
delete tokens.$metadata;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return JSON.stringify(tokens, null, 2);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Build color tokens from variables
|
|
111
|
+
* @param {Object} vars - Color variables
|
|
112
|
+
* @param {boolean} includeHex - Include hex conversion
|
|
113
|
+
* @returns {Object} Color tokens
|
|
114
|
+
*/
|
|
115
|
+
function buildColorTokens(vars, includeHex) {
|
|
116
|
+
const tokens = {};
|
|
117
|
+
|
|
118
|
+
for (const [name, value] of Object.entries(vars)) {
|
|
119
|
+
const token = {
|
|
120
|
+
value: value,
|
|
121
|
+
type: 'color'
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
if (includeHex) {
|
|
125
|
+
token.$extensions = {
|
|
126
|
+
'figma': {
|
|
127
|
+
hexValue: convertHslToHex(value)
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Organize by category
|
|
133
|
+
const category = getColorCategory(name);
|
|
134
|
+
if (!tokens[category]) {
|
|
135
|
+
tokens[category] = {};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Clean name for token path
|
|
139
|
+
const cleanName = name.replace(category + '-', '').replace('-', '.');
|
|
140
|
+
|
|
141
|
+
if (cleanName === category || cleanName === '') {
|
|
142
|
+
tokens[category].DEFAULT = token;
|
|
143
|
+
} else {
|
|
144
|
+
tokens[category][cleanName] = token;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return tokens;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Get color category from token name
|
|
153
|
+
* @param {string} name - Token name
|
|
154
|
+
* @returns {string} Category
|
|
155
|
+
*/
|
|
156
|
+
function getColorCategory(name) {
|
|
157
|
+
const categories = [
|
|
158
|
+
'background', 'foreground', 'primary', 'secondary',
|
|
159
|
+
'muted', 'accent', 'destructive', 'border', 'input',
|
|
160
|
+
'ring', 'card', 'popover', 'sidebar', 'chart',
|
|
161
|
+
'success', 'warning', 'info', 'surface', 'panel', 'overlay'
|
|
162
|
+
];
|
|
163
|
+
|
|
164
|
+
for (const cat of categories) {
|
|
165
|
+
if (name.startsWith(cat)) return cat;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Color scales (e.g., teal-1, teal-9)
|
|
169
|
+
const scaleMatch = name.match(/^([a-z]+)-\d+$/);
|
|
170
|
+
if (scaleMatch) {
|
|
171
|
+
return scaleMatch[1];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return 'other';
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Build typography tokens
|
|
179
|
+
* @param {Object} theme - Theme object
|
|
180
|
+
* @returns {Object} Typography tokens
|
|
181
|
+
*/
|
|
182
|
+
function buildTypographyTokens(theme) {
|
|
183
|
+
const fontSans = theme.typography?.fontFamily?.sans ||
|
|
184
|
+
theme.fontFamily?.sans ||
|
|
185
|
+
'Inter, system-ui, sans-serif';
|
|
186
|
+
const fontMono = theme.typography?.fontFamily?.mono ||
|
|
187
|
+
theme.fontFamily?.mono ||
|
|
188
|
+
'JetBrains Mono, monospace';
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
fontFamily: {
|
|
192
|
+
sans: {
|
|
193
|
+
value: fontSans,
|
|
194
|
+
type: 'fontFamilies'
|
|
195
|
+
},
|
|
196
|
+
mono: {
|
|
197
|
+
value: fontMono,
|
|
198
|
+
type: 'fontFamilies'
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
fontSize: {
|
|
202
|
+
xs: { value: '0.75rem', type: 'fontSizes' },
|
|
203
|
+
sm: { value: '0.875rem', type: 'fontSizes' },
|
|
204
|
+
base: { value: '1rem', type: 'fontSizes' },
|
|
205
|
+
lg: { value: '1.125rem', type: 'fontSizes' },
|
|
206
|
+
xl: { value: '1.25rem', type: 'fontSizes' },
|
|
207
|
+
'2xl': { value: '1.5rem', type: 'fontSizes' },
|
|
208
|
+
'3xl': { value: '1.875rem', type: 'fontSizes' },
|
|
209
|
+
'4xl': { value: '2.25rem', type: 'fontSizes' }
|
|
210
|
+
},
|
|
211
|
+
fontWeight: {
|
|
212
|
+
normal: { value: '400', type: 'fontWeights' },
|
|
213
|
+
medium: { value: '500', type: 'fontWeights' },
|
|
214
|
+
semibold: { value: '600', type: 'fontWeights' },
|
|
215
|
+
bold: { value: '700', type: 'fontWeights' }
|
|
216
|
+
},
|
|
217
|
+
lineHeight: {
|
|
218
|
+
none: { value: '1', type: 'lineHeights' },
|
|
219
|
+
tight: { value: '1.25', type: 'lineHeights' },
|
|
220
|
+
snug: { value: '1.375', type: 'lineHeights' },
|
|
221
|
+
normal: { value: '1.5', type: 'lineHeights' },
|
|
222
|
+
relaxed: { value: '1.625', type: 'lineHeights' },
|
|
223
|
+
loose: { value: '2', type: 'lineHeights' }
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Build spacing tokens
|
|
230
|
+
* @param {Object} theme - Theme object
|
|
231
|
+
* @returns {Object} Spacing tokens
|
|
232
|
+
*/
|
|
233
|
+
function buildSpacingTokens(theme) {
|
|
234
|
+
return {
|
|
235
|
+
'0': { value: '0', type: 'spacing' },
|
|
236
|
+
'1': { value: '0.25rem', type: 'spacing' },
|
|
237
|
+
'2': { value: '0.5rem', type: 'spacing' },
|
|
238
|
+
'3': { value: '0.75rem', type: 'spacing' },
|
|
239
|
+
'4': { value: '1rem', type: 'spacing' },
|
|
240
|
+
'5': { value: '1.25rem', type: 'spacing' },
|
|
241
|
+
'6': { value: '1.5rem', type: 'spacing' },
|
|
242
|
+
'8': { value: '2rem', type: 'spacing' },
|
|
243
|
+
'10': { value: '2.5rem', type: 'spacing' },
|
|
244
|
+
'12': { value: '3rem', type: 'spacing' },
|
|
245
|
+
'16': { value: '4rem', type: 'spacing' },
|
|
246
|
+
'20': { value: '5rem', type: 'spacing' },
|
|
247
|
+
'24': { value: '6rem', type: 'spacing' }
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Build border radius tokens
|
|
253
|
+
* @param {Object} theme - Theme object
|
|
254
|
+
* @returns {Object} Radius tokens
|
|
255
|
+
*/
|
|
256
|
+
function buildRadiusTokens(theme) {
|
|
257
|
+
const radius = theme.spacing?.radius || theme.radius || '0.5rem';
|
|
258
|
+
|
|
259
|
+
return {
|
|
260
|
+
none: { value: '0', type: 'borderRadius' },
|
|
261
|
+
sm: { value: `calc(${radius} - 4px)`, type: 'borderRadius' },
|
|
262
|
+
md: { value: `calc(${radius} - 2px)`, type: 'borderRadius' },
|
|
263
|
+
DEFAULT: { value: radius, type: 'borderRadius' },
|
|
264
|
+
lg: { value: radius, type: 'borderRadius' },
|
|
265
|
+
xl: { value: `calc(${radius} + 4px)`, type: 'borderRadius' },
|
|
266
|
+
'2xl': { value: `calc(${radius} + 8px)`, type: 'borderRadius' },
|
|
267
|
+
full: { value: '9999px', type: 'borderRadius' }
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Build effect tokens
|
|
273
|
+
* @param {Object} effects - Theme effects
|
|
274
|
+
* @returns {Object} Effect tokens
|
|
275
|
+
*/
|
|
276
|
+
function buildEffectTokens(effects) {
|
|
277
|
+
const tokens = {};
|
|
278
|
+
|
|
279
|
+
if (effects.glassMorphism) {
|
|
280
|
+
tokens.glass = {
|
|
281
|
+
blur: {
|
|
282
|
+
value: effects.glassMorphism.backdropBlur || '12px',
|
|
283
|
+
type: 'dimension'
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (effects.glow) {
|
|
289
|
+
tokens.glow = {
|
|
290
|
+
DEFAULT: {
|
|
291
|
+
value: effects.glow.default || '0 0 20px',
|
|
292
|
+
type: 'boxShadow'
|
|
293
|
+
},
|
|
294
|
+
lg: {
|
|
295
|
+
value: effects.glow.lg || '0 0 40px',
|
|
296
|
+
type: 'boxShadow'
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return tokens;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Generate Tokens Studio format (alternative Figma plugin)
|
|
306
|
+
* @param {Object} theme - Theme object
|
|
307
|
+
* @returns {string} JSON string
|
|
308
|
+
*/
|
|
309
|
+
export function generateTokensStudio(theme) {
|
|
310
|
+
return generateFigmaTokens(theme, { format: 'tokens-studio' });
|
|
311
|
+
}
|