reflex-quant 1.2.0 → 1.3.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/README.md +122 -52
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.cts +26 -6
- package/dist/index.d.ts +26 -6
- package/dist/index.development.cjs +156 -73
- package/dist/index.development.cjs.map +3 -3
- package/dist/index.development.js +156 -73
- package/dist/index.development.js.map +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# ⚛ reflex-quant
|
|
4
4
|
|
|
5
|
-
**
|
|
6
|
-
Signals, computeds and effects that update exactly what changed, nothing more.
|
|
5
|
+
**A tiny, high-performance JavaScript signals library built for exact reactive semantics.**
|
|
7
6
|
|
|
8
7
|
[](https://www.npmjs.com/package/reflex-quant)
|
|
9
8
|
[](https://github.com/volynetstyle/reflex-quant/actions/workflows/ci.yml)
|
|
@@ -16,13 +15,25 @@ Signals, computeds and effects that update exactly what changed, nothing more.
|
|
|
16
15
|
|
|
17
16
|
</div>
|
|
18
17
|
|
|
18
|
+
Reflex Quant is a framework-agnostic fine-grained reactivity library for JavaScript
|
|
19
|
+
and TypeScript, with signals, computeds and effects in under 3 KB gzip. It combines
|
|
20
|
+
exact dynamic dependency tracking, glitch-free propagation, stack-safe graph traversal
|
|
21
|
+
and defined failure semantics. Its implementation was derived from a written
|
|
22
|
+
reactive contract and validated through differential testing.
|
|
23
|
+
|
|
24
|
+
In the [published JS Reactivity Benchmark snapshot](https://github.com/volynetstyle/js-reactivity-benchmark/blob/9a26a3bee200fe9610e19cc21e0b8e02730b5459/index.html)
|
|
25
|
+
from November 10, 2026, Quant 1.1.2 ranked first on the family-balanced core
|
|
26
|
+
score: 1.07× versus 1.20× for alien-signals 3.2.1. This is a result for that
|
|
27
|
+
workload set, not a claim that Quant wins every benchmark. The separate
|
|
28
|
+
[project CI suite](#performance) measures Quant 1.2.0.
|
|
29
|
+
|
|
19
30
|
```ts
|
|
20
|
-
import { signal, computed, effect,
|
|
31
|
+
import { signal, computed, effect, read, set } from "reflex-quant";
|
|
21
32
|
|
|
22
33
|
const count = signal(0);
|
|
23
|
-
const doubled = computed(() =>
|
|
34
|
+
const doubled = computed(() => read(count) * 2);
|
|
24
35
|
|
|
25
|
-
effect(() => console.log(`count=${
|
|
36
|
+
effect(() => console.log(`count=${read(count)} doubled=${read(doubled)}`));
|
|
26
37
|
// count=0 doubled=0
|
|
27
38
|
|
|
28
39
|
set(count, 1); // count=1 doubled=2
|
|
@@ -35,7 +46,7 @@ list dependencies by hand.
|
|
|
35
46
|
|
|
36
47
|
## Why quant?
|
|
37
48
|
|
|
38
|
-
-
|
|
49
|
+
- 🤏 **Tiny.** About 2.9 KB min+gzip for the whole library, and no dependencies.
|
|
39
50
|
- 🎯 **Exact.** Dependencies are whatever the last run actually read. Take a
|
|
40
51
|
branch and the old dependencies drop away. Write a value that nothing
|
|
41
52
|
currently reads and nothing reruns.
|
|
@@ -67,11 +78,11 @@ ESM and CommonJS builds are included, along with type declarations. It needs Nod
|
|
|
67
78
|
### 1. Signals hold values
|
|
68
79
|
|
|
69
80
|
```ts
|
|
70
|
-
import { signal,
|
|
81
|
+
import { signal, read, set, update } from "reflex-quant";
|
|
71
82
|
|
|
72
83
|
const name = signal("Ada");
|
|
73
84
|
|
|
74
|
-
|
|
85
|
+
read(name); // "Ada"
|
|
75
86
|
set(name, "Grace"); // replace
|
|
76
87
|
update(name, (n) => n.toUpperCase()); // derive from current: "GRACE"
|
|
77
88
|
```
|
|
@@ -88,14 +99,14 @@ const qty = signal(2);
|
|
|
88
99
|
let runs = 0;
|
|
89
100
|
const total = computed(() => {
|
|
90
101
|
runs++;
|
|
91
|
-
return
|
|
102
|
+
return read(price) * read(qty);
|
|
92
103
|
});
|
|
93
104
|
|
|
94
105
|
set(qty, 3);
|
|
95
106
|
set(qty, 5); // runs === 0: nobody asked yet
|
|
96
107
|
|
|
97
|
-
|
|
98
|
-
|
|
108
|
+
read(total); // 20, runs === 1
|
|
109
|
+
read(total); // 20, runs === 1: cached
|
|
99
110
|
```
|
|
100
111
|
|
|
101
112
|
### 3. Effects react to changes
|
|
@@ -110,7 +121,7 @@ import { effect, dispose } from "reflex-quant";
|
|
|
110
121
|
const room = signal("general");
|
|
111
122
|
|
|
112
123
|
const chat = effect(() => {
|
|
113
|
-
const r =
|
|
124
|
+
const r = read(room);
|
|
114
125
|
console.log("join", r);
|
|
115
126
|
return () => console.log("leave", r);
|
|
116
127
|
});
|
|
@@ -135,10 +146,10 @@ const first = signal("Ada");
|
|
|
135
146
|
const last = signal("Lovelace");
|
|
136
147
|
|
|
137
148
|
const displayName = computed(() =>
|
|
138
|
-
|
|
149
|
+
read(showFull) ? `${read(first)} ${read(last)}` : read(first),
|
|
139
150
|
);
|
|
140
151
|
|
|
141
|
-
effect(() => console.log(
|
|
152
|
+
effect(() => console.log(read(displayName))); // "Ada"
|
|
142
153
|
|
|
143
154
|
set(last, "Byron"); // (nothing: `last` isn't being read right now)
|
|
144
155
|
set(showFull, true); // "Ada Byron"
|
|
@@ -154,10 +165,10 @@ never sees a half-updated state:
|
|
|
154
165
|
```ts
|
|
155
166
|
const first = signal("Ada");
|
|
156
167
|
const last = signal("Lovelace");
|
|
157
|
-
const upper = computed(() =>
|
|
158
|
-
const initials = computed(() =>
|
|
168
|
+
const upper = computed(() => read(first).toUpperCase());
|
|
169
|
+
const initials = computed(() => read(first)[0] + read(last)[0]);
|
|
159
170
|
|
|
160
|
-
effect(() => console.log(`${
|
|
171
|
+
effect(() => console.log(`${read(upper)} (${read(initials)})`));
|
|
161
172
|
// ADA (AL)
|
|
162
173
|
|
|
163
174
|
set(first, "Grace");
|
|
@@ -171,9 +182,9 @@ put:
|
|
|
171
182
|
|
|
172
183
|
```ts
|
|
173
184
|
const n = signal(1);
|
|
174
|
-
const parity = computed(() => (
|
|
185
|
+
const parity = computed(() => (read(n) % 2 === 0 ? "even" : "odd"));
|
|
175
186
|
|
|
176
|
-
effect(() => console.log(
|
|
187
|
+
effect(() => console.log(read(parity))); // "odd"
|
|
177
188
|
|
|
178
189
|
set(n, 3); // (nothing: still "odd")
|
|
179
190
|
set(n, 4); // "even"
|
|
@@ -188,7 +199,7 @@ import { batch } from "reflex-quant";
|
|
|
188
199
|
|
|
189
200
|
const x = signal(0);
|
|
190
201
|
const y = signal(0);
|
|
191
|
-
effect(() => console.log(`(${
|
|
202
|
+
effect(() => console.log(`(${read(x)}, ${read(y)})`)); // (0, 0)
|
|
192
203
|
|
|
193
204
|
batch(() => {
|
|
194
205
|
set(x, 10);
|
|
@@ -207,7 +218,7 @@ import { peek, untracked } from "reflex-quant";
|
|
|
207
218
|
const query = signal("cats");
|
|
208
219
|
const page = signal(1);
|
|
209
220
|
|
|
210
|
-
effect(() => console.log(`search "${
|
|
221
|
+
effect(() => console.log(`search "${read(query)}" page ${peek(page)}`));
|
|
211
222
|
// search "cats" page 1
|
|
212
223
|
|
|
213
224
|
set(page, 2); // (nothing: page was only peeked)
|
|
@@ -229,11 +240,11 @@ const items = signal([
|
|
|
229
240
|
const discount = signal(0);
|
|
230
241
|
|
|
231
242
|
const subtotal = computed(() =>
|
|
232
|
-
|
|
243
|
+
read(items).reduce((sum, i) => sum + i.price * i.qty, 0),
|
|
233
244
|
);
|
|
234
|
-
const total = computed(() =>
|
|
245
|
+
const total = computed(() => read(subtotal) * (1 - read(discount)));
|
|
235
246
|
|
|
236
|
-
effect(() => console.log(`Total: $${
|
|
247
|
+
effect(() => console.log(`Total: $${read(total).toFixed(2)}`));
|
|
237
248
|
// Total: $11.00
|
|
238
249
|
|
|
239
250
|
update(items, (list) => [...list, { name: "Juice", price: 5, qty: 1 }]);
|
|
@@ -256,14 +267,14 @@ const todos = signal([
|
|
|
256
267
|
const filter = signal<"all" | "open" | "done">("all");
|
|
257
268
|
|
|
258
269
|
const visible = computed(() => {
|
|
259
|
-
const f =
|
|
260
|
-
if (f === "all") return
|
|
261
|
-
return
|
|
270
|
+
const f = read(filter);
|
|
271
|
+
if (f === "all") return read(todos);
|
|
272
|
+
return read(todos).filter((t) => t.done === (f === "done"));
|
|
262
273
|
});
|
|
263
|
-
const left = computed(() =>
|
|
274
|
+
const left = computed(() => read(todos).filter((t) => !t.done).length);
|
|
264
275
|
|
|
265
276
|
effect(() =>
|
|
266
|
-
console.log(`${
|
|
277
|
+
console.log(`${read(visible).map((t) => t.text).join(", ")} | ${read(left)} left`),
|
|
267
278
|
);
|
|
268
279
|
// Write README, Ship 1.2.0 | 1 left
|
|
269
280
|
|
|
@@ -283,7 +294,7 @@ update(todos, (list) => list.map((t) => ({ ...t, done: true })));
|
|
|
283
294
|
const query = signal("");
|
|
284
295
|
|
|
285
296
|
effect(() => {
|
|
286
|
-
const q =
|
|
297
|
+
const q = read(query);
|
|
287
298
|
const id = setTimeout(() => fetchResults(q), 300);
|
|
288
299
|
return () => clearTimeout(id); // a new keystroke cancels the previous timer
|
|
289
300
|
});
|
|
@@ -305,7 +316,7 @@ const button = document.querySelector("button")!;
|
|
|
305
316
|
button.addEventListener("click", () => update(count, (n) => n + 1));
|
|
306
317
|
|
|
307
318
|
effect(() => {
|
|
308
|
-
button.textContent = `Clicked ${
|
|
319
|
+
button.textContent = `Clicked ${read(count)} times`;
|
|
309
320
|
});
|
|
310
321
|
```
|
|
311
322
|
|
|
@@ -317,7 +328,7 @@ effect(() => {
|
|
|
317
328
|
```ts
|
|
318
329
|
const theme = signal(localStorage.getItem("theme") ?? "light");
|
|
319
330
|
|
|
320
|
-
effect(() => localStorage.setItem("theme",
|
|
331
|
+
effect(() => localStorage.setItem("theme", read(theme)));
|
|
321
332
|
|
|
322
333
|
set(theme, "dark"); // saved
|
|
323
334
|
```
|
|
@@ -336,12 +347,12 @@ type Cell = { col: number; row: number };
|
|
|
336
347
|
const mouse = signal({ x: 0, y: 0 });
|
|
337
348
|
|
|
338
349
|
const cell = computed((prev: Cell | undefined) => {
|
|
339
|
-
const { x, y } =
|
|
350
|
+
const { x, y } = read(mouse);
|
|
340
351
|
const next = { col: Math.floor(x / 100), row: Math.floor(y / 100) };
|
|
341
352
|
return prev && prev.col === next.col && prev.row === next.row ? prev : next;
|
|
342
353
|
});
|
|
343
354
|
|
|
344
|
-
effect(() => console.log(
|
|
355
|
+
effect(() => console.log(read(cell))); // { col: 0, row: 0 }
|
|
345
356
|
|
|
346
357
|
set(mouse, { x: 10, y: 20 }); // (nothing: same cell)
|
|
347
358
|
set(mouse, { x: 150, y: 20 }); // { col: 1, row: 0 }
|
|
@@ -358,18 +369,30 @@ set(mouse, { x: 150, y: 20 }); // { col: 1, row: 0 }
|
|
|
358
369
|
| `signal(value)` | Create a writable value. |
|
|
359
370
|
| `computed(fn, initial?)` | Create a lazy, cached derived value. `fn(prev)` receives the last committed value. |
|
|
360
371
|
| `effect(fn)` | Run `fn` now and again on every change it read. `fn` may return a cleanup function. Returns a handle. |
|
|
361
|
-
| `
|
|
372
|
+
| `read(x)` | Read a signal or computed and **subscribe** the current computation to it. `get(x)` is the same function (its 1.x name). |
|
|
373
|
+
| `readSignal(s)` | `read` for a signal only, without the computed path: faster in loops that read many signals. |
|
|
374
|
+
| `compute(c)` | `read` for a computed only (the same function, narrowed by type). |
|
|
362
375
|
| `peek(x)` | Read the up-to-date value **without** subscribing. |
|
|
363
376
|
| `set(s, value)` | Write a signal. Ignored if `Object.is(old, value)`. |
|
|
364
377
|
| `update(s, fn)` | `set(s, fn(current))`. `fn` runs untracked. If it throws, nothing is written. |
|
|
365
378
|
| `batch(fn)` | Run `fn`, then deliver all its writes as a single update. Returns `fn`'s result. |
|
|
366
379
|
| `untracked(fn)` | Run `fn` without subscribing to anything it reads. |
|
|
367
|
-
| `dispose(x)` | Stop an effect (running its cleanup) or detach a computed (its last value stays readable).
|
|
380
|
+
| `dispose(x)` | Stop an effect (running its cleanup) or detach a computed (its last committed value stays readable). |
|
|
368
381
|
| `typeOf(x)` | `"signal"`, `"computed"` or `"effect"`, without evaluating anything. |
|
|
369
382
|
|
|
370
|
-
> **Why `
|
|
383
|
+
> **Why `read(count)` and not `count()` or `count.value`?** Here the handle *is*
|
|
371
384
|
> the reactive node. Quant allocates no wrapper object or getter closure, so
|
|
372
385
|
> each signal costs one object.
|
|
386
|
+
> Handles are opaque: their fields are internal and can differ between builds.
|
|
387
|
+
> Access values through `read`, `readSignal`, `compute` or `peek`.
|
|
388
|
+
>
|
|
389
|
+
> **Why `readSignal`?** A signal never needs to be brought up to date; a
|
|
390
|
+
> computed may have to run first. `read` serves both, so the computed path is
|
|
391
|
+
> part of every read, and in loops that read many signals the engine pays for
|
|
392
|
+
> it (`track.duplicate-64`, `stable.wide-8`). `readSignal` takes only a
|
|
393
|
+
> `Signal` and has no computed path. Its type keeps computeds out; past the
|
|
394
|
+
> types (plain JS or a cast), development builds throw, and production builds
|
|
395
|
+
> would return a computed's last value without bringing it up to date.
|
|
373
396
|
|
|
374
397
|
## Good to know
|
|
375
398
|
|
|
@@ -387,21 +410,48 @@ several writes made before anyone reads collapse into a single run:
|
|
|
387
410
|
|
|
388
411
|
```ts
|
|
389
412
|
const clicks = signal(0);
|
|
390
|
-
const history = computed((prev) => [...prev,
|
|
413
|
+
const history = computed((prev) => [...prev, read(clicks)], [] as number[]);
|
|
391
414
|
|
|
392
415
|
set(clicks, 1);
|
|
393
416
|
set(clicks, 2);
|
|
394
|
-
|
|
417
|
+
read(history); // [2] (1 was never observed)
|
|
395
418
|
```
|
|
396
419
|
|
|
397
420
|
If you need every write, append to the log in the code that does the writing,
|
|
398
421
|
not in a computed.
|
|
399
422
|
|
|
400
|
-
**Errors don't break the graph.** If a computed throws, `
|
|
423
|
+
**Errors don't break the graph.** If a computed throws, `read` rethrows the error
|
|
401
424
|
and the computed keeps its last good value as `prev`. Once its inputs are fixed,
|
|
402
425
|
it recovers on the next read. If an effect throws during creation, it leaves
|
|
403
426
|
nothing running.
|
|
404
427
|
|
|
428
|
+
Two edges of error recovery are worth knowing. When a computed throws while an
|
|
429
|
+
effect is checking whether it must rerun, that check stops there. The effect
|
|
430
|
+
does not rerun until another change reaches it, even if a source the check
|
|
431
|
+
never got to changes in the meantime; `read` still returns current values.
|
|
432
|
+
And an effect whose first run throws can run once more before `effect()`
|
|
433
|
+
throws, if that run triggered an update; side effects such as a request are
|
|
434
|
+
not undone by the rollback.
|
|
435
|
+
|
|
436
|
+
**Writes from inside a computation take effect afterwards.** If a callback
|
|
437
|
+
writes a signal while a read is already checking its dependencies, that read
|
|
438
|
+
may still answer from before the write. The next read sees it.
|
|
439
|
+
|
|
440
|
+
The stack-safety guarantee covers Quant's graph walks: a chain of 100,000
|
|
441
|
+
computeds is fine. It does not cover callbacks that call each other until
|
|
442
|
+
the native JavaScript stack runs out. That is a resource failure of the
|
|
443
|
+
host, and Quant promises nothing after a program catches it and goes on.
|
|
444
|
+
An error a callback throws itself is an ordinary failure, handled as above.
|
|
445
|
+
|
|
446
|
+
**Disposing from inside a run is safe.** A computed or effect may be
|
|
447
|
+
disposed while it runs, by its own callback or by anything that callback
|
|
448
|
+
calls. The run finishes, then the node detaches and never runs again. A
|
|
449
|
+
computed's run that returns still commits its value, so the read that
|
|
450
|
+
triggered it sees the new value and that value stays readable. If the run
|
|
451
|
+
throws instead, the previous value stays. An effect disposed during its run
|
|
452
|
+
drops the cleanup that run returns: disposal has already run the previous
|
|
453
|
+
one, and nothing will run the new one.
|
|
454
|
+
|
|
405
455
|
**Use the development build to catch cycles.** Bundlers that resolve the
|
|
406
456
|
`development` export condition (Vite, webpack, and Node with
|
|
407
457
|
`--conditions=development`) load a build that throws `Cycle detected` when a
|
|
@@ -426,18 +476,35 @@ full framework (Vue, Solid, Preact Signals, MobX) is a better fit.
|
|
|
426
476
|
|
|
427
477
|
## Performance
|
|
428
478
|
|
|
479
|
+
The broader [JS Reactivity Benchmark](https://volynetstyle.github.io/js-reactivity-benchmark/),
|
|
480
|
+
maintained by Quant's author, compares 30 reactivity implementations. Its
|
|
481
|
+
[November 10, 2026 snapshot](https://github.com/volynetstyle/js-reactivity-benchmark/blob/9a26a3bee200fe9610e19cc21e0b8e02730b5459/index.html)
|
|
482
|
+
ranked Quant 1.1.2 first with a **1.07×** family-balanced core score, versus
|
|
483
|
+
**1.20×** for alien-signals 3.2.1. The score covers 33 shared core scenarios;
|
|
484
|
+
stress and lifecycle capability tests are reported separately. Lower is better,
|
|
485
|
+
and the scores are not the same as the pairwise time ratios below. No benchmark
|
|
486
|
+
establishes a universally fastest library.
|
|
487
|
+
|
|
488
|
+
The following is a separate, targeted snapshot of the newer Quant 1.2.0:
|
|
489
|
+
|
|
429
490
|
Measured on CI against [Reflex](https://github.com/volynetstyle/Reflex) and
|
|
430
491
|
[alien-signals](https://github.com/stackblitz/alien-signals), with all three
|
|
431
492
|
runtimes on the same runner
|
|
432
|
-
([run
|
|
493
|
+
([run 43479214912](https://github.com/volynetstyle/reflex-quant/actions/runs/43479214912), quant 1.2.0):
|
|
433
494
|
|
|
434
|
-
- within 25 % of the faster of the two on **
|
|
435
|
-
-
|
|
495
|
+
- within 25 % of the faster of the two on **all 18** scenarios, and faster than both on **7** (plus a tie on
|
|
496
|
+
`fan-out.effects-1000`, 0.998× the faster of the two);
|
|
497
|
+
- geometric mean: **0.94×** the faster of the two per scenario, **0.92×** Reflex,
|
|
498
|
+
**0.43×** alien-signals (lower is faster);
|
|
436
499
|
- reorders allocate nothing. If a computation reads the same 256 sources in a
|
|
437
500
|
rotated order on every pass, quant creates and removes **0** links per pass
|
|
438
|
-
where alien-signals relinks 255 (`node bench/structure.mjs`)
|
|
439
|
-
|
|
440
|
-
|
|
501
|
+
where alien-signals relinks 255 (`node bench/structure.mjs`), and takes 0.53×
|
|
502
|
+
Reflex's time and 0.07× alien-signals' there;
|
|
503
|
+
- Reflex is still faster on reversals, random permutations and sorts
|
|
504
|
+
(`reorder.reverse-8` 1.13×, `value-sort.256x32` 1.19×, `long-reorder.256`
|
|
505
|
+
1.20×) and on the trivial read paths (`static.read-clean` 1.10×, the stable
|
|
506
|
+
wide reads 1.13–1.17×); alien-signals is faster on `static.read-clean` (1.22×)
|
|
507
|
+
and `lifecycle.mount-100` (1.10×).
|
|
441
508
|
|
|
442
509
|
The suite is this project's own. Per-scenario numbers are on the
|
|
443
510
|
[benchmarks page](https://volynetstyle.github.io/reflex-quant/benchmarks/), and the
|
|
@@ -445,12 +512,14 @@ trajectory over CI runs is in [research/HISTORY.md](research/HISTORY.md).
|
|
|
445
512
|
|
|
446
513
|
## Correctness
|
|
447
514
|
|
|
448
|
-
Quant is
|
|
449
|
-
runtime that satisfies a fixed contract? The contract is a set of semantic invariants and structural bounds in
|
|
515
|
+
Quant is a research-driven library. Its design asks: what is the smallest known
|
|
516
|
+
reactive runtime that satisfies a fixed contract? The contract is a set of semantic invariants and structural bounds in
|
|
450
517
|
[CONTRACT.md](CONTRACT.md). It was extracted from the executable spec of
|
|
451
518
|
[Reflex](https://github.com/volynetstyle/Reflex)
|
|
452
519
|
(provenance in [research/REPORT.md](research/REPORT.md)). A mechanism is added
|
|
453
|
-
only if dropping it would break the contract or the asymptotics.
|
|
520
|
+
only if dropping it would break the contract or the asymptotics. The ablations
|
|
521
|
+
justify the mechanisms in this implementation; they do not prove a universal
|
|
522
|
+
lower bound for every possible design.
|
|
454
523
|
|
|
455
524
|
- **It found real bugs in Vue.** A port of quant's invariants to Vue 3.6 exposed
|
|
456
525
|
two regressions in its Alien-derived reactivity core, both also reproducible
|
|
@@ -465,9 +534,10 @@ only if dropping it would break the contract or the asymptotics.
|
|
|
465
534
|
spec, with three documented choices applied, on all 27 061 bounded and
|
|
466
535
|
18 660 recovery programs and on 100 000 generated ones. Graph integrity is
|
|
467
536
|
checked after every operation.
|
|
468
|
-
- **Nothing is optional.**
|
|
469
|
-
|
|
470
|
-
|
|
537
|
+
- **Nothing is optional.** Of the 67 ablations in `research/mutants.mjs`, 64
|
|
538
|
+
make a test fail. The other 3 remove store orders kept as conventions
|
|
539
|
+
(truthful transient state); the contract does not require them, and the
|
|
540
|
+
[log](research/LOG.md) records why no test kills them. All 7 ablations of the
|
|
471
541
|
development diagnostic fail a test of the development build.
|
|
472
542
|
- Current Reflex is the same contract plus three failure-path choices. One of
|
|
473
543
|
them drops an execution obligation that the contract (R2) says survives a
|
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* reflex-quant 1.
|
|
2
|
-
"use strict";var
|
|
1
|
+
/* reflex-quant 1.3.1 | MIT */
|
|
2
|
+
"use strict";var M=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var Se=Object.prototype.hasOwnProperty;var Ne=(e,n)=>{for(var t in n)M(e,t,{get:n[t],enumerable:!0})},he=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of ke(n))!Se.call(e,l)&&l!==t&&M(e,l,{get:()=>n[l],enumerable:!(o=ge(n,l))||o.enumerable});return e};var me=e=>he(M({},"__esModule",{value:!0}),e);var Xe={};Ne(Xe,{batch:()=>Te,compute:()=>Ke,computed:()=>Oe,dispose:()=>Ge,effect:()=>qe,get:()=>Be,peek:()=>Le,read:()=>X,readSignal:()=>Ue,set:()=>Ee,signal:()=>Ie,typeOf:()=>Me,untracked:()=>g,update:()=>Qe});module.exports=me(Xe);var T=-1,y=-2,z=-3,j=536870911,x=8,H=2,k=256,b=512;function S(e,n,t){return{e:t,l:n,n:0,r:e,u:null,c:null,f:null,a:null,d:0}}function N(e,n,t,o){let l=n.i,u=n.t;l.t=u,u!==null?u.i=l:e.c=l,n.i=t,n.t=o,t!==null?t.t=n:e.u=n,o.i=n}function F(e,n,t,o){let l=t.t,u=e.c;n!==null?n.t=l:e.u=l,l.i=n,t.i=u,t.t=null,u.t=t,e.c=t,u.n===T&&(t.n=T),o!==l&&N(e,o,n,l)}function I(e,n){let t=n===null?e.u:n.t;if(t!==null)for(n===null?e.u=null:n.t=null,e.c=n,t.i=null;t!==null;t=t.t)A(t)}function J(e){let n=e.d;for(let t=e.u;t!==null;t=t.t)t.d=n}function A(e){let n=e.o,t=e.p,o=e.s;e===n.f?n.f=o:t.s=o,o!==null?o.p=t:n.f!==null&&(n.f.p=t),e.p=null,e.s=null}var Y=Object.is,a=null,f=null,d=new Array(256).fill(null),i=0;var D=()=>{};function Z(e){D=e}function w(){d.length>b&&i===0&&(d.length=k)}function $(e,n){let t=e.l;if(t===n?n!==0||1/t===1/n:t!==t&&n!==n)return!1;e.l=n;let o=e.f;if(o===null)return!1;for(q(e);o!==null;o=o.s){let l=o._,u=l.e;if((u&5)===4)if(l.e=u|1,(u&16)!==0)D(l);else{let r=l.f;r!==null&&O(r)}else if((u&16)!==0)l.e=u|2|32,D(l);else if((u&1)!==0)l.e=u|2;else{l.e=u|2|1;let r=l.f;r!==null&&O(r)}}return!0}function q(e){let n=e.n+1&1073741823;n===0&&ye(e),e.n=n}function ye(e){for(let n=e.f;n!==null;n=n.s)n.n>=0&&(n.n=z)}function O(e){let n=i,t=e;for(;;){for(;t!==null;){let o=t._,l=o.e;if((l&16)!==0)o.e=l|1,D(o);else if((l&1)===0){o.e=l|1;let u=o.f;if(u!==null){let r=t.s;r!==null&&(d[i++]=r),t=u;continue}}t=t.s}if(i===n){w();return}t=d[--i],d[i]=null}}function ee(e){(e.e&47)!==0&&P(e);let n=a;if(n===null)return e.l;let t=f,o=t===null?n.u:t.t;if(o!==null&&o.o===e)return f=o,o.n=e.n,e.l;if(t!==null){if(t.o===e)return e.l;C(n,e,t,o)}else o!==null?C(n,e,t,o):h(n,e,null,null);return e.l}function ne(e){let n=a;if(n===null)return e.l;let t=f,o=t===null?n.u:t.t;if(o!==null&&o.o===e)return f=o,o.n=e.n,e.l;if(t!==null){if(t.o===e)return e.l;C(n,e,t,o)}else o!==null?C(n,e,t,o):h(n,e,null,null);return e.l}function te(e){return(e.e&47)!==0&&P(e),e.l}function P(e){let n=e.e;if((n&2)!==0)return E(e);xe(e,n)}function xe(e,n){e.e=n&-10;let t=i,o=e,l=e.u;try{for(;;){e:for(;l!==null;){let u=l.o,r=u.e;if((r&11)===0){if(u.n===l.n){l=l.t;continue}}else{if((r&2)===0){u.e=r&-10,d[i++]=l,o=u,l=u.u;continue}if(E(u),u.n===l.n){l=l.t;continue}}o.r!==null&&E(o);break e}for(;;){if(i===t){w();return}let u=d[--i];if(d[i]=null,o=u._,u.o.n===u.n){l=u.t;break}o.r!==null&&E(o)}}}catch(u){for(;;){if(o.r!==null){let r=o.e&-42;o.e=(r&2)===0?r|8:r}if(i===t)break;o=d[--i]._,d[i]=null}throw w(),u}}function oe(e,n){let t=e.d+1&1073741823;for(;;){let o=e.u;if((n&2)===0)for(;o!==null;){let l=o.o;if((l.e&11)===0){if(l.n===o.n){o=o.t;continue}}else if(P(l),l.n===o.n){o=o.t;continue}e.e|=2,o=o.t;break}for(;o!==null;){let l=o.o;if((l.e&11)===0||o.d===t){o=o.t;continue}P(l),o=o.t}if(e.r===null)return 0;if(n=e.e,(n&1)===0)return n;e.e=n&-2}}function g(e){let n=a;a=null;try{return e()}finally{a=n}}function E(e){let n=a,t=f,o=i;e.e=e.e&-44|4,a=e,f=null;let l;try{l=e.r(e.l)}catch(R){let V=f;throw a=n,f=t,e.e=e.e&-5|(e.r!==null?2:0),Ae(e,o,V),R}let u=f;a=n,f=t;let r=e.e;if(u!==null&&u.o.a===u&&re(e,o),e.e=r&-5,e.r===null)return be(e,l);(u===null?e.u:u.t)!==null&&I(e,u),e.d=e.d+1&1073741823,(e.d&j)===0&&J(e),Y(l,e.l)===!1&&(e.l=l,q(e))}function be(e,n){B(e),(e.e&16)===0&&Y(n,e.l)===!1&&(e.l=n,q(e))}function Ae(e,n,t){if(t!==null&&t.o.a===t&&re(e,n),e.r===null)return B(e);let o=e.d+1&1073741823;for(let l=t===null?e.u:t.t;l!==null;){let u=l.t;if(l.d===o){let r=l.i;r!==null?r.t=u:e.u=u,u!==null?u.i=r:e.c=r,A(l),l.i=null,l.t=null}l=u}}function W(e){e.r!==null&&(e.r=null,(e.e&4)===0&&B(e))}function B(e){if((e.e&16)===0)I(e,null);else{let n=e.u;for(e.u=e.c=null;n!==null;){let t=n.t;A(n),n.i=n.t=null,n=t}}e.e&=-44}function le(e,n){let t=!1;for(let o=e.u;o!==null;o=o.t)o===n&&(t=!0),t&&(o.n=T),ue(o.o,o)}function ue(e,n){let t=e.a;t!==null&&(d[i++]=t),e.a=n}function re(e,n){for(let t=e.u;t!==null;t=t.t)t.o.a=null;for(;i>n;){let t=d[--i];d[i]=null,t.o.a=t}w()}function h(e,n,t,o){let l=n.f,u=l!==null?l.p:null,r={o:n,n:n.n,t:o,_:e,s:null,d:e.d+1&1073741823,i:t,p:u};t!==null?t.t=r:e.u=r,o!==null?o.i=r:e.c=r,l!==null?(u.s=r,l.p=r):(n.f=r,r.p=r),f=r,(n.e&1)!==0&&O(r)}function C(e,n,t,o){if(t!==null&&t.o.a===t)return de(e,n,t,o);let l=n.f;if(l===null||Pe(l,e))return h(e,n,t,o);if(o!==null&&o.n===T)return fe(e,n,t,o,se(l,e));if(o!==null){let u=o.t;if(u!==null&&u.o===n)return ie(e,n,t,o,u);let r=H;for(u=e.c;u!==o&&u.o!==n&&--r!==0;)u=u.i;if(u.o===n)return u.n=n.n,f=u,N(e,u,t,o)}De(e,n,t,o,l)}function De(e,n,t,o,l){let u=null;if(o!==null){let V=x;for(u=o.t;u!==null&&u.o!==n&&--V!==0;)u=u.t;if(u!==null&&u.o===n)return ie(e,n,t,o,u)}let r=t!==null?t.i:null,R=x;for(;r!==null&&r.o!==n&&--R!==0;)r=r.i;if(!(r!==null&&r.o===n)){if(u===null&&r===null)return h(e,n,t,o);we(e,n,t,o,l)}}function ie(e,n,t,o,l){if(l.n=n.n,f=l,o.n===y)return F(e,t,o,l);o.n=y,N(e,l,t,o)}function we(e,n,t,o,l){let u=se(l,e);if(u!=null){if(u.n===y)return u.n=n.n,f=u,N(e,u,t,o);Ce(e,u,l,o)}fe(e,n,t,o,u)}function fe(e,n,t,o,l){if(l===null)return h(e,n,t,o);if(l!==void 0)return ce(e,l,n,t,o);le(e,o),de(e,n,t,o)}function de(e,n,t,o){let l=n.a;if(l!==null&&l._===e)return ce(e,l,n,t,o);h(e,n,t,o),ue(n,f)}function Pe(e,n){let t=e.p;return e._!==n&&t._!==n&&(t===e||e.s===t)}function se(e,n){let t=x;for(let o=e;o!==null;o=o.s){if(o._===n)return o;if(--t===0)return}return null}function Ce(e,n,t,o){if(o!==null){if(n!==t)return le(e,o);for(let l=o;l!==null;l=l.t)l.n=T}}function ce(e,n,t,o,l){n.n===T&&(n.n=t.n,N(e,n,o,l),f=n)}var m=new Array(k).fill(null),p=k-1,_=0,U=0,v=0,s=0,c=0;function ae(e){let n=e.e;(n&192)===64&&(s>p&&We(),m[_+s++&p]=e,e.e=n|128)}Z(ae);function We(){let e=new Array(s+s).fill(null);for(let n=0;n<s;n++)e[n]=m[_+n&p];m=e,p=s+s-1,_=0}function pe(e,n){return S(e,void 0,19|(n?64:0))}function Re(e,n){if(e.r===null||(n&33)===0){e.e=n;return}if(e.e=n&-34,(n&1)!==0)try{if((oe(e,n)&2)===0)return}catch(o){throw e.e|=1,o}let t=e.l;typeof t=="function"&&(e.l=void 0,g(t),e.r===null)||E(e)}function Q(e){if(e.r===null)return;let n=e.l;e.l=void 0,W(e),typeof n=="function"&&g(n)}function K(){s===0||c!==0||G()}function G(){c=1,L(!1,void 0)}function _e(e){if(c!==0||s!==0)return ae(e),K();c=1;try{E(e)}catch(n){return L(!0,n)}L(!1,void 0)}function L(e,n){let t=0;for(;s!==0;t++){let o=m[_];m[_]=null,_=_+1&p,s--;let l=o.e&-129;o.e=l;try{Re(o,l)}catch(u){e||(n=u),e=!0}}if(_=0,p>=b&&(t+t<p>>1?(t>v&&(v=t),(U+=t)>p&&Ve(v)):U=v=0),c=0,e)throw n}function Ve(e){let n=k;for(;n<e+e;)n+=n;m.length=n,p=n-1,U=v=0}function Te(e){c++;let n;try{n=e()}catch(t){if(--c===0)try{K()}catch{}throw t}return--c===0&&K(),n}function Me(e){let n=e;return(n.e&16)!==0?"effect":n.r===null?"signal":"computed"}function Ie(e){return S(null,e,0)}function Oe(e,n){return S(e,n,2)}function qe(e){let n=pe(e,!0);try{_e(n)}catch(t){try{Q(n)}catch{}throw t}return n}var X=ee,Be=X,Ue=ne;var Ke=X,Le=te;function Ee(e,n){$(e,n)&&s!==0&&c===0&&G()}function Qe(e,n){Ee(e,g(()=>n(e.l)))}function Ge(e){let n=e;(n.e&16)!==0?Q(n):W(n)}
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|