aktion-runtime 0.5.9 → 0.5.11

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.
Files changed (60) hide show
  1. package/README.md +216 -36
  2. package/dist/aktion.iife.js +920 -144
  3. package/dist/aktion.iife.js.map +1 -1
  4. package/dist/aktion.js +17025 -10815
  5. package/dist/aktion.js.map +1 -1
  6. package/dist/aktion.umd.cjs +920 -144
  7. package/dist/aktion.umd.cjs.map +1 -1
  8. package/dist/devtools.js +554 -20
  9. package/dist/devtools.js.map +1 -1
  10. package/dist/language.js +7042 -2455
  11. package/dist/language.js.map +1 -1
  12. package/dist/plugin.cjs +2 -2
  13. package/dist/plugin.cjs.map +1 -1
  14. package/dist/plugin.js +2 -2
  15. package/dist/plugin.js.map +1 -1
  16. package/dist/system_prompt.txt +292 -41
  17. package/dist/system_prompt_chat.txt +14 -14
  18. package/dist/testing.js +16223 -7977
  19. package/dist/testing.js.map +1 -1
  20. package/dist/types/devtools/panel.d.ts +32 -0
  21. package/dist/types/devtools/styles.d.ts +1 -1
  22. package/dist/types/element.d.ts +26 -0
  23. package/dist/types/icons/index.d.ts +10 -0
  24. package/dist/types/library/components/_internal.d.ts +18 -0
  25. package/dist/types/library/components/a11y.d.ts +5 -0
  26. package/dist/types/library/components/canvas.d.ts +3 -0
  27. package/dist/types/library/components/extras.d.ts +15 -0
  28. package/dist/types/library/components/feedback.d.ts +1 -0
  29. package/dist/types/library/components/forms-shared.d.ts +55 -0
  30. package/dist/types/library/components/layout-motion.d.ts +14 -0
  31. package/dist/types/library/components/layout.d.ts +1 -0
  32. package/dist/types/library/components/marketing.d.ts +35 -0
  33. package/dist/types/library/components/new-components.d.ts +1 -0
  34. package/dist/types/library/components/scheduling.d.ts +2 -0
  35. package/dist/types/library/components/wave3.d.ts +6 -0
  36. package/dist/types/library/highlight.d.ts +21 -0
  37. package/dist/types/library/qr.d.ts +12 -0
  38. package/dist/types/library/responsive-style.d.ts +51 -0
  39. package/dist/types/library/sx.d.ts +51 -0
  40. package/dist/types/library/types.d.ts +50 -0
  41. package/dist/types/library/utils.d.ts +28 -0
  42. package/dist/types/library/validate.d.ts +2 -2
  43. package/dist/types/runtime/env.d.ts +33 -0
  44. package/dist/types/runtime/evaluator.d.ts +38 -0
  45. package/dist/types/runtime/http.d.ts +37 -1
  46. package/dist/types/runtime/index.d.ts +2 -0
  47. package/dist/types/runtime/namespaces-extra.d.ts +73 -0
  48. package/dist/types/runtime/realtime.d.ts +46 -0
  49. package/dist/types/runtime/router.d.ts +42 -4
  50. package/dist/types/runtime/ssr.d.ts +29 -0
  51. package/dist/types/runtime/util.d.ts +65 -0
  52. package/dist/types/testing/index.d.ts +35 -0
  53. package/dist/types/theme/fonts.d.ts +30 -0
  54. package/dist/types/theme/index.d.ts +31 -0
  55. package/dist/types/theme/styles.d.ts +1 -1
  56. package/dist/types/tooling/html-import.d.ts +19 -0
  57. package/dist/types/tooling/index.d.ts +3 -0
  58. package/dist/types/tooling/schema.d.ts +58 -0
  59. package/dist/types/tooling/signature-help.d.ts +35 -0
  60. package/package.json +1 -1
@@ -7,6 +7,8 @@ interface AppModel {
7
7
  state: Record<string, unknown>;
8
8
  /** Atom (root) → timestamp of last change, for flash highlighting. */
9
9
  changed: Map<string, number>;
10
+ /** Atom (root) → number of flushes that changed it (reactivity heat). */
11
+ changeCounts: Map<string, number>;
10
12
  /** Timestamp of the first observed event (timeline zero). */
11
13
  firstTime: number | null;
12
14
  }
@@ -22,9 +24,15 @@ export declare class AktionDevtoolsElement extends HTMLElement {
22
24
  private stateFilter;
23
25
  private expanded;
24
26
  private editingPath;
27
+ /** Sort atoms by change frequency (reactivity heat) instead of name. */
28
+ private stateSortByActivity;
25
29
  private selectedCommitId;
26
30
  private flashOnCommit;
31
+ /** Sort key + direction for the ranked-components table. */
32
+ private rankedSort;
27
33
  private phaseFilter;
34
+ /** Group the effect timeline into per-effect lanes vs. a flat log. */
35
+ private effectView;
28
36
  private collapsed;
29
37
  private renderScheduled;
30
38
  private flashTimer;
@@ -63,10 +71,34 @@ export declare class AktionDevtoolsElement extends HTMLElement {
63
71
  private appendRow;
64
72
  private beginEdit;
65
73
  private renderProfilerTab;
74
+ /** A compact grid of headline performance numbers for the session. */
75
+ private renderPerfSummary;
76
+ /**
77
+ * Reactivity insight: which `$state` paths triggered the most commits.
78
+ * Surfaces the "hot" atoms driving re-renders so an author can see what
79
+ * their UI actually reacts to.
80
+ */
81
+ private renderHotAtoms;
82
+ /**
83
+ * Heuristic insights: surface likely performance problems derived from the
84
+ * captured commits (frequent re-renders, heavy bodies, low memoization).
85
+ */
86
+ private renderProfilerInsights;
66
87
  private renderCommitDetail;
67
88
  private renderFlameRow;
68
89
  private renderRankedComponents;
69
90
  private renderEffectsTab;
91
+ /** Headline counters for the effect session. */
92
+ private renderEffectSummary;
93
+ /** Re-run thrash + error detection for effects. */
94
+ private renderEffectInsights;
95
+ /**
96
+ * A visual, time-positioned timeline: one lane per effect, with a marker
97
+ * for every event placed along a shared time axis and coloured by phase.
98
+ * Makes overlapping runs, cleanup→run pairing, and bursts obvious at a
99
+ * glance in a way the chronological log can't.
100
+ */
101
+ private renderEffectTimeline;
70
102
  private renderEffectLanes;
71
103
  private renderEffectLog;
72
104
  private flashApp;
@@ -4,4 +4,4 @@
4
4
  * inspected `<aktion-app>` — the inspector can never be restyled by the app
5
5
  * it is inspecting, and vice versa.
6
6
  */
7
- export declare const devtoolsStyles = "\n:host {\n --dt-bg: #16181d;\n --dt-bg-raised: #1d2026;\n --dt-bg-inset: #101216;\n --dt-border: #2b2f38;\n --dt-border-strong: #3a3f4b;\n --dt-text: #e6e8ec;\n --dt-text-dim: #9aa0ab;\n --dt-text-faint: #6b7280;\n --dt-accent: #7c9cff;\n --dt-accent-soft: #2a3357;\n --dt-green: #5ad19b;\n --dt-blue: #6aa6ff;\n --dt-amber: #f0b35e;\n --dt-grey: #5b626f;\n --dt-red: #f87171;\n --dt-purple: #c08cf0;\n --dt-mono: ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, monospace;\n --dt-sans: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n all: initial;\n position: fixed;\n z-index: 2147483000;\n font-family: var(--dt-sans);\n color: var(--dt-text);\n contain: layout style;\n}\n:host([hidden]) { display: none; }\n\n*, *::before, *::after { box-sizing: border-box; }\n\n.panel {\n display: flex;\n flex-direction: column;\n width: 480px;\n height: 560px;\n max-width: 96vw;\n max-height: 92vh;\n background: var(--dt-bg);\n border: 1px solid var(--dt-border-strong);\n border-radius: 12px;\n box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);\n overflow: hidden;\n font-size: 12px;\n line-height: 1.45;\n}\n.panel.is-collapsed { height: auto !important; }\n.panel.is-collapsed .panel-body,\n.panel.is-collapsed .tabs { display: none; }\n\n/* ---- Header ---- */\n.header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 10px;\n background: var(--dt-bg-raised);\n border-bottom: 1px solid var(--dt-border);\n cursor: grab;\n user-select: none;\n}\n.header.is-dragging { cursor: grabbing; }\n.brand {\n display: flex;\n align-items: center;\n gap: 6px;\n font-weight: 700;\n font-size: 12px;\n letter-spacing: 0.2px;\n white-space: nowrap;\n}\n.brand .bolt { color: var(--dt-accent); font-size: 13px; }\n.brand .ver { color: var(--dt-text-faint); font-weight: 500; font-size: 10px; }\n.header .spacer { flex: 1; }\n\n.app-select {\n appearance: none;\n background: var(--dt-bg-inset);\n color: var(--dt-text);\n border: 1px solid var(--dt-border);\n border-radius: 6px;\n padding: 3px 22px 3px 8px;\n font-size: 11px;\n font-family: var(--dt-sans);\n max-width: 150px;\n cursor: pointer;\n background-image: url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 3.5 5 6.5 8 3.5' stroke='%239aa0ab' fill='none' stroke-width='1.4'/></svg>\");\n background-repeat: no-repeat;\n background-position: right 6px center;\n}\n.app-select:focus { outline: none; border-color: var(--dt-accent); }\n\n.icon-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n height: 24px;\n min-width: 24px;\n padding: 0 6px;\n background: var(--dt-bg-inset);\n color: var(--dt-text-dim);\n border: 1px solid var(--dt-border);\n border-radius: 6px;\n font-size: 11px;\n cursor: pointer;\n font-family: var(--dt-sans);\n}\n.icon-btn:hover { color: var(--dt-text); border-color: var(--dt-border-strong); }\n.icon-btn.is-on { color: var(--dt-text); border-color: var(--dt-accent); }\n.rec-dot {\n width: 8px; height: 8px; border-radius: 50%;\n background: var(--dt-red);\n}\n.rec-dot.is-paused { background: var(--dt-text-faint); }\n\n/* ---- Tabs ---- */\n.tabs {\n display: flex;\n gap: 2px;\n padding: 6px 8px 0;\n background: var(--dt-bg-raised);\n border-bottom: 1px solid var(--dt-border);\n}\n.tab {\n appearance: none;\n background: transparent;\n border: none;\n border-bottom: 2px solid transparent;\n color: var(--dt-text-dim);\n padding: 6px 12px 8px;\n font-size: 12px;\n font-family: var(--dt-sans);\n cursor: pointer;\n border-radius: 6px 6px 0 0;\n}\n.tab:hover { color: var(--dt-text); background: rgba(255,255,255,0.03); }\n.tab.is-active { color: var(--dt-text); border-bottom-color: var(--dt-accent); font-weight: 600; }\n.tab .count {\n margin-left: 5px;\n font-size: 10px;\n color: var(--dt-text-faint);\n font-variant-numeric: tabular-nums;\n}\n\n/* ---- Body ---- */\n.panel-body {\n flex: 1;\n overflow: auto;\n background: var(--dt-bg);\n}\n.panel-body::-webkit-scrollbar { width: 10px; height: 10px; }\n.panel-body::-webkit-scrollbar-thumb { background: var(--dt-border-strong); border-radius: 6px; border: 2px solid var(--dt-bg); }\n\n.toolbar {\n position: sticky;\n top: 0;\n z-index: 2;\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 7px 10px;\n background: var(--dt-bg);\n border-bottom: 1px solid var(--dt-border);\n}\n.toolbar .grow { flex: 1; }\n.search {\n flex: 1;\n background: var(--dt-bg-inset);\n border: 1px solid var(--dt-border);\n border-radius: 6px;\n padding: 4px 8px;\n color: var(--dt-text);\n font-size: 11px;\n font-family: var(--dt-mono);\n}\n.search:focus { outline: none; border-color: var(--dt-accent); }\n.muted { color: var(--dt-text-dim); font-size: 11px; }\n.faint { color: var(--dt-text-faint); }\n.empty {\n padding: 28px 16px;\n text-align: center;\n color: var(--dt-text-faint);\n font-size: 12px;\n}\n.empty code { color: var(--dt-text-dim); font-family: var(--dt-mono); }\n\n/* ---- State inspector tree ---- */\n.tree { padding: 4px 0; }\n.row {\n display: flex;\n align-items: flex-start;\n gap: 4px;\n padding: 2px 10px 2px 0;\n font-family: var(--dt-mono);\n font-size: 11.5px;\n white-space: nowrap;\n}\n.row:hover { background: rgba(255,255,255,0.035); }\n.row .twist {\n width: 14px;\n flex: 0 0 14px;\n color: var(--dt-text-faint);\n cursor: pointer;\n text-align: center;\n user-select: none;\n}\n.row .twist.is-leaf { visibility: hidden; }\n.row .k { color: var(--dt-purple); }\n.row .sep { color: var(--dt-text-faint); }\n.row .v { color: var(--dt-text); cursor: text; }\n.row .v.t-string { color: var(--dt-green); }\n.row .v.t-number { color: var(--dt-amber); }\n.row .v.t-boolean { color: var(--dt-blue); }\n.row .v.t-null, .row .v.t-undefined { color: var(--dt-text-faint); font-style: italic; }\n.row .v.t-object, .row .v.t-array, .row .v.t-function { color: var(--dt-text-dim); }\n.row .tag {\n margin-left: 6px;\n font-size: 9px;\n font-family: var(--dt-sans);\n color: var(--dt-text-faint);\n border: 1px solid var(--dt-border);\n border-radius: 4px;\n padding: 0 4px;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n}\n.row.is-changed { background: var(--dt-accent-soft); animation: dt-flash 1.1s ease-out; }\n@keyframes dt-flash {\n 0% { background: rgba(124,156,255,0.55); }\n 100% { background: transparent; }\n}\n.edit-input {\n background: var(--dt-bg-inset);\n border: 1px solid var(--dt-accent);\n border-radius: 4px;\n color: var(--dt-text);\n font-family: var(--dt-mono);\n font-size: 11.5px;\n padding: 0 4px;\n min-width: 80px;\n}\n.edit-input:focus { outline: none; }\n\n/* ---- Profiler ---- */\n.commit-strip {\n display: flex;\n align-items: flex-end;\n gap: 2px;\n height: 64px;\n padding: 8px 10px;\n background: var(--dt-bg-inset);\n border-bottom: 1px solid var(--dt-border);\n overflow-x: auto;\n}\n.commit-bar {\n flex: 0 0 9px;\n min-height: 3px;\n background: var(--dt-blue);\n border-radius: 2px 2px 0 0;\n cursor: pointer;\n opacity: 0.65;\n transition: opacity 0.1s;\n}\n.commit-bar:hover { opacity: 1; }\n.commit-bar.is-full { background: var(--dt-amber); }\n.commit-bar.is-initial { background: var(--dt-green); }\n.commit-bar.is-selected { opacity: 1; outline: 1.5px solid var(--dt-text); outline-offset: 1px; }\n\n.section { padding: 10px; border-bottom: 1px solid var(--dt-border); }\n.section-title {\n font-size: 10px;\n text-transform: uppercase;\n letter-spacing: 0.6px;\n color: var(--dt-text-faint);\n margin: 0 0 7px;\n font-weight: 700;\n}\n.kv { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 6px; }\n.kv span { font-size: 11px; color: var(--dt-text-dim); }\n.kv b { color: var(--dt-text); font-weight: 600; }\n.kv .mono { font-family: var(--dt-mono); }\n.chip {\n display: inline-block;\n font-size: 10px;\n padding: 1px 6px;\n border-radius: 999px;\n font-family: var(--dt-mono);\n}\n.chip.green { background: rgba(90,209,155,0.16); color: var(--dt-green); }\n.chip.blue { background: rgba(106,166,255,0.16); color: var(--dt-blue); }\n.chip.amber { background: rgba(240,179,94,0.16); color: var(--dt-amber); }\n.chip.grey { background: rgba(91,98,111,0.22); color: var(--dt-text-dim); }\n.chip.red { background: rgba(248,113,113,0.16); color: var(--dt-red); }\n.chip.purple { background: rgba(192,140,240,0.16); color: var(--dt-purple); }\n\n/* flamegraph rows */\n.flame-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 1px 0;\n font-size: 11px;\n}\n.flame-bar-wrap { flex: 1; min-width: 0; }\n.flame-bar {\n height: 16px;\n border-radius: 3px;\n display: flex;\n align-items: center;\n padding: 0 6px;\n color: #0c0e12;\n font-family: var(--dt-mono);\n font-size: 10px;\n font-weight: 600;\n white-space: nowrap;\n overflow: hidden;\n min-width: 2px;\n}\n.flame-bar.p-mount { background: var(--dt-green); }\n.flame-bar.p-update { background: var(--dt-blue); }\n.flame-bar.p-memo { background: var(--dt-grey); color: var(--dt-text-dim); opacity: 0.8; }\n.flame-time { flex: 0 0 56px; text-align: right; font-family: var(--dt-mono); color: var(--dt-text-dim); font-size: 10px; }\n.flame-reason { font-size: 10px; color: var(--dt-text-faint); }\n\n/* tables */\ntable.dt-table { width: 100%; border-collapse: collapse; font-size: 11px; }\ntable.dt-table th {\n text-align: left;\n color: var(--dt-text-faint);\n font-weight: 600;\n font-size: 10px;\n text-transform: uppercase;\n letter-spacing: 0.4px;\n padding: 4px 6px;\n border-bottom: 1px solid var(--dt-border);\n position: sticky;\n top: 0;\n background: var(--dt-bg);\n}\ntable.dt-table td {\n padding: 3px 6px;\n border-bottom: 1px solid rgba(43,47,56,0.5);\n font-variant-numeric: tabular-nums;\n}\ntable.dt-table td.name { font-family: var(--dt-mono); color: var(--dt-text); }\ntable.dt-table td.num { text-align: right; font-family: var(--dt-mono); color: var(--dt-text-dim); }\ntable.dt-table tr:hover td { background: rgba(255,255,255,0.03); }\n.bar-cell { position: relative; }\n.bar-cell .barfill {\n position: absolute;\n left: 0; top: 2px; bottom: 2px;\n background: rgba(124,156,255,0.22);\n border-radius: 3px;\n z-index: 0;\n}\n.bar-cell span { position: relative; z-index: 1; }\n\n/* ---- Effect timeline ---- */\n.lane {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 5px 10px;\n border-bottom: 1px solid rgba(43,47,56,0.5);\n}\n.lane .lane-name { font-family: var(--dt-mono); color: var(--dt-text); font-size: 11px; flex: 0 0 auto; }\n.lane .lane-trig { font-family: var(--dt-mono); color: var(--dt-text-faint); font-size: 10px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.lane .lane-stat { color: var(--dt-text-dim); font-size: 10px; font-variant-numeric: tabular-nums; }\n\n.log-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 2px 10px;\n font-size: 11px;\n border-bottom: 1px solid rgba(43,47,56,0.35);\n}\n.log-row:hover { background: rgba(255,255,255,0.03); }\n.log-row .t { flex: 0 0 62px; text-align: right; font-family: var(--dt-mono); color: var(--dt-text-faint); font-size: 10px; }\n.log-row .ph { flex: 0 0 64px; }\n.log-row .lbl { font-family: var(--dt-mono); color: var(--dt-text-dim); }\n.log-row .rsn { flex: 1; font-family: var(--dt-mono); color: var(--dt-text-faint); font-size: 10px; text-align: right; }\n\n.filters { display: flex; gap: 4px; flex-wrap: wrap; }\n.filter-chip {\n font-size: 10px;\n padding: 2px 8px;\n border-radius: 999px;\n border: 1px solid var(--dt-border);\n background: var(--dt-bg-inset);\n color: var(--dt-text-faint);\n cursor: pointer;\n font-family: var(--dt-sans);\n}\n.filter-chip.is-on { color: var(--dt-text); border-color: var(--dt-border-strong); background: var(--dt-bg-raised); }\n\n/* ---- Resize grip ---- */\n.resize {\n position: absolute;\n width: 16px;\n height: 16px;\n right: 0;\n bottom: 0;\n cursor: nwse-resize;\n background: linear-gradient(135deg, transparent 50%, var(--dt-border-strong) 50%, var(--dt-border-strong) 60%, transparent 60%, transparent 72%, var(--dt-border-strong) 72%, var(--dt-border-strong) 82%, transparent 82%);\n border-bottom-right-radius: 12px;\n}\n";
7
+ export declare const devtoolsStyles = "\n:host {\n --dt-bg: #16181d;\n --dt-bg-raised: #1d2026;\n --dt-bg-inset: #101216;\n --dt-border: #2b2f38;\n --dt-border-strong: #3a3f4b;\n --dt-text: #e6e8ec;\n --dt-text-dim: #9aa0ab;\n --dt-text-faint: #6b7280;\n --dt-accent: #7c9cff;\n --dt-accent-soft: #2a3357;\n --dt-green: #5ad19b;\n --dt-blue: #6aa6ff;\n --dt-amber: #f0b35e;\n --dt-grey: #5b626f;\n --dt-red: #f87171;\n --dt-purple: #c08cf0;\n --dt-mono: ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, monospace;\n --dt-sans: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n all: initial;\n position: fixed;\n z-index: 2147483000;\n font-family: var(--dt-sans);\n color: var(--dt-text);\n contain: layout style;\n}\n:host([hidden]) { display: none; }\n\n*, *::before, *::after { box-sizing: border-box; }\n\n.panel {\n display: flex;\n flex-direction: column;\n width: 480px;\n height: 560px;\n max-width: 96vw;\n max-height: 92vh;\n background: var(--dt-bg);\n border: 1px solid var(--dt-border-strong);\n border-radius: 12px;\n box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);\n overflow: hidden;\n font-size: 12px;\n line-height: 1.45;\n}\n.panel.is-collapsed { height: auto !important; }\n.panel.is-collapsed .panel-body,\n.panel.is-collapsed .tabs { display: none; }\n\n/* ---- Header ---- */\n.header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 10px;\n background: var(--dt-bg-raised);\n border-bottom: 1px solid var(--dt-border);\n cursor: grab;\n user-select: none;\n}\n.header.is-dragging { cursor: grabbing; }\n.brand {\n display: flex;\n align-items: center;\n gap: 6px;\n font-weight: 700;\n font-size: 12px;\n letter-spacing: 0.2px;\n white-space: nowrap;\n}\n.brand .bolt { color: var(--dt-accent); font-size: 13px; }\n.brand .ver { color: var(--dt-text-faint); font-weight: 500; font-size: 10px; }\n.header .spacer { flex: 1; }\n\n.app-select {\n appearance: none;\n background: var(--dt-bg-inset);\n color: var(--dt-text);\n border: 1px solid var(--dt-border);\n border-radius: 6px;\n padding: 3px 22px 3px 8px;\n font-size: 11px;\n font-family: var(--dt-sans);\n max-width: 150px;\n cursor: pointer;\n background-image: url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 3.5 5 6.5 8 3.5' stroke='%239aa0ab' fill='none' stroke-width='1.4'/></svg>\");\n background-repeat: no-repeat;\n background-position: right 6px center;\n}\n.app-select:focus { outline: none; border-color: var(--dt-accent); }\n\n.icon-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n height: 24px;\n min-width: 24px;\n padding: 0 6px;\n background: var(--dt-bg-inset);\n color: var(--dt-text-dim);\n border: 1px solid var(--dt-border);\n border-radius: 6px;\n font-size: 11px;\n cursor: pointer;\n font-family: var(--dt-sans);\n}\n.icon-btn:hover { color: var(--dt-text); border-color: var(--dt-border-strong); }\n.icon-btn.is-on { color: var(--dt-text); border-color: var(--dt-accent); }\n.rec-dot {\n width: 8px; height: 8px; border-radius: 50%;\n background: var(--dt-red);\n}\n.rec-dot.is-paused { background: var(--dt-text-faint); }\n\n/* ---- Tabs ---- */\n.tabs {\n display: flex;\n gap: 2px;\n padding: 6px 8px 0;\n background: var(--dt-bg-raised);\n border-bottom: 1px solid var(--dt-border);\n}\n.tab {\n appearance: none;\n background: transparent;\n border: none;\n border-bottom: 2px solid transparent;\n color: var(--dt-text-dim);\n padding: 6px 12px 8px;\n font-size: 12px;\n font-family: var(--dt-sans);\n cursor: pointer;\n border-radius: 6px 6px 0 0;\n}\n.tab:hover { color: var(--dt-text); background: rgba(255,255,255,0.03); }\n.tab.is-active { color: var(--dt-text); border-bottom-color: var(--dt-accent); font-weight: 600; }\n.tab .count {\n margin-left: 5px;\n font-size: 10px;\n color: var(--dt-text-faint);\n font-variant-numeric: tabular-nums;\n}\n\n/* ---- Body ---- */\n.panel-body {\n flex: 1;\n overflow: auto;\n background: var(--dt-bg);\n}\n.panel-body::-webkit-scrollbar { width: 10px; height: 10px; }\n.panel-body::-webkit-scrollbar-thumb { background: var(--dt-border-strong); border-radius: 6px; border: 2px solid var(--dt-bg); }\n\n.toolbar {\n position: sticky;\n top: 0;\n z-index: 2;\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 7px 10px;\n background: var(--dt-bg);\n border-bottom: 1px solid var(--dt-border);\n}\n.toolbar .grow { flex: 1; }\n.search {\n flex: 1;\n background: var(--dt-bg-inset);\n border: 1px solid var(--dt-border);\n border-radius: 6px;\n padding: 4px 8px;\n color: var(--dt-text);\n font-size: 11px;\n font-family: var(--dt-mono);\n}\n.search:focus { outline: none; border-color: var(--dt-accent); }\n.muted { color: var(--dt-text-dim); font-size: 11px; }\n.faint { color: var(--dt-text-faint); }\n.empty {\n padding: 28px 16px;\n text-align: center;\n color: var(--dt-text-faint);\n font-size: 12px;\n}\n.empty code { color: var(--dt-text-dim); font-family: var(--dt-mono); }\n\n/* ---- State inspector tree ---- */\n.tree { padding: 4px 0; }\n.row {\n display: flex;\n align-items: flex-start;\n gap: 4px;\n padding: 2px 10px 2px 0;\n font-family: var(--dt-mono);\n font-size: 11.5px;\n white-space: nowrap;\n}\n.row:hover { background: rgba(255,255,255,0.035); }\n.row .twist {\n width: 14px;\n flex: 0 0 14px;\n color: var(--dt-text-faint);\n cursor: pointer;\n text-align: center;\n user-select: none;\n}\n.row .twist.is-leaf { visibility: hidden; }\n.row .k { color: var(--dt-purple); }\n.row .sep { color: var(--dt-text-faint); }\n.row .v { color: var(--dt-text); cursor: text; }\n.row .v.t-string { color: var(--dt-green); }\n.row .v.t-number { color: var(--dt-amber); }\n.row .v.t-boolean { color: var(--dt-blue); }\n.row .v.t-null, .row .v.t-undefined { color: var(--dt-text-faint); font-style: italic; }\n.row .v.t-object, .row .v.t-array, .row .v.t-function { color: var(--dt-text-dim); }\n.row .tag {\n margin-left: 6px;\n font-size: 9px;\n font-family: var(--dt-sans);\n color: var(--dt-text-faint);\n border: 1px solid var(--dt-border);\n border-radius: 4px;\n padding: 0 4px;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n}\n.row.is-changed { background: var(--dt-accent-soft); animation: dt-flash 1.1s ease-out; }\n@keyframes dt-flash {\n 0% { background: rgba(124,156,255,0.55); }\n 100% { background: transparent; }\n}\n.edit-input {\n background: var(--dt-bg-inset);\n border: 1px solid var(--dt-accent);\n border-radius: 4px;\n color: var(--dt-text);\n font-family: var(--dt-mono);\n font-size: 11.5px;\n padding: 0 4px;\n min-width: 80px;\n}\n.edit-input:focus { outline: none; }\n\n/* ---- Profiler ---- */\n.commit-strip {\n display: flex;\n align-items: flex-end;\n gap: 2px;\n height: 64px;\n padding: 8px 10px;\n background: var(--dt-bg-inset);\n border-bottom: 1px solid var(--dt-border);\n overflow-x: auto;\n}\n.commit-bar {\n flex: 0 0 9px;\n min-height: 3px;\n background: var(--dt-blue);\n border-radius: 2px 2px 0 0;\n cursor: pointer;\n opacity: 0.65;\n transition: opacity 0.1s;\n}\n.commit-bar:hover { opacity: 1; }\n.commit-bar.is-full { background: var(--dt-amber); }\n.commit-bar.is-initial { background: var(--dt-green); }\n.commit-bar.is-selected { opacity: 1; outline: 1.5px solid var(--dt-text); outline-offset: 1px; }\n\n.section { padding: 10px; border-bottom: 1px solid var(--dt-border); }\n.section-title {\n font-size: 10px;\n text-transform: uppercase;\n letter-spacing: 0.6px;\n color: var(--dt-text-faint);\n margin: 0 0 7px;\n font-weight: 700;\n}\n.kv { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 6px; }\n.kv span { font-size: 11px; color: var(--dt-text-dim); }\n.kv b { color: var(--dt-text); font-weight: 600; }\n.kv .mono { font-family: var(--dt-mono); }\n.chip {\n display: inline-block;\n font-size: 10px;\n padding: 1px 6px;\n border-radius: 999px;\n font-family: var(--dt-mono);\n}\n.chip.green { background: rgba(90,209,155,0.16); color: var(--dt-green); }\n.chip.blue { background: rgba(106,166,255,0.16); color: var(--dt-blue); }\n.chip.amber { background: rgba(240,179,94,0.16); color: var(--dt-amber); }\n.chip.grey { background: rgba(91,98,111,0.22); color: var(--dt-text-dim); }\n.chip.red { background: rgba(248,113,113,0.16); color: var(--dt-red); }\n.chip.purple { background: rgba(192,140,240,0.16); color: var(--dt-purple); }\n\n/* flamegraph rows */\n.flame-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 1px 0;\n font-size: 11px;\n}\n.flame-bar-wrap { flex: 1; min-width: 0; }\n.flame-bar {\n height: 16px;\n border-radius: 3px;\n display: flex;\n align-items: center;\n padding: 0 6px;\n color: #0c0e12;\n font-family: var(--dt-mono);\n font-size: 10px;\n font-weight: 600;\n white-space: nowrap;\n overflow: hidden;\n min-width: 2px;\n}\n.flame-bar.p-mount { background: var(--dt-green); }\n.flame-bar.p-update { background: var(--dt-blue); }\n.flame-bar.p-memo { background: var(--dt-grey); color: var(--dt-text-dim); opacity: 0.8; }\n.flame-time { flex: 0 0 56px; text-align: right; font-family: var(--dt-mono); color: var(--dt-text-dim); font-size: 10px; }\n.flame-reason { font-size: 10px; color: var(--dt-text-faint); }\n\n/* tables */\ntable.dt-table { width: 100%; border-collapse: collapse; font-size: 11px; }\ntable.dt-table th {\n text-align: left;\n color: var(--dt-text-faint);\n font-weight: 600;\n font-size: 10px;\n text-transform: uppercase;\n letter-spacing: 0.4px;\n padding: 4px 6px;\n border-bottom: 1px solid var(--dt-border);\n position: sticky;\n top: 0;\n background: var(--dt-bg);\n}\ntable.dt-table td {\n padding: 3px 6px;\n border-bottom: 1px solid rgba(43,47,56,0.5);\n font-variant-numeric: tabular-nums;\n}\ntable.dt-table td.name { font-family: var(--dt-mono); color: var(--dt-text); }\ntable.dt-table td.num { text-align: right; font-family: var(--dt-mono); color: var(--dt-text-dim); }\ntable.dt-table tr:hover td { background: rgba(255,255,255,0.03); }\n.bar-cell { position: relative; }\n.bar-cell .barfill {\n position: absolute;\n left: 0; top: 2px; bottom: 2px;\n background: rgba(124,156,255,0.22);\n border-radius: 3px;\n z-index: 0;\n}\n.bar-cell span { position: relative; z-index: 1; }\n\n/* ---- Effect timeline ---- */\n.lane {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 5px 10px;\n border-bottom: 1px solid rgba(43,47,56,0.5);\n}\n.lane .lane-name { font-family: var(--dt-mono); color: var(--dt-text); font-size: 11px; flex: 0 0 auto; }\n.lane .lane-trig { font-family: var(--dt-mono); color: var(--dt-text-faint); font-size: 10px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.lane .lane-stat { color: var(--dt-text-dim); font-size: 10px; font-variant-numeric: tabular-nums; }\n\n.log-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 2px 10px;\n font-size: 11px;\n border-bottom: 1px solid rgba(43,47,56,0.35);\n}\n.log-row:hover { background: rgba(255,255,255,0.03); }\n.log-row .t { flex: 0 0 62px; text-align: right; font-family: var(--dt-mono); color: var(--dt-text-faint); font-size: 10px; }\n.log-row .ph { flex: 0 0 64px; }\n.log-row .lbl { font-family: var(--dt-mono); color: var(--dt-text-dim); }\n.log-row .rsn { flex: 1; font-family: var(--dt-mono); color: var(--dt-text-faint); font-size: 10px; text-align: right; }\n\n.filters { display: flex; gap: 4px; flex-wrap: wrap; }\n.filter-chip {\n font-size: 10px;\n padding: 2px 8px;\n border-radius: 999px;\n border: 1px solid var(--dt-border);\n background: var(--dt-bg-inset);\n color: var(--dt-text-faint);\n cursor: pointer;\n font-family: var(--dt-sans);\n}\n.filter-chip.is-on { color: var(--dt-text); border-color: var(--dt-border-strong); background: var(--dt-bg-raised); }\n\n/* ---- Stat grid (perf / effect summaries) ---- */\n.stat-grid {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));\n gap: 6px;\n}\n.stat {\n display: flex;\n flex-direction: column;\n gap: 1px;\n padding: 6px 8px;\n background: var(--dt-bg-inset);\n border: 1px solid var(--dt-border);\n border-radius: 7px;\n}\n.stat.is-link { cursor: pointer; }\n.stat.is-link:hover { border-color: var(--dt-accent); }\n.stat-val {\n font-family: var(--dt-mono);\n font-size: 14px;\n font-weight: 700;\n color: var(--dt-text);\n font-variant-numeric: tabular-nums;\n}\n.stat-val.t-warn { color: var(--dt-amber); }\n.stat-val.t-good { color: var(--dt-green); }\n.stat-val.t-bad { color: var(--dt-red); }\n.stat-label {\n font-size: 9.5px;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n color: var(--dt-text-faint);\n}\n\n/* ---- Horizontal bar rows (hot atoms) ---- */\n.bar-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 2px 0;\n font-size: 11px;\n}\n.bar-row-label {\n flex: 0 0 34%;\n font-family: var(--dt-mono);\n color: var(--dt-purple);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.bar-row-track {\n flex: 1;\n height: 10px;\n background: var(--dt-bg-inset);\n border-radius: 3px;\n overflow: hidden;\n}\n.bar-row-fill {\n display: block;\n height: 100%;\n background: linear-gradient(90deg, var(--dt-accent-soft), var(--dt-accent));\n border-radius: 3px;\n}\n.bar-row-num {\n flex: 0 0 auto;\n font-family: var(--dt-mono);\n color: var(--dt-text-dim);\n font-size: 10px;\n font-variant-numeric: tabular-nums;\n}\n\n/* ---- Insights ---- */\n.insights { display: flex; flex-direction: column; gap: 5px; }\n.insight {\n display: flex;\n gap: 7px;\n align-items: flex-start;\n font-size: 11px;\n line-height: 1.4;\n padding: 6px 8px;\n border-radius: 7px;\n border: 1px solid var(--dt-border);\n background: var(--dt-bg-inset);\n color: var(--dt-text-dim);\n}\n.insight-ic { flex: 0 0 auto; font-weight: 700; }\n.insight.t-warn { border-color: rgba(240,179,94,0.4); }\n.insight.t-warn .insight-ic { color: var(--dt-amber); }\n.insight.t-bad { border-color: rgba(248,113,113,0.4); }\n.insight.t-bad .insight-ic { color: var(--dt-red); }\n.insight.t-good .insight-ic { color: var(--dt-green); }\n\n/* ---- Reactivity heat badge (state tree) ---- */\n.row .grow { flex: 1; min-width: 8px; }\n.heat { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; }\n.heat-bar {\n width: 40px;\n height: 5px;\n border-radius: 3px;\n background: var(--dt-bg-inset);\n overflow: hidden;\n}\n.heat-fill {\n display: block;\n height: 100%;\n background: linear-gradient(90deg, var(--dt-blue), var(--dt-amber));\n}\n.heat-num {\n font-family: var(--dt-mono);\n font-size: 9.5px;\n color: var(--dt-text-faint);\n min-width: 18px;\n text-align: right;\n}\n\n/* ---- Sortable table headers ---- */\ntable.dt-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }\ntable.dt-table th.sortable:hover { color: var(--dt-text-dim); }\n\n/* ---- Effect visual timeline ---- */\n.tl-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 10px 4px;\n}\n.tl-axis {\n position: relative;\n flex: 0 0 120px;\n font-family: var(--dt-mono);\n font-size: 9px;\n color: var(--dt-text-faint);\n}\n.tl-axis-end { float: right; }\n.tl-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 3px 10px;\n border-bottom: 1px solid rgba(43,47,56,0.4);\n}\n.tl-name {\n flex: 0 0 38%;\n font-family: var(--dt-mono);\n font-size: 10.5px;\n color: var(--dt-text-dim);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.tl-track {\n position: relative;\n flex: 1;\n height: 16px;\n background: var(--dt-bg-inset);\n border-radius: 4px;\n}\n.tl-dot {\n position: absolute;\n top: 50%;\n width: 8px;\n height: 8px;\n margin-top: -4px;\n margin-left: -4px;\n border-radius: 50%;\n box-shadow: 0 0 0 1px var(--dt-bg-inset);\n}\n.tl-dot.green { background: var(--dt-green); }\n.tl-dot.blue { background: var(--dt-blue); }\n.tl-dot.purple { background: var(--dt-purple); }\n.tl-dot.grey { background: var(--dt-grey); }\n.tl-dot.red { background: var(--dt-red); }\n\n/* ---- Resize grip ---- */\n.resize {\n position: absolute;\n width: 16px;\n height: 16px;\n right: 0;\n bottom: 0;\n cursor: nwse-resize;\n background: linear-gradient(135deg, transparent 50%, var(--dt-border-strong) 50%, var(--dt-border-strong) 60%, transparent 60%, transparent 72%, var(--dt-border-strong) 72%, var(--dt-border-strong) 82%, transparent 82%);\n border-bottom-right-radius: 12px;\n}\n";
@@ -52,6 +52,11 @@ export declare class AktionElement extends HTMLElement {
52
52
  * overlap this set.
53
53
  */
54
54
  private pendingChangedPaths;
55
+ /**
56
+ * Per-path scroll positions saved for `scroll-restoration="auto"`, so
57
+ * back/forward navigation can return the user to where they were.
58
+ */
59
+ private routeScrollPositions;
55
60
  /**
56
61
  * Set when a re-render was requested via `notify()` (async resolution,
57
62
  * timer, HTTP, hook, effect) rather than a tracked `$state` write. The
@@ -200,6 +205,13 @@ export declare class AktionElement extends HTMLElement {
200
205
  appendChunk(chunk: string): void;
201
206
  setTheme(theme: ThemeInput): void;
202
207
  registerComponents(components: ComponentSpec[], rootName?: string): void;
208
+ /**
209
+ * Register custom icons (inline SVG markup keyed by name) so authored code
210
+ * can use brand glyphs anywhere a Font Awesome name is accepted. Equivalent
211
+ * to `$theme({ icons: {...} })` from inside a program. Re-renders so any
212
+ * already-rendered icons pick up the new set.
213
+ */
214
+ registerIcons(icons: Record<string, string>): void;
203
215
  /**
204
216
  * Build a system prompt for the active library. Pass `{ mode: "chat" }`
205
217
  * for the compact chat-focused prompt; omit `mode` (or pass `"full"`)
@@ -266,7 +278,21 @@ export declare class AktionElement extends HTMLElement {
266
278
  * `route-change` event so host pages can sync analytics or sidebars.
267
279
  */
268
280
  private handleRouteChange;
281
+ /**
282
+ * Save / restore window scroll across route changes when the
283
+ * `scroll-restoration` attribute opts in (IV.5). The outgoing page's scroll
284
+ * is captured synchronously (the DOM hasn't morphed yet); the target scroll
285
+ * is applied in a `requestAnimationFrame` so the incoming page has laid out.
286
+ */
287
+ private handleScrollRestoration;
269
288
  private applyThemeFromAttribute;
289
+ /**
290
+ * Reflect the host `dir` attribute onto the render root (X.1). Setting
291
+ * `dir` on `rootEl` makes `direction` + CSS logical properties cascade to
292
+ * every rendered component, so an RTL locale flips the whole tree. An
293
+ * absent / empty attribute clears it so the element inherits page direction.
294
+ */
295
+ private applyDir;
270
296
  /**
271
297
  * Look for the reserved `theme` binding in the active program — set by a
272
298
  * bare `$theme({...})` statement or an explicit `theme = $theme({...})`
@@ -43,3 +43,13 @@ export declare function isIconName(value: unknown): value is string;
43
43
  export declare const ICON_SIZES: readonly ["xs", "sm", "md", "lg", "xl"];
44
44
  export type IconSize = (typeof ICON_SIZES)[number];
45
45
  export declare function isIconSize(value: unknown): value is IconSize;
46
+ /**
47
+ * Register one or more custom icons. Each value is inline SVG markup — either
48
+ * a full `<svg>…</svg>` element or just its inner shapes (wrapped in a
49
+ * 24×24 `viewBox` svg automatically). Returns the names successfully added.
50
+ */
51
+ export declare function registerIcons(record: unknown): string[];
52
+ /** Look up a registered custom icon's sanitised SVG markup, or null. */
53
+ export declare function getCustomIcon(name: unknown): string | null;
54
+ /** True when `name` resolves to a registered custom icon. */
55
+ export declare function hasCustomIcon(name: unknown): boolean;
@@ -43,6 +43,24 @@ interface DismissOptions {
43
43
  export declare function installDismissListeners(opts: DismissOptions): DismissHandle;
44
44
  /** Trigger an immediate dispose for a live root if one is registered. */
45
45
  export declare function disposeDismissListeners(liveRoot: HTMLElement | null | undefined): void;
46
+ /**
47
+ * Keyboard handler for state-bound dialogs: Escape closes, Tab cycles within
48
+ * the panel (focus trap). Assign to `root.onkeydown` (a property, so the
49
+ * morph keeps the closure fresh); `close` receives the live origin element.
50
+ */
51
+ export declare function dialogKeydownHandler(panelSelector: string, close: (origin: HTMLElement) => void): (event: KeyboardEvent) => void;
52
+ interface DisposerHelpers {
53
+ registerDisposer: (cleanup: () => void, key?: string) => void;
54
+ }
55
+ /**
56
+ * Watch a state-bound dialog's `data-open` attribute on the LIVE node and
57
+ * manage focus: on open, move focus to the panel's first focusable element
58
+ * (remembering what had it); on close, restore it. Installed once per
59
+ * instance — re-render snapshots that the morph discards skip themselves via
60
+ * the `isConnected` check, and the observer is torn down through a keyed
61
+ * disposer when the dialog unmounts.
62
+ */
63
+ export declare function wireDialogFocus(root: HTMLElement, panelSelector: string, helpers: DisposerHelpers): void;
46
64
  export declare function pickIconForLabel(label: string | null | undefined): string | null;
47
65
  export declare function pickIconForTone(tone: string | null | undefined): string | null;
48
66
  /**
@@ -0,0 +1,5 @@
1
+ import { ComponentSpec } from '../types.js';
2
+ export declare const VisuallyHidden: ComponentSpec;
3
+ export declare const SkipLink: ComponentSpec;
4
+ export declare const LiveRegion: ComponentSpec;
5
+ export declare const FocusTrap: ComponentSpec;
@@ -0,0 +1,3 @@
1
+ import { ComponentSpec } from '../types.js';
2
+ export declare const DrawingCanvas: ComponentSpec;
3
+ export declare const SignaturePad: ComponentSpec;
@@ -0,0 +1,15 @@
1
+ import { ComponentSpec } from '../types.js';
2
+ export declare const Svg: ComponentSpec;
3
+ export declare const Sheet: ComponentSpec;
4
+ export declare const BottomSheet: ComponentSpec;
5
+ export declare const ConfirmDialog: ComponentSpec;
6
+ export declare const PresenceAvatars: ComponentSpec;
7
+ export declare const ShareButtons: ComponentSpec;
8
+ export declare const AuthorByline: ComponentSpec;
9
+ export declare const VariantSelector: ComponentSpec;
10
+ export declare const OrderSummary: ComponentSpec;
11
+ export declare const ScrollSpy: ComponentSpec;
12
+ export declare const SpeedDial: ComponentSpec;
13
+ export declare const Confetti: ComponentSpec;
14
+ export declare const KbdShortcut: ComponentSpec;
15
+ export declare const Lottie: ComponentSpec;
@@ -12,3 +12,4 @@ export declare const ChatBubble: ComponentSpec;
12
12
  export declare const Kbd: ComponentSpec;
13
13
  export declare const Popover: ComponentSpec;
14
14
  export declare const Toast: ComponentSpec;
15
+ export declare const Toasts: ComponentSpec;
@@ -1,7 +1,62 @@
1
1
  /**
2
2
  * Shared form helpers used by forms.ts and new-components.ts.
3
3
  */
4
+ /**
5
+ * Wrap a bare input element in a field shell with a label, required marker,
6
+ * hint, and error message — but ONLY when one of those props is supplied
7
+ * (suggestions-global V.4). When none are present, the input is returned
8
+ * unchanged so existing call sites keep identical output (backwards
9
+ * compatible). Also wires `required` + `aria-invalid` / `aria-describedby`
10
+ * on the control for accessibility.
11
+ */
12
+ export declare function withFieldShell(control: HTMLElement, props: Record<string, unknown>, options?: {
13
+ idKey?: string;
14
+ }): HTMLElement;
15
+ /** Props every field-shell-capable input accepts (for spec declarations). */
16
+ export declare const FIELD_SHELL_PROPS: readonly [{
17
+ readonly name: "label";
18
+ readonly type: "string";
19
+ readonly optional: true;
20
+ readonly description: "Field label rendered above the control";
21
+ }, {
22
+ readonly name: "hint";
23
+ readonly type: "string";
24
+ readonly optional: true;
25
+ readonly description: "Helper text rendered below the control";
26
+ }, {
27
+ readonly name: "error";
28
+ readonly type: "string";
29
+ readonly optional: true;
30
+ readonly description: "Validation error rendered below the control (marks it invalid)";
31
+ }, {
32
+ readonly name: "required";
33
+ readonly type: "boolean";
34
+ readonly optional: true;
35
+ readonly description: "Mark the field required (adds a `*` and the `required` attribute)";
36
+ }, {
37
+ readonly name: "onBlur";
38
+ readonly type: "callable";
39
+ readonly optional: true;
40
+ readonly aliases: readonly ["onblur"];
41
+ readonly description: "Called with the current value when focus leaves the control (validate-on-blur, `form.touch`)";
42
+ }, {
43
+ readonly name: "onFocus";
44
+ readonly type: "callable";
45
+ readonly optional: true;
46
+ readonly aliases: readonly ["onfocus"];
47
+ readonly description: "Called when the control gains focus";
48
+ }];
49
+ interface FocusHelpers {
50
+ invoke: (handler: unknown, ...args: unknown[]) => void;
51
+ }
52
+ /**
53
+ * Wire `onBlur`/`onFocus` props as DOM property handlers (morph contract —
54
+ * fresh closures survive node reuse). `onBlur` receives the control's current
55
+ * value so `form.touch(name)` / validate-on-blur flows work (V.1).
56
+ */
57
+ export declare function attachFocusHandlers(control: HTMLElement, props: Record<string, unknown>, helpers: FocusHelpers, getValue?: (node: HTMLElement) => unknown): void;
4
58
  export declare function extractComboboxItems(raw: unknown): Array<{
5
59
  value: string;
6
60
  label: string;
7
61
  }>;
62
+ export {};
@@ -0,0 +1,14 @@
1
+ import { ComponentSpec } from '../types.js';
2
+ export declare const Split: ComponentSpec;
3
+ export declare const BentoCell: ComponentSpec;
4
+ export declare const Bento: ComponentSpec;
5
+ export declare const Reveal: ComponentSpec;
6
+ export declare const OnGesture: ComponentSpec;
7
+ export declare const Sortable: ComponentSpec;
8
+ export declare const Draggable: ComponentSpec;
9
+ export declare const DropZone: ComponentSpec;
10
+ export declare const Parallax: ComponentSpec;
11
+ export declare const ReadingProgress: ComponentSpec;
12
+ export declare const Transition: ComponentSpec;
13
+ export declare const FlipList: ComponentSpec;
14
+ export declare const RouteView: ComponentSpec;
@@ -17,6 +17,7 @@ export declare const Accordion: ComponentSpec;
17
17
  export declare function resolveSpan(span: unknown): number;
18
18
  export declare const GridItem: ComponentSpec;
19
19
  export declare const Box: ComponentSpec;
20
+ export declare const Fragment: ComponentSpec;
20
21
  export declare const Grid: ComponentSpec;
21
22
  export declare const AspectRatio: ComponentSpec;
22
23
  export declare const ScrollArea: ComponentSpec;
@@ -0,0 +1,35 @@
1
+ import { ComponentSpec } from '../types.js';
2
+ export declare const GradientText: ComponentSpec;
3
+ export declare const Display: ComponentSpec;
4
+ export declare const Heading: ComponentSpec;
5
+ export declare const Eyebrow: ComponentSpec;
6
+ export declare const Section: ComponentSpec;
7
+ export declare const OverlayItem: ComponentSpec;
8
+ export declare const Overlay: ComponentSpec;
9
+ export declare const Brand: ComponentSpec;
10
+ export declare const NavBar: ComponentSpec;
11
+ export declare const FooterColumn: ComponentSpec;
12
+ export declare const Footer: ComponentSpec;
13
+ export declare const LogoChip: ComponentSpec;
14
+ export declare const LogoCloud: ComponentSpec;
15
+ export declare const CountUp: ComponentSpec;
16
+ export declare const Metric: ComponentSpec;
17
+ export declare const MetricStrip: ComponentSpec;
18
+ export declare const CodeWindow: ComponentSpec;
19
+ export declare const BrowserFrame: ComponentSpec;
20
+ export declare const Terminal: ComponentSpec;
21
+ export declare const Backdrop: ComponentSpec;
22
+ export declare const ThemeToggle: ComponentSpec;
23
+ export declare const Swatch: ComponentSpec;
24
+ export declare const CopyButton: ComponentSpec;
25
+ export declare const SegmentedControl: ComponentSpec;
26
+ export declare const FloatingActionButton: ComponentSpec;
27
+ export declare const Prose: ComponentSpec;
28
+ export declare const RelativeTime: ComponentSpec;
29
+ export declare const PriceTag: ComponentSpec;
30
+ export declare const QuantityStepper: ComponentSpec;
31
+ export declare const ProductCard: ComponentSpec;
32
+ export declare const TableOfContents: ComponentSpec;
33
+ export declare const TypingIndicator: ComponentSpec;
34
+ export declare const CountdownTimer: ComponentSpec;
35
+ export declare const BackToTop: ComponentSpec;
@@ -4,6 +4,7 @@ export declare const CommandPalette: ComponentSpec;
4
4
  export declare const FilterChips: ComponentSpec;
5
5
  export declare const FieldRepeater: ComponentSpec;
6
6
  export declare const VirtualList: ComponentSpec;
7
+ export declare const VirtualGrid: ComponentSpec;
7
8
  export declare const QueryBuilder: ComponentSpec;
8
9
  export declare const DiffViewer: ComponentSpec;
9
10
  export declare const JsonTree: ComponentSpec;
@@ -0,0 +1,2 @@
1
+ import { ComponentSpec } from '../types.js';
2
+ export declare const Calendar: ComponentSpec;
@@ -0,0 +1,6 @@
1
+ import { ComponentSpec } from '../types.js';
2
+ export declare const QRCode: ComponentSpec;
3
+ export declare const ReactionPicker: ComponentSpec;
4
+ export declare const LiveCursor: ComponentSpec;
5
+ export declare const TabBar: ComponentSpec;
6
+ export declare const Cart: ComponentSpec;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Tiny, dependency-free syntax highlighter (suggestions-global VIII.3).
3
+ *
4
+ * Tokenises a line of code into `{ text, cls }` spans for a handful of common
5
+ * languages. It is intentionally lightweight (a single-pass scanner, not a
6
+ * full parser) — enough to colour keywords, strings, comments, numbers, and
7
+ * punctuation in docs/snippets without pulling in a 200 KB grammar engine.
8
+ * Output is always plain text segments, so the caller can build DOM spans
9
+ * safely (no HTML injection).
10
+ */
11
+ export interface HlToken {
12
+ text: string;
13
+ /** Token class suffix (`rui-hl-<cls>`), or null for plain text. */
14
+ cls: string | null;
15
+ }
16
+ /** Tokenise one line. `state` carries an open block-comment flag across lines. */
17
+ export declare function highlightLine(line: string, lang: string, state: {
18
+ inBlockComment: boolean;
19
+ }): HlToken[];
20
+ /** True when `lang` is a language we can meaningfully highlight. */
21
+ export declare function isHighlightable(lang: string): boolean;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Compact, dependency-free QR Code generator (suggestions-global VIII.8).
3
+ *
4
+ * Byte-mode encoder with automatic version selection (1–40) and configurable
5
+ * error-correction level. Adapted from the public-domain algorithm described
6
+ * by Nayuki (https://www.nayuki.io/page/qr-code-generator-library), trimmed to
7
+ * byte mode. Returns a square boolean matrix (`true` = dark module) that the
8
+ * `QRCode` component renders as crisp SVG rects.
9
+ */
10
+ export type Ecc = "L" | "M" | "Q" | "H";
11
+ /** Encode `text` (UTF-8 byte mode) into a QR module matrix. */
12
+ export declare function encodeQr(text: string, ecc?: Ecc): boolean[][];
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Responsive `sx` support (suggestions-global I.5).
3
+ *
4
+ * Emits atomic, deduped CSS classes with `@media (min-width: …)` rules into a
5
+ * single shared constructable stylesheet that every shadow root adopts
6
+ * alongside the main component stylesheet. This lets `sx` values be breakpoint
7
+ * maps (`{ base, sm, md, lg, xl }`) that emit real media queries — not just
8
+ * the resolved base value — while staying bounded (the caller only passes
9
+ * already-sanitised CSS prop/value pairs).
10
+ *
11
+ * In environments without constructable stylesheets (some headless DOMs),
12
+ * `responsiveClassFor` returns null and the caller falls back to emitting the
13
+ * base value inline.
14
+ */
15
+ /** Breakpoint → min-width (px). `base` is the 0-width default (no media query). */
16
+ export declare const BREAKPOINT_MIN: Record<string, number>;
17
+ /**
18
+ * Lazily create (once) the shared dynamic stylesheet used for responsive
19
+ * atomic rules. Returns null when constructable stylesheets are unavailable.
20
+ */
21
+ export declare function getResponsiveSheet(): CSSStyleSheet | null;
22
+ export interface ResponsiveGroup {
23
+ /** Breakpoint key (`base` | `sm` | `md` | `lg` | `xl`). */
24
+ bp: string;
25
+ /** Already-resolved + sanitised `[cssProperty, cssValue]` pairs. */
26
+ decls: Array<[string, string]>;
27
+ }
28
+ /**
29
+ * Build (or reuse) a deduped atomic class for a set of per-breakpoint
30
+ * declarations. Rules are inserted in ascending breakpoint order so the
31
+ * cascade resolves correctly at any viewport width. Returns the class name,
32
+ * or null when responsive emission is unavailable (caller emits base inline).
33
+ */
34
+ export declare function responsiveClassFor(groups: ResponsiveGroup[]): string | null;
35
+ /** True when a value is a responsive breakpoint map (`{ base|sm|md|lg|xl: … }`). */
36
+ export declare function isResponsiveMap(v: unknown): v is Record<string, unknown>;
37
+ export interface StateRuleGroup {
38
+ /** State key (`hover` | `focus` | `active` | `disabled` | …). */
39
+ state: string;
40
+ /** Already-resolved + sanitised `[cssProperty, cssValue]` pairs. */
41
+ decls: Array<[string, string]>;
42
+ }
43
+ /**
44
+ * Build (or reuse) a deduped atomic class for arbitrary interaction-state CSS
45
+ * (suggestions-global I.4) — `:hover` / `:focus` / `:active` / `:disabled` /
46
+ * `:focus-visible` / `:checked`, plus `group-hover` (fires when an ancestor
47
+ * `.ak-group` is hovered). The declarations are caller-sanitised
48
+ * `[property, value]` pairs, so the surface stays bounded. Returns the class
49
+ * name, or null when the shared stylesheet is unavailable.
50
+ */
51
+ export declare function stateClassFor(groups: StateRuleGroup[]): string | null;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * `sx` — bounded, token-aware style-intent layer (suggestions-global Part I).
3
+ *
4
+ * Every component accepts a universal `sx` prop (plus `animate`, `id`,
5
+ * `anchor`, `className`, `style`). These are NOT raw CSS: each value is a
6
+ * design-token reference, a small enum, or a sanitised scalar, so the surface
7
+ * stays theme-safe, XSS-safe, and enumerable by an LLM.
8
+ *
9
+ * The evaluator collects these into `node.universal`; the renderer calls
10
+ * {@link applyUniversal} on the element returned by a component's `render`.
11
+ * One hook styles all 196 components without editing each spec.
12
+ */
13
+ /**
14
+ * Serialize an `sx` object into a safe inline-style string + utility classes.
15
+ * Unknown keys are ignored. Hover/focus map to predefined utility classes
16
+ * (no dynamic CSS injection) so the surface stays bounded. Responsive map
17
+ * values (`{ base, md, … }`) emit real `@media` rules via atomic classes.
18
+ */
19
+ export declare function serializeSx(sxRaw: unknown): {
20
+ style: string;
21
+ classes: string[];
22
+ };
23
+ /**
24
+ * Resolve the `animate` universal prop → class + inline timing overrides.
25
+ * Accepts a preset string or `{ preset, delay, duration, repeat }`.
26
+ */
27
+ export declare function resolveAnimate(raw: unknown): {
28
+ classes: string[];
29
+ style: string;
30
+ };
31
+ /** Named props that every component implicitly accepts (the universal channel). */
32
+ export declare const UNIVERSAL_PROP_NAMES: Set<string>;
33
+ export interface UniversalProps {
34
+ sx?: unknown;
35
+ animate?: unknown;
36
+ id?: unknown;
37
+ anchor?: unknown;
38
+ className?: unknown;
39
+ class?: unknown;
40
+ style?: unknown;
41
+ aria?: unknown;
42
+ data?: unknown;
43
+ tooltip?: unknown;
44
+ hidden?: unknown;
45
+ }
46
+ /**
47
+ * Apply the universal-prop channel to a rendered element. Merges with any
48
+ * inline style/classes the component already set. Safe to call with a
49
+ * non-Element (no-ops) and with an empty `universal` (no-ops).
50
+ */
51
+ export declare function applyUniversal(node: Node, universal: UniversalProps | null | undefined): void;
@@ -61,6 +61,56 @@ export declare function findPositionalProp(spec: ComponentSpec): PropSpec | unde
61
61
  * library never ships a contradictory spec.
62
62
  */
63
63
  export declare function assertOnePositionalMax(specs: ReadonlyArray<ComponentSpec>): void;
64
+ /**
65
+ * Minimal shape of one call argument for binding decisions: `objectKeys`
66
+ * is the list of non-spread literal keys when the argument is an object
67
+ * literal, `null` for every other expression kind.
68
+ */
69
+ export interface CallArgShape {
70
+ objectKeys: ReadonlyArray<string> | null;
71
+ }
72
+ /** True when a prop's declared type can accept a plain-object payload. */
73
+ export declare function propExpectsObject(prop: PropSpec): boolean;
74
+ /** Prop names + aliases (the names a named-props object may use), plus `key`. */
75
+ export declare function knownPropNames(spec: ComponentSpec): Set<string>;
76
+ /**
77
+ * The slot the `n`-th (0-based) positional argument binds to, mirroring the
78
+ * runtime: positional #0 → the `positional: true` slot (or slot 0), every
79
+ * later positional → the next unfilled slot in declaration order. `null`
80
+ * when the call has more positionals than the spec has props.
81
+ */
82
+ export declare function slotForNthPositional(spec: ComponentSpec, n: number): PropSpec | null;
83
+ /**
84
+ * Decide which argument of a library-component call is the named-props
85
+ * object. Returns the argument index, or `-1` when every argument is
86
+ * positional. The rules, in order:
87
+ *
88
+ * 1. Single object argument, one-prop component → the object is the
89
+ * prop's payload when that prop accepts an object; otherwise it is
90
+ * named props exactly when all keys are known prop names.
91
+ * 2. Single object argument, multi-prop component → named props when all
92
+ * keys are known; a payload for an object-typed positional slot when
93
+ * none are; otherwise assume named props so validation can flag the
94
+ * unknown keys.
95
+ * 3. Multiple arguments — the LAST object literal is the candidate:
96
+ * in trailing position it is the named-props object (the canonical
97
+ * form) unless none of its keys are known and the slot it would fill
98
+ * expects an object; in leading/middle position (legacy
99
+ * `Grid({cols: 12}, [...])`) it is named props only when at least one
100
+ * key is a known prop name.
101
+ *
102
+ * A single object is never split between roles — it is wholly named props
103
+ * or wholly a positional payload.
104
+ */
105
+ export declare function chooseNamedBagIndex(args: ReadonlyArray<CallArgShape>, spec: ComponentSpec): number;
106
+ /** Build `CallArgShape`s from AST call arguments (parser `Expression`s). */
107
+ export declare function callArgShapes(args: ReadonlyArray<{
108
+ kind: string;
109
+ properties?: ReadonlyArray<{
110
+ spread?: unknown;
111
+ key: string;
112
+ }>;
113
+ }>): CallArgShape[];
64
114
  /**
65
115
  * Stable, component-local state slot. Returned by
66
116
  * `RenderHelpers.useInstanceState`. Keep the reference for the lifetime of
@@ -6,6 +6,34 @@ export declare function asArray<T>(value: unknown): T[];
6
6
  export declare function asString(value: unknown, fallback?: string): string;
7
7
  export declare function asBoolean(value: unknown, fallback?: boolean): boolean;
8
8
  export declare function asNumber(value: unknown, fallback?: number): number;
9
+ /**
10
+ * Canonical t-shirt spacing scale shared by every `gap`/`padding`/`margin`/
11
+ * spacing-ish prop. `none` always resolves to `0`. Ordered smallest → largest
12
+ * so the list reads naturally in docs and error messages.
13
+ */
14
+ export declare const SPACING_TOKENS: readonly ["none", "3xs", "2xs", "xs", "sm", "md", "lg", "xl", "2xl", "3xl"];
15
+ export type SpacingToken = typeof SPACING_TOKENS[number];
16
+ /**
17
+ * Legacy t-shirt spellings still accepted at runtime and in validation but no
18
+ * longer advertised in prop enums: the early single-letter spacing dialect
19
+ * (`s`/`m`/`l`) and the verbose Button sizes (`small`/`normal`/`large`).
20
+ */
21
+ export declare const LEGACY_SIZE_TOKEN_ALIASES: Record<string, string>;
22
+ /** Map a size token to its canonical spelling (`m` → `md`); other values pass through. */
23
+ export declare function canonicalSizeToken(value: unknown): string;
24
+ /**
25
+ * Normalise a spacing prop value to a canonical {@link SPACING_TOKENS} entry.
26
+ * Legacy aliases canonicalise first; anything outside the scale returns
27
+ * `fallback` so callers can keep their historical defaults.
28
+ */
29
+ export declare function normalizeSpacingToken(value: unknown, fallback?: string): string;
30
+ /**
31
+ * Resolve a spacing token (canonical or legacy) to its CSS value: `none` → `0`,
32
+ * everything else → the matching `var(--rui-spacing-*)`. The stylesheet keeps
33
+ * the historical short variable names for `sm`/`md`/`lg` (`--rui-spacing-s/m/l`)
34
+ * so existing theme overrides keep working. Unknown tokens return "".
35
+ */
36
+ export declare function spacingCssValue(value: unknown): string;
9
37
  /**
10
38
  * Breakpoint keys honoured by responsive prop maps (Grid columns, Stack
11
39
  * direction, etc.). Ordered from narrow → wide so CSS only needs to chain
@@ -21,7 +21,7 @@ export declare function validateProgram(source: string, library: ComponentLibrar
21
21
  *
22
22
  * - produces a parser-level migration error at parse time, or
23
23
  * - produces a schema-validator error here when library knowledge is
24
- * required (multi-positional calls, unknown props, enum mismatches,
25
- * legacy Theme tokens, …).
24
+ * required (positional arity overflows, unknown props, enum
25
+ * mismatches, built-in-name collisions, legacy Theme tokens, …).
26
26
  */
27
27
  export declare function validateProgramSchema(program: Program, library: ComponentLibrary): ParseError[];