@cameronsjo/artificer 0.22.1 → 0.24.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 +21 -11
- package/package.json +43 -8
- package/reference/SKILL.md +23 -9
- package/src/artificer-editorial.css +4 -4
- package/src/artificer-whimsy.js +47 -9
- package/src/artificer.css +407 -88
- package/src/primitives.json +134 -20
- package/src/tokens.json +4 -2
- package/types/focus.d.ts +17 -0
- package/types/icons.d.ts +23 -0
- package/types/options.d.ts +33 -0
- package/types/tabs.d.ts +26 -0
- package/types/theme.d.ts +28 -0
- package/types/tree.d.ts +31 -0
- package/types/whimsy.d.ts +47 -0
- package/src/assets/fonts/ia-writer-quattro-400-italic.woff2 +0 -0
- package/src/assets/fonts/ia-writer-quattro-400.woff2 +0 -0
- package/src/assets/fonts/ia-writer-quattro-700-italic.woff2 +0 -0
- package/src/assets/fonts/ia-writer-quattro-700.woff2 +0 -0
package/src/primitives.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schemaVersion": "1",
|
|
3
|
-
"$version": "0.
|
|
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.",
|
|
3
|
+
"$version": "0.24.0",
|
|
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": {
|
|
7
7
|
"kind": "utility",
|
|
@@ -180,7 +180,15 @@
|
|
|
180
180
|
"app-shell",
|
|
181
181
|
"app-shell__content"
|
|
182
182
|
],
|
|
183
|
-
"recipe": "App shell / full-viewport layout"
|
|
183
|
+
"recipe": "App shell / full-viewport layout",
|
|
184
|
+
"variants": [
|
|
185
|
+
{
|
|
186
|
+
"class": "app-shell",
|
|
187
|
+
"minted": "0.24.0",
|
|
188
|
+
"note": "knobs, not overrides: --shell-rail (rail width, 240px default) and --shell-gap (rail-to-content column gap, 0 default) — consumers tune the grid via custom properties instead of redefining grid-template-columns"
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
"react": "AppShell + AppShellContent"
|
|
184
192
|
},
|
|
185
193
|
"appbar": {
|
|
186
194
|
"kind": "component",
|
|
@@ -193,7 +201,8 @@
|
|
|
193
201
|
"appbar__search",
|
|
194
202
|
"appbar__spacer"
|
|
195
203
|
],
|
|
196
|
-
"recipe": "Top app bar"
|
|
204
|
+
"recipe": "Top app bar",
|
|
205
|
+
"react": "Appbar"
|
|
197
206
|
},
|
|
198
207
|
"sidenav": {
|
|
199
208
|
"kind": "component",
|
|
@@ -201,10 +210,31 @@
|
|
|
201
210
|
"classes": [
|
|
202
211
|
"sidenav",
|
|
203
212
|
"sidenav__group",
|
|
213
|
+
"sidenav__section",
|
|
214
|
+
"sidenav__footer",
|
|
215
|
+
"sidenav--sticky",
|
|
204
216
|
"label",
|
|
205
217
|
"count"
|
|
206
218
|
],
|
|
207
|
-
"recipe": "Side navigation"
|
|
219
|
+
"recipe": "Side navigation",
|
|
220
|
+
"variants": [
|
|
221
|
+
{
|
|
222
|
+
"class": "sidenav--sticky",
|
|
223
|
+
"minted": "0.24.0",
|
|
224
|
+
"note": "sticky rail — pins the sidenav while .app-shell__content scrolls; align-self:start is load-bearing (a stretch child has nowhere to stick); --sidenav-sticky-top clears sticky chrome above. Replaces consumer-invented sticky wrapper asides"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"class": "sidenav__section",
|
|
228
|
+
"minted": "0.23.0",
|
|
229
|
+
"note": "collapsible group — <details class=\"sidenav__section\"> whose <summary> carries the group-label treatment + twisty; rows keep full sidenav styling. The section holding [aria-current=\"page\"] must be rendered open (consumer JS owns the open attribute); sticky group labels deliberately don't apply inside <details>"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"class": "sidenav__footer",
|
|
233
|
+
"minted": "0.23.0",
|
|
234
|
+
"note": "bottom-anchored settings row (margin-top:auto in the min-height:100% drawer sidenav) — the theme toggle's drawer seat; pairs a text label with a canonical .theme-toggle--inline [data-theme-toggle] button"
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
"react": "SideNav + SideNavFooter"
|
|
208
238
|
},
|
|
209
239
|
"nav-drawer": {
|
|
210
240
|
"kind": "component",
|
|
@@ -213,7 +243,8 @@
|
|
|
213
243
|
"nav-drawer",
|
|
214
244
|
"nav-scrim"
|
|
215
245
|
],
|
|
216
|
-
"recipe": "Mobile nav drawer"
|
|
246
|
+
"recipe": "Mobile nav drawer",
|
|
247
|
+
"react": "NavDrawer"
|
|
217
248
|
},
|
|
218
249
|
"crumb": {
|
|
219
250
|
"kind": "component",
|
|
@@ -262,12 +293,12 @@
|
|
|
262
293
|
"classes": [
|
|
263
294
|
"glyph"
|
|
264
295
|
],
|
|
265
|
-
"recipe": "Dense table status /
|
|
296
|
+
"recipe": "Dense table status / ✓✗~– cells",
|
|
266
297
|
"adoption": {
|
|
267
298
|
"supersedes": "raw emoji / hand-tinted spans in comparison grids",
|
|
268
299
|
"signals": [
|
|
269
300
|
{
|
|
270
|
-
"grep": "[
|
|
301
|
+
"grep": "[✓✗~]</(td|span)",
|
|
271
302
|
"note": "bare status marks without .glyph tinting or role=img"
|
|
272
303
|
}
|
|
273
304
|
]
|
|
@@ -470,7 +501,7 @@
|
|
|
470
501
|
"signals": [
|
|
471
502
|
{
|
|
472
503
|
"grep": "role=\"tablist\"",
|
|
473
|
-
"note": "ARIA tablist without ArtificerTabs.enhance()
|
|
504
|
+
"note": "ARIA tablist without ArtificerTabs.enhance() — the CSS alone is style-only"
|
|
474
505
|
}
|
|
475
506
|
]
|
|
476
507
|
}
|
|
@@ -509,7 +540,8 @@
|
|
|
509
540
|
"tree__group",
|
|
510
541
|
"tree__row",
|
|
511
542
|
"tree__twisty",
|
|
512
|
-
"tree__leaf"
|
|
543
|
+
"tree__leaf",
|
|
544
|
+
"tree--static"
|
|
513
545
|
],
|
|
514
546
|
"js": {
|
|
515
547
|
"module": "artificer-tree.js",
|
|
@@ -518,6 +550,12 @@
|
|
|
518
550
|
},
|
|
519
551
|
"recipe": "Tree / file explorer / nested nav",
|
|
520
552
|
"demo": "live-spec/components-extended.html#tree",
|
|
553
|
+
"variants": [
|
|
554
|
+
{
|
|
555
|
+
"class": "tree--static",
|
|
556
|
+
"note": "native <details>/<summary> disclosure for no-JS/SSR contexts — deliberately not role=\"tree\"; nested disclosure is the honest a11y model here, so ArtificerTree.enhance() stays inert on it"
|
|
557
|
+
}
|
|
558
|
+
],
|
|
521
559
|
"adoption": {
|
|
522
560
|
"supersedes": "hand-rolled nested-list explorers / custom disclosure rows",
|
|
523
561
|
"signals": [
|
|
@@ -584,7 +622,7 @@
|
|
|
584
622
|
"api": "ArtificerOptions.combobox()",
|
|
585
623
|
"hook": "input[data-combobox]"
|
|
586
624
|
},
|
|
587
|
-
"recipe": "Command palette /
|
|
625
|
+
"recipe": "Command palette / ⌘K",
|
|
588
626
|
"demo": "live-spec/components-extended.html"
|
|
589
627
|
},
|
|
590
628
|
"popover": {
|
|
@@ -637,6 +675,21 @@
|
|
|
637
675
|
],
|
|
638
676
|
"recipe": "Split pane / master-detail"
|
|
639
677
|
},
|
|
678
|
+
"workbench": {
|
|
679
|
+
"kind": "component",
|
|
680
|
+
"minted": "0.23.0",
|
|
681
|
+
"classes": [
|
|
682
|
+
"workbench",
|
|
683
|
+
"workbench__pane",
|
|
684
|
+
"workbench__header",
|
|
685
|
+
"workbench__editor"
|
|
686
|
+
],
|
|
687
|
+
"recipe": "Text workbench / editor panes",
|
|
688
|
+
"demo": "live-spec/composition.html#workbench",
|
|
689
|
+
"adoption": {
|
|
690
|
+
"supersedes": "hand-rolled full-height textarea panes"
|
|
691
|
+
}
|
|
692
|
+
},
|
|
640
693
|
"dash": {
|
|
641
694
|
"kind": "component",
|
|
642
695
|
"minted": "0.10.1",
|
|
@@ -688,6 +741,17 @@
|
|
|
688
741
|
"demo": "live-spec/charts.html",
|
|
689
742
|
"recipe": "Chart / sparkline / gauge"
|
|
690
743
|
},
|
|
744
|
+
"bar-meter": {
|
|
745
|
+
"kind": "component",
|
|
746
|
+
"minted": "0.23.0",
|
|
747
|
+
"classes": [
|
|
748
|
+
"bar",
|
|
749
|
+
"bar__track",
|
|
750
|
+
"bar__fill"
|
|
751
|
+
],
|
|
752
|
+
"demo": "live-spec/charts.html",
|
|
753
|
+
"recipe": "Horizontal bar / meter"
|
|
754
|
+
},
|
|
691
755
|
"diagrams": {
|
|
692
756
|
"kind": "component",
|
|
693
757
|
"minted": "0.7.0",
|
|
@@ -703,6 +767,37 @@
|
|
|
703
767
|
"demo": "live-spec/diagrams.html",
|
|
704
768
|
"recipe": "Architecture / flow diagram"
|
|
705
769
|
},
|
|
770
|
+
"diagram-flow": {
|
|
771
|
+
"kind": "component",
|
|
772
|
+
"minted": "0.23.0",
|
|
773
|
+
"classes": [
|
|
774
|
+
"dia-box",
|
|
775
|
+
"dia-box--accent",
|
|
776
|
+
"dia-box--ghost",
|
|
777
|
+
"dia-box--tab",
|
|
778
|
+
"flow",
|
|
779
|
+
"flow-frame",
|
|
780
|
+
"flow-frame__label",
|
|
781
|
+
"flow__link",
|
|
782
|
+
"flow__link--dashed",
|
|
783
|
+
"flow__step"
|
|
784
|
+
],
|
|
785
|
+
"demo": "live-spec/diagrams.html",
|
|
786
|
+
"recipe": "HTML diagram node"
|
|
787
|
+
},
|
|
788
|
+
"spine-phase": {
|
|
789
|
+
"kind": "component",
|
|
790
|
+
"minted": "0.23.0",
|
|
791
|
+
"classes": [
|
|
792
|
+
"spine",
|
|
793
|
+
"phase",
|
|
794
|
+
"phase--accent",
|
|
795
|
+
"phase__body",
|
|
796
|
+
"phase__marker"
|
|
797
|
+
],
|
|
798
|
+
"demo": "live-spec/diagrams.html",
|
|
799
|
+
"recipe": "Phased timeline"
|
|
800
|
+
},
|
|
706
801
|
"syntax": {
|
|
707
802
|
"kind": "component",
|
|
708
803
|
"minted": "0.7.0",
|
|
@@ -897,7 +992,7 @@
|
|
|
897
992
|
},
|
|
898
993
|
"versions": {
|
|
899
994
|
"0.10.1": {
|
|
900
|
-
"title": "v0.10.0 + v0.10.1
|
|
995
|
+
"title": "v0.10.0 + v0.10.1 — navigation wave, SPA lifecycle, brandPurple ramp split (shipped as ONE commit; no consumer was ever on 0.10.0)",
|
|
901
996
|
"minted": [
|
|
902
997
|
"appbar",
|
|
903
998
|
"sidenav",
|
|
@@ -967,7 +1062,7 @@
|
|
|
967
1062
|
]
|
|
968
1063
|
},
|
|
969
1064
|
"0.13.0": {
|
|
970
|
-
"title": "trust layer
|
|
1065
|
+
"title": "trust layer · texture carve · whimsy attention · greeting · brand refresh",
|
|
971
1066
|
"minted": [
|
|
972
1067
|
"figure",
|
|
973
1068
|
"note",
|
|
@@ -981,7 +1076,7 @@
|
|
|
981
1076
|
]
|
|
982
1077
|
},
|
|
983
1078
|
"0.14.0": {
|
|
984
|
-
"title": ".notif primitive
|
|
1079
|
+
"title": ".notif primitive · trust-layer follow-through · gradients · encapsulation doctrine",
|
|
985
1080
|
"minted": [
|
|
986
1081
|
"notif"
|
|
987
1082
|
],
|
|
@@ -991,7 +1086,7 @@
|
|
|
991
1086
|
]
|
|
992
1087
|
},
|
|
993
1088
|
"0.15.0": {
|
|
994
|
-
"title": "A1 conformance gate
|
|
1089
|
+
"title": "A1 conformance gate · the component mints (option-popover keystone + what it unlocks) · loading-feedback",
|
|
995
1090
|
"minted": [
|
|
996
1091
|
"banner",
|
|
997
1092
|
"listbox",
|
|
@@ -1015,7 +1110,7 @@
|
|
|
1015
1110
|
]
|
|
1016
1111
|
},
|
|
1017
1112
|
"0.16.0": {
|
|
1018
|
-
"title": "behavior modules (ArtificerOptions / ArtificerTree)
|
|
1113
|
+
"title": "behavior modules (ArtificerOptions / ArtificerTree) · a11y floor · export gate",
|
|
1019
1114
|
"minted": [],
|
|
1020
1115
|
"breaking": [],
|
|
1021
1116
|
"adoption": [
|
|
@@ -1026,7 +1121,7 @@
|
|
|
1026
1121
|
]
|
|
1027
1122
|
},
|
|
1028
1123
|
"0.17.0": {
|
|
1029
|
-
"title": "the fix wave: gates grow contracts
|
|
1124
|
+
"title": "the fix wave: gates grow contracts · --radius-pill · canonical chrome",
|
|
1030
1125
|
"minted": [],
|
|
1031
1126
|
"breaking": [],
|
|
1032
1127
|
"adoption": []
|
|
@@ -1039,7 +1134,7 @@
|
|
|
1039
1134
|
"kind": "repurpose",
|
|
1040
1135
|
"what": "root font-size + every --t-*-size binding",
|
|
1041
1136
|
"from": "root silently 87.5% (labels rendered at ~0.875x)",
|
|
1042
|
-
"to": "html { font-size: 100% }
|
|
1137
|
+
"to": "html { font-size: 100% } — labels true",
|
|
1043
1138
|
"why": "everything token-bound grows ~14.3% (body 12.25 -> 14px); re-check dense layouts and any px assumptions",
|
|
1044
1139
|
"ref": "#211"
|
|
1045
1140
|
}
|
|
@@ -1053,7 +1148,7 @@
|
|
|
1053
1148
|
"adoption": []
|
|
1054
1149
|
},
|
|
1055
1150
|
"0.19.0": {
|
|
1056
|
-
"title": "Lane 2 unification (one version, one rhythm)
|
|
1151
|
+
"title": "Lane 2 unification (one version, one rhythm) · .glyph anti-emoji mint · terminalBg elevation (ADR 0036, terminal themes)",
|
|
1057
1152
|
"minted": [
|
|
1058
1153
|
"glyph"
|
|
1059
1154
|
],
|
|
@@ -1089,12 +1184,31 @@
|
|
|
1089
1184
|
]
|
|
1090
1185
|
},
|
|
1091
1186
|
"0.22.1": {
|
|
1092
|
-
"title": "btn--link: an action that reads as text
|
|
1187
|
+
"title": "btn--link: an action that reads as text — the missing way to render a <button> as a link, and the reason the colophon spine had to special-case buttons",
|
|
1093
1188
|
"minted": [],
|
|
1094
1189
|
"breaking": [],
|
|
1095
1190
|
"adoption": [
|
|
1096
1191
|
"btn"
|
|
1097
1192
|
]
|
|
1193
|
+
},
|
|
1194
|
+
"0.24.0": {
|
|
1195
|
+
"title": "chrome components: the compiled React adapter (@cameronsjo/artificer/react) single-sources the app shell; ambient d.ts for the vanilla modules; app-shell knobs + sticky rail",
|
|
1196
|
+
"minted": [],
|
|
1197
|
+
"breaking": [
|
|
1198
|
+
{
|
|
1199
|
+
"kind": "remove",
|
|
1200
|
+
"what": "useTheme React hook (framework-adapters/react-components.tsx, copy-consumed only — never npm-imported)",
|
|
1201
|
+
"from": "2-state dark/light hook duplicating the module's persistence",
|
|
1202
|
+
"to": "canonical <ThemeToggle /> (artificer-theme.js owns state) + useThemeMode() for reactive reads",
|
|
1203
|
+
"why": "the hook predated the 3-state canonical cycle and desynced from module-owned toggles"
|
|
1204
|
+
}
|
|
1205
|
+
],
|
|
1206
|
+
"adoption": [
|
|
1207
|
+
"appbar",
|
|
1208
|
+
"sidenav",
|
|
1209
|
+
"nav-drawer",
|
|
1210
|
+
"app-shell"
|
|
1211
|
+
]
|
|
1098
1212
|
}
|
|
1099
1213
|
},
|
|
1100
1214
|
"$exempt": []
|
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.24.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.",
|
|
@@ -70,7 +70,9 @@
|
|
|
70
70
|
"typography": {
|
|
71
71
|
"fontFamily": {
|
|
72
72
|
"mono": { "value": "'JetBrains Mono', 'Berkeley Mono', ui-monospace, 'SF Mono', Menlo, monospace", "use": "Code, identifiers, numerals, dense tool body." },
|
|
73
|
-
"
|
|
73
|
+
"body": { "value": "'iA Writer Quattro V', 'Iowan Old Style', 'Charter', 'Source Sans 3', system-ui, -apple-system, sans-serif", "use": "Body prose — document surfaces, headline/body type utilities, .meta." },
|
|
74
|
+
"interface": { "value": "'iA Writer Quattro S', 'Iowan Old Style', 'Charter', 'Source Sans 3', system-ui, -apple-system, sans-serif", "use": "Interface chrome — labels, controls, form fields, nav, tabular UI numerals." },
|
|
75
|
+
"sans": { "value": "'iA Writer Quattro V', 'Iowan Old Style', 'Charter', 'Source Sans 3', system-ui, -apple-system, sans-serif", "use": "Legacy alias of body — kept resolvable for public-API back-compat." }
|
|
74
76
|
},
|
|
75
77
|
"scale": {
|
|
76
78
|
"$note": "Sizes are REM so text honors the browser font-size preference (root is never overridden; 1rem = 16px at default). px equivalents in comments.",
|
package/types/focus.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for artificer-focus.js — the modal/drawer focus trap. Import for
|
|
3
|
+
* effect: `import '@cameronsjo/artificer/focus.js';`
|
|
4
|
+
*/
|
|
5
|
+
export interface ArtificerFocusApi {
|
|
6
|
+
/** Trap focus inside `el` (Tab cycles; focusables recomputed every Tab).
|
|
7
|
+
* `onEscape` fires on Esc; `release()` untraps and restores focus to the
|
|
8
|
+
* previously-focused element. */
|
|
9
|
+
trap(el: Element | null, opts?: { onEscape?: (e: KeyboardEvent) => void }): { release(): void };
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare global {
|
|
13
|
+
interface Window {
|
|
14
|
+
ArtificerFocus?: ArtificerFocusApi;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export {};
|
package/types/icons.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for artificer-icons.js — Lucide-rooted icon hydration for
|
|
3
|
+
* `<i data-icon="name">` placeholders (unknown names render a dashed
|
|
4
|
+
* placeholder, never a silent blank). Import for effect:
|
|
5
|
+
* `import '@cameronsjo/artificer/icons.js';`
|
|
6
|
+
*/
|
|
7
|
+
export interface ArtificerIconsApi {
|
|
8
|
+
/** Build one icon SVG element for `name`, or null for an unknown name. */
|
|
9
|
+
build(name: string): SVGSVGElement | null;
|
|
10
|
+
/** One-shot hydrate of `root` (default document). */
|
|
11
|
+
hydrate(root?: ParentNode | null): void;
|
|
12
|
+
/** Hydrate `root` now and watch for inserted icons (SPA). Returns a disconnect fn. */
|
|
13
|
+
observe(root?: Element | null): () => void;
|
|
14
|
+
/** Canonical icon names. */
|
|
15
|
+
list(): string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare global {
|
|
19
|
+
interface Window {
|
|
20
|
+
ArtificerIcons?: ArtificerIconsApi;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for artificer-options.js — option-navigation behavior for the
|
|
3
|
+
* `.menu`/`.listbox` primitive (roving tabindex or aria-activedescendant).
|
|
4
|
+
* Import for effect: `import '@cameronsjo/artificer/options.js';`
|
|
5
|
+
*/
|
|
6
|
+
export interface ArtificerOptionsApi {
|
|
7
|
+
/** Roving-tabindex keyboard model on a standalone listbox/menu. Returns a teardown fn. */
|
|
8
|
+
enhance(
|
|
9
|
+
el: Element | null,
|
|
10
|
+
opts?: { onSelect?: (index: number, option: Element) => void; wrap?: boolean },
|
|
11
|
+
): () => void;
|
|
12
|
+
/** aria-activedescendant cursor for the palette/combobox recipe; focus stays
|
|
13
|
+
* on the input; printable keys and Escape are never consumed. The handle's
|
|
14
|
+
* refresh() re-reads options after the consumer filters the list. */
|
|
15
|
+
combobox(
|
|
16
|
+
input: HTMLInputElement | null,
|
|
17
|
+
list: Element | null,
|
|
18
|
+
opts?: { onSelect?: (index: number, option: Element) => void },
|
|
19
|
+
): { refresh(): void; teardown(): void };
|
|
20
|
+
/** enhance() every [data-options] / [data-combobox] under `root` (SPA). Returns a disconnect fn. */
|
|
21
|
+
observe(root?: Element | null): () => void;
|
|
22
|
+
/** Pure: next option index for `key` (clamped for listboxes, wrapping for menus), or null. */
|
|
23
|
+
nextOption(key: string, current: number, count: number, opts?: { wrap?: boolean }): number | null;
|
|
24
|
+
/** Pure: type-to-select match — index of the option matching `buffer`, or null. */
|
|
25
|
+
matchOption(labels: string[], buffer: string, current: number): number | null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare global {
|
|
29
|
+
interface Window {
|
|
30
|
+
ArtificerOptions?: ArtificerOptionsApi;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export {};
|
package/types/tabs.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for artificer-tabs.js — the WAI-ARIA tabs behavior for the `.tabs`
|
|
3
|
+
* primitive. Frameworks that own selection state use the pure `nextIndex`
|
|
4
|
+
* only (enhance/observe toggle panels via `hidden`, which fights conditional
|
|
5
|
+
* rendering). Import for effect: `import '@cameronsjo/artificer/tabs.js';`
|
|
6
|
+
*/
|
|
7
|
+
export interface ArtificerTabsApi {
|
|
8
|
+
/** Wire the APG keyboard model onto a tablist element. Returns a teardown fn. */
|
|
9
|
+
enhance(el: Element | null, opts?: { onSelect?: (index: number, tab: Element) => void }): () => void;
|
|
10
|
+
/** enhance() every [data-tabs] under `root` now and as inserted (SPA). Returns a disconnect fn. */
|
|
11
|
+
observe(root?: Element | null): () => void;
|
|
12
|
+
/** Pure state machine: the index focus/selection moves to for `key`, or null when not a tab-nav key. */
|
|
13
|
+
nextIndex(
|
|
14
|
+
key: string,
|
|
15
|
+
current: number,
|
|
16
|
+
count: number,
|
|
17
|
+
opts?: { orientation?: 'horizontal' | 'vertical' },
|
|
18
|
+
): number | null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare global {
|
|
22
|
+
interface Window {
|
|
23
|
+
ArtificerTabs?: ArtificerTabsApi;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export {};
|
package/types/theme.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for artificer-theme.js — a side-effect script that owns theme state:
|
|
3
|
+
* three modes (dark / light / auto), persistence under `ArtificerTheme.KEY`,
|
|
4
|
+
* canonical empty `[data-theme-toggle]` buttons hydrated with the half-circle
|
|
5
|
+
* glyph, all instances kept in sync. Import for effect:
|
|
6
|
+
* import '@cameronsjo/artificer/theme.js';
|
|
7
|
+
*/
|
|
8
|
+
export type ArtificerThemeMode = 'dark' | 'light' | 'auto';
|
|
9
|
+
|
|
10
|
+
export interface ArtificerThemeApi {
|
|
11
|
+
/** Apply + persist a mode ('auto' follows prefers-color-scheme live). */
|
|
12
|
+
apply(mode: ArtificerThemeMode): void;
|
|
13
|
+
/** Cycle dark → light → auto. */
|
|
14
|
+
toggle(): void;
|
|
15
|
+
/** Bind any unbound [data-theme-toggle] buttons now (idempotent). */
|
|
16
|
+
bind(): void;
|
|
17
|
+
/** bind() now, then watch `root` (default body) for inserted toggles. Returns a disconnect fn. */
|
|
18
|
+
observe(root?: Element | null): () => void;
|
|
19
|
+
/** The localStorage key ('artificer.theme') — the ONE source of truth; never re-hardcode it. */
|
|
20
|
+
readonly KEY: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare global {
|
|
24
|
+
interface Window {
|
|
25
|
+
ArtificerTheme?: ArtificerThemeApi;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export {};
|
package/types/tree.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for artificer-tree.js — the APG tree behavior for the `.tree`
|
|
3
|
+
* primitive (inert on `.tree--static` by design). Import for effect:
|
|
4
|
+
* `import '@cameronsjo/artificer/tree.js';`
|
|
5
|
+
*/
|
|
6
|
+
export interface ArtificerTreeApi {
|
|
7
|
+
/** Wire roving tabindex + arrow-key model onto a [role=tree] element. Returns a teardown fn. */
|
|
8
|
+
enhance(
|
|
9
|
+
treeEl: Element | null,
|
|
10
|
+
opts?: {
|
|
11
|
+
onSelect?: (item: Element) => void;
|
|
12
|
+
onToggle?: (item: Element, expanded: boolean) => void;
|
|
13
|
+
},
|
|
14
|
+
): () => void;
|
|
15
|
+
/** enhance() every [data-tree] under `root` (SPA). Returns a disconnect fn. */
|
|
16
|
+
observe(root?: Element | null): () => void;
|
|
17
|
+
/** Pure: next visible item index for `key` (a tree never wraps), or null. */
|
|
18
|
+
nextVisible(key: string, current: number, count: number): number | null;
|
|
19
|
+
/** Pure: the action for `key` given item state — expand / collapse / activate / move, or null. */
|
|
20
|
+
treeAction(
|
|
21
|
+
key: string,
|
|
22
|
+
state: { expanded?: boolean; isParent?: boolean },
|
|
23
|
+
): string | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare global {
|
|
27
|
+
interface Window {
|
|
28
|
+
ArtificerTree?: ArtificerTreeApi;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for artificer-whimsy.js — the sanctioned whimsy layer (burnished
|
|
3
|
+
* sine-wave rainbow; opt-in, settles, reduced-motion-safe). Import for
|
|
4
|
+
* effect: `import '@cameronsjo/artificer/whimsy.js';`
|
|
5
|
+
*/
|
|
6
|
+
export interface WhimsyApi {
|
|
7
|
+
/** Split [data-whimsy~="wave"] elements under `root` into bobbing chars. */
|
|
8
|
+
hydrate(root?: ParentNode | null): void;
|
|
9
|
+
/** hydrate() now and watch `root` for inserted whimsy nodes (SPA). Returns a disconnect fn. */
|
|
10
|
+
observe(root?: Element | null): () => void;
|
|
11
|
+
/** Ignite a target when a trigger word is typed into `input`. Returns a teardown fn. */
|
|
12
|
+
watch(
|
|
13
|
+
input: HTMLElement | null,
|
|
14
|
+
opts?: { triggers?: string[]; target?: Element | null; loops?: number; settle?: 'static' | 'glacial' },
|
|
15
|
+
): () => void;
|
|
16
|
+
/** One-shot celebration — auto-clears. */
|
|
17
|
+
celebrate(el: Element | null, opts?: number | { ms?: number }): void;
|
|
18
|
+
/** Dissolve treatment (fade-through-whimsy) for a leaving element. */
|
|
19
|
+
dissolve(el: Element | null, opts?: Record<string, unknown>): void;
|
|
20
|
+
/** Pure: the dissolve keyframe timeline for `opts` under a reduced-motion flag. */
|
|
21
|
+
dissolveTimeline(opts?: Record<string, unknown>, reducedMotion?: boolean): unknown;
|
|
22
|
+
/** Pure: parse a CSS duration string to milliseconds (NaN for invalid input). */
|
|
23
|
+
parseMs(value: string | null | undefined): number;
|
|
24
|
+
/** Swap [data-whimsy-greeting] elements under `root` to their seasonal line (idempotent). */
|
|
25
|
+
greeting(root?: ParentNode): void;
|
|
26
|
+
/** Pure: the greeting line + class set for a date. */
|
|
27
|
+
greetingFor(date?: Date | null, opts?: { default?: string; defaultClass?: string }): unknown;
|
|
28
|
+
/** Ignite, then settle after N hue-cycles. Returns a cancel fn. */
|
|
29
|
+
run(el: Element | null, opts?: { loops?: number; settle?: 'static' | 'glacial' }): () => void;
|
|
30
|
+
/** Freeze long-lived whimsy: 'static' (motion off) or 'glacial' (one slow drift). */
|
|
31
|
+
settle(el: Element | null, mode?: 'static' | 'glacial'): void;
|
|
32
|
+
/** Undo a settle. */
|
|
33
|
+
unsettle(el: Element | null): void;
|
|
34
|
+
/** Arrange a settle after `loops` hue-cycles. */
|
|
35
|
+
scheduleSettle(el: Element | null, loops?: number, mode?: 'static' | 'glacial'): void;
|
|
36
|
+
/** Manually add the flowing-gradient state. */
|
|
37
|
+
ignite(el: Element | null): void;
|
|
38
|
+
/** Manually remove the flowing-gradient state. */
|
|
39
|
+
clear(el: Element | null): void;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare global {
|
|
43
|
+
interface Window {
|
|
44
|
+
Whimsy?: WhimsyApi;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|