@solidjs/signals 2.0.0-rc.7 → 2.0.0-rc.8

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 (117) hide show
  1. package/dist/dev-shared.js +5243 -0
  2. package/dist/dev.attribution.js +2333 -0
  3. package/dist/dev.js +1229 -6834
  4. package/dist/observe/affects.js +127 -0
  5. package/dist/observe/attribution.js +1 -0
  6. package/dist/observe/boundaries.js +586 -0
  7. package/dist/observe/core/action.js +167 -0
  8. package/dist/observe/core/async.js +736 -0
  9. package/dist/observe/core/attribution-hooks.js +60 -0
  10. package/dist/observe/core/attribution.js +2318 -0
  11. package/dist/{types-cjs/core/constants.d.cts → observe/core/constants.js} +129 -73
  12. package/dist/{types-cjs/core/context.d.cts → observe/core/context.js} +37 -12
  13. package/dist/observe/core/core.js +1289 -0
  14. package/dist/observe/core/dev.js +232 -0
  15. package/dist/observe/core/effect.js +179 -0
  16. package/dist/observe/core/error.js +80 -0
  17. package/dist/observe/core/external.js +98 -0
  18. package/dist/observe/core/graph.js +155 -0
  19. package/dist/observe/core/heap.js +147 -0
  20. package/dist/observe/core/invariants.js +43 -0
  21. package/dist/observe/core/lanes.js +168 -0
  22. package/dist/observe/core/optimistic.js +438 -0
  23. package/dist/observe/core/owner.js +308 -0
  24. package/dist/observe/core/scheduler.js +1190 -0
  25. package/dist/observe/core/verdict.js +551 -0
  26. package/dist/observe/index.js +55 -0
  27. package/dist/observe/map.js +482 -0
  28. package/dist/{types-cjs/signals.d.cts → observe/signals.js} +295 -317
  29. package/dist/observe/store/index.js +38 -0
  30. package/dist/observe/store/next/optimistic.js +651 -0
  31. package/dist/observe/store/next/projection.js +242 -0
  32. package/dist/observe/store/next/reconcile.js +373 -0
  33. package/dist/observe/store/next/store.js +2213 -0
  34. package/dist/observe/store/next/target.js +51 -0
  35. package/dist/observe/store/store.js +323 -0
  36. package/dist/observe/store/storePath.js +103 -0
  37. package/dist/observe/store/utils.js +210 -0
  38. package/dist/prod/attribution.js +32 -0
  39. package/dist/prod/core/action.js +52 -32
  40. package/dist/prod/core/async.js +171 -127
  41. package/dist/prod/core/constants.js +24 -1
  42. package/dist/prod/core/context.js +3 -3
  43. package/dist/prod/core/core.js +434 -291
  44. package/dist/prod/core/effect.js +54 -34
  45. package/dist/prod/core/external.js +2 -2
  46. package/dist/prod/core/graph.js +32 -32
  47. package/dist/prod/core/heap.js +49 -44
  48. package/dist/prod/core/lanes.js +45 -38
  49. package/dist/prod/core/optimistic.js +207 -73
  50. package/dist/prod/core/owner.js +43 -39
  51. package/dist/prod/core/scheduler.js +319 -190
  52. package/dist/prod/core/verdict.js +67 -67
  53. package/dist/prod/index.js +9 -3
  54. package/dist/prod/map.js +292 -141
  55. package/dist/prod/signals.js +7 -10
  56. package/dist/prod/store/next/optimistic.js +140 -125
  57. package/dist/prod/store/next/projection.js +3 -3
  58. package/dist/prod/store/next/reconcile.js +87 -84
  59. package/dist/prod/store/next/store.js +524 -280
  60. package/dist/prod/store/next/target.js +32 -10
  61. package/dist/prod/store/store.js +12 -14
  62. package/dist/prod/store/utils.js +36 -27
  63. package/dist/types/attribution.d.ts +15 -0
  64. package/dist/types/attribution.prod.d.ts +13 -0
  65. package/dist/types/core/async.d.ts +1 -1
  66. package/dist/types/core/attribution-hooks.d.ts +119 -6
  67. package/dist/types/core/attribution.d.ts +208 -53
  68. package/dist/types/core/constants.d.ts +23 -0
  69. package/dist/types/core/core.d.ts +7 -0
  70. package/dist/types/core/dev.d.ts +124 -26
  71. package/dist/types/core/effect.d.ts +8 -1
  72. package/dist/types/core/index.d.ts +2 -1
  73. package/dist/types/core/lanes.d.ts +8 -1
  74. package/dist/types/core/scheduler.d.ts +60 -0
  75. package/dist/types/core/types.d.ts +29 -9
  76. package/dist/types/index.d.ts +9 -2
  77. package/dist/types/map.d.ts +2 -0
  78. package/dist/types/store/index.d.ts +1 -0
  79. package/dist/types/store/next/store.d.ts +5 -0
  80. package/dist/types/store/next/target.d.ts +36 -9
  81. package/dist/types/store/utils.d.ts +7 -0
  82. package/package.json +21 -17
  83. package/dist/node.cjs +0 -10541
  84. package/dist/node.dev.cjs +0 -13724
  85. package/dist/types-cjs/affects.d.cts +0 -47
  86. package/dist/types-cjs/boundaries.d.cts +0 -175
  87. package/dist/types-cjs/core/action.d.cts +0 -64
  88. package/dist/types-cjs/core/async.d.cts +0 -23
  89. package/dist/types-cjs/core/attribution-hooks.d.cts +0 -127
  90. package/dist/types-cjs/core/attribution.d.cts +0 -495
  91. package/dist/types-cjs/core/core.d.cts +0 -185
  92. package/dist/types-cjs/core/dev.d.cts +0 -136
  93. package/dist/types-cjs/core/effect.d.cts +0 -30
  94. package/dist/types-cjs/core/error.d.cts +0 -56
  95. package/dist/types-cjs/core/external.d.cts +0 -15
  96. package/dist/types-cjs/core/graph.d.cts +0 -28
  97. package/dist/types-cjs/core/heap.d.cts +0 -24
  98. package/dist/types-cjs/core/index.d.cts +0 -13
  99. package/dist/types-cjs/core/invariants.d.cts +0 -59
  100. package/dist/types-cjs/core/lanes.d.cts +0 -54
  101. package/dist/types-cjs/core/optimistic.d.cts +0 -6
  102. package/dist/types-cjs/core/owner.d.cts +0 -124
  103. package/dist/types-cjs/core/scheduler.d.cts +0 -236
  104. package/dist/types-cjs/core/types.d.cts +0 -204
  105. package/dist/types-cjs/core/verdict.d.cts +0 -2
  106. package/dist/types-cjs/index.d.cts +0 -10
  107. package/dist/types-cjs/map.d.cts +0 -69
  108. package/dist/types-cjs/package.json +0 -3
  109. package/dist/types-cjs/store/index.d.cts +0 -18
  110. package/dist/types-cjs/store/next/optimistic.d.cts +0 -25
  111. package/dist/types-cjs/store/next/projection.d.cts +0 -8
  112. package/dist/types-cjs/store/next/reconcile.d.cts +0 -10
  113. package/dist/types-cjs/store/next/store.d.cts +0 -121
  114. package/dist/types-cjs/store/next/target.d.cts +0 -166
  115. package/dist/types-cjs/store/store.d.cts +0 -143
  116. package/dist/types-cjs/store/storePath.d.cts +0 -58
  117. package/dist/types-cjs/store/utils.d.cts +0 -74
package/dist/prod/map.js CHANGED
@@ -24,165 +24,316 @@ function mapArray(t, s, i) {
24
24
  const e = typeof i?.keyed === "function" ? i.keyed : undefined;
25
25
  const r = s.length > 1;
26
26
  const n = s;
27
- const h = {
28
- $t: createOwner(),
29
- Jt: 0,
30
- Xt: t,
31
- Yt: [],
32
- Zt: n,
33
- ts: [],
34
- ss: [],
35
- Ht: e,
36
- es: e || i?.keyed === false ? [] : undefined,
37
- rs: r && i?.keyed !== false ? [] : undefined,
38
- ns: i?.keyed === false,
39
- hs: i?.fallback
27
+ const o = {
28
+ ts: createOwner(),
29
+ ss: 0,
30
+ es: t,
31
+ rs: [],
32
+ ns: n,
33
+ hs: [],
34
+ fs: [],
35
+ xt: e,
36
+ cs: e || i?.keyed === false ? [] : undefined,
37
+ ls: r && i?.keyed !== false ? [] : undefined,
38
+ us: i?.keyed === false,
39
+ ps: i?.fallback
40
40
  };
41
- const o = computed(updateKeyedMap.bind(h), undefined);
41
+ const h = computed(updateKeyedMap.bind(o), undefined);
42
42
  // Untracked reads inside the internal owner resolve via _parentComputed; routing
43
43
  // them through node lets store-proxy lookups see pending writes (not stale _value).
44
- h.$t.Pt = o;
45
- o.T &= ~CONFIG_AUTO_DISPOSE;
46
- return accessor(o);
44
+ o.ts.bt = h;
45
+ h.T &= ~CONFIG_AUTO_DISPOSE;
46
+ return accessor(h);
47
47
  }
48
48
 
49
49
  const pureOptions = {
50
50
  ownedWrite: true
51
51
  };
52
52
 
53
- // Exception safety (#2903): a map callback can throw NotReadyError mid-pass
54
- // (async read), and the computed re-runs the whole pass after settle. Every
55
- // pass therefore STAGES its work — new rows are created into temp arrays and
56
- // removals are deferred — and commits to `this` only after every mapper
57
- // succeeded. An aborted pass disposes just the owners it created and leaves
58
- // `_items`/`_mappings`/`_nodes`/`_rows`/`_indexes`/`_len` exactly as they
59
- // were, so the retry diffs against uncorrupted state. Consequence of the
60
- // strong-abort ordering: removed rows now dispose AFTER the pass's new rows
61
- // are created (you cannot destroy state before knowing the pass will land).
53
+ function trySmallMove(t, s, i, e) {
54
+ const r = t.rs;
55
+ const n = t.ss - 1;
56
+ const o = [];
57
+ const h = [];
58
+ const f = [];
59
+ // flat triples: oldStart, newStart, length
60
+ let c = 256;
61
+ let a = e;
62
+ let l = e;
63
+ let u = false;
64
+ while (a <= n && l <= i - 1) {
65
+ const t = r[a];
66
+ const e = s[l];
67
+ if (t === e) {
68
+ if (!u) {
69
+ f.push(a, l, 0);
70
+ u = true;
71
+ }
72
+ f[f.length - 1]++;
73
+ a++;
74
+ l++;
75
+ continue;
76
+ }
77
+ u = false;
78
+ // Bounded realignment lookahead, shorter distance wins.
79
+ let p = -1;
80
+ let d = Math.min(32 - o.length, n - a, c);
81
+ for (let t = 1; t <= d; t++) {
82
+ if (r[a + t] === e) {
83
+ p = t;
84
+ break;
85
+ }
86
+ }
87
+ c -= p === -1 ? d : p;
88
+ let w = -1;
89
+ d = Math.min(32 - h.length, i - 1 - l, c);
90
+ for (let i = 1; i <= d; i++) {
91
+ if (s[l + i] === t) {
92
+ w = i;
93
+ break;
94
+ }
95
+ }
96
+ c -= w === -1 ? d : w;
97
+ if (p !== -1 && (w === -1 || p <= w)) {
98
+ while (p-- > 0) o.push(a++);
99
+ continue;
100
+ }
101
+ if (w !== -1) {
102
+ while (w-- > 0) h.push(l++);
103
+ continue;
104
+ }
105
+ if (c <= 0 || o.length === 32 || h.length === 32) return false;
106
+ o.push(a++);
107
+ h.push(l++);
108
+ }
109
+ for (;a <= n; a++) {
110
+ if (o.length === 32) return false;
111
+ o.push(a);
112
+ }
113
+ for (;l <= i - 1; l++) {
114
+ if (h.length === 32) return false;
115
+ h.push(l);
116
+ }
117
+ return commitSmallMove(t, s, i, o, h, f);
118
+ }
119
+
120
+ /** PHASE 2 of the small-move path, in its OWN function so that a pass which
121
+ * only SCANS and bails (a full replace: the first structural pass of a page,
122
+ * typically) compiles nothing but the scan — V8 parses and compiles lazily
123
+ * per function, and cold `replace` measured +0.5 ms with both phases in one
124
+ * body. Pairs displaced sources with destinations (an unmatched destination
125
+ * is a replacement/insertion → general path), then commits: slice() the live
126
+ * arrays, copy shifted runs, patch displaced pairs, dispose leftovers. */ function commitSmallMove(t, s, i, e, r, n) {
127
+ const o = t.rs;
128
+ let h;
129
+ let f;
130
+ let c;
131
+ if (r.length !== 0) {
132
+ c = new Array(e.length);
133
+ for (f = 0; f < r.length; f++) {
134
+ let t = -1;
135
+ for (h = 0; h < e.length; h++) {
136
+ if (!c[h] && o[e[h]] === s[r[f]]) {
137
+ t = h;
138
+ break;
139
+ }
140
+ }
141
+ if (t === -1) return false;
142
+ c[t] = true;
143
+ r[f] = r[f] << 6 | t;
144
+ // pack pairing (found < 32)
145
+ }
146
+ }
147
+ // DUPLICATES: the general path pairs equal identities by OCCURRENCE ORDER
148
+ // (the chained index map). Displaced↔displaced pairing above is ascending
149
+ // on both sides, so it agrees; but an aligned run was matched by POSITION,
150
+ // and if a displaced identity also occurs inside a run the two algorithms
151
+ // can hand different occurrences different owners (row-local state moves;
152
+ // a shrink could dispose the wrong one). Decline that case — general path.
153
+ if (e.length !== 0 || r.length !== 0) {
154
+ const t = new Set;
155
+ for (h = 0; h < e.length; h++) t.add(o[e[h]]);
156
+ for (f = 0; f < r.length; f++) t.add(s[r[f] >> 6]);
157
+ for (let s = 0; s < n.length; s += 3) {
158
+ const i = n[s];
159
+ for (let e = 0, r = n[s + 2]; e < r; e++) if (t.has(o[i + e])) return false;
160
+ }
161
+ }
162
+ const a = t.hs;
163
+ const l = t.fs;
164
+ const u = a.slice(0, i);
165
+ const p = l.slice(0, i);
166
+ for (let t = 0; t < n.length; t += 3) {
167
+ const s = n[t];
168
+ const i = n[t + 1];
169
+ if (s !== i) {
170
+ for (let e = 0; e < n[t + 2]; e++) {
171
+ u[i + e] = a[s + e];
172
+ p[i + e] = l[s + e];
173
+ }
174
+ }
175
+ }
176
+ for (f = 0; f < r.length; f++) {
177
+ const t = r[f] >> 6;
178
+ const s = e[r[f] & 63];
179
+ u[t] = a[s];
180
+ p[t] = l[s];
181
+ }
182
+ t.hs = u;
183
+ t.fs = p;
184
+ t.ss = i;
185
+ t.rs = s.slice(0);
186
+ // Dispose unmatched sources LAST (general-path ordering).
187
+ for (h = 0; h < e.length; h++) {
188
+ if (c === undefined || !c[h]) l[e[h]].dispose();
189
+ }
190
+ return true;
191
+ }
192
+
62
193
  function updateKeyedMap() {
63
- const t = this.Xt() || [], s = t.length;
194
+ const t = this.es() || [], s = t.length;
64
195
  t[$TRACK];
65
196
  // top level tracking
66
- runWithOwner(this.$t, () => {
197
+ runWithOwner(this.ts, () => {
67
198
  let i, e, r, n,
68
199
  // Mappers write freshly-created row/index signals into the STAGE
69
200
  // arrays (`rows`/`indexes`), never into `this._rows`/`this._indexes`.
70
- h = this.es ? this.ns ? () => {
201
+ o = this.cs ? this.us ? () => {
71
202
  r[e] = signal(t[e], pureOptions);
72
- return this.Zt(accessor(r[e]), e);
203
+ return this.ns(accessor(r[e]), e);
73
204
  } : () => {
74
205
  r[e] = signal(t[e], pureOptions);
75
206
  n && (n[e] = signal(e, pureOptions));
76
- return this.Zt(accessor(r[e]), n ? accessor(n[e]) : undefined);
77
- } : this.rs ? () => {
207
+ return this.ns(accessor(r[e]), n ? accessor(n[e]) : undefined);
208
+ } : this.ls ? () => {
78
209
  const s = t[e];
79
210
  n[e] = signal(e, pureOptions);
80
- return this.Zt(s, accessor(n[e]));
211
+ return this.ns(s, accessor(n[e]));
81
212
  } : () => {
82
213
  const s = t[e];
83
- return this.Zt(s);
214
+ return this.ns(s);
84
215
  };
85
216
  // fast path for empty arrays
86
217
  if (s === 0) {
87
- if (this.Jt !== 0) {
88
- this.$t.dispose(false);
89
- this.ss = [];
90
- this.Yt = [];
91
- this.ts = [];
92
- this.Jt = 0;
93
- this.es && (this.es = []);
94
- this.rs && (this.rs = []);
218
+ if (this.ss !== 0) {
219
+ this.ts.dispose(false);
220
+ this.fs = [];
221
+ this.rs = [];
222
+ this.hs = [];
223
+ this.ss = 0;
224
+ this.cs && (this.cs = []);
225
+ this.ls && (this.ls = []);
95
226
  }
96
- if (this.hs && !this.ts[0]) {
227
+ if (this.ps && !this.hs[0]) {
97
228
  // an aborted fallback attempt leaves an owner without a mapping;
98
229
  // dispose it before re-creating
99
- this.ss[0]?.dispose();
100
- this.ts[0] = runWithOwner(this.ss[0] = createOwner(), this.hs);
230
+ this.fs[0]?.dispose();
231
+ this.hs[0] = runWithOwner(this.fs[0] = createOwner(), this.ps);
101
232
  }
102
233
  }
103
234
  // fast path for new create
104
- else if (this.Jt === 0) {
105
- const o = new Array(s);
106
- const a = new Array(s);
107
- r = this.es && new Array(s);
108
- n = this.rs && new Array(s);
235
+ else if (this.ss === 0) {
236
+ const h = new Array(s);
237
+ const f = new Array(s);
238
+ r = this.cs && new Array(s);
239
+ n = this.ls && new Array(s);
109
240
  try {
110
- for (e = 0; e < s; e++) o[e] = runWithOwner(a[e] = createOwner(), h);
241
+ for (e = 0; e < s; e++) h[e] = runWithOwner(f[e] = createOwner(), o);
111
242
  } catch (t) {
112
- for (i = 0; i <= e; i++) a[i]?.dispose();
243
+ for (i = 0; i <= e; i++) f[i]?.dispose();
113
244
  throw t;
114
245
  }
115
246
  // commit
116
- if (this.ss[0]) this.ss[0].dispose();
247
+ if (this.fs[0]) this.fs[0].dispose();
117
248
  // previous fallback
118
- this.ts = o;
119
- this.ss = a;
120
- r && (this.es = r);
121
- n && (this.rs = n);
122
- this.Yt = t.slice(0);
123
- this.Jt = s;
249
+ this.hs = h;
250
+ this.fs = f;
251
+ r && (this.cs = r);
252
+ n && (this.ls = n);
253
+ this.rs = t.slice(0);
254
+ this.ss = s;
124
255
  } else {
125
- let o, a, c, f, u, p, l, d, w,
256
+ let h, f, c, a, l, u, p, d, w,
126
257
  // Dev (attribution engine installed): the items behind the exited and
127
258
  // entered rows, for the list-identity census.
128
259
  m, O;
129
260
  // skip common prefix
130
- for (o = 0, a = Math.min(this.Jt, s); o < a && (this.Yt[o] === t[o] || this.es && compare(this.Ht, this.Yt[o], t[o])); o++) {
131
- if (this.es) setSignal(this.es[o], t[o]);
261
+ for (h = 0, f = Math.min(this.ss, s); h < f && (this.rs[h] === t[h] || this.cs && compare(this.xt, this.rs[h], t[h])); h++) {
262
+ if (this.cs) setSignal(this.cs[h], t[h]);
132
263
  }
133
264
  // skip common suffix — counted only; retained entries land in one pass
134
265
  // at commit instead of being staged and copied twice
135
- for (a = this.Jt - 1, c = s - 1; a >= o && c >= o && (this.Yt[a] === t[c] || this.es && compare(this.Ht, this.Yt[a], t[c])); a--,
266
+ for (f = this.ss - 1, c = s - 1; f >= h && c >= h && (this.rs[f] === t[c] || this.cs && compare(this.xt, this.rs[f], t[c])); f--,
136
267
  c--) ;
137
268
  // no structural change (every position matched in place at equal
138
269
  // length — the common post-reconcile shape): keep the same mapped
139
270
  // array identity so downstream consumers don't re-run at all
140
- if (o === s && this.Jt === s) {
141
- this.Yt = t.slice(0);
271
+ if (h === s && this.ss === s) {
272
+ this.rs = t.slice(0);
142
273
  return;
143
274
  }
144
- const _ = s - this.Jt;
275
+ // SMALL-MOVE FAST PATH: extracted to its own function — inlining it
276
+ // here bloats updateKeyedMap past the JIT's optimization budget and
277
+ // deoptimizes the GENERAL path (measured 2x on reverse). Gated to
278
+ // LARGE trimmed windows: when the trims already shrank the window
279
+ // (plain removals, tail edits), the general path is window-
280
+ // proportional and cheap — the fast path would only re-walk what the
281
+ // trims proved.
282
+ if (s <= this.ss && f - h > 64 && this.cs === undefined && this.ls === undefined) {
283
+ // PROBE before the scan: a small move keeps a mid-window item within
284
+ // ±32 of its old position; a REPLACE (all fresh items — the shape
285
+ // every page's first structural pass usually is) has it nowhere.
286
+ // ~65 compares, no allocation, and the scan function is never
287
+ // compiled for a replace (its cold first-call compile was the cost).
288
+ const i = h + (c - h >> 1);
289
+ const e = t[i];
290
+ const r = Math.min(f, i + 32);
291
+ let n = Math.max(h, i - 32);
292
+ while (n <= r && this.rs[n] !== e) n++;
293
+ if (n <= r && trySmallMove(this, t, s, h)) return;
294
+ }
295
+ const _ = s - this.ss;
145
296
  const y = new Array(s);
146
297
  const A = new Array(s);
147
- r = this.es ? new Array(s) : undefined;
148
- n = this.rs ? new Array(s) : undefined;
298
+ r = this.cs ? new Array(s) : undefined;
299
+ n = this.ls ? new Array(s) : undefined;
149
300
  // 0) prepare a map of all indices in the changed window of newItems,
150
301
  // scanning backwards so we encounter them in natural order
151
- p = new Map;
152
- l = new Array(c + 1);
153
- for (e = c; e >= o; e--) {
154
- f = t[e];
155
- u = this.Ht ? this.Ht(f) : f;
156
- i = p.get(u);
157
- l[e] = i === undefined ? -1 : i;
158
- p.set(u, e);
302
+ u = new Map;
303
+ p = new Array(c + 1);
304
+ for (e = c; e >= h; e--) {
305
+ a = t[e];
306
+ l = this.xt ? this.xt(a) : a;
307
+ i = u.get(l);
308
+ p[e] = i === undefined ? -1 : i;
309
+ u.set(l, e);
159
310
  }
160
311
  // 1) step through the old changed window and see if items can be found
161
312
  // in the new set; if so, stage them at their new positions; if not,
162
313
  // queue them for disposal at commit
163
- for (i = o; i <= a; i++) {
164
- f = this.Yt[i];
165
- u = this.Ht ? this.Ht(f) : f;
166
- e = p.get(u);
314
+ for (i = h; i <= f; i++) {
315
+ a = this.rs[i];
316
+ l = this.xt ? this.xt(a) : a;
317
+ e = u.get(l);
167
318
  if (e !== undefined && e !== -1) {
168
- y[e] = this.ts[i];
169
- A[e] = this.ss[i];
170
- r && (r[e] = this.es[i]);
171
- n && (n[e] = this.rs[i]);
172
- e = l[e];
173
- p.set(u, e);
319
+ y[e] = this.hs[i];
320
+ A[e] = this.fs[i];
321
+ r && (r[e] = this.cs[i]);
322
+ n && (n[e] = this.ls[i]);
323
+ e = p[e];
324
+ u.set(l, e);
174
325
  } else {
175
- (d ??= []).push(this.ss[i]);
326
+ (d ??= []).push(this.fs[i]);
176
327
  if (false && attrHooks !== null) ;
177
328
  }
178
329
  }
179
330
  // 2) create new rows into the temp arrays; an abort disposes only these
180
331
  try {
181
- for (e = o; e <= c; e++) {
332
+ for (e = h; e <= c; e++) {
182
333
  if (A[e] !== undefined) continue;
183
334
  (w ??= []).push(A[e] = createOwner());
184
335
  if (false && attrHooks !== null) ;
185
- y[e] = runWithOwner(A[e], h);
336
+ y[e] = runWithOwner(A[e], o);
186
337
  }
187
338
  } catch (t) {
188
339
  if (w) for (i = 0; i < w.length; i++) w[i].dispose();
@@ -191,40 +342,40 @@ function updateKeyedMap() {
191
342
  // 3) commit: land the retained prefix and suffix plus the staged window
192
343
  // into the fresh arrays, swap them in (new identity for downstream
193
344
  // change propagation), then dispose exited rows
194
- for (i = 0; i < o; i++) {
195
- y[i] = this.ts[i];
196
- A[i] = this.ss[i];
197
- r && (r[i] = this.es[i]);
198
- n && (n[i] = this.rs[i]);
345
+ for (i = 0; i < h; i++) {
346
+ y[i] = this.hs[i];
347
+ A[i] = this.fs[i];
348
+ r && (r[i] = this.cs[i]);
349
+ n && (n[i] = this.ls[i]);
199
350
  }
200
- for (e = o; e <= c; e++) {
351
+ for (e = h; e <= c; e++) {
201
352
  if (r) setSignal(r[e], t[e]);
202
353
  if (n) setSignal(n[e], e);
203
354
  }
204
355
  for (e = c + 1; e < s; e++) {
205
- y[e] = this.ts[e - _];
206
- A[e] = this.ss[e - _];
356
+ y[e] = this.hs[e - _];
357
+ A[e] = this.fs[e - _];
207
358
  if (r) {
208
- r[e] = this.es[e - _];
359
+ r[e] = this.cs[e - _];
209
360
  setSignal(r[e], t[e]);
210
361
  }
211
362
  if (n) {
212
- n[e] = this.rs[e - _];
363
+ n[e] = this.ls[e - _];
213
364
  if (_ !== 0) setSignal(n[e], e);
214
365
  }
215
366
  }
216
- this.ts = y;
217
- this.ss = A;
218
- r && (this.es = r);
219
- n && (this.rs = n);
220
- this.Jt = s;
367
+ this.hs = y;
368
+ this.fs = A;
369
+ r && (this.cs = r);
370
+ n && (this.ls = n);
371
+ this.ss = s;
221
372
  // save a copy of the mapped items for the next update
222
- this.Yt = t.slice(0);
373
+ this.rs = t.slice(0);
223
374
  if (d) for (i = 0; i < d.length; i++) d[i].dispose();
224
375
  if (false && attrHooks !== null && m !== undefined && O !== undefined) ;
225
376
  }
226
377
  });
227
- return this.ts;
378
+ return this.hs;
228
379
  }
229
380
 
230
381
  /**
@@ -244,21 +395,21 @@ function updateKeyedMap() {
244
395
  */ function repeat(t, s, i) {
245
396
  const e = s;
246
397
  const r = {
247
- $t: createOwner(),
248
- Jt: 0,
249
- cs: 0,
250
- fs: t,
251
- Zt: e,
252
- ss: [],
253
- ts: [],
254
- us: i?.from,
255
- hs: i?.fallback
398
+ ts: createOwner(),
399
+ ss: 0,
400
+ ds: 0,
401
+ ws: t,
402
+ ns: e,
403
+ fs: [],
404
+ hs: [],
405
+ Os: i?.from,
406
+ ps: i?.fallback
256
407
  };
257
408
  const n = computed(updateRepeat.bind(r));
258
409
  // Same as mapArray: untracked reads inside the internal owner resolve via
259
410
  // _parentComputed, so async reads in row callbacks register with the node
260
411
  // (pending tracking + post-settle retry) instead of vanishing.
261
- r.$t.Pt = n;
412
+ r.ts.bt = n;
262
413
  n.T &= ~CONFIG_AUTO_DISPOSE;
263
414
  return accessor(n);
264
415
  }
@@ -271,55 +422,55 @@ function updateKeyedMap() {
271
422
  // for the post-settle retry. The overlap math also subsumes the previous
272
423
  // disjoint-window/front-clear/end-clear/shift special cases.
273
424
  function updateRepeat() {
274
- const t = this.fs();
275
- const s = this.us?.() || 0;
276
- runWithOwner(this.$t, () => {
425
+ const t = this.ws();
426
+ const s = this.Os?.() || 0;
427
+ runWithOwner(this.ts, () => {
277
428
  if (t === 0) {
278
- if (this.Jt !== 0) {
279
- this.$t.dispose(false);
280
- this.ss = [];
281
- this.ts = [];
282
- this.Jt = 0;
429
+ if (this.ss !== 0) {
430
+ this.ts.dispose(false);
431
+ this.fs = [];
432
+ this.hs = [];
433
+ this.ss = 0;
283
434
  // Reset offset to match the cleared data (#2767, repro 2).
284
- this.cs = 0;
435
+ this.ds = 0;
285
436
  }
286
- if (this.hs && !this.ts[0]) {
437
+ if (this.ps && !this.hs[0]) {
287
438
  // an aborted fallback attempt leaves an owner without a mapping;
288
439
  // dispose it before re-creating
289
- this.ss[0]?.dispose();
290
- this.ts[0] = runWithOwner(this.ss[0] = createOwner(), this.hs);
440
+ this.fs[0]?.dispose();
441
+ this.hs[0] = runWithOwner(this.fs[0] = createOwner(), this.ps);
291
442
  }
292
443
  return;
293
444
  }
294
445
  const i = s + t;
295
- const e = this.cs + this.Jt;
446
+ const e = this.ds + this.ss;
296
447
  // Retained overlap [keepStart, keepEnd) in global indexes; empty when the
297
448
  // windows are disjoint or when coming from empty/fallback.
298
- const r = Math.max(s, this.cs);
449
+ const r = Math.max(s, this.ds);
299
450
  const n = Math.min(i, e);
300
- const h = new Array(t);
301
451
  const o = new Array(t);
452
+ const h = new Array(t);
302
453
  for (let t = r; t < n; t++) {
303
- o[t - s] = this.ss[t - this.cs];
304
- h[t - s] = this.ts[t - this.cs];
454
+ h[t - s] = this.fs[t - this.ds];
455
+ o[t - s] = this.hs[t - this.ds];
305
456
  }
306
457
  try {
307
458
  for (let t = s; t < i; t++) {
308
459
  if (t >= r && t < n) continue;
309
- h[t - s] = runWithOwner(o[t - s] = createOwner(), () => this.Zt(t));
460
+ o[t - s] = runWithOwner(h[t - s] = createOwner(), () => this.ns(t));
310
461
  }
311
462
  } catch (t) {
312
- for (let t = s; t < i; t++) if ((t < r || t >= n) && o[t - s]) o[t - s].dispose();
463
+ for (let t = s; t < i; t++) if ((t < r || t >= n) && h[t - s]) h[t - s].dispose();
313
464
  throw t;
314
465
  }
315
466
  // commit: dispose the previous fallback or the rows leaving the window
316
- if (this.Jt === 0) this.ss[0]?.dispose(); else for (let t = this.cs; t < e; t++) if (t < s || t >= i) this.ss[t - this.cs].dispose();
317
- this.ts = h;
318
- this.ss = o;
319
- this.cs = s;
320
- this.Jt = t;
467
+ if (this.ss === 0) this.fs[0]?.dispose(); else for (let t = this.ds; t < e; t++) if (t < s || t >= i) this.fs[t - this.ds].dispose();
468
+ this.hs = o;
469
+ this.fs = h;
470
+ this.ds = s;
471
+ this.ss = t;
321
472
  });
322
- return this.ts;
473
+ return this.hs;
323
474
  }
324
475
 
325
476
  function compare(t, s, i) {
@@ -281,10 +281,7 @@ function createMemo(e, t) {
281
281
  n = r;
282
282
  dispose(t);
283
283
  }, e.error, {
284
- ...false ? {
285
- ...t,
286
- name: t?.name ?? "effect"
287
- } : t,
284
+ ...t,
288
285
  user: true,
289
286
  defer: true
290
287
  });
@@ -330,7 +327,7 @@ function createMemo(e, t) {
330
327
  // route through the inherited queue.
331
328
  const i = getOwner();
332
329
  const o = new MicrotaskQueue;
333
- o.Le = i.C;
330
+ o.qe = i.C;
334
331
  // notify() forwards up the normal chain
335
332
  i.C = o;
336
333
  // A user effect rather than a bare computed: computeds are pull-based and
@@ -352,7 +349,7 @@ function createMemo(e, t) {
352
349
  // stale mainline value and resolves with old data.
353
350
  {
354
351
  user: true,
355
- At: CONFIG_DIRECT_COMMIT
352
+ Pt: CONFIG_DIRECT_COMMIT
356
353
  });
357
354
  });
358
355
  });
@@ -445,7 +442,7 @@ function createMemo(e, t) {
445
442
  if (i === null) {
446
443
  i = getOwner();
447
444
  const e = new MicrotaskQueue;
448
- e.Le = i.C;
445
+ e.qe = i.C;
449
446
  i.C = e;
450
447
  }
451
448
  return read(t);
@@ -457,7 +454,7 @@ function createMemo(e, t) {
457
454
  dispose(i);
458
455
  }, {
459
456
  user: true,
460
- At: CONFIG_DIRECT_COMMIT | CONFIG_AUTHORITATIVE_READ | CONFIG_FRESH_READ
457
+ Pt: CONFIG_DIRECT_COMMIT | CONFIG_AUTHORITATIVE_READ | CONFIG_FRESH_READ
461
458
  });
462
459
  make();
463
460
  });
@@ -542,7 +539,7 @@ function createMemo(e, t) {
542
539
  // entire point of the hold.
543
540
  const s = getOwner();
544
541
  const u = new MicrotaskQueue;
545
- u.Le = s.C;
542
+ u.qe = s.C;
546
543
  s.C = u;
547
544
  let f;
548
545
  let a;
@@ -572,7 +569,7 @@ function createMemo(e, t) {
572
569
  // the hold itself is keeping uncommitted.
573
570
  {
574
571
  user: true,
575
- At: CONFIG_AUTHORITATIVE_READ | CONFIG_DIRECT_COMMIT
572
+ Pt: CONFIG_AUTHORITATIVE_READ | CONFIG_DIRECT_COMMIT
576
573
  });
577
574
  if (t?.timeout !== undefined) f = setTimeout(() => settle(() => i(new TimeoutError)), t.timeout);
578
575
  if (o !== undefined) {