@solidjs/signals 2.0.0-rc.19 → 2.0.0-rc.20

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 (74) hide show
  1. package/dist/dev-shared.js +553 -264
  2. package/dist/dev.attribution.js +18 -18
  3. package/dist/dev.js +1030 -439
  4. package/dist/observe/affects.js +12 -2
  5. package/dist/observe/boundaries.js +168 -115
  6. package/dist/observe/core/async.js +57 -37
  7. package/dist/observe/core/attribution.js +6 -6
  8. package/dist/observe/core/constants.js +9 -1
  9. package/dist/observe/core/copies.js +10 -0
  10. package/dist/observe/core/core.js +261 -181
  11. package/dist/observe/core/effect.js +32 -27
  12. package/dist/observe/core/graph.js +7 -7
  13. package/dist/observe/core/heap.js +29 -29
  14. package/dist/observe/core/lanes.js +301 -101
  15. package/dist/observe/core/owner.js +13 -13
  16. package/dist/observe/core/scheduler.js +124 -69
  17. package/dist/observe/core/truth.js +9 -7
  18. package/dist/observe/core/verdict.js +160 -98
  19. package/dist/observe/deferred.js +1 -1
  20. package/dist/observe/index.js +2 -0
  21. package/dist/observe/map.js +120 -116
  22. package/dist/observe/reveal.js +48 -48
  23. package/dist/observe/signals.js +5 -5
  24. package/dist/observe/store/affects.js +2 -2
  25. package/dist/observe/store/optimistic.js +272 -176
  26. package/dist/observe/store/projection.js +21 -10
  27. package/dist/observe/store/reconcile.js +8 -2
  28. package/dist/observe/store/store.js +91 -55
  29. package/dist/observe/store/types.js +11 -1
  30. package/dist/observe/store/utils.js +1 -1
  31. package/dist/prod/affects.js +12 -2
  32. package/dist/prod/boundaries.js +164 -109
  33. package/dist/prod/core/async.js +201 -181
  34. package/dist/prod/core/constants.js +9 -1
  35. package/dist/prod/core/copies.js +10 -0
  36. package/dist/prod/core/core.js +244 -164
  37. package/dist/prod/core/dev.js +108 -3
  38. package/dist/prod/core/effect.js +28 -23
  39. package/dist/prod/core/graph.js +9 -9
  40. package/dist/prod/core/heap.js +16 -16
  41. package/dist/prod/core/identities.js +1 -1
  42. package/dist/prod/core/lanes.js +307 -95
  43. package/dist/prod/core/owner.js +22 -22
  44. package/dist/prod/core/scheduler.js +266 -211
  45. package/dist/prod/core/truth.js +9 -7
  46. package/dist/prod/core/verdict.js +161 -99
  47. package/dist/prod/deferred.js +1 -1
  48. package/dist/prod/index.js +2 -0
  49. package/dist/prod/map.js +78 -74
  50. package/dist/prod/reveal.js +34 -34
  51. package/dist/prod/signals.js +3 -3
  52. package/dist/prod/store/affects.js +15 -15
  53. package/dist/prod/store/optimistic.js +185 -89
  54. package/dist/prod/store/projection.js +49 -38
  55. package/dist/prod/store/reconcile.js +8 -2
  56. package/dist/prod/store/store.js +99 -63
  57. package/dist/prod/store/types.js +11 -1
  58. package/dist/types/affects.d.ts +3 -2
  59. package/dist/types/boundaries.d.ts +14 -2
  60. package/dist/types/core/async.d.ts +2 -1
  61. package/dist/types/core/constants.d.ts +8 -0
  62. package/dist/types/core/copies.d.ts +54 -0
  63. package/dist/types/core/core.d.ts +15 -0
  64. package/dist/types/core/dev.d.ts +1 -1
  65. package/dist/types/core/lanes.d.ts +8 -1
  66. package/dist/types/core/scheduler.d.ts +36 -4
  67. package/dist/types/core/truth.d.ts +3 -1
  68. package/dist/types/core/types.d.ts +6 -0
  69. package/dist/types/index.d.ts +2 -0
  70. package/dist/types/store/hooks.d.ts +15 -1
  71. package/dist/types/store/store.d.ts +2 -1
  72. package/dist/types/store/target.d.ts +5 -0
  73. package/dist/types/store/types.d.ts +7 -0
  74. package/package.json +1 -1
@@ -43,11 +43,11 @@ const slotMinReady = t => isController(t) ? t.Qt() : ready(t);
43
43
  if (isController(t)) {
44
44
  t.$ = s;
45
45
  t.ee = r;
46
- t.Bt();
46
+ t.Jt();
47
47
  // Released and ready — every slot of its own has shown — it graduates,
48
48
  // as a boundary does when it shows content. Released at the frontier
49
49
  // but not ready, it stays the parent's frontier.
50
- if (!s && t.Jt && t._parent === e) t._parent = null;
50
+ if (!s && t.Xt && t._parent === e) t._parent = null;
51
51
  return;
52
52
  }
53
53
  if (t.$ !== s || t.ee !== r) {
@@ -58,98 +58,98 @@ const slotMinReady = t => isController(t) ? t.Qt() : ready(t);
58
58
  }
59
59
 
60
60
  class RevealController {
61
- Xt;
62
61
  Yt;
63
- Zt=[];
62
+ Zt;
63
+ ts=[];
64
64
  /** The controller gating this one, until it releases this one. */
65
65
  _parent=null;
66
66
  /** The state a parent forces on this whole group. */
67
67
  $=false;
68
68
  ee=false;
69
- Jt=true;
70
- ts=true;
71
- es=false;
69
+ Xt=true;
70
+ es=true;
71
+ ss=false;
72
72
  constructor(t, e) {
73
- this.Xt = t;
74
- this.Yt = e;
73
+ this.Yt = t;
74
+ this.Zt = e;
75
75
  }
76
76
  /** A slot that has left this controller's ownership: a boundary that has
77
77
  * shown content, a nested group that is ready. Shown is shown — it counts
78
- * as ready whatever happens to it later (a re-arm gates nobody else). */ ss(t) {
78
+ * as ready whatever happens to it later (a re-arm gates nobody else). */ rs(t) {
79
79
  return (isController(t) ? t._parent : t.v) !== this;
80
80
  }
81
81
  /** The slots this controller still owns, in registration order — the
82
- * ones the order's state is forced on. */ rs(t) {
83
- for (let e = 0; e < this.Zt.length; e++) {
84
- const s = this.Zt[e];
85
- if (!this.ss(s) && t(s) === false) return false;
82
+ * ones the order's state is forced on. */ ns(t) {
83
+ for (let e = 0; e < this.ts.length; e++) {
84
+ const s = this.ts[e];
85
+ if (!this.rs(s) && t(s) === false) return false;
86
86
  }
87
87
  return true;
88
88
  }
89
89
  /** Readiness is judged over every slot, done ones as ready. */ Lt() {
90
- for (let t = 0; t < this.Zt.length; t++) {
91
- const e = this.Zt[t];
92
- if (!this.ss(e) && !slotReady(e)) return false;
90
+ for (let t = 0; t < this.ts.length; t++) {
91
+ const e = this.ts[t];
92
+ if (!this.rs(e) && !slotReady(e)) return false;
93
93
  }
94
94
  return true;
95
95
  }
96
96
  /** Something visible to show under its own order — what an enclosing
97
97
  * `together` waits for: `together` — every slot minimally ready;
98
98
  * `sequential` — the first slot; `natural` — any. */ Qt() {
99
- const t = untrack(this.Xt);
100
- const e = this.Zt;
99
+ const t = untrack(this.Yt);
100
+ const e = this.ts;
101
101
  if (e.length === 0) return true;
102
- if (t === "sequential") return this.ss(e[0]) || slotMinReady(e[0]);
102
+ if (t === "sequential") return this.rs(e[0]) || slotMinReady(e[0]);
103
103
  for (let s = 0; s < e.length; s++) {
104
- const r = this.ss(e[s]) || slotMinReady(e[s]);
104
+ const r = this.rs(e[s]) || slotMinReady(e[s]);
105
105
  if (t === "natural" ? r : !r) return t === "natural";
106
106
  }
107
107
  return t !== "natural";
108
108
  }
109
109
  te(t) {
110
- if (this.Zt.includes(t)) return;
111
- this.Zt.push(t);
110
+ if (this.ts.includes(t)) return;
111
+ this.ts.push(t);
112
112
  // Gated from the start (collapsed in a collapsed sequential tail); the
113
113
  // evaluation releases what the order allows.
114
- const e = untrack(this.Xt) === "sequential" && !!untrack(this.Yt);
114
+ const e = untrack(this.Yt) === "sequential" && !!untrack(this.Zt);
115
115
  if (isController(t)) {
116
116
  t._parent = this;
117
117
  t.$ = true;
118
118
  t.ee = e;
119
- t.Bt();
119
+ t.Jt();
120
120
  } else {
121
121
  t.v = this;
122
122
  t.$ = true;
123
123
  t.ee = e;
124
124
  }
125
- untrack(() => this.Bt());
125
+ untrack(() => this.Jt());
126
126
  }
127
127
  oe(t) {
128
- const e = this.Zt.indexOf(t);
129
- if (e >= 0) this.Zt.splice(e, 1);
130
- untrack(() => this.Bt());
128
+ const e = this.ts.indexOf(t);
129
+ if (e >= 0) this.ts.splice(e, 1);
130
+ untrack(() => this.Jt());
131
131
  }
132
132
  /** Apply the order to the owned slots — or, gated by a parent, its state
133
- * to all of them. */ Bt() {
134
- if (this.es) return;
135
- this.es = true;
136
- const t = this.Jt;
137
- const e = this.ts;
133
+ * to all of them. */ Jt() {
134
+ if (this.ss) return;
135
+ this.ss = true;
136
+ const t = this.Xt;
137
+ const e = this.es;
138
138
  try {
139
- const t = untrack(this.Xt);
140
- const e = t === "sequential" && !!untrack(this.Yt);
139
+ const t = untrack(this.Yt);
140
+ const e = t === "sequential" && !!untrack(this.Zt);
141
141
  if (this.$) {
142
- this.rs(t => setSlotState(t, this, true, this.ee));
142
+ this.ns(t => setSlotState(t, this, true, this.ee));
143
143
  } else if (t === "natural") {
144
- this.rs(t => {
144
+ this.ns(t => {
145
145
  if (isController(t)) setSlotState(t, this, false, false); else setSlotState(t, this, !ready(t), false);
146
146
  });
147
147
  } else if (t === "together") {
148
- const t = this.rs(slotMinReady);
149
- this.rs(e => setSlotState(e, this, !t, false));
148
+ const t = this.ns(slotMinReady);
149
+ this.ns(e => setSlotState(e, this, !t, false));
150
150
  } else {
151
151
  let t = false;
152
- this.rs(s => {
152
+ this.ns(s => {
153
153
  if (t) return setSlotState(s, this, true, e);
154
154
  if (slotReady(s)) return setSlotState(s, this, false, false);
155
155
  t = true;
@@ -159,11 +159,11 @@ class RevealController {
159
159
  });
160
160
  }
161
161
  } finally {
162
- this.Jt = this.Lt();
163
- this.ts = this.Qt();
164
- this.es = false;
162
+ this.Xt = this.Lt();
163
+ this.es = this.Qt();
164
+ this.ss = false;
165
165
  }
166
- if (this._parent !== null && (t !== this.Jt || e !== this.ts)) this._parent.Bt();
166
+ if (this._parent !== null && (t !== this.Xt || e !== this.es)) this._parent.Jt();
167
167
  }
168
168
  }
169
169
 
@@ -188,9 +188,9 @@ class RevealController {
188
188
  return runWithOwner(s, () => {
189
189
  const e = t();
190
190
  const s = computed(() => {
191
- i.Xt();
192
191
  i.Yt();
193
- i.Bt();
192
+ i.Zt();
193
+ i.Jt();
194
194
  });
195
195
  if (true) s._name = "reveal order";
196
196
  if (r) {
@@ -206,7 +206,7 @@ class RevealController {
206
206
  setRevealHooks({
207
207
  te: (t, e) => t.te(e),
208
208
  oe: (t, e) => t.oe(e),
209
- P: t => t.Bt()
209
+ P: t => t.Jt()
210
210
  });
211
211
 
212
212
  export { createRevealOrder };
@@ -335,7 +335,7 @@ function createMemo(e, t) {
335
335
  * joined it (L2, born held — A29) and delivers at that commit: the
336
336
  * committed view, never a foreign hold's unrevealed frame. */ function watch(e, t, r, n = 0, o, c = flushTransaction) {
337
337
  if (n & CONFIG_AUTHORITATIVE) {
338
- GlobalQueue.rn = truthRead;
338
+ GlobalQueue.un = truthRead;
339
339
  GlobalQueue.tn = truthConfirmed;
340
340
  }
341
341
  // `config` is on the node for its first pass too (the pass runs inside
@@ -367,7 +367,7 @@ function createMemo(e, t) {
367
367
  o?.(u);
368
368
  queueMicrotask(() => t(u));
369
369
  }, {
370
- St: n
370
+ ct: n
371
371
  }).l |= CONFIG_REDERIVE;
372
372
  }
373
373
 
@@ -467,7 +467,7 @@ function createMemo(e, t) {
467
467
  // guessed node's own re-ask is not answered by it (#3895): park
468
468
  // on that flight, or reject with its error.
469
469
  const e = read(t);
470
- if (t.l & CONFIG_GUESS && t.m & (STATUS_PENDING | STATUS_ERROR)) throw t.T?.F;
470
+ if (t.l & CONFIG_GUESS && t.m & (STATUS_PENDING | STATUS_ERROR)) throw t.T?.U;
471
471
  return e;
472
472
  }, t => {
473
473
  n(typeof e === "function" ? t : e);
@@ -545,7 +545,7 @@ function createMemo(e, t) {
545
545
  // The flip, inside the pass of the flush carrying it: the flush
546
546
  // joins the action's transaction, and what it staged is held and
547
547
  // revealed with the action.
548
- if (e && c !== null && globalQueue.q && resolveTx(c).tt !== 0) joinFuture(c);
548
+ if (e && c !== null && globalQueue.Y && resolveTx(c).tt !== 0) joinFuture(c);
549
549
  });
550
550
  if (t?.timeout !== undefined) i = setTimeout(() => settle(() => n(new TimeoutError)), t.timeout);
551
551
  if (o !== undefined) {
@@ -663,7 +663,7 @@ function createMemo(e, t) {
663
663
  // still holding the optimistic value — reads do not pull (#3411). Fall
664
664
  // to the next pass while the heap has work; `run` swapped the queue,
665
665
  // so this lands there, and `enqueue` keeps the drain alive.
666
- if (dirtyQueue.jt >= dirtyQueue.lt) return globalQueue.enqueue(EFFECT_USER, fire);
666
+ if (dirtyQueue.yt >= dirtyQueue.Et) return globalQueue.enqueue(EFFECT_USER, fire);
667
667
  // Unowned, out-of-band fire (no owner, or a children-forbidden one this
668
668
  // one-shot must not bind to): a returned cleanup has no lifecycle to
669
669
  // attach to. Reject it in dev; in production the return is simply
@@ -40,7 +40,7 @@ function scopeOf(e, o) {
40
40
  if (n === undefined) scopes.set(e, n = {
41
41
  oo: new Set,
42
42
  no: [],
43
- Vt: o
43
+ gt: o
44
44
  });
45
45
  return n;
46
46
  }
@@ -94,7 +94,7 @@ function scopeOf(e, o) {
94
94
  * backings (§7b): a view's backing is another store's proxy — marks cover
95
95
  * the BASE raw, so every identity along the chain is checked. */ function covering(e, o, n) {
96
96
  for (const [t, s] of scopes) {
97
- if (t === n || s.Vt !== undefined && s.Vt !== o) continue;
97
+ if (t === n || s.gt !== undefined && s.gt !== o) continue;
98
98
  for (let o = e.v; ;) {
99
99
  if (s.oo.has(o)) return t;
100
100
  const e = o?.[$TARGET];