@solidjs/signals 2.0.0-rc.13 → 2.0.0-rc.14

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.
Files changed (118) hide show
  1. package/dist/dev-shared.js +2000 -3768
  2. package/dist/dev.attribution.js +132 -79
  3. package/dist/dev.js +7226 -8488
  4. package/dist/observe/affects.js +125 -104
  5. package/dist/observe/boundaries.js +458 -665
  6. package/dist/observe/core/action.js +63 -66
  7. package/dist/observe/core/async.js +240 -383
  8. package/dist/observe/core/attribution-queries.js +1 -1
  9. package/dist/observe/core/attribution.js +240 -183
  10. package/dist/observe/core/constants.js +115 -187
  11. package/dist/observe/core/context.js +3 -3
  12. package/dist/observe/core/core.js +840 -1438
  13. package/dist/observe/core/dev.js +3 -3
  14. package/dist/observe/core/effect.js +75 -86
  15. package/dist/observe/core/external.js +5 -5
  16. package/dist/observe/core/graph.js +61 -70
  17. package/dist/observe/core/heap.js +75 -98
  18. package/dist/observe/core/invariants.js +1 -34
  19. package/dist/observe/core/lanes.js +704 -181
  20. package/dist/observe/core/owner.js +80 -101
  21. package/dist/observe/core/scheduler.js +708 -1351
  22. package/dist/observe/core/verdict.js +302 -621
  23. package/dist/observe/flatten.js +79 -0
  24. package/dist/observe/index.js +15 -13
  25. package/dist/observe/map.js +232 -235
  26. package/dist/observe/reveal.js +212 -0
  27. package/dist/observe/signals.js +133 -215
  28. package/dist/observe/store/affects.js +135 -0
  29. package/dist/observe/store/index.js +29 -24
  30. package/dist/observe/store/optimistic.js +538 -0
  31. package/dist/observe/store/projection.js +302 -0
  32. package/dist/observe/store/reconcile.js +257 -0
  33. package/dist/observe/store/store.js +1945 -277
  34. package/dist/observe/store/storePath.js +1 -1
  35. package/dist/{prod/store/next → observe/store}/target.js +17 -18
  36. package/dist/observe/store/types.js +73 -0
  37. package/dist/observe/store/utils.js +1 -13
  38. package/dist/prod/affects.js +127 -106
  39. package/dist/prod/boundaries.js +442 -654
  40. package/dist/prod/core/action.js +71 -74
  41. package/dist/prod/core/async.js +307 -442
  42. package/dist/prod/core/constants.js +112 -186
  43. package/dist/prod/core/context.js +3 -3
  44. package/dist/prod/core/core.js +852 -1458
  45. package/dist/prod/core/effect.js +88 -99
  46. package/dist/prod/core/external.js +5 -5
  47. package/dist/prod/core/graph.js +61 -70
  48. package/dist/prod/core/heap.js +75 -98
  49. package/dist/prod/core/invariants.js +1 -32
  50. package/dist/prod/core/lanes.js +666 -181
  51. package/dist/prod/core/owner.js +75 -96
  52. package/dist/prod/core/scheduler.js +677 -1332
  53. package/dist/prod/core/verdict.js +297 -621
  54. package/dist/prod/flatten.js +77 -0
  55. package/dist/prod/index.js +15 -13
  56. package/dist/prod/map.js +143 -146
  57. package/dist/prod/reveal.js +212 -0
  58. package/dist/prod/signals.js +144 -226
  59. package/dist/prod/store/affects.js +135 -0
  60. package/dist/prod/store/index.js +28 -19
  61. package/dist/prod/store/optimistic.js +533 -0
  62. package/dist/prod/store/projection.js +295 -0
  63. package/dist/prod/store/reconcile.js +257 -0
  64. package/dist/prod/store/store.js +1840 -272
  65. package/dist/prod/store/storePath.js +1 -1
  66. package/dist/{observe/store/next → prod/store}/target.js +13 -17
  67. package/dist/prod/store/types.js +73 -0
  68. package/dist/prod/store/utils.js +1 -11
  69. package/dist/types/affects.d.ts +11 -30
  70. package/dist/types/boundaries.d.ts +62 -176
  71. package/dist/types/carved.d.ts +1 -0
  72. package/dist/types/core/action.d.ts +5 -6
  73. package/dist/types/core/async.d.ts +10 -5
  74. package/dist/types/core/attribution-hooks.d.ts +20 -1
  75. package/dist/types/core/attribution.d.ts +20 -9
  76. package/dist/types/core/constants.d.ts +125 -180
  77. package/dist/types/core/core.d.ts +104 -264
  78. package/dist/types/core/dev.d.ts +2 -2
  79. package/dist/types/core/effect.d.ts +0 -7
  80. package/dist/types/core/graph.d.ts +7 -1
  81. package/dist/types/core/heap.d.ts +5 -7
  82. package/dist/types/core/index.d.ts +5 -5
  83. package/dist/types/core/invariants.d.ts +0 -29
  84. package/dist/types/core/lanes.d.ts +65 -87
  85. package/dist/types/core/owner.d.ts +3 -3
  86. package/dist/types/core/scheduler.d.ts +249 -331
  87. package/dist/types/core/types.d.ts +51 -85
  88. package/dist/types/core/verdict.d.ts +3 -0
  89. package/dist/types/flatten.d.ts +8 -0
  90. package/dist/types/index.d.ts +6 -4
  91. package/dist/types/reveal.d.ts +19 -0
  92. package/dist/types/signals.d.ts +35 -91
  93. package/dist/types/store/affects.d.ts +1 -0
  94. package/dist/types/store/index.d.ts +35 -15
  95. package/dist/types/store/optimistic.d.ts +23 -0
  96. package/dist/types/store/projection.d.ts +18 -0
  97. package/dist/types/store/reconcile.d.ts +3 -0
  98. package/dist/types/store/store.d.ts +165 -143
  99. package/dist/types/store/storePath.d.ts +1 -1
  100. package/dist/types/store/target.d.ts +151 -0
  101. package/dist/types/store/types.d.ts +84 -0
  102. package/package.json +1 -1
  103. package/dist/observe/core/optimistic.js +0 -669
  104. package/dist/observe/store/next/optimistic.js +0 -717
  105. package/dist/observe/store/next/projection.js +0 -266
  106. package/dist/observe/store/next/reconcile.js +0 -375
  107. package/dist/observe/store/next/store.js +0 -2608
  108. package/dist/prod/core/optimistic.js +0 -658
  109. package/dist/prod/store/next/optimistic.js +0 -710
  110. package/dist/prod/store/next/projection.js +0 -257
  111. package/dist/prod/store/next/reconcile.js +0 -373
  112. package/dist/prod/store/next/store.js +0 -2484
  113. package/dist/types/core/optimistic.d.ts +0 -6
  114. package/dist/types/store/next/optimistic.d.ts +0 -25
  115. package/dist/types/store/next/projection.d.ts +0 -27
  116. package/dist/types/store/next/reconcile.d.ts +0 -10
  117. package/dist/types/store/next/store.d.ts +0 -145
  118. package/dist/types/store/next/target.d.ts +0 -196
@@ -1,6 +1,6 @@
1
- import { REACTIVE_DISPOSED, LANE_RUN, STATUS_ERROR, EFFECT_USER, NOT_PENDING, CONFIG_AUTO_DISPOSE, CONFIG_CHILDREN_FORBIDDEN, EFFECT_TRACKED, EFFECT_RENDER, STATUS_PENDING } from "./constants.js";
1
+ import { NOT_PENDING, EFFECT_USER, CONFIG_AUTO_DISPOSE, CONFIG_CHILDREN_FORBIDDEN, EFFECT_TRACKED, EFFECT_RENDER, REACTIVE_DISPOSED, STATUS_ERROR, STATUS_PENDING } from "./constants.js";
2
2
 
3
- import { setEffectStatusNotify, ext, createEffectNode, recompute, computed, staleValues } from "./core.js";
3
+ import { createEffectNode, recompute, computed, staleValues, ext, setEffectStatusNotify } from "./core.js";
4
4
 
5
5
  import { unwrapStatusError, StatusError } from "./error.js";
6
6
 
@@ -8,75 +8,63 @@ import { trimStaleDeps } from "./graph.js";
8
8
 
9
9
  import { enqueueSub } from "./heap.js";
10
10
 
11
- import { GlobalQueue, currentTransition, activeTransition, haltReactivity, schedule } from "./scheduler.js";
11
+ import { globalQueue, schedule, GlobalQueue, haltReactivity } from "./scheduler.js";
12
12
 
13
13
  /**
14
14
  * Effects are the leaf nodes of our reactive graph. When their sources change, they are
15
15
  * automatically added to the queue of effects to re-execute, which will cause them to fetch their
16
16
  * sources and recompute
17
- */ function effect(t, e, E, r) {
18
- const n = !!r?.user;
19
- const i = createEffectNode(t, e, E, n ? EFFECT_USER : EFFECT_RENDER, r);
20
- recompute(i, true);
21
- // A first pass that derived from a live transaction's staged world was
22
- // staged into that transaction (recompute: born held); the transaction's
23
- // commit replays this effect. Its first run is not this creation's (A29).
24
- !r?.defer && i._e === NOT_PENDING && (i.je === EFFECT_USER || r?.schedule ? i.T.enqueue(i.je, runEffect.bind(null, i)) : runEffect(i, LANE_RUN));
17
+ */ function effect(e, t, u, E) {
18
+ const f = !!E?.user;
19
+ const r = createEffectNode(e, t, u, f ? EFFECT_USER : EFFECT_RENDER, E);
20
+ recompute(r, true);
21
+ // A first pass that read a staged value was staged itself (recompute: born
22
+ // staged); the flush's commit replays this effect. Its first run is not this
23
+ // creation's (A29). A lane's node likewise: its run is the lane's, queued
24
+ // by the pass and released at the reveal (lanes.ts).
25
+ !E?.defer && r.Ae === NOT_PENDING && !r.m?.ke?.Z && (r.i === EFFECT_USER || E?.schedule ? globalQueue.enqueue(r.i, runEffect.bind(null, r)) : runEffect(r, r.i));
25
26
  }
26
27
 
27
- function notifyEffectStatus(t, e) {
28
+ function notifyEffectStatus(e, t) {
28
29
  // Use passed values if provided, otherwise read from node
29
- const E = t !== undefined ? t : this.h;
30
- const r = e !== undefined ? e : this.o?._;
31
- if (E & STATUS_ERROR) {
32
- this.T.notify(this, STATUS_PENDING, 0);
33
- if (this.je === EFFECT_USER) {
30
+ const u = e !== undefined ? e : this.G;
31
+ const E = t !== undefined ? t : this.m?.V;
32
+ if (u & STATUS_ERROR) {
33
+ globalQueue.notify(this, STATUS_PENDING, 0);
34
+ if (this.i === EFFECT_USER) {
34
35
  // The error handler is the error arm of the effect phase (#2840 ruling):
35
36
  // queue it like the effect function. It runs in the same imperative,
36
- // writable scope, throws escalate the same way, and a held transition
37
- // (or optimistic lane) defers it exactly as it defers the success arm.
38
- // No payload is queued — the node already carries `_statusFlags`/`_error`,
37
+ // writable scope and throws escalate the same way. No payload is queued — the node already carries `_statusFlags`/`_error`,
39
38
  // and the runner dispatches on them, so a recovery before the effect
40
39
  // phase takes the success arm instead. Blocked forwards (explicit
41
40
  // `status` arg without node-state writes) don't queue: the status
42
41
  // re-propagates unblocked at commit.
43
- if (this.h & STATUS_ERROR) {
44
- this.Xe = true;
45
- this.T.enqueue(this.je, this.An ??= runEffect.bind(null, this));
42
+ if (this.G & STATUS_ERROR) {
43
+ this.Fe = true;
44
+ globalQueue.enqueue(this.i, this.J ??= runEffect.bind(null, this));
46
45
  }
47
46
  return;
48
47
  }
49
- if (!this.T.notify(this, STATUS_ERROR, STATUS_ERROR)) {
50
- haltReactivity(unwrapStatusError(r));
51
- throw r;
48
+ if (!globalQueue.notify(this, STATUS_ERROR, STATUS_ERROR)) {
49
+ haltReactivity(unwrapStatusError(E));
50
+ throw E;
52
51
  }
53
- } else if (this.je === EFFECT_RENDER) {
54
- this.T.notify(this, STATUS_PENDING | STATUS_ERROR, E, r);
52
+ } else if (this.i === EFFECT_RENDER) {
53
+ globalQueue.notify(this, STATUS_PENDING | STATUS_ERROR, u, E);
55
54
  }
56
55
  }
57
56
 
58
- function runEffect(t, e) {
59
- if (!t.Xe || t.oe & REACTIVE_DISPOSED) return;
60
- // Ownership (#3319): a value computed under a transaction is applied by that
61
- // transaction's commit. The ordinary effect phase runs with a transaction
62
- // active only when the flush's finalize ENTERED one (every other path parks
63
- // or settles first): leave a run owned by a still-held transaction queued —
64
- // `_modified` stays set — and the next gate stashes it with the owner.
65
- // Mainline-owned runs (null) apply now. Lanes are exempt by design (they
66
- // apply their own effects ahead of their transaction — the optimistic view)
67
- // and mark their runs with LANE_RUN.
68
-
69
- // Lane exemption has one exception (#3331): a lane runner for an effect that
70
- // no longer rides a lane — its optimistic source was superseded, so the lane
71
- // has no optimistic view left to apply, and the value this effect now
72
- // carries (or will, once its plain recompute lands) belongs to the still-held
73
- // transaction. Hand the run to the regular queue, where the transaction's
74
- // gate stashes it with the owner. Lane-less runners with no live owner
75
- // (reverts, wake-only lanes) apply now.
76
- if (t.pn !== null && !currentTransition(t.pn).Rn && (e & LANE_RUN ? !t.o?.me : activeTransition !== null)) {
77
- t.T.enqueue(t.je, t.An);
78
- return;
79
- }
57
+ function runEffect(e, t) {
58
+ if (!e.Fe || e.R & REACTIVE_DISPOSED) return;
59
+ // A queued run behind a fallback (boundaries.ts) waits for the reveal: a
60
+ // user effect's, which would read a DOM that is not attached, and a render
61
+ // effect's update too (maintainer, 2026-10-02: "we held the queue but let
62
+ // the sync renders through… we definitely shouldn't be showing portals
63
+ // early") — a Portal's or head-tag's render effect writes outside the
64
+ // hidden subtree. The synchronous first render on creation is not a queued
65
+ // run and goes through. `_modified` stays set; the boundary re-queues the
66
+ // run (`release`).
67
+ if (GlobalQueue.de && GlobalQueue.de(e)) return;
80
68
  // Error arm (#2840), user effects only: a compute-phase error that is still
81
69
  // the node's settled state at effect time runs the bundle's error handler in
82
70
  // this same imperative, writable scope. Unwrap the StatusError used for
@@ -87,93 +75,94 @@ function runEffect(t, e) {
87
75
  // Render effects bypass: their errors route to boundaries synchronously in
88
76
  // notifyEffectStatus, and a runner queued by an earlier valueChanged in the
89
77
  // same flush must not be hijacked by a later-arriving error status.
90
- if (t.h & STATUS_ERROR && t.je === EFFECT_USER) {
91
- const e = unwrapStatusError(t.o?._);
92
- t.xn = t.ce;
93
- t.Xe = false;
78
+ if (e.G & STATUS_ERROR && e.i === EFFECT_USER) {
79
+ const t = unwrapStatusError(e.m?.V);
80
+ e.Ze = e.pe;
81
+ e.Fe = false;
94
82
  try {
95
- t.Mn ? t.Mn(e, () => {
96
- const e = t.wn;
97
- t.wn = undefined;
98
- e?.();
99
- }) : console.error(e);
100
- } catch (e) {
101
- if (!t.T.notify(t, STATUS_ERROR, STATUS_ERROR)) {
102
- haltReactivity(e);
103
- throw e;
83
+ e.it ? e.it(t, () => {
84
+ const t = e.lt;
85
+ e.lt = undefined;
86
+ t?.();
87
+ }) : console.error(t);
88
+ } catch (t) {
89
+ if (!globalQueue.notify(e, STATUS_ERROR, STATUS_ERROR)) {
90
+ haltReactivity(t);
91
+ throw t;
104
92
  }
105
93
  }
106
94
  return;
107
95
  }
108
96
  // Captured before the callback: its own throw errors the node below, but
109
97
  // the compute pass that produced `_value` was clean, so its tail still goes.
110
- const E = t.o?._ == null;
111
- const r = t.wn;
112
- t.wn = undefined;
98
+ const u = e.m?.V == null;
99
+ const E = e.lt;
100
+ e.lt = undefined;
113
101
  try {
114
- r?.();
115
- const e = t.Qn(t.ce, t.xn);
116
- if (false && e !== undefined && typeof e !== "function") ;
102
+ E?.();
103
+ const t = e.st(e.pe, e.Ze);
104
+ if (false && t !== undefined && typeof t !== "function") ;
117
105
  // The final cleanup is invoked by disposeChildren at true disposal.
118
- t.wn = e;
119
- } catch (e) {
120
- ext(t)._ = new StatusError(t, e);
121
- t.h |= STATUS_ERROR;
122
- if (!t.T.notify(t, STATUS_ERROR, STATUS_ERROR)) {
123
- haltReactivity(e);
124
- throw e;
106
+ e.lt = t;
107
+ } catch (t) {
108
+ ext(e).V = new StatusError(e, t);
109
+ e.G |= STATUS_ERROR;
110
+ if (!globalQueue.notify(e, STATUS_ERROR, STATUS_ERROR)) {
111
+ haltReactivity(t);
112
+ throw t;
125
113
  }
126
114
  } finally {
127
- t.xn = t.ce;
128
- t.Xe = false;
115
+ e.Ze = e.pe;
116
+ e.Fe = false;
129
117
  // The run applied: this is the frame now, so the dependency tail the
130
118
  // compute pass left linked goes (A30, #3438 — `recompute` defers an
131
119
  // effect's trim while a run is owed; the twin of `commitPendingNode`'s
132
120
  // trim for a staged pass). An errored compute kept its full list with
133
121
  // `_depsTail` marking where it stopped; leave it, as the commit does.
134
- if (E) trimStaleDeps(t);
122
+ if (u) trimStaleDeps(e);
135
123
  }
136
124
  }
137
125
 
138
- GlobalQueue.Cn = runEffect;
126
+ GlobalQueue.X = runEffect;
139
127
 
140
128
  /**
141
129
  * Internal tracked effect - bypasses heap, goes directly to effect queue.
142
130
  * Runs as a leaf owner: child primitives and onCleanup are forbidden (false throws).
143
131
  * Uses stale reads.
144
- */ function trackedEffect(t, e) {
132
+ */ function trackedEffect(e, t) {
145
133
  const run = () => {
146
134
  // `_modified` is NOT redundant with the heap: the heap dedups within a
147
- // pass, but a held transition's passes each enqueue `_run` into the same
148
- // user queue, and this gate is what collapses them into one run at commit.
149
- if (!E.Xe || E.oe & REACTIVE_DISPOSED) return;
135
+ // pass, but several passes in one flush each enqueue `_run` into the same
136
+ // user queue, and this gate is what collapses them into one run.
137
+ if (!u.Fe || u.R & REACTIVE_DISPOSED) return;
138
+ if (GlobalQueue.de && GlobalQueue.de(u)) return;
150
139
  try {
151
- E.Xe = false;
152
- recompute(E);
140
+ u.Fe = false;
141
+ recompute(u);
153
142
  } finally {}
154
143
  };
155
- const E = computed(() => {
156
- const e = E.wn;
157
- E.wn = undefined;
158
- e?.();
159
- const r = staleValues(t);
160
- E.wn = r;
144
+ const u = computed(() => {
145
+ const t = u.lt;
146
+ u.lt = undefined;
147
+ t?.();
148
+ const E = staleValues(e);
149
+ u.lt = E;
161
150
  }, {
162
- ...e,
151
+ ...t,
163
152
  lazy: true
164
153
  });
165
- E.wn = undefined;
166
- E.C = E.C & ~CONFIG_AUTO_DISPOSE | CONFIG_CHILDREN_FORBIDDEN;
167
- E.Xe = true;
168
- E.je = EFFECT_TRACKED;
154
+ u.lt = undefined;
155
+ u.u = u.u & ~CONFIG_AUTO_DISPOSE | CONFIG_CHILDREN_FORBIDDEN;
156
+ u.Fe = true;
157
+ u.i = EFFECT_TRACKED;
169
158
  // Status dispatch rides the SHARED notifier (statusNotifierOf keys off
170
159
  // _type): its error arm is behavior-identical to the closure that used to
171
160
  // live here, without the per-node NodeExtension allocation.
172
- E.$e = run;
161
+ u.q = run;
173
162
  // The first run rides the heap like every wake (GlobalQueue._update), so a
174
163
  // tracked effect created inside a render-effect callback runs after that
175
164
  // pass's staged writes commit, not before.
176
- enqueueSub(E);
165
+ enqueueSub(u);
177
166
  schedule();
178
167
  }
179
168
 
@@ -46,11 +46,11 @@ function wireExternalSource(e) {
46
46
  equals: false,
47
47
  ownedWrite: true
48
48
  });
49
- const r = externalSourceConfig.factory(e.he, () => {
49
+ const r = externalSourceConfig.factory(e.re, () => {
50
50
  setSignal(n, undefined);
51
51
  });
52
52
  cleanup(() => r.dispose());
53
- e.he = e => {
53
+ e.re = e => {
54
54
  read(n);
55
55
  return r.track(e);
56
56
  };
@@ -61,11 +61,11 @@ function externalUntrack(e) {
61
61
  }
62
62
 
63
63
  // The hooks mirror the config's liveness exactly (installed on enable,
64
- // removed on reset) so core's null checks stay equivalent to the old
64
+ // removed on reset) so core's presence checks stay equivalent to the old
65
65
  // `externalSourceConfig` truthiness checks.
66
66
  function syncExternalHooks() {
67
- GlobalQueue.Zn = externalSourceConfig ? wireExternalSource : null;
68
- GlobalQueue.jn = externalSourceConfig ? externalUntrack : null;
67
+ GlobalQueue._t = externalSourceConfig ? wireExternalSource : undefined;
68
+ GlobalQueue.It = externalSourceConfig ? externalUntrack : undefined;
69
69
  }
70
70
 
71
71
  function enableExternalSource(e) {
@@ -1,47 +1,54 @@
1
1
  import { CONFIG_AUTO_DISPOSE, STATUS_PENDING, REACTIVE_DISPOSED, REACTIVE_ZOMBIE, CONFIG_SLOT_NODE, REACTIVE_RECOMPUTING_DEPS } from "./constants.js";
2
2
 
3
- import { slotUnobservedHook } from "./core.js";
4
-
5
- import { deleteFromHeap, queueFor } from "./heap.js";
3
+ import { deleteFromHeap } from "./heap.js";
6
4
 
7
5
  import { disposeChildren } from "./owner.js";
8
6
 
9
- import { bumpNotifyEpoch } from "./scheduler.js";
7
+ import { bumpNotifyEpoch, dirtyQueue } from "./scheduler.js";
8
+
9
+ /** The store's shared slot-node release handler (store/store.ts installs it
10
+ * once) — a live binding read directly by the sweep site: no wrapper frame,
11
+ * no null check (a CONFIG_SLOT_NODE node existing implies the store module
12
+ * loaded and registered it). */ let slotUnobservedHook;
13
+
14
+ function setSlotUnobserved(e) {
15
+ slotUnobservedHook = e;
16
+ }
10
17
 
11
18
  // https://github.com/stackblitz/alien-signals/blob/v2.0.3/src/system.ts#L100
12
19
  function unlinkSubs(e) {
13
- const n = e.Oe;
14
- const l = e.Ne;
15
- const o = e.Ae;
16
- const s = e.el;
17
- if (o !== null) o.el = s; else n.mn = s;
18
- if (s !== null) s.Ae = o; else {
19
- n.u = o;
20
- if (o === null) {
21
- // Slot nodes (store leaves) dispatch to the ONE shared hook — no
22
- // per-node unobserved closure, no NodeExtension to hold it.
23
- if (n.C & CONFIG_SLOT_NODE) slotUnobservedHook(n); else n.o?.Hn?.();
20
+ const n = e.I;
21
+ const o = e.p;
22
+ const l = e.l;
23
+ const t = e.en;
24
+ if (l !== null) l.en = t; else n.qe = t;
25
+ if (t !== null) t.l = l; else {
26
+ n.t = l;
27
+ if (l === null) {
28
+ // Store slot nodes dispatch to the ONE shared hook — no per-node
29
+ // unobserved closure, no NodeExtension to hold it.
30
+ if (n.u & CONFIG_SLOT_NODE) slotUnobservedHook(n); else n.m?.Xe?.();
24
31
  // No more subscribers; only tear down if CONFIG_AUTO_DISPOSE is set.
25
- // A pending node is exempt: its in-flight async work (or the
26
- // transition holding it) is an observer — tearing down would orphan
27
- // the work and re-execute it on the next read. The settle path runs
28
- // this same last-one-out check when that observer releases (the
29
- // untracked-read dormancy sweep guards on pending identically).
32
+ // A pending node is exempt: its in-flight async work is an observer —
33
+ // tearing down would orphan the work and re-execute it on the next
34
+ // read. The settle path runs this same last-one-out check when that
35
+ // observer releases (the untracked-read dormancy sweep guards on
36
+ // pending identically).
30
37
  const e = n;
31
- e.he && e.C & CONFIG_AUTO_DISPOSE && !(e.oe & REACTIVE_ZOMBIE) && !(e.h & STATUS_PENDING) && unobserved(e);
38
+ e.re && e.u & CONFIG_AUTO_DISPOSE && !(e.R & REACTIVE_ZOMBIE) && !(e.G & STATUS_PENDING) && unobserved(e);
32
39
  }
33
40
  }
34
- return l;
41
+ return o;
35
42
  }
36
43
 
37
44
  function trimStaleDeps(e) {
38
- const n = e.Nn;
39
- let l = n !== null ? n.Ne : e.Ie;
40
- if (l !== null) {
45
+ const n = e.S;
46
+ let o = n !== null ? n.p : e._;
47
+ if (o !== null) {
41
48
  do {
42
- l = unlinkSubs(l);
43
- } while (l !== null);
44
- if (n !== null) n.Ne = null; else e.Ie = null;
49
+ o = unlinkSubs(o);
50
+ } while (o !== null);
51
+ if (n !== null) n.p = null; else e._ = null;
45
52
  }
46
53
  }
47
54
 
@@ -50,17 +57,17 @@ function trimStaleDeps(e) {
50
57
  // and skipping early also avoids adding one (hidden-class churn) via the
51
58
  // null-out below.
52
59
  function clearDeps(e) {
53
- let n = e.Ie;
60
+ let n = e._;
54
61
  if (!n) return;
55
62
  do {
56
63
  n = unlinkSubs(n);
57
64
  } while (n !== null);
58
- e.Ie = null;
59
- e.Nn = null;
65
+ e._ = null;
66
+ e.S = null;
60
67
  }
61
68
 
62
69
  function unobserved(e) {
63
- deleteFromHeap(e, queueFor(e));
70
+ deleteFromHeap(e, dirtyQueue);
64
71
  clearDeps(e);
65
72
  disposeChildren(e, true);
66
73
  }
@@ -94,7 +101,7 @@ function sweepDormant() {
94
101
  // is an observer; the settle path re-runs last-one-out), lost its
95
102
  // AUTO_DISPOSE bit (owner teardown strips it, #3024), or already been
96
103
  // torn down.
97
- if (!e.u && e.C & CONFIG_AUTO_DISPOSE && !(e.h & STATUS_PENDING) && !(e.oe & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE))) {
104
+ if (!e.t && e.u & CONFIG_AUTO_DISPOSE && !(e.G & STATUS_PENDING) && !(e.R & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE))) {
98
105
  unobserved(e);
99
106
  }
100
107
  }
@@ -102,26 +109,16 @@ function sweepDormant() {
102
109
  }
103
110
 
104
111
  // https://github.com/stackblitz/alien-signals/blob/v2.0.3/src/system.ts#L52
105
- function link(e, n, l = false) {
106
- // Repeat touches within one pass AND-combine `_pendingObserver`: a probe
107
- // read (`isPending(() => x())`) beside a value read of the same dep must
108
- // not relabel the value dependency as probe-only — the value read is what
109
- // real-error propagation and affects() coverage key off, regardless of
110
- // read order within the computation.
111
- const o = n.Nn;
112
- if (o !== null && o.Oe === e) {
113
- o.ze &&= l;
114
- return;
115
- }
116
- let s = null;
117
- const t = n.oe & REACTIVE_RECOMPUTING_DEPS;
112
+ function link(e, n) {
113
+ const o = n.S;
114
+ if (o !== null && o.I === e) return;
115
+ let l = null;
116
+ const t = n.R & REACTIVE_RECOMPUTING_DEPS;
118
117
  if (t) {
119
- s = o !== null ? o.Ne : n.Ie;
120
- if (s !== null && s.Oe === e) {
121
- s.Be = n.Ye;
122
- n.Nn = s;
123
- // First touch of this pass: the previous pass's label is stale.
124
- s.ze = l;
118
+ l = o !== null ? o.p : n._;
119
+ if (l !== null && l.I === e) {
120
+ l.Ue = n.Ge;
121
+ n.S = l;
125
122
  return;
126
123
  }
127
124
  }
@@ -130,26 +127,20 @@ function link(e, n, l = false) {
130
127
  // [deps.._depsTail] prefix — the O(1) equivalent of scanning the dep list
131
128
  // (the old alien-signals `isValidLink` walk, O(n²) when a computation
132
129
  // re-reads earlier deps non-consecutively, e.g. store leaf reads).
133
- const r = e.mn;
134
- if (r !== null && r.ge === n && (!t || r.Be === n.Ye)) {
135
- // Gen-matched during a recompute = repeat touch this pass (AND); outside
136
- // a recompute there is no pass boundary, so the latest read labels it.
137
- if (t) r.ze &&= l; else r.ze = l;
138
- return;
139
- }
140
- const u = n.Nn = e.mn = {
141
- Oe: e,
142
- ge: n,
143
- Ne: s,
144
- el: r,
145
- Ae: null,
146
- Be: n.Ye,
147
- ze: l
130
+ const s = e.qe;
131
+ if (s !== null && s.o === n && (!t || s.Ue === n.Ge)) return;
132
+ const u = n.S = e.qe = {
133
+ I: e,
134
+ o: n,
135
+ p: l,
136
+ en: s,
137
+ l: null,
138
+ Ue: n.Ge
148
139
  };
149
- if (o !== null) o.Ne = u; else n.Ie = u;
150
- if (r !== null) r.Ae = u; else e.u = u;
140
+ if (o !== null) o.p = u; else n._ = u;
141
+ if (s !== null) s.l = u; else e.t = u;
151
142
  // New subscriber edge: staged-rewrite skips (§12d) must not miss it.
152
143
  bumpNotifyEpoch();
153
144
  }
154
145
 
155
- export { clearDeps, dormantNodes, link, sweepDormant, trimStaleDeps, unlinkSubs, unobserved };
146
+ export { clearDeps, dormantNodes, link, setSlotUnobserved, slotUnobservedHook, sweepDormant, trimStaleDeps, unlinkSubs, unobserved };