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