@deriv-com/quill-ui-v2 0.0.1 → 0.0.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.
- package/README.md +314 -57
- package/dist/index.d.ts +344 -15
- package/dist/quill-ui-v2.cjs +2 -2
- package/dist/quill-ui-v2.cjs.map +1 -1
- package/dist/quill-ui-v2.mjs +403 -78
- package/dist/quill-ui-v2.mjs.map +1 -1
- package/dist/tokens/component_icon.css +39 -0
- package/dist/tokens/fonts.css +10 -0
- package/dist/tokens/index.css +17 -0
- package/dist/tokens/primitives.css +584 -0
- package/dist/tokens/semantic_colour.css +524 -0
- package/dist/tokens/semantic_effect.css +10 -0
- package/dist/tokens/semantic_icon.css +30 -0
- package/dist/tokens/semantic_size.css +54 -0
- package/dist/tokens/semantic_typography.css +42 -0
- package/dist/tokens/tokens.d.ts +2090 -0
- package/dist/tokens/tokens.js +1047 -0
- package/package.json +23 -5
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ A powerful automation tool that bridges the gap between design and development b
|
|
|
18
18
|
- [Prerequisites](#-prerequisites)
|
|
19
19
|
- [Installation](#-installation)
|
|
20
20
|
- [Usage](#-usage)
|
|
21
|
+
- [Component Development](#-component-development)
|
|
21
22
|
- [For Designers](#-for-designers)
|
|
22
23
|
- [For Developers](#-for-developers)
|
|
23
24
|
- [Common Tasks](#-common-tasks)
|
|
@@ -29,6 +30,36 @@ A powerful automation tool that bridges the gap between design and development b
|
|
|
29
30
|
|
|
30
31
|
## 🚀 Quick Start
|
|
31
32
|
|
|
33
|
+
### For Component Usage
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Install the package
|
|
37
|
+
npm install @deriv-com/quill-ui-v2
|
|
38
|
+
|
|
39
|
+
# Use components in your app
|
|
40
|
+
import { Button } from '@deriv-com/quill-ui-v2';
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### For Token Usage (Custom Styling)
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Install the package
|
|
47
|
+
npm install @deriv-com/quill-ui-v2
|
|
48
|
+
|
|
49
|
+
# Import tokens in your app
|
|
50
|
+
import '@deriv-com/quill-ui-v2/tokens.css';
|
|
51
|
+
|
|
52
|
+
# Use tokens in your CSS
|
|
53
|
+
.custom-element {
|
|
54
|
+
padding: var(--quill-semantic-size-spacing-16);
|
|
55
|
+
background: var(--quill-semantic-colour-background-canvas);
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**📖 See the [Token Usage Guide](docs/token-usage-guide.md) for complete documentation.**
|
|
60
|
+
|
|
61
|
+
### For Development
|
|
62
|
+
|
|
32
63
|
Get up and running in 5 minutes:
|
|
33
64
|
|
|
34
65
|
```bash
|
|
@@ -42,9 +73,8 @@ cp .env.example .env
|
|
|
42
73
|
# 3. Sync tokens from Figma
|
|
43
74
|
npm run tokens
|
|
44
75
|
|
|
45
|
-
# 4.
|
|
46
|
-
|
|
47
|
-
# Use: <p style="color: var(--quill-core-color-blue-500)">Styled text</p>
|
|
76
|
+
# 4. Build the package
|
|
77
|
+
npm run build
|
|
48
78
|
```
|
|
49
79
|
|
|
50
80
|
**New to the project?** Follow the [detailed installation guide](#-installation) below.
|
|
@@ -54,9 +84,11 @@ npm run tokens
|
|
|
54
84
|
## ✨ Features
|
|
55
85
|
|
|
56
86
|
### Core Capabilities
|
|
87
|
+
|
|
57
88
|
- ✅ **Automatic Sync** - One command updates all tokens from Figma
|
|
58
89
|
- ✅ **Multi-Collection Support** - Handle multiple token collections (primitives, semantic, etc.)
|
|
59
90
|
- ✅ **Multi-File Output** - Organized CSS files by collection
|
|
91
|
+
- ✅ **NPM Package Export** - Tokens available as separate CSS files for custom styling
|
|
60
92
|
- ✅ **TypeScript Support** - Type-safe tokens with autocomplete
|
|
61
93
|
- ✅ **Token Validation** - Automatic error detection and warnings
|
|
62
94
|
- ✅ **Version Tracking** - Semantic versioning for changes
|
|
@@ -68,15 +100,15 @@ npm run tokens
|
|
|
68
100
|
|
|
69
101
|
### Generated Outputs
|
|
70
102
|
|
|
71
|
-
| File
|
|
72
|
-
|
|
73
|
-
| [`index.css`](src/tokens/index.css)
|
|
74
|
-
| [`primitives.css`](src/tokens/primitives.css)
|
|
75
|
-
| [`semantic.css`](src/tokens/semantic.css)
|
|
76
|
-
| [`figma-styles.css`](src/tokens/figma-styles.css) | Figma style tokens
|
|
77
|
-
| [`tokens.d.ts`](src/tokens/tokens.d.ts)
|
|
78
|
-
| [`tokens.js`](src/tokens/tokens.js)
|
|
79
|
-
| `version.json`
|
|
103
|
+
| File | Purpose | Auto-Generated |
|
|
104
|
+
| ------------------------------------------------- | ---------------------------------- | -------------- |
|
|
105
|
+
| [`index.css`](src/tokens/index.css) | Main import file for all tokens | ✅ |
|
|
106
|
+
| [`primitives.css`](src/tokens/primitives.css) | Base design tokens (colors, sizes) | ✅ |
|
|
107
|
+
| [`semantic.css`](src/tokens/semantic.css) | Semantic tokens (spacing, radius) | ✅ |
|
|
108
|
+
| [`figma-styles.css`](src/tokens/figma-styles.css) | Figma style tokens | ✅ |
|
|
109
|
+
| [`tokens.d.ts`](src/tokens/tokens.d.ts) | TypeScript definitions | ✅ |
|
|
110
|
+
| [`tokens.js`](src/tokens/tokens.js) | JavaScript module | ✅ |
|
|
111
|
+
| `version.json` | Version metadata | ✅ |
|
|
80
112
|
|
|
81
113
|
---
|
|
82
114
|
|
|
@@ -85,6 +117,7 @@ npm run tokens
|
|
|
85
117
|
Before you begin, ensure you have:
|
|
86
118
|
|
|
87
119
|
### Required
|
|
120
|
+
|
|
88
121
|
- **Node.js** >= 18.0.0 ([Download](https://nodejs.org/))
|
|
89
122
|
- **npm** >= 9.0.0 (comes with Node.js)
|
|
90
123
|
- **Figma account** with access to your design file
|
|
@@ -93,7 +126,7 @@ Before you begin, ensure you have:
|
|
|
93
126
|
### System Requirements
|
|
94
127
|
|
|
95
128
|
| Platform | Supported | Tested |
|
|
96
|
-
|
|
129
|
+
| -------- | --------- | ------ |
|
|
97
130
|
| macOS | ✅ Yes | ✅ |
|
|
98
131
|
| Windows | ✅ Yes | ✅ |
|
|
99
132
|
| Linux | ✅ Yes | ✅ |
|
|
@@ -109,6 +142,7 @@ npm install
|
|
|
109
142
|
```
|
|
110
143
|
|
|
111
144
|
This installs:
|
|
145
|
+
|
|
112
146
|
- `dotenv` (^17.2.3) - Environment variable management
|
|
113
147
|
|
|
114
148
|
### Step 2: Configure Figma Access
|
|
@@ -141,6 +175,7 @@ nano .env
|
|
|
141
175
|
```
|
|
142
176
|
|
|
143
177
|
Add your credentials:
|
|
178
|
+
|
|
144
179
|
```env
|
|
145
180
|
# Your Figma Personal Access Token
|
|
146
181
|
FIGMA_ACCESS_TOKEN=figd_your_token_here
|
|
@@ -157,6 +192,7 @@ npm run tokens
|
|
|
157
192
|
```
|
|
158
193
|
|
|
159
194
|
Expected output:
|
|
195
|
+
|
|
160
196
|
```
|
|
161
197
|
🚀 Starting Figma token extraction...
|
|
162
198
|
📡 Fetching from Figma REST API...
|
|
@@ -172,7 +208,119 @@ Expected output:
|
|
|
172
208
|
|
|
173
209
|
## 💻 Usage
|
|
174
210
|
|
|
175
|
-
###
|
|
211
|
+
### Using the NPM Package
|
|
212
|
+
|
|
213
|
+
#### Install the Package
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
npm install @deriv-com/quill-ui-v2
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
#### Import Components (CSS Bundled)
|
|
220
|
+
|
|
221
|
+
```javascript
|
|
222
|
+
import { Button, Textfield, SearchField } from '@deriv-com/quill-ui-v2';
|
|
223
|
+
|
|
224
|
+
// Components include their styles automatically
|
|
225
|
+
<Button variant="primary">Click me</Button>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
#### Import Tokens for Custom Styling
|
|
229
|
+
|
|
230
|
+
```javascript
|
|
231
|
+
// In your app entry point (main.tsx, App.tsx, etc.)
|
|
232
|
+
import '@deriv-com/quill-ui-v2/tokens.css';
|
|
233
|
+
|
|
234
|
+
// Now use tokens in your CSS
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
```css
|
|
238
|
+
.custom-element {
|
|
239
|
+
padding: var(--quill-semantic-size-spacing-16);
|
|
240
|
+
background: var(--quill-semantic-colour-background-canvas);
|
|
241
|
+
color: var(--quill-semantic-colour-text-prominent-default);
|
|
242
|
+
border-radius: var(--quill-semantic-size-radius-8);
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
#### Import Tokens in JavaScript
|
|
247
|
+
|
|
248
|
+
```javascript
|
|
249
|
+
import { tokens } from '@deriv-com/quill-ui-v2/tokens';
|
|
250
|
+
|
|
251
|
+
const styles = {
|
|
252
|
+
padding: tokens['--quill-semantic-size-spacing-16'],
|
|
253
|
+
background: tokens['--quill-semantic-colour-background-canvas']
|
|
254
|
+
};
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
#### Converting Figma MCP Output to Tokens
|
|
258
|
+
|
|
259
|
+
When Figma MCP generates code, it outputs hard-coded values with token names in comments:
|
|
260
|
+
|
|
261
|
+
```css
|
|
262
|
+
/* ❌ Figma MCP Output */
|
|
263
|
+
.header {
|
|
264
|
+
gap: 16px; /* Figma token: quill-semantic-spacing-16 */
|
|
265
|
+
padding: 16px 0; /* Figma token: quill-semantic-spacing-16 */
|
|
266
|
+
background-color: #ebecef; /* Figma token: tertiary/background/default */
|
|
267
|
+
border-radius: 999px; /* Figma token: size/radius */
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Convert to use design tokens:
|
|
272
|
+
|
|
273
|
+
```css
|
|
274
|
+
/* ✅ With Design Tokens */
|
|
275
|
+
.header {
|
|
276
|
+
gap: var(--quill-semantic-size-spacing-16);
|
|
277
|
+
padding: var(--quill-semantic-size-spacing-16) 0;
|
|
278
|
+
background-color: var(--quill-semantic-colour-button-tertiary-bg-default);
|
|
279
|
+
border-radius: var(--quill-semantic-size-radius-999);
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
#### Common Token Patterns
|
|
284
|
+
|
|
285
|
+
```css
|
|
286
|
+
/* Custom Button */
|
|
287
|
+
.custom-button {
|
|
288
|
+
padding: var(--quill-semantic-size-spacing-12) var(--quill-semantic-size-spacing-20);
|
|
289
|
+
background: var(--quill-semantic-colour-button-primary-bg-default);
|
|
290
|
+
color: var(--quill-semantic-colour-button-primary-text);
|
|
291
|
+
border-radius: var(--quill-semantic-size-radius-999);
|
|
292
|
+
font-size: var(--quill-semantic-typography-body-standard-size);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/* Custom Card */
|
|
296
|
+
.custom-card {
|
|
297
|
+
padding: var(--quill-semantic-size-spacing-24);
|
|
298
|
+
background: var(--quill-semantic-colour-background-surface);
|
|
299
|
+
border: 1px solid var(--quill-semantic-colour-border-default-default);
|
|
300
|
+
border-radius: var(--quill-semantic-size-radius-8);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/* Custom Text */
|
|
304
|
+
.custom-heading {
|
|
305
|
+
font-family: var(--quill-semantic-typography-font-family);
|
|
306
|
+
font-size: var(--quill-semantic-typography-title-section-size);
|
|
307
|
+
color: var(--quill-semantic-colour-text-prominent-default);
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
#### Available Token Categories
|
|
312
|
+
|
|
313
|
+
- **Colors**: `--quill-semantic-colour-*` (text, background, border)
|
|
314
|
+
- **Spacing**: `--quill-semantic-size-spacing-*` (4, 8, 16, 24, etc.)
|
|
315
|
+
- **Sizing**: `--quill-semantic-size-width-height-*` (32, 48, 56, etc.)
|
|
316
|
+
- **Border Radius**: `--quill-semantic-size-radius-*` (8, 16, 999)
|
|
317
|
+
- **Typography**: `--quill-semantic-typography-*` (font-size, font-family, font-weight)
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
### Development Commands
|
|
322
|
+
|
|
323
|
+
#### Command Line
|
|
176
324
|
|
|
177
325
|
```bash
|
|
178
326
|
# Fetch from Figma and generate all files
|
|
@@ -191,21 +339,19 @@ npm run tokens:watch
|
|
|
191
339
|
npm run tokens:ci
|
|
192
340
|
```
|
|
193
341
|
|
|
194
|
-
|
|
342
|
+
#### In HTML (Development)
|
|
195
343
|
|
|
196
344
|
```html
|
|
197
345
|
<!DOCTYPE html>
|
|
198
346
|
<html>
|
|
199
|
-
<head>
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
</head>
|
|
203
|
-
<body>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
</div>
|
|
208
|
-
</body>
|
|
347
|
+
<head>
|
|
348
|
+
<!-- Import all tokens -->
|
|
349
|
+
<link rel="stylesheet" href="./src/tokens/index.css" />
|
|
350
|
+
</head>
|
|
351
|
+
<body>
|
|
352
|
+
<!-- Use CSS variables -->
|
|
353
|
+
<div style="color: var(--quill-core-color-blue-500)">Custom styled element</div>
|
|
354
|
+
</body>
|
|
209
355
|
</html>
|
|
210
356
|
```
|
|
211
357
|
|
|
@@ -213,7 +359,7 @@ npm run tokens:ci
|
|
|
213
359
|
|
|
214
360
|
```css
|
|
215
361
|
/* Import tokens */
|
|
216
|
-
@import
|
|
362
|
+
@import "./src/tokens/index.css";
|
|
217
363
|
|
|
218
364
|
/* Use in your styles */
|
|
219
365
|
.my-button {
|
|
@@ -226,31 +372,31 @@ npm run tokens:ci
|
|
|
226
372
|
### In JavaScript/TypeScript
|
|
227
373
|
|
|
228
374
|
```typescript
|
|
229
|
-
import { tokens } from
|
|
230
|
-
import type { TokenName, TokenValue } from
|
|
375
|
+
import { tokens } from "./src/tokens/tokens.js";
|
|
376
|
+
import type { TokenName, TokenValue } from "./src/tokens/tokens";
|
|
231
377
|
|
|
232
378
|
// Type-safe token access with autocomplete!
|
|
233
|
-
const primaryColor: string = tokens[
|
|
234
|
-
const spacing: string = tokens[
|
|
379
|
+
const primaryColor: string = tokens["--quill-core-color-blue-500"];
|
|
380
|
+
const spacing: string = tokens["--quill-core-spacing-md"];
|
|
235
381
|
|
|
236
382
|
// Use in dynamic styles
|
|
237
|
-
element.style.setProperty(
|
|
238
|
-
element.style.setProperty(
|
|
383
|
+
element.style.setProperty("background-color", primaryColor);
|
|
384
|
+
element.style.setProperty("padding", spacing);
|
|
239
385
|
```
|
|
240
386
|
|
|
241
387
|
### In React
|
|
242
388
|
|
|
243
389
|
```tsx
|
|
244
|
-
import
|
|
245
|
-
import { tokens } from
|
|
390
|
+
import "./src/tokens/index.css";
|
|
391
|
+
import { tokens } from "./src/tokens/tokens";
|
|
246
392
|
|
|
247
393
|
function Button({ children }: { children: React.ReactNode }) {
|
|
248
394
|
return (
|
|
249
395
|
<button
|
|
250
396
|
style={{
|
|
251
|
-
backgroundColor: tokens[
|
|
252
|
-
padding: tokens[
|
|
253
|
-
borderRadius: tokens[
|
|
397
|
+
backgroundColor: tokens["--quill-core-color-blue-500"],
|
|
398
|
+
padding: tokens["--quill-core-spacing-md"],
|
|
399
|
+
borderRadius: tokens["--quill-core-radius-lg"],
|
|
254
400
|
}}
|
|
255
401
|
>
|
|
256
402
|
{children}
|
|
@@ -261,6 +407,96 @@ function Button({ children }: { children: React.ReactNode }) {
|
|
|
261
407
|
|
|
262
408
|
---
|
|
263
409
|
|
|
410
|
+
## 🧩 Component Development
|
|
411
|
+
|
|
412
|
+
This design system includes comprehensive guidelines for building consistent, accessible components.
|
|
413
|
+
|
|
414
|
+
### Getting Started with Components
|
|
415
|
+
|
|
416
|
+
All components must follow the standardized structure and patterns defined in our documentation:
|
|
417
|
+
|
|
418
|
+
- **[Component Guidelines](docs/guideline.md)** - Complete standards for building components
|
|
419
|
+
- **[Component Prompt Template](docs/prompt.md)** - Fill-in template for creating new components
|
|
420
|
+
|
|
421
|
+
### Component Structure
|
|
422
|
+
|
|
423
|
+
Each component includes 6 required files:
|
|
424
|
+
|
|
425
|
+
```
|
|
426
|
+
src/components/{component-name}/
|
|
427
|
+
├── {ComponentName}.tsx # React component
|
|
428
|
+
├── {ComponentName}.module.css # Styles with design tokens
|
|
429
|
+
├── {ComponentName}.stories.tsx # Storybook stories
|
|
430
|
+
├── {ComponentName}.spec.json # Cross-platform specification
|
|
431
|
+
├── index.ts # Public exports
|
|
432
|
+
└── README.md # Documentation
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### Quick Component Creation
|
|
436
|
+
|
|
437
|
+
1. **Sync design tokens**: Run `npm run tokens` to sync from Figma
|
|
438
|
+
2. **Review the guidelines**: Read [`docs/guideline.md`](docs/guideline.md)
|
|
439
|
+
3. **Fill the prompt template**: Use [`docs/prompt.md`](docs/prompt.md)
|
|
440
|
+
4. **Extract with Figma MCP**: Use Figma MCP tools to get component specs
|
|
441
|
+
5. **Create all 6 files**: Generate from Figma data
|
|
442
|
+
6. **Export component**: Add to `src/index.ts`
|
|
443
|
+
|
|
444
|
+
### Example: Creating a Button from Figma
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
# 1. Sync tokens from Figma Variables
|
|
448
|
+
npm run tokens
|
|
449
|
+
|
|
450
|
+
# 2. Get Figma component node ID (e.g., "2074:7")
|
|
451
|
+
|
|
452
|
+
# 3. Use Figma MCP tools to extract:
|
|
453
|
+
# - get_design_context(nodeId)
|
|
454
|
+
# - get_variable_defs(nodeId)
|
|
455
|
+
# - get_screenshot(nodeId)
|
|
456
|
+
# - get_metadata(nodeId)
|
|
457
|
+
|
|
458
|
+
# 4. Generate component files from Figma data
|
|
459
|
+
|
|
460
|
+
# 5. Export in src/index.ts
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
See [`docs/prompt.md`](docs/prompt.md) for complete Figma-driven examples.
|
|
464
|
+
|
|
465
|
+
### Design Token Integration
|
|
466
|
+
|
|
467
|
+
All components must use design tokens from `src/tokens/`:
|
|
468
|
+
|
|
469
|
+
```css
|
|
470
|
+
/* ✅ CORRECT - Use design tokens */
|
|
471
|
+
.button {
|
|
472
|
+
background: var(--quill-semantic-background-action-brand-normal);
|
|
473
|
+
padding: var(--quill-semantic-spacing-24);
|
|
474
|
+
border-radius: var(--quill-semantic-radius-999);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/* ❌ WRONG - Never hardcode values */
|
|
478
|
+
.button {
|
|
479
|
+
background: #0066cc;
|
|
480
|
+
padding: 24px;
|
|
481
|
+
border-radius: 999px;
|
|
482
|
+
}
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
### Component Checklist
|
|
486
|
+
|
|
487
|
+
Before submitting a component, verify:
|
|
488
|
+
|
|
489
|
+
- [ ] All 6 files created
|
|
490
|
+
- [ ] Uses design tokens (no hardcoded values)
|
|
491
|
+
- [ ] All states implemented (hover, active, focus, disabled)
|
|
492
|
+
- [ ] Storybook stories complete
|
|
493
|
+
- [ ] Accessibility requirements met
|
|
494
|
+
- [ ] TypeScript types exported
|
|
495
|
+
- [ ] Component exported in `src/index.ts`
|
|
496
|
+
- [ ] README documentation complete
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
264
500
|
## 🎨 For Designers
|
|
265
501
|
|
|
266
502
|
### Setting Up Figma Variables
|
|
@@ -270,6 +506,7 @@ function Button({ children }: { children: React.ReactNode }) {
|
|
|
270
506
|
- Semantic: Contextual tokens (spacing, radius, etc.)
|
|
271
507
|
|
|
272
508
|
2. **Name Variables** using forward slashes for grouping:
|
|
509
|
+
|
|
273
510
|
```
|
|
274
511
|
colour/blue/500
|
|
275
512
|
size/spacing/md
|
|
@@ -284,12 +521,14 @@ function Button({ children }: { children: React.ReactNode }) {
|
|
|
284
521
|
### Best Practices
|
|
285
522
|
|
|
286
523
|
✅ **DO:**
|
|
524
|
+
|
|
287
525
|
- Use consistent naming conventions
|
|
288
526
|
- Group related tokens together
|
|
289
527
|
- Document token purposes in descriptions
|
|
290
528
|
- Test tokens in Dev Mode before syncing
|
|
291
529
|
|
|
292
530
|
❌ **DON'T:**
|
|
531
|
+
|
|
293
532
|
- Use spaces or special characters in names
|
|
294
533
|
- Create circular references
|
|
295
534
|
- Delete tokens without coordinating with developers
|
|
@@ -323,11 +562,13 @@ This allows you to see CSS variable names in Figma's Dev Mode.
|
|
|
323
562
|
### Workflow
|
|
324
563
|
|
|
325
564
|
1. **Sync tokens** when designers notify you of changes:
|
|
565
|
+
|
|
326
566
|
```bash
|
|
327
567
|
npm run tokens
|
|
328
568
|
```
|
|
329
569
|
|
|
330
570
|
2. **Review changes** before committing:
|
|
571
|
+
|
|
331
572
|
```bash
|
|
332
573
|
git diff src/tokens/
|
|
333
574
|
```
|
|
@@ -351,29 +592,29 @@ module.exports = {
|
|
|
351
592
|
theme: {
|
|
352
593
|
extend: {
|
|
353
594
|
colors: {
|
|
354
|
-
primary:
|
|
355
|
-
secondary:
|
|
595
|
+
primary: "var(--quill-core-color-blue-500)",
|
|
596
|
+
secondary: "var(--quill-core-color-gray-500)",
|
|
356
597
|
},
|
|
357
598
|
spacing: {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
599
|
+
xs: "var(--quill-core-spacing-xs)",
|
|
600
|
+
sm: "var(--quill-core-spacing-sm)",
|
|
601
|
+
md: "var(--quill-core-spacing-md)",
|
|
602
|
+
},
|
|
603
|
+
},
|
|
604
|
+
},
|
|
605
|
+
};
|
|
365
606
|
```
|
|
366
607
|
|
|
367
608
|
#### Styled Components
|
|
368
609
|
|
|
369
610
|
```typescript
|
|
370
|
-
import styled from
|
|
371
|
-
import { tokens } from
|
|
611
|
+
import styled from "styled-components";
|
|
612
|
+
import { tokens } from "./src/tokens/tokens";
|
|
372
613
|
|
|
373
614
|
const Button = styled.button`
|
|
374
|
-
background: ${tokens[
|
|
375
|
-
padding: ${tokens[
|
|
376
|
-
border-radius: ${tokens[
|
|
615
|
+
background: ${tokens["--quill-core-color-blue-500"]};
|
|
616
|
+
padding: ${tokens["--quill-core-spacing-md"]};
|
|
617
|
+
border-radius: ${tokens["--quill-core-radius-lg"]};
|
|
377
618
|
`;
|
|
378
619
|
```
|
|
379
620
|
|
|
@@ -391,10 +632,12 @@ const Button = styled.button`
|
|
|
391
632
|
### Version Control
|
|
392
633
|
|
|
393
634
|
**What to commit:**
|
|
635
|
+
|
|
394
636
|
- ✅ All files in `src/tokens/`
|
|
395
637
|
- ✅ `scripts/tokens/version.json` (optional)
|
|
396
638
|
|
|
397
639
|
**What to ignore:**
|
|
640
|
+
|
|
398
641
|
- ❌ `scripts/tokens/tokens.json` (raw data, can be regenerated)
|
|
399
642
|
- ❌ `.env` (contains secrets)
|
|
400
643
|
|
|
@@ -410,6 +653,7 @@ npm run tokens:dry-run
|
|
|
410
653
|
```
|
|
411
654
|
|
|
412
655
|
Output:
|
|
656
|
+
|
|
413
657
|
```
|
|
414
658
|
🔍 Dry Run - Preview of Changes:
|
|
415
659
|
════════════════════════════════════════════════════════════
|
|
@@ -438,6 +682,7 @@ npm run tokens:watch
|
|
|
438
682
|
```
|
|
439
683
|
|
|
440
684
|
The script will:
|
|
685
|
+
|
|
441
686
|
- Poll Figma every 30 seconds (configurable)
|
|
442
687
|
- Detect when tokens change
|
|
443
688
|
- Prompt you to regenerate
|
|
@@ -451,6 +696,7 @@ npm run tokens:cached
|
|
|
451
696
|
```
|
|
452
697
|
|
|
453
698
|
Useful when:
|
|
699
|
+
|
|
454
700
|
- Testing configuration changes
|
|
455
701
|
- Iterating on output formats
|
|
456
702
|
- Working offline
|
|
@@ -463,6 +709,7 @@ npm run tokens:ci
|
|
|
463
709
|
```
|
|
464
710
|
|
|
465
711
|
Features:
|
|
712
|
+
|
|
466
713
|
- Exits with proper error codes
|
|
467
714
|
- Shows detailed error messages
|
|
468
715
|
- Prevents interactive prompts
|
|
@@ -474,14 +721,17 @@ See [CONFIGURATION.md](CONFIGURATION.md#cicd-integration) for complete CI/CD set
|
|
|
474
721
|
|
|
475
722
|
## 📚 Documentation
|
|
476
723
|
|
|
477
|
-
| Document
|
|
478
|
-
|
|
479
|
-
| **[README.md](README.md)** (this file)
|
|
480
|
-
| **[
|
|
481
|
-
| **[
|
|
724
|
+
| Document | Purpose | Audience |
|
|
725
|
+
| ---------------------------------------- | -------------------------------- | ------------------- |
|
|
726
|
+
| **[README.md](README.md)** (this file) | Quick start and overview | Everyone |
|
|
727
|
+
| **[guideline.md](docs/guideline.md)** | Figma-driven component standards | Developers |
|
|
728
|
+
| **[prompt.md](docs/prompt.md)** | Figma MCP prompt templates | Developers |
|
|
729
|
+
| **[CONFIGURATION.md](CONFIGURATION.md)** | Token extractor configuration | Developers |
|
|
730
|
+
| **[API-REFERENCE.md](API-REFERENCE.md)** | Technical API documentation | Advanced developers |
|
|
482
731
|
|
|
483
732
|
### Quick Links
|
|
484
733
|
|
|
734
|
+
- **Components:** [Figma-Driven Guidelines](docs/guideline.md) • [Figma MCP Prompts](docs/prompt.md) • [Component Structure](#-component-development)
|
|
485
735
|
- **Configuration:** [Environment Variables](CONFIGURATION.md#environment-variables) • [Config Class](CONFIGURATION.md#config-class) • [Collections](CONFIGURATION.md#collection-configuration)
|
|
486
736
|
- **Advanced:** [CI/CD Setup](CONFIGURATION.md#cicd-integration) • [Watch Mode](CONFIGURATION.md#watch-mode) • [Batch API](CONFIGURATION.md#performance-optimization)
|
|
487
737
|
- **API:** [Architecture](API-REFERENCE.md#architecture) • [Modules](API-REFERENCE.md#modules) • [Extending](API-REFERENCE.md#extending-the-system)
|
|
@@ -495,6 +745,7 @@ See [CONFIGURATION.md](CONFIGURATION.md#cicd-integration) for complete CI/CD set
|
|
|
495
745
|
**Problem:** Environment variables not loaded
|
|
496
746
|
|
|
497
747
|
**Solution:**
|
|
748
|
+
|
|
498
749
|
```bash
|
|
499
750
|
# 1. Verify .env file exists
|
|
500
751
|
ls -la .env
|
|
@@ -514,6 +765,7 @@ FIGMA_FILE_KEY=your_file_key_here
|
|
|
514
765
|
**Problem:** Collection name mismatch between Figma and configuration
|
|
515
766
|
|
|
516
767
|
**Solution:**
|
|
768
|
+
|
|
517
769
|
1. Check your Figma collection names
|
|
518
770
|
2. Names are normalized: `"My Colors"` → `my_colors`
|
|
519
771
|
3. Update `COLLECTION_DATA` in configuration
|
|
@@ -527,6 +779,7 @@ FIGMA_FILE_KEY=your_file_key_here
|
|
|
527
779
|
**Problem:** API connection or authentication issues
|
|
528
780
|
|
|
529
781
|
**Solution:**
|
|
782
|
+
|
|
530
783
|
```bash
|
|
531
784
|
# 1. Verify token is valid
|
|
532
785
|
curl -H "X-Figma-Token: YOUR_TOKEN" \
|
|
@@ -547,6 +800,7 @@ ping api.figma.com
|
|
|
547
800
|
**Problem:** TypeScript can't find token definitions
|
|
548
801
|
|
|
549
802
|
**Solution:**
|
|
803
|
+
|
|
550
804
|
```typescript
|
|
551
805
|
// 1. Ensure tokens.d.ts is generated
|
|
552
806
|
// Check: src/tokens/tokens.d.ts exists
|
|
@@ -587,6 +841,7 @@ When reporting issues, please include:
|
|
|
587
841
|
### Adding Features
|
|
588
842
|
|
|
589
843
|
1. **Create feature branch**
|
|
844
|
+
|
|
590
845
|
```bash
|
|
591
846
|
git checkout -b feature/your-feature-name
|
|
592
847
|
```
|
|
@@ -597,6 +852,7 @@ When reporting issues, please include:
|
|
|
597
852
|
- Update documentation
|
|
598
853
|
|
|
599
854
|
3. **Test thoroughly**
|
|
855
|
+
|
|
600
856
|
```bash
|
|
601
857
|
npm test
|
|
602
858
|
npm run tokens
|
|
@@ -654,4 +910,5 @@ MIT License - see LICENSE file for details
|
|
|
654
910
|
**Ready to sync your design system? Let's go! 🚀**
|
|
655
911
|
|
|
656
912
|
```bash
|
|
657
|
-
npm run tokens
|
|
913
|
+
npm run tokens
|
|
914
|
+
```
|