reflex-quant 1.3.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 +60 -36
- 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 +47 -20
- package/dist/index.development.cjs.map +3 -3
- package/dist/index.development.js +47 -20
- package/dist/index.development.js.map +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,12 +28,12 @@ workload set, not a claim that Quant wins every benchmark. The separate
|
|
|
28
28
|
[project CI suite](#performance) measures Quant 1.2.0.
|
|
29
29
|
|
|
30
30
|
```ts
|
|
31
|
-
import { signal, computed, effect,
|
|
31
|
+
import { signal, computed, effect, read, set } from "reflex-quant";
|
|
32
32
|
|
|
33
33
|
const count = signal(0);
|
|
34
|
-
const doubled = computed(() =>
|
|
34
|
+
const doubled = computed(() => read(count) * 2);
|
|
35
35
|
|
|
36
|
-
effect(() => console.log(`count=${
|
|
36
|
+
effect(() => console.log(`count=${read(count)} doubled=${read(doubled)}`));
|
|
37
37
|
// count=0 doubled=0
|
|
38
38
|
|
|
39
39
|
set(count, 1); // count=1 doubled=2
|
|
@@ -78,11 +78,11 @@ ESM and CommonJS builds are included, along with type declarations. It needs Nod
|
|
|
78
78
|
### 1. Signals hold values
|
|
79
79
|
|
|
80
80
|
```ts
|
|
81
|
-
import { signal,
|
|
81
|
+
import { signal, read, set, update } from "reflex-quant";
|
|
82
82
|
|
|
83
83
|
const name = signal("Ada");
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
read(name); // "Ada"
|
|
86
86
|
set(name, "Grace"); // replace
|
|
87
87
|
update(name, (n) => n.toUpperCase()); // derive from current: "GRACE"
|
|
88
88
|
```
|
|
@@ -99,14 +99,14 @@ const qty = signal(2);
|
|
|
99
99
|
let runs = 0;
|
|
100
100
|
const total = computed(() => {
|
|
101
101
|
runs++;
|
|
102
|
-
return
|
|
102
|
+
return read(price) * read(qty);
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
set(qty, 3);
|
|
106
106
|
set(qty, 5); // runs === 0: nobody asked yet
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
read(total); // 20, runs === 1
|
|
109
|
+
read(total); // 20, runs === 1: cached
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
### 3. Effects react to changes
|
|
@@ -121,7 +121,7 @@ import { effect, dispose } from "reflex-quant";
|
|
|
121
121
|
const room = signal("general");
|
|
122
122
|
|
|
123
123
|
const chat = effect(() => {
|
|
124
|
-
const r =
|
|
124
|
+
const r = read(room);
|
|
125
125
|
console.log("join", r);
|
|
126
126
|
return () => console.log("leave", r);
|
|
127
127
|
});
|
|
@@ -146,10 +146,10 @@ const first = signal("Ada");
|
|
|
146
146
|
const last = signal("Lovelace");
|
|
147
147
|
|
|
148
148
|
const displayName = computed(() =>
|
|
149
|
-
|
|
149
|
+
read(showFull) ? `${read(first)} ${read(last)}` : read(first),
|
|
150
150
|
);
|
|
151
151
|
|
|
152
|
-
effect(() => console.log(
|
|
152
|
+
effect(() => console.log(read(displayName))); // "Ada"
|
|
153
153
|
|
|
154
154
|
set(last, "Byron"); // (nothing: `last` isn't being read right now)
|
|
155
155
|
set(showFull, true); // "Ada Byron"
|
|
@@ -165,10 +165,10 @@ never sees a half-updated state:
|
|
|
165
165
|
```ts
|
|
166
166
|
const first = signal("Ada");
|
|
167
167
|
const last = signal("Lovelace");
|
|
168
|
-
const upper = computed(() =>
|
|
169
|
-
const initials = computed(() =>
|
|
168
|
+
const upper = computed(() => read(first).toUpperCase());
|
|
169
|
+
const initials = computed(() => read(first)[0] + read(last)[0]);
|
|
170
170
|
|
|
171
|
-
effect(() => console.log(`${
|
|
171
|
+
effect(() => console.log(`${read(upper)} (${read(initials)})`));
|
|
172
172
|
// ADA (AL)
|
|
173
173
|
|
|
174
174
|
set(first, "Grace");
|
|
@@ -182,9 +182,9 @@ put:
|
|
|
182
182
|
|
|
183
183
|
```ts
|
|
184
184
|
const n = signal(1);
|
|
185
|
-
const parity = computed(() => (
|
|
185
|
+
const parity = computed(() => (read(n) % 2 === 0 ? "even" : "odd"));
|
|
186
186
|
|
|
187
|
-
effect(() => console.log(
|
|
187
|
+
effect(() => console.log(read(parity))); // "odd"
|
|
188
188
|
|
|
189
189
|
set(n, 3); // (nothing: still "odd")
|
|
190
190
|
set(n, 4); // "even"
|
|
@@ -199,7 +199,7 @@ import { batch } from "reflex-quant";
|
|
|
199
199
|
|
|
200
200
|
const x = signal(0);
|
|
201
201
|
const y = signal(0);
|
|
202
|
-
effect(() => console.log(`(${
|
|
202
|
+
effect(() => console.log(`(${read(x)}, ${read(y)})`)); // (0, 0)
|
|
203
203
|
|
|
204
204
|
batch(() => {
|
|
205
205
|
set(x, 10);
|
|
@@ -218,7 +218,7 @@ import { peek, untracked } from "reflex-quant";
|
|
|
218
218
|
const query = signal("cats");
|
|
219
219
|
const page = signal(1);
|
|
220
220
|
|
|
221
|
-
effect(() => console.log(`search "${
|
|
221
|
+
effect(() => console.log(`search "${read(query)}" page ${peek(page)}`));
|
|
222
222
|
// search "cats" page 1
|
|
223
223
|
|
|
224
224
|
set(page, 2); // (nothing: page was only peeked)
|
|
@@ -240,11 +240,11 @@ const items = signal([
|
|
|
240
240
|
const discount = signal(0);
|
|
241
241
|
|
|
242
242
|
const subtotal = computed(() =>
|
|
243
|
-
|
|
243
|
+
read(items).reduce((sum, i) => sum + i.price * i.qty, 0),
|
|
244
244
|
);
|
|
245
|
-
const total = computed(() =>
|
|
245
|
+
const total = computed(() => read(subtotal) * (1 - read(discount)));
|
|
246
246
|
|
|
247
|
-
effect(() => console.log(`Total: $${
|
|
247
|
+
effect(() => console.log(`Total: $${read(total).toFixed(2)}`));
|
|
248
248
|
// Total: $11.00
|
|
249
249
|
|
|
250
250
|
update(items, (list) => [...list, { name: "Juice", price: 5, qty: 1 }]);
|
|
@@ -267,14 +267,14 @@ const todos = signal([
|
|
|
267
267
|
const filter = signal<"all" | "open" | "done">("all");
|
|
268
268
|
|
|
269
269
|
const visible = computed(() => {
|
|
270
|
-
const f =
|
|
271
|
-
if (f === "all") return
|
|
272
|
-
return
|
|
270
|
+
const f = read(filter);
|
|
271
|
+
if (f === "all") return read(todos);
|
|
272
|
+
return read(todos).filter((t) => t.done === (f === "done"));
|
|
273
273
|
});
|
|
274
|
-
const left = computed(() =>
|
|
274
|
+
const left = computed(() => read(todos).filter((t) => !t.done).length);
|
|
275
275
|
|
|
276
276
|
effect(() =>
|
|
277
|
-
console.log(`${
|
|
277
|
+
console.log(`${read(visible).map((t) => t.text).join(", ")} | ${read(left)} left`),
|
|
278
278
|
);
|
|
279
279
|
// Write README, Ship 1.2.0 | 1 left
|
|
280
280
|
|
|
@@ -294,7 +294,7 @@ update(todos, (list) => list.map((t) => ({ ...t, done: true })));
|
|
|
294
294
|
const query = signal("");
|
|
295
295
|
|
|
296
296
|
effect(() => {
|
|
297
|
-
const q =
|
|
297
|
+
const q = read(query);
|
|
298
298
|
const id = setTimeout(() => fetchResults(q), 300);
|
|
299
299
|
return () => clearTimeout(id); // a new keystroke cancels the previous timer
|
|
300
300
|
});
|
|
@@ -316,7 +316,7 @@ const button = document.querySelector("button")!;
|
|
|
316
316
|
button.addEventListener("click", () => update(count, (n) => n + 1));
|
|
317
317
|
|
|
318
318
|
effect(() => {
|
|
319
|
-
button.textContent = `Clicked ${
|
|
319
|
+
button.textContent = `Clicked ${read(count)} times`;
|
|
320
320
|
});
|
|
321
321
|
```
|
|
322
322
|
|
|
@@ -328,7 +328,7 @@ effect(() => {
|
|
|
328
328
|
```ts
|
|
329
329
|
const theme = signal(localStorage.getItem("theme") ?? "light");
|
|
330
330
|
|
|
331
|
-
effect(() => localStorage.setItem("theme",
|
|
331
|
+
effect(() => localStorage.setItem("theme", read(theme)));
|
|
332
332
|
|
|
333
333
|
set(theme, "dark"); // saved
|
|
334
334
|
```
|
|
@@ -347,12 +347,12 @@ type Cell = { col: number; row: number };
|
|
|
347
347
|
const mouse = signal({ x: 0, y: 0 });
|
|
348
348
|
|
|
349
349
|
const cell = computed((prev: Cell | undefined) => {
|
|
350
|
-
const { x, y } =
|
|
350
|
+
const { x, y } = read(mouse);
|
|
351
351
|
const next = { col: Math.floor(x / 100), row: Math.floor(y / 100) };
|
|
352
352
|
return prev && prev.col === next.col && prev.row === next.row ? prev : next;
|
|
353
353
|
});
|
|
354
354
|
|
|
355
|
-
effect(() => console.log(
|
|
355
|
+
effect(() => console.log(read(cell))); // { col: 0, row: 0 }
|
|
356
356
|
|
|
357
357
|
set(mouse, { x: 10, y: 20 }); // (nothing: same cell)
|
|
358
358
|
set(mouse, { x: 150, y: 20 }); // { col: 1, row: 0 }
|
|
@@ -369,7 +369,9 @@ set(mouse, { x: 150, y: 20 }); // { col: 1, row: 0 }
|
|
|
369
369
|
| `signal(value)` | Create a writable value. |
|
|
370
370
|
| `computed(fn, initial?)` | Create a lazy, cached derived value. `fn(prev)` receives the last committed value. |
|
|
371
371
|
| `effect(fn)` | Run `fn` now and again on every change it read. `fn` may return a cleanup function. Returns a handle. |
|
|
372
|
-
| `
|
|
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). |
|
|
373
375
|
| `peek(x)` | Read the up-to-date value **without** subscribing. |
|
|
374
376
|
| `set(s, value)` | Write a signal. Ignored if `Object.is(old, value)`. |
|
|
375
377
|
| `update(s, fn)` | `set(s, fn(current))`. `fn` runs untracked. If it throws, nothing is written. |
|
|
@@ -378,9 +380,19 @@ set(mouse, { x: 150, y: 20 }); // { col: 1, row: 0 }
|
|
|
378
380
|
| `dispose(x)` | Stop an effect (running its cleanup) or detach a computed (its last committed value stays readable). |
|
|
379
381
|
| `typeOf(x)` | `"signal"`, `"computed"` or `"effect"`, without evaluating anything. |
|
|
380
382
|
|
|
381
|
-
> **Why `
|
|
383
|
+
> **Why `read(count)` and not `count()` or `count.value`?** Here the handle *is*
|
|
382
384
|
> the reactive node. Quant allocates no wrapper object or getter closure, so
|
|
383
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.
|
|
384
396
|
|
|
385
397
|
## Good to know
|
|
386
398
|
|
|
@@ -398,21 +410,33 @@ several writes made before anyone reads collapse into a single run:
|
|
|
398
410
|
|
|
399
411
|
```ts
|
|
400
412
|
const clicks = signal(0);
|
|
401
|
-
const history = computed((prev) => [...prev,
|
|
413
|
+
const history = computed((prev) => [...prev, read(clicks)], [] as number[]);
|
|
402
414
|
|
|
403
415
|
set(clicks, 1);
|
|
404
416
|
set(clicks, 2);
|
|
405
|
-
|
|
417
|
+
read(history); // [2] (1 was never observed)
|
|
406
418
|
```
|
|
407
419
|
|
|
408
420
|
If you need every write, append to the log in the code that does the writing,
|
|
409
421
|
not in a computed.
|
|
410
422
|
|
|
411
|
-
**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
|
|
412
424
|
and the computed keeps its last good value as `prev`. Once its inputs are fixed,
|
|
413
425
|
it recovers on the next read. If an effect throws during creation, it leaves
|
|
414
426
|
nothing running.
|
|
415
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
|
+
|
|
416
440
|
The stack-safety guarantee covers Quant's graph walks: a chain of 100,000
|
|
417
441
|
computeds is fine. It does not cover callbacks that call each other until
|
|
418
442
|
the native JavaScript stack runs out. That is a resource failure of the
|
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* reflex-quant 1.3.
|
|
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
|