@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,54 +1,45 @@
1
- import { computed, runWithOwner, signal, currentOptimisticLane, setSignal } from "./core/core.js";
1
+ import { computed, runWithOwner, signal, setSignal } from "./core/core.js";
2
2
 
3
- import { activeLanes } from "./core/lanes.js";
4
-
5
- import { createOwner } from "./core/owner.js";
6
-
7
- import { GlobalQueue } from "./core/scheduler.js";
3
+ import "./core/verdict.js";
8
4
 
9
5
  import { CONFIG_AUTO_DISPOSE } from "./core/constants.js";
10
6
 
11
7
  import { attrHooks } from "./core/attribution-hooks.js";
12
8
 
13
- import "./core/invariants.js";
14
-
15
9
  import "./core/dev.js";
16
10
 
17
- import "./core/verdict.js";
11
+ import "./core/scheduler.js";
12
+
13
+ import { createOwner, getOwner } from "./core/owner.js";
18
14
 
19
15
  import "./core/effect.js";
20
16
 
21
17
  import { accessor } from "./signals.js";
22
18
 
23
- import { $TRACK } from "./store/store.js";
19
+ import { $TRACK } from "./store/types.js";
24
20
 
25
- import "./store/next/store.js";
26
-
27
- function mapArray(t, e, i) {
28
- const s = typeof i?.keyed === "function" ? i.keyed : undefined;
21
+ function mapArray(t, e, s) {
22
+ const i = typeof s?.keyed === "function" ? s.keyed : undefined;
29
23
  const r = e.length > 1;
30
24
  const n = e;
31
25
  const o = {
32
- ie: createOwner(),
33
- oi: 0,
34
- hi: t,
35
- fi: [],
36
- ci: n,
37
- ai: [],
38
- ui: [],
39
- zt: s,
40
- li: s || i?.keyed === false ? [] : undefined,
41
- pi: r && i?.keyed !== false ? [] : undefined,
42
- di: i?.keyed === false,
43
- mi: i?.fallback
26
+ H: createOwner(),
27
+ wt: 0,
28
+ Mt: t,
29
+ $t: [],
30
+ qt: n,
31
+ zt: [],
32
+ nn: [],
33
+ bt: i,
34
+ Jt: i || s?.keyed === false ? [] : undefined,
35
+ Xt: r && s?.keyed !== false ? [] : undefined,
36
+ Yt: s?.keyed === false,
37
+ P: s?.fallback
44
38
  };
45
- const h = computed(updateKeyedMap.bind(o), i?.name ? {
46
- name: i.name
39
+ const h = computed(updateKeyedMap.bind(o), s?.name ? {
40
+ name: s.name
47
41
  } : undefined);
48
- // Untracked reads inside the internal owner resolve via _parentComputed; routing
49
- // them through node lets store-proxy lookups see pending writes (not stale _value).
50
- o.ie.Yt = h;
51
- h.C &= ~CONFIG_AUTO_DISPOSE;
42
+ h.u &= ~CONFIG_AUTO_DISPOSE;
52
43
  return accessor(h);
53
44
  }
54
45
 
@@ -56,21 +47,21 @@ const pureOptions = {
56
47
  ownedWrite: true
57
48
  };
58
49
 
59
- function trySmallMove(t, e, i, s) {
60
- const r = t.fi;
61
- const n = t.oi - 1;
50
+ function trySmallMove(t, e, s, i) {
51
+ const r = t.$t;
52
+ const n = t.wt - 1;
62
53
  const o = [];
63
54
  const h = [];
64
55
  const f = [];
65
56
  // flat triples: oldStart, newStart, length
66
57
  let c = 256;
67
- let a = s;
68
- let u = s;
58
+ let a = i;
59
+ let u = i;
69
60
  let l = false;
70
- while (a <= n && u <= i - 1) {
61
+ while (a <= n && u <= s - 1) {
71
62
  const t = r[a];
72
- const s = e[u];
73
- if (t === s) {
63
+ const i = e[u];
64
+ if (t === i) {
74
65
  if (!l) {
75
66
  f.push(a, u, 0);
76
67
  l = true;
@@ -82,30 +73,30 @@ function trySmallMove(t, e, i, s) {
82
73
  }
83
74
  l = false;
84
75
  // Bounded realignment lookahead, shorter distance wins.
85
- let p = -1;
86
- let d = Math.min(32 - o.length, n - a, c);
87
- for (let t = 1; t <= d; t++) {
88
- if (r[a + t] === s) {
89
- p = t;
76
+ let d = -1;
77
+ let p = Math.min(32 - o.length, n - a, c);
78
+ for (let t = 1; t <= p; t++) {
79
+ if (r[a + t] === i) {
80
+ d = t;
90
81
  break;
91
82
  }
92
83
  }
93
- c -= p === -1 ? d : p;
94
- let m = -1;
95
- d = Math.min(32 - h.length, i - 1 - u, c);
96
- for (let i = 1; i <= d; i++) {
97
- if (e[u + i] === t) {
98
- m = i;
84
+ c -= d === -1 ? p : d;
85
+ let w = -1;
86
+ p = Math.min(32 - h.length, s - 1 - u, c);
87
+ for (let s = 1; s <= p; s++) {
88
+ if (e[u + s] === t) {
89
+ w = s;
99
90
  break;
100
91
  }
101
92
  }
102
- c -= m === -1 ? d : m;
103
- if (p !== -1 && (m === -1 || p <= m)) {
104
- while (p-- > 0) o.push(a++);
93
+ c -= w === -1 ? p : w;
94
+ if (d !== -1 && (w === -1 || d <= w)) {
95
+ while (d-- > 0) o.push(a++);
105
96
  continue;
106
97
  }
107
- if (m !== -1) {
108
- while (m-- > 0) h.push(u++);
98
+ if (w !== -1) {
99
+ while (w-- > 0) h.push(u++);
109
100
  continue;
110
101
  }
111
102
  if (c <= 0 || o.length === 32 || h.length === 32) return false;
@@ -116,11 +107,11 @@ function trySmallMove(t, e, i, s) {
116
107
  if (o.length === 32) return false;
117
108
  o.push(a);
118
109
  }
119
- for (;u <= i - 1; u++) {
110
+ for (;u <= s - 1; u++) {
120
111
  if (h.length === 32) return false;
121
112
  h.push(u);
122
113
  }
123
- return commitSmallMove(t, e, i, o, h, f);
114
+ return commitSmallMove(t, e, s, o, h, f);
124
115
  }
125
116
 
126
117
  /** PHASE 2 of the small-move path, in its OWN function so that a pass which
@@ -129,17 +120,17 @@ function trySmallMove(t, e, i, s) {
129
120
  * per function, and cold `replace` measured +0.5 ms with both phases in one
130
121
  * body. Pairs displaced sources with destinations (an unmatched destination
131
122
  * is a replacement/insertion → general path), then commits: slice() the live
132
- * arrays, copy shifted runs, patch displaced pairs, dispose leftovers. */ function commitSmallMove(t, e, i, s, r, n) {
133
- const o = t.fi;
123
+ * arrays, copy shifted runs, patch displaced pairs, dispose leftovers. */ function commitSmallMove(t, e, s, i, r, n) {
124
+ const o = t.$t;
134
125
  let h;
135
126
  let f;
136
127
  let c;
137
128
  if (r.length !== 0) {
138
- c = new Array(s.length);
129
+ c = new Array(i.length);
139
130
  for (f = 0; f < r.length; f++) {
140
131
  let t = -1;
141
- for (h = 0; h < s.length; h++) {
142
- if (!c[h] && o[s[h]] === e[r[f]]) {
132
+ for (h = 0; h < i.length; h++) {
133
+ if (!c[h] && o[i[h]] === e[r[f]]) {
143
134
  t = h;
144
135
  break;
145
136
  }
@@ -156,113 +147,120 @@ function trySmallMove(t, e, i, s) {
156
147
  // and if a displaced identity also occurs inside a run the two algorithms
157
148
  // can hand different occurrences different owners (row-local state moves;
158
149
  // a shrink could dispose the wrong one). Decline that case — general path.
159
- if (s.length !== 0 || r.length !== 0) {
150
+ if (i.length !== 0 || r.length !== 0) {
160
151
  const t = new Set;
161
- for (h = 0; h < s.length; h++) t.add(o[s[h]]);
152
+ for (h = 0; h < i.length; h++) t.add(o[i[h]]);
162
153
  for (f = 0; f < r.length; f++) t.add(e[r[f] >> 6]);
163
154
  for (let e = 0; e < n.length; e += 3) {
164
- const i = n[e];
165
- for (let s = 0, r = n[e + 2]; s < r; s++) if (t.has(o[i + s])) return false;
155
+ const s = n[e];
156
+ for (let i = 0, r = n[e + 2]; i < r; i++) if (t.has(o[s + i])) return false;
166
157
  }
167
158
  }
168
- const a = t.ai;
169
- const u = t.ui;
170
- const l = a.slice(0, i);
171
- const p = u.slice(0, i);
159
+ const a = t.zt;
160
+ const u = t.nn;
161
+ const l = a.slice(0, s);
162
+ const d = u.slice(0, s);
172
163
  for (let t = 0; t < n.length; t += 3) {
173
164
  const e = n[t];
174
- const i = n[t + 1];
175
- if (e !== i) {
176
- for (let s = 0; s < n[t + 2]; s++) {
177
- l[i + s] = a[e + s];
178
- p[i + s] = u[e + s];
165
+ const s = n[t + 1];
166
+ if (e !== s) {
167
+ for (let i = 0; i < n[t + 2]; i++) {
168
+ l[s + i] = a[e + i];
169
+ d[s + i] = u[e + i];
179
170
  }
180
171
  }
181
172
  }
182
173
  for (f = 0; f < r.length; f++) {
183
174
  const t = r[f] >> 6;
184
- const e = s[r[f] & 63];
175
+ const e = i[r[f] & 63];
185
176
  l[t] = a[e];
186
- p[t] = u[e];
177
+ d[t] = u[e];
187
178
  }
188
- t.ai = l;
189
- t.ui = p;
190
- t.oi = i;
191
- t.fi = e.slice(0);
179
+ t.zt = l;
180
+ t.nn = d;
181
+ t.wt = s;
182
+ t.$t = e.slice(0);
192
183
  // Dispose unmatched sources LAST (general-path ordering).
193
- for (h = 0; h < s.length; h++) {
194
- if (c === undefined || !c[h]) u[s[h]].dispose();
184
+ for (h = 0; h < i.length; h++) {
185
+ if (c === undefined || !c[h]) u[i[h]].dispose();
195
186
  }
196
187
  return true;
197
188
  }
198
189
 
199
190
  function updateKeyedMap() {
200
- const t = this.hi() || [], e = t.length;
191
+ // Untracked reads inside the internal owner resolve via _parentComputed:
192
+ // routed through the node, a store-proxy lookup sees pending writes (not a
193
+ // stale _value) and an async read in a row callback registers the node as
194
+ // the flight's reader (pending tracking + post-settle retry) instead of
195
+ // vanishing. Set per pass: the first pass runs inside `computed()`, before
196
+ // the node exists to the caller.
197
+ this.H.gt = getOwner();
198
+ const t = this.Mt() || [], e = t.length;
201
199
  t[$TRACK];
202
- // top level tracking
203
- runWithOwner(this.ie, () => {
204
- let i, s, r, n,
200
+ // top level tracking (a store array's container node)
201
+ runWithOwner(this.H, () => {
202
+ let s, i, r, n,
205
203
  // Mappers write freshly-created row/index signals into the STAGE
206
204
  // arrays (`rows`/`indexes`), never into `this._rows`/`this._indexes`.
207
- o = this.li ? this.di ? () => {
208
- r[s] = signal(t[s], pureOptions);
209
- return this.ci(accessor(r[s]), s);
205
+ o = this.Jt ? this.Yt ? () => {
206
+ r[i] = signal(t[i], pureOptions);
207
+ return this.qt(accessor(r[i]), i);
210
208
  } : () => {
211
- r[s] = signal(t[s], pureOptions);
212
- n && (n[s] = signal(s, pureOptions));
213
- return this.ci(accessor(r[s]), n ? accessor(n[s]) : undefined);
214
- } : this.pi ? () => {
215
- const e = t[s];
216
- n[s] = signal(s, pureOptions);
217
- return this.ci(e, accessor(n[s]));
209
+ r[i] = signal(t[i], pureOptions);
210
+ n && (n[i] = signal(i, pureOptions));
211
+ return this.qt(accessor(r[i]), n ? accessor(n[i]) : undefined);
212
+ } : this.Xt ? () => {
213
+ const e = t[i];
214
+ n[i] = signal(i, pureOptions);
215
+ return this.qt(e, accessor(n[i]));
218
216
  } : () => {
219
- const e = t[s];
220
- return this.ci(e);
217
+ const e = t[i];
218
+ return this.qt(e);
221
219
  };
222
220
  // fast path for empty arrays
223
221
  if (e === 0) {
224
- if (this.oi !== 0) {
225
- this.ie.dispose(false);
226
- this.ui = [];
227
- this.fi = [];
228
- this.ai = [];
229
- this.oi = 0;
230
- this.li && (this.li = []);
231
- this.pi && (this.pi = []);
222
+ if (this.wt !== 0) {
223
+ this.H.dispose(false);
224
+ this.nn = [];
225
+ this.$t = [];
226
+ this.zt = [];
227
+ this.wt = 0;
228
+ this.Jt && (this.Jt = []);
229
+ this.Xt && (this.Xt = []);
232
230
  }
233
- if (this.mi && !this.ai[0]) {
231
+ if (this.P && !this.zt[0]) {
234
232
  // an aborted fallback attempt leaves an owner without a mapping;
235
233
  // dispose it before re-creating
236
- this.ui[0]?.dispose();
237
- this.ai[0] = runWithOwner(this.ui[0] = createOwner(), this.mi);
234
+ this.nn[0]?.dispose();
235
+ this.zt[0] = runWithOwner(this.nn[0] = createOwner(), this.P);
238
236
  }
239
237
  }
240
238
  // fast path for new create
241
- else if (this.oi === 0) {
239
+ else if (this.wt === 0) {
242
240
  const h = new Array(e);
243
241
  const f = new Array(e);
244
- r = this.li && new Array(e);
245
- n = this.pi && new Array(e);
242
+ r = this.Jt && new Array(e);
243
+ n = this.Xt && new Array(e);
246
244
  try {
247
- for (s = 0; s < e; s++) h[s] = runWithOwner(f[s] = createOwner(), o);
245
+ for (i = 0; i < e; i++) h[i] = runWithOwner(f[i] = createOwner(), o);
248
246
  } catch (t) {
249
- for (i = 0; i <= s; i++) f[i]?.dispose();
247
+ for (s = 0; s <= i; s++) f[s]?.dispose();
250
248
  throw t;
251
249
  }
252
250
  // commit
253
- if (this.ui[0]) this.ui[0].dispose();
251
+ if (this.nn[0]) this.nn[0].dispose();
254
252
  // previous fallback
255
- this.ai = h;
256
- this.ui = f;
257
- r && (this.li = r);
258
- n && (this.pi = n);
259
- this.fi = t.slice(0);
260
- this.oi = e;
253
+ this.zt = h;
254
+ this.nn = f;
255
+ r && (this.Jt = r);
256
+ n && (this.Xt = n);
257
+ this.$t = t.slice(0);
258
+ this.wt = e;
261
259
  } else {
262
- let h, f, c, a, u, l, p, d, m,
260
+ let h, f, c, a, u, l, d, p, w,
263
261
  // Dev (attribution engine installed): the items behind the exited and
264
262
  // entered rows, for the list-identity census.
265
- w, O;
263
+ m, O;
266
264
  // The pass's write to a per-slot signal (a row accessor in index mode,
267
265
  // an index accessor in keyed mode). The list's frame lives in these
268
266
  // writes as much as in the computed's result, so under a LANE pass they
@@ -283,20 +281,21 @@ function updateKeyedMap() {
283
281
  // knows the slots are clean and drops the mark — and an unmarked map
284
282
  // takes `setSignal` directly. The engine is installed whenever a lane
285
283
  // is active.
286
- const _ = (this.wi = currentOptimisticLane !== null || this.wi && activeLanes.size !== 0) ? GlobalQueue.Vn : setSignal;
284
+ // CARVE 2: the lane-slot arm (`_landOnOverride`, F1) went with the engine.
285
+ const _ = setSignal;
287
286
  // skip common prefix
288
- for (h = 0, f = Math.min(this.oi, e); h < f && (this.fi[h] === t[h] || this.li && compare(this.zt, this.fi[h], t[h])); h++) {
289
- if (this.li) _(this.li[h], t[h]);
287
+ for (h = 0, f = Math.min(this.wt, e); h < f && (this.$t[h] === t[h] || this.Jt && compare(this.bt, this.$t[h], t[h])); h++) {
288
+ if (this.Jt) _(this.Jt[h], t[h]);
290
289
  }
291
290
  // skip common suffix — counted only; retained entries land in one pass
292
291
  // at commit instead of being staged and copied twice
293
- for (f = this.oi - 1, c = e - 1; f >= h && c >= h && (this.fi[f] === t[c] || this.li && compare(this.zt, this.fi[f], t[c])); f--,
292
+ for (f = this.wt - 1, c = e - 1; f >= h && c >= h && (this.$t[f] === t[c] || this.Jt && compare(this.bt, this.$t[f], t[c])); f--,
294
293
  c--) ;
295
294
  // no structural change (every position matched in place at equal
296
295
  // length — the common post-reconcile shape): keep the same mapped
297
296
  // array identity so downstream consumers don't re-run at all
298
- if (h === e && this.oi === e) {
299
- this.fi = t.slice(0);
297
+ if (h === e && this.wt === e) {
298
+ this.$t = t.slice(0);
300
299
  return;
301
300
  }
302
301
  // SMALL-MOVE FAST PATH: extracted to its own function — inlining it
@@ -306,103 +305,103 @@ function updateKeyedMap() {
306
305
  // (plain removals, tail edits), the general path is window-
307
306
  // proportional and cheap — the fast path would only re-walk what the
308
307
  // trims proved.
309
- if (e <= this.oi && f - h > 64 && this.li === undefined && this.pi === undefined) {
308
+ if (e <= this.wt && f - h > 64 && this.Jt === undefined && this.Xt === undefined) {
310
309
  // PROBE before the scan: a small move keeps a mid-window item within
311
310
  // ±32 of its old position; a REPLACE (all fresh items — the shape
312
311
  // every page's first structural pass usually is) has it nowhere.
313
312
  // ~65 compares, no allocation, and the scan function is never
314
313
  // compiled for a replace (its cold first-call compile was the cost).
315
- const i = h + (c - h >> 1);
316
- const s = t[i];
317
- const r = Math.min(f, i + 32);
318
- let n = Math.max(h, i - 32);
319
- while (n <= r && this.fi[n] !== s) n++;
314
+ const s = h + (c - h >> 1);
315
+ const i = t[s];
316
+ const r = Math.min(f, s + 32);
317
+ let n = Math.max(h, s - 32);
318
+ while (n <= r && this.$t[n] !== i) n++;
320
319
  if (n <= r && trySmallMove(this, t, e, h)) return;
321
320
  }
322
- const y = e - this.oi;
321
+ const y = e - this.wt;
323
322
  const A = new Array(e);
324
323
  const M = new Array(e);
325
- r = this.li ? new Array(e) : undefined;
326
- n = this.pi ? new Array(e) : undefined;
324
+ r = this.Jt ? new Array(e) : undefined;
325
+ n = this.Xt ? new Array(e) : undefined;
327
326
  // 0) prepare a map of all indices in the changed window of newItems,
328
327
  // scanning backwards so we encounter them in natural order
329
328
  l = new Map;
330
- p = new Array(c + 1);
331
- for (s = c; s >= h; s--) {
332
- a = t[s];
333
- u = this.zt ? this.zt(a) : a;
334
- i = l.get(u);
335
- p[s] = i === undefined ? -1 : i;
336
- l.set(u, s);
329
+ d = new Array(c + 1);
330
+ for (i = c; i >= h; i--) {
331
+ a = t[i];
332
+ u = this.bt ? this.bt(a) : a;
333
+ s = l.get(u);
334
+ d[i] = s === undefined ? -1 : s;
335
+ l.set(u, i);
337
336
  }
338
337
  // 1) step through the old changed window and see if items can be found
339
338
  // in the new set; if so, stage them at their new positions; if not,
340
339
  // queue them for disposal at commit
341
- for (i = h; i <= f; i++) {
342
- a = this.fi[i];
343
- u = this.zt ? this.zt(a) : a;
344
- s = l.get(u);
345
- if (s !== undefined && s !== -1) {
346
- A[s] = this.ai[i];
347
- M[s] = this.ui[i];
348
- r && (r[s] = this.li[i]);
349
- n && (n[s] = this.pi[i]);
350
- s = p[s];
351
- l.set(u, s);
340
+ for (s = h; s <= f; s++) {
341
+ a = this.$t[s];
342
+ u = this.bt ? this.bt(a) : a;
343
+ i = l.get(u);
344
+ if (i !== undefined && i !== -1) {
345
+ A[i] = this.zt[s];
346
+ M[i] = this.nn[s];
347
+ r && (r[i] = this.Jt[s]);
348
+ n && (n[i] = this.Xt[s]);
349
+ i = d[i];
350
+ l.set(u, i);
352
351
  } else {
353
- (d ??= []).push(this.ui[i]);
354
- if (true && attrHooks !== null) (w ??= []).push(a);
352
+ (p ??= []).push(this.nn[s]);
353
+ if (true && attrHooks !== null) (m ??= []).push(a);
355
354
  }
356
355
  }
357
356
  // 2) create new rows into the temp arrays; an abort disposes only these
358
357
  try {
359
- for (s = h; s <= c; s++) {
360
- if (M[s] !== undefined) continue;
361
- (m ??= []).push(M[s] = createOwner());
362
- if (true && attrHooks !== null) (O ??= []).push(t[s]);
363
- A[s] = runWithOwner(M[s], o);
358
+ for (i = h; i <= c; i++) {
359
+ if (M[i] !== undefined) continue;
360
+ (w ??= []).push(M[i] = createOwner());
361
+ if (true && attrHooks !== null) (O ??= []).push(t[i]);
362
+ A[i] = runWithOwner(M[i], o);
364
363
  }
365
364
  } catch (t) {
366
- if (m) for (i = 0; i < m.length; i++) m[i].dispose();
365
+ if (w) for (s = 0; s < w.length; s++) w[s].dispose();
367
366
  throw t;
368
367
  }
369
368
  // 3) commit: land the retained prefix and suffix plus the staged window
370
369
  // into the fresh arrays, swap them in (new identity for downstream
371
370
  // change propagation), then dispose exited rows
372
- for (i = 0; i < h; i++) {
373
- A[i] = this.ai[i];
374
- M[i] = this.ui[i];
375
- r && (r[i] = this.li[i]);
376
- n && (n[i] = this.pi[i]);
371
+ for (s = 0; s < h; s++) {
372
+ A[s] = this.zt[s];
373
+ M[s] = this.nn[s];
374
+ r && (r[s] = this.Jt[s]);
375
+ n && (n[s] = this.Xt[s]);
377
376
  }
378
- for (s = h; s <= c; s++) {
379
- if (r) _(r[s], t[s]);
380
- if (n) _(n[s], s);
377
+ for (i = h; i <= c; i++) {
378
+ if (r) _(r[i], t[i]);
379
+ if (n) _(n[i], i);
381
380
  }
382
- for (s = c + 1; s < e; s++) {
383
- A[s] = this.ai[s - y];
384
- M[s] = this.ui[s - y];
381
+ for (i = c + 1; i < e; i++) {
382
+ A[i] = this.zt[i - y];
383
+ M[i] = this.nn[i - y];
385
384
  if (r) {
386
- r[s] = this.li[s - y];
387
- _(r[s], t[s]);
385
+ r[i] = this.Jt[i - y];
386
+ _(r[i], t[i]);
388
387
  }
389
388
  if (n) {
390
- n[s] = this.pi[s - y];
391
- if (y !== 0) _(n[s], s);
389
+ n[i] = this.Xt[i - y];
390
+ if (y !== 0) _(n[i], i);
392
391
  }
393
392
  }
394
- this.ai = A;
395
- this.ui = M;
396
- r && (this.li = r);
397
- n && (this.pi = n);
398
- this.oi = e;
393
+ this.zt = A;
394
+ this.nn = M;
395
+ r && (this.Jt = r);
396
+ n && (this.Xt = n);
397
+ this.wt = e;
399
398
  // save a copy of the mapped items for the next update
400
- this.fi = t.slice(0);
401
- if (d) for (i = 0; i < d.length; i++) d[i].dispose();
402
- if (true && attrHooks !== null && w !== undefined && O !== undefined) attrHooks.listChurn(this.ie.Yt, w, O, e, this.zt !== undefined);
399
+ this.$t = t.slice(0);
400
+ if (p) for (s = 0; s < p.length; s++) p[s].dispose();
401
+ if (true && attrHooks !== null && m !== undefined && O !== undefined) attrHooks.listChurn(this.H.gt, m, O, e, this.bt !== undefined);
403
402
  }
404
403
  });
405
- return this.ai;
404
+ return this.zt;
406
405
  }
407
406
 
408
407
  /**
@@ -419,25 +418,21 @@ function updateKeyedMap() {
419
418
  * ```
420
419
  *
421
420
  * @description https://docs.solidjs.com/reference/reactive-utilities/repeat
422
- */ function repeat(t, e, i) {
423
- const s = e;
421
+ */ function repeat(t, e, s) {
422
+ const i = e;
424
423
  const r = {
425
- ie: createOwner(),
426
- oi: 0,
427
- Oi: 0,
428
- _i: t,
429
- ci: s,
430
- ui: [],
431
- ai: [],
432
- yi: i?.from,
433
- mi: i?.fallback
424
+ H: createOwner(),
425
+ wt: 0,
426
+ ts: 0,
427
+ es: t,
428
+ qt: i,
429
+ nn: [],
430
+ zt: [],
431
+ ss: s?.from,
432
+ P: s?.fallback
434
433
  };
435
434
  const n = computed(updateRepeat.bind(r));
436
- // Same as mapArray: untracked reads inside the internal owner resolve via
437
- // _parentComputed, so async reads in row callbacks register with the node
438
- // (pending tracking + post-settle retry) instead of vanishing.
439
- r.ie.Yt = n;
440
- n.C &= ~CONFIG_AUTO_DISPOSE;
435
+ n.u &= ~CONFIG_AUTO_DISPOSE;
441
436
  return accessor(n);
442
437
  }
443
438
 
@@ -449,59 +444,61 @@ function updateKeyedMap() {
449
444
  // for the post-settle retry. The overlap math also subsumes the previous
450
445
  // disjoint-window/front-clear/end-clear/shift special cases.
451
446
  function updateRepeat() {
452
- const t = this._i();
453
- const e = this.yi?.() || 0;
454
- runWithOwner(this.ie, () => {
447
+ // As in updateKeyedMap: the node is the row callbacks' reader, per pass.
448
+ this.H.gt = getOwner();
449
+ const t = this.es();
450
+ const e = this.ss?.() || 0;
451
+ runWithOwner(this.H, () => {
455
452
  if (t === 0) {
456
- if (this.oi !== 0) {
457
- this.ie.dispose(false);
458
- this.ui = [];
459
- this.ai = [];
460
- this.oi = 0;
453
+ if (this.wt !== 0) {
454
+ this.H.dispose(false);
455
+ this.nn = [];
456
+ this.zt = [];
457
+ this.wt = 0;
461
458
  // Reset offset to match the cleared data (#2767, repro 2).
462
- this.Oi = 0;
459
+ this.ts = 0;
463
460
  }
464
- if (this.mi && !this.ai[0]) {
461
+ if (this.P && !this.zt[0]) {
465
462
  // an aborted fallback attempt leaves an owner without a mapping;
466
463
  // dispose it before re-creating
467
- this.ui[0]?.dispose();
468
- this.ai[0] = runWithOwner(this.ui[0] = createOwner(), this.mi);
464
+ this.nn[0]?.dispose();
465
+ this.zt[0] = runWithOwner(this.nn[0] = createOwner(), this.P);
469
466
  }
470
467
  return;
471
468
  }
472
- const i = e + t;
473
- const s = this.Oi + this.oi;
469
+ const s = e + t;
470
+ const i = this.ts + this.wt;
474
471
  // Retained overlap [keepStart, keepEnd) in global indexes; empty when the
475
472
  // windows are disjoint or when coming from empty/fallback.
476
- const r = Math.max(e, this.Oi);
477
- const n = Math.min(i, s);
473
+ const r = Math.max(e, this.ts);
474
+ const n = Math.min(s, i);
478
475
  const o = new Array(t);
479
476
  const h = new Array(t);
480
477
  for (let t = r; t < n; t++) {
481
- h[t - e] = this.ui[t - this.Oi];
482
- o[t - e] = this.ai[t - this.Oi];
478
+ h[t - e] = this.nn[t - this.ts];
479
+ o[t - e] = this.zt[t - this.ts];
483
480
  }
484
481
  try {
485
- for (let t = e; t < i; t++) {
482
+ for (let t = e; t < s; t++) {
486
483
  if (t >= r && t < n) continue;
487
- o[t - e] = runWithOwner(h[t - e] = createOwner(), () => this.ci(t));
484
+ o[t - e] = runWithOwner(h[t - e] = createOwner(), () => this.qt(t));
488
485
  }
489
486
  } catch (t) {
490
- for (let t = e; t < i; t++) if ((t < r || t >= n) && h[t - e]) h[t - e].dispose();
487
+ for (let t = e; t < s; t++) if ((t < r || t >= n) && h[t - e]) h[t - e].dispose();
491
488
  throw t;
492
489
  }
493
490
  // commit: dispose the previous fallback or the rows leaving the window
494
- if (this.oi === 0) this.ui[0]?.dispose(); else for (let t = this.Oi; t < s; t++) if (t < e || t >= i) this.ui[t - this.Oi].dispose();
495
- this.ai = o;
496
- this.ui = h;
497
- this.Oi = e;
498
- this.oi = t;
491
+ if (this.wt === 0) this.nn[0]?.dispose(); else for (let t = this.ts; t < i; t++) if (t < e || t >= s) this.nn[t - this.ts].dispose();
492
+ this.zt = o;
493
+ this.nn = h;
494
+ this.ts = e;
495
+ this.wt = t;
499
496
  });
500
- return this.ai;
497
+ return this.zt;
501
498
  }
502
499
 
503
- function compare(t, e, i) {
504
- return t ? t(e) === t(i) : true;
500
+ function compare(t, e, s) {
501
+ return t ? t(e) === t(s) : true;
505
502
  }
506
503
 
507
504
  export { mapArray, repeat };