@cameronsjo/artificer 0.18.0 → 0.21.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/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Artificer · Design System Handoff
2
2
 
3
3
  Cameron's personal design system, packaged for use in real codebases.
4
- **v0.18.0 · 2026** — the re-true: the root is never overridden (`html { font-size: 100% }`), so every `--t-*-size` token now renders at its labeled px and the whole system scales with the browser font-size preference (#211, owner-ruled). Token-bound type grows ~14.3% — body copy lands at a true 14px (it had double-applied to 12.25px); the owner optical pass is #214. The px-literal chrome rebinds to exact-match tokens as identity swaps, the `lint:tokens` font-size watch arms, the `.toast` ghost leaves print.css, and app-shell lands on canonical `.section-title`. See `CHANGELOG.md` for what changed.
4
+ **v0.21.0 · 2026** — the mint ledger: every shipped primitive now carries machine-readable provenance in `src/primitives.json` (vintage, classes, behavior module, recipe pointer, adoption signals), gated in CI by `check:primitives` — a mint can no longer ship invisible (#190) or unreachable (#191). The `artificer-upgrade` skill v0.3 walks the ledger instead of a hand-maintained matrix and sweeps consumers for hand-rolled equivalents of newer primitives; the vendor bin transports the ledger (`ARTIFICER-CHEATSHEET.md` ride-along retired); `docs/UPGRADE.md` gains the 0.11→0.20 migration rows under an existence-lockstep gate; `.masthead` and `.colophon` mint. See `CHANGELOG.md` for what changed.
5
5
 
6
6
  ---
7
7
 
@@ -12,9 +12,9 @@ A complete, self-contained design system you can drop into any project. Five fil
12
12
  | File | What it gives you |
13
13
  |---|---|
14
14
  | `src/artificer.css` | All tokens (color, type, space, radius, motion, z) + every component class. **Just add this stylesheet and you have the system.** |
15
- | `src/artificer-theme.js` | Persistent dark/cream theme toggle, reads `localStorage`, respects `prefers-color-scheme` on first load. |
15
+ | `src/artificer-theme.js` | Persistent theme control — three modes (`dark` / `light` / `auto`), `auto` follows `prefers-color-scheme` live. Hydrates the empty canonical `.theme-toggle` button with the half-circle glyph. |
16
16
  | `src/artificer-focus.js` | `ArtificerFocus.trap(el, {onEscape})` — focus-trap helper for modals, dialogs, command palettes. |
17
- | `src/artificer-icons.js` | Lucide-rooted icon set. Hydrates `<i data-icon="search">` placeholders into inline SVG. |
17
+ | `src/artificer-icons.js` | Lucide-rooted icon set, keyed by Lucide's canonical names (legacy names alias). Hydrates `<i data-icon="search">` placeholders into inline SVG; unknown names render a dashed placeholder box. |
18
18
  | `src/tokens.json` | Machine-readable token export. For Tailwind, Figma, Style Dictionary, anything non-CSS. |
19
19
 
20
20
  Plus `src/print.css` (paper-mode for PDF/print) and two SVG assets (favicon, OG card).
@@ -53,9 +53,7 @@ Copy the `src/` folder into your project, then:
53
53
  </head>
54
54
  <body>
55
55
  <a href="#main" class="skip-link">Skip to content</a>
56
- <button class="theme-toggle" data-theme-toggle aria-label="Toggle theme">
57
- <span class="dot"></span><span data-theme-label>Dark</span>
58
- </button>
56
+ <button class="theme-toggle" data-theme-toggle aria-label="Toggle theme"></button>
59
57
  <main id="main" class="container container--md">…</main>
60
58
  </body>
61
59
  </html>
@@ -63,6 +61,65 @@ Copy the `src/` folder into your project, then:
63
61
 
64
62
  That's it. Use the utility classes (`.btn`, `.card`, `.stack`, `.cluster`, etc.).
65
63
 
64
+ **Vendor it with one command.** Instead of copying `src/` by hand, run the
65
+ bundled `vendor` bin — it globs the runtime (including `primitives.json`,
66
+ the machine-readable mint ledger) and stamps a provenance sidecar so you can
67
+ tell later what version you're on and whether anything drifted:
68
+
69
+ ```bash
70
+ npx @cameronsjo/artificer vendor # → public/artificer/
71
+ npx @cameronsjo/artificer vendor --dest static/artificer --fonts
72
+ ```
73
+
74
+ It copies `artificer*.css`, `artificer*.js`, `print.css`, `tokens.json`, and
75
+ `primitives.json` (the mint ledger the upgrade skill consumes) into the dest,
76
+ plus a `provenance.json` recording the source, the version, and a `sha256` for
77
+ each file. (The interim `ARTIFICER-CHEATSHEET.md` ride-along is retired; an old
78
+ vendored copy can be deleted.) Fonts are opt-in (`--fonts`) — off by default, since a bundler resolves
79
+ them for you. Re-run to update; a vendored file you hand-edited (or an untracked
80
+ file already sitting in the dest) is flagged, and `--strict` turns that into a
81
+ non-zero exit that refuses to overwrite. Re-vendoring adds and overwrites but
82
+ never removes — if a version bump relocates a file, delete the dest and re-run
83
+ for a clean tree. Bundler consumers on **Path B** don't need this — they import
84
+ from `node_modules` directly.
85
+
86
+ > The bin vendors the published `src/`. A minified `dist/` channel
87
+ > (`--channel=min`) is a documented extension point, not yet shipped.
88
+
89
+ **Keep your own CSS honest — `artificer lint`.** The same bin lints Hard rule #1
90
+ (raw hex, on-scale spacing/radius px, near-scale `font-size` px that map to a
91
+ token) over *your* CSS, so consumers hold the line the workshop holds:
92
+
93
+ ```bash
94
+ npx @cameronsjo/artificer lint "src/**/*.css" # strict: exit 2 on a violation
95
+ npx @cameronsjo/artificer lint "src/**/*.css" --advisory # report only, exit 0
96
+ ```
97
+
98
+ It reads the token inventory — the exact scale a violation is measured against —
99
+ from the first of: `--tokens <path>`, then your vendored
100
+ `public/artificer/tokens.json`, then the installed package's own
101
+ `src/tokens.json` (version-locked to what you pinned), then a built-in fallback.
102
+ The chosen source is printed on every run, so the lint stays in lockstep with
103
+ your version. Custom-property definitions and lines marked `/* tuned */` are
104
+ skipped. There is deliberately **no config file** — the discipline is the
105
+ system's, not per-consumer.
106
+
107
+ `lint` only reads files **within** the project — a glob whose base resolves
108
+ outside the working directory is refused. Don't feed it attacker-controlled
109
+ globs in privileged CI.
110
+
111
+ Wire it into CI so drift can't merge. Add a script and a step:
112
+
113
+ ```jsonc
114
+ // package.json
115
+ "scripts": { "lint:artificer": "artificer lint \"src/**/*.css\"" }
116
+ ```
117
+
118
+ ```yaml
119
+ # .github/workflows/ci.yml
120
+ - run: npx @cameronsjo/artificer lint "src/**/*.css"
121
+ ```
122
+
66
123
  ### Path B · Modern bundler (Vite / Webpack / Next / Nuxt)
67
124
 
68
125
  ```bash
@@ -158,6 +215,8 @@ The `framework-adapters/` folder has minimal starting points:
158
215
 
159
216
  These are starters, not the whole system. They cover the 80% case; for new patterns, write the markup directly and use the CSS classes.
160
217
 
218
+ **Read [`framework-adapters/README.md`](framework-adapters/README.md) first** — the one rule for using Artificer's interactive behavior from a framework: the pure keyboard state machines (`ArtificerTabs.nextIndex`, `ArtificerOptions.nextOption`, `ArtificerTree.nextVisible`, …) are *imported* and you drive your own DOM; `enhance()`/`observe()` are for non-framework DOM. It also covers the SPA lifecycle (what auto-hydrates, and the imperative-vs-declarative Whimsy pattern) and the shared theme key (`window.ArtificerTheme.KEY`).
219
+
161
220
  ---
162
221
 
163
222
  ## Fonts