@solidjs/signals 2.0.0-rc.13 → 2.0.0-rc.15
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/dist/dev-shared.js +2059 -3768
- package/dist/dev.attribution.js +237 -101
- package/dist/dev.js +7466 -8497
- package/dist/observe/affects.js +128 -104
- package/dist/observe/boundaries.js +492 -665
- package/dist/observe/core/action.js +63 -66
- package/dist/observe/core/async.js +243 -379
- package/dist/observe/core/attribution-queries.js +1 -1
- package/dist/observe/core/attribution.js +394 -253
- package/dist/observe/core/constants.js +120 -187
- package/dist/observe/core/context.js +3 -3
- package/dist/observe/core/core.js +874 -1440
- package/dist/observe/core/dev.js +3 -3
- package/dist/observe/core/effect.js +73 -84
- package/dist/observe/core/external.js +5 -5
- package/dist/observe/core/graph.js +62 -71
- package/dist/observe/core/heap.js +75 -98
- package/dist/observe/core/invariants.js +1 -34
- package/dist/observe/core/lanes.js +750 -181
- package/dist/observe/core/owner.js +80 -101
- package/dist/observe/core/scheduler.js +719 -1356
- package/dist/observe/core/verdict.js +314 -621
- package/dist/observe/flatten.js +79 -0
- package/dist/observe/index.js +15 -13
- package/dist/observe/map.js +232 -235
- package/dist/observe/reveal.js +212 -0
- package/dist/observe/signals.js +144 -216
- package/dist/observe/store/affects.js +142 -0
- package/dist/observe/store/hooks.js +13 -0
- package/dist/observe/store/index.js +27 -24
- package/dist/observe/store/optimistic.js +571 -0
- package/dist/observe/store/projection.js +308 -0
- package/dist/observe/store/reconcile.js +259 -0
- package/dist/observe/store/store.js +1988 -277
- package/dist/observe/store/storePath.js +1 -1
- package/dist/{prod/store/next → observe/store}/target.js +17 -18
- package/dist/observe/store/types.js +73 -0
- package/dist/observe/store/utils.js +1 -13
- package/dist/prod/affects.js +130 -106
- package/dist/prod/boundaries.js +476 -654
- package/dist/prod/core/action.js +71 -74
- package/dist/prod/core/async.js +306 -444
- package/dist/prod/core/constants.js +117 -186
- package/dist/prod/core/context.js +3 -3
- package/dist/prod/core/core.js +888 -1462
- package/dist/prod/core/effect.js +88 -99
- package/dist/prod/core/external.js +5 -5
- package/dist/prod/core/graph.js +62 -71
- package/dist/prod/core/heap.js +75 -98
- package/dist/prod/core/invariants.js +1 -32
- package/dist/prod/core/lanes.js +712 -181
- package/dist/prod/core/owner.js +75 -96
- package/dist/prod/core/scheduler.js +686 -1335
- package/dist/prod/core/verdict.js +309 -621
- package/dist/prod/flatten.js +77 -0
- package/dist/prod/index.js +15 -13
- package/dist/prod/map.js +142 -145
- package/dist/prod/reveal.js +212 -0
- package/dist/prod/signals.js +155 -227
- package/dist/prod/store/affects.js +142 -0
- package/dist/prod/store/hooks.js +13 -0
- package/dist/prod/store/index.js +26 -19
- package/dist/prod/store/optimistic.js +566 -0
- package/dist/prod/store/projection.js +301 -0
- package/dist/prod/store/reconcile.js +259 -0
- package/dist/prod/store/store.js +1883 -272
- package/dist/prod/store/storePath.js +1 -1
- package/dist/{observe/store/next → prod/store}/target.js +13 -17
- package/dist/prod/store/types.js +73 -0
- package/dist/prod/store/utils.js +1 -11
- package/dist/types/affects.d.ts +11 -30
- package/dist/types/boundaries.d.ts +66 -176
- package/dist/types/carved.d.ts +1 -0
- package/dist/types/core/action.d.ts +5 -6
- package/dist/types/core/async.d.ts +10 -5
- package/dist/types/core/attribution-hooks.d.ts +20 -1
- package/dist/types/core/attribution.d.ts +26 -11
- package/dist/types/core/constants.d.ts +130 -180
- package/dist/types/core/core.d.ts +134 -264
- package/dist/types/core/dev.d.ts +2 -2
- package/dist/types/core/effect.d.ts +0 -7
- package/dist/types/core/graph.d.ts +7 -1
- package/dist/types/core/heap.d.ts +5 -7
- package/dist/types/core/index.d.ts +5 -5
- package/dist/types/core/invariants.d.ts +0 -29
- package/dist/types/core/lanes.d.ts +74 -86
- package/dist/types/core/owner.d.ts +3 -3
- package/dist/types/core/scheduler.d.ts +255 -331
- package/dist/types/core/types.d.ts +45 -85
- package/dist/types/core/verdict.d.ts +3 -0
- package/dist/types/flatten.d.ts +8 -0
- package/dist/types/index.d.ts +6 -4
- package/dist/types/reveal.d.ts +19 -0
- package/dist/types/signals.d.ts +35 -91
- package/dist/types/store/affects.d.ts +12 -0
- package/dist/types/store/hooks.d.ts +48 -0
- package/dist/types/store/index.d.ts +34 -15
- package/dist/types/store/optimistic.d.ts +23 -0
- package/dist/types/store/projection.d.ts +18 -0
- package/dist/types/store/reconcile.d.ts +3 -0
- package/dist/types/store/store.d.ts +132 -145
- package/dist/types/store/storePath.d.ts +1 -1
- package/dist/types/store/target.d.ts +151 -0
- package/dist/types/store/types.d.ts +84 -0
- package/package.json +1 -1
- package/dist/observe/core/optimistic.js +0 -669
- package/dist/observe/store/next/optimistic.js +0 -717
- package/dist/observe/store/next/projection.js +0 -266
- package/dist/observe/store/next/reconcile.js +0 -375
- package/dist/observe/store/next/store.js +0 -2608
- package/dist/prod/core/optimistic.js +0 -658
- package/dist/prod/store/next/optimistic.js +0 -710
- package/dist/prod/store/next/projection.js +0 -257
- package/dist/prod/store/next/reconcile.js +0 -373
- package/dist/prod/store/next/store.js +0 -2484
- package/dist/types/core/optimistic.d.ts +0 -6
- package/dist/types/store/next/optimistic.d.ts +0 -25
- package/dist/types/store/next/projection.d.ts +0 -27
- package/dist/types/store/next/reconcile.d.ts +0 -10
- package/dist/types/store/next/store.d.ts +0 -145
- package/dist/types/store/next/target.d.ts +0 -196
|
@@ -14,33 +14,29 @@
|
|
|
14
14
|
*/
|
|
15
15
|
const $OWNER = Symbol(0);
|
|
16
16
|
|
|
17
|
-
/** raw → target for
|
|
18
|
-
*
|
|
17
|
+
/** raw → target for plain (family-less) stores. Family stores use their own
|
|
18
|
+
* map so one raw can wrap once per family (§7b). */ const storeLookup = new WeakMap;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
function setLookup(e, o) {
|
|
21
|
+
(o.fam?.map ?? storeLookup).set(e, o);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function isOwned(e) {
|
|
21
25
|
return e[$OWNER] !== undefined;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const t = e[$OWNER];
|
|
29
|
-
return t !== undefined && t.fam === o ? t : (o?.map ?? storeNextLookup).get(e);
|
|
28
|
+
/** The target wrapping `raw` in `fam` (or the plain lookup). An owned raw
|
|
29
|
+
* answers from its stamp; a user raw from the map. */ function lookupTarget(e, o) {
|
|
30
|
+
const n = e[$OWNER];
|
|
31
|
+
return n !== undefined && n.fam === o ? n : (o?.map ?? storeLookup).get(e);
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
function devAssertNeverUserMutation(e) {
|
|
33
35
|
return;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
function setOptHooks(e) {
|
|
39
|
-
optHooks = e;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** Sticky descendants flag walk (§6d): reconcile's keyed pruning descends
|
|
43
|
-
* only where subscriptions exist at/below. Nodes AND patches count. */ function markDescendants(e) {
|
|
38
|
+
/** Sticky descendants flag up the parent chain (§6d): adoption descends
|
|
39
|
+
* into a changed child pair only where a target with nodes exists below. */ function markDescendants(e) {
|
|
44
40
|
let o = e;
|
|
45
41
|
while (o && !o.d) {
|
|
46
42
|
o.d = true;
|
|
@@ -48,4 +44,7 @@ function setOptHooks(e) {
|
|
|
48
44
|
}
|
|
49
45
|
}
|
|
50
46
|
|
|
51
|
-
|
|
47
|
+
/** Observe tier: the owner in scope at `createStore` (attribution names and
|
|
48
|
+
* owner paths); the `_owner` write never reaches the proxy. */ const storeOwners = new WeakMap;
|
|
49
|
+
|
|
50
|
+
export { $OWNER, devAssertNeverUserMutation, isOwned, lookupTarget, markDescendants, setLookup, storeLookup, storeOwners };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** Brand keys the proxy answers directly (never user data). */
|
|
2
|
+
const $TRACK = Symbol(0), $TARGET = Symbol(0), $PROXY = Symbol(0), $RECORD = Symbol(0);
|
|
3
|
+
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// raw marking (R42 / RUL-12: a value is never both wrapped and raw)
|
|
6
|
+
const rawValues = new WeakSet;
|
|
7
|
+
|
|
8
|
+
let rawValuesUsed = false;
|
|
9
|
+
|
|
10
|
+
function isRawValue(e) {
|
|
11
|
+
return rawValuesUsed && rawValues.has(e);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Mark a value so no store ever wraps it (sticky; it reads as a leaf). */ function markRaw(e) {
|
|
15
|
+
if (isWrappable(e)) {
|
|
16
|
+
rawValuesUsed = true;
|
|
17
|
+
rawValues.add(e);
|
|
18
|
+
}
|
|
19
|
+
return e;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** A shallow store's ingested record: raw by contract (values served
|
|
23
|
+
* verbatim, slots replaced by reference). */ function markRawOne(e) {
|
|
24
|
+
if (isWrappable(e)) {
|
|
25
|
+
if (e[$TARGET] !== undefined) return;
|
|
26
|
+
rawValuesUsed = true;
|
|
27
|
+
rawValues.add(e);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function markRawIngest(e) {
|
|
32
|
+
if (Array.isArray(e)) {
|
|
33
|
+
for (let r = 0, a = e.length; r < a; r++) markRawOne(e[r]);
|
|
34
|
+
} else {
|
|
35
|
+
for (const r in e) markRawOne(e[r]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// wrappability
|
|
41
|
+
const OBJECT_PROTO = Object.prototype;
|
|
42
|
+
|
|
43
|
+
const wrappableProtos = new WeakMap;
|
|
44
|
+
|
|
45
|
+
function isWrappable(e) {
|
|
46
|
+
if (e == null || typeof e !== "object" || Object.isFrozen(e)) return false;
|
|
47
|
+
const r = Object.getPrototypeOf(e);
|
|
48
|
+
if (r === OBJECT_PROTO || r === null) return true;
|
|
49
|
+
if (Array.isArray(e)) return true;
|
|
50
|
+
let a = wrappableProtos.get(r);
|
|
51
|
+
if (a === undefined) {
|
|
52
|
+
a = Object.prototype.toString.call(e) === "[object Object]" && (typeof Node === "undefined" || !(e instanceof Node));
|
|
53
|
+
wrappableProtos.set(r, a);
|
|
54
|
+
}
|
|
55
|
+
return a;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function ownEnumerableKeys(e) {
|
|
59
|
+
return Reflect.ownKeys(e).filter(r => Object.prototype.propertyIsEnumerable.call(e, r));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
// write override: a projection's draft ops carry it (the derive is the
|
|
64
|
+
// author — its writes must land outside the sync setter scope too, in a
|
|
65
|
+
// continuation after an `await`/`yield`). Projections return in S3; the
|
|
66
|
+
// traps already honour it.
|
|
67
|
+
let writeOverride = false;
|
|
68
|
+
|
|
69
|
+
function setWriteOverride(e) {
|
|
70
|
+
writeOverride = e;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { $PROXY, $RECORD, $TARGET, $TRACK, isRawValue, isWrappable, markRaw, markRawIngest, markRawOne, ownEnumerableKeys, rawValuesUsed, setWriteOverride, writeOverride };
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
import "../core/core.js";
|
|
2
|
-
|
|
3
1
|
import { SUPPORTS_PROXY } from "../core/constants.js";
|
|
4
2
|
|
|
5
|
-
import "../core/dev.js";
|
|
6
|
-
|
|
7
|
-
import "../core/scheduler.js";
|
|
8
|
-
|
|
9
|
-
import "../core/invariants.js";
|
|
10
|
-
|
|
11
|
-
import "../core/verdict.js";
|
|
12
|
-
|
|
13
|
-
import "../core/effect.js";
|
|
14
|
-
|
|
15
3
|
import { createMemo } from "../signals.js";
|
|
16
4
|
|
|
17
|
-
import { $PROXY, $RECORD, $TARGET, ownEnumerableKeys } from "./
|
|
5
|
+
import { $PROXY, $RECORD, $TARGET, ownEnumerableKeys } from "./types.js";
|
|
18
6
|
|
|
19
7
|
function trueFn() {
|
|
20
8
|
return true;
|
package/dist/prod/affects.js
CHANGED
|
@@ -1,127 +1,151 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { ext
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import "./
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { $REFRESH, CONFIG_VERDICT, STATUS_PENDING, CONFIG_SLOT_NODE, STATUS_ERROR, REACTIVE_RECOMPUTING_DEPS } from "./core/constants.js";
|
|
2
|
+
|
|
3
|
+
import { ext } from "./core/core.js";
|
|
4
|
+
|
|
5
|
+
import { enqueueSub } from "./core/heap.js";
|
|
6
|
+
|
|
7
|
+
import { schedule, resolveTx, flushTransaction, GlobalQueue } from "./core/scheduler.js";
|
|
8
|
+
|
|
9
|
+
import { storeMarks, installStoreAffects, releaseMarkScope } from "./store/affects.js";
|
|
10
|
+
|
|
11
|
+
import { $TARGET } from "./store/types.js";
|
|
12
|
+
|
|
13
|
+
// `affects()` — the declaration verb of the pending model (A24 (4), ruled
|
|
14
|
+
// 2026-07-13; the #2893 audit corollaries; rebuilt on L2 2026-10-02 as ruled:
|
|
15
|
+
// transaction-inert).
|
|
16
|
+
// A mark is a declared in-flight change: the marked node — and everything
|
|
17
|
+
// derived from it — reads pending (`isPending` → true) from the declaration
|
|
18
|
+
// until the surrounding transaction lands (an ambient mark, declared outside
|
|
19
|
+
// one, releases at the next seam). The marked values stay readable: no reader
|
|
20
|
+
// suspends on a mark, a mark holds nothing and entangles nothing — it is not
|
|
21
|
+
// a node of its transaction (`blocked` never sees it), and a reader of marked
|
|
22
|
+
// data joins nothing through it. A mark is never a re-ask, so a declared
|
|
23
|
+
// reload's own `refresh()` cannot silence it; a real error outranks it.
|
|
24
|
+
// Representation: a count on the marked node (`_x._marks`), listed with its
|
|
25
|
+
// scope (the transaction's `_marks`, or the ambient list). Coverage of the
|
|
26
|
+
// derivations is pull-derived at probe time — `isPending`'s read walks the
|
|
27
|
+
// probed node's dependencies for a marked one (verdict.ts → `_marked`) — so
|
|
28
|
+
// nothing is stored downstream and a mid-window recompute strands nothing.
|
|
29
|
+
// The push half is the verdict readers' re-derivation at registration and at
|
|
30
|
+
// release (`repoll`): the only notification a mark makes.
|
|
31
|
+
// Installed on `GlobalQueue` when imported: a program that never declares a
|
|
32
|
+
// mark carries none of this.
|
|
33
|
+
/** Live marks, every scope — the gate on the probe's walk. */
|
|
34
|
+
let active = 0;
|
|
35
|
+
|
|
36
|
+
/** Marks declared outside a transaction: released at the next seam. */ const ambient = [];
|
|
37
|
+
|
|
38
|
+
/** The verdict readers downstream of `node` — through derivations, stopping
|
|
39
|
+
* at effects — re-derive: the mark's one notification (a probe's answer
|
|
40
|
+
* changed with no value notifying anyone). */ function repoll(e, t = new Set) {
|
|
41
|
+
for (let r = e.t; r !== null; r = r.o) {
|
|
42
|
+
const e = r.l;
|
|
43
|
+
if (t.has(e)) continue;
|
|
44
|
+
t.add(e);
|
|
45
|
+
if (e.i & CONFIG_VERDICT) enqueueSub(e);
|
|
46
|
+
if (!e.u) repoll(e, t);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
18
49
|
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
50
|
+
/** A node is covered by a live mark iff it carries one, or derives — through
|
|
51
|
+
* its current dependencies — from one that does. A real error outranks an
|
|
52
|
+
* inherited mark (A24 (c)): coverage does not flow through an errored node
|
|
53
|
+
* (a direct mark on one still reads pending). Mid-recompute, only the
|
|
54
|
+
* validated prefix of the dependency list is this pass's. */ function marked(e, t) {
|
|
55
|
+
if (e.m !== null && e.m.T !== 0) return true;
|
|
56
|
+
const r = e;
|
|
57
|
+
if (r.S & STATUS_ERROR || t.has(e)) return false;
|
|
58
|
+
t.add(e);
|
|
59
|
+
const n = r.R & REACTIVE_RECOMPUTING_DEPS ? r.G : undefined;
|
|
60
|
+
if (n !== null) for (let e = r.p ?? null; e !== null; e = e._) {
|
|
61
|
+
if (marked(e.I, t)) return true;
|
|
62
|
+
if (e === n) break;
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
29
65
|
}
|
|
30
66
|
|
|
31
|
-
/**
|
|
32
|
-
*
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
* no visual change.
|
|
42
|
-
*/ function notifyMarkBoundaries(e) {
|
|
43
|
-
if (!e.u && !e.o?.i) return;
|
|
44
|
-
const r = new NotReadyError(e);
|
|
45
|
-
r.l = true;
|
|
46
|
-
const t = new Set;
|
|
47
|
-
const visit = e => {
|
|
48
|
-
if (t.has(e)) return;
|
|
49
|
-
t.add(e);
|
|
50
|
-
// Display consumers (render effects, boundary computeds) act on the
|
|
51
|
-
// notification; descent stops there, exactly like the status rails.
|
|
52
|
-
const o = statusNotifierOf(e);
|
|
53
|
-
if (o) {
|
|
54
|
-
o.call(e, STATUS_PENDING, r);
|
|
55
|
-
return;
|
|
67
|
+
/** Releases one scope's marks (a landed transaction's, the ambient list at
|
|
68
|
+
* the seam): a node whose last mark drops re-derives its verdict readers. */ function release(e) {
|
|
69
|
+
for (let t = 0; t < e.length; t++) {
|
|
70
|
+
const r = e[t];
|
|
71
|
+
active--;
|
|
72
|
+
if (--r.m.T === 0) {
|
|
73
|
+
repoll(r);
|
|
74
|
+
// A store mark's carrier: its scope (and the marks the nodes born in
|
|
75
|
+
// its window inherited) goes with it.
|
|
76
|
+
releaseMarkScope(r);
|
|
56
77
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
forEachDependent(e, visit);
|
|
78
|
+
}
|
|
79
|
+
e.length = 0;
|
|
60
80
|
}
|
|
61
81
|
|
|
62
|
-
/**
|
|
63
|
-
*
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
markAffects(e);
|
|
72
|
-
globalQueue.m.A.push(e);
|
|
73
|
-
// Companions only exist once the verdict layer (isPending/latest) loaded;
|
|
74
|
-
// without them there is no materialized verdict to poke.
|
|
75
|
-
GlobalQueue.k !== null && GlobalQueue.k(e);
|
|
76
|
-
notifyMarkBoundaries(e);
|
|
77
|
-
schedule();
|
|
82
|
+
/** One registration: a count on the node, listed with the scope — the
|
|
83
|
+
* flush's transaction, or the ambient list (released at the seam). */ function register(e) {
|
|
84
|
+
mark(e);
|
|
85
|
+
const t = flushTransaction;
|
|
86
|
+
if (t === null) ambient.push(e); else {
|
|
87
|
+
const r = resolveTx(t);
|
|
88
|
+
(r.T ??= []).push(e);
|
|
89
|
+
}
|
|
90
|
+
repoll(e);
|
|
78
91
|
}
|
|
79
92
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
* transition-scoped — release runs inside queue finalization, where a
|
|
84
|
-
* setSignal would open a fresh override window that nothing settles).
|
|
85
|
-
*/ function releaseAffectsMark(e) {
|
|
86
|
-
shiftAffectsMarks(-1);
|
|
87
|
-
e.o.t--;
|
|
88
|
-
if (!e.o.t) {
|
|
89
|
-
GlobalQueue.k !== null && GlobalQueue.k(e, true);
|
|
90
|
-
GlobalQueue.p?.(e);
|
|
91
|
-
}
|
|
93
|
+
function mark(e) {
|
|
94
|
+
ext(e).T++;
|
|
95
|
+
active++;
|
|
92
96
|
}
|
|
93
97
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
function affects(e, t) {
|
|
99
|
+
// A store (the store half, store/affects.ts): the slot's leaf, or the
|
|
100
|
+
// record's carrier and every live node under it.
|
|
101
|
+
const r = e?.[$TARGET];
|
|
102
|
+
if (r !== undefined) {
|
|
103
|
+
installStoreAffects();
|
|
104
|
+
const e = storeMarks(r, t);
|
|
105
|
+
for (let t = 0; t < e.length; t++) register(e[t]);
|
|
106
|
+
schedule();
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const n = e?.[$REFRESH];
|
|
110
|
+
if (!n) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
register(n);
|
|
114
|
+
schedule();
|
|
100
115
|
}
|
|
101
116
|
|
|
102
|
-
|
|
103
|
-
// lives with the feature so graphs that never declare a mark never ship it.
|
|
104
|
-
// Each call site is gated by state only this module creates (a non-empty
|
|
105
|
-
// `_affectsNodes` batch, a live scope in the store's `affectsScopes`), so the
|
|
106
|
-
// hooks are installed before the first time any of them can fire.
|
|
107
|
-
GlobalQueue.G = releaseAffectsMarks;
|
|
117
|
+
GlobalQueue.N = e => active !== 0 && marked(e, new Set);
|
|
108
118
|
|
|
109
|
-
GlobalQueue.
|
|
119
|
+
GlobalQueue.O = mark;
|
|
110
120
|
|
|
111
|
-
GlobalQueue.
|
|
121
|
+
GlobalQueue.k = release;
|
|
112
122
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
123
|
+
GlobalQueue.A = e => {
|
|
124
|
+
if (ambient.length === 0) return;
|
|
125
|
+
// The flush parked: the declaration's window is the frame's — the marks
|
|
126
|
+
// are its transaction's ("nothing async below ⇒ no window").
|
|
127
|
+
if (e !== null) {
|
|
128
|
+
const t = e.T ??= [];
|
|
129
|
+
for (let e = 0; e < ambient.length; e++) t.push(ambient[e]);
|
|
130
|
+
ambient.length = 0;
|
|
118
131
|
return;
|
|
119
132
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
133
|
+
// Nothing parked, but a marked node's own flight is up (a declared
|
|
134
|
+
// reload's quiet re-ask — the node's, or a store leaf's family derive):
|
|
135
|
+
// the window is the flight's; the mark stays to the seam after the
|
|
136
|
+
// landing. The rest release: verdict-only, nothing to show.
|
|
137
|
+
let t = 0;
|
|
138
|
+
const r = [];
|
|
139
|
+
for (let e = 0; e < ambient.length; e++) {
|
|
140
|
+
const n = ambient[e];
|
|
141
|
+
if (inFlight(n)) ambient[t++] = n; else r.push(n);
|
|
124
142
|
}
|
|
143
|
+
ambient.length = t;
|
|
144
|
+
if (r.length !== 0) release(r);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
function inFlight(e) {
|
|
148
|
+
return (e.S & STATUS_PENDING) !== 0 || (e.i & CONFIG_SLOT_NODE) !== 0 && GlobalQueue.C?.(e) === true;
|
|
125
149
|
}
|
|
126
150
|
|
|
127
151
|
export { affects };
|