@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,182 @@
|
|
|
1
|
+
# STORY-011: Verify & Test Figma Translation Doc Suite
|
|
2
|
+
|
|
3
|
+
> **Epic:** Kai Agent — Design System MCP Integration
|
|
4
|
+
> **Depends on:** STORY-006 (all parts complete — files 00-07 must exist)
|
|
5
|
+
> **Estimate:** 2-3hr
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
STORY-006 creates the Figma Translation doc suite. This story verifies it's **accurate, complete, and usable** by both humans and the Kai agent.
|
|
12
|
+
|
|
13
|
+
A wrong token mapping is worse than no mapping — it produces confidently wrong code. Testing must be thorough and repeatable. These tests become the regression safety net when the design system evolves.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Prerequisites — READ THESE FIRST
|
|
18
|
+
|
|
19
|
+
1. **All 8 translation MDX files** in `stories/documentation/figma-translation/` — understand what's being tested
|
|
20
|
+
2. `panda.config.ts` — source of truth for semantic tokens, recipes, slotRecipes
|
|
21
|
+
3. `src/components/index.ts` — source of truth for component exports
|
|
22
|
+
4. `src/preset/shadows.ts` — shadow token definitions
|
|
23
|
+
5. `src/preset/semantic-tokens.ts` — M3 semantic token definitions
|
|
24
|
+
6. `styled-system/tokens/index.mjs` (generated) — the actual token output after `pnpm prepare`
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Deliverables
|
|
29
|
+
|
|
30
|
+
### 1. Token Accuracy Test
|
|
31
|
+
|
|
32
|
+
**File:** `src/preset/__tests__/translation-token-accuracy.test.ts`
|
|
33
|
+
|
|
34
|
+
Write a test that:
|
|
35
|
+
1. Reads all translation MDX files (01-Colors, 02-Typography, 03-Spacing, 04-Shadows-Radii)
|
|
36
|
+
2. Extracts every Discourser token reference from the "Discourser" column of tables using regex
|
|
37
|
+
- Pattern match: `bg="..."`, `color="..."`, `shadow="..."`, `rounded="..."`, `textStyle="..."`, `p="..."`, `gap="..."`, `fontFamily="..."`, `fontWeight="..."`, etc.
|
|
38
|
+
- Also match semantic tokens like `fg.default`, `fg.muted`, `canvas`, `border`, `primary.9`, `surface.container`, etc.
|
|
39
|
+
3. Cross-references each extracted token against the actual token configuration:
|
|
40
|
+
- For color tokens: check they exist in `panda.config.ts` semanticTokens.colors or in the Radix scale (primary.1-12, etc.)
|
|
41
|
+
- For shadow tokens: check against `src/preset/shadows.ts`
|
|
42
|
+
- For spacing tokens: check numeric values exist in Panda preset spacing scale
|
|
43
|
+
- For radii tokens: check against semanticTokens.radii (l1, l2, l3) and preset radii
|
|
44
|
+
- For textStyle tokens: check against theme.textStyles in panda.config.ts
|
|
45
|
+
4. Reports any token that doesn't resolve with file name and line context
|
|
46
|
+
|
|
47
|
+
**Approach:** Don't try to import and resolve every token programmatically (that's fragile). Instead:
|
|
48
|
+
- Build a known-good token list by reading `panda.config.ts` and preset files
|
|
49
|
+
- Parse MDX files as plain text
|
|
50
|
+
- Match extracted tokens against the known-good list
|
|
51
|
+
- Allow-list common patterns that aren't direct tokens (like numeric spacing values `"4"`, `"6"`, `"8"` which are always valid in Panda)
|
|
52
|
+
|
|
53
|
+
### 2. Component Completeness Test
|
|
54
|
+
|
|
55
|
+
**File:** `src/preset/__tests__/translation-component-completeness.test.ts`
|
|
56
|
+
|
|
57
|
+
Write a test that:
|
|
58
|
+
1. Reads `src/components/index.ts` and extracts all exported component names
|
|
59
|
+
2. Reads `stories/documentation/figma-translation/05-Components.mdx` as plain text
|
|
60
|
+
3. Checks each component name appears as a heading (`### ComponentName`) in the MDX
|
|
61
|
+
4. Reports any missing components
|
|
62
|
+
|
|
63
|
+
**Edge cases to handle:**
|
|
64
|
+
- Some exports may be utility types or helpers, not visual components — allow-list these
|
|
65
|
+
- Component names might differ slightly (e.g., `switchComponent` in config vs `Switch` in export) — normalize
|
|
66
|
+
|
|
67
|
+
### 3. MDX Render Verification Script
|
|
68
|
+
|
|
69
|
+
**File:** `scripts/verify-translation-docs.sh`
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
#!/bin/bash
|
|
73
|
+
# Quick verification that all translation MDX files exist and Storybook can parse them
|
|
74
|
+
|
|
75
|
+
# Check all expected files exist
|
|
76
|
+
TRANSLATION_DIR="stories/documentation/figma-translation"
|
|
77
|
+
EXPECTED_FILES=(
|
|
78
|
+
"00-FigmaTranslation.mdx"
|
|
79
|
+
"01-Colors.mdx"
|
|
80
|
+
"02-Typography.mdx"
|
|
81
|
+
"03-Spacing.mdx"
|
|
82
|
+
"04-Shadows-Radii.mdx"
|
|
83
|
+
"05-Components.mdx"
|
|
84
|
+
"06-Layout.mdx"
|
|
85
|
+
"07-ExtensionGuide.mdx"
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
# Verify each file exists and has Meta tag
|
|
89
|
+
for file in "${EXPECTED_FILES[@]}"; do
|
|
90
|
+
if [ ! -f "$TRANSLATION_DIR/$file" ]; then
|
|
91
|
+
echo "❌ Missing: $TRANSLATION_DIR/$file"
|
|
92
|
+
elif ! grep -q '<Meta title="Documentation/Figma Translation/' "$TRANSLATION_DIR/$file"; then
|
|
93
|
+
echo "⚠️ Missing Meta tag: $TRANSLATION_DIR/$file"
|
|
94
|
+
else
|
|
95
|
+
echo "✅ $file"
|
|
96
|
+
fi
|
|
97
|
+
done
|
|
98
|
+
|
|
99
|
+
# Check table column consistency
|
|
100
|
+
echo ""
|
|
101
|
+
echo "Checking table column consistency..."
|
|
102
|
+
for file in "${EXPECTED_FILES[@]}"; do
|
|
103
|
+
if [ -f "$TRANSLATION_DIR/$file" ]; then
|
|
104
|
+
# Count tables that don't start with Source/Figma/Tailwind in first column
|
|
105
|
+
BAD_TABLES=$(grep -c "^|[^|]*|" "$TRANSLATION_DIR/$file" 2>/dev/null || echo "0")
|
|
106
|
+
echo " $file: $BAD_TABLES table rows found"
|
|
107
|
+
fi
|
|
108
|
+
done
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Adjust the script to actually validate — the above is a starting point. The real value is:
|
|
112
|
+
- File existence check
|
|
113
|
+
- Meta tag presence
|
|
114
|
+
- Could extend to Storybook build test: `pnpm build-storybook 2>&1 | grep -i error`
|
|
115
|
+
|
|
116
|
+
### 4. Cross-Reference Integrity Check
|
|
117
|
+
|
|
118
|
+
Add to the token accuracy test (or separate test):
|
|
119
|
+
- Extract all cross-reference links from translation MDX files
|
|
120
|
+
- Verify the referenced page titles exist in Storybook (check that the target MDX files exist in the expected paths)
|
|
121
|
+
- Example: A link to "Guidelines/99-Button" should verify `stories/documentation/guidelines/components/button.mdx` exists
|
|
122
|
+
|
|
123
|
+
### 5. Regression Documentation
|
|
124
|
+
|
|
125
|
+
Add a section to `07-ExtensionGuide.mdx` (if not already there from STORY-006c):
|
|
126
|
+
|
|
127
|
+
```markdown
|
|
128
|
+
## Running Verification Tests
|
|
129
|
+
|
|
130
|
+
After any design system change, run:
|
|
131
|
+
|
|
132
|
+
\`\`\`bash
|
|
133
|
+
# Full verification suite
|
|
134
|
+
pnpm test -- --grep translation
|
|
135
|
+
|
|
136
|
+
# Quick file/structure check
|
|
137
|
+
bash scripts/verify-translation-docs.sh
|
|
138
|
+
|
|
139
|
+
# Full Storybook build (catches MDX parse errors)
|
|
140
|
+
pnpm build-storybook
|
|
141
|
+
\`\`\`
|
|
142
|
+
|
|
143
|
+
### When to Run
|
|
144
|
+
- After adding/removing components from `src/components/index.ts`
|
|
145
|
+
- After changing semantic tokens in `panda.config.ts`
|
|
146
|
+
- After modifying recipes or slotRecipes
|
|
147
|
+
- After running `pnpm prepare` if token output changes
|
|
148
|
+
- Before any design system version release
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Technical Requirements
|
|
154
|
+
|
|
155
|
+
1. Tests must use `vitest` (or whatever test runner the project uses — check `package.json`)
|
|
156
|
+
2. MDX parsing should be plain text regex, NOT a full MDX parser — keep it simple and dependency-free
|
|
157
|
+
3. Token validation should be generous — allow numeric spacing values, allow Panda preset tokens, only flag things that clearly don't exist
|
|
158
|
+
4. All tests should have descriptive failure messages: "Token 'bg.nonexistent' referenced in 01-Colors.mdx does not exist in token configuration"
|
|
159
|
+
5. Tests should be runnable independently: `pnpm test -- --grep translation`
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## DO NOT
|
|
164
|
+
|
|
165
|
+
- Modify the translation MDX files (only create test files and scripts)
|
|
166
|
+
- Install new test dependencies — use existing test infrastructure
|
|
167
|
+
- Make the tests so strict they break on every minor formatting change
|
|
168
|
+
- Test MDX rendering directly (that's what `pnpm build-storybook` is for)
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Acceptance Criteria
|
|
173
|
+
|
|
174
|
+
- [ ] `translation-token-accuracy.test.ts` — parses MDX, extracts tokens, validates against config
|
|
175
|
+
- [ ] `translation-component-completeness.test.ts` — checks every exported component has a mapping entry
|
|
176
|
+
- [ ] `scripts/verify-translation-docs.sh` — quick structure/existence check
|
|
177
|
+
- [ ] Cross-reference integrity verified (links to guideline MDX files resolve)
|
|
178
|
+
- [ ] All tests pass on current translation doc suite
|
|
179
|
+
- [ ] Tests produce clear failure messages identifying file, line, and problem
|
|
180
|
+
- [ ] Regression process documented in `07-ExtensionGuide.mdx`
|
|
181
|
+
- [ ] Tests runnable via `pnpm test -- --grep translation`
|
|
182
|
+
- [ ] No new dependencies installed
|
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
# Discourser Design System — Architecture
|
|
2
|
+
|
|
3
|
+
> **Version:** 0.2.0
|
|
4
|
+
> **Last Updated:** January 6, 2026
|
|
5
|
+
> **Status:** Active Development
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
The Discourser Design System is a React component library built on **Park UI infrastructure** with **Material Design 3 aesthetic**. It provides the visual foundation for Discourser.AI and demonstrates a bidirectional Figma ↔ Code workflow.
|
|
12
|
+
|
|
13
|
+
### Design Philosophy
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
Park UI (Infrastructure) + Material 3 (Aesthetic) = Discourser Design System
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- **Park UI** provides: Component architecture, Ark UI primitives, PandaCSS recipes, accessibility
|
|
20
|
+
- **Material 3** provides: Color system, typography scale, elevation, motion, shape language
|
|
21
|
+
- **Discourser** adds: Voice-first UX patterns, custom interview-specific components
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Architecture Diagram
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
29
|
+
│ FIGMA DESIGN │
|
|
30
|
+
│ ┌──────────────────────┐ ┌────────────────────────────────────────────┐ │
|
|
31
|
+
│ │ Park UI Foundations │───▶│ Discourser.AI Components │ │
|
|
32
|
+
│ │ Kit (Variables) │ │ (Custom components using Park UI Variables)│ │
|
|
33
|
+
│ └──────────────────────┘ └────────────────────────────────────────────┘ │
|
|
34
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
35
|
+
│
|
|
36
|
+
▼ figma-token-sync Plugin
|
|
37
|
+
┌───────────┐
|
|
38
|
+
│tokens.json│ ← DTCG W3C Format
|
|
39
|
+
└───────────┘
|
|
40
|
+
│
|
|
41
|
+
┌─────────────────────────────┼─────────────────────────────┐
|
|
42
|
+
▼ ▼ ▼
|
|
43
|
+
┌─────────────────────┐ ┌─────────────────────────┐ ┌─────────────────┐
|
|
44
|
+
│ figma-token-sync │ │ @discourser/design- │ │ Discourser.AI │
|
|
45
|
+
│ CLI │ │ system │ │ (MVP App) │
|
|
46
|
+
│ │ │ │ │ │
|
|
47
|
+
│ • validate │ │ ┌─────────────────────┐ │ │ Consumes via │
|
|
48
|
+
│ • diff │ │ │ Park UI Preset │ │───▶│ npm package │
|
|
49
|
+
│ • convert │ │ │ (Ark UI + Recipes) │ │ │ │
|
|
50
|
+
└─────────────────────┘ │ └─────────────────────┘ │ └─────────────────┘
|
|
51
|
+
│ ┌─────────────────────┐ │
|
|
52
|
+
│ │ M3 Theme Bridge │ │
|
|
53
|
+
│ │ (Color mapping) │ │
|
|
54
|
+
│ └─────────────────────┘ │
|
|
55
|
+
│ ┌─────────────────────┐ │
|
|
56
|
+
│ │ Components (React) │ │
|
|
57
|
+
│ └─────────────────────┘ │
|
|
58
|
+
│ ┌─────────────────────┐ │
|
|
59
|
+
│ │ Storybook │ │
|
|
60
|
+
│ │ + Token Addon │ │
|
|
61
|
+
│ └─────────────────────┘ │
|
|
62
|
+
└─────────────────────────┘
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Tech Stack
|
|
68
|
+
|
|
69
|
+
| Layer | Technology | Purpose |
|
|
70
|
+
|-------|------------|---------|
|
|
71
|
+
| CSS Framework | PandaCSS 1.7+ | Zero-runtime CSS-in-JS |
|
|
72
|
+
| Component Primitives | Ark UI 5.30+ | Headless accessible components |
|
|
73
|
+
| Component Library | Park UI | Pre-built recipes and patterns |
|
|
74
|
+
| Design Language | Material 3 | Color, typography, motion, elevation |
|
|
75
|
+
| Token Format | DTCG/W3C | Industry-standard design tokens |
|
|
76
|
+
| Documentation | Storybook 8.x | Component playground |
|
|
77
|
+
| Package Manager | pnpm | Workspace management |
|
|
78
|
+
| Build | tsup | Library bundling |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Color Architecture
|
|
83
|
+
|
|
84
|
+
### The Bridge Pattern
|
|
85
|
+
|
|
86
|
+
Material 3 uses **tonal palettes** (0-100 scale), while Park UI uses **Radix-style** (1-12 scale). We bridge these:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
M3 Tonal Palette (0-100) Radix Scale (1-12)
|
|
90
|
+
───────────────────────── ──────────────────
|
|
91
|
+
100 (white) ─────────────────▶ 1 (lightest bg)
|
|
92
|
+
99 ─────────────────────────▶ 1
|
|
93
|
+
95 ─────────────────────────▶ 2 (subtle bg)
|
|
94
|
+
90 ─────────────────────────▶ 3 (UI element bg)
|
|
95
|
+
80 ─────────────────────────▶ 4
|
|
96
|
+
70 ─────────────────────────▶ 5
|
|
97
|
+
60 ─────────────────────────▶ 6
|
|
98
|
+
50 ─────────────────────────▶ 7 (borders)
|
|
99
|
+
40 ─────────────────────────▶ 8, 9 (primary action)
|
|
100
|
+
30 ─────────────────────────▶ 10 (hover state)
|
|
101
|
+
20 ─────────────────────────▶ 11 (text)
|
|
102
|
+
10 ─────────────────────────▶ 12 (high contrast)
|
|
103
|
+
0 (black) ─────────────────▶ 12
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Color Palettes
|
|
107
|
+
|
|
108
|
+
| Palette | M3 Source | Usage |
|
|
109
|
+
|---------|-----------|-------|
|
|
110
|
+
| `primary` | TastyMakers green (#63A002) | Primary actions, brand |
|
|
111
|
+
| `neutral` | M3 neutral tones | Text, backgrounds, borders |
|
|
112
|
+
| `error` | M3 error red | Destructive actions, errors |
|
|
113
|
+
| `secondary` | M3 secondary | Secondary actions (future) |
|
|
114
|
+
| `tertiary` | M3 tertiary | Accents (future) |
|
|
115
|
+
|
|
116
|
+
### Semantic Token Layers
|
|
117
|
+
|
|
118
|
+
**Layer 1: Park UI Base** (required for components)
|
|
119
|
+
```typescript
|
|
120
|
+
colorPalette: {
|
|
121
|
+
solid: { bg, fg },
|
|
122
|
+
subtle: { bg, fg },
|
|
123
|
+
surface: { bg, border, fg },
|
|
124
|
+
outline: { bg, border, fg },
|
|
125
|
+
plain: { bg, fg }
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Layer 2: M3 Semantic** (optional, for M3-style usage)
|
|
130
|
+
```typescript
|
|
131
|
+
surface, onSurface
|
|
132
|
+
surfaceContainer, surfaceContainerLow, etc.
|
|
133
|
+
m3Primary, onM3Primary
|
|
134
|
+
outline, outlineVariant
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Typography System
|
|
140
|
+
|
|
141
|
+
Based on Material 3 type scale with M3 fonts:
|
|
142
|
+
|
|
143
|
+
| Role | Font | Size | Weight | Use Case |
|
|
144
|
+
|------|------|------|--------|----------|
|
|
145
|
+
| Display Large | Fraunces | 57px | 400 | Hero headlines |
|
|
146
|
+
| Display Medium | Fraunces | 45px | 400 | Section headers |
|
|
147
|
+
| Display Small | Fraunces | 36px | 400 | Card titles |
|
|
148
|
+
| Headline Large | Fraunces | 32px | 400 | Page titles |
|
|
149
|
+
| Headline Medium | Fraunces | 28px | 400 | Section titles |
|
|
150
|
+
| Headline Small | Fraunces | 24px | 400 | Subsections |
|
|
151
|
+
| Title Large | Poppins | 22px | 500 | Card headers |
|
|
152
|
+
| Title Medium | Poppins | 16px | 500 | List items |
|
|
153
|
+
| Title Small | Poppins | 14px | 500 | Captions |
|
|
154
|
+
| Body Large | Poppins | 16px | 400 | Primary text |
|
|
155
|
+
| Body Medium | Poppins | 14px | 400 | Secondary text |
|
|
156
|
+
| Body Small | Poppins | 12px | 400 | Helper text |
|
|
157
|
+
| Label Large | Poppins | 14px | 500 | Buttons |
|
|
158
|
+
| Label Medium | Poppins | 12px | 500 | Chips |
|
|
159
|
+
| Label Small | Poppins | 11px | 500 | Overlines |
|
|
160
|
+
|
|
161
|
+
### Park UI Aliases
|
|
162
|
+
|
|
163
|
+
For compatibility with Park UI recipes:
|
|
164
|
+
- `xs` → Label Small
|
|
165
|
+
- `sm` → Body Small
|
|
166
|
+
- `md` → Body Medium
|
|
167
|
+
- `lg` → Body Large
|
|
168
|
+
- `xl` → Title Medium
|
|
169
|
+
- `2xl` → Title Large
|
|
170
|
+
- etc.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Component Inventory
|
|
175
|
+
|
|
176
|
+
### Core Components (from Park UI)
|
|
177
|
+
|
|
178
|
+
| Component | Status | Notes |
|
|
179
|
+
|-----------|--------|-------|
|
|
180
|
+
| Button | ✅ Ready | solid, subtle, outline, plain, surface variants |
|
|
181
|
+
| IconButton | ✅ Ready | Icon-only button |
|
|
182
|
+
| Input | ✅ Ready | Text input with field wrapper |
|
|
183
|
+
| Textarea | ✅ Ready | Multi-line input |
|
|
184
|
+
| Select | ✅ Ready | Dropdown selection |
|
|
185
|
+
| Checkbox | ✅ Ready | Boolean input |
|
|
186
|
+
| Switch | ✅ Ready | Toggle control |
|
|
187
|
+
| Radio Group | ✅ Ready | Single selection |
|
|
188
|
+
| Dialog | ✅ Ready | Modal dialogs |
|
|
189
|
+
| Drawer | ✅ Ready | Side panels |
|
|
190
|
+
| Popover | ✅ Ready | Floating content |
|
|
191
|
+
| Tooltip | ✅ Ready | Hover hints |
|
|
192
|
+
| Tabs | ✅ Ready | Tab navigation |
|
|
193
|
+
| Accordion | ✅ Ready | Collapsible sections |
|
|
194
|
+
| Avatar | ✅ Ready | User images |
|
|
195
|
+
| Badge | ✅ Ready | Status indicators |
|
|
196
|
+
| Card | ✅ Ready | Content containers |
|
|
197
|
+
| Progress | ✅ Ready | Loading indicators |
|
|
198
|
+
| Skeleton | ✅ Ready | Loading placeholders |
|
|
199
|
+
| Spinner | ✅ Ready | Loading spinner |
|
|
200
|
+
| Toast | ✅ Ready | Notifications |
|
|
201
|
+
|
|
202
|
+
### Discourser-Specific Components (Custom)
|
|
203
|
+
|
|
204
|
+
| Component | Status | Purpose |
|
|
205
|
+
|-----------|--------|---------|
|
|
206
|
+
| AudioWaveform | 🔲 Planned | Voice visualization |
|
|
207
|
+
| ConversationBubble | 🔲 Planned | Chat messages |
|
|
208
|
+
| ScenarioCard | 🔲 Planned | Interview scenario selection |
|
|
209
|
+
| FeedbackPanel | 🔲 Planned | AI feedback display |
|
|
210
|
+
| RecordingControls | 🔲 Planned | Voice recording UI |
|
|
211
|
+
| ProgressStepper | 🔲 Planned | Multi-step flows |
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Package Exports
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
// Main entry - all components
|
|
219
|
+
import { Button, Input, Dialog } from '@discourser/design-system';
|
|
220
|
+
|
|
221
|
+
// Styled system utilities
|
|
222
|
+
import { css, cx } from '@discourser/design-system/styled-system/css';
|
|
223
|
+
import { styled } from '@discourser/design-system/styled-system/jsx';
|
|
224
|
+
|
|
225
|
+
// Tokens for custom styling
|
|
226
|
+
import { token } from '@discourser/design-system/styled-system/tokens';
|
|
227
|
+
|
|
228
|
+
// Recipes for custom components
|
|
229
|
+
import { button } from '@discourser/design-system/styled-system/recipes';
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Development Workflow
|
|
235
|
+
|
|
236
|
+
### Local Development
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
# Install dependencies
|
|
240
|
+
pnpm install
|
|
241
|
+
|
|
242
|
+
# Start Storybook
|
|
243
|
+
pnpm dev
|
|
244
|
+
|
|
245
|
+
# Run tests
|
|
246
|
+
pnpm test
|
|
247
|
+
|
|
248
|
+
# Type check
|
|
249
|
+
pnpm typecheck
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Build & Publish
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# Generate PandaCSS
|
|
256
|
+
pnpm build:panda
|
|
257
|
+
|
|
258
|
+
# Build library
|
|
259
|
+
pnpm build
|
|
260
|
+
|
|
261
|
+
# Create changeset
|
|
262
|
+
pnpm changeset
|
|
263
|
+
|
|
264
|
+
# Version bump
|
|
265
|
+
pnpm version
|
|
266
|
+
|
|
267
|
+
# Publish to npm
|
|
268
|
+
pnpm release
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Token Sync Workflow
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
# In Figma:
|
|
275
|
+
# 1. Open figma-token-sync plugin
|
|
276
|
+
# 2. Export Variables to tokens.json
|
|
277
|
+
|
|
278
|
+
# In Storybook:
|
|
279
|
+
# 3. File watcher detects change
|
|
280
|
+
# 4. Tokens update in real-time
|
|
281
|
+
|
|
282
|
+
# To push changes back to Figma:
|
|
283
|
+
# 5. Edit tokens in Storybook addon
|
|
284
|
+
# 6. Export tokens.json
|
|
285
|
+
# 7. Import via Figma plugin
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## File Structure
|
|
291
|
+
|
|
292
|
+
```
|
|
293
|
+
Discourser-Design-System/
|
|
294
|
+
├── src/
|
|
295
|
+
│ ├── components/ # React components
|
|
296
|
+
│ │ ├── button.tsx
|
|
297
|
+
│ │ ├── input.tsx
|
|
298
|
+
│ │ ├── dialog.tsx
|
|
299
|
+
│ │ └── ...
|
|
300
|
+
│ ├── preset/ # Panda CSS preset
|
|
301
|
+
│ │ ├── colors/ # M3 → Radix color bridge
|
|
302
|
+
│ │ │ ├── m3-primary.ts
|
|
303
|
+
│ │ │ ├── m3-neutral.ts
|
|
304
|
+
│ │ │ ├── m3-error.ts
|
|
305
|
+
│ │ │ └── index.ts
|
|
306
|
+
│ │ ├── recipes/ # Component recipes (from Park UI)
|
|
307
|
+
│ │ │ ├── button.ts
|
|
308
|
+
│ │ │ ├── input.ts
|
|
309
|
+
│ │ │ └── ...
|
|
310
|
+
│ │ └── semantic-tokens.ts
|
|
311
|
+
│ ├── languages/ # Design language definitions
|
|
312
|
+
│ │ └── material3.language.ts
|
|
313
|
+
│ └── index.ts # Main export
|
|
314
|
+
├── stories/ # Storybook stories
|
|
315
|
+
├── styled-system/ # Generated PandaCSS output
|
|
316
|
+
├── dist/ # Built library output
|
|
317
|
+
├── panda.config.ts # PandaCSS configuration
|
|
318
|
+
├── tsup.config.ts # Build configuration
|
|
319
|
+
├── package.json
|
|
320
|
+
└── ARCHITECTURE.md # This file
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Design Decisions
|
|
326
|
+
|
|
327
|
+
### 1. Park UI as Foundation
|
|
328
|
+
**Decision:** Build on Park UI rather than from scratch.
|
|
329
|
+
|
|
330
|
+
**Rationale:**
|
|
331
|
+
- 60+ production-ready components
|
|
332
|
+
- Ark UI provides accessibility
|
|
333
|
+
- Active community (part of Chakra org)
|
|
334
|
+
- Reduces development time significantly
|
|
335
|
+
|
|
336
|
+
### 2. M3 Color Bridge
|
|
337
|
+
**Decision:** Map M3 tonal palettes to Radix scale instead of replacing Park UI colors.
|
|
338
|
+
|
|
339
|
+
**Rationale:**
|
|
340
|
+
- Park UI recipes expect Radix-style color structure
|
|
341
|
+
- Preserves all Park UI component styling
|
|
342
|
+
- M3 aesthetic achieved through color values, not structure
|
|
343
|
+
|
|
344
|
+
### 3. Dual Semantic Token Layers
|
|
345
|
+
**Decision:** Support both Park UI semantics (`solid.bg`) and M3 semantics (`surface`, `onSurface`).
|
|
346
|
+
|
|
347
|
+
**Rationale:**
|
|
348
|
+
- Park UI components work out of the box
|
|
349
|
+
- Custom components can use M3 naming if preferred
|
|
350
|
+
- Flexibility for different use cases
|
|
351
|
+
|
|
352
|
+
### 4. DTCG Token Format
|
|
353
|
+
**Decision:** Use W3C Design Tokens format for token interchange.
|
|
354
|
+
|
|
355
|
+
**Rationale:**
|
|
356
|
+
- Industry standard
|
|
357
|
+
- Tool ecosystem support
|
|
358
|
+
- Future-proof for design tool integrations
|
|
359
|
+
|
|
360
|
+
### 5. Monolithic Package
|
|
361
|
+
**Decision:** Single npm package rather than monorepo with sub-packages.
|
|
362
|
+
|
|
363
|
+
**Rationale:**
|
|
364
|
+
- Simpler consumption for Discourser.AI
|
|
365
|
+
- Easier versioning
|
|
366
|
+
- Can split later if needed
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## Integration with Discourser.AI
|
|
371
|
+
|
|
372
|
+
### Installation
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
pnpm add @discourser/design-system
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Setup
|
|
379
|
+
|
|
380
|
+
```tsx
|
|
381
|
+
// app/layout.tsx
|
|
382
|
+
import '@discourser/design-system/styled-system/styles.css';
|
|
383
|
+
|
|
384
|
+
export default function RootLayout({ children }) {
|
|
385
|
+
return (
|
|
386
|
+
<html lang="en" data-theme="light">
|
|
387
|
+
<body>{children}</body>
|
|
388
|
+
</html>
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
### Usage
|
|
394
|
+
|
|
395
|
+
```tsx
|
|
396
|
+
import { Button, Input, Dialog } from '@discourser/design-system';
|
|
397
|
+
import { css } from '@discourser/design-system/styled-system/css';
|
|
398
|
+
|
|
399
|
+
export function LoginForm() {
|
|
400
|
+
return (
|
|
401
|
+
<div className={css({ p: 'lg' })}>
|
|
402
|
+
<Input placeholder="Email" />
|
|
403
|
+
<Input type="password" placeholder="Password" />
|
|
404
|
+
<Button colorPalette="primary">Sign In</Button>
|
|
405
|
+
</div>
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## Versioning Strategy
|
|
413
|
+
|
|
414
|
+
- **0.x.x** — Pre-release, API may change
|
|
415
|
+
- **1.0.0** — Stable release with Discourser.AI MVP
|
|
416
|
+
- Follows [Semantic Versioning](https://semver.org/)
|
|
417
|
+
- Changesets for changelog generation
|
|
418
|
+
|
|
419
|
+
### Current Version: 0.2.0
|
|
420
|
+
- Park UI integration
|
|
421
|
+
- M3 color bridge
|
|
422
|
+
- Core component set
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## Related Projects
|
|
427
|
+
|
|
428
|
+
| Project | Relationship |
|
|
429
|
+
|---------|--------------|
|
|
430
|
+
| [Discourser.AI](../discourser.ai) | Primary consumer |
|
|
431
|
+
| [figma-token-sync](../figma-token-sync) | Token synchronization tooling |
|
|
432
|
+
| [Park UI](https://park-ui.com) | Component foundation |
|
|
433
|
+
| [Ark UI](https://ark-ui.com) | Headless primitives |
|
|
434
|
+
| [PandaCSS](https://panda-css.com) | Styling engine |
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## Resources
|
|
439
|
+
|
|
440
|
+
- [Park UI Documentation](https://park-ui.com/docs)
|
|
441
|
+
- [Ark UI Documentation](https://ark-ui.com/react/docs)
|
|
442
|
+
- [PandaCSS Documentation](https://panda-css.com/docs)
|
|
443
|
+
- [Material Design 3](https://m3.material.io)
|
|
444
|
+
- [W3C Design Tokens](https://tr.designtokens.org/format/)
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
|
|
448
|
+
*Last updated: January 6, 2026*
|