@0xbuff/throughline 0.0.0-stage → 0.0.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,26 @@
1
+ # Changelog
2
+
3
+ Notable changes to Throughline are recorded here. Package versions follow
4
+ Semantic Versioning independently of the version-1 trace and program schemas.
5
+
6
+ ## [0.0.2] — 2026-11-08
7
+
8
+ ### Changed
9
+
10
+ - Updated the npm package homepage to the Throughline documentation site.
11
+ - Refined installation, styling, security and maintenance documentation.
12
+ - Replaced first-release-specific staging logic with reusable, version-checked
13
+ signed-tag and provenance publishing.
14
+ - Removed obsolete public-release planning records and excluded source-only
15
+ development documentation from the npm tarball.
16
+
17
+ ## [0.0.1] — 2026-11-08
18
+
19
+ Initial public release:
20
+
21
+ - Deterministic, bounded Markdown-authored state-trace compiler.
22
+ - Version-1 `Program` and `Trace` with diagnostics and deterministic seeking.
23
+ - Flow, bindings, binary, matrix and callstack domains.
24
+ - Optional React 19 player with keyboard playback, captions, state inspector,
25
+ responsive layouts, reduced-motion support and opt-in sound.
26
+ - Four explicit typed ESM/CSS exports, Apache-2.0 license and 0xBUFF attribution.
package/COPYRIGHT.md ADDED
@@ -0,0 +1,8 @@
1
+ # Copyright and license
2
+
3
+ Copyright 2026 0xBUFF.
4
+
5
+ Throughline is licensed under the Apache License, Version 2.0.
6
+ See [LICENSE](LICENSE) for the full terms.
7
+
8
+ Third-party dependencies retain their respective licenses and notices.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,190 @@
1
- # Temporary Holding Version
1
+ # Throughline
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Readable state over time, authored in Markdown.**
4
+
5
+ Throughline compiles small, explanatory state traces into deterministic,
6
+ versioned snapshots. Its optional React player makes each change visible as
7
+ a step-by-step SVG scene—with keyboard controls, accessible descriptions,
8
+ responsive layouts and opt-in sound.
9
+
10
+ Use it to explain what changes during an algorithm, a data-structure
11
+ operation, a recursive call or a system workflow. Throughline does not
12
+ execute arbitrary code or require an account, server, network connection
13
+ or application-specific runtime.
14
+
15
+ ## Features
16
+
17
+ - **Author in Markdown:** write a `thl` code fence with explicit, named steps.
18
+ - **Deterministic snapshots:** compile once, then seek through immutable
19
+ frames without re-running the authored program.
20
+ - **Five supported domains:** hand-authored `flow`, reference `bindings`,
21
+ `binary` addition, `matrix` multiplication and recursive `callstack`.
22
+ - **React is optional:** use the pure compiler from Node or other ESM
23
+ environments without loading React or browser globals.
24
+ - **Accessible playback:** keyboard navigation, step captions, a state
25
+ inspector, reduced-motion support and explicit CSS/theme controls.
26
+ - **Bounded by design:** source, state, event and expansion limits provide
27
+ predictable rejection rather than uncontrolled trace growth.
28
+
29
+ ## Installation
30
+
31
+ Install the package from npm:
32
+
33
+ ~~~sh
34
+ npm install @0xbuff/throughline
35
+ ~~~
36
+
37
+ For the optional React player, use React 19 and React DOM 19 in the
38
+ consuming application:
39
+
40
+ ~~~sh
41
+ npm install react@^19 react-dom@^19
42
+ ~~~
43
+
44
+ The package targets Node.js 24 or later, uses ESM and ships TypeScript
45
+ declarations. React is not required for the root compiler import.
46
+
47
+ ## Quick start
48
+
49
+ ### Compile a trace
50
+
51
+ ~~~ts
52
+ import { compile } from "@0xbuff/throughline";
53
+
54
+ const source = [
55
+ "```thl flow",
56
+ 'node counter "Counter" = 0',
57
+ 'step "Increment"',
58
+ " set counter = 1",
59
+ " focus counter",
60
+ ' note "Counter now holds one."',
61
+ "```",
62
+ ].join("\n");
63
+
64
+ const trace = compile(source);
65
+
66
+ // Frame 0 contains the initial state; later frames capture authored steps.
67
+ console.log(trace.version); // 1
68
+ console.log(trace.frames.length); // 2
69
+ ~~~
70
+
71
+ A `thl flow` block declares entities and relationships first, followed by
72
+ named steps using operations such as `set`, `focus`, `note`, `send`,
73
+ `show` and `hide`. Markdown fences are optional when calling `compile`
74
+ directly, but each source must identify its `thl` domain.
75
+
76
+ ### Render it with React
77
+
78
+ ~~~tsx
79
+ import { compile } from "@0xbuff/throughline";
80
+ import { EXAMPLES } from "@0xbuff/throughline/examples";
81
+ import { ThroughlinePlayer } from "@0xbuff/throughline/react";
82
+ import "@0xbuff/throughline/styles/throughline.css";
83
+
84
+ const trace = compile(EXAMPLES[0].source);
85
+
86
+ export function TraceDemo() {
87
+ return <ThroughlinePlayer trace={trace} theme="auto" />;
88
+ }
89
+ ~~~
90
+
91
+ Import the optional stylesheet once in the host application. The player accepts
92
+ `light`, `dark` or `auto` themes and supports `--thl-*` CSS variables.
93
+ Override those variables using the player's `className` prop and a host
94
+ stylesheet loaded after the package CSS. A complete custom stylesheet is
95
+ also possible, but must provide the required layout and accessibility styles.
96
+ Pass a stable trace reference while stepping; replacing it resets playback.
97
+ Audio controls are absent unless you explicitly supply `sonification`.
98
+
99
+ ## Supported domains
100
+
101
+ | Domain | What it explains | Authoring model |
102
+ | --- | --- | --- |
103
+ | `flow` | State, relationships and changes | Explicit nodes, links and steps |
104
+ | `bindings` | Primitives, references, mutation and rebinding | Small assignment/push language |
105
+ | `binary` | Ripple-carry binary addition | Two unsigned binary operands |
106
+ | `matrix` | Matrix multiplication | Two small compatible matrices |
107
+ | `callstack` | Recursive factorial calls and returns | A bounded factorial input |
108
+
109
+ All five domains produce the same version-1 trace shape. Domains are
110
+ intentionally limited; Throughline is not a general-purpose JavaScript
111
+ interpreter or an automatic execution tracer.
112
+
113
+ ## Public package exports
114
+
115
+ | Import path | Contents |
116
+ | --- | --- |
117
+ | `@0xbuff/throughline` | Core compiler, parser, types, validation, tracer |
118
+ | `@0xbuff/throughline/react` | Optional `ThroughlinePlayer` and React types |
119
+ | `@0xbuff/throughline/examples` | Copyable authored fixtures |
120
+ | `@0xbuff/throughline/styles/throughline.css` | Opt-in, namespaced CSS |
121
+
122
+ Only these four entry points are supported; importing from package
123
+ `src/` or `dist/` paths is not part of the API. The compiler is
124
+ React-free, network-free and usable in offline tooling.
125
+
126
+ ## How it works
127
+
128
+ 1. **Parse:** `compile` reads one `thl <domain>` block, preserving useful
129
+ source-line information for diagnostics.
130
+ 2. **Build:** `flow` is parsed into an authored program; computed domains
131
+ construct the same program model from bounded input parameters.
132
+ 3. **Validate and compile:** the engine rejects invalid references, JSON
133
+ values, conflicting writes and excessive work, then produces an initial
134
+ frame plus a snapshot for each step.
135
+ 4. **Present (optional):** the React player uses the compiled frames to
136
+ render a responsive scene, controls, captions and an inspectable state.
137
+ Seeking a frame does not execute the source a second time.
138
+
139
+ Trace schema version `1` is independent of the npm package version.
140
+ Source length is capped at 262,144 UTF-16 code units; the authored
141
+ program is limited to 200 entities, 1,000 relations, 2,000 steps and
142
+ 10,000 events, plus work/expansion budgets. These limits are for
143
+ deterministic work, not a guarantee of exact heap or CPU usage.
144
+
145
+ For the complete guide, see the [Throughline documentation](https://docs.0xbuff.com/docs/throughline) and the [architecture notes](https://github.com/0xbuffdev/throughline/blob/main/docs/architecture.md).
146
+
147
+ ## Documentation
148
+
149
+ - [Throughline documentation](https://docs.0xbuff.com/docs/throughline)
150
+ - [Grammar and authored flow](https://github.com/0xbuffdev/throughline/blob/main/docs/grammar.md)
151
+ - [Domain catalog and domain-specific limits](https://github.com/0xbuffdev/throughline/blob/main/docs/catalog.md)
152
+ - [Architecture, trace format and runtime boundaries](https://github.com/0xbuffdev/throughline/blob/main/docs/architecture.md)
153
+ - [Adding a computed domain](https://github.com/0xbuffdev/throughline/blob/main/docs/authoring.md)
154
+ - [Changelog](https://github.com/0xbuffdev/throughline/blob/main/CHANGELOG.md)
155
+
156
+ ## Development
157
+
158
+ The source is a standalone Node 24 / pnpm 11.2.2 package, not a
159
+ multi-package workspace.
160
+
161
+ ~~~sh
162
+ pnpm install --frozen-lockfile
163
+ pnpm audit:source
164
+ pnpm typecheck
165
+ pnpm test:run
166
+ pnpm exec playwright install chromium
167
+ pnpm test:browser:run
168
+ pnpm build
169
+ pnpm audit:licenses
170
+ pnpm audit:pack
171
+ pnpm audit:browser
172
+ ~~~
173
+
174
+ The packed-consumer audits install the built archive into independent
175
+ Node, TypeScript, React SSR and Vite/browser environments.
176
+
177
+ ## Community
178
+
179
+ Read [contributing guidelines](https://github.com/0xbuffdev/throughline/blob/main/CONTRIBUTING.md) before opening a PR.
180
+ Use [GitHub issues](https://github.com/0xbuffdev/throughline/issues)
181
+ for reproducible bugs and feature proposals; see
182
+ [SUPPORT.md](https://github.com/0xbuffdev/throughline/blob/main/SUPPORT.md) for support and [SECURITY.md](https://github.com/0xbuffdev/throughline/blob/main/SECURITY.md)
183
+ for confidential vulnerability reports. Participation is governed by
184
+ the [code of conduct](https://github.com/0xbuffdev/throughline/blob/main/CODE_OF_CONDUCT.md).
185
+
186
+ ## License
187
+
188
+ Licensed under [Apache-2.0](https://github.com/0xbuffdev/throughline/blob/main/LICENSE).
189
+ Copyright 2026 0xBUFF; see [COPYRIGHT.md](https://github.com/0xbuffdev/throughline/blob/main/COPYRIGHT.md).
190
+ The license covers software rights under its terms, not trademark use.
@@ -0,0 +1,138 @@
1
+ // src/path.ts
2
+ const TARGET = /^([A-Za-z][\w-]*)((?:\[\d+\]|\.[A-Za-z_][\w-]*)*)$/;
3
+ const BLOCKED = /* @__PURE__ */ new Set([
4
+ "__proto__",
5
+ "constructor",
6
+ "prototype"
7
+ ]);
8
+ function parseTarget(text) {
9
+ const match = TARGET.exec(text);
10
+ if (!match) return null;
11
+ const path = [];
12
+ for (const part of match[2].matchAll(/\[(\d+)\]|\.([A-Za-z_][\w-]*)/g)) path.push(part[1] !== void 0 ? Number(part[1]) : part[2]);
13
+ if (path.some((key) => typeof key === "string" && BLOCKED.has(key))) return null;
14
+ return {
15
+ id: match[1],
16
+ path
17
+ };
18
+ }
19
+ const overlaps = (a, b) => a.slice(0, Math.min(a.length, b.length)).every((key, index) => key === b[index]);
20
+ function getAt(value, path) {
21
+ let current = value;
22
+ for (const key of path) {
23
+ if (typeof key === "number") current = Array.isArray(current) ? current[key] : void 0;
24
+ else current = current !== null && typeof current === "object" && !Array.isArray(current) && Object.hasOwn(current, key) ? current[key] : void 0;
25
+ if (current === void 0) return void 0;
26
+ }
27
+ return current;
28
+ }
29
+ /** Immutable write. Arrays may grow by exactly one (index === length); records may gain keys. */
30
+ function setAt(value, path, next) {
31
+ if (!path.length) return next;
32
+ const [head, ...rest] = path;
33
+ if (typeof head === "number") {
34
+ if (!Array.isArray(value)) throw new Error(`Cannot index [${head}] into a non-array value.`);
35
+ if (head > value.length) throw new Error(`Index [${head}] is out of range (length ${value.length}).`);
36
+ const copy = value.slice();
37
+ copy[head] = setAt(head === value.length ? null : value[head], rest, next);
38
+ return copy;
39
+ }
40
+ if (value === null || typeof value !== "object" || Array.isArray(value)) throw new Error(`Cannot read .${head} from a non-record value.`);
41
+ return {
42
+ ...value,
43
+ [head]: setAt(Object.hasOwn(value, head) ? value[head] : null, rest, next)
44
+ };
45
+ }
46
+ // src/layout/measure.ts
47
+ const format = (value) => typeof value === "string" ? value : JSON.stringify(value);
48
+ /** A node's requested view if the value supports it, otherwise the best fit. Evaluated per frame. */
49
+ function effectiveView(view, value) {
50
+ const guess = () => Array.isArray(value) ? value.length > 0 && value.every((row) => Array.isArray(row)) ? "matrix" : "array" : typeof value === "number" ? "number" : value !== null && typeof value === "object" ? "record" : "text";
51
+ switch (view) {
52
+ case "array":
53
+ case "stack": return Array.isArray(value) ? view : guess();
54
+ case "matrix": return Array.isArray(value) && value.every((row) => Array.isArray(row)) ? "matrix" : guess();
55
+ case "bits": return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? "bits" : guess();
56
+ case "record": return value !== null && typeof value === "object" && !Array.isArray(value) ? "record" : guess();
57
+ case "number": return typeof value === "number" ? "number" : guess();
58
+ case "text": return "text";
59
+ default: return guess();
60
+ }
61
+ }
62
+ // src/scene.ts
63
+ /** Hidden endpoints suppress their links without destroying either identity. */
64
+ function visibleScene(state) {
65
+ const entities = state.entities.filter((entity) => !entity.hidden);
66
+ const ids = new Set(entities.map((entity) => entity.id));
67
+ return {
68
+ entities,
69
+ relations: state.relations.filter((relation) => !relation.hidden && ids.has(relation.from) && ids.has(relation.to))
70
+ };
71
+ }
72
+ // src/describe.ts
73
+ /**
74
+ * Semantic summary: one screen-reader-navigable paragraph per frame.
75
+ * The player voices this through a live region and the scene's
76
+ * accessible name, so the trace never depends on vision alone.
77
+ */
78
+ const entityValue = (frame, id) => frame.state.entities.find((entity) => entity.id === id)?.value;
79
+ /** `input[0]` reads as its addressed value; whole ids read as labels. */
80
+ function changedSummary(frame, target) {
81
+ const parsed = parseTarget(target);
82
+ if (!parsed) return target;
83
+ const value = entityValue(frame, parsed.id);
84
+ if (value === void 0) return target;
85
+ const current = parsed.path.length ? getAt(value, parsed.path) : value;
86
+ if (current === void 0) return target;
87
+ return `${parsed.path.length ? target : frame.state.entities.find((entity) => entity.id === parsed.id)?.label ?? parsed.id} is ${format(current)}`;
88
+ }
89
+ const transferSummary = (frame, relation, value) => {
90
+ const known = frame.state.relations.find((candidate) => candidate.id === relation);
91
+ const what = value === void 0 ? "a signal" : format(value);
92
+ if (!known) return `Send ${what} along ${relation}.`;
93
+ return `Send ${what} along ${relation}${known.label ? ` (${known.label})` : ""} from ${known.from} to ${known.to}.`;
94
+ };
95
+ /**
96
+ * One paragraph naming the step position, label, changed values,
97
+ * focus targets, transfers, and author notes. Deterministic: the
98
+ * same frame always reads the same way.
99
+ */
100
+ function describeFrame(frame, total) {
101
+ const count = total ?? frame.index + 1;
102
+ const parts = [`Step ${frame.index + 1} of ${count}: ${frame.label}.`];
103
+ const { state } = frame;
104
+ const scene = visibleScene(state);
105
+ const visible = scene.entities;
106
+ const visibleIds = new Set(visible.map((entity) => entity.id));
107
+ const hiddenIds = new Set(state.entities.filter((entity) => entity.hidden).map((entity) => entity.id));
108
+ const shownTarget = (target) => !hiddenIds.has(parseTarget(target)?.id ?? "");
109
+ const changed = state.changed.filter(shownTarget);
110
+ const active = state.active.filter(shownTarget);
111
+ if (visible.length === 0 && frame.events.length === 0) {
112
+ parts.push("No entities.");
113
+ return parts.join(" ");
114
+ }
115
+ if (frame.index === 0 && state.changed.length === 0 && state.transfers.length === 0 && state.notes.length === 0 && state.active.length === 0) {
116
+ parts.push(`${visible.map((entity) => `${entity.label} is ${format(entity.value)}`).join("; ")}.`);
117
+ return parts.join(" ");
118
+ }
119
+ for (const event of frame.events) {
120
+ if (event.op !== "show" && event.op !== "hide") continue;
121
+ const item = event.kind === "node" ? state.entities.find((entity) => entity.id === event.id) : state.relations.find((relation) => relation.id === event.id);
122
+ if (event.op === "show" && !(event.kind === "node" ? visibleIds.has(event.id) : scene.relations.some((relation) => relation.id === event.id))) continue;
123
+ parts.push(`${event.op === "show" ? "Show" : "Hide"} ${item?.label ?? event.id}.`);
124
+ if (event.op === "show" && event.kind === "node" && !changed.some((target) => parseTarget(target)?.id === event.id)) parts.push(`${changedSummary(frame, event.id)}.`);
125
+ if (event.op === "show" && event.kind === "link") {
126
+ const relation = scene.relations.find((candidate) => candidate.id === event.id);
127
+ if (relation) parts.push(`From ${relation.from} to ${relation.to}.`);
128
+ }
129
+ }
130
+ if (changed.length > 0) parts.push(`${changed.map((target) => changedSummary(frame, target)).join("; ")}.`);
131
+ if (active.length > 0) parts.push(`Focus on ${active.join(", ")}.`);
132
+ for (const transfer of state.transfers) parts.push(transferSummary(frame, transfer.relation, transfer.value));
133
+ if (state.notes.length > 0) parts.push(state.notes.join(" "));
134
+ return parts.join(" ");
135
+ }
136
+ export { getAt as a, setAt as c, format as i, visibleScene as n, overlaps as o, effectiveView as r, parseTarget as s, describeFrame as t };
137
+
138
+ //# sourceMappingURL=describe-ZC7v_r7z.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describe-ZC7v_r7z.js","names":[],"sources":["../src/path.ts","../src/layout/measure.ts","../src/scene.ts","../src/describe.ts"],"sourcesContent":["import type { Value } from \"./model.js\";\n\nexport type Path = (string | number)[];\nexport type Target = { id: string; path: Path };\n\nconst TARGET = /^([A-Za-z][\\w-]*)((?:\\[\\d+\\]|\\.[A-Za-z_][\\w-]*)*)$/;\nconst BLOCKED = new Set([\"__proto__\", \"constructor\", \"prototype\"]);\n\nexport function parseTarget(text: string): Target | null {\n\tconst match = TARGET.exec(text);\n\tif (!match) return null;\n\tconst path: Path = [];\n\tfor (const part of match[2].matchAll(/\\[(\\d+)\\]|\\.([A-Za-z_][\\w-]*)/g))\n\t\tpath.push(part[1] !== undefined ? Number(part[1]) : part[2]);\n\tif (path.some((key) => typeof key === \"string\" && BLOCKED.has(key)))\n\t\treturn null;\n\treturn { id: match[1], path };\n}\n\nexport const overlaps = (a: Path, b: Path) =>\n\ta\n\t\t.slice(0, Math.min(a.length, b.length))\n\t\t.every((key, index) => key === b[index]);\n\nexport function getAt(value: Value | undefined, path: Path): Value | undefined {\n\tlet current = value;\n\tfor (const key of path) {\n\t\tif (typeof key === \"number\")\n\t\t\tcurrent = Array.isArray(current) ? current[key] : undefined;\n\t\telse\n\t\t\tcurrent =\n\t\t\t\tcurrent !== null &&\n\t\t\t\ttypeof current === \"object\" &&\n\t\t\t\t!Array.isArray(current) &&\n\t\t\t\tObject.hasOwn(current, key)\n\t\t\t\t\t? current[key]\n\t\t\t\t\t: undefined;\n\t\tif (current === undefined) return undefined;\n\t}\n\treturn current;\n}\n\n/** Immutable write. Arrays may grow by exactly one (index === length); records may gain keys. */\nexport function setAt(value: Value, path: Path, next: Value): Value {\n\tif (!path.length) return next;\n\tconst [head, ...rest] = path;\n\tif (typeof head === \"number\") {\n\t\tif (!Array.isArray(value))\n\t\t\tthrow new Error(`Cannot index [${head}] into a non-array value.`);\n\t\tif (head > value.length)\n\t\t\tthrow new Error(\n\t\t\t\t`Index [${head}] is out of range (length ${value.length}).`,\n\t\t\t);\n\t\tconst copy = value.slice();\n\t\tcopy[head] = setAt(head === value.length ? null : value[head], rest, next);\n\t\treturn copy;\n\t}\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value))\n\t\tthrow new Error(`Cannot read .${head} from a non-record value.`);\n\treturn {\n\t\t...value,\n\t\t[head]: setAt(Object.hasOwn(value, head) ? value[head] : null, rest, next),\n\t};\n}\n","import type { Value, View } from \"../model.js\";\n\ntype Shown = Exclude<View, \"auto\">;\n\nexport const format = (value: Value): string =>\n\ttypeof value === \"string\" ? value : JSON.stringify(value);\n\n/** A node's requested view if the value supports it, otherwise the best fit. Evaluated per frame. */\nexport function effectiveView(view: View | undefined, value: Value): Shown {\n\tconst guess = (): Shown =>\n\t\tArray.isArray(value)\n\t\t\t? value.length > 0 && value.every((row) => Array.isArray(row))\n\t\t\t\t? \"matrix\"\n\t\t\t\t: \"array\"\n\t\t\t: typeof value === \"number\"\n\t\t\t\t? \"number\"\n\t\t\t\t: value !== null && typeof value === \"object\"\n\t\t\t\t\t? \"record\"\n\t\t\t\t\t: \"text\";\n\tswitch (view) {\n\t\tcase \"array\":\n\t\tcase \"stack\":\n\t\t\treturn Array.isArray(value) ? view : guess();\n\t\tcase \"matrix\":\n\t\t\treturn Array.isArray(value) && value.every((row) => Array.isArray(row))\n\t\t\t\t? \"matrix\"\n\t\t\t\t: guess();\n\t\tcase \"bits\":\n\t\t\treturn typeof value === \"number\" &&\n\t\t\t\tNumber.isSafeInteger(value) &&\n\t\t\t\tvalue >= 0\n\t\t\t\t? \"bits\"\n\t\t\t\t: guess();\n\t\tcase \"record\":\n\t\t\treturn value !== null &&\n\t\t\t\ttypeof value === \"object\" &&\n\t\t\t\t!Array.isArray(value)\n\t\t\t\t? \"record\"\n\t\t\t\t: guess();\n\t\tcase \"number\":\n\t\t\treturn typeof value === \"number\" ? \"number\" : guess();\n\t\tcase \"text\":\n\t\t\treturn \"text\";\n\t\tdefault:\n\t\t\treturn guess();\n\t}\n}\n","import type { Snapshot } from \"./model.js\";\n\n/** Hidden endpoints suppress their links without destroying either identity. */\nexport function visibleScene(\n\tstate: Snapshot,\n): Pick<Snapshot, \"entities\" | \"relations\"> {\n\tconst entities = state.entities.filter((entity) => !entity.hidden);\n\tconst ids = new Set(entities.map((entity) => entity.id));\n\tconst relations = state.relations.filter(\n\t\t(relation) =>\n\t\t\t!relation.hidden && ids.has(relation.from) && ids.has(relation.to),\n\t);\n\treturn { entities, relations };\n}\n","import { format } from \"./layout.js\";\nimport type { Frame, Value } from \"./model.js\";\nimport { getAt, parseTarget } from \"./path.js\";\nimport { visibleScene } from \"./scene.js\";\n\n/**\n * Semantic summary: one screen-reader-navigable paragraph per frame.\n * The player voices this through a live region and the scene's\n * accessible name, so the trace never depends on vision alone.\n */\n\nconst entityValue = (frame: Frame, id: string): Value | undefined =>\n\tframe.state.entities.find((entity) => entity.id === id)?.value;\n\n/** `input[0]` reads as its addressed value; whole ids read as labels. */\nfunction changedSummary(frame: Frame, target: string): string {\n\tconst parsed = parseTarget(target);\n\tif (!parsed) return target;\n\tconst value = entityValue(frame, parsed.id);\n\tif (value === undefined) return target;\n\tconst current: Value | undefined = parsed.path.length\n\t\t? getAt(value, parsed.path)\n\t\t: value;\n\tif (current === undefined) return target;\n\tconst name = parsed.path.length\n\t\t? target\n\t\t: (frame.state.entities.find((entity) => entity.id === parsed.id)?.label ??\n\t\t\tparsed.id);\n\treturn `${name} is ${format(current)}`;\n}\n\nconst transferSummary = (frame: Frame, relation: string, value?: Value) => {\n\tconst known = frame.state.relations.find(\n\t\t(candidate) => candidate.id === relation,\n\t);\n\tconst what = value === undefined ? \"a signal\" : format(value);\n\tif (!known) return `Send ${what} along ${relation}.`;\n\tconst via = known.label ? ` (${known.label})` : \"\";\n\treturn `Send ${what} along ${relation}${via} from ${known.from} to ${known.to}.`;\n};\n\n/**\n * One paragraph naming the step position, label, changed values,\n * focus targets, transfers, and author notes. Deterministic: the\n * same frame always reads the same way.\n */\nexport function describeFrame(frame: Frame, total?: number): string {\n\tconst count = total ?? frame.index + 1;\n\tconst parts = [`Step ${frame.index + 1} of ${count}: ${frame.label}.`];\n\tconst { state } = frame;\n\tconst scene = visibleScene(state);\n\tconst visible = scene.entities;\n\tconst visibleIds = new Set(visible.map((entity) => entity.id));\n\tconst hiddenIds = new Set(\n\t\tstate.entities.filter((entity) => entity.hidden).map((entity) => entity.id),\n\t);\n\tconst shownTarget = (target: string): boolean =>\n\t\t!hiddenIds.has(parseTarget(target)?.id ?? \"\");\n\tconst changed = state.changed.filter(shownTarget);\n\tconst active = state.active.filter(shownTarget);\n\tif (visible.length === 0 && frame.events.length === 0) {\n\t\tparts.push(\"No entities.\");\n\t\treturn parts.join(\" \");\n\t}\n\tif (\n\t\tframe.index === 0 &&\n\t\tstate.changed.length === 0 &&\n\t\tstate.transfers.length === 0 &&\n\t\tstate.notes.length === 0 &&\n\t\tstate.active.length === 0\n\t) {\n\t\tparts.push(\n\t\t\t`${visible.map((entity) => `${entity.label} is ${format(entity.value)}`).join(\"; \")}.`,\n\t\t);\n\t\treturn parts.join(\" \");\n\t}\n\tfor (const event of frame.events) {\n\t\tif (event.op !== \"show\" && event.op !== \"hide\") continue;\n\t\tconst item =\n\t\t\tevent.kind === \"node\"\n\t\t\t\t? state.entities.find((entity) => entity.id === event.id)\n\t\t\t\t: state.relations.find((relation) => relation.id === event.id);\n\t\tif (\n\t\t\tevent.op === \"show\" &&\n\t\t\t!(event.kind === \"node\"\n\t\t\t\t? visibleIds.has(event.id)\n\t\t\t\t: scene.relations.some((relation) => relation.id === event.id))\n\t\t)\n\t\t\tcontinue;\n\t\tparts.push(\n\t\t\t`${event.op === \"show\" ? \"Show\" : \"Hide\"} ${item?.label ?? event.id}.`,\n\t\t);\n\t\tif (\n\t\t\tevent.op === \"show\" &&\n\t\t\tevent.kind === \"node\" &&\n\t\t\t!changed.some((target) => parseTarget(target)?.id === event.id)\n\t\t)\n\t\t\tparts.push(`${changedSummary(frame, event.id)}.`);\n\t\tif (event.op === \"show\" && event.kind === \"link\") {\n\t\t\tconst relation = scene.relations.find(\n\t\t\t\t(candidate) => candidate.id === event.id,\n\t\t\t);\n\t\t\tif (relation) parts.push(`From ${relation.from} to ${relation.to}.`);\n\t\t}\n\t}\n\tif (changed.length > 0)\n\t\tparts.push(\n\t\t\t`${changed.map((target) => changedSummary(frame, target)).join(\"; \")}.`,\n\t\t);\n\tif (active.length > 0) parts.push(`Focus on ${active.join(\", \")}.`);\n\tfor (const transfer of state.transfers)\n\t\tparts.push(transferSummary(frame, transfer.relation, transfer.value));\n\tif (state.notes.length > 0) parts.push(state.notes.join(\" \"));\n\treturn parts.join(\" \");\n}\n"],"mappings":";AAKA,MAAM,SAAS;AACf,MAAM,0BAAU,IAAI,IAAI;CAAC;CAAa;CAAe;AAAW,CAAC;AAEjE,SAAgB,YAAY,MAA6B;CACxD,MAAM,QAAQ,OAAO,KAAK,IAAI;CAC9B,IAAI,CAAC,OAAO,OAAO;CACnB,MAAM,OAAa,CAAC;CACpB,KAAK,MAAM,QAAQ,MAAM,EAAE,CAAC,SAAS,gCAAgC,GACpE,KAAK,KAAK,KAAK,OAAO,KAAA,IAAY,OAAO,KAAK,EAAE,IAAI,KAAK,EAAE;CAC5D,IAAI,KAAK,MAAM,QAAQ,OAAO,QAAQ,YAAY,QAAQ,IAAI,GAAG,CAAC,GACjE,OAAO;CACR,OAAO;EAAE,IAAI,MAAM;EAAI;CAAK;AAC7B;AAEA,MAAa,YAAY,GAAS,MACjC,EACE,MAAM,GAAG,KAAK,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CACtC,OAAO,KAAK,UAAU,QAAQ,EAAE,MAAM;AAEzC,SAAgB,MAAM,OAA0B,MAA+B;CAC9E,IAAI,UAAU;CACd,KAAK,MAAM,OAAO,MAAM;EACvB,IAAI,OAAO,QAAQ,UAClB,UAAU,MAAM,QAAQ,OAAO,IAAI,QAAQ,OAAO,KAAA;OAElD,UACC,YAAY,QACZ,OAAO,YAAY,YACnB,CAAC,MAAM,QAAQ,OAAO,KACtB,OAAO,OAAO,SAAS,GAAG,IACvB,QAAQ,OACR,KAAA;EACL,IAAI,YAAY,KAAA,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ance tests. */
2
+ export declare const EXAMPLES: readonly [{
3
+ readonly id: "reconciliation";
4
+ readonly title: "Reconciliation";
5
+ readonly description: "Compare keyed children, preserve identity, and prepare the changes to commit.";
6
+ readonly source: string;
7
+ }, {
8
+ readonly id: "references";
9
+ readonly title: "Shared references";
10
+ readonly description: "Copy a reference, mutate the shared object, then move one pointer.";
11
+ readonly source: string;
12
+ }, {
13
+ readonly id: "matrix";
14
+ readonly title: "Matrix multiplication";
15
+ readonly description: "Follow one row and one column to each output cell.";
16
+ readonly source: "```thl matrix\nA = [[1,2],[3,4]]\nB = [[5,6],[7,8]]\n```";
17
+ }];