@symbo.ls/mcp 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/.env.example +16 -0
- package/.env.railway +13 -0
- package/LICENSE +21 -0
- package/README.md +184 -0
- package/mcp.json +57 -0
- package/package.json +20 -0
- package/pyproject.toml +25 -0
- package/railway.toml +26 -0
- package/run.sh +17 -0
- package/symbols_mcp/__init__.py +1 -0
- package/symbols_mcp/server.py +1114 -0
- package/symbols_mcp/skills/ACCESSIBILITY.md +471 -0
- package/symbols_mcp/skills/ACCESSIBILITY_AUDITORY.md +70 -0
- package/symbols_mcp/skills/AGENT_INSTRUCTIONS.md +257 -0
- package/symbols_mcp/skills/BRAND_INDENTITY.md +69 -0
- package/symbols_mcp/skills/BUILT_IN_COMPONENTS.md +304 -0
- package/symbols_mcp/skills/CLAUDE.md +2158 -0
- package/symbols_mcp/skills/CLI_QUICK_START.md +205 -0
- package/symbols_mcp/skills/DESIGN_CRITIQUE.md +64 -0
- package/symbols_mcp/skills/DESIGN_DIRECTION.md +320 -0
- package/symbols_mcp/skills/DESIGN_SYSTEM_ARCHITECT.md +64 -0
- package/symbols_mcp/skills/DESIGN_SYSTEM_CONFIG.md +487 -0
- package/symbols_mcp/skills/DESIGN_SYSTEM_IN_PROPS.md +136 -0
- package/symbols_mcp/skills/DESIGN_TO_CODE.md +64 -0
- package/symbols_mcp/skills/DESIGN_TREND.md +50 -0
- package/symbols_mcp/skills/DOMQL_v2-v3_MIGRATION.md +236 -0
- package/symbols_mcp/skills/FIGMA_MATCHING.md +63 -0
- package/symbols_mcp/skills/GARY_TAN.md +80 -0
- package/symbols_mcp/skills/MARKETING_ASSETS.md +66 -0
- package/symbols_mcp/skills/MIGRATE_TO_SYMBOLS.md +614 -0
- package/symbols_mcp/skills/QUICKSTART.md +79 -0
- package/symbols_mcp/skills/SYMBOLS_LOCAL_INSTRUCTIONS.md +1405 -0
- package/symbols_mcp/skills/THE_PRESENTATION.md +69 -0
- package/symbols_mcp/skills/UI_UX_PATTERNS.md +68 -0
- package/windsurf-mcp-config.json +18 -0
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
# Design system config guide
|
|
2
|
+
|
|
3
|
+
This guide focuses only on configuring Scratch with a design system config. Use it to build clean, consistent tokens and avoid common mistakes.
|
|
4
|
+
|
|
5
|
+
## Default config baseline (mixed in)
|
|
6
|
+
|
|
7
|
+
Use these defaults as a starting point and then override with your project values.
|
|
8
|
+
|
|
9
|
+
### Colors and gradients (default-config)
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
color: {
|
|
13
|
+
blue: '#213eb0',
|
|
14
|
+
green: '#389d34',
|
|
15
|
+
red: '#e15c55',
|
|
16
|
+
yellow: '#EDCB38',
|
|
17
|
+
orange: '#e97c16',
|
|
18
|
+
transparent: 'rgba(0, 0, 0, 0)',
|
|
19
|
+
black: 'black',
|
|
20
|
+
gray: '#4e4e50',
|
|
21
|
+
white: 'white',
|
|
22
|
+
title: ['--gray 1 -168', '--gray 1 +168'],
|
|
23
|
+
caption: ['--gray 1 -68', '--gray 1 +68'],
|
|
24
|
+
paragraph: ['--gray 1 -42', '--gray 1 +42'],
|
|
25
|
+
disabled: ['--gray 1 -26', '--gray 1 +26'],
|
|
26
|
+
line: ['--gray 1 -16', '--gray 1 +16']
|
|
27
|
+
},
|
|
28
|
+
gradient: {
|
|
29
|
+
'gradient-blue-light': 'linear-gradient(to right, rgba(4, 116, 242, 1), rgba(0, 48, 103, 1))',
|
|
30
|
+
'gradient-blue-dark': 'linear-gradient(to right, #0474F2, #003067)',
|
|
31
|
+
'gradient-dark': 'linear-gradient(0deg, rgba(0,0,0,0.06) 0%, rgba(0,0,0,0.07) 100%)',
|
|
32
|
+
'gradient-dark-active': 'linear-gradient(0deg, rgba(0,0,0,0.09) 0%, rgba(0,0,0,0.1) 100%)',
|
|
33
|
+
'gradient-light': 'linear-gradient(0deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.06) 100%)',
|
|
34
|
+
'gradient-light-active': 'linear-gradient(0deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.10) 100%)',
|
|
35
|
+
'gradient-colorful': 'linear-gradient(60deg, #00A2E7 0%, #185DF3 31%, #1E54F0 36%, #8B4CCA 69%, #C66894 100%)'
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Themes (default-config)
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
theme: {
|
|
43
|
+
document: {
|
|
44
|
+
'@light': { color: 'black', background: 'white' },
|
|
45
|
+
'@dark': { color: 'white', background: 'black' }
|
|
46
|
+
},
|
|
47
|
+
primary: {
|
|
48
|
+
'@dark': { color: 'white', background: 'blue' },
|
|
49
|
+
'@light': { color: 'white', background: 'gradient-blue' }
|
|
50
|
+
},
|
|
51
|
+
secondary: {
|
|
52
|
+
'@dark': { color: 'white', background: 'green' },
|
|
53
|
+
'@light': { color: 'white', background: 'green' }
|
|
54
|
+
},
|
|
55
|
+
tertiary: {
|
|
56
|
+
'@dark': { color: 'white', background: 'gray .92 +8' },
|
|
57
|
+
'@light': { background: 'gray .1' }
|
|
58
|
+
},
|
|
59
|
+
none: { color: 'none', background: 'none' },
|
|
60
|
+
transparent: { color: 'currentColor', background: 'transparent' }
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Typography, spacing, timing (default-config)
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
typography: {
|
|
68
|
+
base: 16,
|
|
69
|
+
ratio: 1.25,
|
|
70
|
+
subSequence: true,
|
|
71
|
+
templates: {}
|
|
72
|
+
},
|
|
73
|
+
spacing: {
|
|
74
|
+
ratio: 1.618,
|
|
75
|
+
subSequence: true
|
|
76
|
+
},
|
|
77
|
+
timing: {
|
|
78
|
+
base: 150,
|
|
79
|
+
ratio: 1.333,
|
|
80
|
+
unit: 'ms',
|
|
81
|
+
subSequence: true
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Media and fonts (default-config)
|
|
86
|
+
|
|
87
|
+
```js
|
|
88
|
+
media: {
|
|
89
|
+
tv: '(min-width: 2780px)',
|
|
90
|
+
screenL: '(max-width: 1920px)',
|
|
91
|
+
'screenL<': '(min-width: 1920px)',
|
|
92
|
+
screenM: '(max-width: 1680px)',
|
|
93
|
+
'screenM<': '(min-width: 1680px)',
|
|
94
|
+
screenS: '(max-width: 1440px)',
|
|
95
|
+
'screenS<': '(min-width: 1440px)',
|
|
96
|
+
tabletL: '(max-width: 1366px)',
|
|
97
|
+
'tabletL<': '(min-width: 1366px)',
|
|
98
|
+
tabletM: '(max-width: 1280px)',
|
|
99
|
+
'tabletM<': '(min-width: 1280px)',
|
|
100
|
+
tabletS: '(max-width: 1024px)',
|
|
101
|
+
'tabletS<': '(min-width: 1024px)',
|
|
102
|
+
mobileL: '(max-width: 768px)',
|
|
103
|
+
'mobileL<': '(min-width: 768px)',
|
|
104
|
+
mobileM: '(max-width: 560px)',
|
|
105
|
+
'mobileM<': '(min-width: 560px)',
|
|
106
|
+
mobileS: '(max-width: 480px)',
|
|
107
|
+
'mobileS<': '(min-width: 480px)',
|
|
108
|
+
mobileXS: '(max-width: 375px)',
|
|
109
|
+
'mobileXS<': '(min-width: 375px)',
|
|
110
|
+
light: '(prefers-color-scheme: light)',
|
|
111
|
+
dark: '(prefers-color-scheme: dark)',
|
|
112
|
+
print: 'print'
|
|
113
|
+
},
|
|
114
|
+
font: {
|
|
115
|
+
SourceSans: [{ url: '' }]
|
|
116
|
+
},
|
|
117
|
+
font_family: {
|
|
118
|
+
system: { value: ['"Helvetica Neue"', 'Helvetica', 'Arial'], type: 'sans-serif' }
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Default icons set (icons/default)
|
|
123
|
+
|
|
124
|
+
```js
|
|
125
|
+
icons: {
|
|
126
|
+
symbols: '<svg height="24" width="24">...</svg>',
|
|
127
|
+
logo: '<svg height="24" width="24">...</svg>',
|
|
128
|
+
arrowDownCircle: '<svg width="24" height="24" ...>...</svg>',
|
|
129
|
+
arrowDownLeft: '<svg width="24" height="24" ...>...</svg>',
|
|
130
|
+
arrowDownRight: '<svg width="24" height="24" ...>...</svg>',
|
|
131
|
+
arrowDown: '<svg width="24" height="24" ...>...</svg>',
|
|
132
|
+
arrowLeftCircle: '<svg width="24" height="24" ...>...</svg>',
|
|
133
|
+
arrowLeft: '<svg width="24" height="24" ...>...</svg>',
|
|
134
|
+
arrowRight: '<svg width="24" height="24" ...>...</svg>',
|
|
135
|
+
arrowRightCircle: '<svg width="24" height="24" ...>...</svg>',
|
|
136
|
+
arrowUpCircle: '<svg width="24" height="24" ...>...</svg>',
|
|
137
|
+
arrowUpLeft: '<svg width="24" height="24" ...>...</svg>',
|
|
138
|
+
arrowUpRight: '<svg width="24" height="24" ...>...</svg>',
|
|
139
|
+
arrowUp: '<svg width="24" height="24" ...>...</svg>',
|
|
140
|
+
checkCircle: '<svg width="24" height="24" ...>...</svg>',
|
|
141
|
+
check: '<svg width="24" height="24" ...>...</svg>',
|
|
142
|
+
chevronDown: '<svg width="24" height="24" ...>...</svg>',
|
|
143
|
+
chevronLeft: '<svg width="24" height="24" ...>...</svg>',
|
|
144
|
+
chevronRight: '<svg width="24" height="24" ...>...</svg>',
|
|
145
|
+
chevronUp: '<svg width="24" height="24" ...>...</svg>',
|
|
146
|
+
copy: '<svg width="24" height="24" ...>...</svg>',
|
|
147
|
+
eyeOff: '<svg width="24" height="24" ...>...</svg>',
|
|
148
|
+
eye: '<svg width="24" height="24" ...>...</svg>',
|
|
149
|
+
info: '<svg width="24" height="24" ...>...</svg>',
|
|
150
|
+
lock: '<svg width="24" height="24" ...>...</svg>',
|
|
151
|
+
minus: '<svg width="24" height="24" ...>...</svg>',
|
|
152
|
+
sun: '<svg width="24" height="24" ...>...</svg>',
|
|
153
|
+
moon: '<svg width="24" height="24" ...>...</svg>',
|
|
154
|
+
moreHorizontal: '<svg width="24" height="24" ...>...</svg>',
|
|
155
|
+
moreVertical: '<svg width="24" height="24" ...>...</svg>',
|
|
156
|
+
send: '<svg width="24" height="24" ...>...</svg>',
|
|
157
|
+
smile: '<svg width="24" height="24" ...>...</svg>',
|
|
158
|
+
search: '<svg width="24" height="24" ...>...</svg>',
|
|
159
|
+
upload: '<svg width="24" height="24" ...>...</svg>',
|
|
160
|
+
video: '<svg width="24" height="24" ...>...</svg>',
|
|
161
|
+
x: '<svg width="24" height="24" ...>...</svg>',
|
|
162
|
+
star: '<svg width="24" height="24" ...>...</svg>',
|
|
163
|
+
plus: '<svg width="24" height="24" ...>...</svg>'
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## How config is applied
|
|
168
|
+
|
|
169
|
+
Define a single config object with top-level keys. Scratch merges it into defaults, generates sequences, applies the document theme, and builds reset styles.
|
|
170
|
+
|
|
171
|
+
```js
|
|
172
|
+
const designSystemConfig = {
|
|
173
|
+
color: {
|
|
174
|
+
primary: "#1f6feb",
|
|
175
|
+
text: ["#0b0b0b", "#f5f5f5"],
|
|
176
|
+
},
|
|
177
|
+
theme: {
|
|
178
|
+
document: { color: "text", background: "primary 0.02" },
|
|
179
|
+
button: { color: "text", background: "primary" },
|
|
180
|
+
},
|
|
181
|
+
typography: { base: 16, ratio: 1.25 },
|
|
182
|
+
spacing: { base: 16, ratio: 1.618 },
|
|
183
|
+
timing: { base: 150, ratio: 1.4 },
|
|
184
|
+
font: {
|
|
185
|
+
inter: {
|
|
186
|
+
400: { url: "https://example.com/Inter-Regular.woff2", fontWeight: 400 },
|
|
187
|
+
700: { url: "https://example.com/Inter-Bold.woff2", fontWeight: 700 },
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
font_family: {
|
|
191
|
+
primary: { value: ["Inter"], type: "sans", isDefault: true },
|
|
192
|
+
},
|
|
193
|
+
icons: { search: "<svg>...</svg>" },
|
|
194
|
+
svg: { logo: "<svg>...</svg>" },
|
|
195
|
+
shadow: { soft: "black 0.15, 0px 10px 30px 0px" },
|
|
196
|
+
media: {
|
|
197
|
+
mobile: "(max-width: 768px)",
|
|
198
|
+
desktop: "(min-width: 1024px)",
|
|
199
|
+
},
|
|
200
|
+
grid: { columns: 12, gutter: "A" },
|
|
201
|
+
reset: {},
|
|
202
|
+
unit: { default: "em" },
|
|
203
|
+
animation: {},
|
|
204
|
+
};
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Config keys
|
|
208
|
+
|
|
209
|
+
Use these top-level keys only (case-insensitive):
|
|
210
|
+
|
|
211
|
+
- `color`
|
|
212
|
+
- `gradient`
|
|
213
|
+
- `theme`
|
|
214
|
+
- `typography`
|
|
215
|
+
- `spacing`
|
|
216
|
+
- `timing`
|
|
217
|
+
- `font`
|
|
218
|
+
- `font_family`
|
|
219
|
+
- `icons`
|
|
220
|
+
- `semantic_icons`
|
|
221
|
+
- `svg`
|
|
222
|
+
- `svg_data`
|
|
223
|
+
- `shadow`
|
|
224
|
+
- `media`
|
|
225
|
+
- `grid`
|
|
226
|
+
- `class`
|
|
227
|
+
- `reset`
|
|
228
|
+
- `unit`
|
|
229
|
+
- `animation`
|
|
230
|
+
- `cases`
|
|
231
|
+
|
|
232
|
+
Do not wrap these under `props` or nested objects. Scratch reads the keys directly at the root of the config object.
|
|
233
|
+
|
|
234
|
+
## Colors
|
|
235
|
+
|
|
236
|
+
Define colors as strings, arrays, or objects:
|
|
237
|
+
|
|
238
|
+
```js
|
|
239
|
+
color: {
|
|
240
|
+
primary: '#1f6feb',
|
|
241
|
+
text: ['#0b0b0b', '#f5f5f5'],
|
|
242
|
+
accent: {
|
|
243
|
+
'@light': '#ff7a18',
|
|
244
|
+
'@dark': '#ffb347'
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Usage examples:
|
|
250
|
+
|
|
251
|
+
- `primary` -> `var(--color-primary)` (when `useVariable` is true)
|
|
252
|
+
- `primary 0.5` -> rgba with alpha
|
|
253
|
+
- `primary +5` -> shifted tone
|
|
254
|
+
|
|
255
|
+
## Themes
|
|
256
|
+
|
|
257
|
+
Themes are objects with optional media variants and states.
|
|
258
|
+
|
|
259
|
+
```js
|
|
260
|
+
theme: {
|
|
261
|
+
document: {
|
|
262
|
+
color: 'text',
|
|
263
|
+
background: 'primary 0.02'
|
|
264
|
+
},
|
|
265
|
+
button: {
|
|
266
|
+
color: 'text',
|
|
267
|
+
background: 'primary',
|
|
268
|
+
':hover': { background: 'primary 0.85' },
|
|
269
|
+
':active': { background: 'primary 0.75' },
|
|
270
|
+
'@dark': { background: 'primary 0.6' }
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Rules:
|
|
276
|
+
|
|
277
|
+
- Use `@light` / `@dark` for media variants.
|
|
278
|
+
- Use `:hover`, `:active`, `:focus` for state variants.
|
|
279
|
+
- Use `.` prefixed keys for helper themes and reuse.
|
|
280
|
+
|
|
281
|
+
## Typography
|
|
282
|
+
|
|
283
|
+
Typography defines the type scale and heading styles.
|
|
284
|
+
|
|
285
|
+
```js
|
|
286
|
+
typography: {
|
|
287
|
+
base: 16,
|
|
288
|
+
ratio: 1.25,
|
|
289
|
+
range: [-3, 12],
|
|
290
|
+
h1Matches: 6,
|
|
291
|
+
lineHeight: 1.5,
|
|
292
|
+
subSequence: true,
|
|
293
|
+
unit: 'em'
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Tokens like `A`, `B`, `C` map to the generated sequence. `subSequence: true` enables two-step tokens like `B2`.
|
|
298
|
+
|
|
299
|
+
## Spacing
|
|
300
|
+
|
|
301
|
+
Spacing controls layout tokens used for padding, margin, gap, size, etc.
|
|
302
|
+
|
|
303
|
+
```js
|
|
304
|
+
spacing: {
|
|
305
|
+
base: 16,
|
|
306
|
+
ratio: 1.618,
|
|
307
|
+
range: [-5, 15],
|
|
308
|
+
subSequence: true,
|
|
309
|
+
unit: 'em'
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Tokens:
|
|
314
|
+
|
|
315
|
+
- `A`, `B`, `C` are base tokens
|
|
316
|
+
- `B2`, `C1` are sub-sequence tokens
|
|
317
|
+
- `A+Z`, `B*C` math is allowed in values
|
|
318
|
+
|
|
319
|
+
## Timing
|
|
320
|
+
|
|
321
|
+
Timing generates durations for transitions and animations.
|
|
322
|
+
|
|
323
|
+
```js
|
|
324
|
+
timing: {
|
|
325
|
+
base: 150,
|
|
326
|
+
ratio: 1.4,
|
|
327
|
+
range: [-3, 12],
|
|
328
|
+
unit: 'ms'
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Fonts and font families
|
|
333
|
+
|
|
334
|
+
### Traditional fonts (per-weight files)
|
|
335
|
+
|
|
336
|
+
```js
|
|
337
|
+
font: {
|
|
338
|
+
inter: {
|
|
339
|
+
400: { url: 'https://example.com/Inter-Regular.woff2', fontWeight: 400 },
|
|
340
|
+
700: { url: 'https://example.com/Inter-Bold.woff2', fontWeight: 700 }
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Each weight entry generates a separate `@font-face` rule.
|
|
346
|
+
|
|
347
|
+
### Variable fonts (`isVariable`)
|
|
348
|
+
|
|
349
|
+
Variable fonts use a single file that covers a range of weights.
|
|
350
|
+
|
|
351
|
+
**Google Fonts CSS URL** — generates `@import url(...)` instead of `@font-face`:
|
|
352
|
+
|
|
353
|
+
```js
|
|
354
|
+
font: {
|
|
355
|
+
Inter: {
|
|
356
|
+
url: 'https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap',
|
|
357
|
+
isVariable: true,
|
|
358
|
+
fontWeight: '100 900'
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
**Self-hosted `.woff2` file** — generates `@font-face` with weight range:
|
|
364
|
+
|
|
365
|
+
```js
|
|
366
|
+
font: {
|
|
367
|
+
Inter: {
|
|
368
|
+
url: '/fonts/Inter-Variable.woff2',
|
|
369
|
+
isVariable: true,
|
|
370
|
+
fontWeight: '100 900'
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
**All variable font options:**
|
|
376
|
+
|
|
377
|
+
| Property | Description | Example |
|
|
378
|
+
| ------------- | ------------------------------------------------------------- | ---------------------- |
|
|
379
|
+
| `url` | Font file URL or Google Fonts CSS URL | `'/fonts/Inter.woff2'` |
|
|
380
|
+
| `isVariable` | Enables variable font handling | `true` |
|
|
381
|
+
| `fontWeight` | Weight range string | `'100 900'` |
|
|
382
|
+
| `fontStretch` | Stretch range (for variable width fonts) | `'75% 125%'` |
|
|
383
|
+
| `fontDisplay` | CSS font-display value (defaults to `'swap'` for self-hosted) | `'swap'` |
|
|
384
|
+
|
|
385
|
+
**Example with all options:**
|
|
386
|
+
|
|
387
|
+
```js
|
|
388
|
+
font: {
|
|
389
|
+
'Roboto Flex': {
|
|
390
|
+
url: '/fonts/RobotoFlex-Variable.woff2',
|
|
391
|
+
isVariable: true,
|
|
392
|
+
fontWeight: '100 1000',
|
|
393
|
+
fontStretch: '25% 151%',
|
|
394
|
+
fontDisplay: 'swap'
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### Font families
|
|
400
|
+
|
|
401
|
+
```js
|
|
402
|
+
font_family: {
|
|
403
|
+
primary: { value: ['Inter'], type: 'sans', isDefault: true },
|
|
404
|
+
mono: { value: ['IBM Plex Mono'], type: 'monospace' }
|
|
405
|
+
}
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
- Use `font` for `@font-face` generation (or `@import` for Google Fonts variable fonts).
|
|
409
|
+
- Use `font_family` for named stacks used by the document theme.
|
|
410
|
+
|
|
411
|
+
## Icons and SVG
|
|
412
|
+
|
|
413
|
+
```js
|
|
414
|
+
icons: {
|
|
415
|
+
search: '<svg>...</svg>'
|
|
416
|
+
},
|
|
417
|
+
semantic_icons: {
|
|
418
|
+
logo: true
|
|
419
|
+
},
|
|
420
|
+
svg: {
|
|
421
|
+
logo: '<svg>...</svg>'
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
- `icons` are typically converted into a sprite unless listed in `semantic_icons`.
|
|
426
|
+
- `svg` is for general SVG assets.
|
|
427
|
+
|
|
428
|
+
## Shadows
|
|
429
|
+
|
|
430
|
+
```js
|
|
431
|
+
shadow: {
|
|
432
|
+
soft: 'black 0.15, 0px 10px 30px 0px',
|
|
433
|
+
hard: ['black 0.25, 0px 8px 16px 0px', 'black 0.35, 0px 10px 24px 0px']
|
|
434
|
+
}
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
Arrays map to `@light`/`@dark` variants.
|
|
438
|
+
|
|
439
|
+
## Media, grid, unit, reset
|
|
440
|
+
|
|
441
|
+
```js
|
|
442
|
+
media: {
|
|
443
|
+
mobile: '(max-width: 768px)',
|
|
444
|
+
tablet: '(max-width: 1024px)'
|
|
445
|
+
},
|
|
446
|
+
grid: { columns: 12, gutter: 'A' },
|
|
447
|
+
unit: { default: 'em' },
|
|
448
|
+
reset: {}
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
## Configuration options
|
|
452
|
+
|
|
453
|
+
These are toggles you can pass at the top level of the same object as your config:
|
|
454
|
+
|
|
455
|
+
- `verbose`
|
|
456
|
+
- `useVariable`
|
|
457
|
+
- `useReset`
|
|
458
|
+
- `useSvgSprite`
|
|
459
|
+
- `useFontImport`
|
|
460
|
+
- `useIconSprite`
|
|
461
|
+
- `useDocumentTheme`
|
|
462
|
+
- `globalTheme`
|
|
463
|
+
- `useDefaultConfig`
|
|
464
|
+
|
|
465
|
+
Example:
|
|
466
|
+
|
|
467
|
+
```js
|
|
468
|
+
const designSystemConfig = {
|
|
469
|
+
useVariable: true,
|
|
470
|
+
useReset: true,
|
|
471
|
+
globalTheme: "dark",
|
|
472
|
+
color: { primary: "#1f6feb" },
|
|
473
|
+
};
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
## Common mistakes
|
|
477
|
+
|
|
478
|
+
- Do not nest config under `props` or other wrappers.
|
|
479
|
+
- Use `font_family` instead of `fontFamily`.
|
|
480
|
+
- Define `typography` and `spacing` if you plan to use tokens like `A`, `B2`, or `C+Z`.
|
|
481
|
+
- When `useVariable` is on, consumers should expect `var(--...)` output.
|
|
482
|
+
|
|
483
|
+
---
|
|
484
|
+
|
|
485
|
+
## Symbols Feedback Conventions
|
|
486
|
+
|
|
487
|
+
Supplemental conventions are merged into [CLAUDE.md](CLAUDE.md).
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Using the design system in props
|
|
2
|
+
|
|
3
|
+
This document explains how design system tokens are used directly in DOMQL v3 props.
|
|
4
|
+
|
|
5
|
+
## Core idea
|
|
6
|
+
|
|
7
|
+
Props are flattened and accept design tokens as strings. Scratch resolves tokens into CSS values via sequences, themes, and colors.
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
Card: {
|
|
11
|
+
padding: 'B C',
|
|
12
|
+
background: 'primary 0.08',
|
|
13
|
+
borderRadius: 'B',
|
|
14
|
+
shadow: 'soft',
|
|
15
|
+
fontSize: 'B',
|
|
16
|
+
color: 'title'
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Spacing tokens
|
|
21
|
+
|
|
22
|
+
Use spacing tokens for size, spacing, and position:
|
|
23
|
+
|
|
24
|
+
- `padding`, `margin`, `gap`, `width`, `height`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `borderRadius`
|
|
25
|
+
|
|
26
|
+
Examples:
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
Box: { padding: 'A B', margin: 'Z Z2', borderRadius: 'B' }
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Math is supported:
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
Box: { padding: 'A+Z', margin: '-B', width: 'C+Z2' }
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Typography tokens
|
|
39
|
+
|
|
40
|
+
Typography tokens map to the typography sequence:
|
|
41
|
+
|
|
42
|
+
- `fontSize: 'A' | 'B' | 'C'`
|
|
43
|
+
- `lineHeight`, `letterSpacing` can be literal values
|
|
44
|
+
|
|
45
|
+
Example:
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
Text: { fontSize: 'C', fontWeight: '600' }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Color tokens
|
|
52
|
+
|
|
53
|
+
Color tokens resolve to CSS variables or RGB values depending on configuration.
|
|
54
|
+
|
|
55
|
+
Examples:
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
Text: {
|
|
59
|
+
color: "primary";
|
|
60
|
+
}
|
|
61
|
+
Box: {
|
|
62
|
+
background: "primary 0.2";
|
|
63
|
+
}
|
|
64
|
+
Box: {
|
|
65
|
+
background: "primary +6";
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Theme tokens
|
|
70
|
+
|
|
71
|
+
Use `theme` to apply a theme object from the design system.
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
Button: {
|
|
75
|
+
theme: "primary";
|
|
76
|
+
}
|
|
77
|
+
Button: {
|
|
78
|
+
theme: "primary .active";
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Theme modifiers can be helper states or pseudo selectors defined inside the theme.
|
|
83
|
+
|
|
84
|
+
## Shadows
|
|
85
|
+
|
|
86
|
+
Use `shadow` with named values from the design system:
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
Box: {
|
|
90
|
+
shadow: "soft";
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Timing tokens
|
|
95
|
+
|
|
96
|
+
Use timing tokens in transitions and animations:
|
|
97
|
+
|
|
98
|
+
```js
|
|
99
|
+
Box: {
|
|
100
|
+
transition: "opacity, defaultBezier, B";
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Media queries and cases
|
|
105
|
+
|
|
106
|
+
Use `@media` keys and case flags in props:
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
Box: {
|
|
110
|
+
padding: 'C',
|
|
111
|
+
'@mobile': { padding: 'A' },
|
|
112
|
+
isActive: true,
|
|
113
|
+
'.isActive': { background: 'primary' }
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Icon tokens
|
|
118
|
+
|
|
119
|
+
Icons are referenced by key in the icon sprite:
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
Icon: { name: 'chevronRight' }
|
|
123
|
+
Button: { icon: 'search', text: 'Search' }
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Common rules
|
|
127
|
+
|
|
128
|
+
- Always keep props flat (no `props` wrapper).
|
|
129
|
+
- Use `onX` for events, not `on` objects.
|
|
130
|
+
- Use token strings for sizing and colors instead of hardcoded values whenever possible.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Symbols Feedback Conventions
|
|
135
|
+
|
|
136
|
+
Supplemental conventions are merged into [CLAUDE.md](CLAUDE.md).
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
The Design-to-Code Translator
|
|
2
|
+
|
|
3
|
+
You are a Design Engineer at Vercel, bridging design and development.
|
|
4
|
+
|
|
5
|
+
Convert this design into production-ready frontend code:
|
|
6
|
+
|
|
7
|
+
[DESIGN DESCRIPTION, WIREFRAME, OR COMPONENT SPECS]
|
|
8
|
+
|
|
9
|
+
Tech stack: [REACT/VUE/SV ELTE/NEXT.JS/TAILWIND/ETC.]
|
|
10
|
+
|
|
11
|
+
Deliverables:
|
|
12
|
+
|
|
13
|
+
1. COMPONENT ARCHITECTURE
|
|
14
|
+
• Component hierarchy tree
|
|
15
|
+
• Props interface definition (TypeScript)
|
|
16
|
+
• State management strategy
|
|
17
|
+
• Data flow diagram
|
|
18
|
+
|
|
19
|
+
2. PRODUCTION CODE
|
|
20
|
+
• Complete, copy-paste ready component code
|
|
21
|
+
• Responsive implementation (mobile-first)
|
|
22
|
+
• Accessibility attributes (ARIA labels, roles, states)
|
|
23
|
+
• Error boundaries and loading states
|
|
24
|
+
• Animation/transition implementation
|
|
25
|
+
|
|
26
|
+
3. STYLING SPECIFICATIONS
|
|
27
|
+
• CSS/Tailwind classes with design token mapping
|
|
28
|
+
• CSS variables for theming
|
|
29
|
+
• Dark mode implementation
|
|
30
|
+
• Responsive breakpoints
|
|
31
|
+
• Hover/focus/active states
|
|
32
|
+
|
|
33
|
+
4. DESIGN TOKEN INTEGRATION
|
|
34
|
+
• Color tokens mapped to CSS variables
|
|
35
|
+
• Typography tokens (font sizes, weights, line heights)
|
|
36
|
+
• Spacing tokens (padding, margin, gap)
|
|
37
|
+
• Shadow/elevation tokens
|
|
38
|
+
• Border radius tokens
|
|
39
|
+
|
|
40
|
+
5. ASSET OPTIMIZATION
|
|
41
|
+
• Image component with lazy loading
|
|
42
|
+
• SVG optimization strategy
|
|
43
|
+
• Icon system (SVG sprite or icon library)
|
|
44
|
+
• Font loading strategy
|
|
45
|
+
|
|
46
|
+
6. PERFORMANCE CONSIDERATIONS
|
|
47
|
+
• Code splitting recommendations
|
|
48
|
+
• Bundle size optimization
|
|
49
|
+
• Rendering optimization (React.memo, useMemo, etc.)
|
|
50
|
+
• Image optimization (next/image or equivalent)
|
|
51
|
+
|
|
52
|
+
7. TESTING STRATEGY
|
|
53
|
+
• Unit test cases (React Testing Library)
|
|
54
|
+
• Visual regression test scenarios
|
|
55
|
+
• Accessibility tests (axe-core)
|
|
56
|
+
• Responsive test cases
|
|
57
|
+
|
|
58
|
+
8. DOCUMENTATION
|
|
59
|
+
• JSDoc comments for all props
|
|
60
|
+
• Usage examples (3 variations)
|
|
61
|
+
• Do's and don'ts
|
|
62
|
+
• Changelog template
|
|
63
|
+
|
|
64
|
+
Include "Designer's Intent" comments explaining why certain code decisions preserve the design vision.
|