@hirobius/design-system 0.12.0 → 0.13.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/NOTICE.md ADDED
@@ -0,0 +1,9 @@
1
+ # License notice
2
+
3
+ `@hirobius/design-system` is not under a single license.
4
+
5
+ - **HDS code** (components, compiled JavaScript, types, CSS, and token files): MIT. See [LICENSE](LICENSE).
6
+ - **Satoshi** (weights 500 and 700, by Indian Type Foundry, distributed through [Fontshare](https://www.fontshare.com/fonts/satoshi)): ITF Free Font License.
7
+ - **Geist Mono** (weight 400, by Vercel, [source](https://github.com/vercel/geist-font)): SIL Open Font License 1.1.
8
+
9
+ Both fonts are embedded as base64 `@font-face` data in `dist/tokens.css` and `dist/styles.css`. The MIT license does not cover them; each font keeps its own license. `dist/variables.css` embeds no fonts.
package/README.md CHANGED
@@ -1,6 +1,27 @@
1
1
  # Hirobius Design System
2
2
 
3
- A publishable React + TypeScript component library, backed by a governed design-token pipeline, a documentation site, and an automated verification suite — all in one repository.
3
+ A publishable React + TypeScript component library backed by a governed design-token pipeline, published to npm as `@hirobius/design-system`.
4
+
5
+ <!--
6
+ PLACEHOLDER — ADRIAN TO WRITE (hds front-door PR).
7
+ If you want the README to mention the July–September 2026 pause, put one or
8
+ two sentences here in your own words, then delete this comment. Leaving the
9
+ comment in place publishes nothing. Do not restore the old status line this
10
+ PR removed: CI, release, and Chromatic triggers were restored in #204.
11
+ -->
12
+
13
+ <!-- auto:start:front-door-counts -->
14
+
15
+ - **108** public component modules, exported from `src/index.ts`
16
+ - **362** DTCG tokens in `hirobius.tokens.json`, compiled to CSS variables and TypeScript constants
17
+ - **442** Storybook stories in **112** story files, reviewed visually in Chromatic
18
+
19
+ <!-- auto:end:front-door-counts -->
20
+
21
+ - Theming through four root attributes and CSS variables (theme, density, brand, font) that need no JavaScript
22
+ - Deterministic gates in git hooks and CI: typecheck, zero-warning ESLint, token validity and contrast, Vitest unit and contract tests, bundle budgets, a consumer smoke build, and a Storybook build
23
+
24
+ The counts are generated from source by `pnpm readme:counts`, which `pnpm tokens` also runs. `scripts/__tests__/front-door.test.mjs` fails if this README claims more than the source has.
4
25
 
5
26
  ## Using the published package
6
27
 
@@ -46,17 +67,22 @@ HDS theming is driven by root attributes + CSS variables, so it works with **zer
46
67
  JavaScript** — set them on any element (React, Astro, plain HTML) and every HDS
47
68
  descendant re-skins:
48
69
 
49
- | Dial | Attribute / var | Values | Default |
50
- | --- | --- | --- | --- |
51
- | theme | `data-theme` | `dark` | light (unset) |
52
- | density | `data-density` | `compact` | comfortable (unset) |
53
- | brand | `data-brand` (+ `data-tenant` alias) | overlay slug | base (unset) |
54
- | font | `--hds-font-family` / `--hds-font-family-mono` | any font-family | Satoshi / Geist Mono |
70
+ | Dial | Attribute / var | Values | Default |
71
+ | ------- | ---------------------------------------------- | --------------- | -------------------- |
72
+ | theme | `data-theme` | `dark` | light (unset) |
73
+ | density | `data-density` | `compact` | comfortable (unset) |
74
+ | brand | `data-brand` (+ `data-tenant` alias) | overlay slug | base (unset) |
75
+ | font | `--hds-font-family` / `--hds-font-family-mono` | any font-family | Satoshi / Geist Mono |
55
76
 
56
77
  ```html
57
78
  <!-- zero-JS: static markup (e.g. an Astro layout) -->
58
- <div data-hds data-theme="dark" data-density="compact" data-brand="acme"
59
- style="--hds-font-family: 'Inter', sans-serif">
79
+ <div
80
+ data-hds
81
+ data-theme="dark"
82
+ data-density="compact"
83
+ data-brand="acme"
84
+ style="--hds-font-family: 'Inter', sans-serif"
85
+ >
60
86
  …
61
87
  </div>
62
88
  ```
@@ -73,27 +99,43 @@ import { HdsThemeProvider } from '@hirobius/design-system';
73
99
  </HdsThemeProvider>;
74
100
  ```
75
101
 
102
+ ## Figma ↔ code
103
+
104
+ Code is the source of truth, and sync runs one way, from code to Figma. What exists today:
105
+
106
+ - **Tokens → Figma model:** `pnpm figma:model` projects `hirobius.tokens.json` into `figma/model.json` — the Primitives, Semantic (Light/Dark), Component, Role, Brand and Density collections, plus text and effect styles. Light and Dark keep their own values.
107
+ - **Model → Figma file:** `pnpm figma:push` writes the upsert scripts that apply that model to a Figma file, and `pnpm figma:native-import` writes DTCG files for Figma's own Variables ▸ Import. Both are run by hand — no workflow pushes to Figma. The runbook is [`figma/README.md`](figma/README.md).
108
+ - **Figma → repo:** `pnpm figma:snapshot --ingest` records the file's state in `figma/snapshot.json`, and `pnpm check:figma-drift` compares the model against that committed snapshot. A hand edit in Figma is drift, not a source change.
109
+ - **Legacy export:** `pnpm figma-variables` still writes the older plugin and REST export files, now projected from the same model.
110
+ - **Components → Code Connect:** the v2 templates live in the repo, but no Code Connect mapping is published, so Dev Mode shows no snippets. Publishing Code Connect needs a Figma Organization plan.
111
+
112
+ What each Figma plan allows, and the Pro-plan architecture this follows, are in [ADR-025](docs/adr/025-figma-sync-pro-architecture.md).
113
+
76
114
  ## Developing this repo
77
115
 
78
116
  ```bash
79
117
  pnpm install
80
- pnpm dev
118
+ # Generated data files are gitignored; create them once (the same step CI runs):
119
+ node scripts/generate-manifest.mjs && node scripts/generate-component-api.mjs && node scripts/enrich-manifest.mjs && node scripts/sync-icons.mjs && node scripts/audit-tokens.mjs --full
120
+ pnpm storybook # component workbench on http://localhost:6006
81
121
  ```
82
122
 
83
123
  Core verification commands:
84
124
 
85
125
  ```bash
86
126
  pnpm typecheck
87
- pnpm run heal
88
- pnpm test:layout
127
+ pnpm lint
128
+ pnpm exec vitest run # unit + contract tests, as the pre-push hook and CI run them
129
+ pnpm tokens:verify
89
130
  pnpm check:size
131
+ pnpm build-storybook
90
132
  ```
91
133
 
92
134
  ## Architecture
93
135
 
94
136
  HDS is built around three structural rules:
95
137
 
96
- - **Strict semantics** — public surfaces prefer system primitives such as `HdsStack`, `HdsGrid`, `HdsSurface`, `HdsTextLockup`, `DocLayout`, and `CaseStudyLayout` instead of raw layout divs or ad hoc CSS.
138
+ - **Strict semantics** — public surfaces prefer system primitives such as `Stack`, `Grid`, `Surface`, and `TextLockup` instead of raw layout divs or ad hoc CSS.
97
139
  - **Polymorphism** — primitives preserve semantic HTML while staying composable through governed APIs such as `forwardRef`, `as`, and layout slots.
98
140
  - **12-column grid** — page structure follows a consistent editorial grid: readable center columns, intentional breakout zones, and explicit `gap` ownership rather than one-off spacing math.
99
141
 
@@ -105,6 +147,20 @@ Source-of-truth files:
105
147
  - `DESIGN.md` — lean visual spec for agents and engineers.
106
148
  - `DESIGN-HANDOFF.md` — verbose visual mirror for handoff and review.
107
149
 
150
+ <!-- design-links:start (generated by `pnpm figma:links`; edit the @figma JSDoc tag, not this section) -->
151
+
152
+ ## Design ↔ Code links
153
+
154
+ Each component has one Figma source: `figmaUrl` in `public/hds-manifest.json`, which `pnpm manifest:generate` sets from the `@figma` tag in the component JSDoc. `pnpm figma:links` keeps this table current and Storybook reads the same field (`parameters.design`). The Figma-side links (dev resources and component descriptions) exist only once someone runs their steps in [`figma/README.md`](figma/README.md).
155
+
156
+ **1 of 120** components link a Figma node.
157
+
158
+ | Component | Figma node | Story | Source |
159
+ | --------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------- | ----------------------------------------- |
160
+ | `Alert` | [33:34](https://www.figma.com/design/c8MaVgwxOlxm4wr8wnH0Z4/HDS-Tokens-Components?node-id=33-34) | [alert.stories.tsx](src/stories/alert.stories.tsx) | [alert.tsx](src/app/components/alert.tsx) |
161
+
162
+ <!-- design-links:end -->
163
+
108
164
  ## Visual direction: Editorial Enterprise
109
165
 
110
166
  The governing direction is "Editorial Enterprise" — enterprise rigor with editorial pacing. It favors sharp hierarchy, open whitespace, monochrome neutrals, and a single electric-blue accent. In practice:
@@ -116,26 +172,20 @@ The governing direction is "Editorial Enterprise" — enterprise rigor with edit
116
172
 
117
173
  ## Verification workflow
118
174
 
119
- Regression prevention is layered:
120
-
121
- - `CLAUDE.md` is the operating contract — agent execution protocol, UI guardrails, required validation steps, and the self-heal requirement before a task is considered done.
122
- - `scripts/self-heal.mjs` (`pnpm run heal`) runs the local static and smoke checks, captures failures, and gives a consistent path to fix type, layout, and runtime drift.
123
- - The Playwright suite covers accessibility, layout integrity, collision detection, responsiveness, and visual regression, so changes that break containment, overlap, or responsive behavior fail automatically.
175
+ The gates are deterministic and need no browser or live site:
124
176
 
125
- Typical loop:
177
+ - **pre-commit** (`.husky/pre-commit`): secrets scan, Prettier on staged files, typecheck, zero-warning ESLint, and token validity and contrast.
178
+ - **pre-push** (`.husky/pre-push`): Vitest unit and contract tests, then the consumer smoke build (library build, subpath resolution, publint, consumer typecheck).
179
+ - **CI** (`.github/workflows/ci.yml`): typecheck, zero-warning ESLint, token validity and contrast, Vitest, and the consumer smoke build, plus bundle budgets and a Storybook build.
180
+ - **Visual review:** Storybook is the visual verification surface, and Chromatic (`.github/workflows/chromatic.yml`) runs it on pull requests. The earlier browser test suite drove a docs site that no longer exists; it is archived in `tests-archive/`.
126
181
 
127
- 1. Change code within the token and component constraints.
128
- 2. Run `pnpm typecheck` and `pnpm run heal`.
129
- 3. Let Playwright catch runtime and visual regressions.
130
- 4. If self-healing fixes a regression, log the root cause and resolution.
131
- 5. Update the verification checklist and ship.
182
+ `CLAUDE.md` is the operating contract for agents working in this repo.
132
183
 
133
184
  ## Bundle and release hygiene
134
185
 
135
186
  - `pnpm check:size` builds the library bundle and runs `size-limit`.
136
- - `pnpm check:release` runs the full release gate (accessibility, responsive, collision, visual, and bundle-size checks).
137
187
 
138
- Releases are cut with [Changesets](https://github.com/changesets/changesets): a merged changeset opens a "Version Packages" PR, and merging that PR publishes the new version to public npm via `.github/workflows/release.yml`.
188
+ Releases are cut with [Changesets](https://github.com/changesets/changesets). A pull request that changes the published package adds a changeset (`pnpm changeset:add`). On a push to `main`, `.github/workflows/release.yml` opens or updates a "Version Packages" PR, and merging that PR publishes the new version to public npm.
139
189
 
140
190
  ## Repository shape
141
191
 
@@ -159,3 +209,7 @@ public/
159
209
  - `DESIGN-HANDOFF.md` — verbose visual mirror
160
210
  - `TOKEN_GOVERNANCE.md` — token system rules
161
211
  - `SYSTEMS_REGISTRY.md` — systems & guardrail registry
212
+
213
+ ## License
214
+
215
+ The HDS code is MIT ([LICENSE](LICENSE)). The package CSS also embeds the Satoshi and Geist Mono fonts, which keep their own licenses and are not covered by MIT. See [NOTICE.md](NOTICE.md).