ui-foundations 0.1.1 → 0.3.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.
Files changed (45) hide show
  1. package/README.md +68 -227
  2. package/dist/core/index.css +7 -7
  3. package/dist/main.css +462 -289
  4. package/dist/react/index.js +1 -0
  5. package/dist/react/switch.js +45 -0
  6. package/dist/tokens/css/{color.dark.tokens.css → appearance-(modes).tokens.mode-dark.css} +2 -2
  7. package/dist/tokens/css/{color.light.tokens.css → appearance-(modes).tokens.mode-light.css} +3 -3
  8. package/dist/tokens/css/{component.tokens.css → components-(ui).tokens.css} +70 -54
  9. package/dist/tokens/css/{primitives.tokens.css → core-(primitives).tokens.css} +21 -21
  10. package/dist/tokens/css/{semantic.tokens.css → semantics-(roles).tokens.css} +7 -6
  11. package/dist/tokens/css/{brand-a.tokens.css → themes-(brands).tokens.brand-a.css} +11 -11
  12. package/dist/tokens/css/{brand-b.tokens.css → themes-(brands).tokens.brand-b.css} +10 -10
  13. package/dist/tokens/json/appearance-(modes).tokens.mode-dark.json +182 -0
  14. package/dist/tokens/json/appearance-(modes).tokens.mode-light.json +182 -0
  15. package/dist/tokens/json/components-(ui).tokens.json +739 -0
  16. package/dist/tokens/json/{primitives.tokens.json → core-(primitives).tokens.json} +766 -772
  17. package/dist/tokens/json/semantics-(roles).tokens.json +203 -0
  18. package/dist/tokens/json/themes-(brands).tokens.brand-a.json +115 -0
  19. package/dist/tokens/json/themes-(brands).tokens.brand-b.json +115 -0
  20. package/dist/tokens/tokens.yaml +1068 -847
  21. package/dist/tokens/ts/{color.dark.tokens.ts → appearance-(modes).tokens.mode-dark.ts} +3 -3
  22. package/dist/tokens/ts/{color.light.tokens.ts → appearance-(modes).tokens.mode-light.ts} +4 -4
  23. package/dist/tokens/ts/{component.tokens.ts → components-(ui).tokens.ts} +71 -55
  24. package/dist/tokens/ts/{primitives.tokens.ts → core-(primitives).tokens.ts} +22 -22
  25. package/dist/tokens/ts/{semantic.tokens.ts → semantics-(roles).tokens.ts} +7 -6
  26. package/dist/tokens/ts/{brand-a.tokens.ts → themes-(brands).tokens.brand-a.ts} +13 -13
  27. package/dist/tokens/ts/{brand-b.tokens.ts → themes-(brands).tokens.brand-b.ts} +12 -12
  28. package/dist/ui/index.css +1 -0
  29. package/dist/ui/patterns/button.css +1 -0
  30. package/dist/ui/patterns/switch.css +155 -0
  31. package/docs/agentic/assistant-behavior-rules.md +16 -0
  32. package/docs/agentic/skills/README.md +51 -0
  33. package/docs/agentic/skills/design-ops-specialist/SKILL.md +60 -0
  34. package/docs/agentic/skills/design-system-architect/SKILL.md +106 -0
  35. package/docs/agentic/team-ai-playbook.md +226 -0
  36. package/docs/foundations/foundation-010-implementation-and-pipeline-workflow.md +82 -0
  37. package/docs/foundations/foundation-011-branching-and-release-governance.md +42 -0
  38. package/docs/foundations/foundation-012-minimal-markup-and-composition.md +42 -0
  39. package/package.json +24 -12
  40. package/dist/tokens/json/brand-a.tokens.json +0 -192
  41. package/dist/tokens/json/brand-b.tokens.json +0 -192
  42. package/dist/tokens/json/color.dark.tokens.json +0 -364
  43. package/dist/tokens/json/color.light.tokens.json +0 -364
  44. package/dist/tokens/json/component.tokens.json +0 -1101
  45. package/dist/tokens/json/semantic.tokens.json +0 -206
@@ -0,0 +1,51 @@
1
+ # Agentic Skills
2
+
3
+ This directory contains repo-specific skills for AI-assisted design-system work.
4
+
5
+ ## Available skills
6
+
7
+ ### design-ops-specialist
8
+
9
+ Use for tactical, proposal-first work:
10
+
11
+ - minimal component drafts
12
+ - token naming proposals
13
+ - CSS pattern structure suggestions
14
+ - optional React wrapper API sketches
15
+ - docs/playground integration plans
16
+
17
+ Best when the question is close to implementation and should stay incremental and non-breaking.
18
+
19
+ Path:
20
+ - `docs/agentic/skills/design-ops-specialist/SKILL.md`
21
+
22
+ ### design-system-architect
23
+
24
+ Use for strategic, system-level work:
25
+
26
+ - foundation reviews
27
+ - token governance decisions
28
+ - component boundary decisions
29
+ - Figma/code reconciliation
30
+ - architecture-level handoff and system recommendations
31
+
32
+ Best when the question is about whether something belongs in the system at all, how foundations should evolve, or how to restore consistency across Figma, tokens, code, and docs.
33
+
34
+ Path:
35
+ - `docs/agentic/skills/design-system-architect/SKILL.md`
36
+
37
+ ## Quick selection guide
38
+
39
+ Use `design-ops-specialist` when the question sounds like:
40
+
41
+ - "Propose a draft for this component"
42
+ - "How should the token names look?"
43
+ - "What files would change?"
44
+ - "How would the CSS and docs be structured?"
45
+
46
+ Use `design-system-architect` when the question sounds like:
47
+
48
+ - "Should this be a standalone component or composition?"
49
+ - "Do we need new semantic tokens?"
50
+ - "Are the foundations still coherent?"
51
+ - "How do we reconcile Figma and code drift?"
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: design-ops-specialist
3
+ description: "Tactical proposal-first guidance for token-first component work in this repo and package consumers. Use when a request asks for a minimal component draft, token naming proposal, CSS pattern structure under src/ui/patterns, optional React wrapper API, docs/playground integration, or a concrete implementation plan that should stay incremental and non-breaking. Prefer design-system-architect instead when the request is about foundations, token governance, component-boundary decisions, Figma/code drift, or system-wide architecture."
4
+ ---
5
+
6
+ # Design Ops Specialist
7
+
8
+ ## Intent
9
+
10
+ Use this skill for tactical, proposal-first work before or just ahead of implementation.
11
+
12
+ This skill is narrower than `design-system-architect`.
13
+
14
+ - Use `design-ops-specialist` for concrete component drafts and repo-shaped implementation proposals.
15
+ - Use `design-system-architect` for system-wide reviews, governance, and architecture decisions.
16
+
17
+ ## Workflow
18
+
19
+ 1. Confirm scope and constraints:
20
+ - component name
21
+ - parts / variants / states
22
+ - platform or framework constraints
23
+ - whether the ask is proposal-only or implementation-adjacent
24
+ 2. Align with source rules:
25
+ - `docs/foundations/`
26
+ - `docs/agentic/assistant-behavior-rules.md`
27
+ - `docs/agentic/team-ai-playbook.md`
28
+ 3. If the request implies a new system component, call out that boundary validation is required and defer the strategic decision to `design-system-architect` when needed.
29
+ 4. Produce a concise proposal by default, with no code changes unless explicitly requested.
30
+ 5. Keep proposals minimal, incremental, and non-breaking.
31
+
32
+ ## Output format
33
+
34
+ Provide these sections:
35
+
36
+ 1. Boundary assumption
37
+ - whether this is assumed to be composition or a valid standalone candidate
38
+ - if unclear, say so briefly
39
+ 2. Token naming proposal
40
+ - prefix, variants, parts, states
41
+ - alignment to foundations naming rules
42
+ 3. CSS pattern structure
43
+ - target files under `src/ui/patterns` or existing family integration
44
+ - expected class names and token hookups
45
+ 4. Optional React wrapper API
46
+ - only when requested or clearly needed
47
+ - props mapped to token variants/states
48
+ 5. Docs + playground integration
49
+ - required docs pages/sections
50
+ - playground additions or updates
51
+ 6. Implementation surface
52
+ - exact repo paths likely to change
53
+
54
+ ## Guardrails
55
+
56
+ - Prefer extending existing patterns over introducing new frameworks.
57
+ - Keep recommendations compatible with token-first and Figma-aligned architecture.
58
+ - Do not broaden into foundations governance unless explicitly asked.
59
+ - If requirements are underspecified, ask targeted clarifying questions or state minimal assumptions.
60
+ - If the task is really about whether something belongs in the system at all, hand off conceptually to `design-system-architect`.
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: design-system-architect
3
+ description: "Strategic design-system architecture for this repo. Use when reviewing or evolving foundations, deciding token governance, evaluating component boundaries, reconciling Figma/code drift, auditing semantic coverage, or making architecture-level decisions that span beyond a single component proposal. Prefer this skill over design-ops-specialist when the request is system-wide, governance-heavy, or about whether something should enter the system at all."
4
+ ---
5
+
6
+ # Design System Architect
7
+
8
+ ## Intent
9
+
10
+ Use this skill for system-level decisions, reviews, and governance.
11
+
12
+ This skill is broader than `design-ops-specialist`.
13
+
14
+ - Use `design-ops-specialist` for tactical, proposal-first component drafts.
15
+ - Use `design-system-architect` for architecture, boundaries, token governance, and Figma/code alignment decisions.
16
+
17
+ ## Required source alignment
18
+
19
+ Before responding, align to these repo sources:
20
+
21
+ - `docs/foundations/`
22
+ - `docs/agentic/assistant-behavior-rules.md`
23
+ - `docs/agentic/team-ai-playbook.md`
24
+
25
+ At minimum, check these when relevant:
26
+
27
+ - `docs/foundations/foundation-001-token-layering.md`
28
+ - `docs/foundations/foundation-002-naming-and-grouping.md`
29
+ - `docs/foundations/foundation-003-color-semantics-and-status.md`
30
+ - `docs/foundations/foundation-009-component-boundaries-and-utility.md`
31
+ - `docs/foundations/foundation-010-implementation-and-pipeline-workflow.md`
32
+ - `docs/foundations/foundation-011-branching-and-release-governance.md`
33
+
34
+ ## Task types
35
+
36
+ ### 1. Foundation review
37
+
38
+ Use when reviewing the health of the system.
39
+
40
+ Check for:
41
+
42
+ - layering integrity
43
+ - semantic gaps
44
+ - naming drift
45
+ - duplicate concepts
46
+ - hard-coded or leaky component decisions
47
+ - weak state coverage
48
+ - Figma/code mismatch
49
+
50
+ ### 2. Token governance
51
+
52
+ Use when deciding whether to create, alias, rename, or reject token changes.
53
+
54
+ Report:
55
+
56
+ - correct layer
57
+ - rationale
58
+ - consumer scope
59
+ - theme/mode impact
60
+ - migration implications
61
+
62
+ ### 3. Boundary decision
63
+
64
+ Use before proposing or implementing a new component.
65
+
66
+ Decide:
67
+
68
+ - composition inside an existing family, or
69
+ - standalone system component
70
+
71
+ Apply the Snowflake check from `foundation-009`.
72
+
73
+ ### 4. Figma/code reconciliation
74
+
75
+ Use when system contracts drift between Figma and implementation.
76
+
77
+ Review:
78
+
79
+ - token exports in `figma/exports/`
80
+ - Code Connect mappings in `figma/connections/`
81
+ - implementation in `src/ui/` and `src/react/`
82
+ - docs/playground representation in `site/components/`
83
+
84
+ ### 5. System handoff
85
+
86
+ Use when another designer or engineer needs a structured architectural recommendation.
87
+
88
+ ## Output format
89
+
90
+ Provide these sections when relevant:
91
+
92
+ 1. Task type
93
+ 2. Current system reading
94
+ 3. Decision
95
+ 4. Rationale
96
+ 5. Repo surfaces affected
97
+ 6. Risks / mismatches
98
+ 7. Recommended next step
99
+
100
+ ## Guardrails
101
+
102
+ - Do not invent raw values inside components.
103
+ - Keep the 4-layer architecture intact.
104
+ - Treat token work and component boundary decisions as separate questions.
105
+ - Prefer small, reviewable changes and feature-branch delivery.
106
+ - Say explicitly when something should remain local instead of entering the system.
@@ -0,0 +1,226 @@
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.
@@ -0,0 +1,82 @@
1
+ # Foundation-010: Implementation and Pipeline Workflow
2
+
3
+ ## Purpose
4
+
5
+ Define the stable implementation workflow for adding or updating UI foundations artifacts, including token generation, component integration, docs updates, and validation.
6
+
7
+ ## Rules
8
+
9
+ 1. Follow this sequence for new components:
10
+ - Run boundary + utility check first (see Foundation-009).
11
+ - Add/update Figma token exports in `figma/exports/`.
12
+ - Regenerate artifacts via `npm run build:all`.
13
+ - Add or update CSS pattern in `src/ui/patterns/`.
14
+ - Export pattern in `src/ui/index.css`.
15
+ - Add React wrapper only when needed.
16
+ - Add docs + playground pages in `site/components/`.
17
+
18
+ 2. Keep changes token-first:
19
+ - Components consume semantic/foundation tokens.
20
+ - Do not introduce component-local hard-coded colors.
21
+
22
+ 3. Treat generated output as build artifacts:
23
+ - `dist/tokens/` and `dist/` are generated outputs.
24
+ - Build scripts in `scripts/` are the source for generation behavior.
25
+
26
+ 4. Keep package runtime mode policy consumer-owned:
27
+ - Token outputs define scopes/selectors.
28
+ - Consumers decide when/how `data-mode` and `data-brand` are applied.
29
+
30
+ ## Build and Validation
31
+
32
+ Use these commands as the baseline:
33
+
34
+ - `npm run lint`
35
+ - `npm run test:unit`
36
+ - `npm run ci:check`
37
+
38
+ Additional useful commands:
39
+
40
+ - `npm run tokens:generate`
41
+ - `npm run build:css`
42
+ - `npm run build:all`
43
+ - `npm run docs:site`
44
+
45
+ ## Token Pipeline Notes
46
+
47
+ `scripts/extract-tokens.js` orchestrates generation.
48
+
49
+ Key helpers:
50
+
51
+ - `scripts/extract-tokens.utils.js`
52
+ - `scripts/extract-tokens.lookup.js`
53
+ - `scripts/extract-tokens.value.js`
54
+ - `scripts/extract-tokens.scope.js`
55
+
56
+ Scope behavior from export filenames:
57
+
58
+ - `Brand X.tokens.json` -> `:root[data-brand="x"]`
59
+ - `Mode Light.tokens.json` -> `:root`
60
+ - `Mode Dark.tokens.json` -> `:root[data-mode="dark"]`
61
+
62
+ Fallback behavior:
63
+
64
+ - Missing or invalid `com.figma.codeSyntax.WEB` falls back to auto-derived CSS variable names and is reported.
65
+ - Missing alias targets and alias cycles fall back to literal values and are reported.
66
+
67
+ ## AI-Assisted Workflow
68
+
69
+ When using assistants for component incubation:
70
+
71
+ 1. Define boundary (composition vs standalone).
72
+ 2. Propose token naming + component structure.
73
+ 3. Align/update Figma tokens.
74
+ 4. Regenerate and integrate in code.
75
+ 5. Update docs/playground.
76
+ 6. Run validation commands before handoff.
77
+
78
+ ## Implications
79
+
80
+ - The repository remains predictable for humans and assistants.
81
+ - Detailed operational guidance stays in foundations docs, not top-level onboarding.
82
+ - The README can remain minimal while implementation rigor stays explicit.
@@ -0,0 +1,42 @@
1
+ # Foundation-011: Branching and Release Governance
2
+
3
+ ## Purpose
4
+
5
+ Keep delivery safe and predictable by enforcing feature-branch development and protected `main` releases.
6
+
7
+ ## Rules
8
+
9
+ 1. Development happens on feature branches only:
10
+ - naming: `feat/*`, `fix/*`, `chore/*`, `docs/*`
11
+ - no direct commits to `main`
12
+
13
+ 2. Merge to `main` only via pull request:
14
+ - at least one review required
15
+ - required status checks must pass (`lint`, `test:unit`, `ci:check`)
16
+ - no force pushes to `main`
17
+ - no branch deletion protection bypass
18
+
19
+ 3. Releases are cut from clean `main` only:
20
+ - run `npm run release:patch|minor|major`
21
+ - push commit + tag with `npm run release:push`
22
+ - publish with `npm run release:publish` (or `npm publish --otp=<code>`)
23
+
24
+ ## Recommended GitHub Branch Protection (`main`)
25
+
26
+ - Require a pull request before merging
27
+ - Require approvals: 1+
28
+ - Dismiss stale approvals on new commits
29
+ - Require status checks:
30
+ - `lint`
31
+ - `test:unit`
32
+ - `ci:check`
33
+ - Require branches to be up to date before merging
34
+ - Restrict who can push (optional, recommended for shared repos)
35
+ - Disallow force pushes
36
+ - Disallow deletions
37
+
38
+ ## Implications
39
+
40
+ - Main stays releasable.
41
+ - Releases become repeatable and auditable.
42
+ - Risk of accidental or unreviewed production changes is reduced.
@@ -0,0 +1,42 @@
1
+ # Foundation-012: Minimal Markup and Composition
2
+
3
+ ## Purpose
4
+
5
+ Keep component markup as flat and simple as possible. Complexity in HTML structure should only exist when it solves a real problem.
6
+
7
+ ## Rules
8
+
9
+ 1. Start with the flattest possible markup.
10
+ - A link with an icon is `<a class="link"><span class="icon">...</span> Text</a>`, not three nested wrappers.
11
+ - Add structure only when layout or behavior requires it.
12
+
13
+ 2. Use CSS on the component root for layout.
14
+ - `inline-flex`, `gap`, `align-items` on the component class itself.
15
+ - Avoid wrapper elements whose only purpose is layout.
16
+
17
+ 3. Composition patterns (like `label-content`) are opt-in, not default.
18
+ - Use them only when the component genuinely needs slot management, reordering, or icon-only modes.
19
+ - A simple text + icon combination does not need a composition wrapper.
20
+
21
+ 4. Measure complexity by counting elements.
22
+ - If a simple variant needs more than 2 elements (root + content), question the structure.
23
+ - Complex variants (e.g. button with icon-only mode, loading state) may justify more elements.
24
+
25
+ 5. Avoid premature abstraction.
26
+ - Do not add wrapper elements "in case we need them later".
27
+ - Add structure when a real variant or behavior demands it.
28
+
29
+ ## Test
30
+
31
+ Before finalizing component markup, ask:
32
+
33
+ - Can I remove any element without losing functionality?
34
+ - Is every wrapper solving a real layout or behavior problem?
35
+ - Would a developer using this component find the markup obvious?
36
+
37
+ ## Implications
38
+
39
+ - Components stay readable and debuggable in browser DevTools.
40
+ - CSS stays simpler with fewer selectors.
41
+ - Consumers write less HTML.
42
+ - Complex components can still use composition patterns when justified.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui-foundations",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "Token-first UI foundations with CSS, tokens, and React exports.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -15,7 +15,10 @@
15
15
  "files": [
16
16
  "dist/**",
17
17
  "README.md",
18
- "docs/foundations/**"
18
+ "docs/foundations/**",
19
+ "docs/agentic/assistant-behavior-rules.md",
20
+ "docs/agentic/team-ai-playbook.md",
21
+ "docs/agentic/skills/**"
19
22
  ],
20
23
  "exports": {
21
24
  "./core.css": "./dist/core/index.css",
@@ -26,15 +29,15 @@
26
29
  "./react/input": "./dist/react/input.js",
27
30
  "./react/label": "./dist/react/label.js",
28
31
  "./assets/*": "./dist/assets/*",
29
- "./tokens/core.css": "./dist/tokens/css/primitives.tokens.css",
30
- "./tokens/primitives.css": "./dist/tokens/css/primitives.tokens.css",
31
- "./tokens/brand-a.css": "./dist/tokens/css/brand-a.tokens.css",
32
- "./tokens/brand-b.css": "./dist/tokens/css/brand-b.tokens.css",
33
- "./tokens/color.css": "./dist/tokens/css/color.light.tokens.css",
34
- "./tokens/color-light.css": "./dist/tokens/css/color.light.tokens.css",
35
- "./tokens/color-dark.css": "./dist/tokens/css/color.dark.tokens.css",
36
- "./tokens/semantic.css": "./dist/tokens/css/semantic.tokens.css",
37
- "./tokens/components.css": "./dist/tokens/css/component.tokens.css"
32
+ "./tokens/core.css": "./dist/tokens/css/core-(primitives).tokens.css",
33
+ "./tokens/primitives.css": "./dist/tokens/css/core-(primitives).tokens.css",
34
+ "./tokens/brand-a.css": "./dist/tokens/css/themes-(brands).tokens.brand-a.css",
35
+ "./tokens/brand-b.css": "./dist/tokens/css/themes-(brands).tokens.brand-b.css",
36
+ "./tokens/color.css": "./dist/tokens/css/appearance-(modes).tokens.mode-light.css",
37
+ "./tokens/color-light.css": "./dist/tokens/css/appearance-(modes).tokens.mode-light.css",
38
+ "./tokens/color-dark.css": "./dist/tokens/css/appearance-(modes).tokens.mode-dark.css",
39
+ "./tokens/semantic.css": "./dist/tokens/css/semantics-(roles).tokens.css",
40
+ "./tokens/components.css": "./dist/tokens/css/components-(ui).tokens.css"
38
41
  },
39
42
  "scripts": {
40
43
  "icons:generate-list": "node scripts/generate-icon-list.mjs",
@@ -43,6 +46,7 @@
43
46
  "test:unit": "node --test tests/*.test.mjs",
44
47
  "test": "npm run test:unit",
45
48
  "smoke:check": "node scripts/smoke-check.mjs",
49
+ "assets:check": "node scripts/check-asset-refs.mjs",
46
50
  "tokens:generate": "node scripts/extract-tokens.js",
47
51
  "tokens:validate": "node scripts/validate-tokens.mjs",
48
52
  "tokens:build": "npm run tokens:generate",
@@ -51,9 +55,14 @@
51
55
  "build": "npm run build:all",
52
56
  "pack:check": "npm pack --dry-run",
53
57
  "release:check": "npm run ci:check && npm run pack:check",
58
+ "release:patch": "npm run release:check && npm version patch",
59
+ "release:minor": "npm run release:check && npm version minor",
60
+ "release:major": "npm run release:check && npm version major",
61
+ "release:push": "git push origin main --follow-tags",
62
+ "release:publish": "npm publish",
54
63
  "docs:build": "eleventy",
55
64
  "docs:site": "npm run build:all && npm run docs:build",
56
- "ci:check": "npm run lint && npm run test:unit && npm run build:all && npm run smoke:check && npm run tokens:validate && npm run docs:build",
65
+ "ci:check": "npm run lint && npm run test:unit && npm run build:all && npm run smoke:check && npm run tokens:validate && npm run assets:check && npm run docs:build",
57
66
  "docs:dev": "npm run build:all && eleventy --serve"
58
67
  },
59
68
  "devDependencies": {
@@ -63,5 +72,8 @@
63
72
  "js-yaml": "^4.1.0",
64
73
  "jsonc-parser": "^3.3.1",
65
74
  "prismjs": "^1.30.0"
75
+ },
76
+ "dependencies": {
77
+ "ui-foundations": "^0.1.2"
66
78
  }
67
79
  }