@solidjs/signals 2.0.0-rc.11 → 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.
- package/dist/dev-shared.js +2056 -3773
- package/dist/dev.attribution.js +159 -91
- package/dist/dev.js +7263 -8384
- package/dist/observe/affects.js +125 -104
- package/dist/observe/boundaries.js +458 -665
- package/dist/observe/core/action.js +63 -66
- package/dist/observe/core/async.js +240 -383
- package/dist/observe/core/attribution-queries.js +1 -1
- package/dist/observe/core/attribution.js +271 -199
- package/dist/observe/core/constants.js +115 -178
- package/dist/observe/core/context.js +3 -3
- package/dist/observe/core/core.js +840 -1428
- package/dist/observe/core/dev.js +41 -18
- package/dist/observe/core/effect.js +75 -86
- package/dist/observe/core/external.js +5 -5
- package/dist/observe/core/graph.js +61 -70
- package/dist/observe/core/heap.js +75 -98
- package/dist/observe/core/invariants.js +1 -34
- package/dist/observe/core/lanes.js +704 -181
- package/dist/observe/core/owner.js +80 -101
- package/dist/observe/core/scheduler.js +708 -1351
- package/dist/observe/core/verdict.js +302 -621
- package/dist/observe/flatten.js +79 -0
- package/dist/observe/index.js +15 -13
- package/dist/observe/map.js +232 -235
- package/dist/observe/reveal.js +212 -0
- package/dist/observe/signals.js +133 -215
- package/dist/observe/store/affects.js +135 -0
- package/dist/observe/store/index.js +29 -24
- package/dist/observe/store/optimistic.js +538 -0
- package/dist/observe/store/projection.js +302 -0
- package/dist/observe/store/reconcile.js +257 -0
- package/dist/observe/store/store.js +1945 -277
- package/dist/observe/store/storePath.js +1 -1
- package/dist/{prod/store/next → observe/store}/target.js +17 -18
- package/dist/observe/store/types.js +73 -0
- package/dist/observe/store/utils.js +1 -13
- package/dist/prod/affects.js +127 -106
- package/dist/prod/boundaries.js +442 -654
- package/dist/prod/core/action.js +71 -74
- package/dist/prod/core/async.js +307 -442
- package/dist/prod/core/constants.js +112 -177
- package/dist/prod/core/context.js +3 -3
- package/dist/prod/core/core.js +852 -1448
- package/dist/prod/core/effect.js +88 -99
- package/dist/prod/core/external.js +5 -5
- package/dist/prod/core/graph.js +61 -70
- package/dist/prod/core/heap.js +75 -98
- package/dist/prod/core/invariants.js +1 -32
- package/dist/prod/core/lanes.js +666 -181
- package/dist/prod/core/owner.js +75 -96
- package/dist/prod/core/scheduler.js +677 -1332
- package/dist/prod/core/verdict.js +297 -621
- package/dist/prod/flatten.js +77 -0
- package/dist/prod/index.js +15 -13
- package/dist/prod/map.js +143 -146
- package/dist/prod/reveal.js +212 -0
- package/dist/prod/signals.js +144 -226
- package/dist/prod/store/affects.js +135 -0
- package/dist/prod/store/index.js +28 -19
- package/dist/prod/store/optimistic.js +533 -0
- package/dist/prod/store/projection.js +295 -0
- package/dist/prod/store/reconcile.js +257 -0
- package/dist/prod/store/store.js +1840 -272
- package/dist/prod/store/storePath.js +1 -1
- package/dist/{observe/store/next → prod/store}/target.js +13 -17
- package/dist/prod/store/types.js +73 -0
- package/dist/prod/store/utils.js +1 -11
- package/dist/types/affects.d.ts +11 -30
- package/dist/types/boundaries.d.ts +62 -176
- package/dist/types/carved.d.ts +1 -0
- package/dist/types/core/action.d.ts +5 -6
- package/dist/types/core/async.d.ts +10 -5
- package/dist/types/core/attribution-hooks.d.ts +48 -1
- package/dist/types/core/attribution.d.ts +29 -9
- package/dist/types/core/constants.d.ts +125 -171
- package/dist/types/core/core.d.ts +104 -264
- package/dist/types/core/dev.d.ts +60 -7
- package/dist/types/core/effect.d.ts +0 -7
- package/dist/types/core/graph.d.ts +7 -1
- package/dist/types/core/heap.d.ts +5 -7
- package/dist/types/core/index.d.ts +6 -6
- package/dist/types/core/invariants.d.ts +0 -29
- package/dist/types/core/lanes.d.ts +65 -87
- package/dist/types/core/owner.d.ts +3 -3
- package/dist/types/core/scheduler.d.ts +249 -331
- package/dist/types/core/types.d.ts +51 -85
- package/dist/types/core/verdict.d.ts +3 -0
- package/dist/types/flatten.d.ts +8 -0
- package/dist/types/index.d.ts +7 -5
- package/dist/types/reveal.d.ts +19 -0
- package/dist/types/signals.d.ts +53 -92
- package/dist/types/store/affects.d.ts +1 -0
- package/dist/types/store/index.d.ts +35 -15
- package/dist/types/store/optimistic.d.ts +23 -0
- package/dist/types/store/projection.d.ts +18 -0
- package/dist/types/store/reconcile.d.ts +3 -0
- package/dist/types/store/store.d.ts +165 -143
- package/dist/types/store/storePath.d.ts +1 -1
- package/dist/types/store/target.d.ts +151 -0
- package/dist/types/store/types.d.ts +84 -0
- package/package.json +1 -1
- package/dist/observe/core/optimistic.js +0 -669
- package/dist/observe/store/next/optimistic.js +0 -717
- package/dist/observe/store/next/projection.js +0 -266
- package/dist/observe/store/next/reconcile.js +0 -375
- package/dist/observe/store/next/store.js +0 -2480
- package/dist/prod/core/optimistic.js +0 -658
- package/dist/prod/store/next/optimistic.js +0 -710
- package/dist/prod/store/next/projection.js +0 -257
- package/dist/prod/store/next/reconcile.js +0 -373
- package/dist/prod/store/next/store.js +0 -2356
- package/dist/types/core/optimistic.d.ts +0 -6
- package/dist/types/store/next/optimistic.d.ts +0 -25
- package/dist/types/store/next/projection.d.ts +0 -27
- package/dist/types/store/next/reconcile.d.ts +0 -10
- package/dist/types/store/next/store.d.ts +0 -143
- package/dist/types/store/next/target.d.ts +0 -196
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { NotReadyError } from "./core/error.js";
|
|
2
|
+
|
|
3
|
+
import "./core/verdict.js";
|
|
4
|
+
|
|
5
|
+
import "./core/core.js";
|
|
6
|
+
|
|
7
|
+
import "./core/scheduler.js";
|
|
8
|
+
|
|
9
|
+
import "./core/effect.js";
|
|
10
|
+
|
|
11
|
+
// CARVE 4: `flatten` lived in boundaries.ts but is the general children
|
|
12
|
+
// resolver the renderers (`web`, `universal`, `solid`'s `children()`) walk
|
|
13
|
+
// through — not a boundary feature. Moved verbatim so the boundary carve
|
|
14
|
+
// measures boundaries alone.
|
|
15
|
+
/**
|
|
16
|
+
* Resolves nested accessors and arrays in a children tree to their rendered
|
|
17
|
+
* values. See the `children()` helper in solid-js for the memoized form.
|
|
18
|
+
*/
|
|
19
|
+
function flatten(r, t) {
|
|
20
|
+
if (typeof r === "function" && !r.length) {
|
|
21
|
+
if (t?.doNotUnwrap) return r;
|
|
22
|
+
do {
|
|
23
|
+
r = r();
|
|
24
|
+
} while (typeof r === "function" && !r.length);
|
|
25
|
+
}
|
|
26
|
+
if (t?.skipNonRendered && (r == null || r === true || r === false || r === "")) return;
|
|
27
|
+
if (Array.isArray(r)) {
|
|
28
|
+
let e = [];
|
|
29
|
+
if (flattenArray(r, e, t)) {
|
|
30
|
+
return () => {
|
|
31
|
+
let r = [];
|
|
32
|
+
flattenArray(e, r, {
|
|
33
|
+
...t,
|
|
34
|
+
doNotUnwrap: false
|
|
35
|
+
});
|
|
36
|
+
return r;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return e;
|
|
40
|
+
}
|
|
41
|
+
return r;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function flattenArray(r, t = [], e) {
|
|
45
|
+
let o = null;
|
|
46
|
+
let f = false;
|
|
47
|
+
for (let n = 0; n < r.length; n++) {
|
|
48
|
+
try {
|
|
49
|
+
let o = r[n];
|
|
50
|
+
if (typeof o === "function" && !o.length) {
|
|
51
|
+
if (e?.doNotUnwrap) {
|
|
52
|
+
t.push(o);
|
|
53
|
+
f = true;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
do {
|
|
57
|
+
o = o();
|
|
58
|
+
} while (typeof o === "function" && !o.length);
|
|
59
|
+
}
|
|
60
|
+
if (Array.isArray(o)) {
|
|
61
|
+
// OR, don't overwrite: an accessor already pushed under doNotUnwrap
|
|
62
|
+
// still needs the resolving wrapper even when a later sibling
|
|
63
|
+
// fragment contains no functions (#3133).
|
|
64
|
+
f = flattenArray(o, t, e) || f;
|
|
65
|
+
} else if (e?.skipNonRendered && (o == null || o === true || o === false || o === "")) {
|
|
66
|
+
// skip
|
|
67
|
+
} else t.push(o);
|
|
68
|
+
} catch (r) {
|
|
69
|
+
if (!(r instanceof NotReadyError)) throw r;
|
|
70
|
+
o = r;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (o) throw o;
|
|
74
|
+
return f;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { flatten };
|
package/dist/prod/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export { ContextNotFoundError, NoOwnerError, NotReadyError, TimeoutError } from "./core/error.js";
|
|
2
2
|
|
|
3
|
+
export { isPending, latest } from "./core/verdict.js";
|
|
4
|
+
|
|
5
|
+
export { action } from "./core/action.js";
|
|
6
|
+
|
|
3
7
|
export { clearSnapshots, isEqual, markSnapshotScope, releaseSnapshotScope, runWithOwner, setSnapshotCapture, untrack } from "./core/core.js";
|
|
4
8
|
|
|
5
9
|
export { enableExternalSource } from "./core/external.js";
|
|
@@ -10,39 +14,37 @@ export { createContext, getContext, setContext } from "./core/context.js";
|
|
|
10
14
|
|
|
11
15
|
export { $REFRESH, SUPPORTS_PROXY } from "./core/constants.js";
|
|
12
16
|
|
|
13
|
-
import "./core/invariants.js";
|
|
14
|
-
|
|
15
17
|
export { setConsoleFooter } from "./core/dev.js";
|
|
16
18
|
|
|
17
19
|
export { ROOT_ERROR_HOOK, enforceLoadingBoundary, flush, resetErrorHalt } from "./core/scheduler.js";
|
|
18
20
|
|
|
19
|
-
export { isPending, latest } from "./core/verdict.js";
|
|
20
|
-
|
|
21
21
|
import "./core/effect.js";
|
|
22
22
|
|
|
23
|
-
export { action } from "./core/action.js";
|
|
24
|
-
|
|
25
23
|
export { configureClientErrors } from "./core/error-hooks.js";
|
|
26
24
|
|
|
27
25
|
export { createEffect, createMemo, createOptimistic, createReaction, createRenderEffect, createSignal, createTrackedEffect, onCleanup, onSettled, refresh, resolve, until } from "./signals.js";
|
|
28
26
|
|
|
29
|
-
export { affects } from "./affects.js";
|
|
30
|
-
|
|
31
27
|
export { mapArray, repeat } from "./map.js";
|
|
32
28
|
|
|
33
29
|
export { createStore, deep, reconcile, snapshot } from "./store/index.js";
|
|
34
30
|
|
|
35
|
-
export {
|
|
31
|
+
export { affects } from "./affects.js";
|
|
32
|
+
|
|
33
|
+
export { flatten } from "./flatten.js";
|
|
34
|
+
|
|
35
|
+
export { createErrorBoundary, createLoadingBoundary } from "./boundaries.js";
|
|
36
|
+
|
|
37
|
+
export { createRevealOrder } from "./reveal.js";
|
|
36
38
|
|
|
37
|
-
export { $PROXY, $RECORD, $TARGET, $TRACK, isWrappable } from "./store/
|
|
39
|
+
export { $PROXY, $RECORD, $TARGET, $TRACK, isWrappable, markRaw } from "./store/types.js";
|
|
38
40
|
|
|
39
41
|
export { MergeView, OmitView, SOURCE_MEMO, SOURCE_MERGE, SOURCE_OMIT, SOURCE_PLAIN, SOURCE_PROXY, hasStaticKeys, isStatic, merge, mergeSources, mergeView, omit, omitView, resolvedTable, sourceGet, sourceHas, sourceKeys, sourceOwners, viewOf } from "./store/utils.js";
|
|
40
42
|
|
|
41
|
-
export {
|
|
43
|
+
export { createOptimisticStore } from "./store/optimistic.js";
|
|
42
44
|
|
|
43
|
-
export {
|
|
45
|
+
export { createProjection } from "./store/projection.js";
|
|
44
46
|
|
|
45
|
-
export { storeHasFamily, storeHasOptimisticFamily, storeIsShallow } from "./store/
|
|
47
|
+
export { storeHasFamily, storeHasOptimisticFamily, storeIsShallow } from "./store/store.js";
|
|
46
48
|
|
|
47
49
|
export { storePath } from "./store/storePath.js";
|
|
48
50
|
|
package/dist/prod/map.js
CHANGED
|
@@ -1,50 +1,41 @@
|
|
|
1
|
-
import { computed, runWithOwner, signal,
|
|
1
|
+
import { computed, runWithOwner, signal, setSignal } from "./core/core.js";
|
|
2
2
|
|
|
3
|
-
import
|
|
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/
|
|
9
|
+
import "./core/scheduler.js";
|
|
14
10
|
|
|
15
|
-
import "./core/
|
|
11
|
+
import { createOwner, getOwner } from "./core/owner.js";
|
|
16
12
|
|
|
17
13
|
import "./core/effect.js";
|
|
18
14
|
|
|
19
15
|
import { accessor } from "./signals.js";
|
|
20
16
|
|
|
21
|
-
import { $TRACK } from "./store/
|
|
22
|
-
|
|
23
|
-
import "./store/next/store.js";
|
|
17
|
+
import { $TRACK } from "./store/types.js";
|
|
24
18
|
|
|
25
19
|
function mapArray(t, s, e) {
|
|
26
20
|
const i = typeof e?.keyed === "function" ? e.keyed : undefined;
|
|
27
21
|
const r = s.length > 1;
|
|
28
22
|
const n = s;
|
|
29
23
|
const o = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
v: createOwner(),
|
|
25
|
+
ht: 0,
|
|
26
|
+
ct: t,
|
|
27
|
+
wt: [],
|
|
28
|
+
Ot: n,
|
|
33
29
|
yt: [],
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
gt: e?.keyed === false,
|
|
41
|
-
bt: e?.fallback
|
|
30
|
+
un: [],
|
|
31
|
+
rt: i,
|
|
32
|
+
Mt: i || e?.keyed === false ? [] : undefined,
|
|
33
|
+
gt: r && e?.keyed !== false ? [] : undefined,
|
|
34
|
+
St: e?.keyed === false,
|
|
35
|
+
P: e?.fallback
|
|
42
36
|
};
|
|
43
37
|
const h = computed(updateKeyedMap.bind(o), undefined);
|
|
44
|
-
|
|
45
|
-
// them through node lets store-proxy lookups see pending writes (not stale _value).
|
|
46
|
-
o.ie.qn = h;
|
|
47
|
-
h.C &= ~CONFIG_AUTO_DISPOSE;
|
|
38
|
+
h.u &= ~CONFIG_AUTO_DISPOSE;
|
|
48
39
|
return accessor(h);
|
|
49
40
|
}
|
|
50
41
|
|
|
@@ -53,8 +44,8 @@ const pureOptions = {
|
|
|
53
44
|
};
|
|
54
45
|
|
|
55
46
|
function trySmallMove(t, s, e, i) {
|
|
56
|
-
const r = t.
|
|
57
|
-
const n = t.
|
|
47
|
+
const r = t.wt;
|
|
48
|
+
const n = t.ht - 1;
|
|
58
49
|
const o = [];
|
|
59
50
|
const h = [];
|
|
60
51
|
const f = [];
|
|
@@ -87,21 +78,21 @@ function trySmallMove(t, s, e, i) {
|
|
|
87
78
|
}
|
|
88
79
|
}
|
|
89
80
|
c -= p === -1 ? d : p;
|
|
90
|
-
let
|
|
81
|
+
let w = -1;
|
|
91
82
|
d = Math.min(32 - h.length, e - 1 - u, c);
|
|
92
83
|
for (let e = 1; e <= d; e++) {
|
|
93
84
|
if (s[u + e] === t) {
|
|
94
|
-
|
|
85
|
+
w = e;
|
|
95
86
|
break;
|
|
96
87
|
}
|
|
97
88
|
}
|
|
98
|
-
c -=
|
|
99
|
-
if (p !== -1 && (
|
|
89
|
+
c -= w === -1 ? d : w;
|
|
90
|
+
if (p !== -1 && (w === -1 || p <= w)) {
|
|
100
91
|
while (p-- > 0) o.push(a++);
|
|
101
92
|
continue;
|
|
102
93
|
}
|
|
103
|
-
if (
|
|
104
|
-
while (
|
|
94
|
+
if (w !== -1) {
|
|
95
|
+
while (w-- > 0) h.push(u++);
|
|
105
96
|
continue;
|
|
106
97
|
}
|
|
107
98
|
if (c <= 0 || o.length === 32 || h.length === 32) return false;
|
|
@@ -126,7 +117,7 @@ function trySmallMove(t, s, e, i) {
|
|
|
126
117
|
* body. Pairs displaced sources with destinations (an unmatched destination
|
|
127
118
|
* is a replacement/insertion → general path), then commits: slice() the live
|
|
128
119
|
* arrays, copy shifted runs, patch displaced pairs, dispose leftovers. */ function commitSmallMove(t, s, e, i, r, n) {
|
|
129
|
-
const o = t.
|
|
120
|
+
const o = t.wt;
|
|
130
121
|
let h;
|
|
131
122
|
let f;
|
|
132
123
|
let c;
|
|
@@ -161,8 +152,8 @@ function trySmallMove(t, s, e, i) {
|
|
|
161
152
|
for (let i = 0, r = n[s + 2]; i < r; i++) if (t.has(o[e + i])) return false;
|
|
162
153
|
}
|
|
163
154
|
}
|
|
164
|
-
const a = t.
|
|
165
|
-
const u = t.
|
|
155
|
+
const a = t.yt;
|
|
156
|
+
const u = t.un;
|
|
166
157
|
const l = a.slice(0, e);
|
|
167
158
|
const p = u.slice(0, e);
|
|
168
159
|
for (let t = 0; t < n.length; t += 3) {
|
|
@@ -181,10 +172,10 @@ function trySmallMove(t, s, e, i) {
|
|
|
181
172
|
l[t] = a[s];
|
|
182
173
|
p[t] = u[s];
|
|
183
174
|
}
|
|
184
|
-
t.
|
|
185
|
-
t.
|
|
186
|
-
t.
|
|
187
|
-
t.
|
|
175
|
+
t.yt = l;
|
|
176
|
+
t.un = p;
|
|
177
|
+
t.ht = e;
|
|
178
|
+
t.wt = s.slice(0);
|
|
188
179
|
// Dispose unmatched sources LAST (general-path ordering).
|
|
189
180
|
for (h = 0; h < i.length; h++) {
|
|
190
181
|
if (c === undefined || !c[h]) u[i[h]].dispose();
|
|
@@ -193,52 +184,59 @@ function trySmallMove(t, s, e, i) {
|
|
|
193
184
|
}
|
|
194
185
|
|
|
195
186
|
function updateKeyedMap() {
|
|
196
|
-
|
|
187
|
+
// Untracked reads inside the internal owner resolve via _parentComputed:
|
|
188
|
+
// routed through the node, a store-proxy lookup sees pending writes (not a
|
|
189
|
+
// stale _value) and an async read in a row callback registers the node as
|
|
190
|
+
// the flight's reader (pending tracking + post-settle retry) instead of
|
|
191
|
+
// vanishing. Set per pass: the first pass runs inside `computed()`, before
|
|
192
|
+
// the node exists to the caller.
|
|
193
|
+
this.v.ut = getOwner();
|
|
194
|
+
const t = this.ct() || [], s = t.length;
|
|
197
195
|
t[$TRACK];
|
|
198
|
-
// top level tracking
|
|
199
|
-
runWithOwner(this.
|
|
196
|
+
// top level tracking (a store array's container node)
|
|
197
|
+
runWithOwner(this.v, () => {
|
|
200
198
|
let e, i, r, n,
|
|
201
199
|
// Mappers write freshly-created row/index signals into the STAGE
|
|
202
200
|
// arrays (`rows`/`indexes`), never into `this._rows`/`this._indexes`.
|
|
203
|
-
o = this.
|
|
201
|
+
o = this.Mt ? this.St ? () => {
|
|
204
202
|
r[i] = signal(t[i], pureOptions);
|
|
205
|
-
return this.
|
|
203
|
+
return this.Ot(accessor(r[i]), i);
|
|
206
204
|
} : () => {
|
|
207
205
|
r[i] = signal(t[i], pureOptions);
|
|
208
206
|
n && (n[i] = signal(i, pureOptions));
|
|
209
|
-
return this.
|
|
210
|
-
} : this.
|
|
207
|
+
return this.Ot(accessor(r[i]), n ? accessor(n[i]) : undefined);
|
|
208
|
+
} : this.gt ? () => {
|
|
211
209
|
const s = t[i];
|
|
212
210
|
n[i] = signal(i, pureOptions);
|
|
213
|
-
return this.
|
|
211
|
+
return this.Ot(s, accessor(n[i]));
|
|
214
212
|
} : () => {
|
|
215
213
|
const s = t[i];
|
|
216
|
-
return this.
|
|
214
|
+
return this.Ot(s);
|
|
217
215
|
};
|
|
218
216
|
// fast path for empty arrays
|
|
219
217
|
if (s === 0) {
|
|
220
|
-
if (this.
|
|
221
|
-
this.
|
|
222
|
-
this.
|
|
218
|
+
if (this.ht !== 0) {
|
|
219
|
+
this.v.dispose(false);
|
|
220
|
+
this.un = [];
|
|
221
|
+
this.wt = [];
|
|
223
222
|
this.yt = [];
|
|
224
|
-
this.
|
|
225
|
-
this.
|
|
226
|
-
this.
|
|
227
|
-
this.kt && (this.kt = []);
|
|
223
|
+
this.ht = 0;
|
|
224
|
+
this.Mt && (this.Mt = []);
|
|
225
|
+
this.gt && (this.gt = []);
|
|
228
226
|
}
|
|
229
|
-
if (this.
|
|
227
|
+
if (this.P && !this.yt[0]) {
|
|
230
228
|
// an aborted fallback attempt leaves an owner without a mapping;
|
|
231
229
|
// dispose it before re-creating
|
|
232
|
-
this.
|
|
233
|
-
this.
|
|
230
|
+
this.un[0]?.dispose();
|
|
231
|
+
this.yt[0] = runWithOwner(this.un[0] = createOwner(), this.P);
|
|
234
232
|
}
|
|
235
233
|
}
|
|
236
234
|
// fast path for new create
|
|
237
|
-
else if (this.
|
|
235
|
+
else if (this.ht === 0) {
|
|
238
236
|
const h = new Array(s);
|
|
239
237
|
const f = new Array(s);
|
|
240
|
-
r = this.
|
|
241
|
-
n = this.
|
|
238
|
+
r = this.Mt && new Array(s);
|
|
239
|
+
n = this.gt && new Array(s);
|
|
242
240
|
try {
|
|
243
241
|
for (i = 0; i < s; i++) h[i] = runWithOwner(f[i] = createOwner(), o);
|
|
244
242
|
} catch (t) {
|
|
@@ -246,19 +244,19 @@ function updateKeyedMap() {
|
|
|
246
244
|
throw t;
|
|
247
245
|
}
|
|
248
246
|
// commit
|
|
249
|
-
if (this.
|
|
247
|
+
if (this.un[0]) this.un[0].dispose();
|
|
250
248
|
// previous fallback
|
|
251
|
-
this.
|
|
252
|
-
this.
|
|
253
|
-
r && (this.
|
|
254
|
-
n && (this.
|
|
255
|
-
this.
|
|
256
|
-
this.
|
|
249
|
+
this.yt = h;
|
|
250
|
+
this.un = f;
|
|
251
|
+
r && (this.Mt = r);
|
|
252
|
+
n && (this.gt = n);
|
|
253
|
+
this.wt = t.slice(0);
|
|
254
|
+
this.ht = s;
|
|
257
255
|
} else {
|
|
258
|
-
let h, f, c, a, u, l, p, d,
|
|
256
|
+
let h, f, c, a, u, l, p, d, w,
|
|
259
257
|
// Dev (attribution engine installed): the items behind the exited and
|
|
260
258
|
// entered rows, for the list-identity census.
|
|
261
|
-
|
|
259
|
+
m, O;
|
|
262
260
|
// The pass's write to a per-slot signal (a row accessor in index mode,
|
|
263
261
|
// an index accessor in keyed mode). The list's frame lives in these
|
|
264
262
|
// writes as much as in the computed's result, so under a LANE pass they
|
|
@@ -279,20 +277,21 @@ function updateKeyedMap() {
|
|
|
279
277
|
// knows the slots are clean and drops the mark — and an unmarked map
|
|
280
278
|
// takes `setSignal` directly. The engine is installed whenever a lane
|
|
281
279
|
// is active.
|
|
282
|
-
|
|
280
|
+
// CARVE 2: the lane-slot arm (`_landOnOverride`, F1) went with the engine.
|
|
281
|
+
const _ = setSignal;
|
|
283
282
|
// skip common prefix
|
|
284
|
-
for (h = 0, f = Math.min(this.
|
|
285
|
-
if (this.
|
|
283
|
+
for (h = 0, f = Math.min(this.ht, s); h < f && (this.wt[h] === t[h] || this.Mt && compare(this.rt, this.wt[h], t[h])); h++) {
|
|
284
|
+
if (this.Mt) _(this.Mt[h], t[h]);
|
|
286
285
|
}
|
|
287
286
|
// skip common suffix — counted only; retained entries land in one pass
|
|
288
287
|
// at commit instead of being staged and copied twice
|
|
289
|
-
for (f = this.
|
|
288
|
+
for (f = this.ht - 1, c = s - 1; f >= h && c >= h && (this.wt[f] === t[c] || this.Mt && compare(this.rt, this.wt[f], t[c])); f--,
|
|
290
289
|
c--) ;
|
|
291
290
|
// no structural change (every position matched in place at equal
|
|
292
291
|
// length — the common post-reconcile shape): keep the same mapped
|
|
293
292
|
// array identity so downstream consumers don't re-run at all
|
|
294
|
-
if (h === s && this.
|
|
295
|
-
this.
|
|
293
|
+
if (h === s && this.ht === s) {
|
|
294
|
+
this.wt = t.slice(0);
|
|
296
295
|
return;
|
|
297
296
|
}
|
|
298
297
|
// SMALL-MOVE FAST PATH: extracted to its own function — inlining it
|
|
@@ -302,7 +301,7 @@ function updateKeyedMap() {
|
|
|
302
301
|
// (plain removals, tail edits), the general path is window-
|
|
303
302
|
// proportional and cheap — the fast path would only re-walk what the
|
|
304
303
|
// trims proved.
|
|
305
|
-
if (s <= this.
|
|
304
|
+
if (s <= this.ht && f - h > 64 && this.Mt === undefined && this.gt === undefined) {
|
|
306
305
|
// PROBE before the scan: a small move keeps a mid-window item within
|
|
307
306
|
// ±32 of its old position; a REPLACE (all fresh items — the shape
|
|
308
307
|
// every page's first structural pass usually is) has it nowhere.
|
|
@@ -312,21 +311,21 @@ function updateKeyedMap() {
|
|
|
312
311
|
const i = t[e];
|
|
313
312
|
const r = Math.min(f, e + 32);
|
|
314
313
|
let n = Math.max(h, e - 32);
|
|
315
|
-
while (n <= r && this.
|
|
314
|
+
while (n <= r && this.wt[n] !== i) n++;
|
|
316
315
|
if (n <= r && trySmallMove(this, t, s, h)) return;
|
|
317
316
|
}
|
|
318
|
-
const y = s - this.
|
|
317
|
+
const y = s - this.ht;
|
|
319
318
|
const A = new Array(s);
|
|
320
319
|
const M = new Array(s);
|
|
321
|
-
r = this.
|
|
322
|
-
n = this.
|
|
320
|
+
r = this.Mt ? new Array(s) : undefined;
|
|
321
|
+
n = this.gt ? new Array(s) : undefined;
|
|
323
322
|
// 0) prepare a map of all indices in the changed window of newItems,
|
|
324
323
|
// scanning backwards so we encounter them in natural order
|
|
325
324
|
l = new Map;
|
|
326
325
|
p = new Array(c + 1);
|
|
327
326
|
for (i = c; i >= h; i--) {
|
|
328
327
|
a = t[i];
|
|
329
|
-
u = this.
|
|
328
|
+
u = this.rt ? this.rt(a) : a;
|
|
330
329
|
e = l.get(u);
|
|
331
330
|
p[i] = e === undefined ? -1 : e;
|
|
332
331
|
l.set(u, i);
|
|
@@ -335,18 +334,18 @@ function updateKeyedMap() {
|
|
|
335
334
|
// in the new set; if so, stage them at their new positions; if not,
|
|
336
335
|
// queue them for disposal at commit
|
|
337
336
|
for (e = h; e <= f; e++) {
|
|
338
|
-
a = this.
|
|
339
|
-
u = this.
|
|
337
|
+
a = this.wt[e];
|
|
338
|
+
u = this.rt ? this.rt(a) : a;
|
|
340
339
|
i = l.get(u);
|
|
341
340
|
if (i !== undefined && i !== -1) {
|
|
342
|
-
A[i] = this.
|
|
343
|
-
M[i] = this.
|
|
344
|
-
r && (r[i] = this.
|
|
345
|
-
n && (n[i] = this.
|
|
341
|
+
A[i] = this.yt[e];
|
|
342
|
+
M[i] = this.un[e];
|
|
343
|
+
r && (r[i] = this.Mt[e]);
|
|
344
|
+
n && (n[i] = this.gt[e]);
|
|
346
345
|
i = p[i];
|
|
347
346
|
l.set(u, i);
|
|
348
347
|
} else {
|
|
349
|
-
(d ??= []).push(this.
|
|
348
|
+
(d ??= []).push(this.un[e]);
|
|
350
349
|
if (false && attrHooks !== null) ;
|
|
351
350
|
}
|
|
352
351
|
}
|
|
@@ -354,51 +353,51 @@ function updateKeyedMap() {
|
|
|
354
353
|
try {
|
|
355
354
|
for (i = h; i <= c; i++) {
|
|
356
355
|
if (M[i] !== undefined) continue;
|
|
357
|
-
(
|
|
356
|
+
(w ??= []).push(M[i] = createOwner());
|
|
358
357
|
if (false && attrHooks !== null) ;
|
|
359
358
|
A[i] = runWithOwner(M[i], o);
|
|
360
359
|
}
|
|
361
360
|
} catch (t) {
|
|
362
|
-
if (
|
|
361
|
+
if (w) for (e = 0; e < w.length; e++) w[e].dispose();
|
|
363
362
|
throw t;
|
|
364
363
|
}
|
|
365
364
|
// 3) commit: land the retained prefix and suffix plus the staged window
|
|
366
365
|
// into the fresh arrays, swap them in (new identity for downstream
|
|
367
366
|
// change propagation), then dispose exited rows
|
|
368
367
|
for (e = 0; e < h; e++) {
|
|
369
|
-
A[e] = this.
|
|
370
|
-
M[e] = this.
|
|
371
|
-
r && (r[e] = this.
|
|
372
|
-
n && (n[e] = this.
|
|
368
|
+
A[e] = this.yt[e];
|
|
369
|
+
M[e] = this.un[e];
|
|
370
|
+
r && (r[e] = this.Mt[e]);
|
|
371
|
+
n && (n[e] = this.gt[e]);
|
|
373
372
|
}
|
|
374
373
|
for (i = h; i <= c; i++) {
|
|
375
374
|
if (r) _(r[i], t[i]);
|
|
376
375
|
if (n) _(n[i], i);
|
|
377
376
|
}
|
|
378
377
|
for (i = c + 1; i < s; i++) {
|
|
379
|
-
A[i] = this.
|
|
380
|
-
M[i] = this.
|
|
378
|
+
A[i] = this.yt[i - y];
|
|
379
|
+
M[i] = this.un[i - y];
|
|
381
380
|
if (r) {
|
|
382
|
-
r[i] = this.
|
|
381
|
+
r[i] = this.Mt[i - y];
|
|
383
382
|
_(r[i], t[i]);
|
|
384
383
|
}
|
|
385
384
|
if (n) {
|
|
386
|
-
n[i] = this.
|
|
385
|
+
n[i] = this.gt[i - y];
|
|
387
386
|
if (y !== 0) _(n[i], i);
|
|
388
387
|
}
|
|
389
388
|
}
|
|
390
|
-
this.
|
|
391
|
-
this.
|
|
392
|
-
r && (this.
|
|
393
|
-
n && (this.
|
|
394
|
-
this.
|
|
389
|
+
this.yt = A;
|
|
390
|
+
this.un = M;
|
|
391
|
+
r && (this.Mt = r);
|
|
392
|
+
n && (this.gt = n);
|
|
393
|
+
this.ht = s;
|
|
395
394
|
// save a copy of the mapped items for the next update
|
|
396
|
-
this.
|
|
395
|
+
this.wt = t.slice(0);
|
|
397
396
|
if (d) for (e = 0; e < d.length; e++) d[e].dispose();
|
|
398
|
-
if (false && attrHooks !== null &&
|
|
397
|
+
if (false && attrHooks !== null && m !== undefined && O !== undefined) ;
|
|
399
398
|
}
|
|
400
399
|
});
|
|
401
|
-
return this.
|
|
400
|
+
return this.yt;
|
|
402
401
|
}
|
|
403
402
|
|
|
404
403
|
/**
|
|
@@ -418,22 +417,18 @@ function updateKeyedMap() {
|
|
|
418
417
|
*/ function repeat(t, s, e) {
|
|
419
418
|
const i = s;
|
|
420
419
|
const r = {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
420
|
+
v: createOwner(),
|
|
421
|
+
ht: 0,
|
|
422
|
+
kt: 0,
|
|
423
|
+
jt: t,
|
|
424
|
+
Ot: i,
|
|
425
|
+
un: [],
|
|
426
|
+
yt: [],
|
|
427
|
+
Wt: e?.from,
|
|
428
|
+
P: e?.fallback
|
|
430
429
|
};
|
|
431
430
|
const n = computed(updateRepeat.bind(r));
|
|
432
|
-
|
|
433
|
-
// _parentComputed, so async reads in row callbacks register with the node
|
|
434
|
-
// (pending tracking + post-settle retry) instead of vanishing.
|
|
435
|
-
r.ie.qn = n;
|
|
436
|
-
n.C &= ~CONFIG_AUTO_DISPOSE;
|
|
431
|
+
n.u &= ~CONFIG_AUTO_DISPOSE;
|
|
437
432
|
return accessor(n);
|
|
438
433
|
}
|
|
439
434
|
|
|
@@ -445,55 +440,57 @@ function updateKeyedMap() {
|
|
|
445
440
|
// for the post-settle retry. The overlap math also subsumes the previous
|
|
446
441
|
// disjoint-window/front-clear/end-clear/shift special cases.
|
|
447
442
|
function updateRepeat() {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
443
|
+
// As in updateKeyedMap: the node is the row callbacks' reader, per pass.
|
|
444
|
+
this.v.ut = getOwner();
|
|
445
|
+
const t = this.jt();
|
|
446
|
+
const s = this.Wt?.() || 0;
|
|
447
|
+
runWithOwner(this.v, () => {
|
|
451
448
|
if (t === 0) {
|
|
452
|
-
if (this.
|
|
453
|
-
this.
|
|
454
|
-
this.
|
|
455
|
-
this.
|
|
456
|
-
this.
|
|
449
|
+
if (this.ht !== 0) {
|
|
450
|
+
this.v.dispose(false);
|
|
451
|
+
this.un = [];
|
|
452
|
+
this.yt = [];
|
|
453
|
+
this.ht = 0;
|
|
457
454
|
// Reset offset to match the cleared data (#2767, repro 2).
|
|
458
|
-
this.
|
|
455
|
+
this.kt = 0;
|
|
459
456
|
}
|
|
460
|
-
if (this.
|
|
457
|
+
if (this.P && !this.yt[0]) {
|
|
461
458
|
// an aborted fallback attempt leaves an owner without a mapping;
|
|
462
459
|
// dispose it before re-creating
|
|
463
|
-
this.
|
|
464
|
-
this.
|
|
460
|
+
this.un[0]?.dispose();
|
|
461
|
+
this.yt[0] = runWithOwner(this.un[0] = createOwner(), this.P);
|
|
465
462
|
}
|
|
466
463
|
return;
|
|
467
464
|
}
|
|
468
465
|
const e = s + t;
|
|
469
|
-
const i = this.
|
|
466
|
+
const i = this.kt + this.ht;
|
|
470
467
|
// Retained overlap [keepStart, keepEnd) in global indexes; empty when the
|
|
471
468
|
// windows are disjoint or when coming from empty/fallback.
|
|
472
|
-
const r = Math.max(s, this.
|
|
469
|
+
const r = Math.max(s, this.kt);
|
|
473
470
|
const n = Math.min(e, i);
|
|
474
471
|
const o = new Array(t);
|
|
475
472
|
const h = new Array(t);
|
|
476
473
|
for (let t = r; t < n; t++) {
|
|
477
|
-
h[t - s] = this.
|
|
478
|
-
o[t - s] = this.
|
|
474
|
+
h[t - s] = this.un[t - this.kt];
|
|
475
|
+
o[t - s] = this.yt[t - this.kt];
|
|
479
476
|
}
|
|
480
477
|
try {
|
|
481
478
|
for (let t = s; t < e; t++) {
|
|
482
479
|
if (t >= r && t < n) continue;
|
|
483
|
-
o[t - s] = runWithOwner(h[t - s] = createOwner(), () => this.
|
|
480
|
+
o[t - s] = runWithOwner(h[t - s] = createOwner(), () => this.Ot(t));
|
|
484
481
|
}
|
|
485
482
|
} catch (t) {
|
|
486
483
|
for (let t = s; t < e; t++) if ((t < r || t >= n) && h[t - s]) h[t - s].dispose();
|
|
487
484
|
throw t;
|
|
488
485
|
}
|
|
489
486
|
// commit: dispose the previous fallback or the rows leaving the window
|
|
490
|
-
if (this.
|
|
491
|
-
this.
|
|
492
|
-
this.
|
|
493
|
-
this.
|
|
494
|
-
this.
|
|
487
|
+
if (this.ht === 0) this.un[0]?.dispose(); else for (let t = this.kt; t < i; t++) if (t < s || t >= e) this.un[t - this.kt].dispose();
|
|
488
|
+
this.yt = o;
|
|
489
|
+
this.un = h;
|
|
490
|
+
this.kt = s;
|
|
491
|
+
this.ht = t;
|
|
495
492
|
});
|
|
496
|
-
return this.
|
|
493
|
+
return this.yt;
|
|
497
494
|
}
|
|
498
495
|
|
|
499
496
|
function compare(t, s, e) {
|