@discourser/design-system 0.7.0 → 0.9.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.
@@ -78,6 +78,83 @@ BEFORE using ANY component, you MUST read its guidelines file first:
78
78
 
79
79
  **DO NOT write code using a component until you have read its specific guidelines.**
80
80
 
81
+ ## CRITICAL: Working with Figma Designs
82
+
83
+ **When building from a Figma frame, DO NOT pixel-match or extract values from the design.**
84
+
85
+ Instead, follow these rules:
86
+
87
+ ### NEVER Do This:
88
+
89
+ - ❌ Extract hex colors from the Figma design (e.g., `#4A4A4A`, `#f5f1eb`)
90
+ - ❌ Copy exact pixel values for spacing (e.g., `padding: '20px 10px'`)
91
+ - ❌ Copy exact font sizes (e.g., `fontSize: '16px'`)
92
+ - ❌ Copy exact border radius values (e.g., `borderRadius: '13px'`)
93
+ - ❌ Create inline SVGs for logos or icons
94
+ - ❌ Override component styles with `className={css({...})}` containing hardcoded values
95
+ - ❌ Use `<span>` or `<div>` when a design system component exists
96
+
97
+ ### ALWAYS Do This:
98
+
99
+ - ✅ Map visual colors to semantic tokens (green → `primary`, light bg → `surface`)
100
+ - ✅ Use spacing tokens (`sm`, `md`, `lg`) not pixel values
101
+ - ✅ Use typography tokens (`bodyMedium`, `titleLarge`) not font sizes
102
+ - ✅ Use radius tokens (`small`, `medium`, `large`) not pixel values
103
+ - ✅ Use placeholder elements or icon components for logos/icons
104
+ - ✅ Use component variants (`variant="filled"`) not style overrides
105
+ - ✅ Use `<Badge>` component, not styled spans
106
+ - ✅ Use `<Button>` component, not styled divs
107
+
108
+ ### Color Mapping Guide
109
+
110
+ When you see these colors in a Figma design, use these tokens:
111
+
112
+ | Figma Color | Semantic Token | Usage |
113
+ | -------------------- | ------------------------------- | --------------------------- |
114
+ | Green/olive tones | `primary` | Brand color, CTAs |
115
+ | Light cream/beige | `surface` or `surfaceContainer` | Backgrounds |
116
+ | Dark gray/black text | `onSurface` | Primary text |
117
+ | Medium gray text | `onSurfaceVariant` | Secondary text |
118
+ | White | `onPrimary` | Text on primary backgrounds |
119
+ | Borders/dividers | `outline` or `outlineVariant` | Borders |
120
+ | Error/red tones | `error` | Error states |
121
+
122
+ ### Component Override Rules
123
+
124
+ **Acceptable overrides:**
125
+
126
+ ```tsx
127
+ // ✅ OK - Layout positioning only
128
+ <Card.Root className={css({ width: '100%', maxWidth: '400px' })}>
129
+ ```
130
+
131
+ **Unacceptable overrides:**
132
+
133
+ ```tsx
134
+ // ❌ WRONG - Overriding colors, fonts, spacing
135
+ <Card.Root className={css({ bg: '#f5f1eb', borderRadius: '13px', padding: '20px' })}>
136
+ ```
137
+
138
+ ### Logo and Icon Handling
139
+
140
+ - **Logos**: Use a placeholder `<div>` with text or import from an assets folder. NEVER create inline SVGs.
141
+ - **Icons**: Use Lucide React icons or a placeholder. NEVER create custom SVG icon components.
142
+
143
+ ```tsx
144
+ // ✅ OK - Placeholder for logo
145
+ <div className={css({ display: 'flex', alignItems: 'center', gap: 'sm' })}>
146
+ <span>🎯</span>
147
+ <span>Discourser</span>
148
+ </div>;
149
+
150
+ // ❌ WRONG - Inline SVG
151
+ function Logo() {
152
+ return <svg>...</svg>; // Never do this
153
+ }
154
+ ```
155
+
156
+ ---
157
+
81
158
  ## Core Principles
82
159
 
83
160
  - **Always prefer design system components** over native HTML elements
@@ -87,6 +164,7 @@ BEFORE using ANY component, you MUST read its guidelines file first:
87
164
  - **Never use inline styles** with raw color values
88
165
  - **Read component guidelines** before using any component
89
166
  - **Follow common patterns** documented in overview-patterns.md
167
+ - **Map Figma designs to tokens** — never extract exact values
90
168
 
91
169
  ## Quick Start
92
170
 
@@ -0,0 +1,57 @@
1
+ Overall Goal
2
+ The primary objective is to successfully integrate your local
3
+ @discourser/design-system with Figma Make by creating a set of "guidelines"
4
+ that allows Figma's AI to generate accurate, production-ready code based on
5
+ your design system.
6
+
7
+ The Core Problem
8
+ Your initial attempt at providing guidelines was unsuccessful because their
9
+ total size was massive (~839 KB across 33 files). This far exceeds the context
10
+ window that Figma Make's AI can effectively handle, leading to it ignoring the
11
+ rules, hallucinating incorrect code (like using Tailwind CSS), or failing
12
+ entirely.
13
+
14
+ The Solution: "Minimal Guidelines" (exp/v1)
15
+ The core strategy you and Claude developed was to abandon the comprehensive
16
+ documentation approach and instead create a hyper-efficient, minimal set of
17
+ guidelines focused on fixing the most common failure modes.
18
+
19
+ This new version, stored in guidelines/exp/v1/, has the following
20
+ characteristics:
21
+
22
+ - Drastic Size Reduction: The guidelines were shrunk by 99.2%, from ~839 KB
23
+ down to just ~6.9 KB.
24
+ - Fewer Files: The structure was simplified from 33 files to just 2 core
25
+ instruction files and a testing log:
26
+ - Guidelines.md (1.3 KB): The main entry point containing only the most
27
+ critical, non-negotiable rules.
28
+ - quick-ref.md (5.6 KB): A "cheat sheet" containing decision trees,
29
+ correct import patterns, and barebones examples for key components,
30
+ prioritizing structure over prose.
31
+ - TESTING-LOG.md (6.7 KB): A pre-made template to systematically log the
32
+ results of your tests.
33
+ - Focus on Critical Failures: The new guidelines prioritize telling the AI
34
+ how to avoid common mistakes, specifically:
35
+ 1. How to correctly use compound components (e.g., always use
36
+ `<Card.Root>`).
37
+ 2. How to correctly apply the `colorPalette` prop to buttons.
38
+ 3. To use the design system's styling functions, not Tailwind CSS.
39
+
40
+ The Action Plan: Structured Testing
41
+ A clear, scientific testing plan was established to validate the new minimal
42
+ guidelines.
43
+
44
+ 1. Test A (Experimental): Use the new, minimal exp/v1 guidelines.
45
+ 2. Test B (Control): Use a small subset of the original, large guidelines to
46
+ prove they are less effective.
47
+ 3. Standardized Prompts: Run a set of specific, repeatable prompts for both
48
+ tests, such as:
49
+ - "Create a Card with a title and a primary button"
50
+ - "Create a login form with email, password inputs and submit button"
51
+ 4. Success Metrics: Use the TESTING-LOG.md template to track pass/fail
52
+ criteria for each prompt, noting:
53
+ - Were the imports correct?
54
+ - Was .Root used for compound components?
55
+ - Was colorPalette used correctly?
56
+ - Was Tailwind CSS avoided?
57
+ - How long did it take?
@@ -0,0 +1,66 @@
1
+ # Discourser Design System
2
+
3
+ Package: `@discourser/design-system`
4
+
5
+ ## CRITICAL RULES
6
+
7
+ 1. **ALWAYS** import from `@discourser/design-system`
8
+ 2. **NEVER** use Tailwind classes or raw CSS values
9
+ 3. **NEVER** create custom components when design system components exist
10
+ 4. **ALWAYS** use `.Root` for compound components (Card, Dialog, Switch, etc.)
11
+
12
+ ## Two Component Types
13
+
14
+ ### Simple Components (use directly)
15
+
16
+ ```tsx
17
+ <Button variant="solid" colorPalette="primary">Click</Button>
18
+ <Heading as="h1" size="2xl">Title</Heading>
19
+ <Input label="Email" />
20
+ ```
21
+
22
+ ### Compound Components (MUST use .Root)
23
+
24
+ ```tsx
25
+ <Card.Root>...</Card.Root>
26
+ <Dialog.Root>...</Dialog.Root>
27
+ <Switch.Root>...</Switch.Root>
28
+ ```
29
+
30
+ ⚠️ `<Card>Content</Card>` = RUNTIME ERROR. Must be `<Card.Root>Content</Card.Root>`
31
+
32
+ ## Import Pattern
33
+
34
+ ```tsx
35
+ import {
36
+ Button,
37
+ Heading,
38
+ Input,
39
+ Textarea,
40
+ Badge,
41
+ Spinner,
42
+ Card,
43
+ Dialog,
44
+ Switch,
45
+ Checkbox,
46
+ Select,
47
+ Tabs,
48
+ Avatar,
49
+ } from '@discourser/design-system';
50
+ import { css } from '@discourser/design-system/styled-system/css';
51
+ ```
52
+
53
+ ## Styling
54
+
55
+ ```tsx
56
+ // ✅ CORRECT - semantic tokens
57
+ css({ bg: 'surface', color: 'onSurface', p: 'lg', gap: 'md' });
58
+
59
+ // ❌ WRONG - raw values
60
+ css({ bg: '#fff', padding: '24px' });
61
+ className = 'bg-white p-6';
62
+ ```
63
+
64
+ ## Quick Reference Tables
65
+
66
+ See: [quick-ref.md](quick-ref.md) for component selection and variants.
@@ -0,0 +1,307 @@
1
+ # Figma Make Testing Session Log
2
+
3
+ **Date:** 2025-01-16
4
+ **Package:** `@discourser/design-system@0.2.2`
5
+ **Tester:** Will Streeter
6
+
7
+ ---
8
+
9
+ ## Session Overview
10
+
11
+ | Test | Guidelines Version | Total Size | Result |
12
+ | ---- | ---------------------------------------------------- | ---------- | ---------- |
13
+ | A | exp/v1 | 6.9 KB | ⬜ Pending |
14
+ | B | Current subset (Guidelines.md + overview-imports.md) | ~16 KB | ⬜ Pending |
15
+ | C | No guidelines (baseline) | 0 KB | ⬜ Pending |
16
+
17
+ ---
18
+
19
+ ## Test A: Minimal Guidelines (exp/v1)
20
+
21
+ **Setup:**
22
+
23
+ - [ ] Created new Figma Make file
24
+ - [ ] Installed `@discourser/design-system`
25
+ - [ ] Added `guidelines/Guidelines.md` from exp/v1
26
+ - [ ] Added `guidelines/quick-ref.md` from exp/v1
27
+
28
+ ### Prompt 1: Card with Button
29
+
30
+ **Prompt:** "Create a Card with a title and a primary button"
31
+
32
+ | Criteria | Pass | Fail | Notes |
33
+ | ----------------------------------- | ---- | ---- | ----- |
34
+ | Correct import path | ⬜ | ⬜ | |
35
+ | Used `Card.Root` (not `<Card>`) | ⬜ | ⬜ | |
36
+ | Used `Card.Title` or `Card.Header` | ⬜ | ⬜ | |
37
+ | Button has `colorPalette="primary"` | ⬜ | ⬜ | |
38
+ | Button has valid variant | ⬜ | ⬜ | |
39
+ | No Tailwind classes | ⬜ | ⬜ | |
40
+ | Uses `css()` with semantic tokens | ⬜ | ⬜ | |
41
+
42
+ **Time to complete:** \_\_\_ seconds / ⬜ Timeout
43
+
44
+ **Actual output (paste key snippet):**
45
+
46
+ ```tsx
47
+
48
+ ```
49
+
50
+ **Notes:**
51
+
52
+ ---
53
+
54
+ ### Prompt 2: Login Form
55
+
56
+ **Prompt:** "Create a login form with email and password inputs and a submit button"
57
+
58
+ | Criteria | Pass | Fail | Notes |
59
+ | --------------------------------- | ---- | ---- | ----- |
60
+ | Correct import path | ⬜ | ⬜ | |
61
+ | Used `<Input>` component (simple) | ⬜ | ⬜ | |
62
+ | Input has `label` prop | ⬜ | ⬜ | |
63
+ | Button has `colorPalette` | ⬜ | ⬜ | |
64
+ | Button has `type="submit"` | ⬜ | ⬜ | |
65
+ | No Tailwind classes | ⬜ | ⬜ | |
66
+ | Uses `css()` with semantic tokens | ⬜ | ⬜ | |
67
+
68
+ **Time to complete:** \_\_\_ seconds / ⬜ Timeout
69
+
70
+ **Actual output (paste key snippet):**
71
+
72
+ ```tsx
73
+
74
+ ```
75
+
76
+ **Notes:**
77
+
78
+ ---
79
+
80
+ ### Prompt 3: Delete Confirmation Dialog
81
+
82
+ **Prompt:** "Create a dialog for confirming a delete action"
83
+
84
+ | Criteria | Pass | Fail | Notes |
85
+ | ---------------------------------------------------- | ---- | ---- | ----- |
86
+ | Correct import path | ⬜ | ⬜ | |
87
+ | Used `Dialog.Root` (not `<Dialog>`) | ⬜ | ⬜ | |
88
+ | Used `Dialog.Trigger` | ⬜ | ⬜ | |
89
+ | Used `Dialog.Content` | ⬜ | ⬜ | |
90
+ | Used `Dialog.Title` | ⬜ | ⬜ | |
91
+ | Cancel button: `variant="outline"` or `"plain"` | ⬜ | ⬜ | |
92
+ | Delete button: `colorPalette="error"` or `"primary"` | ⬜ | ⬜ | |
93
+ | No Tailwind classes | ⬜ | ⬜ | |
94
+
95
+ **Time to complete:** \_\_\_ seconds / ⬜ Timeout
96
+
97
+ **Actual output (paste key snippet):**
98
+
99
+ ```tsx
100
+
101
+ ```
102
+
103
+ **Notes:**
104
+
105
+ ---
106
+
107
+ ### Test A Summary
108
+
109
+ | Prompt | Pass Rate | Critical Failures |
110
+ | ---------------- | --------- | ----------------- |
111
+ | Card with Button | /7 | |
112
+ | Login Form | /7 | |
113
+ | Delete Dialog | /8 | |
114
+ | **Total** | /22 | |
115
+
116
+ **Overall Assessment:** ⬜ Usable / ⬜ Needs Work / ⬜ Failed
117
+
118
+ **Key Observations:**
119
+
120
+ ---
121
+
122
+ ## Test B: Current Guidelines Subset
123
+
124
+ **Setup:**
125
+
126
+ - [ ] Created new Figma Make file
127
+ - [ ] Installed `@discourser/design-system`
128
+ - [ ] Added `guidelines/Guidelines.md` (current ~5.8KB)
129
+ - [ ] Added `guidelines/overview-imports.md` (current ~10.4KB)
130
+
131
+ ### Prompt 1: Card with Button
132
+
133
+ **Prompt:** "Create a Card with a title and a primary button"
134
+
135
+ | Criteria | Pass | Fail | Notes |
136
+ | ----------------------------------- | ---- | ---- | ----- |
137
+ | Correct import path | ⬜ | ⬜ | |
138
+ | Used `Card.Root` (not `<Card>`) | ⬜ | ⬜ | |
139
+ | Used `Card.Title` or `Card.Header` | ⬜ | ⬜ | |
140
+ | Button has `colorPalette="primary"` | ⬜ | ⬜ | |
141
+ | Button has valid variant | ⬜ | ⬜ | |
142
+ | No Tailwind classes | ⬜ | ⬜ | |
143
+ | Uses `css()` with semantic tokens | ⬜ | ⬜ | |
144
+
145
+ **Time to complete:** \_\_\_ seconds / ⬜ Timeout
146
+
147
+ **Actual output (paste key snippet):**
148
+
149
+ ```tsx
150
+
151
+ ```
152
+
153
+ **Notes:**
154
+
155
+ ---
156
+
157
+ ### Prompt 2: Login Form
158
+
159
+ **Prompt:** "Create a login form with email and password inputs and a submit button"
160
+
161
+ | Criteria | Pass | Fail | Notes |
162
+ | --------------------------------- | ---- | ---- | ----- |
163
+ | Correct import path | ⬜ | ⬜ | |
164
+ | Used `<Input>` component (simple) | ⬜ | ⬜ | |
165
+ | Input has `label` prop | ⬜ | ⬜ | |
166
+ | Button has `colorPalette` | ⬜ | ⬜ | |
167
+ | Button has `type="submit"` | ⬜ | ⬜ | |
168
+ | No Tailwind classes | ⬜ | ⬜ | |
169
+ | Uses `css()` with semantic tokens | ⬜ | ⬜ | |
170
+
171
+ **Time to complete:** \_\_\_ seconds / ⬜ Timeout
172
+
173
+ **Actual output (paste key snippet):**
174
+
175
+ ```tsx
176
+
177
+ ```
178
+
179
+ **Notes:**
180
+
181
+ ---
182
+
183
+ ### Prompt 3: Delete Confirmation Dialog
184
+
185
+ **Prompt:** "Create a dialog for confirming a delete action"
186
+
187
+ | Criteria | Pass | Fail | Notes |
188
+ | ---------------------------------------------------- | ---- | ---- | ----- |
189
+ | Correct import path | ⬜ | ⬜ | |
190
+ | Used `Dialog.Root` (not `<Dialog>`) | ⬜ | ⬜ | |
191
+ | Used `Dialog.Trigger` | ⬜ | ⬜ | |
192
+ | Used `Dialog.Content` | ⬜ | ⬜ | |
193
+ | Used `Dialog.Title` | ⬜ | ⬜ | |
194
+ | Cancel button: `variant="outline"` or `"plain"` | ⬜ | ⬜ | |
195
+ | Delete button: `colorPalette="error"` or `"primary"` | ⬜ | ⬜ | |
196
+ | No Tailwind classes | ⬜ | ⬜ | |
197
+
198
+ **Time to complete:** \_\_\_ seconds / ⬜ Timeout
199
+
200
+ **Actual output (paste key snippet):**
201
+
202
+ ```tsx
203
+
204
+ ```
205
+
206
+ **Notes:**
207
+
208
+ ---
209
+
210
+ ### Test B Summary
211
+
212
+ | Prompt | Pass Rate | Critical Failures |
213
+ | ---------------- | --------- | ----------------- |
214
+ | Card with Button | /7 | |
215
+ | Login Form | /7 | |
216
+ | Delete Dialog | /8 | |
217
+ | **Total** | /22 | |
218
+
219
+ **Overall Assessment:** ⬜ Usable / ⬜ Needs Work / ⬜ Failed
220
+
221
+ **Key Observations:**
222
+
223
+ ---
224
+
225
+ ## Test C: No Guidelines (Baseline)
226
+
227
+ **Setup:**
228
+
229
+ - [ ] Created new Figma Make file
230
+ - [ ] Installed `@discourser/design-system`
231
+ - [ ] NO guidelines folder added
232
+
233
+ ### Prompt 1: Card with Button
234
+
235
+ **Prompt:** "Create a Card with a title and a primary button using @discourser/design-system"
236
+
237
+ | Criteria | Pass | Fail | Notes |
238
+ | ---------------------------------- | ---- | ---- | ----- |
239
+ | Correct import path | ⬜ | ⬜ | |
240
+ | Used `Card.Root` (not `<Card>`) | ⬜ | ⬜ | |
241
+ | Used `Card.Title` or `Card.Header` | ⬜ | ⬜ | |
242
+ | Button has `colorPalette` | ⬜ | ⬜ | |
243
+ | Button has valid variant | ⬜ | ⬜ | |
244
+ | No Tailwind classes | ⬜ | ⬜ | |
245
+
246
+ **Time to complete:** \_\_\_ seconds / ⬜ Timeout
247
+
248
+ **Actual output (paste key snippet):**
249
+
250
+ ```tsx
251
+
252
+ ```
253
+
254
+ **Notes:**
255
+
256
+ ---
257
+
258
+ ### Test C Summary
259
+
260
+ | Prompt | Pass Rate | Critical Failures |
261
+ | ---------------- | --------- | ----------------- |
262
+ | Card with Button | /6 | |
263
+ | **Total** | /6 | |
264
+
265
+ **Overall Assessment:** ⬜ Usable / ⬜ Needs Work / ⬜ Failed
266
+
267
+ **Key Observations:**
268
+
269
+ ---
270
+
271
+ ## Comparison Summary
272
+
273
+ | Test | Guidelines Size | Pass Rate | Timeouts | Best For |
274
+ | ------------------ | --------------- | --------- | -------- | -------- |
275
+ | A (exp/v1) | 6.9 KB | /22 | | |
276
+ | B (Current subset) | ~16 KB | /22 | | |
277
+ | C (No guidelines) | 0 KB | /6 | | |
278
+
279
+ ---
280
+
281
+ ## Key Findings
282
+
283
+ ### What Worked
284
+
285
+ ### What Failed
286
+
287
+ ### Recommendations for exp/v2
288
+
289
+ ---
290
+
291
+ ## Iteration Notes
292
+
293
+ Use this section to track specific fixes needed:
294
+
295
+ | Issue | Guideline Fix | Priority |
296
+ | ----- | ------------- | -------- |
297
+ | | | |
298
+ | | | |
299
+ | | | |
300
+
301
+ ---
302
+
303
+ ## Next Steps
304
+
305
+ - [ ]
306
+ - [ ]
307
+ - [ ]