stitch-kit 1.5.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/AGENTS.md +139 -0
- package/CHANGELOG.md +86 -0
- package/README.md +167 -0
- package/agents/stitch-kit.md +93 -0
- package/bin/stitch-kit.mjs +430 -0
- package/docs/architecture.md +118 -0
- package/docs/color-prompt-guide.md +119 -0
- package/docs/mcp-naming-convention.md +64 -0
- package/docs/mcp-schemas/README.md +130 -0
- package/docs/mcp-schemas/apply_design_system.json +36 -0
- package/docs/mcp-schemas/create_design_system.json +78 -0
- package/docs/mcp-schemas/create_project.json +290 -0
- package/docs/mcp-schemas/delete_project.json +20 -0
- package/docs/mcp-schemas/edit_screens.json +46 -0
- package/docs/mcp-schemas/generate_screen_from_text.json +242 -0
- package/docs/mcp-schemas/generate_variants.json +77 -0
- package/docs/mcp-schemas/get_project.json +137 -0
- package/docs/mcp-schemas/get_screen.json +92 -0
- package/docs/mcp-schemas/list_design_systems.json +32 -0
- package/docs/mcp-schemas/list_projects.json +136 -0
- package/docs/mcp-schemas/list_screens.json +56 -0
- package/docs/mcp-schemas/update_design_system.json +32 -0
- package/docs/mcp-schemas/upload_screens_from_images.json +52 -0
- package/docs/prd-to-stitch-workflow.md +137 -0
- package/docs/skills-index.md +108 -0
- package/docs/tailwind-reference.md +207 -0
- package/package.json +41 -0
- package/skills/stitch-a11y/SKILL.md +428 -0
- package/skills/stitch-a11y/resources/audit-checklist.md +102 -0
- package/skills/stitch-animate/SKILL.md +371 -0
- package/skills/stitch-animate/resources/animation-patterns.md +248 -0
- package/skills/stitch-design-md/SKILL.md +215 -0
- package/skills/stitch-design-md/examples/DESIGN.md +54 -0
- package/skills/stitch-design-md/examples/usage.md +67 -0
- package/skills/stitch-design-md/scripts/fetch-stitch.sh +35 -0
- package/skills/stitch-design-system/SKILL.md +314 -0
- package/skills/stitch-design-system/resources/tokens-template.css +237 -0
- package/skills/stitch-html-components/SKILL.md +344 -0
- package/skills/stitch-html-components/resources/architecture-checklist.md +74 -0
- package/skills/stitch-html-components/scripts/fetch-stitch.sh +45 -0
- package/skills/stitch-loop/SKILL.md +183 -0
- package/skills/stitch-loop/examples/SITE.md +39 -0
- package/skills/stitch-loop/examples/next-prompt.md +24 -0
- package/skills/stitch-loop/examples/usage.md +77 -0
- package/skills/stitch-mcp-apply-design-system/SKILL.md +82 -0
- package/skills/stitch-mcp-create-design-system/SKILL.md +117 -0
- package/skills/stitch-mcp-create-project/SKILL.md +77 -0
- package/skills/stitch-mcp-delete-project/SKILL.md +62 -0
- package/skills/stitch-mcp-edit-screens/SKILL.md +121 -0
- package/skills/stitch-mcp-generate-screen-from-text/SKILL.md +102 -0
- package/skills/stitch-mcp-generate-screen-from-text/examples/desktop.md +53 -0
- package/skills/stitch-mcp-generate-screen-from-text/examples/mobile.md +71 -0
- package/skills/stitch-mcp-generate-variants/SKILL.md +124 -0
- package/skills/stitch-mcp-get-project/SKILL.md +67 -0
- package/skills/stitch-mcp-get-screen/SKILL.md +117 -0
- package/skills/stitch-mcp-get-screen/scripts/fetch-stitch.sh +35 -0
- package/skills/stitch-mcp-list-design-systems/SKILL.md +84 -0
- package/skills/stitch-mcp-list-projects/SKILL.md +77 -0
- package/skills/stitch-mcp-list-screens/SKILL.md +69 -0
- package/skills/stitch-mcp-update-design-system/SKILL.md +82 -0
- package/skills/stitch-mcp-upload-screens-from-images/SKILL.md +95 -0
- package/skills/stitch-mcp-upload-screens-from-images/scripts/encode-image.sh +43 -0
- package/skills/stitch-nextjs-components/SKILL.md +181 -0
- package/skills/stitch-nextjs-components/resources/architecture-checklist.md +65 -0
- package/skills/stitch-nextjs-components/resources/component-template.tsx +101 -0
- package/skills/stitch-nextjs-components/scripts/fetch-stitch.sh +45 -0
- package/skills/stitch-orchestrator/SKILL.md +337 -0
- package/skills/stitch-orchestrator/examples/workflow.md +173 -0
- package/skills/stitch-react-components/SKILL.md +236 -0
- package/skills/stitch-react-components/references/tailwind-to-react.md +117 -0
- package/skills/stitch-react-components/resources/architecture-checklist.md +34 -0
- package/skills/stitch-react-components/resources/component-template.tsx +35 -0
- package/skills/stitch-react-components/scripts/fetch-stitch.sh +35 -0
- package/skills/stitch-react-native-components/SKILL.md +333 -0
- package/skills/stitch-react-native-components/resources/architecture-checklist.md +74 -0
- package/skills/stitch-react-native-components/resources/component-template.tsx +104 -0
- package/skills/stitch-react-native-components/scripts/fetch-stitch.sh +45 -0
- package/skills/stitch-remotion/SKILL.md +280 -0
- package/skills/stitch-setup/SKILL.md +183 -0
- package/skills/stitch-shadcn-ui/SKILL.md +255 -0
- package/skills/stitch-skill-creator/SKILL.md +257 -0
- package/skills/stitch-skill-creator/references/output-patterns.md +71 -0
- package/skills/stitch-skill-creator/scripts/init_stitch_skill.py +229 -0
- package/skills/stitch-svelte-components/SKILL.md +282 -0
- package/skills/stitch-svelte-components/resources/architecture-checklist.md +62 -0
- package/skills/stitch-svelte-components/resources/component-template.svelte +193 -0
- package/skills/stitch-svelte-components/scripts/fetch-stitch.sh +36 -0
- package/skills/stitch-swiftui-components/SKILL.md +424 -0
- package/skills/stitch-swiftui-components/resources/architecture-checklist.md +83 -0
- package/skills/stitch-swiftui-components/resources/component-template.swift +131 -0
- package/skills/stitch-swiftui-components/resources/layout-mapping.md +155 -0
- package/skills/stitch-swiftui-components/scripts/fetch-stitch.sh +45 -0
- package/skills/stitch-ued-guide/SKILL.md +124 -0
- package/skills/stitch-ui-design-spec-generator/SKILL.md +115 -0
- package/skills/stitch-ui-design-spec-generator/examples/usage.md +79 -0
- package/skills/stitch-ui-design-variants/SKILL.md +127 -0
- package/skills/stitch-ui-prompt-architect/SKILL.md +196 -0
- package/skills/stitch-ui-prompt-architect/references/KEYWORDS.md +170 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stitch-design-system
|
|
3
|
+
description: Extracts a Stitch design and generates production code artifacts — CSS custom properties with dark mode tokens, a Tailwind v4 @theme block, and a semantic design system document. Run this before framework conversion skills.
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- "stitch*:*"
|
|
6
|
+
- "Bash"
|
|
7
|
+
- "Read"
|
|
8
|
+
- "Write"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Stitch → Design System Code Artifacts
|
|
12
|
+
|
|
13
|
+
You are a design systems engineer. You analyze Stitch designs and generate **code artifacts** — not just documentation. While the `design-md` skill produces a human-readable markdown file, this skill produces files you actually import into your codebase: CSS custom properties with dark mode, Tailwind v4 configuration, and typography tokens.
|
|
14
|
+
|
|
15
|
+
**Use this skill first, before `stitch-nextjs-components` or `stitch-svelte-components`.** The generated tokens become the foundation for all subsequent component generation.
|
|
16
|
+
|
|
17
|
+
## When to use this skill
|
|
18
|
+
|
|
19
|
+
Use this skill when:
|
|
20
|
+
- Starting a new project from a Stitch design
|
|
21
|
+
- The user mentions "design tokens", "CSS variables", "dark mode tokens", "Tailwind config"
|
|
22
|
+
- Running before framework conversion skills to ensure design consistency
|
|
23
|
+
- Updating an existing project's design system after a Stitch design update
|
|
24
|
+
|
|
25
|
+
## What this skill generates
|
|
26
|
+
|
|
27
|
+
Three output files:
|
|
28
|
+
|
|
29
|
+
| File | Purpose |
|
|
30
|
+
|------|---------|
|
|
31
|
+
| `design-tokens.css` | CSS custom properties — import this in your framework's global CSS |
|
|
32
|
+
| `tailwind-theme.css` | Tailwind v4 `@theme` block — paste into your `globals.css` |
|
|
33
|
+
| `DESIGN.md` | Extended design document (richer than `design-md`, includes dark mode + animation tokens) |
|
|
34
|
+
|
|
35
|
+
## Step 1: Retrieve the Stitch design
|
|
36
|
+
|
|
37
|
+
1. **Namespace discovery** — Run `list_tools` to find the Stitch MCP prefix.
|
|
38
|
+
2. **Fetch screen** — Call `[prefix]:get_screen` with `projectId` and `screenId`.
|
|
39
|
+
3. **Download HTML** — Run:
|
|
40
|
+
```bash
|
|
41
|
+
bash scripts/fetch-stitch.sh "[htmlCode.downloadUrl]" "temp/source.html"
|
|
42
|
+
```
|
|
43
|
+
4. **Visual reference** — Check `screenshot.downloadUrl` to see the full design intent.
|
|
44
|
+
|
|
45
|
+
If multiple screens exist, retrieve all of them. Run `[prefix]:list_screens` and fetch each one to ensure the token set covers every pattern in the design.
|
|
46
|
+
|
|
47
|
+
## Step 2: Extract raw design values
|
|
48
|
+
|
|
49
|
+
From the Stitch HTML and screenshot, extract:
|
|
50
|
+
|
|
51
|
+
### Colors
|
|
52
|
+
Identify every distinct color. For each, determine:
|
|
53
|
+
- **Exact hex value** (from Tailwind config in `<head>`, or infer from screenshot)
|
|
54
|
+
- **Semantic role**: What does this color DO? (primary action, surface, text, border, error, success...)
|
|
55
|
+
- **Usage frequency**: How dominant is it?
|
|
56
|
+
|
|
57
|
+
Aim for 8-12 semantic tokens, not 50 specific shades.
|
|
58
|
+
|
|
59
|
+
### Typography
|
|
60
|
+
- Font families (heading, body, mono — if present)
|
|
61
|
+
- Type scale sizes (the actual `px` or `rem` values used in the design)
|
|
62
|
+
- Font weights used
|
|
63
|
+
- Line heights
|
|
64
|
+
|
|
65
|
+
### Spacing & geometry
|
|
66
|
+
- Base spacing unit (usually 4px or 8px)
|
|
67
|
+
- Border radius values
|
|
68
|
+
- Shadow definitions
|
|
69
|
+
|
|
70
|
+
### Motion
|
|
71
|
+
- Transition durations used (or infer: 150ms for micro, 300ms for panels)
|
|
72
|
+
- Easing styles (linear, ease-out, spring-like)
|
|
73
|
+
|
|
74
|
+
## Step 3: Generate `design-tokens.css`
|
|
75
|
+
|
|
76
|
+
Create `design-tokens.css` with full light + dark mode token sets.
|
|
77
|
+
|
|
78
|
+
**Naming convention:**
|
|
79
|
+
- `--color-*` — Color tokens
|
|
80
|
+
- `--font-*` — Typography
|
|
81
|
+
- `--spacing-*` — Spacing scale
|
|
82
|
+
- `--radius-*` — Border radius
|
|
83
|
+
- `--shadow-*` — Elevation
|
|
84
|
+
- `--motion-*` — Animation timing
|
|
85
|
+
|
|
86
|
+
**Template:**
|
|
87
|
+
```css
|
|
88
|
+
/* =============================================================
|
|
89
|
+
Design Tokens — extracted from Stitch project: [Project Name]
|
|
90
|
+
Generated by stitch-design-system skill
|
|
91
|
+
============================================================= */
|
|
92
|
+
|
|
93
|
+
/* ---- Light mode (default) ---- */
|
|
94
|
+
:root {
|
|
95
|
+
/* Colors: Semantic roles, not visual names */
|
|
96
|
+
--color-background: [hex]; /* Page background */
|
|
97
|
+
--color-surface: [hex]; /* Card, panel backgrounds */
|
|
98
|
+
--color-surface-elevated: [hex]; /* Tooltip, dropdown backgrounds */
|
|
99
|
+
--color-primary: [hex]; /* Primary CTA, key actions */
|
|
100
|
+
--color-primary-hover: [hex]; /* Primary at hover state */
|
|
101
|
+
--color-primary-fg: [hex]; /* Text/icon on primary bg */
|
|
102
|
+
--color-secondary: [hex]; /* Secondary actions, accents */
|
|
103
|
+
--color-secondary-fg: [hex]; /* Text/icon on secondary bg */
|
|
104
|
+
--color-text: [hex]; /* Body text */
|
|
105
|
+
--color-text-muted: [hex]; /* Secondary, supporting text */
|
|
106
|
+
--color-text-disabled: [hex]; /* Disabled element text */
|
|
107
|
+
--color-border: [hex]; /* Dividers, input borders */
|
|
108
|
+
--color-border-focus: [hex]; /* Focus ring color */
|
|
109
|
+
--color-error: [hex]; /* Error states */
|
|
110
|
+
--color-success: [hex]; /* Success states */
|
|
111
|
+
--color-warning: [hex]; /* Warning states */
|
|
112
|
+
|
|
113
|
+
/* Typography */
|
|
114
|
+
--font-sans: [font-family-stack]; /* Heading and UI font */
|
|
115
|
+
--font-body: [font-family-stack]; /* Body text font (may equal --font-sans) */
|
|
116
|
+
--font-mono: [monospace-stack]; /* Code, technical content */
|
|
117
|
+
|
|
118
|
+
/* Type scale */
|
|
119
|
+
--text-xs: 0.75rem; /* 12px */
|
|
120
|
+
--text-sm: 0.875rem; /* 14px */
|
|
121
|
+
--text-base: 1rem; /* 16px */
|
|
122
|
+
--text-lg: 1.125rem; /* 18px */
|
|
123
|
+
--text-xl: 1.25rem; /* 20px */
|
|
124
|
+
--text-2xl: 1.5rem; /* 24px */
|
|
125
|
+
--text-3xl: 1.875rem; /* 30px */
|
|
126
|
+
--text-4xl: 2.25rem; /* 36px */
|
|
127
|
+
|
|
128
|
+
/* Spacing scale (base 4px) */
|
|
129
|
+
--space-1: 0.25rem; /* 4px */
|
|
130
|
+
--space-2: 0.5rem; /* 8px */
|
|
131
|
+
--space-3: 0.75rem; /* 12px */
|
|
132
|
+
--space-4: 1rem; /* 16px */
|
|
133
|
+
--space-6: 1.5rem; /* 24px */
|
|
134
|
+
--space-8: 2rem; /* 32px */
|
|
135
|
+
--space-12: 3rem; /* 48px */
|
|
136
|
+
--space-16: 4rem; /* 64px */
|
|
137
|
+
|
|
138
|
+
/* Geometry */
|
|
139
|
+
--radius-sm: [value]; /* Small elements: badges, chips */
|
|
140
|
+
--radius-md: [value]; /* Buttons, inputs */
|
|
141
|
+
--radius-lg: [value]; /* Cards, panels */
|
|
142
|
+
--radius-xl: [value]; /* Modals, drawers */
|
|
143
|
+
--radius-full: 9999px; /* Pills, avatars */
|
|
144
|
+
|
|
145
|
+
/* Shadows */
|
|
146
|
+
--shadow-sm: [value]; /* Subtle card lift */
|
|
147
|
+
--shadow-md: [value]; /* Dropdown, tooltip */
|
|
148
|
+
--shadow-lg: [value]; /* Modal, sheet */
|
|
149
|
+
|
|
150
|
+
/* Motion tokens */
|
|
151
|
+
--motion-duration-fast: 150ms; /* Hover states, micro interactions */
|
|
152
|
+
--motion-duration-base: 250ms; /* Typical UI transitions */
|
|
153
|
+
--motion-duration-slow: 400ms; /* Page-level, large panel */
|
|
154
|
+
--motion-ease-default: cubic-bezier(0.4, 0, 0.2, 1); /* Material ease */
|
|
155
|
+
--motion-ease-out: cubic-bezier(0, 0, 0.2, 1); /* Entries */
|
|
156
|
+
--motion-ease-in: cubic-bezier(0.4, 0, 1, 1); /* Exits */
|
|
157
|
+
--motion-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* Bouncy open */
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* ---- Dark mode ---- */
|
|
161
|
+
/* Applied via .dark class (Next.js + next-themes) or [data-theme="dark"] (Svelte) */
|
|
162
|
+
.dark,
|
|
163
|
+
[data-theme="dark"] {
|
|
164
|
+
--color-background: [dark-hex];
|
|
165
|
+
--color-surface: [dark-hex];
|
|
166
|
+
--color-surface-elevated: [dark-hex];
|
|
167
|
+
--color-primary: [dark-hex]; /* Same hue, lighter for dark bg contrast */
|
|
168
|
+
--color-primary-hover: [dark-hex];
|
|
169
|
+
--color-primary-fg: [dark-hex];
|
|
170
|
+
--color-secondary: [dark-hex];
|
|
171
|
+
--color-secondary-fg: [dark-hex];
|
|
172
|
+
--color-text: [dark-hex];
|
|
173
|
+
--color-text-muted: [dark-hex];
|
|
174
|
+
--color-text-disabled: [dark-hex];
|
|
175
|
+
--color-border: [dark-hex];
|
|
176
|
+
--color-border-focus: [dark-hex];
|
|
177
|
+
--color-error: [dark-hex];
|
|
178
|
+
--color-success: [dark-hex];
|
|
179
|
+
--color-warning: [dark-hex];
|
|
180
|
+
/* Typography, spacing, geometry, motion tokens: unchanged in dark mode */
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Step 4: Generate `tailwind-theme.css`
|
|
185
|
+
|
|
186
|
+
For projects using **Tailwind v4** (no `tailwind.config.js`), generate a `@theme` block.
|
|
187
|
+
|
|
188
|
+
**Important:** Tailwind v4 uses `@theme` in CSS, not a JS config file. Map tokens to Tailwind's namespace:
|
|
189
|
+
|
|
190
|
+
```css
|
|
191
|
+
/* tailwind-theme.css — paste into your globals.css or import it */
|
|
192
|
+
@import "tailwindcss";
|
|
193
|
+
|
|
194
|
+
@theme {
|
|
195
|
+
/* Wire Tailwind color utilities to your CSS variables */
|
|
196
|
+
--color-background: var(--color-background);
|
|
197
|
+
--color-surface: var(--color-surface);
|
|
198
|
+
--color-primary: var(--color-primary);
|
|
199
|
+
--color-primary-hover: var(--color-primary-hover);
|
|
200
|
+
--color-text: var(--color-text);
|
|
201
|
+
--color-text-muted: var(--color-text-muted);
|
|
202
|
+
--color-border: var(--color-border);
|
|
203
|
+
|
|
204
|
+
/* Fonts */
|
|
205
|
+
--font-sans: var(--font-sans);
|
|
206
|
+
--font-mono: var(--font-mono);
|
|
207
|
+
|
|
208
|
+
/* Radius */
|
|
209
|
+
--radius-sm: var(--radius-sm);
|
|
210
|
+
--radius-md: var(--radius-md);
|
|
211
|
+
--radius-lg: var(--radius-lg);
|
|
212
|
+
|
|
213
|
+
/* Animation duration utilities */
|
|
214
|
+
--animate-duration-fast: var(--motion-duration-fast);
|
|
215
|
+
--animate-duration-base: var(--motion-duration-base);
|
|
216
|
+
--animate-duration-slow: var(--motion-duration-slow);
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
For **Tailwind v3** projects (with `tailwind.config.js`), instead generate a `tailwind.config.js` section using the extracted hex values directly.
|
|
221
|
+
|
|
222
|
+
## Step 5: Generate `DESIGN.md`
|
|
223
|
+
|
|
224
|
+
Produce an extended design document. It has all sections from the standard `design-md` skill plus:
|
|
225
|
+
|
|
226
|
+
```markdown
|
|
227
|
+
# Design System: [Project Name]
|
|
228
|
+
|
|
229
|
+
> Generated by stitch-design-system from Stitch project [ID]
|
|
230
|
+
> Screens analyzed: [list]
|
|
231
|
+
|
|
232
|
+
## 1. Visual Theme & Atmosphere
|
|
233
|
+
[Mood, density, aesthetic philosophy — 2-3 sentences]
|
|
234
|
+
|
|
235
|
+
## 2. Color Palette & Roles
|
|
236
|
+
| Token | Light | Dark | Role |
|
|
237
|
+
|-------|-------|------|------|
|
|
238
|
+
| --color-primary | #... | #... | Main CTA, key actions |
|
|
239
|
+
| --color-background | #... | #... | Page background |
|
|
240
|
+
| ... | | | |
|
|
241
|
+
|
|
242
|
+
## 3. Typography
|
|
243
|
+
- **Heading font**: [Family, weights used, where]
|
|
244
|
+
- **Body font**: [Family, weights used, where]
|
|
245
|
+
- **Type scale**: xs (12px) → sm (14px) → base (16px) → lg (18px) → ... → 4xl (36px)
|
|
246
|
+
|
|
247
|
+
## 4. Geometry & Elevation
|
|
248
|
+
- **Border radius**: sm [Xpx] | md [Xpx] | lg [Xpx] | xl [Xpx]
|
|
249
|
+
- **Shadows**: [describe the elevation system]
|
|
250
|
+
|
|
251
|
+
## 5. Motion System
|
|
252
|
+
- **Micro** (hovers, toggles): [duration]ms [easing]
|
|
253
|
+
- **Meso** (panels, drawers): [duration]ms [easing]
|
|
254
|
+
- **Macro** (page transitions): [duration]ms [easing]
|
|
255
|
+
- **Spring** (playful elements): cubicOut spring
|
|
256
|
+
|
|
257
|
+
## 6. Stitch Prompt Copy-Paste Block
|
|
258
|
+
Use this block in every Stitch prompt for design consistency:
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
[Primary color: NAME (#HEX)] — used for buttons and key actions
|
|
262
|
+
[Background: #HEX] — clean and [mood adjective]
|
|
263
|
+
[Typography: FONT NAME] — [weight] weight for headings, regular for body
|
|
264
|
+
[Aesthetic: 2-3 adjectives describing the visual style]
|
|
265
|
+
[Border radius: SIZE — rounded/sharp/pill-shaped elements]
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## 7. Dark Mode Notes
|
|
269
|
+
[Specific notes on how the dark theme differs — any color roles that change significantly, any elements that need special treatment in dark mode]
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Step 6: Output & integration
|
|
273
|
+
|
|
274
|
+
Write all three files to the project root (or wherever the user specifies):
|
|
275
|
+
- `design-tokens.css`
|
|
276
|
+
- `tailwind-theme.css`
|
|
277
|
+
- `DESIGN.md`
|
|
278
|
+
|
|
279
|
+
Then tell the user how to use them:
|
|
280
|
+
|
|
281
|
+
**For Next.js:**
|
|
282
|
+
```tsx
|
|
283
|
+
// app/globals.css
|
|
284
|
+
@import '../design-tokens.css';
|
|
285
|
+
@import '../tailwind-theme.css';
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**For SvelteKit:**
|
|
289
|
+
```svelte
|
|
290
|
+
<!-- src/app.css -->
|
|
291
|
+
@import '$lib/design-tokens.css';
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**For the Stitch loop:**
|
|
295
|
+
> Copy Section 6 from `DESIGN.md` into every Stitch prompt to maintain design consistency across generated screens.
|
|
296
|
+
|
|
297
|
+
## Troubleshooting
|
|
298
|
+
|
|
299
|
+
| Issue | Fix |
|
|
300
|
+
|-------|-----|
|
|
301
|
+
| Can't determine dark mode hex values | Use the light-mode hue, desaturate slightly, and increase lightness by 30-40% |
|
|
302
|
+
| Font not loading | Add Google Fonts `@import` to `design-tokens.css` |
|
|
303
|
+
| Tailwind v3 vs v4 confusion | Check `package.json` — v4 uses `"tailwindcss": "^4"` and no config file |
|
|
304
|
+
| Tokens not applying | Ensure `design-tokens.css` is imported BEFORE component CSS |
|
|
305
|
+
|
|
306
|
+
## Integration with other skills
|
|
307
|
+
|
|
308
|
+
- Run this skill **before** `stitch-nextjs-components` or `stitch-svelte-components`
|
|
309
|
+
- The framework skills will import `design-tokens.css` instead of hardcoding values
|
|
310
|
+
- The `DESIGN.md` Section 6 feeds into `stitch-loop` for multi-page consistency
|
|
311
|
+
|
|
312
|
+
## References
|
|
313
|
+
|
|
314
|
+
- `resources/tokens-template.css` — Full template with all token categories
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/* =============================================================
|
|
2
|
+
Design Tokens — Template
|
|
3
|
+
Copy this file, fill in the values from your Stitch design,
|
|
4
|
+
and save as design-tokens.css in your project root.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
Next.js: @import '../design-tokens.css'; in app/globals.css
|
|
8
|
+
SvelteKit: @import '$lib/design-tokens.css'; in src/app.css
|
|
9
|
+
============================================================= */
|
|
10
|
+
|
|
11
|
+
/* ---- Google Fonts (update to match your Stitch design) ---- */
|
|
12
|
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
|
|
13
|
+
|
|
14
|
+
/* ---- Light mode (default) ---- */
|
|
15
|
+
:root {
|
|
16
|
+
/* ── Colors ── */
|
|
17
|
+
|
|
18
|
+
/* Backgrounds */
|
|
19
|
+
--color-background: ; /* Page/app background */
|
|
20
|
+
--color-surface: ; /* Card, panel, input backgrounds */
|
|
21
|
+
--color-surface-elevated: ; /* Tooltip, popover, dropdown */
|
|
22
|
+
|
|
23
|
+
/* Brand */
|
|
24
|
+
--color-primary: ; /* Main CTA, links, key actions */
|
|
25
|
+
--color-primary-hover: ; /* Primary at :hover */
|
|
26
|
+
--color-primary-active: ; /* Primary at :active */
|
|
27
|
+
--color-primary-fg: ; /* Text/icon on primary background */
|
|
28
|
+
|
|
29
|
+
--color-secondary: ; /* Secondary actions, tags, accents */
|
|
30
|
+
--color-secondary-hover: ;
|
|
31
|
+
--color-secondary-fg: ; /* Text/icon on secondary background */
|
|
32
|
+
|
|
33
|
+
/* Text */
|
|
34
|
+
--color-text: ; /* Default body text */
|
|
35
|
+
--color-text-muted: ; /* Captions, helper text, placeholders */
|
|
36
|
+
--color-text-disabled: ; /* Disabled state text */
|
|
37
|
+
--color-text-inverse: ; /* Text on dark backgrounds */
|
|
38
|
+
|
|
39
|
+
/* Borders */
|
|
40
|
+
--color-border: ; /* Default dividers, input borders */
|
|
41
|
+
--color-border-strong: ; /* Emphasized separators */
|
|
42
|
+
--color-border-focus: ; /* Focus ring color */
|
|
43
|
+
|
|
44
|
+
/* Status */
|
|
45
|
+
--color-error: ;
|
|
46
|
+
--color-error-bg: ; /* Error message background */
|
|
47
|
+
--color-success: ;
|
|
48
|
+
--color-success-bg: ; /* Success message background */
|
|
49
|
+
--color-warning: ;
|
|
50
|
+
--color-warning-bg: ; /* Warning message background */
|
|
51
|
+
--color-info: ;
|
|
52
|
+
|
|
53
|
+
/* ── Typography ── */
|
|
54
|
+
--font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
|
|
55
|
+
--font-body: var(--font-sans); /* Often same as sans; separate if design uses different body font */
|
|
56
|
+
--font-mono: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, monospace;
|
|
57
|
+
|
|
58
|
+
/* Type scale */
|
|
59
|
+
--text-xs: 0.75rem; /* 12px */
|
|
60
|
+
--text-sm: 0.875rem; /* 14px */
|
|
61
|
+
--text-base: 1rem; /* 16px — body default */
|
|
62
|
+
--text-lg: 1.125rem; /* 18px */
|
|
63
|
+
--text-xl: 1.25rem; /* 20px */
|
|
64
|
+
--text-2xl: 1.5rem; /* 24px */
|
|
65
|
+
--text-3xl: 1.875rem; /* 30px */
|
|
66
|
+
--text-4xl: 2.25rem; /* 36px */
|
|
67
|
+
--text-5xl: 3rem; /* 48px */
|
|
68
|
+
|
|
69
|
+
/* Font weights */
|
|
70
|
+
--weight-regular: 400;
|
|
71
|
+
--weight-medium: 500;
|
|
72
|
+
--weight-semibold: 600;
|
|
73
|
+
--weight-bold: 700;
|
|
74
|
+
|
|
75
|
+
/* Line heights */
|
|
76
|
+
--leading-tight: 1.25;
|
|
77
|
+
--leading-normal: 1.5;
|
|
78
|
+
--leading-relaxed: 1.625;
|
|
79
|
+
|
|
80
|
+
/* ── Spacing ── */
|
|
81
|
+
/* Base unit: 4px. Scale: 1=4px, 2=8px, 3=12px, 4=16px, 6=24px, 8=32px, 12=48px, 16=64px */
|
|
82
|
+
--space-px: 1px;
|
|
83
|
+
--space-0-5: 0.125rem; /* 2px */
|
|
84
|
+
--space-1: 0.25rem; /* 4px */
|
|
85
|
+
--space-2: 0.5rem; /* 8px */
|
|
86
|
+
--space-3: 0.75rem; /* 12px */
|
|
87
|
+
--space-4: 1rem; /* 16px */
|
|
88
|
+
--space-5: 1.25rem; /* 20px */
|
|
89
|
+
--space-6: 1.5rem; /* 24px */
|
|
90
|
+
--space-8: 2rem; /* 32px */
|
|
91
|
+
--space-10: 2.5rem; /* 40px */
|
|
92
|
+
--space-12: 3rem; /* 48px */
|
|
93
|
+
--space-16: 4rem; /* 64px */
|
|
94
|
+
--space-20: 5rem; /* 80px */
|
|
95
|
+
--space-24: 6rem; /* 96px */
|
|
96
|
+
|
|
97
|
+
/* ── Geometry ── */
|
|
98
|
+
--radius-none: 0;
|
|
99
|
+
--radius-sm: ; /* e.g. 4px — small elements */
|
|
100
|
+
--radius-md: ; /* e.g. 8px — buttons, inputs */
|
|
101
|
+
--radius-lg: ; /* e.g. 12px — cards */
|
|
102
|
+
--radius-xl: ; /* e.g. 16px — modals, sheets */
|
|
103
|
+
--radius-2xl: ; /* e.g. 24px — large panels */
|
|
104
|
+
--radius-full: 9999px; /* Pills, circles */
|
|
105
|
+
|
|
106
|
+
/* ── Shadows (Elevation) ── */
|
|
107
|
+
--shadow-none: none;
|
|
108
|
+
--shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
109
|
+
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
110
|
+
--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
111
|
+
--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
|
|
112
|
+
--shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
|
|
113
|
+
|
|
114
|
+
/* ── Motion ── */
|
|
115
|
+
--motion-duration-instant: 0ms;
|
|
116
|
+
--motion-duration-fast: 150ms; /* Hovers, toggles, micro interactions */
|
|
117
|
+
--motion-duration-base: 250ms; /* Standard UI transitions */
|
|
118
|
+
--motion-duration-slow: 400ms; /* Page elements, larger panels */
|
|
119
|
+
--motion-duration-slower: 600ms; /* Significant page transitions */
|
|
120
|
+
|
|
121
|
+
--motion-ease-linear: linear;
|
|
122
|
+
--motion-ease-default: cubic-bezier(0.4, 0, 0.2, 1); /* Standard — most interactions */
|
|
123
|
+
--motion-ease-in: cubic-bezier(0.4, 0, 1, 1); /* Exits — element leaving */
|
|
124
|
+
--motion-ease-out: cubic-bezier(0, 0, 0.2, 1); /* Entries — element appearing */
|
|
125
|
+
--motion-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* Playful bounce */
|
|
126
|
+
|
|
127
|
+
/* ── Z-Index ── */
|
|
128
|
+
--z-base: 0;
|
|
129
|
+
--z-raised: 10;
|
|
130
|
+
--z-dropdown: 100;
|
|
131
|
+
--z-sticky: 200;
|
|
132
|
+
--z-overlay: 300;
|
|
133
|
+
--z-modal: 400;
|
|
134
|
+
--z-toast: 500;
|
|
135
|
+
--z-tooltip: 600;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* ---- Dark mode ---- */
|
|
139
|
+
/* Applied via:
|
|
140
|
+
- .dark class on <html> (Next.js + next-themes)
|
|
141
|
+
- [data-theme="dark"] on <html> (Svelte)
|
|
142
|
+
Only override color tokens — spacing, typography, motion stay the same. */
|
|
143
|
+
.dark,
|
|
144
|
+
[data-theme="dark"] {
|
|
145
|
+
/* Backgrounds */
|
|
146
|
+
--color-background: ;
|
|
147
|
+
--color-surface: ;
|
|
148
|
+
--color-surface-elevated: ;
|
|
149
|
+
|
|
150
|
+
/* Brand — typically same hue, adjusted lightness for dark bg */
|
|
151
|
+
--color-primary: ;
|
|
152
|
+
--color-primary-hover: ;
|
|
153
|
+
--color-primary-active: ;
|
|
154
|
+
--color-primary-fg: ;
|
|
155
|
+
|
|
156
|
+
--color-secondary: ;
|
|
157
|
+
--color-secondary-hover: ;
|
|
158
|
+
--color-secondary-fg: ;
|
|
159
|
+
|
|
160
|
+
/* Text */
|
|
161
|
+
--color-text: ;
|
|
162
|
+
--color-text-muted: ;
|
|
163
|
+
--color-text-disabled: ;
|
|
164
|
+
--color-text-inverse: ;
|
|
165
|
+
|
|
166
|
+
/* Borders */
|
|
167
|
+
--color-border: ;
|
|
168
|
+
--color-border-strong: ;
|
|
169
|
+
--color-border-focus: ;
|
|
170
|
+
|
|
171
|
+
/* Status — may need adjusted for dark bg visibility */
|
|
172
|
+
--color-error: ;
|
|
173
|
+
--color-error-bg: ;
|
|
174
|
+
--color-success: ;
|
|
175
|
+
--color-success-bg: ;
|
|
176
|
+
--color-warning: ;
|
|
177
|
+
--color-warning-bg: ;
|
|
178
|
+
--color-info: ;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* ---- Accessibility utilities ---- */
|
|
182
|
+
|
|
183
|
+
/* Visually hidden but readable by screen readers */
|
|
184
|
+
.sr-only {
|
|
185
|
+
position: absolute;
|
|
186
|
+
width: 1px;
|
|
187
|
+
height: 1px;
|
|
188
|
+
padding: 0;
|
|
189
|
+
margin: -1px;
|
|
190
|
+
overflow: hidden;
|
|
191
|
+
clip: rect(0, 0, 0, 0);
|
|
192
|
+
white-space: nowrap;
|
|
193
|
+
border-width: 0;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Skip navigation link */
|
|
197
|
+
.skip-link {
|
|
198
|
+
position: absolute;
|
|
199
|
+
left: -9999px;
|
|
200
|
+
top: auto;
|
|
201
|
+
width: 1px;
|
|
202
|
+
height: 1px;
|
|
203
|
+
overflow: hidden;
|
|
204
|
+
}
|
|
205
|
+
.skip-link:focus {
|
|
206
|
+
position: fixed;
|
|
207
|
+
top: 1rem;
|
|
208
|
+
left: 1rem;
|
|
209
|
+
width: auto;
|
|
210
|
+
height: auto;
|
|
211
|
+
padding: 0.5rem 1rem;
|
|
212
|
+
background: var(--color-primary);
|
|
213
|
+
color: var(--color-primary-fg);
|
|
214
|
+
border-radius: var(--radius-md);
|
|
215
|
+
font-weight: var(--weight-semibold);
|
|
216
|
+
z-index: var(--z-tooltip);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* ---- Global focus ring ---- */
|
|
220
|
+
/* Visible on keyboard focus only — not mouse click */
|
|
221
|
+
*:focus-visible {
|
|
222
|
+
outline: 2px solid var(--color-border-focus);
|
|
223
|
+
outline-offset: 2px;
|
|
224
|
+
border-radius: 2px;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/* ---- Reduced motion ---- */
|
|
228
|
+
@media (prefers-reduced-motion: reduce) {
|
|
229
|
+
*,
|
|
230
|
+
*::before,
|
|
231
|
+
*::after {
|
|
232
|
+
animation-duration: 0.01ms !important;
|
|
233
|
+
animation-iteration-count: 1 !important;
|
|
234
|
+
transition-duration: 0.01ms !important;
|
|
235
|
+
scroll-behavior: auto !important;
|
|
236
|
+
}
|
|
237
|
+
}
|