ui-foundations 0.3.2 → 0.4.1
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/README.md +179 -36
- package/dist/assets/icons/checkmark.svg +1 -0
- package/dist/core/index.css +7 -7
- package/dist/macros/ui.njk +142 -0
- package/dist/main.css +465 -173
- package/dist/react/badge.js +41 -0
- package/dist/react/button.js +15 -6
- package/dist/react/checkbox.js +30 -0
- package/dist/react/icon.js +19 -1
- package/dist/react/index.js +2 -0
- package/dist/react/label.js +1 -1
- package/dist/react/radio.js +62 -0
- package/dist/react/switch.js +18 -0
- package/dist/tokens/css/{appearance-(modes).tokens.mode-dark.css → appearance-modes.tokens.mode-dark.css} +1 -1
- package/dist/tokens/css/{appearance-(modes).tokens.mode-light.css → appearance-modes.tokens.mode-light.css} +1 -1
- package/dist/tokens/css/{components-(ui).tokens.css → components-ui.tokens.css} +46 -3
- package/dist/tokens/css/{core-(primitives).tokens.css → core-primitives.tokens.css} +61 -19
- package/dist/tokens/css/{semantics-(roles).tokens.css → semantics-roles.tokens.css} +1 -1
- package/dist/tokens/css/themes-brands.tokens.brand-a.css +22 -0
- package/dist/tokens/css/{themes-(brands).tokens.brand-b.css → themes-brands.tokens.brand-b.css} +9 -9
- package/dist/tokens/json/appearance-modes.tokens.mode-dark.json +121 -0
- package/dist/tokens/json/appearance-modes.tokens.mode-light.json +121 -0
- package/dist/tokens/json/components-ui.tokens.json +715 -0
- package/dist/tokens/json/{core-(primitives).tokens.json → core-primitives.tokens.json} +227 -413
- package/dist/tokens/json/semantics-roles.tokens.json +141 -0
- package/dist/tokens/json/themes-brands.tokens.brand-a.json +81 -0
- package/dist/tokens/json/themes-brands.tokens.brand-b.json +81 -0
- package/dist/tokens/missing-tokens.json +43 -0
- package/dist/tokens/tokens.yaml +1254 -149
- package/dist/tokens/ts/{appearance-(modes).tokens.mode-dark.ts → appearance-modes.tokens.mode-dark.ts} +1 -1
- package/dist/tokens/ts/{appearance-(modes).tokens.mode-light.ts → appearance-modes.tokens.mode-light.ts} +1 -1
- package/dist/tokens/ts/{components-(ui).tokens.ts → components-ui.tokens.ts} +47 -4
- package/dist/tokens/ts/{core-(primitives).tokens.ts → core-primitives.tokens.ts} +62 -20
- package/dist/tokens/ts/{semantics-(roles).tokens.ts → semantics-roles.tokens.ts} +1 -1
- package/dist/tokens/ts/{themes-(brands).tokens.brand-a.ts → themes-brands.tokens.brand-a.ts} +9 -9
- package/dist/tokens/ts/{themes-(brands).tokens.brand-b.ts → themes-brands.tokens.brand-b.ts} +9 -9
- package/dist/ui/index.css +2 -0
- package/dist/ui/patterns/badge.css +49 -0
- package/dist/ui/patterns/checkbox.css +71 -22
- package/dist/ui/patterns/radio.css +109 -0
- package/docs/README.md +38 -0
- package/docs/agentic/README.md +34 -0
- package/docs/agentic/assistant-behavior-rules.md +48 -0
- package/docs/agentic/skills/ux-writing-coach.md +116 -0
- package/docs/foundations/README.md +31 -0
- package/docs/foundations/foundation-001-token-layering.md +6 -0
- package/docs/foundations/foundation-002-naming-and-grouping.md +6 -0
- package/docs/foundations/foundation-003-color-semantics-and-status.md +6 -0
- package/docs/foundations/foundation-004-typography-scale-and-line-height.md +6 -0
- package/docs/foundations/foundation-005-responsive-breakpoints-and-containers.md +6 -0
- package/docs/foundations/foundation-006-z-index-layering.md +6 -0
- package/docs/foundations/foundation-007-typography-selectors-and-specificity.md +6 -0
- package/docs/foundations/foundation-008-mode-activation-and-consumer-control.md +6 -0
- package/docs/foundations/foundation-009-component-boundaries-and-utility.md +6 -0
- package/docs/foundations/foundation-010-implementation-and-pipeline-workflow.md +6 -0
- package/docs/foundations/foundation-011-branching-and-release-governance.md +6 -0
- package/docs/foundations/foundation-012-minimal-markup-and-composition.md +6 -0
- package/package.json +15 -11
- package/dist/tokens/css/themes-(brands).tokens.brand-a.css +0 -22
- package/dist/tokens/json/appearance-(modes).tokens.mode-dark.json +0 -182
- package/dist/tokens/json/appearance-(modes).tokens.mode-light.json +0 -182
- package/dist/tokens/json/components-(ui).tokens.json +0 -739
- package/dist/tokens/json/semantics-(roles).tokens.json +0 -203
- package/dist/tokens/json/themes-(brands).tokens.brand-a.json +0 -115
- package/dist/tokens/json/themes-(brands).tokens.brand-b.json +0 -115
- package/docs/agentic/skills/README.md +0 -51
- package/docs/agentic/skills/design-ops-specialist/SKILL.md +0 -60
- package/docs/agentic/skills/design-system-architect/SKILL.md +0 -106
- package/docs/agentic/team-ai-playbook.md +0 -226
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
# AI Playbook
|
|
2
|
-
|
|
3
|
-
This playbook defines how to use AI as an engineering copilot in this repository.
|
|
4
|
-
|
|
5
|
-
## Goal
|
|
6
|
-
|
|
7
|
-
Use AI to speed up component incubation and implementation while keeping output:
|
|
8
|
-
|
|
9
|
-
- token-first
|
|
10
|
-
- reviewable in Git
|
|
11
|
-
- consistent with existing architecture
|
|
12
|
-
|
|
13
|
-
## Principles
|
|
14
|
-
|
|
15
|
-
1. Keep changes small and incremental.
|
|
16
|
-
2. Prefer existing patterns over introducing new abstractions.
|
|
17
|
-
3. Keep Figma and code aligned through explicit token roundtrips.
|
|
18
|
-
4. Always validate with local checks before pushing.
|
|
19
|
-
|
|
20
|
-
## Component Boundary Check (Mandatory)
|
|
21
|
-
|
|
22
|
-
Run this decision gate before implementing a "new component":
|
|
23
|
-
|
|
24
|
-
1. Start with composition-first:
|
|
25
|
-
- If the new idea is primarily grouping, layout, or orchestration of existing components, implement it as composition within the existing component family and document it there.
|
|
26
|
-
2. Promote to standalone only when needed:
|
|
27
|
-
- The candidate introduces distinct semantics (own role/responsibility), a stable API surface, or independent lifecycle/behavior that is not just a wrapper.
|
|
28
|
-
3. Apply a utility test ("Snowflake check"):
|
|
29
|
-
- One-off/local case -> keep it local or document as composition.
|
|
30
|
-
- Reusable across contexts/products -> valid candidate for system-level component.
|
|
31
|
-
4. Keep token work independent:
|
|
32
|
-
- New tokens may be needed in both paths.
|
|
33
|
-
- Token creation does not automatically justify a new standalone component.
|
|
34
|
-
5. Source of truth:
|
|
35
|
-
- `docs/foundations/foundation-009-component-boundaries-and-utility.md`
|
|
36
|
-
|
|
37
|
-
## Standard Workflow: New Component
|
|
38
|
-
|
|
39
|
-
1. Run the Component Boundary Check and decide:
|
|
40
|
-
- standalone component, or
|
|
41
|
-
- composition inside existing component docs/API.
|
|
42
|
-
2. Ask AI for a first proposal:
|
|
43
|
-
- structure: HTML/CSS/React
|
|
44
|
-
- token names and states
|
|
45
|
-
- docs + playground example
|
|
46
|
-
3. Review and adjust naming before implementation.
|
|
47
|
-
4. Add/import proposed tokens in Figma.
|
|
48
|
-
5. Export tokens from Figma to `figma/exports/`.
|
|
49
|
-
6. Let AI integrate implementation:
|
|
50
|
-
- `src/ui/patterns/<component>.css`
|
|
51
|
-
- `src/react/<component>.js` and `src/react/index.js` (if needed)
|
|
52
|
-
- `site/components/<component>.md`
|
|
53
|
-
- `site/components/<component>-playground.md`
|
|
54
|
-
- `figma/connections/web-<component>.figma.ts` (if needed)
|
|
55
|
-
7. Run validation:
|
|
56
|
-
- `npm run ci:check`
|
|
57
|
-
8. Iterate naming/states/a11y until stable.
|
|
58
|
-
|
|
59
|
-
## Skill selection
|
|
60
|
-
|
|
61
|
-
Use the repo skills intentionally:
|
|
62
|
-
|
|
63
|
-
- `design-ops-specialist` for tactical, proposal-first component work
|
|
64
|
-
- `design-system-architect` for strategic, system-level reviews and decisions
|
|
65
|
-
|
|
66
|
-
See also:
|
|
67
|
-
- `docs/agentic/skills/README.md`
|
|
68
|
-
|
|
69
|
-
## Proposal Mode: Design Ops Specialist
|
|
70
|
-
|
|
71
|
-
Use this mode when the request is explicitly a proposal (no implementation yet).
|
|
72
|
-
|
|
73
|
-
1. Confirm scope and constraints first:
|
|
74
|
-
- component name
|
|
75
|
-
- variants/sizes/states/parts
|
|
76
|
-
- platform constraints
|
|
77
|
-
2. Review source rules before proposing:
|
|
78
|
-
- `docs/foundations/`
|
|
79
|
-
- `docs/agentic/assistant-behavior-rules.md`
|
|
80
|
-
- this playbook
|
|
81
|
-
3. Deliver a concise proposal with these sections:
|
|
82
|
-
- token naming proposal (variants/parts/states)
|
|
83
|
-
- CSS pattern structure under `src/ui/patterns`
|
|
84
|
-
- optional React wrapper API (only if requested/needed)
|
|
85
|
-
- docs + playground integration plan
|
|
86
|
-
4. Keep recommendations minimal and non-breaking by default.
|
|
87
|
-
|
|
88
|
-
## Standard Workflow: Token Roundtrip
|
|
89
|
-
|
|
90
|
-
1. Create or update tokens in Figma.
|
|
91
|
-
2. Export into `figma/exports/*.tokens.json`.
|
|
92
|
-
3. Run:
|
|
93
|
-
- `npm run build:all`
|
|
94
|
-
- `npm run tokens:validate`
|
|
95
|
-
4. Check output consistency:
|
|
96
|
-
- `dist/tokens/css/*.tokens.css`
|
|
97
|
-
- `dist/tokens/json/*.json`
|
|
98
|
-
- `dist/tokens/tokens.yaml`
|
|
99
|
-
5. If warnings appear (missing/invalid WEB syntax, alias issues), fix in Figma first.
|
|
100
|
-
|
|
101
|
-
## Standard Workflow: Figma Drift Reconciliation
|
|
102
|
-
|
|
103
|
-
Use this when the component was scaffolded in code first and component variables/variants are created or changed in Figma afterwards.
|
|
104
|
-
|
|
105
|
-
1. Define the contract first:
|
|
106
|
-
- component API (props/states/semantics)
|
|
107
|
-
- token names and expected usage
|
|
108
|
-
2. Update Figma variables/variants and export tokens:
|
|
109
|
-
- `figma/exports/*.tokens.json`
|
|
110
|
-
3. Rebuild token artifacts:
|
|
111
|
-
- `npm run build:all`
|
|
112
|
-
- `npm run tokens:validate`
|
|
113
|
-
4. Reconcile Code Connect mappings:
|
|
114
|
-
- update `figma/connections/web-<component>.figma.ts`
|
|
115
|
-
- align node-id targets and property names with actual Figma top-level component/component set
|
|
116
|
-
- run `figma connect parse`
|
|
117
|
-
- run `figma connect publish --dry-run`
|
|
118
|
-
5. Reconcile implementation only where needed:
|
|
119
|
-
- adjust CSS/React/docs/playground to match agreed contract
|
|
120
|
-
- avoid broad rewrites; keep changes minimal
|
|
121
|
-
6. Validate and stabilize:
|
|
122
|
-
- `npm run lint`
|
|
123
|
-
- `npm run test:unit`
|
|
124
|
-
- `npm run ci:check`
|
|
125
|
-
7. Commit with explicit scope, for example:
|
|
126
|
-
- `chore(figma): reconcile <component> code-connect mapping`
|
|
127
|
-
- `feat(<component>): align states and tokens with figma`
|
|
128
|
-
|
|
129
|
-
## Standard Workflow: Refactor and Quality
|
|
130
|
-
|
|
131
|
-
1. Ask AI to identify one small refactor target.
|
|
132
|
-
2. Implement only one focused change set.
|
|
133
|
-
3. Add or update tests when behavior is touched.
|
|
134
|
-
4. Run:
|
|
135
|
-
- `npm run lint`
|
|
136
|
-
- `npm run test:unit`
|
|
137
|
-
- `npm run ci:check`
|
|
138
|
-
5. Commit with clear scope in message.
|
|
139
|
-
|
|
140
|
-
## Prompt Templates
|
|
141
|
-
|
|
142
|
-
### 1) New component incubation
|
|
143
|
-
|
|
144
|
-
```text
|
|
145
|
-
You are my Design OPS Manager. Propose a token-first setup for a new <component>.
|
|
146
|
-
Include:
|
|
147
|
-
- token naming proposal (variants/parts/states)
|
|
148
|
-
- CSS pattern structure under src/ui/patterns
|
|
149
|
-
- optional React wrapper API
|
|
150
|
-
- docs + playground integration
|
|
151
|
-
Keep changes minimal and aligned with existing repository conventions.
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### 2) Token integration after Figma export
|
|
155
|
-
|
|
156
|
-
```text
|
|
157
|
-
I updated figma/exports. Please run the token/build pipeline, review warnings,
|
|
158
|
-
and apply minimal fixes so docs and bundles are green.
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### 3) Safe refactor
|
|
162
|
-
|
|
163
|
-
```text
|
|
164
|
-
Refactor <target file/module> for maintainability in small steps only.
|
|
165
|
-
No behavior changes. Add tests if needed. Keep ci:check green.
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### 4) Prompt to UI component (scaffold + implement)
|
|
169
|
-
|
|
170
|
-
```text
|
|
171
|
-
Scaffold and implement a new UI component named <component-name> in this repository.
|
|
172
|
-
|
|
173
|
-
Follow these sources strictly:
|
|
174
|
-
- docs/agentic/team-ai-playbook.md
|
|
175
|
-
- docs/agentic/assistant-behavior-rules.md
|
|
176
|
-
- docs/foundations/*
|
|
177
|
-
|
|
178
|
-
Execution requirements:
|
|
179
|
-
1) Run the Component Boundary Check first and state the decision (composition vs standalone).
|
|
180
|
-
2) Keep scope small, incremental, and reviewable in Git.
|
|
181
|
-
3) Implement token-first and reuse existing patterns:
|
|
182
|
-
- src/ui/patterns/<component>.css
|
|
183
|
-
- src/react/<component>.js and src/react/index.js (if needed)
|
|
184
|
-
- site/components/<component>.md
|
|
185
|
-
- site/components/<component>-playground.md
|
|
186
|
-
- figma/connections/web-<component>.figma.ts (only if a publishable top-level Figma component/component-set exists)
|
|
187
|
-
4) Validate before handoff:
|
|
188
|
-
- npm run lint
|
|
189
|
-
- npm run test:unit
|
|
190
|
-
- npm run ci:check
|
|
191
|
-
|
|
192
|
-
Mandatory progress tracker for this task type:
|
|
193
|
-
- Start with: Tasks completion: 0/4
|
|
194
|
-
- Update after each phase: 1/4, 2/4, 3/4, 4/4
|
|
195
|
-
|
|
196
|
-
Handoff format:
|
|
197
|
-
- boundary decision result
|
|
198
|
-
- files changed
|
|
199
|
-
- validation results
|
|
200
|
-
- open follow-ups (if any)
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
## Definition of Done (AI Task)
|
|
204
|
-
|
|
205
|
-
- Scope is clear and minimal.
|
|
206
|
-
- Affected files are easy to review.
|
|
207
|
-
- No broken exports or docs.
|
|
208
|
-
- `npm run ci:check` passes.
|
|
209
|
-
- README/docs updated when behavior or workflow changes.
|
|
210
|
-
|
|
211
|
-
## Worked example: Button Group
|
|
212
|
-
|
|
213
|
-
This repository now includes a concrete walkthrough based on a `Button Group`:
|
|
214
|
-
|
|
215
|
-
1. AI proposal:
|
|
216
|
-
- layout model (`orientation`, `attached`, `justify`)
|
|
217
|
-
- token proposal (`--button-group-gap`, `--button-group-border-radius`)
|
|
218
|
-
2. Implementation in code:
|
|
219
|
-
- integrated button family CSS: `src/ui/patterns/button.css`
|
|
220
|
-
- React wrapper API in `src/react/button.js` (`ButtonGroup`)
|
|
221
|
-
3. Documentation:
|
|
222
|
-
- integrated in `site/components/button.md` under grouped usage
|
|
223
|
-
4. Validation:
|
|
224
|
-
- `npm run ci:check`
|
|
225
|
-
|
|
226
|
-
Use this pattern as the reference baseline for future AI-assisted component incubation where wrappers extend an existing component family.
|