@cameronsjo/artificer 0.27.0 → 0.29.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 +17 -16
- package/bin/artificer.mjs +341 -5
- package/bin/lint-core.mjs +3 -2
- package/dist/react/chrome.d.ts +6 -2
- package/dist/react/chrome.d.ts.map +1 -1
- package/dist/react/chrome.js +4 -4
- package/dist/react/index.d.ts +4 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +2 -1
- package/dist/react/interactive.d.ts +52 -0
- package/dist/react/interactive.d.ts.map +1 -0
- package/dist/react/interactive.js +210 -0
- package/dist/react/primitives.d.ts +20 -5
- package/dist/react/primitives.d.ts.map +1 -1
- package/dist/react/primitives.js +37 -9
- package/package.json +6 -1
- package/reference/SKILL.md +13 -9
- package/src/artificer-options.js +1 -1
- package/src/artificer-sploot.js +303 -0
- package/src/artificer-tailwind.css +86 -0
- package/src/artificer-texture.css +129 -23
- package/src/artificer-theme.js +31 -4
- package/src/artificer-whimsy.css +43 -34
- package/src/artificer-whimsy.js +1 -1
- package/src/artificer.css +392 -120
- package/src/assets/app-icon-1024.png +0 -0
- package/src/assets/app-icon.svg +1 -0
- package/src/assets/favicon-16.png +0 -0
- package/src/assets/favicon-180.png +0 -0
- package/src/assets/favicon-32.png +0 -0
- package/src/assets/favicon-48.png +0 -0
- package/src/assets/favicon-512.png +0 -0
- package/src/assets/favicon-legacy.svg +5 -0
- package/src/assets/favicon.ico +0 -0
- package/src/assets/favicon.svg +1 -5
- package/src/assets/fonts/bricolage-grotesque-variable.woff2 +0 -0
- package/src/assets/fonts/jetbrains-mono-blocks.woff2 +0 -0
- package/src/assets/fonts/recursive-variable.woff2 +0 -0
- package/src/assets/og-image.png +0 -0
- package/src/assets/og-image.svg +14 -20
- package/src/primitives.json +74 -2
- package/src/print.css +4 -3
- package/src/theme-bootstrap.html +4 -2
- package/src/tokens.json +4 -4
- package/types/sploot.d.ts +48 -0
- package/src/assets/fonts/ia-writer-quattro-s-400-italic.woff2 +0 -0
- package/src/assets/fonts/ia-writer-quattro-s-400.woff2 +0 -0
- package/src/assets/fonts/ia-writer-quattro-s-700-italic.woff2 +0 -0
- package/src/assets/fonts/ia-writer-quattro-s-700.woff2 +0 -0
- package/src/assets/fonts/ia-writer-quattro-v-400-italic.woff2 +0 -0
- package/src/assets/fonts/ia-writer-quattro-v-400.woff2 +0 -0
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.29.0 · 2026** — `@layer artificer` cascade scoping, a canonical Tailwind v4 `@theme` export (`@cameronsjo/artificer/tailwind.css`), offline `artificer search`/`lookup`/`scan` CLI commands, inline `.alert` / `.btn-group` / `.list-group` primitives, React `Tabs`/`Listbox`/`Menu`/`Tree` wrappers, and modern-web fixes (Astro view transitions, IME-safe combobox Enter, `[hidden]` override, contained `.app-shell`). See `CHANGELOG.md` for what changed.
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -136,6 +136,7 @@ import 'artificer/artificer-icons.js' // only if using <i data-icon>
|
|
|
136
136
|
import 'artificer/artificer-tabs.js' // only if using .tabs (ships the APG keyboard model)
|
|
137
137
|
import 'artificer/artificer-options.js' // only if using .menu/.listbox/.palette (option navigation)
|
|
138
138
|
import 'artificer/artificer-tree.js' // only if using .tree (ships the APG tree keyboard)
|
|
139
|
+
import 'artificer/artificer-sploot.js' // only if drawing Sploot (<span data-sploot>)
|
|
139
140
|
```
|
|
140
141
|
|
|
141
142
|
The CSS uses CSS custom properties (variables) and `data-theme` attribute — no preprocessing needed.
|
|
@@ -209,9 +210,9 @@ For the full surface area (every component, every variant, voice & tone, accessi
|
|
|
209
210
|
|
|
210
211
|
The `framework-adapters/` folder has minimal starting points:
|
|
211
212
|
|
|
212
|
-
- `tailwind.config.js` —
|
|
213
|
-
- `react
|
|
214
|
-
- `vue-components.
|
|
213
|
+
- `tailwind.config.js` — Tailwind v3 starter mapping Artificer CSS custom properties (`bg-bg`, `text-fg`, `text-accent`, `font-mono`, `rounded-md`, etc.). For Tailwind v4, import `@cameronsjo/artificer/tailwind.css` (`@theme` block).
|
|
214
|
+
- `react/` (`@cameronsjo/artificer/react`) — compiled TypeScript React wrappers for layout, forms, modal, and app chrome (`AppShell`, `Appbar`, `NavDrawer`, `SideNav`, `ThemeToggle`, `Button`, `Field`, `Stack`, `Cluster`, `Modal`, `Notification`). Thin — they emit the canonical classes.
|
|
215
|
+
- `vue-components.md` — copy-pasteable Vue 3 SFC starters for the same patterns.
|
|
215
216
|
|
|
216
217
|
These are starters, not the whole system. They cover the 80% case; for new patterns, write the markup directly and use the CSS classes.
|
|
217
218
|
|
|
@@ -221,19 +222,19 @@ These are starters, not the whole system. They cover the 80% case; for new patte
|
|
|
221
222
|
|
|
222
223
|
## Fonts
|
|
223
224
|
|
|
224
|
-
Artificer ships three SIL OFL font
|
|
225
|
+
Artificer ships three SIL OFL font families, self-hosted as WOFF2 in `src/assets/fonts/`. **Pick the face by role** (see CLAUDE.md → "First decision — what surface is this?"):
|
|
225
226
|
|
|
226
227
|
- **JetBrains Mono** (weights 400 / 500 / 700) — body face on **tool surfaces** (dashboards, consoles, terminals, settings panels, data tables). Always used for code, identifiers, file paths, and numerals — even in document surfaces.
|
|
227
|
-
- **
|
|
228
|
-
- **
|
|
228
|
+
- **Bricolage Grotesque** — `--font-body`, the prose face on **document surfaces** (writeups, READMEs, reports, design docs). One variable file, weights 200–800, with an optical-size axis that tightens headlines automatically.
|
|
229
|
+
- **Recursive** — `--font-interface`, the chrome face: labels, controls, badges, form fields, nav, tabular UI numerals — on **both** tool and document surfaces. One variable file, weights 300–1000, with a slant axis for italics; its digits are fixed-width by default.
|
|
229
230
|
|
|
230
|
-
Both
|
|
231
|
+
Both replaced iA Writer Quattro S/V (ADR 0046). `--font-sans` remains resolvable as a legacy alias of `--font-body`.
|
|
231
232
|
|
|
232
|
-
A useful rule of thumb: if the page has more than ~3 paragraphs of running prose, it's a document — set body in
|
|
233
|
+
A useful rule of thumb: if the page has more than ~3 paragraphs of running prose, it's a document — set body in `--font-body`. If it's mostly chrome around data, it's a tool — set body in JetBrains Mono. Mixing within a project is normal: the settings page is a tool, the README explaining it is a document.
|
|
233
234
|
|
|
234
|
-
|
|
235
|
+
All three are self-hosted from the bundled WOFF2 files (they are also on Google Fonts and Fontsource). The stacks fall back through Source Sans 3 → system-ui, so the page still renders if fonts haven't loaded yet.
|
|
235
236
|
|
|
236
|
-
Full loading recipes
|
|
237
|
+
Full loading recipes and the axis notes: **[`FONTS.md`](FONTS.md)**. Upstream sources: [arrowtype/recursive](https://github.com/arrowtype/recursive) and [ateliertriay/bricolage](https://github.com/ateliertriay/bricolage).
|
|
237
238
|
|
|
238
239
|
---
|
|
239
240
|
|
|
@@ -241,7 +242,7 @@ Full loading recipes, the weight-coverage table, and the Windows faux-bold dispo
|
|
|
241
242
|
|
|
242
243
|
You don't need to reinvent any of this. Just don't undo it.
|
|
243
244
|
|
|
244
|
-
- AAA contrast on all body text (
|
|
245
|
+
- AAA contrast on all body text (11.21:1 dark, 11.4:1 cream)
|
|
245
246
|
- Focus-visible outlines on every interactive element (2px `--accent`, 2px offset)
|
|
246
247
|
- `:focus-visible` not `:focus` — no rings on mouse clicks
|
|
247
248
|
- `prefers-reduced-motion: reduce` collapses all durations to 0ms
|
|
@@ -312,8 +313,8 @@ And the browser:
|
|
|
312
313
|
directory without packing at all.
|
|
313
314
|
|
|
314
315
|
Plus the terminal and TUI surfaces around them — Ghostty, WezTerm, tmux, gitmux, cmux,
|
|
315
|
-
bat/delta, glamour, gum, fzf, eza, starship, yazi, lazygit, gh-dash, herdr,
|
|
316
|
-
flux. **`themes/README.md` carries the full list**; it is the one place that
|
|
316
|
+
bat/delta, glamour, gum, fzf, eza, starship, yazi, lazygit, gh-dash, herdr, the
|
|
317
|
+
herdr desktop app, and flux. **`themes/README.md` carries the full list**; it is the one place that
|
|
317
318
|
enumerates them, so this section never has to be counted again.
|
|
318
319
|
|
|
319
320
|
Everything except Obsidian is generated from `themes/_palette.json`. To re-tune
|
|
@@ -368,13 +369,13 @@ what it *does*.
|
|
|
368
369
|
- **Live system** — every page is a live spec. Read first, then code.
|
|
369
370
|
- **`docs/STATE.md`** — the maturity baseline: where each layer of the system honestly sits (clay / materials / rooms / trust), known gaps, and the backlog policy. Re-assessed each minor version.
|
|
370
371
|
- **`reference/SKILL.md`** — the AI-handoff version of these instructions, dense and machine-readable. If you're using Claude Code, point it at that file.
|
|
371
|
-
-
|
|
372
|
+
- **`.claude/rules/artificer-consumer.md`** (shipped as `CLAUDE.md` in the public `cameronsjo/artificer` repo) — drop into your repo root; Claude Code reads it automatically and will follow Artificer's rules from then on.
|
|
372
373
|
|
|
373
374
|
---
|
|
374
375
|
|
|
375
376
|
## Versioning
|
|
376
377
|
|
|
377
|
-
- **
|
|
378
|
+
- **Apache-2.0** (see `LICENSE`); Cameron-first for personal projects. Current release is tracked in `package.json`.
|
|
378
379
|
- Any change to a token value is a **minor version bump**. Adding a new token or component is a **patch**. Removing a token is a **major** (breaking).
|
|
379
380
|
|
|
380
381
|
---
|
package/bin/artificer.mjs
CHANGED
|
@@ -128,15 +128,17 @@ export function walkRelFiles(root) {
|
|
|
128
128
|
return out;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
// Dirs never worth descending when expanding a consumer's lint glob.
|
|
132
|
-
const LINT_SKIP_DIRS = new Set(['node_modules', '.git']);
|
|
131
|
+
// Dirs never worth descending when expanding a consumer's lint/scan glob (#584).
|
|
132
|
+
const LINT_SKIP_DIRS = new Set(['node_modules', '.git', 'dist', 'build', '_site', 'out']);
|
|
133
133
|
|
|
134
134
|
// Walk `root`, emitting paths POSIX-relative to `relBase`, skipping heavy/hidden
|
|
135
|
-
// dirs
|
|
136
|
-
//
|
|
135
|
+
// dirs, build outputs, vendored Artificer dirs (containing provenance.json),
|
|
136
|
+
// and symlinks — so a consumer `lint "**/*.css"` never descends node_modules,
|
|
137
|
+
// build output, or upstream vendored Artificer files (#584).
|
|
137
138
|
function walkForLint(root, relBase) {
|
|
138
139
|
const out = [];
|
|
139
140
|
const rec = (dir) => {
|
|
141
|
+
if (dir !== root && (existsSync(join(dir, PROVENANCE)) || (dir.endsWith(`${sep}artificer`) && existsSync(join(dir, 'artificer.css'))))) return;
|
|
140
142
|
let names;
|
|
141
143
|
try {
|
|
142
144
|
names = readdirSync(dir);
|
|
@@ -310,6 +312,9 @@ Usage:
|
|
|
310
312
|
Commands:
|
|
311
313
|
vendor Copy the runtime + a provenance sidecar into your project
|
|
312
314
|
lint Check your CSS for raw values that have a token (Hard rule #1)
|
|
315
|
+
search Search Artificer primitives and tokens offline
|
|
316
|
+
lookup Inspect one primitive or token by exact name
|
|
317
|
+
scan Scan a consumer repo for retired/legacy Artificer workarounds
|
|
313
318
|
|
|
314
319
|
Run "artificer <command> --help" for a command's options.`;
|
|
315
320
|
|
|
@@ -625,8 +630,339 @@ export function lint({ argv = [], cwd = process.cwd(), packageRoot, out = consol
|
|
|
625
630
|
return EXIT.LINT_VIOLATIONS;
|
|
626
631
|
}
|
|
627
632
|
|
|
633
|
+
// ── catalog helpers (search / lookup) ────────────────────────────────────────
|
|
634
|
+
const kebabCase = (s) => s.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
635
|
+
|
|
636
|
+
export function flattenTokens(tokens) {
|
|
637
|
+
const items = [];
|
|
638
|
+
if (!tokens || typeof tokens !== 'object') return items;
|
|
639
|
+
|
|
640
|
+
const pushColorGroup = (group, obj) => {
|
|
641
|
+
for (const [k, v] of Object.entries(obj ?? {})) {
|
|
642
|
+
if (k.startsWith('$') || !v || typeof v !== 'object') continue;
|
|
643
|
+
items.push({
|
|
644
|
+
name: kebabCase(k),
|
|
645
|
+
cssVar: `--${kebabCase(k)}`,
|
|
646
|
+
category: `color.${group}`,
|
|
647
|
+
dark: v.dark ?? null,
|
|
648
|
+
light: v.light ?? null,
|
|
649
|
+
value: v.value ?? null,
|
|
650
|
+
use: v.use ?? '',
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
for (const grp of ['surface', 'fg', 'semantic', 'brand', 'anchor', 'onColor']) {
|
|
655
|
+
pushColorGroup(grp, tokens.color?.[grp]);
|
|
656
|
+
}
|
|
657
|
+
for (const [k, v] of Object.entries(tokens.spacing ?? {})) {
|
|
658
|
+
if (k.startsWith('$')) continue;
|
|
659
|
+
items.push({ name: `s-${k}`, cssVar: `--s-${k}`, category: 'spacing', value: String(v), use: 'Spacing scale' });
|
|
660
|
+
}
|
|
661
|
+
for (const [k, v] of Object.entries(tokens.radius ?? {})) {
|
|
662
|
+
if (k.startsWith('$')) continue;
|
|
663
|
+
items.push({ name: `radius-${k}`, cssVar: `--radius-${k}`, category: 'radius', value: v?.value ?? String(v), use: v?.use ?? '' });
|
|
664
|
+
}
|
|
665
|
+
for (const [k, v] of Object.entries(tokens.breakpoint ?? {})) {
|
|
666
|
+
if (k.startsWith('$')) continue;
|
|
667
|
+
items.push({ name: `bp-${k}`, cssVar: `--bp-${k}`, category: 'breakpoint', value: v?.value ?? String(v), use: v?.use ?? '' });
|
|
668
|
+
}
|
|
669
|
+
for (const [k, v] of Object.entries(tokens.typography?.fontFamily ?? {})) {
|
|
670
|
+
if (k.startsWith('$')) continue;
|
|
671
|
+
items.push({ name: `font-${k}`, cssVar: `--font-${k}`, category: 'typography.fontFamily', value: v?.value ?? String(v), use: v?.use ?? '' });
|
|
672
|
+
}
|
|
673
|
+
for (const [k, v] of Object.entries(tokens.typography?.scale ?? {})) {
|
|
674
|
+
if (k.startsWith('$')) continue;
|
|
675
|
+
const stem = kebabCase(k);
|
|
676
|
+
items.push({ name: `t-${stem}-size`, cssVar: `--t-${stem}-size`, category: 'typography.scale', value: v?.size ?? '', use: `lh ${v?.lineHeight ?? ''}, weight ${v?.weight ?? ''}, family ${v?.family ?? ''}` });
|
|
677
|
+
}
|
|
678
|
+
for (const [k, v] of Object.entries(tokens.focus ?? {})) {
|
|
679
|
+
if (k.startsWith('$')) continue;
|
|
680
|
+
items.push({ name: `focus-${kebabCase(k)}`, cssVar: `--focus-${kebabCase(k)}`, category: 'focus', value: v?.value ?? String(v), use: v?.use ?? '' });
|
|
681
|
+
}
|
|
682
|
+
for (const [k, v] of Object.entries(tokens.shadow ?? {})) {
|
|
683
|
+
if (k.startsWith('$')) continue;
|
|
684
|
+
items.push({ name: `shadow-${k}`, cssVar: `--shadow-${k}`, category: 'shadow', dark: v?.dark ?? null, light: v?.light ?? null, use: v?.use ?? '' });
|
|
685
|
+
}
|
|
686
|
+
return items;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
function loadCatalog({ cwd, packageRoot }) {
|
|
690
|
+
const root = packageRoot ?? resolvePackageRoot(BIN_DIR);
|
|
691
|
+
const readJson = (rel) => {
|
|
692
|
+
const vendored = resolve(cwd, DEFAULT_DEST, rel);
|
|
693
|
+
if (existsSync(vendored)) {
|
|
694
|
+
try { return JSON.parse(readFileSync(vendored, 'utf8')); } catch {}
|
|
695
|
+
}
|
|
696
|
+
const own = join(root, 'src', rel);
|
|
697
|
+
if (existsSync(own)) {
|
|
698
|
+
try { return JSON.parse(readFileSync(own, 'utf8')); } catch {}
|
|
699
|
+
}
|
|
700
|
+
return null;
|
|
701
|
+
};
|
|
702
|
+
return {
|
|
703
|
+
primitives: readJson('primitives.json')?.primitives ?? {},
|
|
704
|
+
tokens: flattenTokens(readJson('tokens.json')),
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
const SEARCH_HELP = `artificer search — search Artificer primitives and tokens offline
|
|
709
|
+
|
|
710
|
+
Usage:
|
|
711
|
+
npx @cameronsjo/artificer search <query...> [--json]
|
|
712
|
+
|
|
713
|
+
Options:
|
|
714
|
+
--json Emit machine-readable JSON
|
|
715
|
+
--help, -h Show this help`;
|
|
716
|
+
|
|
717
|
+
export function search({ argv = [], cwd = process.cwd(), packageRoot, out = console.log, err = console.error } = {}) {
|
|
718
|
+
let jsonMode = false;
|
|
719
|
+
const terms = [];
|
|
720
|
+
for (const a of argv) {
|
|
721
|
+
if (a === '--help' || a === '-h') { out(SEARCH_HELP); return EXIT.OK; }
|
|
722
|
+
if (a === '--json') jsonMode = true;
|
|
723
|
+
else if (a.startsWith('-')) { err(`artificer search: unknown option "${a}"`); return EXIT.USAGE; }
|
|
724
|
+
else terms.push(...a.toLowerCase().split(/\s+/).filter(Boolean));
|
|
725
|
+
}
|
|
726
|
+
if (terms.length === 0) {
|
|
727
|
+
err('artificer search: query required (e.g. artificer search "modal focus")');
|
|
728
|
+
err(SEARCH_HELP);
|
|
729
|
+
return EXIT.USAGE;
|
|
730
|
+
}
|
|
731
|
+
const { primitives, tokens } = loadCatalog({ cwd, packageRoot });
|
|
732
|
+
const results = [];
|
|
733
|
+
|
|
734
|
+
for (const [id, p] of Object.entries(primitives)) {
|
|
735
|
+
const hay = [id, p.kind, ...(p.classes ?? []), ...(p.modifiers ?? []), p.js ?? '', ...(p.react ?? []), p.notes ?? ''].join(' ').toLowerCase();
|
|
736
|
+
let score = 0;
|
|
737
|
+
for (const t of terms) {
|
|
738
|
+
if (id.toLowerCase() === t) score += 10;
|
|
739
|
+
else if ((p.classes ?? []).some((c) => c.toLowerCase() === t.replace(/^\./, ''))) score += 8;
|
|
740
|
+
else if (hay.includes(t)) score += 3;
|
|
741
|
+
}
|
|
742
|
+
if (score > 0) results.push({ type: 'primitive', id, score, kind: p.kind, classes: p.classes ?? [], js: p.js ?? null, react: p.react ?? null });
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
for (const tok of tokens) {
|
|
746
|
+
const hay = `${tok.name} ${tok.cssVar} ${tok.category} ${tok.use}`.toLowerCase();
|
|
747
|
+
let score = 0;
|
|
748
|
+
for (const t of terms) {
|
|
749
|
+
const clean = t.replace(/^--/, '');
|
|
750
|
+
if (tok.name === clean) score += 10;
|
|
751
|
+
else if (hay.includes(clean)) score += 3;
|
|
752
|
+
}
|
|
753
|
+
if (score > 0) results.push({ type: 'token', id: tok.cssVar, score, category: tok.category, dark: tok.dark, light: tok.light, value: tok.value, use: tok.use });
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
results.sort((a, b) => b.score - a.score || a.id.localeCompare(b.id));
|
|
757
|
+
const top = results.slice(0, 12);
|
|
758
|
+
if (jsonMode) {
|
|
759
|
+
out(JSON.stringify({ query: terms.join(' '), total: results.length, results: top }, null, 2));
|
|
760
|
+
return EXIT.OK;
|
|
761
|
+
}
|
|
762
|
+
if (top.length === 0) {
|
|
763
|
+
out(`artificer search: no matches for "${terms.join(' ')}"`);
|
|
764
|
+
return EXIT.OK;
|
|
765
|
+
}
|
|
766
|
+
for (const r of top) {
|
|
767
|
+
if (r.type === 'primitive') {
|
|
768
|
+
const cls = r.classes.map((c) => `.${c}`).join(', ');
|
|
769
|
+
const extras = [r.js && `js:${r.js}`, r.react && `react:${r.react.join('/')}`].filter(Boolean).join(' · ');
|
|
770
|
+
out(`[primitive] ${r.id} (${r.kind}) — ${cls}${extras ? ` [${extras}]` : ''}`);
|
|
771
|
+
} else {
|
|
772
|
+
const val = r.dark && r.light ? `dark ${r.dark} / light ${r.light}` : (r.value ?? '');
|
|
773
|
+
out(`[token] ${r.id} (${r.category}) — ${val}${r.use ? ` · ${r.use}` : ''}`);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
return EXIT.OK;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
const LOOKUP_HELP = `artificer lookup — inspect one Artificer primitive or token by exact name
|
|
780
|
+
|
|
781
|
+
Usage:
|
|
782
|
+
npx @cameronsjo/artificer lookup <name> [--json]
|
|
783
|
+
|
|
784
|
+
Examples:
|
|
785
|
+
npx @cameronsjo/artificer lookup modal
|
|
786
|
+
npx @cameronsjo/artificer lookup .app-shell
|
|
787
|
+
npx @cameronsjo/artificer lookup --accent-fill
|
|
788
|
+
|
|
789
|
+
Options:
|
|
790
|
+
--json Emit machine-readable JSON
|
|
791
|
+
--help, -h Show this help`;
|
|
792
|
+
|
|
793
|
+
export function lookup({ argv = [], cwd = process.cwd(), packageRoot, out = console.log, err = console.error } = {}) {
|
|
794
|
+
let jsonMode = false;
|
|
795
|
+
let target = null;
|
|
796
|
+
for (const a of argv) {
|
|
797
|
+
if (a === '--help' || a === '-h') { out(LOOKUP_HELP); return EXIT.OK; }
|
|
798
|
+
if (a === '--json') jsonMode = true;
|
|
799
|
+
else if (a.startsWith('--') && !target) target = a; // allow CSS custom property like --accent
|
|
800
|
+
else if (a.startsWith('-')) { err(`artificer lookup: unknown option "${a}"`); return EXIT.USAGE; }
|
|
801
|
+
else if (!target) target = a;
|
|
802
|
+
else { err(`artificer lookup: unexpected argument "${a}"`); return EXIT.USAGE; }
|
|
803
|
+
}
|
|
804
|
+
if (!target) {
|
|
805
|
+
err('artificer lookup: name required (e.g. artificer lookup modal)');
|
|
806
|
+
err(LOOKUP_HELP);
|
|
807
|
+
return EXIT.USAGE;
|
|
808
|
+
}
|
|
809
|
+
const { primitives, tokens } = loadCatalog({ cwd, packageRoot });
|
|
810
|
+
const cleanClass = target.replace(/^\./, '').toLowerCase();
|
|
811
|
+
const cleanVar = target.replace(/^--/, '').toLowerCase();
|
|
812
|
+
|
|
813
|
+
let primEntry = null;
|
|
814
|
+
if (primitives[target]) primEntry = { id: target, ...primitives[target] };
|
|
815
|
+
else {
|
|
816
|
+
for (const [id, p] of Object.entries(primitives)) {
|
|
817
|
+
if (id.toLowerCase() === cleanClass || (p.classes ?? []).some((c) => c.toLowerCase() === cleanClass)) {
|
|
818
|
+
primEntry = { id, ...p };
|
|
819
|
+
break;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
const tokEntry = tokens.find((t) => t.name === cleanVar || t.cssVar === target.toLowerCase());
|
|
825
|
+
const hit = primEntry ? { type: 'primitive', ...primEntry } : tokEntry ? { type: 'token', ...tokEntry } : null;
|
|
826
|
+
|
|
827
|
+
if (!hit) {
|
|
828
|
+
err(`artificer lookup: "${target}" not found (try "artificer search ${target.replace(/^[-.]+/, '')}")`);
|
|
829
|
+
return EXIT.NO_MATCH;
|
|
830
|
+
}
|
|
831
|
+
if (jsonMode) {
|
|
832
|
+
out(JSON.stringify(hit, null, 2));
|
|
833
|
+
return EXIT.OK;
|
|
834
|
+
}
|
|
835
|
+
if (hit.type === 'primitive') {
|
|
836
|
+
out(`${hit.id} (${hit.kind}, minted v${hit.minted ?? '?'})`);
|
|
837
|
+
if (hit.classes?.length) out(` classes: ${hit.classes.map((c) => `.${c}`).join(', ')}`);
|
|
838
|
+
if (hit.js) out(` js: ${hit.js}`);
|
|
839
|
+
if (hit.react?.length) out(` react: ${hit.react.join(', ')}`);
|
|
840
|
+
if (hit.notes) out(` notes: ${hit.notes}`);
|
|
841
|
+
} else {
|
|
842
|
+
out(`${hit.cssVar} (${hit.category})`);
|
|
843
|
+
if (hit.dark) out(` dark: ${hit.dark}`);
|
|
844
|
+
if (hit.light) out(` light: ${hit.light}`);
|
|
845
|
+
if (hit.value) out(` value: ${hit.value}`);
|
|
846
|
+
if (hit.use) out(` use: ${hit.use}`);
|
|
847
|
+
}
|
|
848
|
+
return EXIT.OK;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
// ── scan (legacy consumer pattern detector) ──────────────────────────────────
|
|
852
|
+
const SCAN_EXT = /\.(?:css|html|js|mjs|cjs|ts|tsx|jsx|astro|vue|svelte)$/i;
|
|
853
|
+
const SCAN_RULES = [
|
|
854
|
+
{
|
|
855
|
+
id: 'legacy-font-quattro',
|
|
856
|
+
re: /iA Writer Quattro/i,
|
|
857
|
+
message: 'Retired font family (ADR 0046, v0.28.0) — migrate to Bricolage Grotesque (--font-body) and Recursive (--font-interface), or import @cameronsjo/artificer/tailwind.css.',
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
id: 'hidden-attr-workaround',
|
|
861
|
+
re: /\[hidden\]\s*\{[^}]*display\s*:\s*none\s*!important/i,
|
|
862
|
+
message: 'Local [hidden] override is now built into artificer.css (#581) and can be deleted.',
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
id: 'app-shell-gutter-workaround',
|
|
866
|
+
re: /\.app-shell__content\s*\{[^}]*grid-template-columns/i,
|
|
867
|
+
message: 'Custom .app-shell__content gutter override is replaced by .app-shell--contained + .app-shell__content--flush (#532).',
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
id: 'astro-view-transition-theme-glue',
|
|
871
|
+
re: /astro:before-swap/,
|
|
872
|
+
message: 'Custom Astro view-transition theme glue is now handled automatically by artificer-theme.js (#530).',
|
|
873
|
+
},
|
|
874
|
+
];
|
|
875
|
+
|
|
876
|
+
const SCAN_HELP = `artificer scan — scan a consumer repo for retired/legacy Artificer workarounds
|
|
877
|
+
|
|
878
|
+
Usage:
|
|
879
|
+
npx @cameronsjo/artificer scan [dir] [--json]
|
|
880
|
+
|
|
881
|
+
Options:
|
|
882
|
+
--json Emit machine-readable JSON
|
|
883
|
+
--help, -h Show this help`;
|
|
884
|
+
|
|
885
|
+
export function scan({ argv = [], cwd = process.cwd(), packageRoot, out = console.log, err = console.error } = {}) {
|
|
886
|
+
let jsonMode = false;
|
|
887
|
+
let dirArg = '.';
|
|
888
|
+
for (const a of argv) {
|
|
889
|
+
if (a === '--help' || a === '-h') { out(SCAN_HELP); return EXIT.OK; }
|
|
890
|
+
if (a === '--json') jsonMode = true;
|
|
891
|
+
else if (a.startsWith('-')) { err(`artificer scan: unknown option "${a}"`); return EXIT.USAGE; }
|
|
892
|
+
else dirArg = a;
|
|
893
|
+
}
|
|
894
|
+
const cwdAbs = resolve(cwd);
|
|
895
|
+
const cwdReal = realpathSync(cwdAbs);
|
|
896
|
+
const targetAbs = resolve(cwd, dirArg);
|
|
897
|
+
if (!existsSync(targetAbs)) {
|
|
898
|
+
err(`artificer scan: path not found: ${dirArg}`);
|
|
899
|
+
return EXIT.USAGE;
|
|
900
|
+
}
|
|
901
|
+
const targetReal = realpathSync(targetAbs);
|
|
902
|
+
if (!within(targetAbs, cwdAbs) || !within(targetReal, cwdReal)) {
|
|
903
|
+
err(`artificer scan: path resolves outside the project: ${dirArg}`);
|
|
904
|
+
return EXIT.USAGE;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
const root = packageRoot ?? resolvePackageRoot(BIN_DIR);
|
|
908
|
+
const pkgVersion = (() => {
|
|
909
|
+
try { return JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')).version; } catch { return null; }
|
|
910
|
+
})();
|
|
911
|
+
|
|
912
|
+
const findings = [];
|
|
913
|
+
|
|
914
|
+
// Check vendored provenance.json version drift against current CLI package version.
|
|
915
|
+
const provAbs = join(cwdAbs, DEFAULT_DEST, PROVENANCE);
|
|
916
|
+
if (pkgVersion && existsSync(provAbs)) {
|
|
917
|
+
try {
|
|
918
|
+
const prov = JSON.parse(readFileSync(provAbs, 'utf8'));
|
|
919
|
+
if (prov.version && prov.version !== pkgVersion) {
|
|
920
|
+
findings.push({
|
|
921
|
+
ruleId: 'vendored-version-drift',
|
|
922
|
+
file: `${DEFAULT_DEST}/${PROVENANCE}`,
|
|
923
|
+
line: 1,
|
|
924
|
+
message: `Vendored Artificer is v${prov.version}, installed CLI is v${pkgVersion} — re-run "npx @cameronsjo/artificer vendor".`,
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
} catch {}
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
const files = walkForLint(targetAbs, cwdAbs).filter((rel) => SCAN_EXT.test(rel));
|
|
931
|
+
for (const rel of files) {
|
|
932
|
+
let text;
|
|
933
|
+
try { text = readFileSync(join(cwdAbs, rel), 'utf8'); } catch { continue; }
|
|
934
|
+
const lines = text.split('\n');
|
|
935
|
+
for (const rule of SCAN_RULES) {
|
|
936
|
+
// Test whole text for multiline CSS rules, then pinpoint first matching line.
|
|
937
|
+
if (!rule.re.test(text)) continue;
|
|
938
|
+
let lineNo = 1;
|
|
939
|
+
for (let i = 0; i < lines.length; i++) {
|
|
940
|
+
if (rule.re.test(lines[i]) || (i + 3 < lines.length && rule.re.test(lines.slice(i, i + 4).join('\n')))) {
|
|
941
|
+
lineNo = i + 1;
|
|
942
|
+
break;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
findings.push({ ruleId: rule.id, file: rel, line: lineNo, message: rule.message });
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
if (jsonMode) {
|
|
950
|
+
out(JSON.stringify({ targetDir: dirArg, scannedFiles: files.length, totalFindings: findings.length, findings }, null, 2));
|
|
951
|
+
return EXIT.OK;
|
|
952
|
+
}
|
|
953
|
+
if (findings.length === 0) {
|
|
954
|
+
out(`artificer scan: 0 legacy findings across ${files.length} file(s)`);
|
|
955
|
+
return EXIT.OK;
|
|
956
|
+
}
|
|
957
|
+
for (const f of findings) {
|
|
958
|
+
out(` ${f.file}:${f.line} [${f.ruleId}] ${f.message}`);
|
|
959
|
+
}
|
|
960
|
+
out(`artificer scan: ${findings.length} finding(s) across ${files.length} file(s)`);
|
|
961
|
+
return EXIT.OK;
|
|
962
|
+
}
|
|
963
|
+
|
|
628
964
|
// ── router ────────────────────────────────────────────────────────────────────
|
|
629
|
-
const COMMANDS = { vendor, lint };
|
|
965
|
+
const COMMANDS = { vendor, lint, search, lookup, scan };
|
|
630
966
|
|
|
631
967
|
export function route({ argv = [], cwd = process.cwd(), packageRoot, out = console.log, err = console.error } = {}) {
|
|
632
968
|
const [cmd, ...rest] = argv;
|
package/bin/lint-core.mjs
CHANGED
|
@@ -112,8 +112,9 @@ export function lintText(text, { fontScale = true, tokens } = {}) {
|
|
|
112
112
|
// custom-property DEFINITIONS are where raw values belong — skip
|
|
113
113
|
if (/^\s*--[\w-]+\s*:/.test(scan)) return;
|
|
114
114
|
|
|
115
|
-
// raw hex in a value (declarations only)
|
|
116
|
-
|
|
115
|
+
// raw hex in a value (declarations only). Skip mask/mask-image declarations
|
|
116
|
+
// where #000/#fff are alpha-channel mask stops, not visual colors (#584).
|
|
117
|
+
if (scan.includes(':') && !/(?:^|[{;\s])(?:-webkit-)?mask(?:-image)?\s*:/.test(scan)) {
|
|
117
118
|
const hex = scan.slice(scan.indexOf(':') + 1).match(HEX);
|
|
118
119
|
if (hex) out.push({ n: i + 1, msg: `raw hex ${hex[0]} → define/use a color token`, src: line.trim() });
|
|
119
120
|
}
|
package/dist/react/chrome.d.ts
CHANGED
|
@@ -22,14 +22,18 @@ export declare function useThemeMode(): {
|
|
|
22
22
|
theme: 'dark' | 'light';
|
|
23
23
|
toggle: () => void;
|
|
24
24
|
};
|
|
25
|
-
export declare function AppShell({ rail, gap, className, style, ...rest }: React.HTMLAttributes<HTMLDivElement> & {
|
|
25
|
+
export declare function AppShell({ rail, gap, contained, className, style, ...rest }: React.HTMLAttributes<HTMLDivElement> & {
|
|
26
26
|
/** Rail column width — sets --shell-rail (default 240px). */
|
|
27
27
|
rail?: string;
|
|
28
28
|
/** Rail↔content column gap — sets --shell-gap (default 0). */
|
|
29
29
|
gap?: string;
|
|
30
|
+
/** Drop the 100dvh floor when nested inside an outer .container (#532). */
|
|
31
|
+
contained?: boolean;
|
|
30
32
|
}): React.JSX.Element;
|
|
31
|
-
export declare function AppShellContent({ as: As, className, ...rest }: React.HTMLAttributes<HTMLElement> & {
|
|
33
|
+
export declare function AppShellContent({ as: As, flush, className, ...rest }: React.HTMLAttributes<HTMLElement> & {
|
|
32
34
|
as?: React.ElementType;
|
|
35
|
+
/** Zero the bleed-grid inline gutter when an outer .container supplies it (#532). */
|
|
36
|
+
flush?: boolean;
|
|
33
37
|
}): React.JSX.Element;
|
|
34
38
|
export declare function Appbar({ brand, brandHref, brandWhimsy, contained, sticky, search, actions, menu, className, children, ...rest }: React.HTMLAttributes<HTMLElement> & {
|
|
35
39
|
/** Brand text/node — rendered inside the canonical `.appbar__brand > .wordmark` composition. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chrome.d.ts","sourceRoot":"","sources":["../../framework-adapters/react/src/chrome.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkB/B,wBAAgB,WAAW,CAAC,EAC1B,MAAc,EACd,SAAS,EACT,GAAG,IAAI,EACR,EAAE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,qBAUtE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI;IAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,CAe9E;AAID,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,GAAG,EACH,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG;IACxC,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"chrome.d.ts","sourceRoot":"","sources":["../../framework-adapters/react/src/chrome.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkB/B,wBAAgB,WAAW,CAAC,EAC1B,MAAc,EACd,SAAS,EACT,GAAG,IAAI,EACR,EAAE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,qBAUtE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI;IAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,CAe9E;AAID,wBAAgB,QAAQ,CAAC,EACvB,IAAI,E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AC;CAC1B,qBA4FA;AAED,qEAAqE;AACrE,wBAAgB,aAAa,CAAC,EAC5B,KAAe,EACf,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAOpE"}
|
package/dist/react/chrome.js
CHANGED
|
@@ -40,16 +40,16 @@ export function useThemeMode() {
|
|
|
40
40
|
return { theme, toggle };
|
|
41
41
|
}
|
|
42
42
|
// ─── AppShell ────────────────────────────────────────────────────────────
|
|
43
|
-
export function AppShell({ rail, gap, className, style, ...rest }) {
|
|
43
|
+
export function AppShell({ rail, gap, contained = false, className, style, ...rest }) {
|
|
44
44
|
const vars = {};
|
|
45
45
|
if (rail)
|
|
46
46
|
vars['--shell-rail'] = rail;
|
|
47
47
|
if (gap)
|
|
48
48
|
vars['--shell-gap'] = gap;
|
|
49
|
-
return (_jsx("div", { ...rest, style: { ...vars, ...style }, className: cx('app-shell', className) }));
|
|
49
|
+
return (_jsx("div", { ...rest, style: { ...vars, ...style }, className: cx('app-shell', contained && 'app-shell--contained', className) }));
|
|
50
50
|
}
|
|
51
|
-
export function AppShellContent({ as: As = 'main', className, ...rest }) {
|
|
52
|
-
return _jsx(As, { ...rest, className: cx('app-shell__content', className) });
|
|
51
|
+
export function AppShellContent({ as: As = 'main', flush = false, className, ...rest }) {
|
|
52
|
+
return _jsx(As, { ...rest, className: cx('app-shell__content', flush && 'app-shell__content--flush', className) });
|
|
53
53
|
}
|
|
54
54
|
// ─── Appbar ──────────────────────────────────────────────────────────────
|
|
55
55
|
export function Appbar({ brand, brandHref = '/', brandWhimsy = false, contained = false, sticky = true, search, actions, menu, className, children, ...rest }) {
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export { cx, safeHref, Stack, Cluster, Container, GridAuto, Button, Field, Input, Textarea, Select, Notification, Modal, Icon, useIcons, useWhimsy, } from './primitives.js';
|
|
1
|
+
export { cx, safeHref, Stack, Cluster, Container, GridAuto, Button, Field, Input, Textarea, Select, Notification, Alert, ButtonGroup, ListGroup, ListGroupItem, Modal, Icon, useIcons, useWhimsy, } from './primitives.js';
|
|
2
|
+
export type { AlertTier } from './primitives.js';
|
|
3
|
+
export { Tabs, Listbox, Menu, Tree } from './interactive.js';
|
|
4
|
+
export type { TabItem, OptionItem, TreeNode } from './interactive.js';
|
|
2
5
|
export { ThemeToggle, useThemeMode, AppShell, AppShellContent, Appbar, NavDrawer, SideNav, SideNavFooter, } from './chrome.js';
|
|
3
6
|
export type { SideNavItem, SideNavGroup } from './chrome.js';
|
|
4
7
|
export { defaultSectionOpen, onNavigationActivates, onUserToggle, onViewportChange, } from './sidenav-sections.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../framework-adapters/react/src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,EAAE,EACF,QAAQ,EACR,KAAK,EACL,OAAO,EACP,SAAS,EACT,QAAQ,EACR,MAAM,EACN,KAAK,EACL,KAAK,EACL,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,SAAS,GACV,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../framework-adapters/react/src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,EAAE,EACF,QAAQ,EACR,KAAK,EACL,OAAO,EACP,SAAS,EACT,QAAQ,EACR,MAAM,EACN,KAAK,EACL,KAAK,EACL,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,KAAK,EACL,WAAW,EACX,SAAS,EACT,aAAa,EACb,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7D,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EACL,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,MAAM,EACN,SAAS,EACT,OAAO,EACP,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/react/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @cameronsjo/artificer/react — React adapter, compiled to dist/react.
|
|
2
2
|
// Primitives emit canonical classes; chrome components single-source the app
|
|
3
3
|
// shell; behavior stays in the vanilla modules (theme/focus/icons).
|
|
4
|
-
export { cx, safeHref, Stack, Cluster, Container, GridAuto, Button, Field, Input, Textarea, Select, Notification, Modal, Icon, useIcons, useWhimsy, } from './primitives.js';
|
|
4
|
+
export { cx, safeHref, Stack, Cluster, Container, GridAuto, Button, Field, Input, Textarea, Select, Notification, Alert, ButtonGroup, ListGroup, ListGroupItem, Modal, Icon, useIcons, useWhimsy, } from './primitives.js';
|
|
5
|
+
export { Tabs, Listbox, Menu, Tree } from './interactive.js';
|
|
5
6
|
export { ThemeToggle, useThemeMode, AppShell, AppShellContent, Appbar, NavDrawer, SideNav, SideNavFooter, } from './chrome.js';
|
|
6
7
|
export { defaultSectionOpen, onNavigationActivates, onUserToggle, onViewportChange, } from './sidenav-sections.js';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive React wrappers wired to Artificer's pure keyboard state machines
|
|
3
|
+
* (ArtificerTabs.nextIndex, ArtificerOptions.nextOption/matchOption,
|
|
4
|
+
* ArtificerTree.nextVisible/treeAction). React owns the DOM; the vanilla
|
|
5
|
+
* modules own the WAI-ARIA APG keyboard math (with inline fallback when the
|
|
6
|
+
* module script hasn't attached to window yet).
|
|
7
|
+
*/
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
export interface TabItem {
|
|
10
|
+
id: string;
|
|
11
|
+
label: React.ReactNode;
|
|
12
|
+
content: React.ReactNode;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function Tabs({ items, selectedId, defaultSelectedId, onSelect, orientation, label, className, }: {
|
|
16
|
+
items: TabItem[];
|
|
17
|
+
selectedId?: string;
|
|
18
|
+
defaultSelectedId?: string;
|
|
19
|
+
onSelect?: (id: string) => void;
|
|
20
|
+
orientation?: 'horizontal' | 'vertical';
|
|
21
|
+
label: string;
|
|
22
|
+
className?: string;
|
|
23
|
+
}): React.JSX.Element;
|
|
24
|
+
export interface OptionItem {
|
|
25
|
+
id: string;
|
|
26
|
+
label: string;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
danger?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare function Listbox({ items, selectedId, onSelect, variant, label, className, }: {
|
|
31
|
+
items: OptionItem[];
|
|
32
|
+
selectedId?: string;
|
|
33
|
+
onSelect?: (item: OptionItem) => void;
|
|
34
|
+
variant?: 'listbox' | 'menu';
|
|
35
|
+
label: string;
|
|
36
|
+
className?: string;
|
|
37
|
+
}): React.JSX.Element;
|
|
38
|
+
export declare function Menu(props: Omit<React.ComponentProps<typeof Listbox>, 'variant'>): React.JSX.Element;
|
|
39
|
+
export interface TreeNode {
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
children?: TreeNode[];
|
|
43
|
+
}
|
|
44
|
+
export declare function Tree({ nodes, selectedId, defaultExpandedIds, onSelect, label, className, }: {
|
|
45
|
+
nodes: TreeNode[];
|
|
46
|
+
selectedId?: string;
|
|
47
|
+
defaultExpandedIds?: string[];
|
|
48
|
+
onSelect?: (node: TreeNode) => void;
|
|
49
|
+
label: string;
|
|
50
|
+
className?: string;
|
|
51
|
+
}): React.JSX.Element;
|
|
52
|
+
//# sourceMappingURL=interactive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../../framework-adapters/react/src/interactive.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,IAAI,CAAC,EACnB,KAAK,EACL,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,WAA0B,EAC1B,KAAK,EACL,SAAc,GACf,EAAE;IACD,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,qBA0EA;AAeD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,UAAU,EACV,QAAQ,EACR,OAAmB,EACnB,KAAK,EACL,SAAc,GACf,EAAE;IAC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