@cameronsjo/artificer 0.25.0 → 0.27.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 +4 -3
- package/dist/artificer-chromium-dark.zip +0 -0
- package/dist/artificer-chromium-light.zip +0 -0
- package/dist/artificer-firefox.zip +0 -0
- package/package.json +1 -1
- package/reference/SKILL.md +22 -17
- package/src/artificer-editorial.css +3 -1
- package/src/artificer-whimsy.css +170 -0
- package/src/artificer-whimsy.js +227 -5
- package/src/artificer.css +75 -9
- package/src/primitives.json +47 -3
- package/src/tokens.json +1 -1
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.
|
|
4
|
+
**v0.27.0 · 2026** — new layout and doc-chrome primitives: `.container--page` for page padding, `.eyebrow`, `.subsection-title`, `.callout`, a `.kv--props` properties block, and an embed card on `.figure`. The shipped skills and reference drop stale guidance (AA contrast floor, current colour names, a boilerplate that follows the Hard rules), and every live-spec page now uses the system classes and tokens it used to hand-roll. See `CHANGELOG.md` for what changed.
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -252,7 +252,7 @@ You don't need to reinvent any of this. Just don't undo it.
|
|
|
252
252
|
- Selection color (`::selection`) themed
|
|
253
253
|
- Scrollbar styled to match (Webkit + Firefox)
|
|
254
254
|
|
|
255
|
-
The `live-spec/a11y.html` page (in the live system) has the
|
|
255
|
+
The `live-spec/a11y.html` page (in the live system) has the 13-point shipping checklist.
|
|
256
256
|
|
|
257
257
|
---
|
|
258
258
|
|
|
@@ -298,6 +298,7 @@ lives — same palette, every surface. The editors and agent CLIs:
|
|
|
298
298
|
- **VS Code / Cursor** — `themes/vscode/` (sideload or `vsce package`)
|
|
299
299
|
- **Helix** — `themes/helix/artificer-{dark,light}.toml` (+ `-opaque` twins)
|
|
300
300
|
- **Neovim** — `themes/neovim/colors/artificer.lua` (one file, both modes)
|
|
301
|
+
- **Zed** — `themes/zed/artificer.json` (one theme family, both variants)
|
|
301
302
|
- **JetBrains IDEs** — `themes/jetbrains/` (IntelliJ Platform theme plugin; `npm run pack:jetbrains` → install the jar from disk)
|
|
302
303
|
- **Codex CLI** — `themes/codex/artificer-{dark,light}.tmTheme`
|
|
303
304
|
- **Obsidian** — `themes/obsidian/Artificer/` (drop-in theme folder, hand-authored sister)
|
|
@@ -310,7 +311,7 @@ And the browser:
|
|
|
310
311
|
`npm run pack:browser` builds the store zips; sideload straight from the
|
|
311
312
|
directory without packing at all.
|
|
312
313
|
|
|
313
|
-
Plus the terminal and TUI surfaces around them — Ghostty, tmux, gitmux, cmux,
|
|
314
|
+
Plus the terminal and TUI surfaces around them — Ghostty, WezTerm, tmux, gitmux, cmux,
|
|
314
315
|
bat/delta, glamour, gum, fzf, eza, starship, yazi, lazygit, gh-dash, herdr, and
|
|
315
316
|
flux. **`themes/README.md` carries the full list**; it is the one place that
|
|
316
317
|
enumerates them, so this section never has to be counted again.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cameronsjo/artificer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Cameron's personal design system — AuDHD-friendly, dark-first, for tools and dashboards. Apache-2.0 but Cameron-first: published for my own reuse, unsupported, no stability guarantees implied.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Cameron Sjo",
|
package/reference/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: Artificer
|
|
|
3
3
|
description: Cameron's personal design system. AuDHD-optimized, Ghostty-rooted, dark-first with a paper-stock light mode and a Jazz Age Deco palette (burnished gold + royal purple). Use for tools, dashboards, agent UIs, terminals, settings panels — anything that must stay calm until something demands action. Do NOT use for marketing sites, kid-facing UI, or anywhere the goal is delight-via-stimulation.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Artificer · v0.
|
|
6
|
+
# Artificer · v0.27.0
|
|
7
7
|
|
|
8
8
|
A neurodivergent-first design system for Cameron. Every token and rule here exists to reduce cognitive load for an AuDHD brain that **scans instead of reads** and holds **3–4 items** in working memory.
|
|
9
9
|
|
|
@@ -31,7 +31,6 @@ Don't use Artificer for:
|
|
|
31
31
|
|---|---|
|
|
32
32
|
| `artificer.css` | All tokens + utility classes. The only stylesheet you need. |
|
|
33
33
|
| `artificer-theme.js` | Persistent theme control — dark / light / auto (auto follows the OS live); hydrates the empty canonical `.theme-toggle` button. |
|
|
34
|
-
| `assets/cameron-logo.jpg` | Personal mark — only used on Cameron-branded surfaces. |
|
|
35
34
|
| `README.html` | System overview, principles, do/don't. |
|
|
36
35
|
| `colors.html` · `typography.html` · `spacing.html` | Foundations specs. |
|
|
37
36
|
| `components.html` · `patterns.html` · `notifications.html` | Live component specs. |
|
|
@@ -41,14 +40,14 @@ Don't use Artificer for:
|
|
|
41
40
|
| `forms-extended.html` | Field anatomy, validation, fieldsets, helper/error text. The twelve non-negotiable rules. |
|
|
42
41
|
| `data-display.html` | Tables, key-value lists, stat cards, progress. Tabular-nums everywhere. |
|
|
43
42
|
| `states.html` | Empty, loading, error — by duration. Skeleton sizing rules. |
|
|
44
|
-
| `a11y.html` | WCAG 2.2 audit, contrast ratios, focus rings, the
|
|
43
|
+
| `a11y.html` | WCAG 2.2 audit, contrast ratios, focus rings, the a11y shipping checklist. |
|
|
45
44
|
| `artificer-icons.js` | Lucide-rooted icon set, Lucide-canonical names (legacy names alias; unknown names render a dashed placeholder). Auto-hydrates `<i data-icon="…">` placeholders. |
|
|
46
45
|
| `artificer-focus.js` | `ArtificerFocus.trap(el, {onEscape})` — focus-trap helper for modals/dialogs. |
|
|
47
46
|
| `icons.html` | Icon catalog + usage rules (16px viewBox, 1.5 stroke, inherit color). |
|
|
48
47
|
| `voice-and-tone.html` | Microcopy spec — empty states, errors, success, loading. 7-point checklist. |
|
|
49
48
|
| `tokens.json` | Machine-readable token export (for Tailwind, Figma, non-CSS consumers). |
|
|
50
49
|
| `print.css` | Print stylesheet. Forces ivory/navy paper mode, strips chrome. Load `media="print"`. |
|
|
51
|
-
| `assets/favicon.svg` · `assets/og-image.
|
|
50
|
+
| `assets/favicon.svg` · `assets/og-image.png` | Favicon (32px, SVG) and Open Graph card (1200×630, PNG; `og-image.svg` is its source). |
|
|
52
51
|
|
|
53
52
|
---
|
|
54
53
|
|
|
@@ -65,7 +64,7 @@ Don't use Artificer for:
|
|
|
65
64
|
light. Key 'artificer.theme' (dot); dark-first. See QUICKSTART.md. -->
|
|
66
65
|
<script>(function(){try{var s=localStorage.getItem('artificer.theme');var p=s==='light'||s==='dark';var l=window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches;document.documentElement.setAttribute('data-theme',p?s:(l?'light':'dark'));}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>
|
|
67
66
|
<link rel="icon" type="image/svg+xml" href="assets/favicon.svg" />
|
|
68
|
-
<meta property="og:image" content="assets/og-image.
|
|
67
|
+
<meta property="og:image" content="assets/og-image.png" />
|
|
69
68
|
<link rel="stylesheet" href="artificer.css" />
|
|
70
69
|
<link rel="stylesheet" href="print.css" media="print" />
|
|
71
70
|
<script src="artificer-theme.js" defer></script>
|
|
@@ -73,7 +72,7 @@ Don't use Artificer for:
|
|
|
73
72
|
</head>
|
|
74
73
|
<body>
|
|
75
74
|
<button class="theme-toggle" data-theme-toggle aria-label="Toggle theme"></button>
|
|
76
|
-
<main
|
|
75
|
+
<main class="container container--md container--page">
|
|
77
76
|
<!-- your content -->
|
|
78
77
|
</main>
|
|
79
78
|
</body>
|
|
@@ -102,7 +101,7 @@ If you have **no file system** (chat-only artifact), inline the contents of `art
|
|
|
102
101
|
| Confirmation dialog / modal | `overlay.html` — `.scrim` + `.modal`, wire `ArtificerFocus.trap()` for focus-trap |
|
|
103
102
|
| Tooltip / popover | `overlay.html` — `.tooltip` (label) or `.popover` (body content). Reveal on hover + keyboard focus: wrap trigger + `.tooltip` in `.has-tooltip`; place/arrow via `.tooltip--top/bottom/left/right`. Bare `.tooltip` stays a static box |
|
|
104
103
|
| Horizontal bar / meter / usage bar | `charts.html` — `.bar` + `.bar__track` + `.bar__fill` (width inline; fill bg any semantic token; fill bakes `display:block;height:100%` so it never collapses). Determinate % → `.progress` |
|
|
105
|
-
| Page layout (sidebar/main) | `layout.html` — `.page-shell`, `.container` + `.container--{sm\|md\|lg}` (the base class is required — it carries width, centering, and inline padding; the size modifier only sets max-width) |
|
|
104
|
+
| Page layout (sidebar/main) | `layout.html` — `.page-shell`, `.container` + `.container--{sm\|md\|lg}` (the base class is required — it carries width, centering, and inline padding; the size modifier only sets max-width; add `.container--page` on a top-level `<main>` for page block padding) |
|
|
106
105
|
| Blog / editorial / document top nav / masthead | `.masthead` (`artificer-editorial.css`) — non-sticky, no border; document counterpart to `.appbar`. Brand via `.wordmark`, toggle via `.theme-toggle--inline` — `navigation.html` |
|
|
107
106
|
| Stacking children | `layout.html` — `.stack` (vertical), `.cluster` (horizontal wrap) |
|
|
108
107
|
| Card grid | `layout.html` — `.grid-auto` with `--min: 240px`, never hand-rolled flexbox |
|
|
@@ -137,6 +136,8 @@ If you have **no file system** (chat-only artifact), inline the contents of `art
|
|
|
137
136
|
| Wide table / diff / wider-than-phone block | `<div class="scroll-x" tabindex="0">…</div>` — content scrolls inside, never the page; `tabindex="0"` is load-bearing (axe scrollable-region-focusable). `.scroll-x--fade` adds self-hiding edge shadows — `keyboard.html` |
|
|
138
137
|
| Wide comparison matrix (tools × features) | Row-per-item + glyph/text cells → `.table--responsive` cards; interactive/score grids (cell buttons, heatmaps) → stay a table in `.scroll-x.scroll-x--fade` + `.table--sticky-col` (pins `tbody th:first-child` too). Never both below 640px — `data-display.html` |
|
|
139
138
|
| Key-value list | `.kv`; mono `<dl>` grid for metadata pairs, `.table` for real data — `data-display.html` |
|
|
139
|
+
| Properties / metadata block | `.kv.kv--props`; icon per key, divider per row, `.badge--steel` tags — `data-display.html#props` |
|
|
140
|
+
| Embedded diagram / media card | `.figure.figure--frame` + `.figure__bar` (`.eyebrow` + reset) + `.figure__body` — `diagrams.html#embed` |
|
|
140
141
|
| Live data indicator | `.live-tick` (pulsing dot) + `.last-updated` (timestamp); auto-updating regions still need an in-UI pause — `composition.html` |
|
|
141
142
|
| Stat card / KPI strip / headline numbers (KPIs) | `.stat` — `.stat__label` + `.stat__value` (mono, tabular) + `.stat__row` + `.stat__delta`(`.down`); the cell of a `.kpi-strip`, max 4 per row — `data-display.html` |
|
|
142
143
|
| Dashboard shell | `.dash` + `.dash__topbar` (`.dash__title` + `.dash__actions`) — one frame, five recipes — `composition.html` |
|
|
@@ -147,9 +148,13 @@ If you have **no file system** (chat-only artifact), inline the contents of `art
|
|
|
147
148
|
| Theme toggle | empty `<button class="theme-toggle" data-theme-toggle aria-label="Toggle theme">` — the module injects the glyph |
|
|
148
149
|
| Tabular number | `.num` utility — sets `font-variant-numeric: tabular-nums`; drop on the cell, or the parent for a whole table — `data-display.html` |
|
|
149
150
|
| Short hint paragraph under a figure or field | `.note` — sister of `.meta`, smaller (label-sm); inherits the body face, mono on tool surfaces / sans on document surfaces |
|
|
151
|
+
| Eyebrow / overline label | `.eyebrow` (+ `.eyebrow--accent`) — uppercase label over a heading, block, or demo — `typography.html#doc-chrome` |
|
|
152
|
+
| Doc-page subsection header | `<h3 class="subsection-title">` — mono 700 body-md; sibling under `.section-title` — `typography.html#doc-chrome` |
|
|
153
|
+
| Callout / standing note | `.callout` + `.callout__title` (+ `--steel`/`--attention`/`--urgent`); the title names the tier in text — `typography.html#doc-chrome` |
|
|
150
154
|
| Doc-page section header | `<h2 class="section-title">` — mono, uppercase, `--fg-secondary`, border-bottom rule; doc/spec chrome — `data-display.html` |
|
|
151
155
|
| Live-spec / doc-page example container | `<figure class="figure">` + `<figcaption class="meta">…</figcaption>` — `.figure--frame`/`--flush` modifiers — `data-display.html` |
|
|
152
156
|
| Make it fun / playful / celebratory / rainbow | The sanctioned `.whimsy` layer, opt-in, one per view; never on chrome/status/data/errors — `whimsy.html` |
|
|
157
|
+
| Night sky behind a hero or header band | `data-whimsy="sky"` / `.whimsy-sky` + `Whimsy.starfield()` — flowing brand field + seeded stars, dark only, rests with its wordmark on one timer; never behind data/status/errors/body copy — `whimsy.html` pattern 10 |
|
|
153
158
|
| Make it feel like paper / give it grain / material / texture / depth | `.tex-grain` / `.tex-dots` / `.tex-line` / `.tex-paper` / `.tex-raised`; hueless + motionless, never on data/status/errors — `texture.html` |
|
|
154
159
|
| Empty state / error / loading copy | `voice-and-tone.html` — never improvise microcopy |
|
|
155
160
|
| Loading state / UI | `states.html` — pick by *duration*: nothing → disabled label → skeleton → progress → background |
|
|
@@ -157,7 +162,7 @@ If you have **no file system** (chat-only artifact), inline the contents of `art
|
|
|
157
162
|
| Refreshing a value in place | `.live-value[data-refreshing]` recedes the stale value + `.live-value__dot` pulses — NOT `.skeleton` (would blank it) — `composition.html` |
|
|
158
163
|
| Animation / transition | `motion.html` — `--dur-fast` + `--ease`. Don't invent durations. |
|
|
159
164
|
| z-index | `motion.html` / `overlay.html` — six rungs only: `--z-{base\|raised\|overlay\|popover\|modal\|toast}` |
|
|
160
|
-
| Pre-ship a11y check | `a11y.html` —
|
|
165
|
+
| Pre-ship a11y check | `a11y.html` — a11y shipping checklist before merging |
|
|
161
166
|
| Token in non-CSS context | Read `tokens.json` |
|
|
162
167
|
| PDF / print output | Add `<link rel="stylesheet" href="print.css" media="print">` |
|
|
163
168
|
| Hero/landing page | **Don't** — wrong system. Suggest a brand-marketing system instead. |
|
|
@@ -196,11 +201,11 @@ use the lifecycle API:
|
|
|
196
201
|
1. **Dark is default.** Light mode is a paper alternative, not the primary.
|
|
197
202
|
2. **Max 2 semantic colors on screen at once.** Brand purple + gold = one "Cameron" signal, doesn't count.
|
|
198
203
|
3. **Bold 3–5 anchor words per paragraph.** Use `class="anchor"` or `<b>`. Primary scanning mechanism. When prose arrives as data, mark anchors as `**…**` in the source and promote each marked span to `<b class="anchor">` at render — single-level only, never nested.
|
|
199
|
-
4. **
|
|
204
|
+
4. **At most one primary CTA per screen** — zero is valid. Everything else is `.btn--secondary` or `.btn--ghost`.
|
|
200
205
|
5. **5–7 items max** in any list/palette/menu before progressive disclosure.
|
|
201
206
|
6. **No pure black.** `#1D1F21` is the darkest value in the system.
|
|
202
207
|
7. **Honor `prefers-reduced-motion`** — durations collapse to 0ms (already wired in CSS).
|
|
203
|
-
8. **WCAG
|
|
208
|
+
8. **WCAG 2.2 AA floor** — 4.5:1 for body text. Run `scripts/contrast.mjs` on any new pairing.
|
|
204
209
|
9. **Never mix rounded and sharp corners** in one view.
|
|
205
210
|
10. **Voice is literal, direct, lightly deadpan.** No metaphor, sarcasm, or figurative copy. Autism demands clarity.
|
|
206
211
|
|
|
@@ -233,18 +238,18 @@ budgets-with-exemptions, not exceptions that swallow the rule:
|
|
|
233
238
|
SURFACES --bg / --bg-raised / --bg-overlay / --bg-inactive
|
|
234
239
|
TEXT --fg / --fg-secondary / --fg-muted / --fg-disabled / --border
|
|
235
240
|
|
|
236
|
-
INTERACTIVE --accent gold text
|
|
241
|
+
INTERACTIVE --accent gold text — links, focus, secondary buttons
|
|
237
242
|
--accent-bright hover state
|
|
238
243
|
--accent-fill gold background — SMALL controls only (buttons, badges);
|
|
239
244
|
never a selected-card/surface bg, pairs only with --on-accent
|
|
240
245
|
|
|
241
|
-
ATTENTION --attention rose text
|
|
246
|
+
ATTENTION --attention dusty rose text — "look when you can"
|
|
242
247
|
--attention-fill rose background
|
|
243
248
|
|
|
244
|
-
URGENT --urgent
|
|
245
|
-
--urgent-fill
|
|
249
|
+
URGENT --urgent brick red text — errors, blocking
|
|
250
|
+
--urgent-fill brick red background
|
|
246
251
|
|
|
247
|
-
SUCCESS --success
|
|
252
|
+
SUCCESS --success apothecary green — completed
|
|
248
253
|
META --steel / --steel-fill — chrome, secondary UI
|
|
249
254
|
|
|
250
255
|
BRAND --brand-purple / --brand-purple-fill — wordmarks, masthead, NOT semantic
|
|
@@ -401,7 +406,7 @@ there is no `.dash-*` class):
|
|
|
401
406
|
- **9 nodes ceiling.** Group beyond that.
|
|
402
407
|
- **Mermaid:** initialize with `theme:'base'` + `themeVariables` reading CSS vars (snippet in `live-spec/diagrams.html`).
|
|
403
408
|
- **React Flow:** wrap in `.rf-artificer`.
|
|
404
|
-
- **Excalidraw palette:** strokes
|
|
409
|
+
- **Excalidraw palette:** take stroke and fill hexes from the dark block of `tokens.json` (strokes `fg`, `fgSecondary`, `accent`, `attention`; fills `bg`, `bgRaised`, `bgOverlay`). "Architect" roughness for system maps; "artist" for sketches.
|
|
405
410
|
- **`<defs>` ids are document-scoped.** Namespace per instance (`arrow-<id>`) when repeating a diagram component; never hard-code one inside it.
|
|
406
411
|
- **Interactive nodes:** `tabindex="0"` + `role="button"` + `aria-label` + Enter/Space. Focus ring free from the global catch-all.
|
|
407
412
|
|
|
@@ -422,4 +427,4 @@ there is no `.dash-*` class):
|
|
|
422
427
|
- **v0.1** · 2026 · personal use, no license required for Cameron's projects.
|
|
423
428
|
- Palette inspired by 1920s–50s Jazz Age Deco screen-print posters.
|
|
424
429
|
- Surface scale rooted in [Ghostty](https://ghostty.org) terminal defaults.
|
|
425
|
-
-
|
|
430
|
+
- Contrast values are pre-tuned; don't substitute hexes without re-running contrast checks.
|
|
@@ -50,7 +50,9 @@
|
|
|
50
50
|
color: var(--fg-secondary); text-decoration: none;
|
|
51
51
|
transition: color var(--dur-fast) var(--ease);
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
@media (hover: hover) {
|
|
54
|
+
.masthead__nav a:hover { color: var(--fg); }
|
|
55
|
+
}
|
|
54
56
|
.masthead__nav a[aria-current="page"] {
|
|
55
57
|
color: var(--accent);
|
|
56
58
|
box-shadow: inset 0 -2px 0 var(--accent); /* active band — mirrors .sidenav's rail, rotated for a horizontal nav */
|
package/src/artificer-whimsy.css
CHANGED
|
@@ -69,6 +69,19 @@
|
|
|
69
69
|
var(--accent, #dbbb6f) /* → gold */
|
|
70
70
|
);
|
|
71
71
|
|
|
72
|
+
/* Night ground for .whimsy-sky (#501) — derived from tokens, no new hex.
|
|
73
|
+
scripts/icon-recipe.mjs reads these two declarations and resolves them
|
|
74
|
+
(var() or an oklab color-mix) for the app icon, so keep them in one of
|
|
75
|
+
those two forms. A deep night at the zenith (--bg-inactive
|
|
76
|
+
with a touch of the deepest brand purple) that ends exactly on --bg, so
|
|
77
|
+
the band meets the page with no seam (owner ruling 2026-09-27, from the
|
|
78
|
+
Gatehouse header: the first, brighter purple read too loud). --fg holds
|
|
79
|
+
11.2:1 or better across the whole band. */
|
|
80
|
+
--whimsy-night-top: color-mix(in oklab, var(--bg-inactive) 76%, var(--brand-purple-fill));
|
|
81
|
+
--whimsy-night-bottom: var(--bg);
|
|
82
|
+
--whimsy-sky-speed: 40s; /* one sky cycle — slow drift, not a sweep */
|
|
83
|
+
--whimsy-sky-opacity: 0.1; /* flowing field over the ground — a faint tint, never a fill */
|
|
84
|
+
|
|
72
85
|
/* Sine-wave mask for the rainbow rule (one period = 64px). */
|
|
73
86
|
--whimsy-wave-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='64' height='22' viewBox='0 0 64 22'><path d='M0 11 Q 8 2 16 11 T 32 11 T 48 11 T 64 11' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'/></svg>");
|
|
74
87
|
}
|
|
@@ -421,3 +434,160 @@
|
|
|
421
434
|
@media (prefers-reduced-motion: reduce) {
|
|
422
435
|
.whimsy-underline::after { animation: none !important; background-position: 30% 50% !important; }
|
|
423
436
|
}
|
|
437
|
+
|
|
438
|
+
/* ═══ Night sky — the backdrop form of whimsy (#501) ══════════════════════════
|
|
439
|
+
A slow flowing brand field over a night ground, with a seeded starfield
|
|
440
|
+
(Whimsy.starfield / data-whimsy="sky"). Rule #5 ("display + bold only")
|
|
441
|
+
governs gradient TEXT; the sky is a non-text backdrop, so it lives by its
|
|
442
|
+
own bounds instead:
|
|
443
|
+
• only behind a header or hero band — never behind data, status, errors,
|
|
444
|
+
or body copy; foreground text stays on solid ground (--fg > 9:1)
|
|
445
|
+
• the sky and the wordmark it frames are ONE whimsy moment (rule #2) and
|
|
446
|
+
rest on one timer (rule #7 — Whimsy.starfield arms it)
|
|
447
|
+
• dark only: light mode hides the field and stars, leaving plain --bg
|
|
448
|
+
• never stacked with a texture (texture rule #2)
|
|
449
|
+
Markup: <header data-whimsy="sky"> … <a class="wordmark whimsy whimsy--brand">
|
|
450
|
+
The stars layer is aria-hidden; the sky adds nothing to the a11y tree. */
|
|
451
|
+
.whimsy-sky {
|
|
452
|
+
position: relative;
|
|
453
|
+
isolation: isolate;
|
|
454
|
+
overflow: hidden;
|
|
455
|
+
}
|
|
456
|
+
.whimsy-sky::before,
|
|
457
|
+
.whimsy-sky::after {
|
|
458
|
+
content: "";
|
|
459
|
+
position: absolute;
|
|
460
|
+
inset: 0;
|
|
461
|
+
z-index: var(--z-base);
|
|
462
|
+
pointer-events: none;
|
|
463
|
+
}
|
|
464
|
+
/* The night ground. */
|
|
465
|
+
.whimsy-sky::before {
|
|
466
|
+
background: linear-gradient(180deg, var(--whimsy-night-top), var(--whimsy-night-bottom));
|
|
467
|
+
}
|
|
468
|
+
/* The flowing field — the brand cycle, faded out toward the bottom so the
|
|
469
|
+
horizon stays quiet. Unlike text whimsy it drifts by TRANSFORM, not
|
|
470
|
+
background-position: the layer is two sky-widths wide with one gradient
|
|
471
|
+
tile per sky-width, and slides left by one tile per cycle. A transform
|
|
472
|
+
runs on the compositor; a background-position animation repaints this
|
|
473
|
+
whole band every frame, which is too much for a long-lived backdrop. */
|
|
474
|
+
.whimsy-sky::after {
|
|
475
|
+
right: auto;
|
|
476
|
+
width: 200%;
|
|
477
|
+
background-image: var(--whimsy-gradient-brand);
|
|
478
|
+
background-size: 50% 100%;
|
|
479
|
+
background-repeat: repeat;
|
|
480
|
+
opacity: var(--whimsy-sky-opacity);
|
|
481
|
+
animation: whimsy-sky-drift var(--whimsy-sky-speed) linear infinite;
|
|
482
|
+
/* A mask reads alpha only; --fg is simply an opaque token. */
|
|
483
|
+
-webkit-mask-image: linear-gradient(180deg, var(--fg), transparent);
|
|
484
|
+
mask-image: linear-gradient(180deg, var(--fg), transparent);
|
|
485
|
+
}
|
|
486
|
+
@keyframes whimsy-sky-drift {
|
|
487
|
+
from { transform: translateX(0); }
|
|
488
|
+
to { transform: translateX(-50%); } /* exactly one tile → seamless loop */
|
|
489
|
+
}
|
|
490
|
+
.whimsy-sky__stars {
|
|
491
|
+
position: absolute;
|
|
492
|
+
inset: 0;
|
|
493
|
+
z-index: var(--z-base);
|
|
494
|
+
pointer-events: none;
|
|
495
|
+
}
|
|
496
|
+
/* Paint order at --z-base follows the box tree: ::before (ground), then the
|
|
497
|
+
stars layer, then ::after (field). The field washing over the stars is
|
|
498
|
+
deliberate — one tint unifies the sky. Content rides above all three. */
|
|
499
|
+
.whimsy-sky > :not(.whimsy-sky__stars) {
|
|
500
|
+
position: relative;
|
|
501
|
+
z-index: var(--z-raised);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/* A star — the element holds position and its base opacity; ::before draws
|
|
505
|
+
the tinted dot and twinkles. Tints are token roles softened toward --fg,
|
|
506
|
+
so the field reads as starlight, not as status colors. */
|
|
507
|
+
.whimsy-star {
|
|
508
|
+
position: absolute;
|
|
509
|
+
width: calc(2 * var(--star-r, 1.7px));
|
|
510
|
+
height: calc(2 * var(--star-r, 1.7px));
|
|
511
|
+
transform: translate(-50%, -50%);
|
|
512
|
+
opacity: var(--star-o, 0.6);
|
|
513
|
+
}
|
|
514
|
+
.whimsy-star::before {
|
|
515
|
+
content: "";
|
|
516
|
+
position: absolute;
|
|
517
|
+
inset: 0;
|
|
518
|
+
border-radius: var(--radius-pill);
|
|
519
|
+
background: color-mix(in oklab, var(--star-tint, var(--accent)) 70%, var(--fg));
|
|
520
|
+
animation: whimsy-twinkle var(--star-period, 6s) var(--ease) infinite;
|
|
521
|
+
animation-delay: var(--d, 0s);
|
|
522
|
+
}
|
|
523
|
+
/* A sparkle — a four-point star over a soft glow. The glow is the element's
|
|
524
|
+
own background; the star shape is ::before, clipped, so the clip never
|
|
525
|
+
cuts the glow. */
|
|
526
|
+
.whimsy-star--sparkle {
|
|
527
|
+
background: radial-gradient(closest-side,
|
|
528
|
+
color-mix(in oklab, var(--star-tint, var(--accent)) 45%, transparent),
|
|
529
|
+
transparent);
|
|
530
|
+
}
|
|
531
|
+
.whimsy-star--sparkle::before {
|
|
532
|
+
inset: 1px;
|
|
533
|
+
border-radius: 0;
|
|
534
|
+
clip-path: polygon(50% 0, 57.7% 42.3%, 100% 50%, 57.7% 57.7%,
|
|
535
|
+
50% 100%, 42.3% 57.7%, 0 50%, 42.3% 42.3%);
|
|
536
|
+
}
|
|
537
|
+
/* Twinkle — opacity only, dipping to 65% of the star's base (the element's
|
|
538
|
+
opacity multiplies in). Constant keyframes on purpose: a var() inside
|
|
539
|
+
@keyframes keeps 48 animations off the compositor, and on WebKit that
|
|
540
|
+
measurably stalls the main thread. */
|
|
541
|
+
@keyframes whimsy-twinkle {
|
|
542
|
+
0%, 100% { opacity: 1; }
|
|
543
|
+
50% { opacity: 0.65; }
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/* Settle — the sky rests with its wordmark (Whimsy.starfield arms one timer
|
|
547
|
+
that adds these to the sky, every star, and every .whimsy inside).
|
|
548
|
+
Glacial: the field drifts at --whimsy-settle-speed; stars hold at base.
|
|
549
|
+
Static: everything freezes. Compound selectors, !important, and the
|
|
550
|
+
reduced-motion list below all mirror the #221 pattern above. */
|
|
551
|
+
.whimsy-sky.whimsy--glacial::after {
|
|
552
|
+
animation-name: whimsy-sky-drift !important;
|
|
553
|
+
animation-duration: var(--whimsy-settle-speed) !important;
|
|
554
|
+
animation-timing-function: linear !important;
|
|
555
|
+
animation-iteration-count: infinite !important;
|
|
556
|
+
}
|
|
557
|
+
.whimsy-sky.whimsy--settled::after {
|
|
558
|
+
animation: none !important;
|
|
559
|
+
}
|
|
560
|
+
.whimsy-star.whimsy--glacial::before,
|
|
561
|
+
.whimsy-star.whimsy--settled::before {
|
|
562
|
+
animation: none !important;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/* Reduced motion freezes the whole sky: no drift, no twinkle. Every settle
|
|
566
|
+
compound is listed so its !important longhands tie on specificity and
|
|
567
|
+
this later block wins (#221). */
|
|
568
|
+
@media (prefers-reduced-motion: reduce) {
|
|
569
|
+
.whimsy-sky::after,
|
|
570
|
+
.whimsy-sky.whimsy--glacial::after,
|
|
571
|
+
.whimsy-sky.whimsy--settled::after,
|
|
572
|
+
.whimsy-star::before,
|
|
573
|
+
.whimsy-star.whimsy--glacial::before,
|
|
574
|
+
.whimsy-star.whimsy--settled::before {
|
|
575
|
+
animation: none !important;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/* Dark only — light mode hides the ground, the field, and the stars, and the
|
|
580
|
+
sky falls back to the plain page surface. Both light branches, mirroring
|
|
581
|
+
the light rules at the top of this file. */
|
|
582
|
+
:root[data-theme="light"] .whimsy-sky::before,
|
|
583
|
+
:root[data-theme="light"] .whimsy-sky::after,
|
|
584
|
+
:root[data-theme="light"] .whimsy-sky__stars {
|
|
585
|
+
display: none;
|
|
586
|
+
}
|
|
587
|
+
@media (prefers-color-scheme: light) {
|
|
588
|
+
:root:not([data-theme]) .whimsy-sky::before,
|
|
589
|
+
:root:not([data-theme]) .whimsy-sky::after,
|
|
590
|
+
:root:not([data-theme]) .whimsy-sky__stars {
|
|
591
|
+
display: none;
|
|
592
|
+
}
|
|
593
|
+
}
|
package/src/artificer-whimsy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
-
ARTIFICER · Whimsy helper · v0.
|
|
2
|
+
ARTIFICER · Whimsy helper · v0.27.0
|
|
3
3
|
─────────────────────────────────────────────────────────────────────────
|
|
4
4
|
Tiny, dependency-free. Pairs with artificer-whimsy.css. Exposes window.Whimsy.
|
|
5
5
|
|
|
@@ -35,7 +35,16 @@
|
|
|
35
35
|
Whimsy.run(el, opts) ignite el, then settle after opts.loops
|
|
36
36
|
hue-cycles. For long "thinking" states.
|
|
37
37
|
opts = { loops?, settle? }
|
|
38
|
-
Whimsy.scheduleSettle(el, n, mode) rest el after n loops; returns
|
|
38
|
+
Whimsy.scheduleSettle(el, n, mode, opts?) rest el after n loops; returns
|
|
39
|
+
cancel(). opts = { seconds?, group? }.
|
|
40
|
+
Whimsy.starfield(el, opts?) render a seeded starfield into a night sky
|
|
41
|
+
([data-whimsy~="sky"] hydrates on its own)
|
|
42
|
+
and rest it with its wordmark on one timer.
|
|
43
|
+
opts = { seed?, count?, sparkles?, clear?,
|
|
44
|
+
loops?, settle? }
|
|
45
|
+
Whimsy.starPositions(seed, opts?) PURE — the star placement behind
|
|
46
|
+
starfield(). Deterministic per seed.
|
|
47
|
+
Whimsy.mulberry32(seed) PURE — the seeded PRNG starPositions draws.
|
|
39
48
|
Whimsy.settle(el, mode) / .unsettle(el) manual rest / wake.
|
|
40
49
|
mode: "static" (default) | "glacial".
|
|
41
50
|
Whimsy.ignite(el) / .clear(el) manual toggle.
|
|
@@ -110,12 +119,21 @@
|
|
|
110
119
|
}
|
|
111
120
|
|
|
112
121
|
/* Rest `el` after `loops` hue-cycles. loops <= 0 / Infinity = never settle.
|
|
113
|
-
mode: "static" (default) | "glacial". Returns a cancel() fn.
|
|
114
|
-
|
|
122
|
+
mode: "static" (default) | "glacial". Returns a cancel() fn.
|
|
123
|
+
opts = { seconds?, group? } — seconds overrides the cycle length (default:
|
|
124
|
+
the element's live --whimsy-speed); group also settles every .whimsy-star
|
|
125
|
+
and .whimsy inside el on the same tick, so a sky and the wordmark it
|
|
126
|
+
frames rest together as one whimsy moment (#501). */
|
|
127
|
+
function scheduleSettle(el, loops, mode, opts) {
|
|
115
128
|
if (!el || !loops || loops === Infinity || loops <= 0) return function () {};
|
|
129
|
+
opts = opts || {};
|
|
130
|
+
var seconds = opts.seconds > 0 ? opts.seconds : flowSeconds(el);
|
|
116
131
|
var id = window.setTimeout(function () {
|
|
117
132
|
settle(el, mode);
|
|
118
|
-
|
|
133
|
+
if (!opts.group) return;
|
|
134
|
+
var inner = el.querySelectorAll(".whimsy-star, .whimsy");
|
|
135
|
+
for (var i = 0; i < inner.length; i++) settle(inner[i], mode);
|
|
136
|
+
}, seconds * loops * 1000);
|
|
119
137
|
return function cancel() { window.clearTimeout(id); };
|
|
120
138
|
}
|
|
121
139
|
|
|
@@ -149,6 +167,198 @@
|
|
|
149
167
|
el.dataset.whimsyHydrated = "1";
|
|
150
168
|
}
|
|
151
169
|
|
|
170
|
+
/* ── Night sky ── seeded starfield (#501) ──────────────────────────────────
|
|
171
|
+
The algorithm is a contract: a starfield spec describes it draw by draw
|
|
172
|
+
so native ports reproduce the same sky from the same seed, and a
|
|
173
|
+
conformance table pins it. Change the draw order here and both must move
|
|
174
|
+
with it. */
|
|
175
|
+
|
|
176
|
+
// Tints are token ROLE names; CSS resolves each through
|
|
177
|
+
// color-mix(in oklab, var(--<role>) 70%, var(--fg)). Index order is part of
|
|
178
|
+
// the contract — a draw picks by index.
|
|
179
|
+
var STAR_TINTS = ["accent", "attention", "brand-purple-bright", "steel", "success"];
|
|
180
|
+
// Star radii in px at 1×, the stars2.py set (duplicates weight the draw).
|
|
181
|
+
var STAR_SIZES = [1.3, 1.4, 1.7, 1.7, 2.0, 2.3, 2.6];
|
|
182
|
+
var SPARKLE_RADIUS = 11;
|
|
183
|
+
var MAX_ATTEMPTS = 5000;
|
|
184
|
+
var MAX_SPARKLE_PICKS = 100;
|
|
185
|
+
var SKY_DEFAULTS = {
|
|
186
|
+
count: 48,
|
|
187
|
+
sparkles: 4,
|
|
188
|
+
spacing: 0.034, // min distance between star centers, 0–1 units
|
|
189
|
+
topBias: 0.15, // density falloff: accept if draw <= 1 + topBias - t
|
|
190
|
+
bounds: [0.04, 0.03, 0.96, 0.97], // x0, y0, x1, y1 — where stars may land
|
|
191
|
+
clear: null // { cx, cy, rx, ry } ellipse kept empty, or null
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
/* PURE — mulberry32, integer-only (Math.imul + >>>) so every language with
|
|
195
|
+
wrapping 32-bit multiply reproduces it exactly. Returns a draw fn → [0, 1). */
|
|
196
|
+
function mulberry32(seed) {
|
|
197
|
+
var a = seed >>> 0;
|
|
198
|
+
return function () {
|
|
199
|
+
a = (a + 0x6d2b79f5) >>> 0;
|
|
200
|
+
var t = Math.imul(a ^ (a >>> 15), a | 1);
|
|
201
|
+
t = (t + Math.imul(t ^ (t >>> 7), t | 61)) ^ t;
|
|
202
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function quantize(v) { return Math.round(v * 1e6) / 1e6; }
|
|
207
|
+
|
|
208
|
+
function toSeed(seed) {
|
|
209
|
+
var n = typeof seed === "string" && seed.trim() !== "" ? Number(seed) : seed;
|
|
210
|
+
if (typeof n !== "number" || !isFinite(n) || Math.floor(n) !== n) {
|
|
211
|
+
throw new TypeError("Whimsy.starPositions: seed must be an integer, got " + JSON.stringify(seed));
|
|
212
|
+
}
|
|
213
|
+
return n >>> 0;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* PURE — place a seeded starfield. Returns
|
|
217
|
+
[{ x, y, r, o, tint, sparkle, phase, period }]: x/y in 0–1 of the sky box,
|
|
218
|
+
r in px at 1×, o = base opacity, tint = a STAR_TINTS role, phase in [0, 1)
|
|
219
|
+
and period in seconds (4–9) for the twinkle. Stops at MAX_ATTEMPTS, so an
|
|
220
|
+
over-packed request returns fewer stars instead of hanging. */
|
|
221
|
+
function starPositions(seed, opts) {
|
|
222
|
+
var o = {};
|
|
223
|
+
var k;
|
|
224
|
+
for (k in SKY_DEFAULTS) o[k] = SKY_DEFAULTS[k];
|
|
225
|
+
for (k in (opts || {})) if (opts[k] !== undefined) o[k] = opts[k];
|
|
226
|
+
var b = o.bounds;
|
|
227
|
+
if (!(o.count >= 0) || Math.floor(o.count) !== o.count) {
|
|
228
|
+
throw new RangeError("Whimsy.starPositions: count must be a non-negative integer, got " + o.count);
|
|
229
|
+
}
|
|
230
|
+
if (!(o.sparkles >= 0)) {
|
|
231
|
+
throw new RangeError("Whimsy.starPositions: sparkles must be >= 0, got " + o.sparkles);
|
|
232
|
+
}
|
|
233
|
+
if (!b || b.length !== 4 || !(b[0] < b[2]) || !(b[1] < b[3])) {
|
|
234
|
+
throw new RangeError("Whimsy.starPositions: bounds must be [x0, y0, x1, y1] with x0 < x1 and y0 < y1, got " + JSON.stringify(b));
|
|
235
|
+
}
|
|
236
|
+
var rand = mulberry32(toSeed(seed));
|
|
237
|
+
var stars = [];
|
|
238
|
+
for (var tries = 0; stars.length < o.count && tries < MAX_ATTEMPTS; tries++) {
|
|
239
|
+
var x = b[0] + (b[2] - b[0]) * rand();
|
|
240
|
+
var y = b[1] + (b[3] - b[1]) * rand();
|
|
241
|
+
var t = (y - b[1]) / (b[3] - b[1]);
|
|
242
|
+
if (rand() > 1 + o.topBias - t) continue; // thinner toward the bottom
|
|
243
|
+
if (o.clear) {
|
|
244
|
+
var ex = (x - o.clear.cx) / o.clear.rx;
|
|
245
|
+
var ey = (y - o.clear.cy) / o.clear.ry;
|
|
246
|
+
if (ex * ex + ey * ey < 1) continue; // keep the focal zone clear
|
|
247
|
+
}
|
|
248
|
+
var crowded = false;
|
|
249
|
+
for (var i = 0; i < stars.length && !crowded; i++) {
|
|
250
|
+
crowded = Math.hypot(x - stars[i].x, y - stars[i].y) < o.spacing;
|
|
251
|
+
}
|
|
252
|
+
if (crowded) continue;
|
|
253
|
+
stars.push({
|
|
254
|
+
x: x, y: y,
|
|
255
|
+
r: STAR_SIZES[Math.floor(rand() * STAR_SIZES.length)],
|
|
256
|
+
o: 0.35 + 0.5 * rand(),
|
|
257
|
+
tint: STAR_TINTS[Math.floor(rand() * STAR_TINTS.length)],
|
|
258
|
+
sparkle: false,
|
|
259
|
+
phase: rand(),
|
|
260
|
+
period: 4 + 5 * rand()
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
var want = Math.min(o.sparkles, stars.length);
|
|
264
|
+
for (var s = 0, picks = 0; s < want && picks < MAX_SPARKLE_PICKS; picks++) {
|
|
265
|
+
var star = stars[Math.floor(rand() * stars.length)];
|
|
266
|
+
if (star.sparkle) continue;
|
|
267
|
+
star.sparkle = true;
|
|
268
|
+
star.r = SPARKLE_RADIUS;
|
|
269
|
+
s++;
|
|
270
|
+
}
|
|
271
|
+
return stars.map(function (st) {
|
|
272
|
+
return { x: quantize(st.x), y: quantize(st.y), r: st.r, o: quantize(st.o),
|
|
273
|
+
tint: st.tint, sparkle: st.sparkle,
|
|
274
|
+
phase: quantize(st.phase), period: quantize(st.period) };
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// el → cancel() for its pending sky settle, so a re-render re-arms one timer.
|
|
279
|
+
var skySettles = new WeakMap();
|
|
280
|
+
|
|
281
|
+
function readInt(v, fallback) {
|
|
282
|
+
var n = parseInt(v, 10);
|
|
283
|
+
return isNaN(n) ? fallback : n;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/* DOM — render a seeded starfield into a .whimsy-sky element and arm the
|
|
287
|
+
shared settle. Stars are aria-hidden decoration; CSS hides them in light
|
|
288
|
+
mode, so a theme toggle needs no re-render. Idempotent: the same options
|
|
289
|
+
on an already-rendered sky do nothing; different options replace the
|
|
290
|
+
field. opts = { seed?, count?, sparkles?, clear?, loops?, settle? } —
|
|
291
|
+
omitted values read data-whimsy-seed / -stars / -loops / -settle.
|
|
292
|
+
settle: "glacial" (default) | "static" | "none". */
|
|
293
|
+
function starfield(el, opts) {
|
|
294
|
+
if (!el) return;
|
|
295
|
+
opts = opts || {};
|
|
296
|
+
var d = el.dataset;
|
|
297
|
+
var seed = opts.seed != null ? opts.seed : (d.whimsySeed || 1);
|
|
298
|
+
var placement = {
|
|
299
|
+
count: opts.count != null ? opts.count : readInt(d.whimsyStars, SKY_DEFAULTS.count),
|
|
300
|
+
sparkles: opts.sparkles,
|
|
301
|
+
clear: opts.clear
|
|
302
|
+
};
|
|
303
|
+
var mode = opts.settle || d.whimsySettle || "glacial";
|
|
304
|
+
var loops = opts.loops != null ? opts.loops : readInt(d.whimsyLoops, 3);
|
|
305
|
+
var signature = JSON.stringify([seed, placement, mode, loops]);
|
|
306
|
+
// Its own flag, not whimsyHydrated: a node marked data-whimsy="sky wave"
|
|
307
|
+
// must still get its wave split (splitWave skips whimsyHydrated nodes).
|
|
308
|
+
if (d.whimsySky === signature) return;
|
|
309
|
+
|
|
310
|
+
var stars;
|
|
311
|
+
try {
|
|
312
|
+
stars = starPositions(seed, placement);
|
|
313
|
+
} catch (err) {
|
|
314
|
+
// Bad data-* on a decorative layer must not break the page: say what
|
|
315
|
+
// was wrong and render the default field instead.
|
|
316
|
+
console.warn("Whimsy.starfield: " + err.message + " — rendering the default field.");
|
|
317
|
+
stars = starPositions(1);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
el.classList.add("whimsy-sky");
|
|
321
|
+
// Read the cycle length before writing the stars, so the style read does
|
|
322
|
+
// not force a recalc over freshly inserted nodes.
|
|
323
|
+
var seconds = parseMs(getComputedStyle(el).getPropertyValue("--whimsy-sky-speed")) / 1000;
|
|
324
|
+
var layer = el.querySelector(":scope > .whimsy-sky__stars");
|
|
325
|
+
if (layer) layer.textContent = "";
|
|
326
|
+
else {
|
|
327
|
+
layer = document.createElement("div");
|
|
328
|
+
layer.className = "whimsy-sky__stars";
|
|
329
|
+
layer.setAttribute("aria-hidden", "true");
|
|
330
|
+
el.insertBefore(layer, el.firstChild);
|
|
331
|
+
}
|
|
332
|
+
var batch = document.createDocumentFragment();
|
|
333
|
+
for (var i = 0; i < stars.length; i++) {
|
|
334
|
+
var s = stars[i];
|
|
335
|
+
var span = document.createElement("span");
|
|
336
|
+
span.className = s.sparkle ? "whimsy-star whimsy-star--sparkle" : "whimsy-star";
|
|
337
|
+
span.style.left = (s.x * 100).toFixed(4) + "%";
|
|
338
|
+
span.style.top = (s.y * 100).toFixed(4) + "%";
|
|
339
|
+
span.style.setProperty("--star-r", s.r + "px");
|
|
340
|
+
span.style.setProperty("--star-o", String(s.o));
|
|
341
|
+
span.style.setProperty("--star-tint", "var(--" + s.tint + ")");
|
|
342
|
+
span.style.setProperty("--star-period", s.period.toFixed(3) + "s");
|
|
343
|
+
span.style.setProperty("--d", (-s.phase * s.period).toFixed(3) + "s");
|
|
344
|
+
batch.appendChild(span);
|
|
345
|
+
}
|
|
346
|
+
layer.appendChild(batch);
|
|
347
|
+
|
|
348
|
+
// One timer for the whole moment: the sky, its stars, and any .whimsy
|
|
349
|
+
// wordmark inside rest together after `loops` sky cycles.
|
|
350
|
+
var prior = skySettles.get(el);
|
|
351
|
+
if (prior) prior();
|
|
352
|
+
unsettle(el);
|
|
353
|
+
var inner = el.querySelectorAll(".whimsy");
|
|
354
|
+
for (var j = 0; j < inner.length; j++) unsettle(inner[j]);
|
|
355
|
+
if (mode !== "none") {
|
|
356
|
+
skySettles.set(el, scheduleSettle(el, loops, mode,
|
|
357
|
+
{ seconds: seconds > 0 ? seconds : 40, group: true }));
|
|
358
|
+
}
|
|
359
|
+
d.whimsySky = signature;
|
|
360
|
+
}
|
|
361
|
+
|
|
152
362
|
function hydrate(root) {
|
|
153
363
|
root = root || document;
|
|
154
364
|
var waves = root.querySelectorAll('[data-whimsy~="wave"]');
|
|
@@ -165,6 +375,14 @@
|
|
|
165
375
|
if (plain[j].dataset.whimsyCleared === "1") continue;
|
|
166
376
|
plain[j].classList.add("whimsy");
|
|
167
377
|
}
|
|
378
|
+
// Skies last: splitWave rewrites textContent, which would wipe a stars
|
|
379
|
+
// layer already inserted into a node marked data-whimsy="sky wave".
|
|
380
|
+
var skies = root.querySelectorAll('[data-whimsy~="sky"]');
|
|
381
|
+
for (var s = 0; s < skies.length; s++) {
|
|
382
|
+
if (skies[s].dataset.whimsyCleared === "1") continue;
|
|
383
|
+
if (skies[s].dataset.whimsySky) continue;
|
|
384
|
+
starfield(skies[s]);
|
|
385
|
+
}
|
|
168
386
|
}
|
|
169
387
|
|
|
170
388
|
/* The "ultrathink" gesture. Watch a text input; when its value contains any
|
|
@@ -419,6 +637,10 @@
|
|
|
419
637
|
settle: settle,
|
|
420
638
|
unsettle: unsettle,
|
|
421
639
|
scheduleSettle: scheduleSettle,
|
|
640
|
+
starfield: starfield,
|
|
641
|
+
starPositions: starPositions,
|
|
642
|
+
mulberry32: mulberry32,
|
|
643
|
+
STAR_TINTS: STAR_TINTS.slice(),
|
|
422
644
|
ignite: igniteEl,
|
|
423
645
|
clear: clearEl
|
|
424
646
|
};
|
package/src/artificer.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
-
ARTIFICER · Design tokens · v0.
|
|
2
|
+
ARTIFICER · Design tokens · v0.27.0 (apothecary × deco × speakeasy)
|
|
3
3
|
AuDHD-optimized, Ghostty-rooted, with warm Jazz-Age accents.
|
|
4
4
|
Default theme = dark. Add data-theme="light" on <html> for ivory paper mode.
|
|
5
5
|
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
--bg-inactive: #1d1f21; /* unfocused panes */
|
|
112
112
|
|
|
113
113
|
/* Foreground — bone, not chrome. Softer than #fff but still AAA. */
|
|
114
|
-
--fg: #e8e6e1; /* warm off-white, 11.
|
|
114
|
+
--fg: #e8e6e1; /* warm off-white, 11.21:1 on --bg */
|
|
115
115
|
--fg-secondary: #c5c8c6;
|
|
116
116
|
--fg-muted: #5a7a8a; /* steel-blue muted — meta/comment text, between secondary and disabled */
|
|
117
117
|
--fg-disabled: #666666;
|
|
@@ -213,7 +213,7 @@
|
|
|
213
213
|
--z-toast: 3000; /* always-on-top notifications */
|
|
214
214
|
|
|
215
215
|
/* Artificer v0.10.1 — baseline contract: see CLAUDE.md § Baseline contract */
|
|
216
|
-
--art-version: "0.
|
|
216
|
+
--art-version: "0.27.0";
|
|
217
217
|
|
|
218
218
|
color-scheme: dark;
|
|
219
219
|
}
|
|
@@ -395,6 +395,36 @@ body { font-size: var(--t-body-md-size); }
|
|
|
395
395
|
padding-bottom: var(--s-sm);
|
|
396
396
|
border-bottom: 1px solid var(--border);
|
|
397
397
|
}
|
|
398
|
+
/* Sibling of .section-title for the h3 under it (#508). */
|
|
399
|
+
.subsection-title {
|
|
400
|
+
font-family: var(--font-mono); font-weight: 700;
|
|
401
|
+
font-size: var(--t-body-md-size); line-height: var(--t-body-md-lh);
|
|
402
|
+
color: var(--fg);
|
|
403
|
+
margin: var(--s-lg) 0 var(--s-sm);
|
|
404
|
+
}
|
|
405
|
+
/* Uppercase overline label above a heading, block, or demo (#507). Tracking
|
|
406
|
+
matches .stat__label / .menu__label so the system has one label tracking. */
|
|
407
|
+
.eyebrow {
|
|
408
|
+
font-family: var(--font-interface); font-weight: 500;
|
|
409
|
+
font-size: var(--t-label-xs-size); line-height: var(--t-label-xs-lh);
|
|
410
|
+
letter-spacing: .08em; text-transform: uppercase;
|
|
411
|
+
color: var(--fg-secondary);
|
|
412
|
+
}
|
|
413
|
+
.eyebrow--accent { color: var(--accent); }
|
|
414
|
+
/* Callout: a raised note with an accent edge (#461). Tier modifiers recolor
|
|
415
|
+
the edge only; the title (.callout__title) must name the tier in text, so
|
|
416
|
+
color never carries the meaning alone. No success tier: no success token
|
|
417
|
+
clears the 3:1 non-text floor on --bg-raised in dark. */
|
|
418
|
+
.callout {
|
|
419
|
+
background: var(--bg-raised);
|
|
420
|
+
border-left: 2px solid var(--accent);
|
|
421
|
+
border-radius: var(--radius-md);
|
|
422
|
+
padding: var(--s-md) var(--s-lg);
|
|
423
|
+
}
|
|
424
|
+
.callout__title { margin-bottom: var(--s-xs); }
|
|
425
|
+
.callout--steel { border-left-color: var(--steel); }
|
|
426
|
+
.callout--attention { border-left-color: var(--attention); }
|
|
427
|
+
.callout--urgent { border-left-color: var(--urgent-text); }
|
|
398
428
|
|
|
399
429
|
code, .code {
|
|
400
430
|
font-family: var(--font-mono);
|
|
@@ -692,6 +722,8 @@ hr, .divider { border: none; border-top: 1px solid var(--border); margin: var(--
|
|
|
692
722
|
.container--sm { max-width: 560px; }
|
|
693
723
|
.container--md { max-width: 820px; }
|
|
694
724
|
.container--lg { max-width: 1120px; }
|
|
725
|
+
/* Page-level block padding for a top-level <main> (#506): top --s-2xl, bottom --s-3xl. */
|
|
726
|
+
.container--page { padding-block: var(--s-2xl) var(--s-3xl); }
|
|
695
727
|
|
|
696
728
|
/* Page shell: sticky masthead + scrolling main. */
|
|
697
729
|
.page-shell { display: grid; grid-template-rows: auto 1fr; min-height: 100vh; }
|
|
@@ -999,6 +1031,19 @@ hr, .divider { border: none; border-top: 1px solid var(--border); margin: var(--
|
|
|
999
1031
|
}
|
|
1000
1032
|
.figure--frame { padding: 0; overflow: hidden; position: relative; }
|
|
1001
1033
|
.figure--flush { padding: 0; overflow: hidden; }
|
|
1034
|
+
/* Embed: a labeled diagram or media card (#461). Compose on .figure--frame:
|
|
1035
|
+
.figure__bar holds an .eyebrow kind label and an optional reset control;
|
|
1036
|
+
.figure__body centers the content. The bar's icon button drops to 32px
|
|
1037
|
+
(>= 24px floor); the coarse-pointer rule still lifts it to 44px on touch. */
|
|
1038
|
+
.figure__bar {
|
|
1039
|
+
display: flex; align-items: center; gap: var(--s-sm);
|
|
1040
|
+
padding: var(--s-xs) var(--s-md);
|
|
1041
|
+
border-bottom: 1px solid var(--border);
|
|
1042
|
+
}
|
|
1043
|
+
.figure__bar > .eyebrow { flex: 1; }
|
|
1044
|
+
.figure__bar > .btn--icon { width: var(--s-xl); height: var(--s-xl); min-width: var(--s-xl); }
|
|
1045
|
+
.figure__body { display: flex; justify-content: center; padding: var(--s-lg); overflow: auto; }
|
|
1046
|
+
.figure__body > svg, .figure__body > img { max-width: 100%; height: auto; }
|
|
1002
1047
|
|
|
1003
1048
|
.table {
|
|
1004
1049
|
width: 100%; border-collapse: collapse;
|
|
@@ -1012,6 +1057,17 @@ hr, .divider { border: none; border-top: 1px solid var(--border); margin: var(--
|
|
|
1012
1057
|
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--s-sm) var(--s-lg); font-family: var(--font-mono); font-size: var(--t-body-md-size); }
|
|
1013
1058
|
.kv dt { color: var(--fg-secondary); }
|
|
1014
1059
|
.kv dd { margin: 0; color: var(--fg); }
|
|
1060
|
+
/* Properties block (#461): .kv in a bordered raised box, one divider per row,
|
|
1061
|
+
an optional leading icon on each key, and wrapping tag values in the dd. */
|
|
1062
|
+
.kv--props {
|
|
1063
|
+
gap: 0; background: var(--bg-raised);
|
|
1064
|
+
border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden;
|
|
1065
|
+
}
|
|
1066
|
+
.kv--props dt, .kv--props dd { padding: var(--s-xs) var(--s-md); border-bottom: 1px solid var(--border); }
|
|
1067
|
+
.kv--props dt:last-of-type, .kv--props dd:last-of-type { border-bottom: none; }
|
|
1068
|
+
.kv--props dt { display: flex; align-items: center; gap: var(--s-xs); font-size: var(--t-label-sm-size); }
|
|
1069
|
+
.kv--props dt > .icon { color: var(--fg-disabled); flex: none; }
|
|
1070
|
+
.kv--props dd { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-xs); }
|
|
1015
1071
|
|
|
1016
1072
|
/* ═══ States — empty, skeleton, progress ══════════════════════════════ */
|
|
1017
1073
|
.empty-state {
|
|
@@ -1341,7 +1397,7 @@ select:focus-visible,
|
|
|
1341
1397
|
--series-1: var(--accent); /* gold */
|
|
1342
1398
|
--series-2: var(--steel); /* steel-blue */
|
|
1343
1399
|
--series-3: var(--brand-purple); /* purple */
|
|
1344
|
-
--series-4: var(--success); /*
|
|
1400
|
+
--series-4: var(--success); /* apothecary green */
|
|
1345
1401
|
--series-5: var(--attention); /* rose */
|
|
1346
1402
|
|
|
1347
1403
|
/* Sequential ramp — single-hue, 5 stops light→dark.
|
|
@@ -1352,7 +1408,7 @@ select:focus-visible,
|
|
|
1352
1408
|
--ramp-4: color-mix(in oklch, var(--accent) 85%, var(--bg));
|
|
1353
1409
|
--ramp-5: var(--accent);
|
|
1354
1410
|
|
|
1355
|
-
/* Diverging — for signed deltas.
|
|
1411
|
+
/* Diverging — for signed deltas. Brick-low → neutral → apothecary-green-high. */
|
|
1356
1412
|
--diverge-low: var(--urgent);
|
|
1357
1413
|
--diverge-mid: var(--fg-disabled);
|
|
1358
1414
|
--diverge-high: var(--success);
|
|
@@ -1587,7 +1643,10 @@ select:focus-visible,
|
|
|
1587
1643
|
color: var(--fg-secondary); margin: 0 0 var(--s-md);
|
|
1588
1644
|
}
|
|
1589
1645
|
.crumb a { color: var(--fg-secondary); text-decoration: none; }
|
|
1590
|
-
.crumb a:
|
|
1646
|
+
.crumb a:focus-visible { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
|
|
1647
|
+
@media (hover: hover) {
|
|
1648
|
+
.crumb a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
|
|
1649
|
+
}
|
|
1591
1650
|
.crumb [aria-current="page"] { color: var(--fg); }
|
|
1592
1651
|
.crumb__sep { color: var(--fg-disabled); margin: 0 0.4em; }
|
|
1593
1652
|
|
|
@@ -1845,7 +1904,9 @@ select:focus-visible,
|
|
|
1845
1904
|
border-bottom: 2px solid transparent;
|
|
1846
1905
|
transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
|
|
1847
1906
|
}
|
|
1848
|
-
|
|
1907
|
+
@media (hover: hover) {
|
|
1908
|
+
.tabs button:hover, .tabs a:hover { color: var(--fg); }
|
|
1909
|
+
}
|
|
1849
1910
|
.tabs [aria-selected="true"], .tabs [aria-current="page"] {
|
|
1850
1911
|
color: var(--accent); border-bottom-color: var(--accent);
|
|
1851
1912
|
}
|
|
@@ -2149,7 +2210,9 @@ select:focus-visible,
|
|
|
2149
2210
|
transform: rotate(45deg); transition: transform var(--dur-fast) var(--ease);
|
|
2150
2211
|
}
|
|
2151
2212
|
.accordion details[open] > summary::after { transform: rotate(-135deg); }
|
|
2152
|
-
|
|
2213
|
+
@media (hover: hover) {
|
|
2214
|
+
.accordion summary:hover { background: var(--bg-raised); }
|
|
2215
|
+
}
|
|
2153
2216
|
.accordion summary:focus-visible { outline: var(--focus-width) solid var(--accent); outline-offset: var(--focus-offset-inset); }
|
|
2154
2217
|
.accordion__body { padding: 0 var(--s-md) var(--s-md); color: var(--fg-secondary); }
|
|
2155
2218
|
|
|
@@ -2377,7 +2440,10 @@ select:focus-visible,
|
|
|
2377
2440
|
color: var(--fg-secondary); cursor: pointer;
|
|
2378
2441
|
transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
|
|
2379
2442
|
}
|
|
2380
|
-
|
|
2443
|
+
/* Hover only where hover exists — same latch rationale as the .sidenav guard. */
|
|
2444
|
+
@media (hover: hover) {
|
|
2445
|
+
.tree__row:hover { background: var(--bg-raised); color: var(--fg); }
|
|
2446
|
+
}
|
|
2381
2447
|
/* aria-expanded / aria-selected live on the parent [role="treeitem"] (APG tree
|
|
2382
2448
|
pattern), so reach the row through it — keying off .tree__row[aria-*] matches
|
|
2383
2449
|
nothing (the row is a roleless div, the attrs sit on the <li>). */
|
package/src/primitives.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schemaVersion": "1",
|
|
3
|
-
"$version": "0.
|
|
3
|
+
"$version": "0.27.0",
|
|
4
4
|
"$doc": "Primitive mint ledger (ADR 0037, #199). Provenance + adoption semantics for every shipped primitive. tokens.json owns token VALUES; scripts/css-token-set.baseline.json owns the token SET; this file owns grouping, vintage, recipes, and adoption signals. Gated by scripts/check-primitives.mjs (check:primitives). minted 'pending-backfill' marks an entry awaiting mechanical dating (all dated by #199 PR-3's backfill; the sentinel remains legal for future re-derivations); 'unreleased' marks a mint on a feature branch, swept to the release version by sync:primitives-vintage. The 'js' field names a VANILLA src/ behavior module (data- hook + window API); the 'react' field names the compiled React adapter component(s) for the primitive (@cameronsjo/artificer/react) — distinct fields because they are distinct consumption models.",
|
|
5
5
|
"primitives": {
|
|
6
6
|
"stack": {
|
|
@@ -119,7 +119,9 @@
|
|
|
119
119
|
"kind": "component",
|
|
120
120
|
"minted": "0.13.0",
|
|
121
121
|
"classes": [
|
|
122
|
-
"figure"
|
|
122
|
+
"figure",
|
|
123
|
+
"figure__bar",
|
|
124
|
+
"figure__body"
|
|
123
125
|
],
|
|
124
126
|
"recipe": "Live-spec / doc-page example container"
|
|
125
127
|
},
|
|
@@ -913,11 +915,15 @@
|
|
|
913
915
|
"whimsy-char",
|
|
914
916
|
"whimsy-focus",
|
|
915
917
|
"whimsy-rule",
|
|
918
|
+
"whimsy-sky",
|
|
919
|
+
"whimsy-sky__stars",
|
|
920
|
+
"whimsy-star",
|
|
921
|
+
"whimsy-star--sparkle",
|
|
916
922
|
"whimsy-underline"
|
|
917
923
|
],
|
|
918
924
|
"js": {
|
|
919
925
|
"module": "artificer-whimsy.js",
|
|
920
|
-
"api": "Whimsy.hydrate() / watch() / celebrate() / run()",
|
|
926
|
+
"api": "Whimsy.hydrate() / watch() / celebrate() / run() / starfield()",
|
|
921
927
|
"hook": "data-whimsy"
|
|
922
928
|
},
|
|
923
929
|
"recipe": "Make it fun / playful / celebratory / rainbow",
|
|
@@ -988,6 +994,44 @@
|
|
|
988
994
|
"--focus-offset-loose",
|
|
989
995
|
"--focus-offset-inset"
|
|
990
996
|
]
|
|
997
|
+
},
|
|
998
|
+
"eyebrow": {
|
|
999
|
+
"kind": "utility",
|
|
1000
|
+
"minted": "0.27.0",
|
|
1001
|
+
"classes": [
|
|
1002
|
+
"eyebrow",
|
|
1003
|
+
"eyebrow--accent"
|
|
1004
|
+
],
|
|
1005
|
+
"recipe": "Eyebrow / overline label",
|
|
1006
|
+
"demo": "live-spec/typography.html#doc-chrome",
|
|
1007
|
+
"adoption": {
|
|
1008
|
+
"supersedes": "hand-rolled uppercase 11px labels (.label, .demo-label, …) with drifted tracking"
|
|
1009
|
+
}
|
|
1010
|
+
},
|
|
1011
|
+
"subsection-title": {
|
|
1012
|
+
"kind": "utility",
|
|
1013
|
+
"minted": "0.27.0",
|
|
1014
|
+
"classes": [
|
|
1015
|
+
"subsection-title"
|
|
1016
|
+
],
|
|
1017
|
+
"recipe": "Doc-page subsection header",
|
|
1018
|
+
"demo": "live-spec/typography.html#doc-chrome"
|
|
1019
|
+
},
|
|
1020
|
+
"callout": {
|
|
1021
|
+
"kind": "component",
|
|
1022
|
+
"minted": "0.27.0",
|
|
1023
|
+
"classes": [
|
|
1024
|
+
"callout",
|
|
1025
|
+
"callout__title",
|
|
1026
|
+
"callout--steel",
|
|
1027
|
+
"callout--attention",
|
|
1028
|
+
"callout--urgent"
|
|
1029
|
+
],
|
|
1030
|
+
"recipe": "Callout / standing note",
|
|
1031
|
+
"demo": "live-spec/typography.html#doc-chrome",
|
|
1032
|
+
"adoption": {
|
|
1033
|
+
"supersedes": "hand-rolled --bg-raised + accent border-left note blocks"
|
|
1034
|
+
}
|
|
991
1035
|
}
|
|
992
1036
|
},
|
|
993
1037
|
"versions": {
|
package/src/tokens.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://design-tokens.org/schema.json",
|
|
3
3
|
"$description": "Artificer · Cameron's personal design system. Machine-readable token export. Mirrors artificer.css. Source of truth lives in the CSS — regenerate this file if tokens change there.",
|
|
4
|
-
"$version": "0.
|
|
4
|
+
"$version": "0.27.0",
|
|
5
5
|
|
|
6
6
|
"color": {
|
|
7
7
|
"$description": "All colors paired with their dark/light values. AAA-tuned where indicated. v0.6 palette: apothecary × deco × speakeasy.",
|