sinapse-ai 9.3.0 → 9.4.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/.claude/CLAUDE.md +56 -343
- package/.claude/rules/agent-authority.md +6 -0
- package/.claude/rules/agent-handoff.md +5 -0
- package/.claude/rules/cross-squad-routing.md +5 -0
- package/.claude/rules/hook-governance.md +6 -0
- package/.claude/rules/mcp-usage.md +3 -1
- package/.claude/rules/safe-collaboration.md +10 -0
- package/.claude/rules/security-data-protection.md +9 -0
- package/.claude/rules/squad-awareness.md +3 -1
- package/.claude/rules/tool-examples.md +6 -0
- package/.claude/rules/workflow-execution.md +7 -0
- package/.codex/agents/analyst.md +253 -72
- package/.codex/agents/architect.md +455 -68
- package/.codex/agents/data-engineer.md +492 -106
- package/.codex/agents/developer.md +560 -0
- package/.codex/agents/devops.md +518 -69
- package/.codex/agents/product-lead.md +335 -0
- package/.codex/agents/project-lead.md +377 -0
- package/.codex/agents/quality-gate.md +449 -0
- package/.codex/agents/sinapse-orqx.md +9 -7
- package/.codex/agents/sprint-lead.md +287 -0
- package/.codex/agents/squad-creator.md +344 -0
- package/.codex/agents/ux-design-expert.md +495 -0
- package/.codex/delegation-matrix.json +756 -44
- package/.codex/handoff-packet.schema.json +30 -6
- package/.sinapse-ai/data/entity-registry.yaml +175 -363
- package/.sinapse-ai/data/registry-update-log.jsonl +16 -0
- package/.sinapse-ai/development/agents/analyst.md +90 -0
- package/.sinapse-ai/development/agents/architect.md +73 -0
- package/.sinapse-ai/development/agents/developer.md +69 -0
- package/.sinapse-ai/development/agents/devops.md +117 -0
- package/.sinapse-ai/development/agents/quality-gate.md +85 -0
- package/.sinapse-ai/development/checklists/agent-quality-gate.md +27 -0
- package/.sinapse-ai/development/checklists/brownfield-compatibility-checklist.md +20 -0
- package/.sinapse-ai/development/checklists/code-review-checklist.md +106 -0
- package/.sinapse-ai/development/checklists/issue-triage-checklist.md +9 -0
- package/.sinapse-ai/development/checklists/memory-audit-checklist.md +16 -0
- package/.sinapse-ai/development/checklists/pr-quality-checklist.md +72 -0
- package/.sinapse-ai/development/checklists/security-deployment-checklist.md +54 -0
- package/.sinapse-ai/development/checklists/self-critique-checklist.md +19 -1
- package/.sinapse-ai/development/skills/debug.md +57 -0
- package/.sinapse-ai/development/skills/fast-review.md +69 -0
- package/.sinapse-ai/development/skills/research-synthesis.md +77 -0
- package/.sinapse-ai/development/skills/security-scan.md +73 -0
- package/.sinapse-ai/development/skills/verify.md +53 -0
- package/.sinapse-ai/development/templates/squad/agent-template.md +17 -4
- package/.sinapse-ai/development/templates/squad/checklist-template.md +13 -5
- package/.sinapse-ai/development/templates/squad/task-template.md +7 -0
- package/.sinapse-ai/development/templates/squad/workflow-template.yaml +7 -0
- package/.sinapse-ai/development/workflows/fast-track.yaml +87 -0
- package/.sinapse-ai/infrastructure/scripts/validate-codex-delegation.js +3 -1
- package/.sinapse-ai/install-manifest.yaml +71 -35
- package/docs/codex-integration-process.md +22 -0
- package/docs/codex-parity-program.md +27 -0
- package/docs/ide-integration.md +36 -0
- package/package.json +1 -1
- package/squads/claude-code-mastery/knowledge-base/claude-code-internals-reference.md +927 -0
- package/squads/squad-brand/knowledge-base/archetype-brand-mapping.md +12 -1
- package/squads/squad-brand/knowledge-base/brand-activism-cultural-branding.md +216 -0
- package/squads/squad-brand/knowledge-base/brand-audit-criteria.md +58 -0
- package/squads/squad-brand/knowledge-base/brand-digital-strategy.md +188 -0
- package/squads/squad-brand/knowledge-base/brand-legal-ip.md +222 -0
- package/squads/squad-brand/knowledge-base/brand-naming-framework.md +163 -0
- package/squads/squad-brand/knowledge-base/branding-master-reference.md +1001 -0
- package/squads/squad-brand/knowledge-base/color-psychology.md +25 -12
- package/squads/squad-brand/knowledge-base/employer-personal-branding.md +206 -0
- package/squads/squad-brand/knowledge-base/routing-catalog.md +34 -0
- package/squads/squad-brand/knowledge-base/sonic-branding-principles.md +6 -1
- package/squads/squad-brand/knowledge-base/typography-personality.md +34 -0
- package/squads/squad-claude/knowledge-base/context-window-optimization.md +334 -0
- package/squads/squad-claude/knowledge-base/knowledge-architecture-reference.md +403 -0
- package/squads/squad-claude/knowledge-base/memory-systems-reference.md +412 -0
- package/squads/squad-claude/knowledge-base/obsidian-claude-integration.md +423 -0
- package/squads/squad-claude/knowledge-base/retrieval-augmented-generation.md +320 -0
- package/squads/squad-claude/knowledge-base/skill-creation-patterns.md +380 -0
- package/squads/squad-claude/knowledge-base/swarm-orchestration-patterns.md +411 -0
- package/squads/squad-cloning/knowledge-base/clone-quality-assurance.md +211 -0
- package/squads/squad-cloning/knowledge-base/confidence-scoring.md +51 -0
- package/squads/squad-cloning/knowledge-base/cross-squad-deployment.md +47 -0
- package/squads/squad-cloning/knowledge-base/ethical-guidelines.md +237 -0
- package/squads/squad-cloning/knowledge-base/knowledge-graph-for-clones.md +295 -0
- package/squads/squad-cloning/knowledge-base/memory-architecture-for-clones.md +229 -0
- package/squads/squad-cloning/knowledge-base/multi-agent-deployment-patterns.md +320 -0
- package/squads/squad-cloning/knowledge-base/skill-standard-for-clones.md +262 -0
- package/squads/squad-cloning/knowledge-base/sop-extraction-guide.md +243 -0
- package/squads/squad-commercial/knowledge-base/account-based-selling.md +206 -0
- package/squads/squad-commercial/knowledge-base/ai-as-competitive-infrastructure.md +14 -0
- package/squads/squad-commercial/knowledge-base/ai-in-sales.md +199 -0
- package/squads/squad-commercial/knowledge-base/brazilian-sales-context.md +195 -0
- package/squads/squad-commercial/knowledge-base/customer-success-operations.md +83 -2
- package/squads/squad-commercial/knowledge-base/prospecting-pipeline-generation.md +69 -0
- package/squads/squad-commercial/knowledge-base/sales-enablement-playbook.md +260 -0
- package/squads/squad-commercial/knowledge-base/sales-methodology-comparison.md +185 -0
- package/squads/squad-commercial/knowledge-base/sales-revenue-master-reference.md +1123 -0
- package/squads/squad-content/knowledge-base/brazilian-content-context.md +176 -0
- package/squads/squad-content/knowledge-base/competitor-analysis-methods.md +40 -1
- package/squads/squad-content/knowledge-base/content-architecture-taxonomy.md +206 -0
- package/squads/squad-content/knowledge-base/content-formats-encyclopedia.md +58 -1
- package/squads/squad-content/knowledge-base/content-references-bibliography.md +130 -0
- package/squads/squad-content/knowledge-base/content-strategy-master-reference.md +1097 -0
- package/squads/squad-content/knowledge-base/content-tech-stack.md +150 -0
- package/squads/squad-content/knowledge-base/copywriting-formulas-library.md +188 -0
- package/squads/squad-content/knowledge-base/email-newsletter-strategy.md +161 -0
- package/squads/squad-content/knowledge-base/platform-algorithm-intelligence.md +86 -1
- package/squads/squad-content/knowledge-base/social-algorithms-master-reference.md +1007 -0
- package/squads/squad-content/knowledge-base/video-audio-content-playbook.md +218 -0
- package/squads/squad-copy/knowledge-base/ai-copy-production.md +254 -0
- package/squads/squad-copy/knowledge-base/brazilian-copywriting-context.md +242 -0
- package/squads/squad-copy/knowledge-base/email-copywriting-system.md +299 -0
- package/squads/squad-copy/knowledge-base/landing-page-copy-architecture.md +267 -0
- package/squads/squad-copy/knowledge-base/power-words-catalog.md +205 -0
- package/squads/squad-copy/knowledge-base/seo-copywriting.md +255 -0
- package/squads/squad-copy/knowledge-base/video-script-copywriting.md +239 -0
- package/squads/squad-council/knowledge-base/brand-strategy-models.md +193 -0
- package/squads/squad-council/knowledge-base/growth-strategy-models.md +267 -0
- package/squads/squad-council/knowledge-base/innovation-disruption-frameworks.md +193 -0
- package/squads/squad-council/knowledge-base/market-analysis-frameworks.md +240 -0
- package/squads/squad-council/knowledge-base/organizational-leadership-models.md +212 -0
- package/squads/squad-council/knowledge-base/sales-strategy-models.md +215 -0
- package/squads/squad-courses/knowledge-base/course-launch-strategy.md +251 -0
- package/squads/squad-courses/knowledge-base/domain-advocacia-curriculum.md +385 -0
- package/squads/squad-courses/knowledge-base/domain-contabilidade-curriculum.md +266 -0
- package/squads/squad-courses/knowledge-base/platform-comparison.md +68 -0
- package/squads/squad-courses/knowledge-base/video-production-guide.md +70 -0
- package/squads/squad-cybersecurity/knowledge-base/cloud-security-reference.md +363 -0
- package/squads/squad-cybersecurity/knowledge-base/compliance-frameworks.md +273 -0
- package/squads/squad-cybersecurity/knowledge-base/database-security.md +438 -0
- package/squads/squad-cybersecurity/knowledge-base/incident-response-playbook.md +420 -0
- package/squads/squad-cybersecurity/knowledge-base/network-security-reference.md +477 -0
- package/squads/squad-cybersecurity/knowledge-base/penetration-testing-methodology.md +350 -0
- package/squads/squad-cybersecurity/knowledge-base/vulnerability-management.md +349 -0
- package/squads/squad-design/knowledge-base/brazilian-design-context.md +223 -0
- package/squads/squad-design/knowledge-base/component-api-patterns.md +208 -4
- package/squads/squad-design/knowledge-base/design-system-master-reference.md +1302 -0
- package/squads/squad-design/knowledge-base/design-systems-frameworks.md +91 -1
- package/squads/squad-design/knowledge-base/responsive-modern-css.md +96 -4
- package/squads/squad-design/knowledge-base/wcag-aria-reference.md +117 -5
- package/squads/squad-design/knowledge-base/web-performance-reference.md +127 -4
- package/squads/squad-finance/knowledge-base/brazilian-taxation.md +263 -0
- package/squads/squad-finance/knowledge-base/contabilidade-master-reference.md +998 -0
- package/squads/squad-finance/knowledge-base/finance-master-reference.md +946 -0
- package/squads/squad-finance/knowledge-base/financial-reporting-analysis.md +316 -0
- package/squads/squad-finance/knowledge-base/fintech-brazilian-context.md +242 -0
- package/squads/squad-finance/knowledge-base/fpa-planning-frameworks.md +286 -0
- package/squads/squad-finance/knowledge-base/ma-and-transactions.md +285 -0
- package/squads/squad-finance/knowledge-base/risk-management.md +233 -0
- package/squads/squad-finance/knowledge-base/startups-venture-capital.md +337 -0
- package/squads/squad-growth/knowledge-base/ai-growth-playbook.md +216 -0
- package/squads/squad-growth/knowledge-base/attribution-models.md +78 -0
- package/squads/squad-growth/knowledge-base/brazilian-growth-context.md +208 -0
- package/squads/squad-growth/knowledge-base/community-led-growth.md +175 -0
- package/squads/squad-growth/knowledge-base/content-marketing-flywheel.md +190 -0
- package/squads/squad-growth/knowledge-base/email-lifecycle-framework.md +192 -0
- package/squads/squad-growth/knowledge-base/growth-frameworks-catalog.md +82 -0
- package/squads/squad-growth/knowledge-base/growth-master-reference.md +1168 -0
- package/squads/squad-growth/knowledge-base/routing-catalog.md +53 -11
- package/squads/squad-paidmedia/knowledge-base/audiences-segmentation-deep.md +285 -0
- package/squads/squad-paidmedia/knowledge-base/creative-strategy-deep.md +294 -0
- package/squads/squad-paidmedia/knowledge-base/google-ads-account-architecture.md +87 -0
- package/squads/squad-paidmedia/knowledge-base/meta-ads-campaign-architecture.md +76 -0
- package/squads/squad-paidmedia/knowledge-base/paid-media-metrics-reference.md +117 -0
- package/squads/squad-paidmedia/knowledge-base/paid-traffic-master-reference.md +1308 -0
- package/squads/squad-paidmedia/knowledge-base/routing-catalog.md +95 -18
- package/squads/squad-paidmedia/knowledge-base/traffic-masters-frameworks.md +71 -0
- package/squads/squad-product/knowledge-base/brazilian-product-context.md +284 -0
- package/squads/squad-product/knowledge-base/discovery-methodology-playbook.md +141 -0
- package/squads/squad-product/knowledge-base/pm-frameworks-reference.md +125 -9
- package/squads/squad-product/knowledge-base/product-analytics-formulas.md +72 -0
- package/squads/squad-product/knowledge-base/product-led-growth-reference.md +155 -13
- package/squads/squad-product/knowledge-base/product-market-fit-framework.md +222 -0
- package/squads/squad-product/knowledge-base/routing-catalog.md +32 -0
- package/squads/squad-research/knowledge-base/agentic-second-brain-reference.md +591 -0
- package/squads/squad-research/knowledge-base/ai-augmented-research.md +212 -0
- package/squads/squad-research/knowledge-base/brazilian-market-research-sources.md +197 -0
- package/squads/squad-research/knowledge-base/community-platforms-reference.md +786 -0
- package/squads/squad-research/knowledge-base/community-research-methods.md +194 -0
- package/squads/squad-research/knowledge-base/mixed-methods-research-design.md +168 -0
- package/squads/squad-research/knowledge-base/network-effects-analysis.md +192 -0
- package/squads/squad-research/knowledge-base/qualitative-research-deep-methods.md +202 -0
- package/squads/squad-research/knowledge-base/quantitative-research-methods.md +208 -0
- package/squads/squad-research/knowledge-base/research-frameworks-encyclopedia.md +40 -0
- package/squads/squad-research/knowledge-base/research-synthesis-frameworks.md +223 -0
- package/squads/squad-storytelling/knowledge-base/brand-mythology-framework.md +236 -0
- package/squads/squad-storytelling/knowledge-base/brazilian-storytelling-context.md +237 -0
- package/squads/squad-storytelling/knowledge-base/data-storytelling.md +232 -0
- package/squads/squad-storytelling/knowledge-base/improv-storytelling.md +226 -0
- package/squads/squad-storytelling/knowledge-base/persuasion-narrative-techniques.md +269 -0
- package/squads/squad-storytelling/knowledge-base/social-movement-narratives.md +191 -0
- package/squads/squad-storytelling/knowledge-base/video-storytelling.md +252 -0
- package/squads/claude-code-mastery/data/swarm-orchestration-patterns.yaml +0 -378
- package/squads/squad-animations/knowledge-base/framer-motion-complete-reference.md +0 -710
- package/squads/squad-animations/knowledge-base/web-animations-api-view-transitions.md +0 -478
|
@@ -0,0 +1,1302 @@
|
|
|
1
|
+
# Design System Master Reference
|
|
2
|
+
|
|
3
|
+
> Comprehensive reference for design system architecture, tokens, components, accessibility, tooling, and governance.
|
|
4
|
+
> Source: MS-002 Research (46 sources, 10 major design systems analyzed)
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Table of Contents
|
|
9
|
+
|
|
10
|
+
1. [Design System Architecture](#1-design-system-architecture)
|
|
11
|
+
2. [Design Tokens](#2-design-tokens)
|
|
12
|
+
3. [Foundations](#3-foundations)
|
|
13
|
+
4. [Component Architecture](#4-component-architecture)
|
|
14
|
+
5. [Accessibility (a11y)](#5-accessibility-a11y)
|
|
15
|
+
6. [Design-to-Code Pipeline](#6-design-to-code-pipeline)
|
|
16
|
+
7. [Component Libraries Comparison](#7-component-libraries-comparison)
|
|
17
|
+
8. [Documentation & Governance](#8-documentation--governance)
|
|
18
|
+
9. [Testing & Quality](#9-testing--quality)
|
|
19
|
+
10. [DesignOps](#10-designops)
|
|
20
|
+
11. [Performance & Optimization](#11-performance--optimization)
|
|
21
|
+
12. [Famous Design Systems Comparison](#12-famous-design-systems-comparison)
|
|
22
|
+
13. [Brazilian Context](#13-brazilian-context)
|
|
23
|
+
14. [Advanced Patterns](#14-advanced-patterns)
|
|
24
|
+
15. [Actionable Checklists](#15-actionable-checklists)
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 1. Design System Architecture
|
|
29
|
+
|
|
30
|
+
### 1.1 The 5-Layer Model (EightShapes / Nathan Curtis)
|
|
31
|
+
|
|
32
|
+
A well-architected design system follows separation of concerns. Dependencies flow bottom-up: changing a foundation propagates to all consuming components.
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
+-------------------------------------------+
|
|
36
|
+
| 5. TEMPLATES | Full page layouts
|
|
37
|
+
+-------------------------------------------+
|
|
38
|
+
| 4. PATTERNS | UI compositions (forms, nav, cards)
|
|
39
|
+
+-------------------------------------------+
|
|
40
|
+
| 3. COMPONENTS | Reusable elements (Button, Input)
|
|
41
|
+
+-------------------------------------------+
|
|
42
|
+
| 2. TOKENS | Design values (colors, spacing, type)
|
|
43
|
+
+-------------------------------------------+
|
|
44
|
+
| 1. FOUNDATIONS | Principles, brand, voice & tone
|
|
45
|
+
+-------------------------------------------+
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
| Layer | Description | Change Frequency |
|
|
49
|
+
|-------|-------------|------------------|
|
|
50
|
+
| **Foundations** | Design principles, brand personality, voice & tone. "Prefer clarity over beauty" (Polaris), "Adaptive, not rigid" (Carbon) | Rarely modified |
|
|
51
|
+
| **Tokens** | Numeric representation of design decisions. `color.primary.500`, `spacing.4` | Moderate |
|
|
52
|
+
| **Components** | Reusable UI elements with documented API, states, a11y, and tests | Regular |
|
|
53
|
+
| **Patterns** | Compositions solving recurring UX problems (login form, search, onboarding) | Regular |
|
|
54
|
+
| **Templates** | Complete page layouts combining patterns in real contexts | As needed |
|
|
55
|
+
|
|
56
|
+
### 1.2 System of Systems
|
|
57
|
+
|
|
58
|
+
Large organizations need a **federated architecture** -- a family of coordinated systems.
|
|
59
|
+
|
|
60
|
+
**Umbrella Model (Google):**
|
|
61
|
+
Core system (Material Design) defines principles, tokens, components. Each platform (Android, Flutter, Web) implements respecting native conventions.
|
|
62
|
+
|
|
63
|
+
**Hub & Spoke Model (Salesforce):**
|
|
64
|
+
Lightning Design System is the hub. Each product (Sales Cloud, Service Cloud) is a spoke extending the hub with specialized components.
|
|
65
|
+
|
|
66
|
+
**Multi-Brand Model (Natura &Co):**
|
|
67
|
+
Core system of "neutral" tokens and components themed via brand tokens. Same `<Button>` renders green for Natura, pink for Avon -- changing only tokens, not the component.
|
|
68
|
+
|
|
69
|
+
### 1.3 Governance Models
|
|
70
|
+
|
|
71
|
+
| Model | How It Works | Pros | Cons | Adopted By |
|
|
72
|
+
|-------|-------------|------|------|------------|
|
|
73
|
+
| **Centralized** | Dedicated team creates and maintains everything | Max consistency, high quality | Bottleneck, slow to meet demands | Salesforce, IBM, Microsoft |
|
|
74
|
+
| **Federated** | Product teams contribute; core team curates | Fast, high engagement | Inconsistency risk, coordination overhead | Smaller orgs |
|
|
75
|
+
| **Hybrid** | Core team maintains foundations + core components; product teams contribute via RFC | Best of both worlds | Requires rigorous review processes | Shopify, Atlassian, GitHub |
|
|
76
|
+
|
|
77
|
+
### 1.4 Contribution Models
|
|
78
|
+
|
|
79
|
+
**RFC Process (Request for Comments):**
|
|
80
|
+
1. Proposer creates RFC document (problem, proposed solution, API, a11y)
|
|
81
|
+
2. Review period (7-14 days) -- community and core team feedback
|
|
82
|
+
3. Decision: accept, modify, or reject
|
|
83
|
+
4. Implementation (by proposer or core team)
|
|
84
|
+
5. Code review + design review
|
|
85
|
+
6. Publication + documentation
|
|
86
|
+
|
|
87
|
+
**Promotion Model:**
|
|
88
|
+
1. Product team creates local component for their need
|
|
89
|
+
2. If useful for other teams, candidate for promotion
|
|
90
|
+
3. Core team evaluates: reuse potential, quality, a11y
|
|
91
|
+
4. If approved, component migrates to central system
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 2. Design Tokens
|
|
96
|
+
|
|
97
|
+
### 2.1 What Are Design Tokens
|
|
98
|
+
|
|
99
|
+
Concept created by **Jina Anne** (2014, Salesforce Lightning). A design token is a **named design decision** storing visual attributes (color, typography, spacing, elevation, animation) as data, not code.
|
|
100
|
+
|
|
101
|
+
### 2.2 W3C DTCG Specification
|
|
102
|
+
|
|
103
|
+
The **W3C Design Tokens Community Group** published its first stable version (2025.10). Style Dictionary 4.0, Token Studio, Supernova, and Specify all support it. It is now the de facto industry standard.
|
|
104
|
+
|
|
105
|
+
**JSON format:**
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"color": {
|
|
109
|
+
"primary": {
|
|
110
|
+
"$value": "#0066FF",
|
|
111
|
+
"$type": "color",
|
|
112
|
+
"$description": "Primary brand color for CTAs and key interactive elements"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"spacing": {
|
|
116
|
+
"medium": {
|
|
117
|
+
"$value": "16px",
|
|
118
|
+
"$type": "dimension"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Defined types:**
|
|
125
|
+
|
|
126
|
+
| Type | Examples |
|
|
127
|
+
|------|---------|
|
|
128
|
+
| `color` | `#FF0000`, `oklch(0.63 0.26 29)` |
|
|
129
|
+
| `dimension` | `16px`, `1rem` |
|
|
130
|
+
| `fontFamily` | `"Inter", sans-serif` |
|
|
131
|
+
| `fontWeight` | `400`, `bold` |
|
|
132
|
+
| `duration` | `200ms` |
|
|
133
|
+
| `cubicBezier` | `[0.4, 0, 0.2, 1]` |
|
|
134
|
+
| `number` | `1.5` (line-height, opacity) |
|
|
135
|
+
| `border` | Composition of width + color + style |
|
|
136
|
+
| `transition` | Composition of duration + delay + timingFunction |
|
|
137
|
+
| `shadow` | Composition of offsetX + offsetY + blur + spread + color |
|
|
138
|
+
| `gradient` | Linear/radial with stops |
|
|
139
|
+
| `typography` | Composition of fontFamily + fontSize + fontWeight + lineHeight + letterSpacing |
|
|
140
|
+
|
|
141
|
+
### 2.3 3-Tier Token Taxonomy
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
Global (blue.500) --> Alias (color.brand.primary) --> Component (button.primary.background.default)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Tier 1 -- Global Tokens (Primitives):**
|
|
148
|
+
Raw values without semantic context. The complete palette of options.
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"blue": {
|
|
153
|
+
"50": { "$value": "#EBF5FF" },
|
|
154
|
+
"500": { "$value": "#0066FF" },
|
|
155
|
+
"900": { "$value": "#001433" }
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Tier 2 -- Alias Tokens (Semantic):**
|
|
161
|
+
References to global tokens with contextual meaning.
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"color": {
|
|
166
|
+
"brand": {
|
|
167
|
+
"primary": { "$value": "{blue.500}" }
|
|
168
|
+
},
|
|
169
|
+
"feedback": {
|
|
170
|
+
"success": { "$value": "{green.500}" },
|
|
171
|
+
"error": { "$value": "{red.500}" }
|
|
172
|
+
},
|
|
173
|
+
"surface": {
|
|
174
|
+
"default": { "$value": "{gray.50}" },
|
|
175
|
+
"elevated": { "$value": "{white}" }
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Tier 3 -- Component Tokens (Specific):**
|
|
182
|
+
Tokens bound to specific components.
|
|
183
|
+
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"button": {
|
|
187
|
+
"primary": {
|
|
188
|
+
"background": {
|
|
189
|
+
"default": { "$value": "{color.brand.primary}" },
|
|
190
|
+
"hover": { "$value": "{blue.600}" },
|
|
191
|
+
"active": { "$value": "{blue.700}" }
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### 2.4 Multi-Theme Tokens
|
|
199
|
+
|
|
200
|
+
Components reference only alias tokens. Theme switching changes only the alias-layer mappings.
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"theme": {
|
|
205
|
+
"light": {
|
|
206
|
+
"color.surface.default": { "$value": "{white}" },
|
|
207
|
+
"color.text.primary": { "$value": "{gray.900}" }
|
|
208
|
+
},
|
|
209
|
+
"dark": {
|
|
210
|
+
"color.surface.default": { "$value": "{gray.900}" },
|
|
211
|
+
"color.text.primary": { "$value": "{gray.50}" }
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Figma Variables (2023+) support modes (light, dark, brand-a, brand-b) natively.
|
|
218
|
+
|
|
219
|
+
### 2.5 Style Dictionary
|
|
220
|
+
|
|
221
|
+
The most-used token transformer. Receives JSON tokens and generates outputs for any platform.
|
|
222
|
+
|
|
223
|
+
```javascript
|
|
224
|
+
export default {
|
|
225
|
+
source: ['tokens/**/*.json'],
|
|
226
|
+
platforms: {
|
|
227
|
+
css: {
|
|
228
|
+
transformGroup: 'css',
|
|
229
|
+
buildPath: 'build/css/',
|
|
230
|
+
files: [{ destination: 'variables.css', format: 'css/variables' }]
|
|
231
|
+
},
|
|
232
|
+
ios: {
|
|
233
|
+
transformGroup: 'ios-swift',
|
|
234
|
+
buildPath: 'build/ios/',
|
|
235
|
+
files: [{ destination: 'StyleDictionary.swift', format: 'ios-swift/class.swift' }]
|
|
236
|
+
},
|
|
237
|
+
android: {
|
|
238
|
+
transformGroup: 'android',
|
|
239
|
+
buildPath: 'build/android/',
|
|
240
|
+
files: [{ destination: 'values/tokens.xml', format: 'android/resources' }]
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Typical pipeline with Tokens Studio:**
|
|
247
|
+
```
|
|
248
|
+
Figma (Tokens Studio) --> Push to GitHub --> CI/CD --> Style Dictionary build --> Publish npm package
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### 2.6 Token-Driven Development
|
|
252
|
+
|
|
253
|
+
**Golden rule:** If you can see it, there is a token for it. No hardcoded values allowed.
|
|
254
|
+
|
|
255
|
+
```css
|
|
256
|
+
/* FORBIDDEN */
|
|
257
|
+
.button { background-color: #0066FF; padding: 8px 16px; }
|
|
258
|
+
|
|
259
|
+
/* CORRECT */
|
|
260
|
+
.button {
|
|
261
|
+
background-color: var(--color-brand-primary);
|
|
262
|
+
padding: var(--spacing-2) var(--spacing-4);
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Stylelint can enforce this automatically with `color-no-hex: true`.
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## 3. Foundations
|
|
271
|
+
|
|
272
|
+
### 3.1 Color Systems -- OKLCH
|
|
273
|
+
|
|
274
|
+
The industry is migrating from HSL to **OKLCH** (2020, Bjorn Ottosson). In OKLCH, colors with the same Lightness (L) actually appear the same perceived luminosity -- unlike HSL where yellow and blue at the same lightness look drastically different.
|
|
275
|
+
|
|
276
|
+
```css
|
|
277
|
+
:root {
|
|
278
|
+
--blue-50: oklch(97% 0.02 250);
|
|
279
|
+
--blue-100: oklch(93% 0.04 250);
|
|
280
|
+
--blue-500: oklch(58% 0.20 250);
|
|
281
|
+
--blue-900: oklch(18% 0.08 250);
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
CSS natively supports OKLCH: `color: oklch(58% 0.20 250)`.
|
|
286
|
+
|
|
287
|
+
**Lea Verou** (MIT, CSS Working Group) is the primary advocate. Tailwind CSS v4 adopted OKLCH for its modernized color palette.
|
|
288
|
+
|
|
289
|
+
**Semantic color mapping:**
|
|
290
|
+
```
|
|
291
|
+
Primitive Scale: Semantic Mapping:
|
|
292
|
+
blue.50 (lightest) --> surface.info.subtle
|
|
293
|
+
blue.500 --> interactive.primary.default
|
|
294
|
+
blue.600 --> interactive.primary.hover
|
|
295
|
+
blue.700 --> interactive.primary.active
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### 3.2 Typography -- Type Scales & Fluid Typography
|
|
299
|
+
|
|
300
|
+
**Modular scales** (Tim Brown, modularscale.com) use a ratio to generate sizes:
|
|
301
|
+
|
|
302
|
+
| Ratio | Name | Values (base 16px) |
|
|
303
|
+
|-------|------|---------------------|
|
|
304
|
+
| 1.125 | Major Second | 14, 16, 18, 20, 23 |
|
|
305
|
+
| 1.200 | Minor Third | 13, 16, 19, 23, 28 |
|
|
306
|
+
| 1.250 | Major Third | 13, 16, 20, 25, 31 |
|
|
307
|
+
| 1.333 | Perfect Fourth | 12, 16, 21, 28, 38 |
|
|
308
|
+
| 1.500 | Perfect Fifth | 11, 16, 24, 36, 54 |
|
|
309
|
+
|
|
310
|
+
Larger ratios = more dramatic (landing pages). Smaller ratios = more utilitarian (dashboards).
|
|
311
|
+
|
|
312
|
+
**Fluid Typography (Utopia.fyi):**
|
|
313
|
+
Interpolate smoothly between breakpoints using `clamp()`:
|
|
314
|
+
|
|
315
|
+
```css
|
|
316
|
+
--font-size-body: clamp(1rem, 0.9rem + 0.45vw, 1.25rem);
|
|
317
|
+
--font-size-h1: clamp(2rem, 1.6rem + 1.82vw, 3rem);
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Eliminates media queries for typography -- size adapts continuously to viewport.
|
|
321
|
+
|
|
322
|
+
**Variable Fonts:**
|
|
323
|
+
One file replaces 9+ static font files. Support any weight in a range.
|
|
324
|
+
|
|
325
|
+
```css
|
|
326
|
+
@font-face {
|
|
327
|
+
font-family: 'Inter Variable';
|
|
328
|
+
src: url('Inter-Variable.woff2') format('woff2');
|
|
329
|
+
font-weight: 100 900;
|
|
330
|
+
font-display: swap;
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Top variable fonts for interfaces: Inter (Rasmus Andersson), Roboto Flex (Google), Source Sans Variable (Adobe).
|
|
335
|
+
|
|
336
|
+
### 3.3 Spacing -- 4px/8px Grid
|
|
337
|
+
|
|
338
|
+
Industry standard: 4px base with geometric scale.
|
|
339
|
+
|
|
340
|
+
```
|
|
341
|
+
Spacing scale (4px base):
|
|
342
|
+
0 = 0px 1 = 4px 2 = 8px 3 = 12px
|
|
343
|
+
4 = 16px 6 = 24px 8 = 32px 12 = 48px
|
|
344
|
+
16 = 64px 20 = 80px 24 = 96px
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
Used by Material Design, Tailwind CSS, Shopify Polaris. 4px divides well across any device pixel ratio.
|
|
348
|
+
|
|
349
|
+
### 3.4 Elevation & Shadow
|
|
350
|
+
|
|
351
|
+
Shadow tokens encode spatial hierarchy:
|
|
352
|
+
|
|
353
|
+
```json
|
|
354
|
+
{
|
|
355
|
+
"shadow": {
|
|
356
|
+
"xs": { "$value": "0 1px 2px 0 rgba(0,0,0,0.05)" },
|
|
357
|
+
"sm": { "$value": "0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)" },
|
|
358
|
+
"md": { "$value": "0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)" },
|
|
359
|
+
"lg": { "$value": "0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)" },
|
|
360
|
+
"xl": { "$value": "0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)" }
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
In dark mode, use **surface color elevation** (lighter surfaces for higher elevation) instead of traditional shadows.
|
|
366
|
+
|
|
367
|
+
### 3.5 Motion & Animation Tokens
|
|
368
|
+
|
|
369
|
+
```json
|
|
370
|
+
{
|
|
371
|
+
"motion": {
|
|
372
|
+
"duration": {
|
|
373
|
+
"instant": { "$value": "50ms" },
|
|
374
|
+
"fast": { "$value": "100ms" },
|
|
375
|
+
"normal": { "$value": "200ms" },
|
|
376
|
+
"slow": { "$value": "300ms" },
|
|
377
|
+
"slower": { "$value": "500ms" }
|
|
378
|
+
},
|
|
379
|
+
"easing": {
|
|
380
|
+
"default": { "$value": "cubic-bezier(0.4, 0, 0.2, 1)" },
|
|
381
|
+
"in": { "$value": "cubic-bezier(0.4, 0, 1, 1)" },
|
|
382
|
+
"out": { "$value": "cubic-bezier(0, 0, 0.2, 1)" },
|
|
383
|
+
"spring": { "$value": "cubic-bezier(0.175, 0.885, 0.32, 1.275)" }
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
Key Disney principles for UI: Easing (slow in/out), Anticipation, Follow-through, Secondary action.
|
|
390
|
+
|
|
391
|
+
### 3.6 Iconography Systems
|
|
392
|
+
|
|
393
|
+
Modern standard (2024-2026): **SVG inline via React/Vue components** with tree-shaking.
|
|
394
|
+
|
|
395
|
+
| Approach | Examples | Advantage | Disadvantage |
|
|
396
|
+
|----------|----------|-----------|--------------|
|
|
397
|
+
| SVG inline (components) | Phosphor, Lucide | Max control, tree-shakeable | Larger bundle if not optimized |
|
|
398
|
+
| SVG sprites | Material Icons | Good for web, customizable | Requires build pipeline |
|
|
399
|
+
| Icon fonts | Font Awesome | Easy to use | A11y issues, layout shifts |
|
|
400
|
+
|
|
401
|
+
Icon system specs:
|
|
402
|
+
- **Grid:** 24x24 or 16x16 with 2px padding
|
|
403
|
+
- **Stroke width:** 1.5px or 2px (consistent across set)
|
|
404
|
+
- **Corner radius:** Consistent (sharp, rounded, or mixed)
|
|
405
|
+
- **Optical sizing:** Adjust visual size for complexity (complex icons appear smaller)
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
## 4. Component Architecture
|
|
410
|
+
|
|
411
|
+
### 4.1 Atomic Design (Brad Frost)
|
|
412
|
+
|
|
413
|
+
| Level | Analogy | Description | Examples |
|
|
414
|
+
|-------|---------|-------------|----------|
|
|
415
|
+
| **Atoms** | Atom | Basic irreducible elements | Button, Input, Label, Icon, Badge |
|
|
416
|
+
| **Molecules** | Molecule | Groups of atoms working together | Search Field, Form Field |
|
|
417
|
+
| **Organisms** | Organism | Sections composed of molecules/atoms | Header, Product Card |
|
|
418
|
+
| **Templates** | Blueprint | Layouts without real content | Dashboard Layout, Settings Layout |
|
|
419
|
+
| **Pages** | Final page | Templates with real content | Dashboard with data |
|
|
420
|
+
|
|
421
|
+
Most systems in practice use: **Primitives --> Components --> Patterns --> Layouts**.
|
|
422
|
+
|
|
423
|
+
### 4.2 Component API Design Principles
|
|
424
|
+
|
|
425
|
+
**1. Declarative over imperative:**
|
|
426
|
+
```tsx
|
|
427
|
+
// GOOD
|
|
428
|
+
<Button variant="primary" size="lg" loading>Submit</Button>
|
|
429
|
+
|
|
430
|
+
// BAD
|
|
431
|
+
<Button className="btn btn-primary btn-lg">
|
|
432
|
+
{loading ? <Spinner /> : "Submit"}
|
|
433
|
+
</Button>
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
**2. Sensible defaults:**
|
|
437
|
+
```tsx
|
|
438
|
+
<Button>Click me</Button>
|
|
439
|
+
// Equivalent to: variant="primary", size="md", disabled={false}, loading={false}
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
**3. Composition over configuration:**
|
|
443
|
+
```tsx
|
|
444
|
+
// GOOD -- composition (flexible)
|
|
445
|
+
<Card>
|
|
446
|
+
<Card.Header><Card.Title>Title</Card.Title></Card.Header>
|
|
447
|
+
<Card.Body>Content</Card.Body>
|
|
448
|
+
</Card>
|
|
449
|
+
|
|
450
|
+
// BAD -- configuration (rigid)
|
|
451
|
+
<Card title="Title" body="Content" />
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
**4. Strict TypeScript types:**
|
|
455
|
+
```tsx
|
|
456
|
+
type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
|
|
457
|
+
type ButtonSize = 'sm' | 'md' | 'lg';
|
|
458
|
+
|
|
459
|
+
interface ButtonProps {
|
|
460
|
+
variant?: ButtonVariant;
|
|
461
|
+
size?: ButtonSize;
|
|
462
|
+
loading?: boolean;
|
|
463
|
+
disabled?: boolean;
|
|
464
|
+
children: React.ReactNode;
|
|
465
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
466
|
+
}
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
### 4.3 Headless Components
|
|
470
|
+
|
|
471
|
+
Separate **logic/behavior** from **visual presentation**. The component manages state, a11y, keyboard navigation -- but applies no styles.
|
|
472
|
+
|
|
473
|
+
| Library | Maintained By | Approach |
|
|
474
|
+
|---------|---------------|----------|
|
|
475
|
+
| **Radix UI** | WorkOS | Unstyled React components with impeccable a11y |
|
|
476
|
+
| **Headless UI** | Tailwind Labs | Components for Tailwind CSS (React + Vue) |
|
|
477
|
+
| **React Aria** | Adobe | Accessibility hooks for React (base of Spectrum) |
|
|
478
|
+
| **Ark UI** | Chakra (Segun Adebayo) | Headless multi-framework (React, Vue, Solid) |
|
|
479
|
+
| **Melt UI** | Community | Headless components for Svelte |
|
|
480
|
+
|
|
481
|
+
```tsx
|
|
482
|
+
import * as Dialog from '@radix-ui/react-dialog';
|
|
483
|
+
|
|
484
|
+
<Dialog.Root>
|
|
485
|
+
<Dialog.Trigger>Open</Dialog.Trigger>
|
|
486
|
+
<Dialog.Portal>
|
|
487
|
+
<Dialog.Overlay className="backdrop" />
|
|
488
|
+
<Dialog.Content className="modal">
|
|
489
|
+
<Dialog.Title>Title</Dialog.Title>
|
|
490
|
+
<Dialog.Description>Description</Dialog.Description>
|
|
491
|
+
<Dialog.Close>Close</Dialog.Close>
|
|
492
|
+
</Dialog.Content>
|
|
493
|
+
</Dialog.Portal>
|
|
494
|
+
</Dialog.Root>
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
**shadcn/ui** (112K+ GitHub stars, Apr 2026) is built on Radix UI + Tailwind CSS. Not an npm package -- a collection of copy-paste components. Changed how the industry thinks about component libraries. In 2025-2026, AI tools (Claude Code, v0, Lovable) adopted shadcn as default UI library.
|
|
498
|
+
|
|
499
|
+
### 4.4 Compound Components Pattern
|
|
500
|
+
|
|
501
|
+
Parent and child components share state implicitly via React Context:
|
|
502
|
+
|
|
503
|
+
```tsx
|
|
504
|
+
<Select>
|
|
505
|
+
<Select.Trigger>Choose a fruit</Select.Trigger>
|
|
506
|
+
<Select.Content>
|
|
507
|
+
<Select.Item value="apple">Apple</Select.Item>
|
|
508
|
+
<Select.Item value="banana">Banana</Select.Item>
|
|
509
|
+
</Select.Content>
|
|
510
|
+
</Select>
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
### 4.5 Polymorphic Components
|
|
514
|
+
|
|
515
|
+
Render as different HTML elements via `as` or `asChild` prop:
|
|
516
|
+
|
|
517
|
+
```tsx
|
|
518
|
+
<Button>Click me</Button> // renders <button>
|
|
519
|
+
<Button as="a" href="/page">Go</Button> // renders <a>
|
|
520
|
+
<Button as={Link} href="/page">Nav</Button> // renders <Link>
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
Radix uses `asChild` which is more type-safe -- the trigger delegates rendering to the child, merging props and event handlers.
|
|
524
|
+
|
|
525
|
+
---
|
|
526
|
+
|
|
527
|
+
## 5. Accessibility (a11y)
|
|
528
|
+
|
|
529
|
+
### 5.1 WCAG 2.2
|
|
530
|
+
|
|
531
|
+
Version 2.2 (October 2023, approved as ISO/IEC 40500:2025 in October 2025) has 86 success criteria across three levels:
|
|
532
|
+
|
|
533
|
+
| Level | Meaning | Criteria |
|
|
534
|
+
|-------|---------|----------|
|
|
535
|
+
| **A** | Minimum -- remove critical barriers | 30 |
|
|
536
|
+
| **AA** | Recommended standard (target for most DS) | 24 |
|
|
537
|
+
| **AAA** | Maximum -- exceptional accessibility | 32 |
|
|
538
|
+
|
|
539
|
+
**Key WCAG 2.2 additions for design systems:**
|
|
540
|
+
|
|
541
|
+
| Criterion | ID | Impact |
|
|
542
|
+
|-----------|-----|--------|
|
|
543
|
+
| Focus Not Obscured (Min) | 2.4.11 AA | Focus indicator must not be fully covered by fixed elements |
|
|
544
|
+
| Dragging Movements | 2.5.7 AA | Every drag action must have single-pointer alternative |
|
|
545
|
+
| Target Size (Minimum) | 2.5.8 AA | Interaction targets minimum 24x24 CSS pixels |
|
|
546
|
+
| Accessible Authentication | 3.3.8 AA | Auth must not require cognitive test |
|
|
547
|
+
| Redundant Entry | 3.3.7 A | Don't ask for info already provided in session |
|
|
548
|
+
|
|
549
|
+
### 5.2 ARIA Patterns
|
|
550
|
+
|
|
551
|
+
| Component | Role | Key ARIA | Keyboard |
|
|
552
|
+
|-----------|------|----------|----------|
|
|
553
|
+
| Dialog/Modal | `dialog` | `aria-modal`, `aria-labelledby` | Esc closes, focus trap |
|
|
554
|
+
| Tabs | `tablist`, `tab`, `tabpanel` | `aria-selected`, `aria-controls` | Arrow keys navigate |
|
|
555
|
+
| Accordion | `heading`, `button`, `region` | `aria-expanded`, `aria-controls` | Enter/Space toggle |
|
|
556
|
+
| Menu | `menu`, `menuitem` | `aria-expanded`, `aria-haspopup` | Arrow keys navigate |
|
|
557
|
+
| Combobox | `combobox`, `listbox`, `option` | `aria-expanded`, `aria-activedescendant` | Arrow keys + typing |
|
|
558
|
+
| Tooltip | `tooltip` | `aria-describedby` | Esc closes, focus shows |
|
|
559
|
+
| Alert | `alert` | `aria-live="assertive"` | None -- auto announcement |
|
|
560
|
+
|
|
561
|
+
**Fundamental rule:** Use semantic HTML first. ARIA is a complement, not a substitute. `<button>` is better than `<div role="button">`.
|
|
562
|
+
|
|
563
|
+
### 5.3 Color Contrast Requirements
|
|
564
|
+
|
|
565
|
+
| Type | AA | AAA |
|
|
566
|
+
|------|-----|-----|
|
|
567
|
+
| Normal text (< 18pt / < 14pt bold) | 4.5:1 | 7:1 |
|
|
568
|
+
| Large text (>= 18pt / >= 14pt bold) | 3:1 | 4.5:1 |
|
|
569
|
+
| UI components and graphics | 3:1 | -- |
|
|
570
|
+
|
|
571
|
+
Tools: Stark (Figma plugin), axe DevTools (browser), Lighthouse (Chrome), Polypane.
|
|
572
|
+
|
|
573
|
+
### 5.4 Focus Management
|
|
574
|
+
|
|
575
|
+
1. Be focusable via `tabindex="0"` if not native elements
|
|
576
|
+
2. Show visible focus indicator -- outline with minimum 3:1 contrast
|
|
577
|
+
3. Maintain logical tab order following visual order
|
|
578
|
+
4. Trap focus in modals
|
|
579
|
+
5. Restore focus when closing modals
|
|
580
|
+
|
|
581
|
+
```css
|
|
582
|
+
:focus-visible {
|
|
583
|
+
outline: 2px solid var(--color-focus);
|
|
584
|
+
outline-offset: 2px;
|
|
585
|
+
}
|
|
586
|
+
:focus:not(:focus-visible) {
|
|
587
|
+
outline: none;
|
|
588
|
+
}
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
### 5.5 Automated a11y Testing
|
|
592
|
+
|
|
593
|
+
Automated tests detect ~30-40% of a11y issues. The rest requires manual testing (keyboard nav, screen reader, content review).
|
|
594
|
+
|
|
595
|
+
**axe-core (Deque Systems):** 100+ WCAG rules. Used as browser extension, in jest-axe, cypress-axe, Storybook addon-a11y, and CI/CD (@axe-core/playwright).
|
|
596
|
+
|
|
597
|
+
```tsx
|
|
598
|
+
import { axe } from 'jest-axe';
|
|
599
|
+
|
|
600
|
+
test('Button has no a11y violations', async () => {
|
|
601
|
+
const { container } = render(<Button>Click me</Button>);
|
|
602
|
+
const results = await axe(container);
|
|
603
|
+
expect(results).toHaveNoViolations();
|
|
604
|
+
});
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
### 5.6 Inclusive Design (Microsoft Toolkit)
|
|
608
|
+
|
|
609
|
+
Three categories of exclusion:
|
|
610
|
+
- **Permanent:** Blind, deaf, amputee
|
|
611
|
+
- **Temporary:** Eye inflammation, broken arm
|
|
612
|
+
- **Situational:** Driving (cannot look), noisy environment, holding a baby
|
|
613
|
+
|
|
614
|
+
Designing for permanent exclusion benefits everyone. Captions were created for deaf users but are used by 80% of audiences.
|
|
615
|
+
|
|
616
|
+
---
|
|
617
|
+
|
|
618
|
+
## 6. Design-to-Code Pipeline
|
|
619
|
+
|
|
620
|
+
### 6.1 Figma-to-Code Approaches
|
|
621
|
+
|
|
622
|
+
| Approach | Description | Quality |
|
|
623
|
+
|----------|-------------|---------|
|
|
624
|
+
| Manual inspection | Developer opens Dev Mode, inspects props, recreates | Slow, error-prone |
|
|
625
|
+
| Code generators | Anima, Locofy, Builder.io export from Figma | Starting point, rarely prod-ready |
|
|
626
|
+
| Token + component mapping | DS defines tokens/components in both Figma and code | State of the art |
|
|
627
|
+
| **Code Connect** (Figma 2024) | Maps Figma components directly to codebase components | Revolutionary -- eliminates ambiguity |
|
|
628
|
+
|
|
629
|
+
With Code Connect, when a developer inspects a Button in Figma, they see:
|
|
630
|
+
```tsx
|
|
631
|
+
import { Button } from '@mylib/components';
|
|
632
|
+
<Button variant="primary" size="lg">{props.label}</Button>
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
### 6.2 Figma Feature Timeline
|
|
636
|
+
|
|
637
|
+
| Feature | Year | Impact |
|
|
638
|
+
|---------|------|--------|
|
|
639
|
+
| Components | 2016 | Design element reuse |
|
|
640
|
+
| Auto Layout | 2019 (major 2022) | Responsive layout without manual constraints |
|
|
641
|
+
| Variants | 2020 | Multiple variants in one component |
|
|
642
|
+
| Dev Mode | 2023 | Optimized inspection for developers |
|
|
643
|
+
| Variables | 2023 | Native design tokens with modes (light/dark) |
|
|
644
|
+
| Code Connect | 2024 | Direct Figma-to-code component mapping |
|
|
645
|
+
| Multi-edit | 2024 | Edit multiple component instances simultaneously |
|
|
646
|
+
| Git Integration | 2025-2026 | Branch, commit, merge to GitHub/GitLab |
|
|
647
|
+
| Bidirectional Code Sync | 2025-2026 | Figma components sync with React codebases |
|
|
648
|
+
| MCP Server | 2025-2026 | Dev Mode as context for AI code generation |
|
|
649
|
+
|
|
650
|
+
### 6.3 Storybook (v8 --> v9 --> v10)
|
|
651
|
+
|
|
652
|
+
Standard tool for isolated component development and documentation. Used by Shopify, GitHub, Airbnb, IBM, Microsoft.
|
|
653
|
+
|
|
654
|
+
| Version | Key Feature | Description |
|
|
655
|
+
|---------|-------------|-------------|
|
|
656
|
+
| v8 (Mar 2024) | Portable stories | Stories reusable in unit tests |
|
|
657
|
+
| v8 | Visual tests built-in | Native Chromatic integration |
|
|
658
|
+
| v9 (Mid 2025) | Storybook Test | Partnership with Vitest |
|
|
659
|
+
| v9 | Install size -50% | Significant dependency reduction |
|
|
660
|
+
| v10 (Oct 2025) | ESM-only | Additional 29% install size reduction |
|
|
661
|
+
| v10 | CSF Factories | New story definition format (preview) |
|
|
662
|
+
|
|
663
|
+
**Essential addons:**
|
|
664
|
+
|
|
665
|
+
| Addon | Function |
|
|
666
|
+
|-------|----------|
|
|
667
|
+
| Controls | Modify props interactively |
|
|
668
|
+
| Actions | Log events (onClick, onChange) |
|
|
669
|
+
| Viewport | Simulate different screen sizes |
|
|
670
|
+
| a11y | Accessibility audit (axe-core) |
|
|
671
|
+
| Interactions | Interaction tests with Play Functions |
|
|
672
|
+
| Visual Tests | Chromatic visual regression |
|
|
673
|
+
| Docs | Automatic MDX documentation |
|
|
674
|
+
|
|
675
|
+
### 6.4 Visual Regression Testing
|
|
676
|
+
|
|
677
|
+
**Chromatic** (by Storybook creators): Renders each story in real browsers, captures screenshots, compares with baseline, requires human approval for intentional changes.
|
|
678
|
+
|
|
679
|
+
```yaml
|
|
680
|
+
# .github/workflows/chromatic.yml
|
|
681
|
+
name: Chromatic
|
|
682
|
+
on: push
|
|
683
|
+
jobs:
|
|
684
|
+
chromatic:
|
|
685
|
+
runs-on: ubuntu-latest
|
|
686
|
+
steps:
|
|
687
|
+
- uses: actions/checkout@v4
|
|
688
|
+
with: { fetch-depth: 0 }
|
|
689
|
+
- run: npm ci
|
|
690
|
+
- uses: chromaui/action@latest
|
|
691
|
+
with:
|
|
692
|
+
projectToken: ${{ secrets.CHROMATIC_TOKEN }}
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
Alternatives: Percy (BrowserStack), Playwright screenshots (DIY).
|
|
696
|
+
|
|
697
|
+
### 6.5 Single Source of Truth Pipeline
|
|
698
|
+
|
|
699
|
+
```
|
|
700
|
+
Tokens (SSOT for visual values)
|
|
701
|
+
--> Figma Variables (via Tokens Studio sync)
|
|
702
|
+
--> CSS Variables (via Style Dictionary)
|
|
703
|
+
--> iOS/Android constants (via Style Dictionary)
|
|
704
|
+
|
|
705
|
+
Components (SSOT for behavior)
|
|
706
|
+
--> Figma Components (design)
|
|
707
|
+
--> React Components (code)
|
|
708
|
+
--> Storybook Stories (docs + tests)
|
|
709
|
+
--> Code Connect (Figma <-> code mapping)
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
---
|
|
713
|
+
|
|
714
|
+
## 7. Component Libraries Comparison
|
|
715
|
+
|
|
716
|
+
### 7.1 React Libraries
|
|
717
|
+
|
|
718
|
+
| Library | Stars | Philosophy | CSS Approach | Best For |
|
|
719
|
+
|---------|-------|-----------|-------------|----------|
|
|
720
|
+
| **MUI** | 97K+ | Material Design implementation | Emotion (CSS-in-JS) | Material-styled apps |
|
|
721
|
+
| **shadcn/ui** | 112K+ | Copy-paste components (Radix + Tailwind) | Tailwind CSS | Full ownership, modern stack |
|
|
722
|
+
| **Ant Design** | 93K+ | Enterprise components (Alibaba) | CSS-in-JS | Admin panels, dashboards |
|
|
723
|
+
| **Chakra UI** | 38K+ | A11y-first, great DX (Segun Adebayo) | Emotion, v3 on Ark UI | Accessible apps |
|
|
724
|
+
| **Mantine** | 27K+ | All-in-one (130+ components) | Custom | Full-featured needs |
|
|
725
|
+
| **Radix Themes** | 5K+ | Visual layer on Radix primitives | CSS Variables | Cohesive out-of-box design |
|
|
726
|
+
|
|
727
|
+
### 7.2 CSS Approaches
|
|
728
|
+
|
|
729
|
+
| Approach | Library | Runtime | Trade-off |
|
|
730
|
+
|----------|---------|---------|-----------|
|
|
731
|
+
| Utility-first | **Tailwind CSS** (94K+ stars) | Zero | Verbose classnames, max flexibility |
|
|
732
|
+
| CSS Modules | Native | Zero | Scoped, simple, predictable |
|
|
733
|
+
| CSS-in-TypeScript | **vanilla-extract** (9K+) | Zero | Type-safe styles, compiled to CSS |
|
|
734
|
+
| Utility + Recipes | **Panda CSS** (5K+) | Zero | Combines Tailwind + CSS-in-JS benefits |
|
|
735
|
+
| Tagged templates | **styled-components** (40K+) | Runtime | Declining due to performance overhead |
|
|
736
|
+
|
|
737
|
+
**Tailwind CSS v4 (Jan 2025):** Rewritten engine (5x faster full builds, 100x+ incremental), CSS-first config (no tailwind.config.js), automatic content detection, OKLCH color palette, native cascade layers.
|
|
738
|
+
|
|
739
|
+
### 7.3 Web Components
|
|
740
|
+
|
|
741
|
+
Native browser standards (Custom Elements + Shadow DOM). Write once, use in any framework.
|
|
742
|
+
|
|
743
|
+
**Lit (Google, 18K+ stars):** Primary library for Web Components with reactive properties, scoped styles, efficient templates.
|
|
744
|
+
|
|
745
|
+
Used by: Google (Material Web), SAP (UI5), Salesforce (Lightning Web Components), ING Bank.
|
|
746
|
+
|
|
747
|
+
Best use case: organizations with multiple frameworks.
|
|
748
|
+
|
|
749
|
+
---
|
|
750
|
+
|
|
751
|
+
## 8. Documentation & Governance
|
|
752
|
+
|
|
753
|
+
### 8.1 Living Documentation Principles
|
|
754
|
+
|
|
755
|
+
1. **Co-located with code** -- story/doc lives in same directory as component
|
|
756
|
+
2. **Auto-extracted** -- TypeScript types generate prop tables automatically
|
|
757
|
+
3. **Interactive** -- reader can change props and see results in real time
|
|
758
|
+
4. **Contextualized** -- shows when to use, when NOT to use, alternatives
|
|
759
|
+
5. **Versioned** -- versioned with code, not separately
|
|
760
|
+
|
|
761
|
+
### 8.2 Storybook + MDX
|
|
762
|
+
|
|
763
|
+
```mdx
|
|
764
|
+
import { Meta, Canvas, Controls, ArgsTable } from '@storybook/blocks';
|
|
765
|
+
import * as ButtonStories from './Button.stories';
|
|
766
|
+
|
|
767
|
+
<Meta of={ButtonStories} />
|
|
768
|
+
|
|
769
|
+
# Button
|
|
770
|
+
|
|
771
|
+
## When to use
|
|
772
|
+
- **Primary:** Main action on a page (max 1 per view)
|
|
773
|
+
- **Secondary:** Supporting actions
|
|
774
|
+
|
|
775
|
+
## When NOT to use
|
|
776
|
+
- For navigation -- use `<Link>` instead
|
|
777
|
+
- For toggling state -- use `<Toggle>` instead
|
|
778
|
+
|
|
779
|
+
<Canvas of={ButtonStories.Primary} />
|
|
780
|
+
<Controls />
|
|
781
|
+
<ArgsTable of={ButtonStories} />
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
### 8.3 Documentation Platforms
|
|
785
|
+
|
|
786
|
+
| Platform | Differentiator |
|
|
787
|
+
|----------|---------------|
|
|
788
|
+
| **Zeroheight** | Connects Figma, Storybook, code. Non-technical contributors |
|
|
789
|
+
| **Supernova** | Auto-syncs with Figma. Multi-brand, end-to-end |
|
|
790
|
+
| **Knapsack** | Multi-framework (React, Vue, Angular, WC) in same docs |
|
|
791
|
+
|
|
792
|
+
### 8.4 Versioning Strategy (SemVer)
|
|
793
|
+
|
|
794
|
+
```
|
|
795
|
+
MAJOR: Breaking changes (rename prop, remove component)
|
|
796
|
+
MINOR: New backward-compatible features (add prop, add component)
|
|
797
|
+
PATCH: Bug fixes, performance improvements
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
**Breaking change management:**
|
|
801
|
+
1. Mark as deprecated with clear message
|
|
802
|
+
2. Provide codemods (jscodeshift) for automatic migration
|
|
803
|
+
3. Document migration guide
|
|
804
|
+
4. Maintain deprecated for 1-2 minor releases
|
|
805
|
+
5. Remove in next major release
|
|
806
|
+
|
|
807
|
+
### 8.5 RFC Process Template
|
|
808
|
+
|
|
809
|
+
```
|
|
810
|
+
RFC-001: Add Stepper Component
|
|
811
|
+
|
|
812
|
+
## Motivation
|
|
813
|
+
3 product teams independently implemented steppers.
|
|
814
|
+
|
|
815
|
+
## Detailed Design
|
|
816
|
+
- API: <Stepper steps={[...]} currentStep={1} />
|
|
817
|
+
- Variants: horizontal, vertical
|
|
818
|
+
- Accessibility: ARIA progressbar pattern
|
|
819
|
+
|
|
820
|
+
## Alternatives Considered
|
|
821
|
+
1. Extend Tabs (rejected: wrong mental model)
|
|
822
|
+
2. Third-party (rejected: doesn't follow our tokens)
|
|
823
|
+
|
|
824
|
+
## Timeline
|
|
825
|
+
- Design: 2 weeks | Dev: 3 weeks | Testing: 1 week | Docs: 1 week
|
|
826
|
+
```
|
|
827
|
+
|
|
828
|
+
---
|
|
829
|
+
|
|
830
|
+
## 9. Testing & Quality
|
|
831
|
+
|
|
832
|
+
### 9.1 Testing Strategy
|
|
833
|
+
|
|
834
|
+
| Type | What to Test | Tools |
|
|
835
|
+
|------|-------------|-------|
|
|
836
|
+
| **Visual regression** | Screenshot diff across versions | Chromatic, Percy, Playwright |
|
|
837
|
+
| **Unit** | Rendering, props, events, states | Testing Library + Vitest/Jest |
|
|
838
|
+
| **Accessibility** | Roles, aria attributes, keyboard nav | jest-axe, Storybook addon-a11y |
|
|
839
|
+
| **Interaction** | Complex user flows in stories | Storybook Play Functions |
|
|
840
|
+
| **Cross-browser** | All supported browsers | Playwright, BrowserStack |
|
|
841
|
+
| **Performance** | Bundle size, render time | size-limit, React DevTools |
|
|
842
|
+
|
|
843
|
+
### 9.2 Unit Testing Example
|
|
844
|
+
|
|
845
|
+
```tsx
|
|
846
|
+
import { render, screen } from '@testing-library/react';
|
|
847
|
+
import userEvent from '@testing-library/user-event';
|
|
848
|
+
import { Button } from './Button';
|
|
849
|
+
|
|
850
|
+
describe('Button', () => {
|
|
851
|
+
it('renders with children', () => {
|
|
852
|
+
render(<Button>Click me</Button>);
|
|
853
|
+
expect(screen.getByRole('button', { name: 'Click me' })).toBeInTheDocument();
|
|
854
|
+
});
|
|
855
|
+
|
|
856
|
+
it('calls onClick when clicked', async () => {
|
|
857
|
+
const user = userEvent.setup();
|
|
858
|
+
const handleClick = vi.fn();
|
|
859
|
+
render(<Button onClick={handleClick}>Click me</Button>);
|
|
860
|
+
await user.click(screen.getByRole('button'));
|
|
861
|
+
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
862
|
+
});
|
|
863
|
+
|
|
864
|
+
it('is disabled when loading', () => {
|
|
865
|
+
render(<Button loading>Click me</Button>);
|
|
866
|
+
expect(screen.getByRole('button')).toBeDisabled();
|
|
867
|
+
});
|
|
868
|
+
});
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
### 9.3 Interaction Testing (Storybook Play Functions)
|
|
872
|
+
|
|
873
|
+
```tsx
|
|
874
|
+
export const WithFormValidation: Story = {
|
|
875
|
+
play: async ({ canvasElement, step }) => {
|
|
876
|
+
const canvas = within(canvasElement);
|
|
877
|
+
await step('Leave email empty and submit', async () => {
|
|
878
|
+
await userEvent.click(canvas.getByRole('button', { name: 'Submit' }));
|
|
879
|
+
});
|
|
880
|
+
await step('Verify error message', async () => {
|
|
881
|
+
await expect(canvas.getByText('Email is required')).toBeInTheDocument();
|
|
882
|
+
});
|
|
883
|
+
},
|
|
884
|
+
};
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
### 9.4 Performance Targets
|
|
888
|
+
|
|
889
|
+
| Metric | Target | Tool |
|
|
890
|
+
|--------|--------|------|
|
|
891
|
+
| Bundle size per component | < 5KB gzipped (atom), < 20KB (organism) | bundlephobia, size-limit |
|
|
892
|
+
| Runtime performance | < 16ms render (60fps) | React DevTools Profiler |
|
|
893
|
+
| First render | < 100ms for visible component | Lighthouse |
|
|
894
|
+
| Re-render | Minimize unnecessary re-renders | why-did-you-render |
|
|
895
|
+
|
|
896
|
+
### 9.5 Cross-Browser Matrix
|
|
897
|
+
|
|
898
|
+
| Browser | Version | Engine |
|
|
899
|
+
|---------|---------|--------|
|
|
900
|
+
| Chrome | Latest 2 | Blink |
|
|
901
|
+
| Firefox | Latest 2 | Gecko |
|
|
902
|
+
| Safari | Latest 2 | WebKit |
|
|
903
|
+
| Edge | Latest 2 | Blink |
|
|
904
|
+
| Safari iOS | Latest 2 | WebKit |
|
|
905
|
+
| Chrome Android | Latest | Blink |
|
|
906
|
+
|
|
907
|
+
---
|
|
908
|
+
|
|
909
|
+
## 10. DesignOps
|
|
910
|
+
|
|
911
|
+
### 10.1 Team Models
|
|
912
|
+
|
|
913
|
+
| Model | Structure | Adopted By |
|
|
914
|
+
|-------|-----------|------------|
|
|
915
|
+
| **Centralized** | 3-8 dedicated (1-2 designers, 2-4 engineers, 1 PM) | Salesforce, IBM, Microsoft |
|
|
916
|
+
| **Federated** | No dedicated team; community contributors + board | Smaller organizations |
|
|
917
|
+
| **Hybrid** | Small core team (2-4) + product contributors via RFC | Shopify, GitHub, Atlassian |
|
|
918
|
+
|
|
919
|
+
### 10.2 Adoption Metrics
|
|
920
|
+
|
|
921
|
+
| Metric | How to Measure | Target |
|
|
922
|
+
|--------|---------------|--------|
|
|
923
|
+
| Coverage | % of screens using system components | > 80% |
|
|
924
|
+
| Adoption rate | % of teams using the system | > 90% |
|
|
925
|
+
| Token compliance | % of visual values via tokens (vs hardcoded) | > 95% |
|
|
926
|
+
| Component reuse | # instances per component | > 10 (avg) |
|
|
927
|
+
| Contribution rate | # PRs from product teams / month | 2-5 |
|
|
928
|
+
| Satisfaction (NPS) | Quarterly survey | > 50 |
|
|
929
|
+
| Time to implement | Average time to implement new screen | > 40% reduction |
|
|
930
|
+
| Design-dev parity | % components with Figma + code equivalent | > 90% |
|
|
931
|
+
|
|
932
|
+
**Measurement tools:** Omlet (codebase adoption analysis), Figma Analytics, Custom ESLint rules.
|
|
933
|
+
|
|
934
|
+
### 10.3 ROI
|
|
935
|
+
|
|
936
|
+
```
|
|
937
|
+
ROI = ((Hours saved * Cost/hour) - Investment) / Investment
|
|
938
|
+
|
|
939
|
+
Industry benchmark (Sparkbox 2023):
|
|
940
|
+
- 34% average dev time reduction
|
|
941
|
+
- 29% average visual bug reduction
|
|
942
|
+
- 89% report consistency improvement
|
|
943
|
+
- Salesforce: $2B+ annual savings from Lightning DS
|
|
944
|
+
- Shopify: 50% reduction in new screen build time
|
|
945
|
+
```
|
|
946
|
+
|
|
947
|
+
### 10.4 Maturity Model (InVision)
|
|
948
|
+
|
|
949
|
+
| Level | Name | Characteristics |
|
|
950
|
+
|-------|------|-----------------|
|
|
951
|
+
| 1 | **Ad Hoc** | No system. Individual components. Total inconsistency |
|
|
952
|
+
| 2 | **Emerging** | Basic style guide. Some conventions. Inconsistent adoption |
|
|
953
|
+
| 3 | **Defined** | Formal DS. Tokens, components, docs. Dedicated/partial team |
|
|
954
|
+
| 4 | **Managed** | Mature system. Adoption metrics. Clear governance. Federated contribution |
|
|
955
|
+
| 5 | **Optimized** | System as product. Continuous innovation. Industry benchmark |
|
|
956
|
+
|
|
957
|
+
### 10.5 Design System as a Product
|
|
958
|
+
|
|
959
|
+
**Dan Mall** ("Design That Scales", 2022): Design systems fail when treated as projects (end when budget runs out) and thrive when treated as products (evolve continuously based on user feedback).
|
|
960
|
+
|
|
961
|
+
Practices: user research with consumer teams, public roadmap, detailed changelogs, weekly office hours, usage analytics, deprecation notices.
|
|
962
|
+
|
|
963
|
+
---
|
|
964
|
+
|
|
965
|
+
## 11. Performance & Optimization
|
|
966
|
+
|
|
967
|
+
### 11.1 Tree-Shaking
|
|
968
|
+
|
|
969
|
+
Requirements:
|
|
970
|
+
1. **ESM exports** -- `import/export`, not CommonJS
|
|
971
|
+
2. **sideEffects: false** in package.json
|
|
972
|
+
3. **Per-component exports**
|
|
973
|
+
|
|
974
|
+
```json
|
|
975
|
+
{
|
|
976
|
+
"sideEffects": false,
|
|
977
|
+
"exports": {
|
|
978
|
+
".": { "import": "./dist/index.mjs" },
|
|
979
|
+
"./button": { "import": "./dist/button.mjs" },
|
|
980
|
+
"./modal": { "import": "./dist/modal.mjs" }
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
```
|
|
984
|
+
|
|
985
|
+
### 11.2 Code-Splitting
|
|
986
|
+
|
|
987
|
+
```tsx
|
|
988
|
+
const DataTable = React.lazy(() => import('@mylib/components/data-table'));
|
|
989
|
+
|
|
990
|
+
<Suspense fallback={<Skeleton />}>
|
|
991
|
+
<DataTable data={data} />
|
|
992
|
+
</Suspense>
|
|
993
|
+
```
|
|
994
|
+
|
|
995
|
+
### 11.3 CSS Optimization
|
|
996
|
+
|
|
997
|
+
- **CSS Layers:** `@layer reset, tokens, components, utilities;` -- controls specificity without `!important`
|
|
998
|
+
- **Critical CSS:** Extract above-the-fold CSS and inline in HTML (Critters, Next.js native)
|
|
999
|
+
- **CSS Purging:** Remove unused CSS (Tailwind does automatically; PurgeCSS for traditional CSS)
|
|
1000
|
+
|
|
1001
|
+
### 11.4 Core Web Vitals Impact
|
|
1002
|
+
|
|
1003
|
+
| Metric | How DS Affects It | Optimization |
|
|
1004
|
+
|--------|-------------------|-------------|
|
|
1005
|
+
| **LCP** | Heavy components delay render | Lazy loading, code-splitting |
|
|
1006
|
+
| **INP** | Slow event handlers | Optimize renders, useCallback/useMemo |
|
|
1007
|
+
| **CLS** | Components without explicit dimensions | Skeleton loaders, aspect-ratio, reserve space |
|
|
1008
|
+
|
|
1009
|
+
---
|
|
1010
|
+
|
|
1011
|
+
## 12. Famous Design Systems Comparison
|
|
1012
|
+
|
|
1013
|
+
### 12.1 Architectural Comparison
|
|
1014
|
+
|
|
1015
|
+
| Design System | Token Format | CSS Approach | Framework | Components |
|
|
1016
|
+
|--------------|-------------|-------------|-----------|------------|
|
|
1017
|
+
| **Material Design** (Google) | W3C DTCG | CSS custom properties | Multi (Web, Flutter, Android) | 50+ |
|
|
1018
|
+
| **Carbon** (IBM) | Custom JSON | Sass + CSS vars | Multi (React, Vue, Angular, Svelte) | 80+ |
|
|
1019
|
+
| **Polaris** (Shopify) | Custom JSON | CSS Modules | React | 60+ |
|
|
1020
|
+
| **Primer** (GitHub) | JSON | Styled Components + CSS | React | 60+ |
|
|
1021
|
+
| **Atlassian DS** | Custom | Emotion | React | 70+ |
|
|
1022
|
+
| **Lightning** (Salesforce) | Custom (pioneer) | BEM CSS | LWC (Web Components) | 100+ |
|
|
1023
|
+
| **Spectrum** (Adobe) | Custom | CSS Modules | React (+ React Aria) | 70+ |
|
|
1024
|
+
| **Fluent** (Microsoft) | Custom | Griffel (atomic) | React | 80+ |
|
|
1025
|
+
| **Geist** (Vercel) | Tailwind | Tailwind CSS | React | 30+ |
|
|
1026
|
+
|
|
1027
|
+
### 12.2 What to Learn from Each
|
|
1028
|
+
|
|
1029
|
+
| System | Key Lesson |
|
|
1030
|
+
|--------|-----------|
|
|
1031
|
+
| **Material Design** | Systematic rigor, exhaustive docs, motion guidelines, token architecture |
|
|
1032
|
+
| **Carbon (IBM)** | Enterprise UX, data visualization, multi-framework strategy, a11y rigor |
|
|
1033
|
+
| **Polaris (Shopify)** | Principles-driven design, contribution model, commerce UX patterns |
|
|
1034
|
+
| **Primer (GitHub)** | Developer-centric design, dark mode architecture, open-source governance |
|
|
1035
|
+
| **Atlassian DS** | Enterprise patterns, pragmatic governance, scaling across products |
|
|
1036
|
+
| **Lightning (Salesforce)** | Design tokens as concept (pioneer), enterprise patterns, a11y compliance |
|
|
1037
|
+
| **Spectrum (Adobe)** | 3-layer architecture (behavior/state/visual), React Aria, i18n |
|
|
1038
|
+
| **Fluent (Microsoft)** | Enterprise scale, high-contrast a11y, atomic CSS optimization |
|
|
1039
|
+
| **HIG (Apple)** | Platform-native design, haptics/spatial, design for delight |
|
|
1040
|
+
| **Geist (Vercel)** | Modern minimalism, developer-first UX, font as brand identity |
|
|
1041
|
+
|
|
1042
|
+
---
|
|
1043
|
+
|
|
1044
|
+
## 13. Brazilian Context
|
|
1045
|
+
|
|
1046
|
+
### 13.1 Notable Brazilian Design Systems
|
|
1047
|
+
|
|
1048
|
+
**Natura Design System (Natura &Co):**
|
|
1049
|
+
Multi-brand system (Natura, Avon, The Body Shop). Uses design tokens for theming and Storybook for documentation.
|
|
1050
|
+
|
|
1051
|
+
**NuDS (Nubank Design System):**
|
|
1052
|
+
100+ reusable components and screen templates. Custom typeface **Nu Sans** (32 fonts: 2 optical sizes, 3 widths, 4 weights with italics, by Blackletra Type Foundry). Iconic purple color treated as fundamental design token. Brand color updates deployed in a single sprint thanks to token architecture.
|
|
1053
|
+
|
|
1054
|
+
**Itau Design System:**
|
|
1055
|
+
Robust system for digital channels (app, internet banking, ATMs). Focus on cross-channel consistency and regulatory a11y compliance. 2025 digital overhaul aims for 75% of retail customers served exclusively via digital channels.
|
|
1056
|
+
|
|
1057
|
+
**VTEX Styleguide:**
|
|
1058
|
+
E-commerce platform. One of few genuinely open-source Brazilian design systems. React components for admin panel construction.
|
|
1059
|
+
|
|
1060
|
+
**RD Station:**
|
|
1061
|
+
Internal DS for marketing/CRM products. React-based with focus on cross-product consistency.
|
|
1062
|
+
|
|
1063
|
+
**Magazine Luiza (Magalu):**
|
|
1064
|
+
DS to unify app, site, and marketplace experience. Includes "Lu" (digital avatar) as brand system element.
|
|
1065
|
+
|
|
1066
|
+
### 13.2 Brazilian Regulatory Requirements
|
|
1067
|
+
|
|
1068
|
+
| Regulation | What It Requires |
|
|
1069
|
+
|-----------|-----------------|
|
|
1070
|
+
| **LBI** (Lei 13.146/2015) | Digital accessibility mandatory for companies with presence in Brazil |
|
|
1071
|
+
| **e-MAG** | Brazilian WCAG (government sites must comply) |
|
|
1072
|
+
| **Decreto 10.645/2021** | Accessibility seal and periodic audits for government sites |
|
|
1073
|
+
|
|
1074
|
+
**Implications:** Components MUST meet WCAG AA minimum. Digital accessibility is a legal obligation, not a competitive differentiator. Fines can be applied by the Public Ministry.
|
|
1075
|
+
|
|
1076
|
+
### 13.3 Brazil-Specific Design Challenges
|
|
1077
|
+
|
|
1078
|
+
| Challenge | Design System Impact |
|
|
1079
|
+
|-----------|---------------------|
|
|
1080
|
+
| Device diversity | Many low-cost Android devices with small screens, less processing power |
|
|
1081
|
+
| Variable connectivity | Components must work in low-bandwidth (progressive loading, graceful degradation) |
|
|
1082
|
+
| PIX payments | E-commerce/fintech DS must include PIX-specific patterns (QR code, copy-paste, expiration timer) |
|
|
1083
|
+
| WhatsApp-first (120M+ users) | Consider WhatsApp integration patterns (click-to-chat, notifications, chatbots) |
|
|
1084
|
+
| Multilingual ops | International companies (Natura, Nubank) need i18n for Spanish, English |
|
|
1085
|
+
|
|
1086
|
+
---
|
|
1087
|
+
|
|
1088
|
+
## 14. Advanced Patterns
|
|
1089
|
+
|
|
1090
|
+
### 14.1 Theming Architecture
|
|
1091
|
+
|
|
1092
|
+
```tsx
|
|
1093
|
+
function ThemeProvider({ theme, children }) {
|
|
1094
|
+
return (
|
|
1095
|
+
<div data-theme={theme.name} style={tokensToCSSVars(theme.tokens)}>
|
|
1096
|
+
{children}
|
|
1097
|
+
</div>
|
|
1098
|
+
);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
<ThemeProvider theme={lightTheme}><App /></ThemeProvider>
|
|
1102
|
+
<ThemeProvider theme={darkTheme}><App /></ThemeProvider>
|
|
1103
|
+
<ThemeProvider theme={brandBTheme}><App /></ThemeProvider>
|
|
1104
|
+
```
|
|
1105
|
+
|
|
1106
|
+
**Dark mode pitfalls:**
|
|
1107
|
+
- Not "invert colors" -- needs redesigned palette
|
|
1108
|
+
- Images/illustrations need dark variants
|
|
1109
|
+
- Shadows don't work (use surface elevation instead)
|
|
1110
|
+
- Reduce color saturation (vibrant colors in dark are aggressive)
|
|
1111
|
+
- Pure white (#FFFFFF) is aggressive -- use off-white (#E0E0E0)
|
|
1112
|
+
|
|
1113
|
+
### 14.2 Controlled vs Uncontrolled
|
|
1114
|
+
|
|
1115
|
+
Components should support both modes via `useControllableState`:
|
|
1116
|
+
|
|
1117
|
+
```tsx
|
|
1118
|
+
function useControllableState({ value, defaultValue, onChange }) {
|
|
1119
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
1120
|
+
const isControlled = value !== undefined;
|
|
1121
|
+
const currentValue = isControlled ? value : internalValue;
|
|
1122
|
+
const setValue = useCallback((next) => {
|
|
1123
|
+
if (!isControlled) setInternalValue(next);
|
|
1124
|
+
onChange?.(next);
|
|
1125
|
+
}, [isControlled, onChange]);
|
|
1126
|
+
return [currentValue, setValue];
|
|
1127
|
+
}
|
|
1128
|
+
```
|
|
1129
|
+
|
|
1130
|
+
### 14.3 Slots Pattern
|
|
1131
|
+
|
|
1132
|
+
Consumers replace internal parts of a component without reimplementing:
|
|
1133
|
+
|
|
1134
|
+
```tsx
|
|
1135
|
+
<Card>
|
|
1136
|
+
<Card.Slot name="header"><CustomHeader /></Card.Slot>
|
|
1137
|
+
<Card.Slot name="body"><p>Content</p></Card.Slot>
|
|
1138
|
+
<Card.Slot name="footer"><CustomFooter /></Card.Slot>
|
|
1139
|
+
</Card>
|
|
1140
|
+
```
|
|
1141
|
+
|
|
1142
|
+
### 14.4 RTL Support
|
|
1143
|
+
|
|
1144
|
+
Use CSS Logical Properties (supported in all modern browsers):
|
|
1145
|
+
|
|
1146
|
+
```css
|
|
1147
|
+
/* Old (not RTL-safe) */
|
|
1148
|
+
margin-left: 16px;
|
|
1149
|
+
text-align: left;
|
|
1150
|
+
|
|
1151
|
+
/* Modern (RTL-safe) */
|
|
1152
|
+
margin-inline-start: 16px;
|
|
1153
|
+
text-align: start;
|
|
1154
|
+
```
|
|
1155
|
+
|
|
1156
|
+
### 14.5 Responsive Design Tokens
|
|
1157
|
+
|
|
1158
|
+
```css
|
|
1159
|
+
:root {
|
|
1160
|
+
--spacing-page-gutter: clamp(16px, 2vw + 8px, 32px);
|
|
1161
|
+
--font-size-heading-1: clamp(28px, 4vw + 12px, 48px);
|
|
1162
|
+
}
|
|
1163
|
+
```
|
|
1164
|
+
|
|
1165
|
+
### 14.6 Animation Vocabulary
|
|
1166
|
+
|
|
1167
|
+
| Pattern | When to Use | Example |
|
|
1168
|
+
|---------|-------------|---------|
|
|
1169
|
+
| Fade | Elements appearing/disappearing without moving | Tooltip, notification |
|
|
1170
|
+
| Slide | Elements entering from a direction | Drawer, panel, sheet |
|
|
1171
|
+
| Scale | Elements growing/shrinking | Modal opening, zoom |
|
|
1172
|
+
| Morph | Elements changing shape/position | Shared element transition |
|
|
1173
|
+
| Stagger | Group animating in sequence | List items appearing |
|
|
1174
|
+
| Spring | Physics-based spring animation | Drag and drop, pull to refresh |
|
|
1175
|
+
|
|
1176
|
+
**Framer Motion** (23K+ stars) is the most-used React animation library for design systems.
|
|
1177
|
+
|
|
1178
|
+
### 14.7 Design Linting
|
|
1179
|
+
|
|
1180
|
+
**Stylelint** enforces token usage:
|
|
1181
|
+
```json
|
|
1182
|
+
{
|
|
1183
|
+
"rules": {
|
|
1184
|
+
"color-no-hex": true,
|
|
1185
|
+
"declaration-property-value-allowed-list": {
|
|
1186
|
+
"color": ["/var\\(--/"],
|
|
1187
|
+
"background-color": ["/var\\(--/"]
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
```
|
|
1192
|
+
|
|
1193
|
+
**Custom ESLint** enforces DS component usage:
|
|
1194
|
+
```javascript
|
|
1195
|
+
// Ban raw HTML elements in favor of DS components
|
|
1196
|
+
const banned = ['button', 'input', 'select', 'textarea'];
|
|
1197
|
+
if (banned.includes(node.name.name)) {
|
|
1198
|
+
context.report({ message: `Use DS component instead of <${node.name.name}>` });
|
|
1199
|
+
}
|
|
1200
|
+
```
|
|
1201
|
+
|
|
1202
|
+
---
|
|
1203
|
+
|
|
1204
|
+
## 15. Actionable Checklists
|
|
1205
|
+
|
|
1206
|
+
### 15.1 Design System Setup Checklist
|
|
1207
|
+
|
|
1208
|
+
- [ ] Define design principles (3-5 core principles)
|
|
1209
|
+
- [ ] Establish token taxonomy (global --> alias --> component)
|
|
1210
|
+
- [ ] Set up color system with OKLCH scales (10-12 levels per hue)
|
|
1211
|
+
- [ ] Define type scale with fluid typography (`clamp()`)
|
|
1212
|
+
- [ ] Create spacing scale (4px base)
|
|
1213
|
+
- [ ] Define elevation/shadow tokens
|
|
1214
|
+
- [ ] Define motion tokens (duration + easing)
|
|
1215
|
+
- [ ] Choose icon system (SVG components recommended)
|
|
1216
|
+
- [ ] Set up Style Dictionary for multi-platform token output
|
|
1217
|
+
- [ ] Configure Tokens Studio for Figma-Git sync
|
|
1218
|
+
- [ ] Set up Storybook for component development
|
|
1219
|
+
- [ ] Configure Chromatic for visual regression testing
|
|
1220
|
+
- [ ] Set up jest-axe for automated a11y testing
|
|
1221
|
+
- [ ] Define governance model (centralized, federated, or hybrid)
|
|
1222
|
+
- [ ] Create contribution RFC template
|
|
1223
|
+
- [ ] Set up size-limit for bundle monitoring
|
|
1224
|
+
|
|
1225
|
+
### 15.2 Component Quality Checklist
|
|
1226
|
+
|
|
1227
|
+
- [ ] TypeScript interface with strict types (no `any`)
|
|
1228
|
+
- [ ] Sensible default props
|
|
1229
|
+
- [ ] All visual values use tokens (no hardcoded colors/spacing)
|
|
1230
|
+
- [ ] Supports all states: default, hover, active, focus, disabled, loading
|
|
1231
|
+
- [ ] Accessible: correct ARIA roles, keyboard navigation, focus management
|
|
1232
|
+
- [ ] passes jest-axe tests
|
|
1233
|
+
- [ ] Storybook story for each variant and state
|
|
1234
|
+
- [ ] Unit tests: rendering, props, events, states
|
|
1235
|
+
- [ ] Visual regression baseline captured
|
|
1236
|
+
- [ ] Documentation: when to use, when NOT to use, API reference
|
|
1237
|
+
- [ ] Bundle size within targets (< 5KB atom, < 20KB organism)
|
|
1238
|
+
- [ ] Works in light and dark themes
|
|
1239
|
+
- [ ] Supports controlled and uncontrolled modes (form components)
|
|
1240
|
+
|
|
1241
|
+
### 15.3 Pre-Release Checklist
|
|
1242
|
+
|
|
1243
|
+
- [ ] All components pass visual regression
|
|
1244
|
+
- [ ] All a11y tests pass
|
|
1245
|
+
- [ ] All unit/interaction tests pass
|
|
1246
|
+
- [ ] Cross-browser tested (Chrome, Firefox, Safari, Edge)
|
|
1247
|
+
- [ ] Bundle size within limits
|
|
1248
|
+
- [ ] Breaking changes documented with migration guide
|
|
1249
|
+
- [ ] Deprecated APIs have codemod available
|
|
1250
|
+
- [ ] Changelog updated
|
|
1251
|
+
- [ ] Storybook docs updated
|
|
1252
|
+
- [ ] SemVer correctly applied (MAJOR/MINOR/PATCH)
|
|
1253
|
+
|
|
1254
|
+
### 15.4 Adoption Health Checklist
|
|
1255
|
+
|
|
1256
|
+
- [ ] Component coverage > 80% of screens
|
|
1257
|
+
- [ ] Token compliance > 95% (no hardcoded values)
|
|
1258
|
+
- [ ] Team adoption > 90%
|
|
1259
|
+
- [ ] Design-dev parity > 90% (Figma + code equivalents)
|
|
1260
|
+
- [ ] NPS score > 50 from consumer teams
|
|
1261
|
+
- [ ] Office hours held weekly
|
|
1262
|
+
- [ ] Public roadmap maintained
|
|
1263
|
+
- [ ] Analytics tracking component usage
|
|
1264
|
+
|
|
1265
|
+
---
|
|
1266
|
+
|
|
1267
|
+
## Key People Reference
|
|
1268
|
+
|
|
1269
|
+
| Person | Contribution |
|
|
1270
|
+
|--------|-------------|
|
|
1271
|
+
| **Brad Frost** | Atomic Design (2013/2016) -- composicional hierarchy |
|
|
1272
|
+
| **Nathan Curtis** | EightShapes -- DS operations, governance, component API design |
|
|
1273
|
+
| **Jina Anne** | Design Tokens concept (2014, Salesforce), W3C DTCG co-chair |
|
|
1274
|
+
| **Dan Mall** | "Design That Scales" (2022) -- DS as product, team models |
|
|
1275
|
+
| **Alla Kholmatova** | "Design Systems" (2017) -- theoretical frameworks |
|
|
1276
|
+
| **Lea Verou** | OKLCH advocacy, CSS Working Group, "CSS Secrets" |
|
|
1277
|
+
| **Adam Wathan** | Tailwind CSS -- utility-first revolution |
|
|
1278
|
+
| **Sarah Drasner** | Animation engineering, "SVG Animations" |
|
|
1279
|
+
| **Heydon Pickering** | "Inclusive Components" -- accessible component patterns |
|
|
1280
|
+
| **Segun Adebayo** | Chakra UI, Panda CSS, Ark UI |
|
|
1281
|
+
| **Matias Duarte** | Material Design architect (Google) |
|
|
1282
|
+
| **Rasmus Andersson** | Inter font -- most-used interface font 2024-2026 |
|
|
1283
|
+
|
|
1284
|
+
---
|
|
1285
|
+
|
|
1286
|
+
## Essential Books
|
|
1287
|
+
|
|
1288
|
+
| Book | Author | Extract |
|
|
1289
|
+
|------|--------|---------|
|
|
1290
|
+
| "Atomic Design" | Brad Frost (2016) | Compositional hierarchy, Pattern Lab |
|
|
1291
|
+
| "Design Systems" | Alla Kholmatova (2017) | Functional vs perceptual patterns, principles framework |
|
|
1292
|
+
| "Refactoring UI" | Wathan & Schoger (2018) | Visual design rules for foundations |
|
|
1293
|
+
| "Inclusive Components" | Heydon Pickering (2019) | ARIA patterns, keyboard nav, screen reader testing |
|
|
1294
|
+
| "Design That Scales" | Dan Mall (2022) | Team models, contribution models, selling DS to executives |
|
|
1295
|
+
| "Expressive Design Systems" | Yesenia Perez-Cruz (2019) | Brand expression via tokens |
|
|
1296
|
+
| "The Design of Everyday Things" | Don Norman (1988/2013) | Affordance, signifiers -- philosophical base for any DS |
|
|
1297
|
+
| "Grid Systems in Graphic Design" | Muller-Brockmann (1961) | Mathematical grids -- foundation for spacing tokens |
|
|
1298
|
+
|
|
1299
|
+
---
|
|
1300
|
+
|
|
1301
|
+
*Design System Master Reference -- SINAPSE squad-design knowledge base*
|
|
1302
|
+
*Source: MS-002 Research (46 sources, 10 major DS analyzed, 20+ key people referenced)*
|