@solidjs/signals 2.0.0-rc.14 → 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.
Files changed (66) hide show
  1. package/dist/dev-shared.js +248 -189
  2. package/dist/dev.attribution.js +124 -41
  3. package/dist/dev.js +553 -322
  4. package/dist/observe/affects.js +34 -31
  5. package/dist/observe/boundaries.js +166 -132
  6. package/dist/observe/core/async.js +90 -83
  7. package/dist/observe/core/attribution-queries.js +1 -1
  8. package/dist/observe/core/attribution.js +281 -197
  9. package/dist/observe/core/constants.js +7 -2
  10. package/dist/observe/core/context.js +3 -3
  11. package/dist/observe/core/core.js +277 -245
  12. package/dist/observe/core/dev.js +3 -3
  13. package/dist/observe/core/effect.js +21 -21
  14. package/dist/observe/core/external.js +2 -2
  15. package/dist/observe/core/graph.js +25 -25
  16. package/dist/observe/core/heap.js +9 -9
  17. package/dist/observe/core/lanes.js +206 -160
  18. package/dist/observe/core/owner.js +27 -27
  19. package/dist/observe/core/scheduler.js +92 -86
  20. package/dist/observe/core/verdict.js +66 -54
  21. package/dist/observe/map.js +35 -35
  22. package/dist/observe/reveal.js +24 -24
  23. package/dist/observe/signals.js +38 -28
  24. package/dist/observe/store/affects.js +75 -68
  25. package/dist/observe/store/hooks.js +13 -0
  26. package/dist/observe/store/index.js +0 -2
  27. package/dist/observe/store/optimistic.js +67 -34
  28. package/dist/observe/store/projection.js +37 -31
  29. package/dist/observe/store/reconcile.js +32 -30
  30. package/dist/observe/store/store.js +128 -85
  31. package/dist/prod/affects.js +34 -31
  32. package/dist/prod/boundaries.js +143 -109
  33. package/dist/prod/core/async.js +64 -67
  34. package/dist/prod/core/constants.js +7 -2
  35. package/dist/prod/core/context.js +3 -3
  36. package/dist/prod/core/core.js +302 -270
  37. package/dist/prod/core/effect.js +38 -38
  38. package/dist/prod/core/external.js +4 -4
  39. package/dist/prod/core/graph.js +27 -27
  40. package/dist/prod/core/heap.js +30 -30
  41. package/dist/prod/core/lanes.js +257 -211
  42. package/dist/prod/core/owner.js +39 -39
  43. package/dist/prod/core/scheduler.js +125 -119
  44. package/dist/prod/core/verdict.js +70 -58
  45. package/dist/prod/map.js +73 -73
  46. package/dist/prod/reveal.js +38 -38
  47. package/dist/prod/signals.js +30 -20
  48. package/dist/prod/store/affects.js +75 -68
  49. package/dist/prod/store/hooks.js +13 -0
  50. package/dist/prod/store/index.js +0 -2
  51. package/dist/prod/store/optimistic.js +114 -81
  52. package/dist/prod/store/projection.js +30 -24
  53. package/dist/prod/store/reconcile.js +32 -30
  54. package/dist/prod/store/store.js +136 -93
  55. package/dist/types/boundaries.d.ts +4 -0
  56. package/dist/types/core/attribution.d.ts +6 -2
  57. package/dist/types/core/constants.d.ts +5 -0
  58. package/dist/types/core/core.d.ts +33 -3
  59. package/dist/types/core/lanes.d.ts +10 -0
  60. package/dist/types/core/scheduler.d.ts +12 -6
  61. package/dist/types/core/types.d.ts +0 -6
  62. package/dist/types/store/affects.d.ts +11 -0
  63. package/dist/types/store/hooks.d.ts +48 -0
  64. package/dist/types/store/index.d.ts +0 -1
  65. package/dist/types/store/store.d.ts +3 -38
  66. package/package.json +1 -1
@@ -16,11 +16,11 @@ import { schedule, dirtyQueue } from "./scheduler.js";
16
16
  // key off it, and the heap defers a zombie's recompute past the seam (no
17
17
  // second heap — the deferral list in scheduler.ts).
18
18
  function markDisposal(e) {
19
- let n = e.ge;
19
+ let n = e.Ve;
20
20
  while (n) {
21
21
  n.R |= REACTIVE_ZOMBIE;
22
22
  markDisposal(n);
23
- n = n.me;
23
+ n = n.ge;
24
24
  }
25
25
  }
26
26
 
@@ -31,7 +31,7 @@ function dispose(e) {
31
31
  // left queued would be recomputed and resurrected by the next flush (#2983)
32
32
  // — dep unlinking, child disposal) is exactly unobserved()'s body; only
33
33
  // this flag distinguishes death from dormancy.
34
- e.u &= ~CONFIG_AUTO_DISPOSE;
34
+ e.i &= ~CONFIG_AUTO_DISPOSE;
35
35
  unobserved(e);
36
36
  }
37
37
 
@@ -43,20 +43,20 @@ function disposeChildren(e, n = false, t) {
43
43
  // cleanups never run and it stays subscribed, rerunning in a torn-down
44
44
  // tree (#3561). Death only (`self`): a re-pass leaves the frame reacting
45
45
  // until the commit.
46
- if (n && !t && e.m !== null && (e.m.Me !== null || e.m.Be !== null)) disposeChildren(e, false, true);
46
+ if (n && !t && e.m !== null && (e.m.Qe !== null || e.m.ve !== null)) disposeChildren(e, false, true);
47
47
  if (n) {
48
48
  e.R = i | REACTIVE_DISPOSED;
49
49
  }
50
- if (n && e.re) {
51
- if (e.m !== null) e.m.De = null;
50
+ if (n && e.ee) {
51
+ if (e.m !== null) e.m.Te = null;
52
52
  // A death that can unblock the future (L2, `futureBlocked`): a held
53
53
  // flight's — a transaction's or a lane's (its `_x._transaction`) — or a
54
54
  // stale reader's (REACTIVE_FRAME_READ — a frame that derived from one).
55
55
  // Nothing else re-examines a dead node, so make sure a seam comes.
56
- if (e.G & STATUS_PENDING && e.m?.ke != null || i & REACTIVE_FRAME_READ) schedule();
56
+ if (e.S & STATUS_PENDING && e.m?.He != null || i & REACTIVE_FRAME_READ) schedule();
57
57
  }
58
- let l = t ? e.m.Me : e.ge;
59
- if (t) e.m.Me = null; else e.ge = null;
58
+ let l = t ? e.m.Qe : e.Ve;
59
+ if (t) e.m.Qe = null; else e.Ve = null;
60
60
  while (l) {
61
61
  const e = l;
62
62
  // Owner teardown is death regardless of the child's own lifecycle
@@ -66,7 +66,7 @@ function disposeChildren(e, n = false, t) {
66
66
  // disposeChildren call early-returns on REACTIVE_DISPOSED) die too.
67
67
  // Only unobserved()'s own node keeps its dormancy — it is never in
68
68
  // this loop; its children are rebuilt fresh on reawaken.
69
- e.u &= ~CONFIG_AUTO_DISPOSE;
69
+ e.i &= ~CONFIG_AUTO_DISPOSE;
70
70
  // Heap removal must not be gated on `_deps`: a dependency-free
71
71
  // computation queued by refresh() has a null dep list but still sits in
72
72
  // the dirty heap, and left there the post-disposal flush recomputes it —
@@ -80,43 +80,43 @@ function disposeChildren(e, n = false, t) {
80
80
  // on the fresh head and survives. Pointing each drained child's prev at
81
81
  // itself routes its later splice onto the detached chain, never the head,
82
82
  // and keeps the dev owner-chain-head invariant honest for those children.
83
- l.Je = l;
83
+ l.Ke = l;
84
84
  disposeChildren(l, true);
85
85
  // Read after, not before: a sibling this disposal made dormant spliced
86
86
  // itself out of the detached chain, and a cleanup may then have linked
87
87
  // it at the fresh head, which rewrote the `_nextSibling` a pre-read
88
88
  // would still be holding.
89
- l = l.me;
89
+ l = l.ge;
90
90
  }
91
- if (!t) e.Ye = 0;
91
+ if (!t) e.Be = 0;
92
92
  // O(1) splice out of parent's chain on individual dispose. Skipped during
93
93
  // batch dispose (parent already disposed) and for a zombie (it sits on the
94
94
  // parent's parked frame, drained whole by the commit). We leave
95
95
  // node._nextSibling intact so outer walks that already advanced past us
96
96
  // still reach later siblings.
97
97
  if (n && !t && !(i & REACTIVE_ZOMBIE) && e._parent !== null && !(e._parent.R & REACTIVE_DISPOSED)) {
98
- const n = e.Je;
99
- const t = e.me;
100
- if (n !== null) n.me = t; else e._parent.ge = t;
101
- if (t !== null) t.Je = n;
102
- e.Je = null;
98
+ const n = e.Ke;
99
+ const t = e.ge;
100
+ if (n !== null) n.ge = t; else e._parent.Ve = t;
101
+ if (t !== null) t.Ke = n;
102
+ e.Ke = null;
103
103
  }
104
104
  runDisposal(e, t);
105
105
  // Final effect-returned cleanup fires at true disposal, after `_disposal`
106
106
  // to mirror rerun ordering (compute-phase teardown first, cleanup last).
107
- if (n && e.lt) {
108
- const n = e.lt;
109
- e.lt = undefined;
107
+ if (n && e.st) {
108
+ const n = e.st;
109
+ e.st = undefined;
110
110
  n();
111
111
  }
112
112
  }
113
113
 
114
114
  function linkChild(e, n) {
115
- const t = e.ge;
116
- n.Je = null;
117
- n.me = t;
118
- if (t !== null) t.Je = n;
119
- e.ge = n;
115
+ const t = e.Ve;
116
+ n.Ke = null;
117
+ n.ge = t;
118
+ if (t !== null) t.Ke = n;
119
+ e.Ve = n;
120
120
  }
121
121
 
122
122
  function runDisposal(e, n) {
@@ -126,9 +126,9 @@ function runDisposal(e, n) {
126
126
  // walk ran every entry a second time. Detached, the re-entrant drain finds
127
127
  // nothing. The same shape latched a throwing cleanup: the list survived the
128
128
  // throw and every later drain re-ran and re-threw it.
129
- const t = n ? e.m.Be : e.Pe;
129
+ const t = n ? e.m.ve : e.Re;
130
130
  if (!t) return;
131
- if (n) e.m.Be = null; else e.Pe = null;
131
+ if (n) e.m.ve = null; else e.Re = null;
132
132
  if (Array.isArray(t)) {
133
133
  // Unwind order (#3572, restores 1.x #1562): later registrations run
134
134
  // before earlier ones. Children have already been disposed by the caller,
@@ -145,8 +145,8 @@ function runDisposal(e, n) {
145
145
 
146
146
  function childId(e, n) {
147
147
  let t = e;
148
- while (t.u & CONFIG_TRANSPARENT && t._parent) t = t._parent;
149
- if (t.id != null) return formatId(t.id, n ? t.Ye++ : t.Ye);
148
+ while (t.i & CONFIG_TRANSPARENT && t._parent) t = t._parent;
149
+ if (t.id != null) return formatId(t.id, n ? t.Be++ : t.Be);
150
150
  throw new Error("");
151
151
  }
152
152
 
@@ -226,7 +226,7 @@ function formatId(e, n) {
226
226
  * checks. `cleanup()` is the unchecked primitive used by internals.
227
227
  */ function cleanup(e) {
228
228
  if (!context) return e;
229
- if (!context.Pe) context.Pe = e; else if (Array.isArray(context.Pe)) context.Pe.push(e); else context.Pe = [ context.Pe, e ];
229
+ if (!context.Re) context.Re = e; else if (Array.isArray(context.Re)) context.Re.push(e); else context.Re = [ context.Re, e ];
230
230
  return e;
231
231
  }
232
232
 
@@ -269,15 +269,15 @@ function disposeRootSelf(e = true) {
269
269
  // is a plain store rather than a shape fork between labelled and plain roots.
270
270
  const i = {
271
271
  id: inheritId(e, t, n),
272
- u: t ? CONFIG_TRANSPARENT : 0,
273
- Et: true,
274
- ut: n?.Et ? n.ut : n,
272
+ i: t ? CONFIG_TRANSPARENT : 0,
273
+ $e: true,
274
+ et: n?.$e ? n.et : n,
275
+ Ve: null,
275
276
  ge: null,
276
- me: null,
277
- Je: null,
278
- Pe: null,
279
- U: n?.U || defaultContext,
280
- Ye: 0,
277
+ Ke: null,
278
+ Re: null,
279
+ D: n?.D || defaultContext,
280
+ Be: 0,
281
281
  m: null,
282
282
  _parent: n,
283
283
  dispose: disposeRootSelf