@discourser/design-system 0.22.2 → 0.22.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/dist/figma-codex.json +2 -2
- package/docs/CSS_USAGE.md +235 -0
- package/docs/FIGMA_MAKE_SETUP.md +339 -0
- package/docs/GUIDELINES_REVIEW.md +728 -0
- package/docs/MAINTAINER_CHECKLIST.md +265 -0
- package/docs/TESTING_QUICK_REFERENCE.md +159 -0
- package/docs/TESTING_TOKENS.md +340 -0
- package/docs/active-stories/README.md +29 -0
- package/docs/active-stories/STORY-006a-figma-translation-foundations.md +324 -0
- package/docs/active-stories/STORY-006b-figma-translation-components.md +201 -0
- package/docs/active-stories/STORY-006c-figma-translation-layout-extension.md +258 -0
- package/docs/active-stories/STORY-008-kai-sidecar-fragments.md +137 -0
- package/docs/active-stories/STORY-011-verify-translation-docs.md +182 -0
- package/docs/archive/ARCHITECTURE-discourser-design-system.md +448 -0
- package/docs/claude-feed-back/ARCHITECTURE_DIAGRAM.md +243 -0
- package/docs/claude-feed-back/STYLING_VERIFICATION.md +89 -0
- package/docs/claude-feed-back/TEST_RESULTS.md +182 -0
- package/docs/context-share/ELEVATION_FIX_PLAN.md +903 -0
- package/docs/context-share/STORY-001-VALIDATION-PASSED.md +192 -0
- package/docs/context-share/STORY-002-IMPLEMENTATION-COMPLETE.md +161 -0
- package/docs/context-share/STORYBOOK_MCP_STRATEGY.md +867 -0
- package/docs/context-share/TESTING_GAPS_FILLED.md +353 -0
- package/docs/context-share/TOKEN_TESTING_SUMMARY.md +388 -0
- package/docs/context-share/code-connect-prompt.md +90 -0
- package/docs/context-share/dds-autonomous-pipeline.md +765 -0
- package/docs/context-share/fix-checkbox-radio-tokens.md +145 -0
- package/docs/context-share/icon-component-prompt.md +154 -0
- package/docs/context-share/icons/Audience.svg +3 -0
- package/docs/context-share/icons/AudioSpeaker.svg +3 -0
- package/docs/context-share/icons/BookmarkPlus.svg +3 -0
- package/docs/context-share/icons/ClipBoard.svg +8 -0
- package/docs/context-share/icons/DiscourserLogo.svg +4 -0
- package/docs/context-share/icons/ExitStudio.svg +4 -0
- package/docs/context-share/icons/Microphone.svg +5 -0
- package/docs/context-share/icons/NotebookPen.svg +3 -0
- package/docs/context-share/icons/PausePlay.svg +5 -0
- package/docs/context-share/icons/Play.svg +4 -0
- package/docs/context-share/icons/Record.svg +6 -0
- package/docs/context-share/icons/RepeatQuestion.svg +3 -0
- package/docs/context-share/icons/ScrollText.svg +3 -0
- package/docs/context-share/icons/Sparkles.svg +3 -0
- package/docs/context-share/icons/Speech.svg +3 -0
- package/docs/context-share/icons/StopPlay.svg +4 -0
- package/docs/context-share/icons/Timer.svg +3 -0
- package/docs/context-share/icons/UserProfile.svg +3 -0
- package/docs/context-share/m3-token-pipeline-audit.md +125 -0
- package/docs/context-share/storybook-mcp-kai-agent-revised-summary.md +211 -0
- package/docs/discourser-design-system-prd.md +3698 -0
- package/docs/figma-captures/01-typography.png +0 -0
- package/docs/figma-captures/02-button-iconbutton.png +0 -0
- package/docs/figma-captures/03-form-inputs.png +0 -0
- package/docs/figma-captures/04-form-controls.png +0 -0
- package/docs/figma-captures/05-data-display.png +0 -0
- package/docs/figma-captures/06-feedback.png +0 -0
- package/docs/figma-captures/07-overlays.png +0 -0
- package/docs/figma-captures/08-navigation-layout.png +0 -0
- package/docs/figma-captures/09-custom-components.png +0 -0
- package/docs/figma-captures/10-scenario-queue.png +0 -0
- package/docs/figma-captures/11-icon-library.png +0 -0
- package/docs/figma-make-docs/01-understanding-templates.md +235 -0
- package/docs/figma-make-docs/02-prerequisites.md +266 -0
- package/docs/figma-make-docs/03-creating-template.md +306 -0
- package/docs/figma-make-docs/04-adding-guidelines.md +448 -0
- package/docs/figma-make-docs/05-example-starter-code.md +590 -0
- package/docs/figma-make-docs/06-publishing-template.md +417 -0
- package/docs/figma-make-docs/07-maintenance.md +536 -0
- package/docs/figma-make-docs/08-faq.md +490 -0
- package/docs/figma-make-docs/README.md +95 -0
- package/docs/material-theme.json +418 -0
- package/docs/plans/2026-03-12-figma-token-export-rewrite.md +504 -0
- package/docs/plans/2026-03-12-step7-panda-token-resolution-design.md +119 -0
- package/docs/plans/2026-03-12-step7-panda-token-resolution.md +993 -0
- package/docs/token-name-mapping.json +850 -0
- package/docs/token-name-mapping.md +251 -0
- package/package.json +3 -2
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# STORY-006b: Figma Translation System — Component Mappings (05)
|
|
2
|
+
|
|
3
|
+
> **Epic:** Kai Agent — Design System MCP Integration
|
|
4
|
+
> **Parent Story:** STORY-006: Figma-to-Discourser Translation System
|
|
5
|
+
> **Part:** 2 of 3
|
|
6
|
+
> **Depends on:** STORY-006a (files 00-04 must exist)
|
|
7
|
+
> **Estimate:** 2-3hr
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Context
|
|
12
|
+
|
|
13
|
+
This prompt creates the **component registry** — the most comprehensive file in the translation suite. It maps every Discourser component from its Figma/Shadcn equivalent, including props, variants, import paths, and compound component anatomy.
|
|
14
|
+
|
|
15
|
+
**This file must be accurate.** Every import path, prop name, variant value, and compound anatomy must come from reading the actual source files — not from memory or guessing.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Prerequisites — READ THESE FIRST
|
|
20
|
+
|
|
21
|
+
Before writing ANY code, read these files in this order:
|
|
22
|
+
|
|
23
|
+
1. **`src/components/index.ts`** — The complete list of exported components. Every component here MUST appear in the mapping.
|
|
24
|
+
2. **`panda.config.ts`** — Check the `recipes` and `slotRecipes` sections to know which components are simple (recipe) vs compound (slotRecipe).
|
|
25
|
+
3. **Read each component's guideline MDX** in `stories/documentation/guidelines/components/` — these have variant tables, prop lists, and usage guidance.
|
|
26
|
+
4. **Read each component's `.stories.tsx`** in `stories/` — these show actual prop values and usage patterns.
|
|
27
|
+
5. **Read the source file** for each component in `src/components/` — for compound components, this shows the exact anatomy (Root, Trigger, Content, etc.).
|
|
28
|
+
6. **`stories/documentation/figma-translation/00-FigmaTranslation.mdx`** — Read the overview from STORY-006a to understand the document conventions and architecture.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Deliverable
|
|
33
|
+
|
|
34
|
+
Create one file: `stories/documentation/figma-translation/05-Components.mdx`
|
|
35
|
+
|
|
36
|
+
**Storybook sidebar:** `Documentation/Figma Translation/05-Components`
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
40
|
+
<Meta title="Documentation/Figma Translation/05-Components" />
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Structure
|
|
44
|
+
|
|
45
|
+
Organize components into these groups:
|
|
46
|
+
|
|
47
|
+
1. **Interactive Elements:** Button, IconButton, Input, InputGroup, InputAddon, Textarea, Select, Checkbox, RadioGroup, Switch, Slider
|
|
48
|
+
2. **Layout & Containers:** Card, Accordion, Drawer, Tabs, Stepper
|
|
49
|
+
3. **Feedback & Status:** Badge, Avatar, Progress, Skeleton, Spinner, Toast
|
|
50
|
+
4. **Overlays:** Dialog, Popover, Tooltip
|
|
51
|
+
5. **Typography:** Header
|
|
52
|
+
6. **Utility:** CloseButton, Group, AbsoluteCenter, Icon, Loader
|
|
53
|
+
|
|
54
|
+
### Per-Component Format
|
|
55
|
+
|
|
56
|
+
For **simple components** (recipe — listed in `panda.config.ts` under `recipes`):
|
|
57
|
+
|
|
58
|
+
```markdown
|
|
59
|
+
### [ComponentName]
|
|
60
|
+
|
|
61
|
+
**Maps from:** [Figma equivalent], [Shadcn equivalent if applicable]
|
|
62
|
+
**Import:** `import { [ComponentName] } from '@discourser/design-system'`
|
|
63
|
+
**Type:** Simple (recipe)
|
|
64
|
+
|
|
65
|
+
| Source (Figma/Shadcn) Prop | Discourser Prop | Values | Notes |
|
|
66
|
+
|---|---|---|---|
|
|
67
|
+
| [external prop] | [discourser prop] | [available values] | [mapping notes] |
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
For **compound components** (slotRecipe — listed in `panda.config.ts` under `slotRecipes`):
|
|
71
|
+
|
|
72
|
+
```markdown
|
|
73
|
+
### [ComponentName]
|
|
74
|
+
|
|
75
|
+
**Maps from:** [Figma equivalent], [Shadcn equivalent if applicable]
|
|
76
|
+
**Import:** `import { [ComponentName] } from '@discourser/design-system'`
|
|
77
|
+
**Type:** Compound (slot recipe)
|
|
78
|
+
|
|
79
|
+
**Anatomy:**
|
|
80
|
+
- `<ComponentName.Root>` — [purpose]
|
|
81
|
+
- `<ComponentName.Part>` — [purpose]
|
|
82
|
+
- ...
|
|
83
|
+
|
|
84
|
+
| Source (Shadcn) | Discourser | Notes |
|
|
85
|
+
|---|---|---|
|
|
86
|
+
| `<ShadcnPart>` | `<ComponentName.Part>` | [mapping notes] |
|
|
87
|
+
|
|
88
|
+
| Source Prop | Discourser Prop | Values | Notes |
|
|
89
|
+
|---|---|---|---|
|
|
90
|
+
| [external prop] | [discourser prop] | [available values] | [notes] |
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Detailed Mapping Requirements
|
|
94
|
+
|
|
95
|
+
Here's what MUST be covered for key components. For each, read the actual source file and guideline MDX:
|
|
96
|
+
|
|
97
|
+
**Button** (recipe):
|
|
98
|
+
- Variant mapping: Shadcn "default" → Discourser "solid", "destructive" → `colorPalette="error"` (color, not variant)
|
|
99
|
+
- All variant values from recipe: solid, outline, ghost, subtle, elevated (verify against actual recipe)
|
|
100
|
+
- All size values from recipe (verify against actual recipe)
|
|
101
|
+
- Note that `colorPalette` prop changes the color theme, not a variant
|
|
102
|
+
|
|
103
|
+
**Card** (slotRecipe):
|
|
104
|
+
- Anatomy: Root, Header, Body, Footer, Title, Description
|
|
105
|
+
- Shadcn `<Card>` → `<Card.Root>`, `<CardHeader>` → `<Card.Header>`, etc.
|
|
106
|
+
- Note that Card is compound in Discourser but flat in Shadcn
|
|
107
|
+
|
|
108
|
+
**Dialog** (slotRecipe):
|
|
109
|
+
- Anatomy: Root, Trigger, Backdrop, Positioner, Content, Title, Description, CloseTrigger
|
|
110
|
+
- Critical: Shadcn `<DialogContent>` → `<Dialog.Positioner><Dialog.Content>` (needs positioner wrapper)
|
|
111
|
+
- Shadcn `<DialogHeader>` → `<VStack gap="1.5">` (no dedicated component — use layout)
|
|
112
|
+
- Shadcn `<DialogFooter>` → `<HStack gap="3" justify="flex-end">` (no dedicated component — use layout)
|
|
113
|
+
|
|
114
|
+
**Select** (slotRecipe):
|
|
115
|
+
- Full compound anatomy from Ark UI
|
|
116
|
+
- Shadcn Select is much simpler — note the structural differences
|
|
117
|
+
|
|
118
|
+
**Drawer** (slotRecipe):
|
|
119
|
+
- Similar to Dialog but with slide-in behavior
|
|
120
|
+
- Map Shadcn Sheet → Discourser Drawer
|
|
121
|
+
|
|
122
|
+
**Input / InputGroup / InputAddon**:
|
|
123
|
+
- Show how Shadcn's simple `<Input>` maps to potential InputGroup + InputAddon composition
|
|
124
|
+
- Variant and size mappings
|
|
125
|
+
|
|
126
|
+
**Toast** (slotRecipe):
|
|
127
|
+
- Programmatic API: `toaster.create()` vs Shadcn's `toast()`
|
|
128
|
+
- Show the different invocation pattern
|
|
129
|
+
|
|
130
|
+
**Accordion** (slotRecipe):
|
|
131
|
+
- Anatomy from Ark UI compound pattern
|
|
132
|
+
|
|
133
|
+
For ALL other components: read the source, guideline, and story to produce accurate mappings. Do not skip any component exported from `src/components/index.ts`.
|
|
134
|
+
|
|
135
|
+
### Common Mistakes Section
|
|
136
|
+
|
|
137
|
+
Include at the bottom:
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
// ❌ WRONG: Using flat Shadcn pattern for compound Discourser component
|
|
141
|
+
<Dialog>
|
|
142
|
+
<DialogContent>...</DialogContent>
|
|
143
|
+
</Dialog>
|
|
144
|
+
|
|
145
|
+
// ✅ CORRECT: Using Ark UI compound pattern
|
|
146
|
+
<Dialog.Root>
|
|
147
|
+
<Dialog.Trigger>Open</Dialog.Trigger>
|
|
148
|
+
<Dialog.Backdrop />
|
|
149
|
+
<Dialog.Positioner>
|
|
150
|
+
<Dialog.Content>...</Dialog.Content>
|
|
151
|
+
</Dialog.Positioner>
|
|
152
|
+
</Dialog.Root>
|
|
153
|
+
|
|
154
|
+
// ❌ WRONG: Using "destructive" as a variant
|
|
155
|
+
<Button variant="destructive">Delete</Button>
|
|
156
|
+
|
|
157
|
+
// ✅ CORRECT: Using colorPalette for destructive intent
|
|
158
|
+
<Button variant="solid" colorPalette="error">Delete</Button>
|
|
159
|
+
|
|
160
|
+
// ❌ WRONG: Importing from wrong path
|
|
161
|
+
import { Button } from '@ark-ui/react'
|
|
162
|
+
import { button } from '../preset/recipes/button'
|
|
163
|
+
|
|
164
|
+
// ✅ CORRECT: Importing from design system
|
|
165
|
+
import { Button } from '@discourser/design-system'
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Technical Requirements
|
|
171
|
+
|
|
172
|
+
1. **Read the actual source for every component** — Do not guess at anatomy, props, or variant values.
|
|
173
|
+
2. **Consistent table columns** — `Source (Figma/Shadcn) | Discourser | Notes` pattern maintained.
|
|
174
|
+
3. **Every import path must be `@discourser/design-system`** — this is the only valid import path for consumers.
|
|
175
|
+
4. **Cross-reference each component** to its guideline MDX with a link like: "See [Guidelines/99-Button] for full usage guidance."
|
|
176
|
+
5. **Verify against panda.config.ts** — recipe vs slotRecipe classification must match what's in config.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## DO NOT
|
|
181
|
+
|
|
182
|
+
- Change any existing files
|
|
183
|
+
- Modify any source code
|
|
184
|
+
- Install any packages
|
|
185
|
+
- Guess at component anatomy — read the source file
|
|
186
|
+
- Omit any component from `src/components/index.ts`
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Acceptance Criteria
|
|
191
|
+
|
|
192
|
+
- [ ] `05-Components.mdx` created with all components from `src/components/index.ts` mapped
|
|
193
|
+
- [ ] Components grouped by category (Interactive, Layout, Feedback, Overlays, Typography, Utility)
|
|
194
|
+
- [ ] Simple components have variant/size/prop tables from actual recipe definitions
|
|
195
|
+
- [ ] Compound components have full anatomy listing from actual source files
|
|
196
|
+
- [ ] Shadcn → Discourser structural mapping for all compound components (Dialog, Card, Select, etc.)
|
|
197
|
+
- [ ] Common Mistakes section with ❌/✅ patterns
|
|
198
|
+
- [ ] Every import path verified as `@discourser/design-system`
|
|
199
|
+
- [ ] Cross-references to existing guideline MDX docs
|
|
200
|
+
- [ ] Recipe vs slotRecipe classification matches `panda.config.ts`
|
|
201
|
+
- [ ] File renders in Storybook without MDX parse errors
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# STORY-006c: Figma Translation System — Layout Patterns + Extension Guide (06-07)
|
|
2
|
+
|
|
3
|
+
> **Epic:** Kai Agent — Design System MCP Integration
|
|
4
|
+
> **Parent Story:** STORY-006: Figma-to-Discourser Translation System
|
|
5
|
+
> **Part:** 3 of 3
|
|
6
|
+
> **Depends on:** STORY-006a (files 00-04) and STORY-006b (file 05)
|
|
7
|
+
> **Estimate:** 1.5-2hr
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Context
|
|
12
|
+
|
|
13
|
+
This prompt creates the final two files in the translation suite:
|
|
14
|
+
- **06-Layout.mdx** — Maps Figma auto-layout and Tailwind flex/grid to Panda CSS patterns. This subsumes the work originally planned for STORY-005 (Panda CSS Layout Pattern MDX Docs).
|
|
15
|
+
- **07-ExtensionGuide.mdx** — Templates and processes for maintaining the translation suite as the design system evolves. This is what makes the whole system sustainable.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Prerequisites — READ THESE FIRST
|
|
20
|
+
|
|
21
|
+
1. **All files created by STORY-006a and STORY-006b** — Read the existing translation files (00-05) to match conventions, column formats, and tone.
|
|
22
|
+
2. `stories/documentation/guidelines/overview-patterns.mdx` — Existing layout/composition patterns. Reference but don't duplicate.
|
|
23
|
+
3. `stories/documentation/guidelines/design-tokens/spacing.mdx` — Spacing scale (already mapped in 03-Spacing.mdx, reference for consistency).
|
|
24
|
+
4. `panda.config.ts` — Check available breakpoint conditions, global CSS settings.
|
|
25
|
+
5. `src/components/index.ts` — Full component list for completeness checks in extension guide.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Deliverables
|
|
30
|
+
|
|
31
|
+
### File 1: `stories/documentation/figma-translation/06-Layout.mdx`
|
|
32
|
+
|
|
33
|
+
**Storybook sidebar:** `Documentation/Figma Translation/06-Layout Patterns`
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
37
|
+
<Meta title="Documentation/Figma Translation/06-Layout Patterns" />
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Figma/Tailwind → Panda CSS layout mapping:**
|
|
41
|
+
|
|
42
|
+
| Source (Figma/Tailwind) | Discourser | When to Use |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| `flex flex-col` | `display="flex" flexDir="column"` or `<VStack>` | Vertical stacking |
|
|
45
|
+
| `flex flex-row` | `display="flex" flexDir="row"` or `<HStack>` | Horizontal layout |
|
|
46
|
+
| `flex flex-wrap` | `<Flex wrap="wrap">` | Wrapping items |
|
|
47
|
+
| `grid grid-cols-2` | `display="grid" gridTemplateColumns="repeat(2, 1fr)"` or `<Grid columns={2}>` | Fixed column grid |
|
|
48
|
+
| `grid grid-cols-3` | `<Grid columns={{ base: 1, md: 3 }}>` | Responsive grid |
|
|
49
|
+
| `items-center` | `alignItems="center"` | Same prop name |
|
|
50
|
+
| `justify-between` | `justifyContent="space-between"` | Same prop name |
|
|
51
|
+
| `justify-center` | `justifyContent="center"` | Same prop name |
|
|
52
|
+
| `container mx-auto` | `maxW="breakpoint-xl" mx="auto"` | Centered container |
|
|
53
|
+
| `w-full` | `w="full"` | Full width |
|
|
54
|
+
| `h-screen`, `min-h-screen` | `h="100vh"` or `minH="dvh"` | Full viewport height |
|
|
55
|
+
| `space-y-4` | `display="flex" flexDir="column" gap="4"` | Use gap, not space utilities |
|
|
56
|
+
| `space-x-4` | `display="flex" flexDir="row" gap="4"` | Use gap, not space utilities |
|
|
57
|
+
| `divide-y` | Individual `borderBottom` on items or use gap + border approach | No direct equivalent |
|
|
58
|
+
|
|
59
|
+
**VStack vs HStack vs Grid vs Flex decision tree:**
|
|
60
|
+
|
|
61
|
+
| Layout Need | Use | Example |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| Stack items vertically with uniform gap | `<VStack gap="...">` | Form fields, card list |
|
|
64
|
+
| Stack items horizontally with uniform gap | `<HStack gap="...">` | Button groups, icon + text |
|
|
65
|
+
| Items need to wrap to next line | `<Flex wrap="wrap" gap="...">` | Tags, chips, badges |
|
|
66
|
+
| Fixed column/row structure | `<Grid columns={...}>` | Card grid, dashboard |
|
|
67
|
+
| Complex alignment + spacing | `display="flex"` with props | Custom layouts |
|
|
68
|
+
|
|
69
|
+
**Responsive breakpoint translation:**
|
|
70
|
+
|
|
71
|
+
| Source (Tailwind) | Discourser (Panda CSS) | Min Width |
|
|
72
|
+
|---|---|---|
|
|
73
|
+
| `sm:` | `sm:` or `{ sm: value }` | 640px |
|
|
74
|
+
| `md:` | `md:` or `{ md: value }` | 768px |
|
|
75
|
+
| `lg:` | `lg:` or `{ lg: value }` | 1024px |
|
|
76
|
+
| `xl:` | `xl:` or `{ xl: value }` | 1280px |
|
|
77
|
+
| `2xl:` | `2xl:` or `{ '2xl': value }` | 1536px |
|
|
78
|
+
|
|
79
|
+
**Two responsive syntax forms** (show both):
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
// Object syntax (JSX props) — preferred for component props
|
|
83
|
+
<Box p={{ base: '4', md: '6', lg: '8' }}>
|
|
84
|
+
<Grid columns={{ base: 1, md: 2, lg: 3 }}>
|
|
85
|
+
|
|
86
|
+
// CSS utility syntax — preferred for css() calls
|
|
87
|
+
const styles = css({
|
|
88
|
+
p: { base: '4', md: '6', lg: '8' },
|
|
89
|
+
display: { base: 'block', md: 'grid' },
|
|
90
|
+
gridTemplateColumns: { md: 'repeat(2, 1fr)', lg: 'repeat(3, 1fr)' },
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Common page layout patterns** (from overview-patterns.mdx, translated):
|
|
95
|
+
|
|
96
|
+
Show 3-4 common compositions:
|
|
97
|
+
1. **Page shell** — sidebar + main content area
|
|
98
|
+
2. **Form layout** — VStack of labeled fields with action buttons
|
|
99
|
+
3. **Card grid** — responsive grid of Card components
|
|
100
|
+
4. **Centered content** — max-width container with centered content
|
|
101
|
+
|
|
102
|
+
For each, show the Figma auto-layout structure alongside the Discourser implementation.
|
|
103
|
+
|
|
104
|
+
**Common Mistakes** section:
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
// ❌ WRONG: Using Tailwind's space utilities
|
|
108
|
+
<div className="space-y-4">
|
|
109
|
+
|
|
110
|
+
// ✅ CORRECT: Using flex + gap
|
|
111
|
+
<VStack gap="4">
|
|
112
|
+
|
|
113
|
+
// ❌ WRONG: Fixed breakpoint values
|
|
114
|
+
<Box display={{ '640px': 'grid' }}>
|
|
115
|
+
|
|
116
|
+
// ✅ CORRECT: Named breakpoint tokens
|
|
117
|
+
<Box display={{ sm: 'grid' }}>
|
|
118
|
+
|
|
119
|
+
// ❌ WRONG: Using px for responsive queries
|
|
120
|
+
@media (min-width: 768px) { ... }
|
|
121
|
+
|
|
122
|
+
// ✅ CORRECT: Panda CSS responsive syntax
|
|
123
|
+
const styles = css({
|
|
124
|
+
flexDir: { base: 'column', md: 'row' }
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Cross-reference: Link to `Documentation/Guidelines/99-Overview Patterns` for complete composition examples.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
### File 2: `stories/documentation/figma-translation/07-ExtensionGuide.mdx`
|
|
133
|
+
|
|
134
|
+
**Storybook sidebar:** `Documentation/Figma Translation/07-Extension Guide`
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
138
|
+
<Meta title="Documentation/Figma Translation/07-Extension Guide" />
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
This file documents how to maintain and extend the translation suite. It's the "meta-doc" that ensures consistency as the design system evolves.
|
|
142
|
+
|
|
143
|
+
**Sections to include:**
|
|
144
|
+
|
|
145
|
+
#### 1. Adding a New Component Mapping
|
|
146
|
+
|
|
147
|
+
Provide the exact template:
|
|
148
|
+
|
|
149
|
+
```markdown
|
|
150
|
+
### [ComponentName]
|
|
151
|
+
|
|
152
|
+
**Maps from:** [Figma equivalent], [Shadcn equivalent]
|
|
153
|
+
**Import:** `import { [ComponentName] } from '@discourser/design-system'`
|
|
154
|
+
**Type:** Simple (recipe) | Compound (slot recipe)
|
|
155
|
+
**Added in:** v[X.Y.Z]
|
|
156
|
+
|
|
157
|
+
| Source (Figma/Shadcn) Prop | Discourser Prop | Values | Notes |
|
|
158
|
+
|---|---|---|---|
|
|
159
|
+
|
|
160
|
+
**Compound Anatomy (if applicable):**
|
|
161
|
+
- `<ComponentName.Root>` — [purpose]
|
|
162
|
+
- `<ComponentName.Part>` — [purpose]
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Step-by-step process:
|
|
166
|
+
1. Check if component is recipe or slotRecipe in `panda.config.ts`
|
|
167
|
+
2. Read source file in `src/components/[ComponentName].tsx` for anatomy
|
|
168
|
+
3. Read guideline MDX in `stories/documentation/guidelines/components/[name].mdx` for variants/props
|
|
169
|
+
4. Find the closest Shadcn equivalent (if any) from [shadcn/ui docs](https://ui.shadcn.com)
|
|
170
|
+
5. Add entry to `05-Components.mdx` in the appropriate group
|
|
171
|
+
6. Add cross-reference link to component's guideline MDX
|
|
172
|
+
|
|
173
|
+
#### 2. Adding a New Token Mapping
|
|
174
|
+
|
|
175
|
+
For each token type, specify which file to update:
|
|
176
|
+
|
|
177
|
+
| Token Type | File to Update | Table to Add Entry To |
|
|
178
|
+
|---|---|---|
|
|
179
|
+
| Background color | `01-Colors.mdx` | Background colors table |
|
|
180
|
+
| Text color | `01-Colors.mdx` | Text colors table |
|
|
181
|
+
| Border color | `01-Colors.mdx` | Border colors table |
|
|
182
|
+
| Typography | `02-Typography.mdx` | Text size or font mapping table |
|
|
183
|
+
| Spacing | `03-Spacing.mdx` | Numeric or named token table |
|
|
184
|
+
| Shadow | `04-Shadows-Radii.mdx` | Shadow mapping table |
|
|
185
|
+
| Border radius | `04-Shadows-Radii.mdx` | Border radius table |
|
|
186
|
+
|
|
187
|
+
Process:
|
|
188
|
+
1. Verify new token exists in `panda.config.ts` (run `pnpm prepare` to regenerate)
|
|
189
|
+
2. Find the closest Tailwind/Shadcn equivalent
|
|
190
|
+
3. Add row to appropriate table maintaining column format: Source | Discourser | Notes
|
|
191
|
+
4. Run verification test: `pnpm test -- --grep translation` (STORY-011)
|
|
192
|
+
|
|
193
|
+
#### 3. Adding a New Color Palette
|
|
194
|
+
|
|
195
|
+
When a new palette bridge is created (using `create-palette-bridge.ts`):
|
|
196
|
+
1. Add palette name to `01-Colors.mdx` colorPalette system section
|
|
197
|
+
2. Add background/text/border entries for the new palette
|
|
198
|
+
3. Update `05-Components.mdx` — any components that support `colorPalette` need the new value listed
|
|
199
|
+
4. Run verification tests
|
|
200
|
+
|
|
201
|
+
#### 4. Versioning & Maintenance
|
|
202
|
+
|
|
203
|
+
When to re-verify translation docs:
|
|
204
|
+
- Any change to `panda.config.ts` semantic tokens
|
|
205
|
+
- Any new component added to `src/components/index.ts`
|
|
206
|
+
- Any recipe/slotRecipe modification (new variants, renamed props)
|
|
207
|
+
- Any design system version bump
|
|
208
|
+
- After running `pnpm prepare` if token output changes
|
|
209
|
+
|
|
210
|
+
How to verify:
|
|
211
|
+
```bash
|
|
212
|
+
# Run all translation verification tests (STORY-011)
|
|
213
|
+
pnpm test -- --grep translation
|
|
214
|
+
|
|
215
|
+
# Or manually check Storybook render
|
|
216
|
+
pnpm storybook
|
|
217
|
+
# Navigate to Documentation/Figma Translation and verify each page
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
#### 5. Relationship to Kai Sidecar Knowledge
|
|
221
|
+
|
|
222
|
+
The translation MDX files are comprehensive (for human + MCP consumption). Kai's sidecar knowledge fragments (`_bmad/_memory/kai-sidecar/knowledge/`) are **condensed extracts** optimized for agent context:
|
|
223
|
+
- Tables only, no prose explanations
|
|
224
|
+
- No Common Mistakes sections (Kai's instructions.md handles error prevention)
|
|
225
|
+
- Fragment per concern (colors, typography, components, layout) for selective loading
|
|
226
|
+
|
|
227
|
+
When updating translation MDX, also update the corresponding sidecar fragment (STORY-008).
|
|
228
|
+
|
|
229
|
+
#### 6. Document Conventions
|
|
230
|
+
|
|
231
|
+
- All tables: First column = Source/external term, Second column = Discourser equivalent
|
|
232
|
+
- All MDX files start with `import { Meta }` and `<Meta title="Documentation/Figma Translation/[XX-Name]" />`
|
|
233
|
+
- Common Mistakes in each file use ❌/✅ pattern
|
|
234
|
+
- Cross-references use Storybook page titles, not file paths
|
|
235
|
+
- File naming: `XX-Name.mdx` where XX is zero-padded number for sort order
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## DO NOT
|
|
240
|
+
|
|
241
|
+
- Change any existing files (00-05.mdx)
|
|
242
|
+
- Modify source code or config
|
|
243
|
+
- Install packages
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Acceptance Criteria
|
|
248
|
+
|
|
249
|
+
- [ ] `06-Layout.mdx` created with layout primitive mapping, decision tree, responsive breakpoints, and page composition patterns
|
|
250
|
+
- [ ] `07-ExtensionGuide.mdx` created with templates for components, tokens, palettes + versioning process
|
|
251
|
+
- [ ] Layout file covers VStack/HStack/Grid/Flex with decision guidance
|
|
252
|
+
- [ ] Responsive breakpoint table with both syntax forms
|
|
253
|
+
- [ ] Extension guide has copy-pasteable templates for each type of addition
|
|
254
|
+
- [ ] Versioning section documents when/how to re-verify
|
|
255
|
+
- [ ] Kai sidecar relationship documented
|
|
256
|
+
- [ ] Both files render in Storybook without MDX parse errors
|
|
257
|
+
- [ ] Conventions section ensures future contributors maintain consistency
|
|
258
|
+
- [ ] Common Mistakes section in layout file with ❌/✅ patterns
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# STORY-008: Extract Kai Sidecar Knowledge Fragments
|
|
2
|
+
|
|
3
|
+
> **Epic:** Kai Agent — Design System MCP Integration
|
|
4
|
+
> **Depends on:** STORY-006 (all parts), STORY-007 (sidecar structure scaffolded)
|
|
5
|
+
> **Estimate:** 2-3hr
|
|
6
|
+
> **Note:** This story executes in the **Discourser.ai** project, not the design system repo. However, the source content comes from the design system's translation docs. This file documents what to extract and how.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Context
|
|
11
|
+
|
|
12
|
+
STORY-006 created comprehensive Figma Translation MDX docs in Storybook — designed for human readability and MCP queryability. The Kai agent needs **condensed extracts** optimized for LLM context loading:
|
|
13
|
+
- Tables only, no prose explanations
|
|
14
|
+
- No Common Mistakes sections (Kai's `instructions.md` handles error prevention)
|
|
15
|
+
- One fragment per concern for selective loading via `kai-index.csv`
|
|
16
|
+
- Total fragment size per task stays under agent context budget
|
|
17
|
+
|
|
18
|
+
This story extracts the translation MDX content into Kai-optimized sidecar fragments.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Prerequisites
|
|
23
|
+
|
|
24
|
+
1. **STORY-006 complete** — All 8 translation MDX files exist in `Discourser-Design-System/stories/documentation/figma-translation/`
|
|
25
|
+
2. **STORY-007 complete** — Kai sidecar structure exists at `_bmad/_cfg/agents/kai/kai-sidecar/knowledge/`
|
|
26
|
+
3. **STORY-011 complete (recommended)** — Translation docs verified as accurate before extracting
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Deliverables
|
|
31
|
+
|
|
32
|
+
All files go in the Discourser.ai project's Kai sidecar knowledge directory:
|
|
33
|
+
```
|
|
34
|
+
_bmad/_cfg/agents/kai/kai-sidecar/knowledge/
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Fragment 1: `figma-translation-colors.md`
|
|
38
|
+
|
|
39
|
+
**Source:** `01-Colors.mdx`
|
|
40
|
+
**Extract:** All mapping tables (backgrounds, text, border, M3 surface, colorPalette). Strip prose, keep only tables and the colorPalette system rules (available palettes, when to use colorPalette vs direct token).
|
|
41
|
+
|
|
42
|
+
### Fragment 2: `figma-translation-typography.md`
|
|
43
|
+
|
|
44
|
+
**Source:** `02-Typography.mdx`
|
|
45
|
+
**Extract:** Text size mapping table, font family table, font weight table, Header component size mapping. Strip prose.
|
|
46
|
+
|
|
47
|
+
### Fragment 3: `figma-translation-spacing.md`
|
|
48
|
+
|
|
49
|
+
**Source:** `03-Spacing.mdx`
|
|
50
|
+
**Extract:** Numeric scale table, named token table, Figma auto-layout translation table. Strip prose.
|
|
51
|
+
|
|
52
|
+
### Fragment 4: `figma-translation-shadows-radii.md`
|
|
53
|
+
|
|
54
|
+
**Source:** `04-Shadows-Radii.mdx`
|
|
55
|
+
**Extract:** Shadow mapping table, border radius table. Strip prose.
|
|
56
|
+
|
|
57
|
+
### Fragment 5: `figma-translation-components.md`
|
|
58
|
+
|
|
59
|
+
**Source:** `05-Components.mdx`
|
|
60
|
+
**Extract:** All component entries with their type (recipe/slotRecipe), import path, key props, and compound anatomy. This will be the largest fragment. Consider splitting into `figma-translation-components-interactive.md` and `figma-translation-components-compound.md` if too large for single context load.
|
|
61
|
+
|
|
62
|
+
### Fragment 6: `layout-patterns.md`
|
|
63
|
+
|
|
64
|
+
**Source:** `06-Layout.mdx`
|
|
65
|
+
**Extract:** Layout primitive mapping table, decision tree, responsive breakpoint table. Strip page composition examples (Kai can query Storybook MCP for those).
|
|
66
|
+
|
|
67
|
+
### Fragment 7: `component-catalog.md`
|
|
68
|
+
|
|
69
|
+
**Source:** Component guidelines in `stories/documentation/guidelines/components/` + `05-Components.mdx`
|
|
70
|
+
**Content:** Quick-reference catalog of all components with: name, type, variants, sizes, import path. One table, all components. This is the "at a glance" view Kai checks before diving into specific component details.
|
|
71
|
+
|
|
72
|
+
### Fragment 8: `token-decision-trees.md`
|
|
73
|
+
|
|
74
|
+
**Source:** Design token MDX files in `stories/documentation/guidelines/design-tokens/` + translation files
|
|
75
|
+
**Content:** Decision trees for common token choices:
|
|
76
|
+
- Which background token? (canvas vs surface vs surfaceContainer vs component default)
|
|
77
|
+
- Which text color? (fg.default vs fg.muted vs fg.subtle vs onSurface)
|
|
78
|
+
- Which shadow? (none vs xs vs sm vs md vs lg — with component context)
|
|
79
|
+
- Which border radius? (l1 vs l2 vs l3 vs none vs full — with component context)
|
|
80
|
+
|
|
81
|
+
### Update: `kai-index.csv`
|
|
82
|
+
|
|
83
|
+
Map task types to fragments:
|
|
84
|
+
|
|
85
|
+
```csv
|
|
86
|
+
task,fragment,description
|
|
87
|
+
color-mapping,figma-translation-colors.md,Figma/Tailwind/Shadcn color → Discourser token mapping
|
|
88
|
+
typography-mapping,figma-translation-typography.md,Text size/font/weight translation
|
|
89
|
+
spacing-mapping,figma-translation-spacing.md,Spacing scale + auto-layout translation
|
|
90
|
+
shadow-radius-mapping,figma-translation-shadows-radii.md,Shadow + border radius translation
|
|
91
|
+
component-selection,figma-translation-components.md,Full component mapping with props and anatomy
|
|
92
|
+
layout-decisions,layout-patterns.md,VStack/HStack/Grid/Flex selection + responsive patterns
|
|
93
|
+
component-catalog,component-catalog.md,Quick-reference: all components at a glance
|
|
94
|
+
token-decisions,token-decision-trees.md,Decision trees for semantic token selection
|
|
95
|
+
design-translate-full,figma-translation-colors.md;figma-translation-typography.md;figma-translation-spacing.md;figma-translation-shadows-radii.md;figma-translation-components.md;layout-patterns.md,Full context for DT workflow
|
|
96
|
+
design-validate,component-catalog.md;token-decision-trees.md;figma-translation-components.md,Context for DV (validation) workflow
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Extraction Rules
|
|
102
|
+
|
|
103
|
+
1. **Tables only** — Remove all prose paragraphs, introductions, and explanations
|
|
104
|
+
2. **Keep column headers** — Every table must retain its header row
|
|
105
|
+
3. **Keep section headers** — Use `##` for sections within a fragment so Kai can navigate
|
|
106
|
+
4. **No Common Mistakes** — Kai's `instructions.md` handles this via critical_actions
|
|
107
|
+
5. **No cross-references** — Kai loads fragments directly, doesn't follow Storybook links
|
|
108
|
+
6. **Add fragment header** — Each file starts with:
|
|
109
|
+
```markdown
|
|
110
|
+
# [Fragment Title]
|
|
111
|
+
> Source: stories/documentation/figma-translation/[XX-File.mdx]
|
|
112
|
+
> Last synced: [date]
|
|
113
|
+
> Design System version: [version from package.json]
|
|
114
|
+
```
|
|
115
|
+
7. **Size budget** — Each fragment should be under 2000 tokens. If larger, split.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Verification
|
|
120
|
+
|
|
121
|
+
After extraction:
|
|
122
|
+
1. Spot-check 5 random entries from each fragment against the source MDX — they must match
|
|
123
|
+
2. Load the `design-translate-full` fragment set via kai-index.csv — total size should be reasonable for agent context
|
|
124
|
+
3. Give Kai a test query: "Translate a Figma card with primary background, 16px padding, medium shadow, containing a heading and body text" — verify the spec output references correct tokens
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Acceptance Criteria
|
|
129
|
+
|
|
130
|
+
- [ ] 8 knowledge fragments created in Kai sidecar
|
|
131
|
+
- [ ] `kai-index.csv` updated with all task-to-fragment mappings
|
|
132
|
+
- [ ] Each fragment has header with source file, sync date, and version
|
|
133
|
+
- [ ] Tables-only format (no prose except section headers)
|
|
134
|
+
- [ ] Each fragment under 2000 tokens
|
|
135
|
+
- [ ] `design-translate-full` fragment set covers all translation content
|
|
136
|
+
- [ ] Spot-check accuracy: 5 random entries per fragment match source MDX
|
|
137
|
+
- [ ] Fragment loading via kai-index.csv works correctly
|