@0xbuff/throughline 0.0.0-stage → 0.0.1
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 +27 -0
- package/COPYRIGHT.md +15 -0
- package/LICENSE +201 -0
- package/README.md +191 -2
- package/dist/describe-ZC7v_r7z.js +138 -0
- package/dist/describe-ZC7v_r7z.js.map +1 -0
- package/dist/examples.d.ts +17 -0
- package/dist/examples.js +70 -0
- package/dist/examples.js.map +1 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +1134 -0
- package/dist/index.js.map +1 -0
- package/dist/model-Dwy20ibD.d.ts +97 -0
- package/dist/react/index.d.ts +22 -0
- package/dist/react/index.js +810 -0
- package/dist/react/index.js.map +1 -0
- package/docs/architecture.md +93 -0
- package/docs/authoring.md +54 -0
- package/docs/catalog.md +96 -0
- package/docs/grammar.md +97 -0
- package/package.json +94 -3
- package/src/styles/throughline.css +77 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Notable externally observable changes are recorded here. Package
|
|
4
|
+
versions follow Semantic Versioning, independently of trace/program
|
|
5
|
+
schema version `1`.
|
|
6
|
+
|
|
7
|
+
## [0.0.1] — Prepared, not yet published
|
|
8
|
+
|
|
9
|
+
Initial proposed public release of Throughline.
|
|
10
|
+
|
|
11
|
+
### Included
|
|
12
|
+
|
|
13
|
+
- Deterministic, bounded authored-state trace compiler.
|
|
14
|
+
- Version-1 `Program` and `Trace` formats with source diagnostics and
|
|
15
|
+
deterministic frame seeking.
|
|
16
|
+
- Five supported domains: `flow`, `bindings`, `binary`, `matrix`,
|
|
17
|
+
and `callstack`.
|
|
18
|
+
- Optional React 19 player with keyboard playback, captions, state
|
|
19
|
+
inspection, responsive layouts, reduced motion and optional sound.
|
|
20
|
+
- Explicitly namespaced CSS, typed ESM exports and copyable examples.
|
|
21
|
+
- Independent Node, TypeScript, SSR, Chromium and Vite hydration tests.
|
|
22
|
+
- Apache-2.0 license and 0xBUFF attribution.
|
|
23
|
+
|
|
24
|
+
**Publication pending:** the npm package is not yet released.
|
|
25
|
+
Source-history clearance, legal-rights review, immutable release
|
|
26
|
+
revision, registry staging/provenance and maintainer approval remain
|
|
27
|
+
separate prerequisites.
|
package/COPYRIGHT.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Copyright and attribution
|
|
2
|
+
|
|
3
|
+
Throughline
|
|
4
|
+
|
|
5
|
+
Copyright 2026 0xBUFF
|
|
6
|
+
|
|
7
|
+
Throughline is licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE)
|
|
8
|
+
for its terms.
|
|
9
|
+
|
|
10
|
+
"0xBUFF" is the maintainer-designated project copyright attribution. This
|
|
11
|
+
notice does not represent that the brand is incorporated as a separate legal
|
|
12
|
+
entity, or that a transfer of underlying copyright title has occurred. The
|
|
13
|
+
maintainer must verify authorship, legal ownership and redistribution rights
|
|
14
|
+
before a public source or npm release. Third-party attribution obligations
|
|
15
|
+
are reviewed separately; no third-party code is bundled in this package.
|
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,192 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Throughline
|
|
2
2
|
|
|
3
|
-
|
|
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
|
+
> **Release status:** GitHub source is public and npm version `0.0.1`
|
|
16
|
+
> is prepared for release. Check the registry for actual publication and
|
|
17
|
+
> provenance; see [release operations](RELEASING.md).
|
|
18
|
+
> The historical private planning reference still needs review.
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- **Author in Markdown:** write a `thl` code fence with explicit, named steps.
|
|
23
|
+
- **Deterministic snapshots:** compile once, then seek through immutable
|
|
24
|
+
frames without re-running the authored program.
|
|
25
|
+
- **Five supported domains:** hand-authored `flow`, reference `bindings`,
|
|
26
|
+
`binary` addition, `matrix` multiplication and recursive `callstack`.
|
|
27
|
+
- **React is optional:** use the pure compiler from Node or other ESM
|
|
28
|
+
environments without loading React or browser globals.
|
|
29
|
+
- **Accessible playback:** keyboard navigation, step captions, a state
|
|
30
|
+
inspector, reduced-motion support and explicit CSS/theme controls.
|
|
31
|
+
- **Bounded by design:** source, state, event and expansion limits provide
|
|
32
|
+
predictable rejection rather than uncontrolled trace growth.
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
Once the first release is published to npm:
|
|
37
|
+
|
|
38
|
+
~~~sh
|
|
39
|
+
npm install @0xbuff/throughline
|
|
40
|
+
~~~
|
|
41
|
+
|
|
42
|
+
For the optional React player, use React 19 and React DOM 19 in the
|
|
43
|
+
consuming application:
|
|
44
|
+
|
|
45
|
+
~~~sh
|
|
46
|
+
npm install react@^19 react-dom@^19
|
|
47
|
+
~~~
|
|
48
|
+
|
|
49
|
+
The package targets Node.js 24 or later, uses ESM and ships TypeScript
|
|
50
|
+
declarations. React is not required for the root compiler import.
|
|
51
|
+
|
|
52
|
+
## Quick start
|
|
53
|
+
|
|
54
|
+
### Compile a trace
|
|
55
|
+
|
|
56
|
+
~~~ts
|
|
57
|
+
import { compile } from "@0xbuff/throughline";
|
|
58
|
+
|
|
59
|
+
const source = [
|
|
60
|
+
"```thl flow",
|
|
61
|
+
'node counter "Counter" = 0',
|
|
62
|
+
'step "Increment"',
|
|
63
|
+
" set counter = 1",
|
|
64
|
+
" focus counter",
|
|
65
|
+
' note "Counter now holds one."',
|
|
66
|
+
"```",
|
|
67
|
+
].join("\n");
|
|
68
|
+
|
|
69
|
+
const trace = compile(source);
|
|
70
|
+
|
|
71
|
+
// Frame 0 contains the initial state; later frames capture authored steps.
|
|
72
|
+
console.log(trace.version); // 1
|
|
73
|
+
console.log(trace.frames.length); // 2
|
|
74
|
+
~~~
|
|
75
|
+
|
|
76
|
+
A `thl flow` block declares entities and relationships first, followed by
|
|
77
|
+
named steps using operations such as `set`, `focus`, `note`, `send`,
|
|
78
|
+
`show` and `hide`. Markdown fences are optional when calling `compile`
|
|
79
|
+
directly, but each source must identify its `thl` domain.
|
|
80
|
+
|
|
81
|
+
### Render it with React
|
|
82
|
+
|
|
83
|
+
~~~tsx
|
|
84
|
+
import { compile } from "@0xbuff/throughline";
|
|
85
|
+
import { EXAMPLES } from "@0xbuff/throughline/examples";
|
|
86
|
+
import { ThroughlinePlayer } from "@0xbuff/throughline/react";
|
|
87
|
+
import "@0xbuff/throughline/styles/throughline.css";
|
|
88
|
+
|
|
89
|
+
const trace = compile(EXAMPLES[0].source);
|
|
90
|
+
|
|
91
|
+
export function TraceDemo() {
|
|
92
|
+
return <ThroughlinePlayer trace={trace} theme="auto" />;
|
|
93
|
+
}
|
|
94
|
+
~~~
|
|
95
|
+
|
|
96
|
+
Import the stylesheet once in the host application. The player accepts
|
|
97
|
+
`light`, `dark` or `auto` themes and supports `--thl-*` CSS variables.
|
|
98
|
+
Pass a stable trace reference while stepping; replacing it resets playback.
|
|
99
|
+
Audio controls are absent unless you explicitly supply `sonification`.
|
|
100
|
+
|
|
101
|
+
## Supported domains
|
|
102
|
+
|
|
103
|
+
| Domain | What it explains | Authoring model |
|
|
104
|
+
| --- | --- | --- |
|
|
105
|
+
| `flow` | State, relationships and changes | Explicit nodes, links and steps |
|
|
106
|
+
| `bindings` | Primitives, references, mutation and rebinding | Small assignment/push language |
|
|
107
|
+
| `binary` | Ripple-carry binary addition | Two unsigned binary operands |
|
|
108
|
+
| `matrix` | Matrix multiplication | Two small compatible matrices |
|
|
109
|
+
| `callstack` | Recursive factorial calls and returns | A bounded factorial input |
|
|
110
|
+
|
|
111
|
+
All five domains produce the same version-1 trace shape. Domains are
|
|
112
|
+
intentionally limited; Throughline is not a general-purpose JavaScript
|
|
113
|
+
interpreter or an automatic execution tracer.
|
|
114
|
+
|
|
115
|
+
## Public package exports
|
|
116
|
+
|
|
117
|
+
| Import path | Contents |
|
|
118
|
+
| --- | --- |
|
|
119
|
+
| `@0xbuff/throughline` | Core compiler, parser, types, validation, tracer |
|
|
120
|
+
| `@0xbuff/throughline/react` | Optional `ThroughlinePlayer` and React types |
|
|
121
|
+
| `@0xbuff/throughline/examples` | Copyable authored fixtures |
|
|
122
|
+
| `@0xbuff/throughline/styles/throughline.css` | Opt-in, namespaced CSS |
|
|
123
|
+
|
|
124
|
+
Only these four entry points are supported; importing from package
|
|
125
|
+
`src/` or `dist/` paths is not part of the API. The compiler is
|
|
126
|
+
React-free, network-free and usable in offline tooling.
|
|
127
|
+
|
|
128
|
+
## How it works
|
|
129
|
+
|
|
130
|
+
1. **Parse:** `compile` reads one `thl <domain>` block, preserving useful
|
|
131
|
+
source-line information for diagnostics.
|
|
132
|
+
2. **Build:** `flow` is parsed into an authored program; computed domains
|
|
133
|
+
construct the same program model from bounded input parameters.
|
|
134
|
+
3. **Validate and compile:** the engine rejects invalid references, JSON
|
|
135
|
+
values, conflicting writes and excessive work, then produces an initial
|
|
136
|
+
frame plus a snapshot for each step.
|
|
137
|
+
4. **Present (optional):** the React player uses the compiled frames to
|
|
138
|
+
render a responsive scene, controls, captions and an inspectable state.
|
|
139
|
+
Seeking a frame does not execute the source a second time.
|
|
140
|
+
|
|
141
|
+
Trace schema version `1` is separate from package version `0.0.1`.
|
|
142
|
+
Source length is capped at 262,144 UTF-16 code units; the authored
|
|
143
|
+
program is limited to 200 entities, 1,000 relations, 2,000 steps and
|
|
144
|
+
10,000 events, plus work/expansion budgets. These limits are for
|
|
145
|
+
deterministic work, not a guarantee of exact heap or CPU usage.
|
|
146
|
+
|
|
147
|
+
For technical details, see the [architecture notes](docs/architecture.md).
|
|
148
|
+
|
|
149
|
+
## Documentation
|
|
150
|
+
|
|
151
|
+
- [Grammar and authored flow](docs/grammar.md)
|
|
152
|
+
- [Domain catalog and domain-specific limits](docs/catalog.md)
|
|
153
|
+
- [Architecture, trace format and runtime boundaries](docs/architecture.md)
|
|
154
|
+
- [Adding a computed domain](docs/authoring.md)
|
|
155
|
+
- [Changelog](CHANGELOG.md)
|
|
156
|
+
|
|
157
|
+
## Development
|
|
158
|
+
|
|
159
|
+
The source is a standalone Node 24 / pnpm 11.2.2 package, not a
|
|
160
|
+
multi-package workspace.
|
|
161
|
+
|
|
162
|
+
~~~sh
|
|
163
|
+
pnpm install --frozen-lockfile
|
|
164
|
+
pnpm audit:source
|
|
165
|
+
pnpm typecheck
|
|
166
|
+
pnpm test:run
|
|
167
|
+
pnpm exec playwright install chromium
|
|
168
|
+
pnpm test:browser:run
|
|
169
|
+
pnpm build
|
|
170
|
+
pnpm audit:licenses
|
|
171
|
+
pnpm audit:pack
|
|
172
|
+
pnpm audit:browser
|
|
173
|
+
~~~
|
|
174
|
+
|
|
175
|
+
The packed-consumer audits install the built archive into independent
|
|
176
|
+
Node, TypeScript, React SSR and Vite/browser environments. Build success
|
|
177
|
+
does not, by itself, authorize a public release.
|
|
178
|
+
|
|
179
|
+
## Community
|
|
180
|
+
|
|
181
|
+
Read [contributing guidelines](CONTRIBUTING.md) before opening a PR.
|
|
182
|
+
Use [GitHub issues](https://github.com/0xbuffdev/throughline/issues)
|
|
183
|
+
for reproducible bugs and feature proposals; see
|
|
184
|
+
[SUPPORT.md](SUPPORT.md) for support and [SECURITY.md](SECURITY.md)
|
|
185
|
+
for confidential vulnerability reports. Participation is governed by
|
|
186
|
+
the [code of conduct](CODE_OF_CONDUCT.md).
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
Licensed under [Apache-2.0](LICENSE).
|
|
191
|
+
Copyright 2026 0xBUFF; see [COPYRIGHT.md](COPYRIGHT.md).
|
|
192
|
+
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,KAA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GAAG,eAAe,OAAO,MAAM,EAAE,EAAE,EAAE;EACjD,IAAI,MAAM,OAAO,UAAU,MAAM,SAAS,QAAQ;GACjD,MAAM,WAAW,MAAM,UAAU,MAC/B,cAAc,UAAU,OAAO,MAAM,EACvC;GACA,IAAI,UAAU,MAAM,KAAK,QAAQ,SAAS,KAAK,MAAM,SAAS,GAAG,EAAE;EACpE;CACD;CACA,IAAI,QAAQ,SAAS,GACpB,MAAM,KACL,GAAG,QAAQ,KAAK,WAAW,eAAe,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,EACtE;CACD,IAAI,OAAO,SAAS,GAAG,MAAM,KAAK,YAAY,OAAO,KAAK,IAAI,EAAE,EAAE;CAClE,KAAK,MAAM,YAAY,MAAM,WAC5B,MAAM,KAAK,gBAAgB,OAAO,SAAS,UAAU,SAAS,KAAK,CAAC;CACrE,IAAI,MAAM,MAAM,SAAS,GAAG,MAAM,KAAK,MAAM,MAAM,KAAK,GAAG,CAAC;CAC5D,OAAO,MAAM,KAAK,GAAG;AACtB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Copyable sources shared by the gallery, editor and compiler acceptance 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
|
+
}];
|