@solidjs/signals 2.0.0-beta.10 → 2.0.0-beta.12
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.js +777 -397
- package/dist/node.cjs +1862 -1540
- package/dist/prod.js +1555 -1222
- package/dist/types/boundaries.d.ts +2 -2
- package/dist/types/core/constants.d.ts +8 -6
- package/dist/types/core/core.d.ts +29 -8
- package/dist/types/core/dev.d.ts +1 -1
- package/dist/types/core/effect.d.ts +1 -0
- package/dist/types/core/graph.d.ts +1 -0
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/core/scheduler.d.ts +19 -3
- package/dist/types/core/types.d.ts +2 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/map.d.ts +21 -5
- package/dist/types/signals.d.ts +25 -4
- package/dist/types/src/boundaries.d.ts +173 -0
- package/dist/types/src/core/action.d.ts +35 -0
- package/dist/types/src/core/async.d.ts +6 -0
- package/dist/types/src/core/constants.d.ts +51 -0
- package/dist/types/src/core/context.d.ts +36 -0
- package/dist/types/src/core/core.d.ts +174 -0
- package/dist/types/src/core/dev.d.ts +49 -0
- package/dist/types/src/core/effect.d.ts +32 -0
- package/dist/types/src/core/error.d.ts +38 -0
- package/dist/types/src/core/external.d.ts +45 -0
- package/dist/types/src/core/graph.d.ts +5 -0
- package/dist/types/src/core/heap.d.ts +14 -0
- package/dist/types/src/core/index.d.ts +12 -0
- package/dist/types/src/core/lanes.d.ts +54 -0
- package/dist/types/src/core/owner.d.ts +116 -0
- package/dist/types/src/core/scheduler.d.ts +122 -0
- package/dist/types/src/core/types.d.ts +85 -0
- package/dist/types/src/index.d.ts +9 -0
- package/dist/types/src/map.d.ts +53 -0
- package/dist/types/src/signals.d.ts +512 -0
- package/dist/types/src/store/index.d.ts +9 -0
- package/dist/types/src/store/optimistic.d.ts +45 -0
- package/dist/types/src/store/projection.d.ts +66 -0
- package/dist/types/src/store/reconcile.d.ts +23 -0
- package/dist/types/src/store/store.d.ts +125 -0
- package/dist/types/src/store/storePath.d.ts +58 -0
- package/dist/types/src/store/utils.d.ts +114 -0
- package/dist/types-cjs/boundaries.d.cts +2 -2
- package/dist/types-cjs/core/constants.d.cts +8 -6
- package/dist/types-cjs/core/core.d.cts +29 -8
- package/dist/types-cjs/core/dev.d.cts +1 -1
- package/dist/types-cjs/core/effect.d.cts +1 -0
- package/dist/types-cjs/core/graph.d.cts +1 -0
- package/dist/types-cjs/core/index.d.cts +1 -1
- package/dist/types-cjs/core/scheduler.d.cts +19 -3
- package/dist/types-cjs/core/types.d.cts +2 -0
- package/dist/types-cjs/index.d.cts +1 -1
- package/dist/types-cjs/map.d.cts +21 -5
- package/dist/types-cjs/signals.d.cts +25 -4
- package/dist/types-cjs/src/boundaries.d.cts +173 -0
- package/dist/types-cjs/src/core/action.d.cts +35 -0
- package/dist/types-cjs/src/core/async.d.cts +6 -0
- package/dist/types-cjs/src/core/constants.d.cts +51 -0
- package/dist/types-cjs/src/core/context.d.cts +36 -0
- package/dist/types-cjs/src/core/core.d.cts +174 -0
- package/dist/types-cjs/src/core/dev.d.cts +49 -0
- package/dist/types-cjs/src/core/effect.d.cts +32 -0
- package/dist/types-cjs/src/core/error.d.cts +38 -0
- package/dist/types-cjs/src/core/external.d.cts +45 -0
- package/dist/types-cjs/src/core/graph.d.cts +5 -0
- package/dist/types-cjs/src/core/heap.d.cts +14 -0
- package/dist/types-cjs/src/core/index.d.cts +12 -0
- package/dist/types-cjs/src/core/lanes.d.cts +54 -0
- package/dist/types-cjs/src/core/owner.d.cts +116 -0
- package/dist/types-cjs/src/core/scheduler.d.cts +122 -0
- package/dist/types-cjs/src/core/types.d.cts +85 -0
- package/dist/types-cjs/src/index.d.cts +9 -0
- package/dist/types-cjs/src/map.d.cts +53 -0
- package/dist/types-cjs/src/signals.d.cts +512 -0
- package/dist/types-cjs/src/store/index.d.cts +9 -0
- package/dist/types-cjs/src/store/optimistic.d.cts +45 -0
- package/dist/types-cjs/src/store/projection.d.cts +66 -0
- package/dist/types-cjs/src/store/reconcile.d.cts +23 -0
- package/dist/types-cjs/src/store/store.d.cts +125 -0
- package/dist/types-cjs/src/store/storePath.d.cts +58 -0
- package/dist/types-cjs/src/store/utils.d.cts +114 -0
- package/package.json +4 -4
package/dist/prod.js
CHANGED
|
@@ -33,12 +33,14 @@ const REACTIVE_DISPOSED = 1 << 6;
|
|
|
33
33
|
const REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
|
|
34
34
|
const REACTIVE_SNAPSHOT_STALE = 1 << 8;
|
|
35
35
|
const REACTIVE_LAZY = 1 << 9;
|
|
36
|
+
const REACTIVE_MANUAL_WRITE = 1 << 10;
|
|
36
37
|
const CONFIG_OWNED_WRITE = 1 << 0;
|
|
37
38
|
const CONFIG_NO_SNAPSHOT = 1 << 1;
|
|
38
39
|
const CONFIG_TRANSPARENT = 1 << 2;
|
|
39
40
|
const CONFIG_IN_SNAPSHOT_SCOPE = 1 << 3;
|
|
40
41
|
const CONFIG_CHILDREN_FORBIDDEN = 1 << 4;
|
|
41
42
|
const CONFIG_AUTO_DISPOSE = 1 << 5;
|
|
43
|
+
const CONFIG_SYNC = 1 << 6;
|
|
42
44
|
const STATUS_PENDING = 1 << 0;
|
|
43
45
|
const STATUS_ERROR = 1 << 1;
|
|
44
46
|
const STATUS_UNINITIALIZED = 1 << 2;
|
|
@@ -51,6 +53,16 @@ const STORE_SNAPSHOT_PROPS = "sp";
|
|
|
51
53
|
const SUPPORTS_PROXY = typeof Proxy === "function";
|
|
52
54
|
const defaultContext = {};
|
|
53
55
|
const $REFRESH = Symbol("refresh");
|
|
56
|
+
const diagnosticListeners = new Set();
|
|
57
|
+
const diagnosticCaptures = new Set();
|
|
58
|
+
let diagnosticSequence = 0;
|
|
59
|
+
const DEV$1 = undefined;
|
|
60
|
+
function emitDiagnostic(e) {
|
|
61
|
+
const t = { sequence: ++diagnosticSequence, ...e };
|
|
62
|
+
for (const e of diagnosticListeners) e(t);
|
|
63
|
+
for (const e of diagnosticCaptures) e.push(t);
|
|
64
|
+
return t;
|
|
65
|
+
}
|
|
54
66
|
function actualInsertIntoHeap(e, t) {
|
|
55
67
|
const n = (e.i?.t ? e.i.u?.o : e.i?.o) ?? -1;
|
|
56
68
|
if (n >= e.o) e.o = n + 1;
|
|
@@ -58,76 +70,80 @@ function actualInsertIntoHeap(e, t) {
|
|
|
58
70
|
const r = t.l[i];
|
|
59
71
|
if (r === undefined) t.l[i] = e;
|
|
60
72
|
else {
|
|
61
|
-
const t = r.
|
|
62
|
-
t.
|
|
63
|
-
e.
|
|
64
|
-
r.
|
|
73
|
+
const t = r.S;
|
|
74
|
+
t.T = e;
|
|
75
|
+
e.S = t;
|
|
76
|
+
r.S = e;
|
|
65
77
|
}
|
|
66
78
|
if (i > t.O) t.O = i;
|
|
67
79
|
}
|
|
68
80
|
function insertIntoHeap(e, t) {
|
|
69
|
-
let n = e.
|
|
70
|
-
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS)) return;
|
|
81
|
+
let n = e._;
|
|
82
|
+
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_MANUAL_WRITE)) return;
|
|
71
83
|
if (n & REACTIVE_CHECK) {
|
|
72
|
-
e.
|
|
73
|
-
} else e.
|
|
84
|
+
e._ = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
|
|
85
|
+
} else e._ = n | REACTIVE_IN_HEAP;
|
|
74
86
|
if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
|
|
75
87
|
}
|
|
76
88
|
function insertIntoHeapHeight(e, t) {
|
|
77
|
-
let n = e.
|
|
78
|
-
if (
|
|
79
|
-
|
|
89
|
+
let n = e._;
|
|
90
|
+
if (
|
|
91
|
+
n &
|
|
92
|
+
(REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT | REACTIVE_MANUAL_WRITE)
|
|
93
|
+
)
|
|
94
|
+
return;
|
|
95
|
+
e._ = n | REACTIVE_IN_HEAP_HEIGHT;
|
|
80
96
|
actualInsertIntoHeap(e, t);
|
|
81
97
|
}
|
|
82
98
|
function deleteFromHeap(e, t) {
|
|
83
|
-
const n = e.
|
|
99
|
+
const n = e._;
|
|
84
100
|
if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
|
|
85
|
-
e.
|
|
101
|
+
e._ = n & -25;
|
|
86
102
|
const i = e.o;
|
|
87
|
-
if (e.
|
|
103
|
+
if (e.S === e) t.l[i] = undefined;
|
|
88
104
|
else {
|
|
89
|
-
const n = e.
|
|
105
|
+
const n = e.T;
|
|
90
106
|
const r = t.l[i];
|
|
91
107
|
const s = n ?? r;
|
|
92
108
|
if (e === r) t.l[i] = n;
|
|
93
|
-
else e.T
|
|
94
|
-
s.
|
|
109
|
+
else e.S.T = n;
|
|
110
|
+
s.S = e.S;
|
|
95
111
|
}
|
|
96
|
-
e.
|
|
97
|
-
e.
|
|
112
|
+
e.S = e;
|
|
113
|
+
e.T = undefined;
|
|
98
114
|
}
|
|
99
115
|
function markHeap(e) {
|
|
100
|
-
if (e.
|
|
101
|
-
e.
|
|
116
|
+
if (e.R) return;
|
|
117
|
+
e.R = true;
|
|
102
118
|
for (let t = 0; t <= e.O; t++) {
|
|
103
|
-
for (let n = e.l[t]; n !== undefined; n = n.
|
|
104
|
-
if (n.
|
|
119
|
+
for (let n = e.l[t]; n !== undefined; n = n.T) {
|
|
120
|
+
if (n._ & REACTIVE_IN_HEAP) markNode(n);
|
|
105
121
|
}
|
|
106
122
|
}
|
|
107
123
|
}
|
|
108
124
|
function markNode(e, t = REACTIVE_DIRTY) {
|
|
109
|
-
const n = e.
|
|
125
|
+
const n = e._;
|
|
110
126
|
if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
|
|
111
|
-
e.
|
|
112
|
-
for (let t = e.I; t !== null; t = t.
|
|
113
|
-
markNode(t.
|
|
127
|
+
e._ = (n & -4) | t;
|
|
128
|
+
for (let t = e.I; t !== null; t = t.p) {
|
|
129
|
+
markNode(t.h, REACTIVE_CHECK);
|
|
114
130
|
}
|
|
115
131
|
if (e.N !== null) {
|
|
116
132
|
for (let t = e.N; t !== null; t = t.A) {
|
|
117
|
-
for (let e = t.I; e !== null; e = e.
|
|
118
|
-
markNode(e.
|
|
133
|
+
for (let e = t.I; e !== null; e = e.p) {
|
|
134
|
+
markNode(e.h, REACTIVE_CHECK);
|
|
119
135
|
}
|
|
120
136
|
}
|
|
121
137
|
}
|
|
122
138
|
}
|
|
123
139
|
function runHeap(e, t) {
|
|
124
|
-
e.
|
|
125
|
-
for (e.
|
|
126
|
-
let n = e.l[e.
|
|
140
|
+
e.R = false;
|
|
141
|
+
for (e.C = 0; e.C <= e.O; e.C++) {
|
|
142
|
+
let n = e.l[e.C];
|
|
127
143
|
while (n !== undefined) {
|
|
128
|
-
if (n.
|
|
144
|
+
if (n._ & REACTIVE_IN_HEAP) t(n);
|
|
129
145
|
else adjustHeight(n, e);
|
|
130
|
-
n = e.l[e.
|
|
146
|
+
n = e.l[e.C];
|
|
131
147
|
}
|
|
132
148
|
}
|
|
133
149
|
e.O = 0;
|
|
@@ -135,31 +151,105 @@ function runHeap(e, t) {
|
|
|
135
151
|
function adjustHeight(e, t) {
|
|
136
152
|
deleteFromHeap(e, t);
|
|
137
153
|
let n = e.o;
|
|
138
|
-
for (let t = e.
|
|
154
|
+
for (let t = e.P; t; t = t.D) {
|
|
139
155
|
const e = t.m;
|
|
140
156
|
const i = e.V || e;
|
|
141
157
|
if (i.L && i.o >= n) n = i.o + 1;
|
|
142
158
|
}
|
|
143
159
|
if (e.o !== n) {
|
|
144
160
|
e.o = n;
|
|
145
|
-
for (let n = e.I; n !== null; n = n.
|
|
146
|
-
insertIntoHeapHeight(n.
|
|
161
|
+
for (let n = e.I; n !== null; n = n.p) {
|
|
162
|
+
insertIntoHeapHeight(n.h, t);
|
|
147
163
|
}
|
|
148
164
|
}
|
|
149
165
|
}
|
|
150
|
-
const
|
|
166
|
+
const signalLanes = new WeakMap();
|
|
167
|
+
const activeLanes = new Set();
|
|
168
|
+
function getOrCreateLane(e) {
|
|
169
|
+
let t = signalLanes.get(e);
|
|
170
|
+
if (t) {
|
|
171
|
+
return findLane(t);
|
|
172
|
+
}
|
|
173
|
+
const n = e.U;
|
|
174
|
+
const i = n?.G ? findLane(n.G) : null;
|
|
175
|
+
t = { F: e, k: new Set(), W: [[], []], H: null, M: activeTransition, j: i };
|
|
176
|
+
signalLanes.set(e, t);
|
|
177
|
+
activeLanes.add(t);
|
|
178
|
+
e.$ = false;
|
|
179
|
+
return t;
|
|
180
|
+
}
|
|
181
|
+
function findLane(e) {
|
|
182
|
+
while (e.H) e = e.H;
|
|
183
|
+
return e;
|
|
184
|
+
}
|
|
185
|
+
function mergeLanes(e, t) {
|
|
186
|
+
e = findLane(e);
|
|
187
|
+
t = findLane(t);
|
|
188
|
+
if (e === t) return e;
|
|
189
|
+
t.H = e;
|
|
190
|
+
for (const n of t.k) e.k.add(n);
|
|
191
|
+
e.W[0].push(...t.W[0]);
|
|
192
|
+
e.W[1].push(...t.W[1]);
|
|
193
|
+
return e;
|
|
194
|
+
}
|
|
195
|
+
function resolveLane(e) {
|
|
196
|
+
const t = e.G;
|
|
197
|
+
if (!t) return undefined;
|
|
198
|
+
const n = findLane(t);
|
|
199
|
+
if (activeLanes.has(n)) return n;
|
|
200
|
+
e.G = undefined;
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
function resolveTransition(e) {
|
|
204
|
+
return resolveLane(e)?.M ?? e.M;
|
|
205
|
+
}
|
|
206
|
+
function hasActiveOverride(e) {
|
|
207
|
+
return !!(e.K !== undefined && e.K !== NOT_PENDING);
|
|
208
|
+
}
|
|
209
|
+
function assignOrMergeLane(e, t) {
|
|
210
|
+
const n = findLane(t);
|
|
211
|
+
const i = e.G;
|
|
212
|
+
if (i) {
|
|
213
|
+
if (i.H) {
|
|
214
|
+
e.G = t;
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const r = findLane(i);
|
|
218
|
+
if (activeLanes.has(r)) {
|
|
219
|
+
if (r !== n && !hasActiveOverride(e)) {
|
|
220
|
+
if (n.j && findLane(n.j) === r) {
|
|
221
|
+
e.G = t;
|
|
222
|
+
} else if (r.j && findLane(r.j) === n);
|
|
223
|
+
else mergeLanes(n, r);
|
|
224
|
+
}
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
e.G = t;
|
|
229
|
+
}
|
|
151
230
|
const transitions = new Set();
|
|
152
|
-
const dirtyQueue = { l: new Array(2e3).fill(undefined),
|
|
153
|
-
const zombieQueue = { l: new Array(2e3).fill(undefined),
|
|
231
|
+
const dirtyQueue = { l: new Array(2e3).fill(undefined), R: false, C: 0, O: 0 };
|
|
232
|
+
const zombieQueue = { l: new Array(2e3).fill(undefined), R: false, C: 0, O: 0 };
|
|
154
233
|
let clock = 0;
|
|
155
234
|
let activeTransition = null;
|
|
156
235
|
let scheduled = false;
|
|
236
|
+
let syncDepth = 0;
|
|
157
237
|
let projectionWriteActive = false;
|
|
158
238
|
let stashedOptimisticReads = null;
|
|
159
239
|
const transientStoreNodes = new Set();
|
|
160
240
|
function registerTransientStoreNode(e) {
|
|
161
241
|
transientStoreNodes.add(e);
|
|
162
242
|
}
|
|
243
|
+
function canUseSimpleSyncFlush(e) {
|
|
244
|
+
return (
|
|
245
|
+
transitions.size === 0 &&
|
|
246
|
+
activeLanes.size === 0 &&
|
|
247
|
+
e.Y.length === 0 &&
|
|
248
|
+
e.Z.length === 0 &&
|
|
249
|
+
e.q.size === 0 &&
|
|
250
|
+
transientStoreNodes.size === 0
|
|
251
|
+
);
|
|
252
|
+
}
|
|
163
253
|
function sweepTransientStoreNodes() {
|
|
164
254
|
if (transientStoreNodes.size === 0) return;
|
|
165
255
|
for (const e of transientStoreNodes) {
|
|
@@ -167,10 +257,10 @@ function sweepTransientStoreNodes() {
|
|
|
167
257
|
transientStoreNodes.delete(e);
|
|
168
258
|
continue;
|
|
169
259
|
}
|
|
170
|
-
if (e.
|
|
171
|
-
if (e.
|
|
260
|
+
if (e.B !== NOT_PENDING) continue;
|
|
261
|
+
if (e.K !== undefined && e.K !== NOT_PENDING) continue;
|
|
172
262
|
transientStoreNodes.delete(e);
|
|
173
|
-
e.
|
|
263
|
+
e.X?.();
|
|
174
264
|
}
|
|
175
265
|
}
|
|
176
266
|
function enforceLoadingBoundary(e) {}
|
|
@@ -179,27 +269,27 @@ function shouldReadStashedOptimisticValue(e) {
|
|
|
179
269
|
}
|
|
180
270
|
function runLaneEffects(e) {
|
|
181
271
|
for (const t of activeLanes) {
|
|
182
|
-
if (t.
|
|
183
|
-
const n = t.
|
|
272
|
+
if (t.H || t.k.size > 0) continue;
|
|
273
|
+
const n = t.W[e - 1];
|
|
184
274
|
if (n.length) {
|
|
185
|
-
t.
|
|
275
|
+
t.W[e - 1] = [];
|
|
186
276
|
runQueue(n, e);
|
|
187
277
|
}
|
|
188
278
|
}
|
|
189
279
|
}
|
|
190
280
|
function queueStashedOptimisticEffects(e) {
|
|
191
|
-
for (let t = e.I; t !== null; t = t.
|
|
192
|
-
const e = t.
|
|
193
|
-
if (!e.
|
|
194
|
-
if (e.
|
|
195
|
-
if (!e.
|
|
196
|
-
e.
|
|
197
|
-
e
|
|
281
|
+
for (let t = e.I; t !== null; t = t.p) {
|
|
282
|
+
const e = t.h;
|
|
283
|
+
if (!e.J) continue;
|
|
284
|
+
if (e.J === EFFECT_TRACKED) {
|
|
285
|
+
if (!e.ee) {
|
|
286
|
+
e.ee = true;
|
|
287
|
+
e.te.enqueue(EFFECT_USER, e.ne);
|
|
198
288
|
}
|
|
199
289
|
continue;
|
|
200
290
|
}
|
|
201
|
-
const n = e.
|
|
202
|
-
if (n.
|
|
291
|
+
const n = e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
292
|
+
if (n.C > e.o) n.C = e.o;
|
|
203
293
|
insertIntoHeap(e, n);
|
|
204
294
|
}
|
|
205
295
|
}
|
|
@@ -207,67 +297,67 @@ function setProjectionWriteActive(e) {
|
|
|
207
297
|
projectionWriteActive = e;
|
|
208
298
|
}
|
|
209
299
|
function mergeTransitionState(e, t) {
|
|
210
|
-
t.
|
|
211
|
-
e.
|
|
212
|
-
for (const n of activeLanes) if (n.
|
|
213
|
-
e.
|
|
214
|
-
for (const n of t.
|
|
215
|
-
for (const [n, i] of t.
|
|
216
|
-
let t = e.
|
|
217
|
-
if (!t) e.
|
|
300
|
+
t.ie = e;
|
|
301
|
+
e.re.push(...t.re);
|
|
302
|
+
for (const n of activeLanes) if (n.M === t) n.M = e;
|
|
303
|
+
e.Z.push(...t.Z);
|
|
304
|
+
for (const n of t.q) e.q.add(n);
|
|
305
|
+
for (const [n, i] of t.se) {
|
|
306
|
+
let t = e.se.get(n);
|
|
307
|
+
if (!t) e.se.set(n, (t = new Set()));
|
|
218
308
|
for (const e of i) t.add(e);
|
|
219
309
|
}
|
|
220
|
-
for (const n of t.
|
|
310
|
+
for (const n of t.oe) e.oe.add(n);
|
|
221
311
|
}
|
|
222
312
|
function resolveOptimisticNodes(e) {
|
|
223
313
|
for (let t = 0; t < e.length; t++) {
|
|
224
314
|
const n = e[t];
|
|
225
|
-
n.
|
|
226
|
-
if (n.
|
|
227
|
-
n.
|
|
228
|
-
n.
|
|
315
|
+
n.G = undefined;
|
|
316
|
+
if (n.B !== NOT_PENDING) {
|
|
317
|
+
n.ue = n.B;
|
|
318
|
+
n.B = NOT_PENDING;
|
|
229
319
|
}
|
|
230
|
-
const i = n.
|
|
231
|
-
n.
|
|
232
|
-
if (i !== NOT_PENDING && n.
|
|
233
|
-
n.
|
|
320
|
+
const i = n.K;
|
|
321
|
+
n.K = NOT_PENDING;
|
|
322
|
+
if (i !== NOT_PENDING && n.ue !== i) insertSubs(n, true);
|
|
323
|
+
n.M = null;
|
|
234
324
|
}
|
|
235
325
|
e.length = 0;
|
|
236
326
|
}
|
|
237
327
|
function cleanupCompletedLanes(e) {
|
|
238
328
|
for (const t of activeLanes) {
|
|
239
|
-
const n = e ? t.
|
|
329
|
+
const n = e ? t.M === e : !t.M;
|
|
240
330
|
if (!n) continue;
|
|
241
|
-
if (!t.
|
|
242
|
-
if (t.
|
|
243
|
-
if (t.
|
|
244
|
-
}
|
|
245
|
-
if (t.
|
|
246
|
-
t.
|
|
247
|
-
t.
|
|
248
|
-
t.
|
|
331
|
+
if (!t.H) {
|
|
332
|
+
if (t.W[0].length) runQueue(t.W[0], EFFECT_RENDER);
|
|
333
|
+
if (t.W[1].length) runQueue(t.W[1], EFFECT_USER);
|
|
334
|
+
}
|
|
335
|
+
if (t.F.G === t) t.F.G = undefined;
|
|
336
|
+
t.k.clear();
|
|
337
|
+
t.W[0].length = 0;
|
|
338
|
+
t.W[1].length = 0;
|
|
249
339
|
activeLanes.delete(t);
|
|
250
|
-
signalLanes.delete(t.
|
|
340
|
+
signalLanes.delete(t.F);
|
|
251
341
|
}
|
|
252
342
|
}
|
|
253
343
|
function schedule() {
|
|
254
344
|
if (scheduled) return;
|
|
255
345
|
scheduled = true;
|
|
256
|
-
if (!globalQueue.
|
|
346
|
+
if (!syncDepth && !globalQueue.le && !projectionWriteActive) queueMicrotask(flush);
|
|
257
347
|
}
|
|
258
348
|
class Queue {
|
|
259
349
|
i = null;
|
|
260
|
-
|
|
261
|
-
|
|
350
|
+
ce = [[], []];
|
|
351
|
+
Y = [];
|
|
262
352
|
created = clock;
|
|
263
353
|
addChild(e) {
|
|
264
|
-
this.
|
|
354
|
+
this.Y.push(e);
|
|
265
355
|
e.i = this;
|
|
266
356
|
}
|
|
267
357
|
removeChild(e) {
|
|
268
|
-
const t = this.
|
|
358
|
+
const t = this.Y.indexOf(e);
|
|
269
359
|
if (t >= 0) {
|
|
270
|
-
this.
|
|
360
|
+
this.Y.splice(t, 1);
|
|
271
361
|
e.i = null;
|
|
272
362
|
}
|
|
273
363
|
}
|
|
@@ -276,81 +366,84 @@ class Queue {
|
|
|
276
366
|
return false;
|
|
277
367
|
}
|
|
278
368
|
run(e) {
|
|
279
|
-
if (this.
|
|
280
|
-
const t = this.
|
|
281
|
-
this.
|
|
369
|
+
if (this.ce[e - 1].length) {
|
|
370
|
+
const t = this.ce[e - 1];
|
|
371
|
+
this.ce[e - 1] = [];
|
|
282
372
|
runQueue(t, e);
|
|
283
373
|
}
|
|
284
|
-
for (let t = 0; t < this.
|
|
374
|
+
for (let t = 0; t < this.Y.length; t++) this.Y[t].run?.(e);
|
|
285
375
|
}
|
|
286
376
|
enqueue(e, t) {
|
|
287
377
|
if (e) {
|
|
288
378
|
if (currentOptimisticLane) {
|
|
289
379
|
const n = findLane(currentOptimisticLane);
|
|
290
|
-
n.
|
|
380
|
+
n.W[e - 1].push(t);
|
|
291
381
|
} else {
|
|
292
|
-
this.
|
|
382
|
+
this.ce[e - 1].push(t);
|
|
293
383
|
}
|
|
294
384
|
}
|
|
295
385
|
schedule();
|
|
296
386
|
}
|
|
297
387
|
stashQueues(e) {
|
|
298
|
-
e.
|
|
299
|
-
e.
|
|
300
|
-
this.
|
|
301
|
-
for (let t = 0; t < this.
|
|
302
|
-
let n = this.
|
|
303
|
-
let i = e.
|
|
388
|
+
e.ce[0].push(...this.ce[0]);
|
|
389
|
+
e.ce[1].push(...this.ce[1]);
|
|
390
|
+
this.ce = [[], []];
|
|
391
|
+
for (let t = 0; t < this.Y.length; t++) {
|
|
392
|
+
let n = this.Y[t];
|
|
393
|
+
let i = e.Y[t];
|
|
304
394
|
if (!i) {
|
|
305
|
-
i = {
|
|
306
|
-
e.
|
|
395
|
+
i = { ce: [[], []], Y: [] };
|
|
396
|
+
e.Y[t] = i;
|
|
307
397
|
}
|
|
308
398
|
n.stashQueues(i);
|
|
309
399
|
}
|
|
310
400
|
}
|
|
311
401
|
restoreQueues(e) {
|
|
312
|
-
this.
|
|
313
|
-
this.
|
|
314
|
-
for (let t = 0; t < e.
|
|
315
|
-
const n = e.
|
|
316
|
-
let i = this.
|
|
402
|
+
this.ce[0].push(...e.ce[0]);
|
|
403
|
+
this.ce[1].push(...e.ce[1]);
|
|
404
|
+
for (let t = 0; t < e.Y.length; t++) {
|
|
405
|
+
const n = e.Y[t];
|
|
406
|
+
let i = this.Y[t];
|
|
317
407
|
if (i) i.restoreQueues(n);
|
|
318
408
|
}
|
|
319
409
|
}
|
|
320
410
|
}
|
|
321
411
|
class GlobalQueue extends Queue {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
static
|
|
328
|
-
static
|
|
412
|
+
le = false;
|
|
413
|
+
ae = null;
|
|
414
|
+
fe = [];
|
|
415
|
+
Z = [];
|
|
416
|
+
q = new Set();
|
|
417
|
+
static Ee;
|
|
418
|
+
static Se;
|
|
419
|
+
static Te;
|
|
420
|
+
static de = null;
|
|
329
421
|
flush() {
|
|
330
|
-
if (this.
|
|
331
|
-
this.
|
|
422
|
+
if (this.le) return;
|
|
423
|
+
this.le = true;
|
|
332
424
|
try {
|
|
333
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
425
|
+
runHeap(dirtyQueue, GlobalQueue.Ee);
|
|
334
426
|
if (activeTransition) {
|
|
335
427
|
const e = transitionComplete(activeTransition);
|
|
336
428
|
if (!e) {
|
|
337
429
|
const e = activeTransition;
|
|
338
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
339
|
-
this.
|
|
340
|
-
this.
|
|
341
|
-
this.
|
|
430
|
+
runHeap(zombieQueue, GlobalQueue.Ee);
|
|
431
|
+
this.ae = null;
|
|
432
|
+
this.fe = [];
|
|
433
|
+
this.Z = [];
|
|
434
|
+
this.q = new Set();
|
|
342
435
|
runLaneEffects(EFFECT_RENDER);
|
|
343
436
|
runLaneEffects(EFFECT_USER);
|
|
344
|
-
this.stashQueues(e.
|
|
437
|
+
this.stashQueues(e.Oe);
|
|
345
438
|
clock++;
|
|
346
|
-
scheduled = dirtyQueue.O >= dirtyQueue.
|
|
347
|
-
reassignPendingTransition(e.
|
|
439
|
+
scheduled = dirtyQueue.O >= dirtyQueue.C;
|
|
440
|
+
reassignPendingTransition(e.fe);
|
|
348
441
|
activeTransition = null;
|
|
349
|
-
if (!e.
|
|
442
|
+
if (!e.re.length && !e.se.size && e.Z.length) {
|
|
350
443
|
stashedOptimisticReads = new Set();
|
|
351
|
-
for (let t = 0; t < e.
|
|
352
|
-
const n = e.
|
|
353
|
-
if (n.L || n.
|
|
444
|
+
for (let t = 0; t < e.Z.length; t++) {
|
|
445
|
+
const n = e.Z[t];
|
|
446
|
+
if (n.L || n._e & CONFIG_OWNED_WRITE) continue;
|
|
354
447
|
stashedOptimisticReads.add(n);
|
|
355
448
|
queueStashedOptimisticEffects(n);
|
|
356
449
|
}
|
|
@@ -362,36 +455,44 @@ class GlobalQueue extends Queue {
|
|
|
362
455
|
}
|
|
363
456
|
return;
|
|
364
457
|
}
|
|
365
|
-
this.
|
|
366
|
-
this.restoreQueues(activeTransition.
|
|
458
|
+
this.fe !== activeTransition.fe && this.fe.push(...activeTransition.fe);
|
|
459
|
+
this.restoreQueues(activeTransition.Oe);
|
|
367
460
|
transitions.delete(activeTransition);
|
|
368
461
|
const t = activeTransition;
|
|
369
462
|
activeTransition = null;
|
|
370
|
-
reassignPendingTransition(this.
|
|
463
|
+
reassignPendingTransition(this.fe);
|
|
371
464
|
finalizePureQueue(t);
|
|
372
465
|
} else {
|
|
373
|
-
if (
|
|
374
|
-
|
|
466
|
+
if (canUseSimpleSyncFlush(this)) {
|
|
467
|
+
commitPendingNodes();
|
|
468
|
+
if (dirtyQueue.O >= dirtyQueue.C) {
|
|
469
|
+
runHeap(dirtyQueue, GlobalQueue.Ee);
|
|
470
|
+
commitPendingNodes();
|
|
471
|
+
}
|
|
472
|
+
} else {
|
|
473
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.Ee);
|
|
474
|
+
finalizePureQueue();
|
|
475
|
+
}
|
|
375
476
|
}
|
|
376
477
|
clock++;
|
|
377
|
-
scheduled = dirtyQueue.O >= dirtyQueue.
|
|
378
|
-
runLaneEffects(EFFECT_RENDER);
|
|
478
|
+
scheduled = dirtyQueue.O >= dirtyQueue.C;
|
|
479
|
+
activeLanes.size && runLaneEffects(EFFECT_RENDER);
|
|
379
480
|
this.run(EFFECT_RENDER);
|
|
380
|
-
runLaneEffects(EFFECT_USER);
|
|
481
|
+
activeLanes.size && runLaneEffects(EFFECT_USER);
|
|
381
482
|
this.run(EFFECT_USER);
|
|
382
483
|
if (false);
|
|
383
484
|
} finally {
|
|
384
|
-
this.
|
|
485
|
+
this.le = false;
|
|
385
486
|
}
|
|
386
487
|
}
|
|
387
488
|
notify(e, t, n, i) {
|
|
388
489
|
if (t & STATUS_PENDING) {
|
|
389
490
|
if (n & STATUS_PENDING) {
|
|
390
|
-
const t = i !== undefined ? i : e.
|
|
491
|
+
const t = i !== undefined ? i : e.Re;
|
|
391
492
|
if (activeTransition && t) {
|
|
392
493
|
const n = t.source;
|
|
393
|
-
let i = activeTransition.
|
|
394
|
-
if (!i) activeTransition.
|
|
494
|
+
let i = activeTransition.se.get(n);
|
|
495
|
+
if (!i) activeTransition.se.set(n, (i = new Set()));
|
|
395
496
|
const r = i.size;
|
|
396
497
|
i.add(e);
|
|
397
498
|
if (i.size !== r) schedule();
|
|
@@ -404,18 +505,18 @@ class GlobalQueue extends Queue {
|
|
|
404
505
|
initTransition(e) {
|
|
405
506
|
if (e) e = currentTransition(e);
|
|
406
507
|
if (e && e === activeTransition) return;
|
|
407
|
-
if (!e && activeTransition && activeTransition.
|
|
508
|
+
if (!e && activeTransition && activeTransition.Ie === clock) return;
|
|
408
509
|
if (!activeTransition) {
|
|
409
510
|
activeTransition = e ?? {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
511
|
+
Ie: clock,
|
|
512
|
+
fe: [],
|
|
513
|
+
se: new Map(),
|
|
514
|
+
Z: [],
|
|
515
|
+
q: new Set(),
|
|
516
|
+
re: [],
|
|
517
|
+
Oe: { ce: [[], []], Y: [] },
|
|
518
|
+
ie: false,
|
|
519
|
+
oe: new Set()
|
|
419
520
|
};
|
|
420
521
|
} else if (e) {
|
|
421
522
|
const t = activeTransition;
|
|
@@ -424,102 +525,138 @@ class GlobalQueue extends Queue {
|
|
|
424
525
|
activeTransition = e;
|
|
425
526
|
}
|
|
426
527
|
transitions.add(activeTransition);
|
|
427
|
-
activeTransition.
|
|
428
|
-
if (this.
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
528
|
+
activeTransition.Ie = clock;
|
|
529
|
+
if (this.ae !== null) {
|
|
530
|
+
this.ae.M = activeTransition;
|
|
531
|
+
activeTransition.fe.push(this.ae);
|
|
532
|
+
this.ae = null;
|
|
533
|
+
}
|
|
534
|
+
if (this.fe !== activeTransition.fe) {
|
|
535
|
+
for (let e = 0; e < this.fe.length; e++) {
|
|
536
|
+
const t = this.fe[e];
|
|
537
|
+
t.M = activeTransition;
|
|
538
|
+
activeTransition.fe.push(t);
|
|
433
539
|
}
|
|
434
|
-
this.
|
|
540
|
+
this.fe = activeTransition.fe;
|
|
435
541
|
}
|
|
436
|
-
if (this.
|
|
437
|
-
for (let e = 0; e < this.
|
|
438
|
-
const t = this.
|
|
439
|
-
t.
|
|
440
|
-
activeTransition.
|
|
542
|
+
if (this.Z !== activeTransition.Z) {
|
|
543
|
+
for (let e = 0; e < this.Z.length; e++) {
|
|
544
|
+
const t = this.Z[e];
|
|
545
|
+
t.M = activeTransition;
|
|
546
|
+
activeTransition.Z.push(t);
|
|
441
547
|
}
|
|
442
|
-
this.
|
|
548
|
+
this.Z = activeTransition.Z;
|
|
443
549
|
}
|
|
444
550
|
for (const e of activeLanes) {
|
|
445
|
-
if (!e.
|
|
551
|
+
if (!e.M) e.M = activeTransition;
|
|
446
552
|
}
|
|
447
|
-
if (this.
|
|
448
|
-
for (const e of this.
|
|
449
|
-
this.
|
|
553
|
+
if (this.q !== activeTransition.q) {
|
|
554
|
+
for (const e of this.q) activeTransition.q.add(e);
|
|
555
|
+
this.q = activeTransition.q;
|
|
450
556
|
}
|
|
451
557
|
}
|
|
452
558
|
}
|
|
559
|
+
function queuePendingNode(e) {
|
|
560
|
+
if (activeTransition) {
|
|
561
|
+
globalQueue.fe.push(e);
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
if (globalQueue.ae === null && globalQueue.fe.length === 0) {
|
|
565
|
+
globalQueue.ae = e;
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
if (globalQueue.ae !== null) {
|
|
569
|
+
globalQueue.fe.push(globalQueue.ae);
|
|
570
|
+
globalQueue.ae = null;
|
|
571
|
+
}
|
|
572
|
+
globalQueue.fe.push(e);
|
|
573
|
+
}
|
|
453
574
|
function insertSubs(e, t = false) {
|
|
454
|
-
const n = e.
|
|
455
|
-
const i = e.
|
|
456
|
-
for (let r = e.I; r !== null; r = r.
|
|
457
|
-
if (i && r.
|
|
458
|
-
r.
|
|
575
|
+
const n = e.G || currentOptimisticLane;
|
|
576
|
+
const i = e.pe !== undefined;
|
|
577
|
+
for (let r = e.I; r !== null; r = r.p) {
|
|
578
|
+
if (i && r.h._e & CONFIG_IN_SNAPSHOT_SCOPE) {
|
|
579
|
+
r.h._ |= REACTIVE_SNAPSHOT_STALE;
|
|
459
580
|
continue;
|
|
460
581
|
}
|
|
461
582
|
if (t && n) {
|
|
462
|
-
r.
|
|
463
|
-
assignOrMergeLane(r.
|
|
583
|
+
r.h._ |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
584
|
+
assignOrMergeLane(r.h, n);
|
|
464
585
|
} else if (t) {
|
|
465
|
-
r.
|
|
466
|
-
r.
|
|
586
|
+
r.h._ |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
587
|
+
r.h.G = undefined;
|
|
467
588
|
}
|
|
468
|
-
const e = r.
|
|
469
|
-
if (e.
|
|
470
|
-
if (!e.
|
|
471
|
-
e.
|
|
472
|
-
e
|
|
589
|
+
const e = r.h;
|
|
590
|
+
if (e.J === EFFECT_TRACKED) {
|
|
591
|
+
if (!e.ee) {
|
|
592
|
+
e.ee = true;
|
|
593
|
+
e.te.enqueue(EFFECT_USER, e.ne);
|
|
473
594
|
}
|
|
474
595
|
continue;
|
|
475
596
|
}
|
|
476
|
-
const s = r.
|
|
477
|
-
if (s.
|
|
478
|
-
insertIntoHeap(r.
|
|
597
|
+
const s = r.h._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
598
|
+
if (s.C > r.h.o) s.C = r.h.o;
|
|
599
|
+
insertIntoHeap(r.h, s);
|
|
479
600
|
}
|
|
480
601
|
}
|
|
602
|
+
function commitPendingNode(e) {
|
|
603
|
+
const t = e;
|
|
604
|
+
if (!t.L) {
|
|
605
|
+
if (e.B !== NOT_PENDING) {
|
|
606
|
+
e.ue = e.B;
|
|
607
|
+
e.B = NOT_PENDING;
|
|
608
|
+
}
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
if (e.B !== NOT_PENDING) {
|
|
612
|
+
e.ue = e.B;
|
|
613
|
+
e.B = NOT_PENDING;
|
|
614
|
+
if (e.J && e.J !== EFFECT_TRACKED) e.ee = true;
|
|
615
|
+
}
|
|
616
|
+
t._ &= ~REACTIVE_MANUAL_WRITE;
|
|
617
|
+
if (!(t.he & STATUS_PENDING)) t.he &= ~STATUS_UNINITIALIZED;
|
|
618
|
+
if (t.Ne !== null || t.Ae !== null) GlobalQueue.Se(t, false, true);
|
|
619
|
+
}
|
|
481
620
|
function commitPendingNodes() {
|
|
482
|
-
|
|
621
|
+
if (globalQueue.ae !== null) {
|
|
622
|
+
commitPendingNode(globalQueue.ae);
|
|
623
|
+
globalQueue.ae = null;
|
|
624
|
+
}
|
|
625
|
+
const e = globalQueue.fe;
|
|
483
626
|
for (let t = 0; t < e.length; t++) {
|
|
484
|
-
|
|
485
|
-
if (n.U !== NOT_PENDING) {
|
|
486
|
-
n.ne = n.U;
|
|
487
|
-
n.U = NOT_PENDING;
|
|
488
|
-
if (n.M && n.M !== EFFECT_TRACKED) n.j = true;
|
|
489
|
-
}
|
|
490
|
-
if (!(n.Oe & STATUS_PENDING)) n.Oe &= ~STATUS_UNINITIALIZED;
|
|
491
|
-
if (n.L) GlobalQueue.ae(n, false, true);
|
|
627
|
+
commitPendingNode(e[t]);
|
|
492
628
|
}
|
|
493
629
|
e.length = 0;
|
|
494
630
|
}
|
|
495
631
|
function finalizePureQueue(e = null, t = false) {
|
|
496
632
|
const n = !t;
|
|
497
633
|
if (n) commitPendingNodes();
|
|
498
|
-
if (!t) checkBoundaryChildren(globalQueue);
|
|
499
|
-
|
|
634
|
+
if (!t && globalQueue.Y.length) checkBoundaryChildren(globalQueue);
|
|
635
|
+
const i = dirtyQueue.O >= dirtyQueue.C;
|
|
636
|
+
if (i) runHeap(dirtyQueue, GlobalQueue.Ee);
|
|
500
637
|
if (n) {
|
|
501
|
-
commitPendingNodes();
|
|
502
|
-
resolveOptimisticNodes(e ? e.
|
|
503
|
-
if (e && e.
|
|
504
|
-
for (const t of e.
|
|
505
|
-
if (t.
|
|
506
|
-
if (t.
|
|
507
|
-
if (!t.
|
|
508
|
-
t.
|
|
509
|
-
t
|
|
638
|
+
if (i) commitPendingNodes();
|
|
639
|
+
resolveOptimisticNodes(e ? e.Z : globalQueue.Z);
|
|
640
|
+
if (e && e.oe.size) {
|
|
641
|
+
for (const t of e.oe) {
|
|
642
|
+
if (t._ & REACTIVE_DISPOSED) continue;
|
|
643
|
+
if (t.J === EFFECT_TRACKED) {
|
|
644
|
+
if (!t.ee) {
|
|
645
|
+
t.ee = true;
|
|
646
|
+
t.te.enqueue(EFFECT_USER, t.ne);
|
|
510
647
|
}
|
|
511
648
|
continue;
|
|
512
649
|
}
|
|
513
|
-
const e = t.
|
|
514
|
-
if (e.
|
|
650
|
+
const e = t._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
651
|
+
if (e.C > t.o) e.C = t.o;
|
|
515
652
|
insertIntoHeap(t, e);
|
|
516
653
|
}
|
|
517
|
-
e.
|
|
654
|
+
e.oe.clear();
|
|
518
655
|
}
|
|
519
|
-
const t = e ? e.
|
|
520
|
-
if (GlobalQueue.
|
|
656
|
+
const t = e ? e.q : globalQueue.q;
|
|
657
|
+
if (GlobalQueue.de && t.size) {
|
|
521
658
|
for (const e of t) {
|
|
522
|
-
GlobalQueue.
|
|
659
|
+
GlobalQueue.de(e);
|
|
523
660
|
}
|
|
524
661
|
t.clear();
|
|
525
662
|
schedule();
|
|
@@ -529,23 +666,32 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
529
666
|
}
|
|
530
667
|
}
|
|
531
668
|
function checkBoundaryChildren(e) {
|
|
532
|
-
for (const t of e.
|
|
669
|
+
for (const t of e.Y) {
|
|
533
670
|
t.checkSources?.();
|
|
534
671
|
checkBoundaryChildren(t);
|
|
535
672
|
}
|
|
536
673
|
}
|
|
537
674
|
function trackOptimisticStore(e) {
|
|
538
|
-
globalQueue.
|
|
675
|
+
globalQueue.q.add(e);
|
|
539
676
|
schedule();
|
|
540
677
|
}
|
|
541
678
|
function reassignPendingTransition(e) {
|
|
542
679
|
for (let t = 0; t < e.length; t++) {
|
|
543
|
-
e[t].
|
|
680
|
+
e[t].M = activeTransition;
|
|
544
681
|
}
|
|
545
682
|
}
|
|
546
683
|
const globalQueue = new GlobalQueue();
|
|
547
|
-
function flush() {
|
|
548
|
-
if (
|
|
684
|
+
function flush(e) {
|
|
685
|
+
if (e) {
|
|
686
|
+
syncDepth++;
|
|
687
|
+
try {
|
|
688
|
+
return e();
|
|
689
|
+
} finally {
|
|
690
|
+
flush();
|
|
691
|
+
syncDepth--;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
if (globalQueue.le) {
|
|
549
695
|
return;
|
|
550
696
|
}
|
|
551
697
|
while (scheduled || activeTransition) {
|
|
@@ -556,22 +702,22 @@ function runQueue(e, t) {
|
|
|
556
702
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
557
703
|
}
|
|
558
704
|
function reporterBlocksSource(e, t) {
|
|
559
|
-
if (e.
|
|
560
|
-
if (e.
|
|
561
|
-
for (let n = e.
|
|
705
|
+
if (e._ & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
|
|
706
|
+
if (e.Ce === t || e.Pe?.has(t)) return true;
|
|
707
|
+
for (let n = e.P; n; n = n.D) {
|
|
562
708
|
let e = n.m;
|
|
563
709
|
while (e) {
|
|
564
710
|
if (e === t || e.V === t) return true;
|
|
565
|
-
e = e.
|
|
711
|
+
e = e.U;
|
|
566
712
|
}
|
|
567
713
|
}
|
|
568
|
-
return !!(e.
|
|
714
|
+
return !!(e.he & STATUS_PENDING && e.Re instanceof NotReadyError && e.Re.source === t);
|
|
569
715
|
}
|
|
570
716
|
function transitionComplete(e) {
|
|
571
|
-
if (e.
|
|
572
|
-
if (e.
|
|
717
|
+
if (e.ie) return true;
|
|
718
|
+
if (e.re.length) return false;
|
|
573
719
|
let t = true;
|
|
574
|
-
for (const [n, i] of e.
|
|
720
|
+
for (const [n, i] of e.se) {
|
|
575
721
|
let r = false;
|
|
576
722
|
for (const e of i) {
|
|
577
723
|
if (reporterBlocksSource(e, n)) {
|
|
@@ -580,32 +726,32 @@ function transitionComplete(e) {
|
|
|
580
726
|
}
|
|
581
727
|
i.delete(e);
|
|
582
728
|
}
|
|
583
|
-
if (!r) e.
|
|
584
|
-
else if (n.
|
|
729
|
+
if (!r) e.se.delete(n);
|
|
730
|
+
else if (n.he & STATUS_PENDING && n.Re?.source === n) {
|
|
585
731
|
t = false;
|
|
586
732
|
break;
|
|
587
733
|
}
|
|
588
734
|
}
|
|
589
735
|
if (t) {
|
|
590
|
-
for (let n = 0; n < e.
|
|
591
|
-
const i = e.
|
|
736
|
+
for (let n = 0; n < e.Z.length; n++) {
|
|
737
|
+
const i = e.Z[n];
|
|
592
738
|
if (
|
|
593
739
|
hasActiveOverride(i) &&
|
|
594
|
-
"
|
|
595
|
-
i.
|
|
596
|
-
i.
|
|
597
|
-
i.
|
|
740
|
+
"he" in i &&
|
|
741
|
+
i.he & STATUS_PENDING &&
|
|
742
|
+
i.Re instanceof NotReadyError &&
|
|
743
|
+
i.Re.source !== i
|
|
598
744
|
) {
|
|
599
745
|
t = false;
|
|
600
746
|
break;
|
|
601
747
|
}
|
|
602
748
|
}
|
|
603
749
|
}
|
|
604
|
-
t && (e.
|
|
750
|
+
t && (e.ie = true);
|
|
605
751
|
return t;
|
|
606
752
|
}
|
|
607
753
|
function currentTransition(e) {
|
|
608
|
-
while (e.
|
|
754
|
+
while (e.ie && typeof e.ie === "object") e = e.ie;
|
|
609
755
|
return e;
|
|
610
756
|
}
|
|
611
757
|
function setActiveTransition(e) {
|
|
@@ -620,182 +766,67 @@ function runInTransition(e, t) {
|
|
|
620
766
|
activeTransition = n;
|
|
621
767
|
}
|
|
622
768
|
}
|
|
623
|
-
const signalLanes = new WeakMap();
|
|
624
|
-
const activeLanes = new Set();
|
|
625
|
-
function getOrCreateLane(e) {
|
|
626
|
-
let t = signalLanes.get(e);
|
|
627
|
-
if (t) {
|
|
628
|
-
return findLane(t);
|
|
629
|
-
}
|
|
630
|
-
const n = e.Ie;
|
|
631
|
-
const i = n?.te ? findLane(n.te) : null;
|
|
632
|
-
t = { ie: e, W: new Set(), H: [[], []], F: null, Z: activeTransition, he: i };
|
|
633
|
-
signalLanes.set(e, t);
|
|
634
|
-
activeLanes.add(t);
|
|
635
|
-
e.pe = false;
|
|
636
|
-
return t;
|
|
637
|
-
}
|
|
638
|
-
function findLane(e) {
|
|
639
|
-
while (e.F) e = e.F;
|
|
640
|
-
return e;
|
|
641
|
-
}
|
|
642
|
-
function mergeLanes(e, t) {
|
|
643
|
-
e = findLane(e);
|
|
644
|
-
t = findLane(t);
|
|
645
|
-
if (e === t) return e;
|
|
646
|
-
t.F = e;
|
|
647
|
-
for (const n of t.W) e.W.add(n);
|
|
648
|
-
e.H[0].push(...t.H[0]);
|
|
649
|
-
e.H[1].push(...t.H[1]);
|
|
650
|
-
return e;
|
|
651
|
-
}
|
|
652
|
-
function resolveLane(e) {
|
|
653
|
-
const t = e.te;
|
|
654
|
-
if (!t) return undefined;
|
|
655
|
-
const n = findLane(t);
|
|
656
|
-
if (activeLanes.has(n)) return n;
|
|
657
|
-
e.te = undefined;
|
|
658
|
-
return undefined;
|
|
659
|
-
}
|
|
660
|
-
function resolveTransition(e) {
|
|
661
|
-
return resolveLane(e)?.Z ?? e.Z;
|
|
662
|
-
}
|
|
663
|
-
function hasActiveOverride(e) {
|
|
664
|
-
return !!(e.G !== undefined && e.G !== NOT_PENDING);
|
|
665
|
-
}
|
|
666
|
-
function assignOrMergeLane(e, t) {
|
|
667
|
-
const n = findLane(t);
|
|
668
|
-
const i = e.te;
|
|
669
|
-
if (i) {
|
|
670
|
-
if (i.F) {
|
|
671
|
-
e.te = t;
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
674
|
-
const r = findLane(i);
|
|
675
|
-
if (activeLanes.has(r)) {
|
|
676
|
-
if (r !== n && !hasActiveOverride(e)) {
|
|
677
|
-
if (n.he && findLane(n.he) === r) {
|
|
678
|
-
e.te = t;
|
|
679
|
-
} else if (r.he && findLane(r.he) === n);
|
|
680
|
-
else mergeLanes(n, r);
|
|
681
|
-
}
|
|
682
|
-
return;
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
e.te = t;
|
|
686
|
-
}
|
|
687
|
-
function unlinkSubs(e) {
|
|
688
|
-
const t = e.m;
|
|
689
|
-
const n = e.D;
|
|
690
|
-
const i = e.h;
|
|
691
|
-
const r = e.Ne;
|
|
692
|
-
if (i !== null) i.Ne = r;
|
|
693
|
-
else t.Ae = r;
|
|
694
|
-
if (r !== null) r.h = i;
|
|
695
|
-
else {
|
|
696
|
-
t.I = i;
|
|
697
|
-
if (i === null) {
|
|
698
|
-
t.k?.();
|
|
699
|
-
const e = t;
|
|
700
|
-
e.L && e.Ee & CONFIG_AUTO_DISPOSE && !(e.R & REACTIVE_ZOMBIE) && unobserved(e);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
return n;
|
|
704
|
-
}
|
|
705
|
-
function unobserved(e) {
|
|
706
|
-
deleteFromHeap(e, e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
707
|
-
let t = e.C;
|
|
708
|
-
while (t !== null) {
|
|
709
|
-
t = unlinkSubs(t);
|
|
710
|
-
}
|
|
711
|
-
e.C = null;
|
|
712
|
-
e.Pe = null;
|
|
713
|
-
disposeChildren(e, true);
|
|
714
|
-
}
|
|
715
|
-
function link(e, t) {
|
|
716
|
-
const n = t.Pe;
|
|
717
|
-
if (n !== null && n.m === e) return;
|
|
718
|
-
let i = null;
|
|
719
|
-
const r = t.R & REACTIVE_RECOMPUTING_DEPS;
|
|
720
|
-
if (r) {
|
|
721
|
-
i = n !== null ? n.D : t.C;
|
|
722
|
-
if (i !== null && i.m === e) {
|
|
723
|
-
t.Pe = i;
|
|
724
|
-
return;
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
const s = e.Ae;
|
|
728
|
-
if (s !== null && s.p === t && (!r || isValidLink(s, t))) return;
|
|
729
|
-
const o = (t.Pe = e.Ae = { m: e, p: t, D: i, Ne: s, h: null });
|
|
730
|
-
if (n !== null) n.D = o;
|
|
731
|
-
else t.C = o;
|
|
732
|
-
if (s !== null) s.h = o;
|
|
733
|
-
else e.I = o;
|
|
734
|
-
}
|
|
735
|
-
function isValidLink(e, t) {
|
|
736
|
-
const n = t.Pe;
|
|
737
|
-
if (n !== null) {
|
|
738
|
-
let i = t.C;
|
|
739
|
-
do {
|
|
740
|
-
if (i === e) return true;
|
|
741
|
-
if (i === n) break;
|
|
742
|
-
i = i.D;
|
|
743
|
-
} while (i !== null);
|
|
744
|
-
}
|
|
745
|
-
return false;
|
|
746
|
-
}
|
|
747
769
|
const PENDING_OWNER = {};
|
|
748
770
|
function markDisposal(e) {
|
|
749
|
-
let t = e.
|
|
771
|
+
let t = e.ge;
|
|
750
772
|
while (t) {
|
|
751
|
-
t.
|
|
752
|
-
if (t.
|
|
773
|
+
t._ |= REACTIVE_ZOMBIE;
|
|
774
|
+
if (t._ & REACTIVE_IN_HEAP) {
|
|
753
775
|
deleteFromHeap(t, dirtyQueue);
|
|
754
776
|
insertIntoHeap(t, zombieQueue);
|
|
755
777
|
}
|
|
756
778
|
markDisposal(t);
|
|
757
|
-
t = t.
|
|
779
|
+
t = t.De;
|
|
758
780
|
}
|
|
759
781
|
}
|
|
760
782
|
function dispose(e) {
|
|
761
|
-
let t = e.
|
|
783
|
+
let t = e.P || null;
|
|
762
784
|
do {
|
|
763
785
|
t = unlinkSubs(t);
|
|
764
786
|
} while (t !== null);
|
|
765
|
-
e.
|
|
766
|
-
e.
|
|
787
|
+
e.P = null;
|
|
788
|
+
e.ye = null;
|
|
767
789
|
disposeChildren(e, true);
|
|
768
790
|
}
|
|
769
791
|
function disposeChildren(e, t = false, n) {
|
|
770
|
-
|
|
771
|
-
if (
|
|
772
|
-
if (t
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
792
|
+
const i = e._;
|
|
793
|
+
if (i & REACTIVE_DISPOSED) return;
|
|
794
|
+
if (t) e._ = i | REACTIVE_DISPOSED;
|
|
795
|
+
if (t && e.L) e.ve = null;
|
|
796
|
+
let r = n ? e.Ne : e.ge;
|
|
797
|
+
while (r) {
|
|
798
|
+
const e = r.De;
|
|
799
|
+
if (r.P) {
|
|
800
|
+
const e = r;
|
|
801
|
+
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
802
|
+
let t = e.P;
|
|
780
803
|
do {
|
|
781
804
|
t = unlinkSubs(t);
|
|
782
805
|
} while (t !== null);
|
|
783
|
-
e.
|
|
784
|
-
e.
|
|
806
|
+
e.P = null;
|
|
807
|
+
e.ye = null;
|
|
785
808
|
}
|
|
786
|
-
disposeChildren(
|
|
787
|
-
|
|
809
|
+
disposeChildren(r, true);
|
|
810
|
+
r = e;
|
|
788
811
|
}
|
|
789
812
|
if (n) {
|
|
790
|
-
e.
|
|
813
|
+
e.Ne = null;
|
|
791
814
|
} else {
|
|
792
|
-
e.
|
|
793
|
-
e.
|
|
815
|
+
e.ge = null;
|
|
816
|
+
e.me = 0;
|
|
817
|
+
}
|
|
818
|
+
if (t && !n && !(i & REACTIVE_ZOMBIE) && e.i !== null && !(e.i._ & REACTIVE_DISPOSED)) {
|
|
819
|
+
const t = e.be;
|
|
820
|
+
const n = e.De;
|
|
821
|
+
if (t !== null) t.De = n;
|
|
822
|
+
else e.i.ge = n;
|
|
823
|
+
if (n !== null) n.be = t;
|
|
824
|
+
e.be = null;
|
|
794
825
|
}
|
|
795
826
|
runDisposal(e, n);
|
|
796
827
|
}
|
|
797
828
|
function runDisposal(e, t) {
|
|
798
|
-
let n = t ? e.
|
|
829
|
+
let n = t ? e.Ae : e.we;
|
|
799
830
|
if (!n) return;
|
|
800
831
|
if (Array.isArray(n)) {
|
|
801
832
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -805,12 +836,12 @@ function runDisposal(e, t) {
|
|
|
805
836
|
} else {
|
|
806
837
|
n.call(n);
|
|
807
838
|
}
|
|
808
|
-
t ? (e.
|
|
839
|
+
t ? (e.Ae = null) : (e.we = null);
|
|
809
840
|
}
|
|
810
841
|
function childId(e, t) {
|
|
811
842
|
let n = e;
|
|
812
|
-
while (n.
|
|
813
|
-
if (n.id != null) return formatId(n.id, t ? n.
|
|
843
|
+
while (n._e & CONFIG_TRANSPARENT && n.i) n = n.i;
|
|
844
|
+
if (n.id != null) return formatId(n.id, t ? n.me++ : n.me);
|
|
814
845
|
throw new Error("Cannot get child id from owner without an id");
|
|
815
846
|
}
|
|
816
847
|
function getNextChildId(e) {
|
|
@@ -839,96 +870,170 @@ function cleanup(e) {
|
|
|
839
870
|
return e;
|
|
840
871
|
}
|
|
841
872
|
function isDisposed(e) {
|
|
842
|
-
return !!(e.
|
|
873
|
+
return !!(e._ & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
|
|
874
|
+
}
|
|
875
|
+
function disposeRootSelf(e = true) {
|
|
876
|
+
disposeChildren(this, e);
|
|
843
877
|
}
|
|
844
878
|
function createOwner(e) {
|
|
845
879
|
const t = context;
|
|
846
880
|
const n = e?.transparent ?? false;
|
|
847
881
|
const i = {
|
|
848
882
|
id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
|
|
849
|
-
|
|
883
|
+
_e: n ? CONFIG_TRANSPARENT : 0,
|
|
850
884
|
t: true,
|
|
851
885
|
u: t?.t ? t.u : t,
|
|
852
|
-
Ce: null,
|
|
853
886
|
ge: null,
|
|
887
|
+
De: null,
|
|
888
|
+
be: null,
|
|
854
889
|
we: null,
|
|
855
|
-
|
|
890
|
+
te: t?.te ?? globalQueue,
|
|
856
891
|
Ve: t?.Ve || defaultContext,
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
892
|
+
me: 0,
|
|
893
|
+
Ae: null,
|
|
894
|
+
Ne: null,
|
|
860
895
|
i: t,
|
|
861
|
-
dispose
|
|
862
|
-
disposeChildren(i, e);
|
|
863
|
-
}
|
|
896
|
+
dispose: disposeRootSelf
|
|
864
897
|
};
|
|
865
898
|
if (t) {
|
|
866
|
-
const e = t.
|
|
899
|
+
const e = t.ge;
|
|
867
900
|
if (e === null) {
|
|
868
|
-
t.
|
|
901
|
+
t.ge = i;
|
|
869
902
|
} else {
|
|
870
|
-
i.
|
|
871
|
-
|
|
903
|
+
i.De = e;
|
|
904
|
+
e.be = i;
|
|
905
|
+
t.ge = i;
|
|
872
906
|
}
|
|
873
907
|
}
|
|
874
908
|
return i;
|
|
875
909
|
}
|
|
876
910
|
function createRoot(e, t) {
|
|
877
911
|
const n = createOwner(t);
|
|
878
|
-
return runWithOwner(n, () => e(n.dispose));
|
|
912
|
+
return runWithOwner(n, () => e(() => n.dispose()));
|
|
913
|
+
}
|
|
914
|
+
function unlinkSubs(e) {
|
|
915
|
+
const t = e.m;
|
|
916
|
+
const n = e.D;
|
|
917
|
+
const i = e.p;
|
|
918
|
+
const r = e.Le;
|
|
919
|
+
if (i !== null) i.Le = r;
|
|
920
|
+
else t.Ue = r;
|
|
921
|
+
if (r !== null) r.p = i;
|
|
922
|
+
else {
|
|
923
|
+
t.I = i;
|
|
924
|
+
if (i === null) {
|
|
925
|
+
t.X?.();
|
|
926
|
+
const e = t;
|
|
927
|
+
e.L && e._e & CONFIG_AUTO_DISPOSE && !(e._ & REACTIVE_ZOMBIE) && unobserved(e);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
return n;
|
|
931
|
+
}
|
|
932
|
+
function trimStaleDeps(e) {
|
|
933
|
+
const t = e.ye;
|
|
934
|
+
let n = t !== null ? t.D : e.P;
|
|
935
|
+
if (n !== null) {
|
|
936
|
+
do {
|
|
937
|
+
n = unlinkSubs(n);
|
|
938
|
+
} while (n !== null);
|
|
939
|
+
if (t !== null) t.D = null;
|
|
940
|
+
else e.P = null;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
function unobserved(e) {
|
|
944
|
+
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
945
|
+
let t = e.P;
|
|
946
|
+
while (t !== null) {
|
|
947
|
+
t = unlinkSubs(t);
|
|
948
|
+
}
|
|
949
|
+
e.P = null;
|
|
950
|
+
e.ye = null;
|
|
951
|
+
disposeChildren(e, true);
|
|
952
|
+
}
|
|
953
|
+
function link(e, t) {
|
|
954
|
+
const n = t.ye;
|
|
955
|
+
if (n !== null && n.m === e) return;
|
|
956
|
+
let i = null;
|
|
957
|
+
const r = t._ & REACTIVE_RECOMPUTING_DEPS;
|
|
958
|
+
if (r) {
|
|
959
|
+
i = n !== null ? n.D : t.P;
|
|
960
|
+
if (i !== null && i.m === e) {
|
|
961
|
+
t.ye = i;
|
|
962
|
+
return;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
const s = e.Ue;
|
|
966
|
+
if (s !== null && s.h === t && (!r || isValidLink(s, t))) return;
|
|
967
|
+
const o = (t.ye = e.Ue = { m: e, h: t, D: i, Le: s, p: null });
|
|
968
|
+
if (n !== null) n.D = o;
|
|
969
|
+
else t.P = o;
|
|
970
|
+
if (s !== null) s.p = o;
|
|
971
|
+
else e.I = o;
|
|
972
|
+
}
|
|
973
|
+
function isValidLink(e, t) {
|
|
974
|
+
const n = t.ye;
|
|
975
|
+
if (n !== null) {
|
|
976
|
+
let i = t.P;
|
|
977
|
+
do {
|
|
978
|
+
if (i === e) return true;
|
|
979
|
+
if (i === n) break;
|
|
980
|
+
i = i.D;
|
|
981
|
+
} while (i !== null);
|
|
982
|
+
}
|
|
983
|
+
return false;
|
|
879
984
|
}
|
|
880
985
|
function addPendingSource(e, t) {
|
|
881
|
-
if (e.
|
|
882
|
-
if (!e.
|
|
883
|
-
e.
|
|
986
|
+
if (e.Ce === t || e.Pe?.has(t)) return false;
|
|
987
|
+
if (!e.Ce) {
|
|
988
|
+
e.Ce = t;
|
|
884
989
|
return true;
|
|
885
990
|
}
|
|
886
|
-
if (!e.
|
|
887
|
-
e.
|
|
991
|
+
if (!e.Pe) {
|
|
992
|
+
e.Pe = new Set([e.Ce, t]);
|
|
888
993
|
} else {
|
|
889
|
-
e.
|
|
994
|
+
e.Pe.add(t);
|
|
890
995
|
}
|
|
891
|
-
e.
|
|
996
|
+
e.Ce = undefined;
|
|
892
997
|
return true;
|
|
893
998
|
}
|
|
894
999
|
function removePendingSource(e, t) {
|
|
895
|
-
if (e.
|
|
896
|
-
if (e.
|
|
897
|
-
e.
|
|
1000
|
+
if (e.Ce) {
|
|
1001
|
+
if (e.Ce !== t) return false;
|
|
1002
|
+
e.Ce = undefined;
|
|
898
1003
|
return true;
|
|
899
1004
|
}
|
|
900
|
-
if (!e.
|
|
901
|
-
if (e.
|
|
902
|
-
e.
|
|
903
|
-
e.
|
|
904
|
-
} else if (e.
|
|
905
|
-
e.
|
|
1005
|
+
if (!e.Pe?.delete(t)) return false;
|
|
1006
|
+
if (e.Pe.size === 1) {
|
|
1007
|
+
e.Ce = e.Pe.values().next().value;
|
|
1008
|
+
e.Pe = undefined;
|
|
1009
|
+
} else if (e.Pe.size === 0) {
|
|
1010
|
+
e.Pe = undefined;
|
|
906
1011
|
}
|
|
907
1012
|
return true;
|
|
908
1013
|
}
|
|
909
1014
|
function clearPendingSources(e) {
|
|
910
|
-
e.
|
|
911
|
-
e.
|
|
912
|
-
e.
|
|
1015
|
+
e.Ce = undefined;
|
|
1016
|
+
e.Pe?.clear();
|
|
1017
|
+
e.Pe = undefined;
|
|
913
1018
|
}
|
|
914
1019
|
function setPendingError(e, t, n) {
|
|
915
1020
|
if (!t) {
|
|
916
|
-
e.
|
|
1021
|
+
e.Re = null;
|
|
917
1022
|
return;
|
|
918
1023
|
}
|
|
919
1024
|
if (n instanceof NotReadyError && n.source === t) {
|
|
920
|
-
e.
|
|
1025
|
+
e.Re = n;
|
|
921
1026
|
return;
|
|
922
1027
|
}
|
|
923
|
-
const i = e.
|
|
1028
|
+
const i = e.Re;
|
|
924
1029
|
if (!(i instanceof NotReadyError) || i.source !== t) {
|
|
925
|
-
e.
|
|
1030
|
+
e.Re = new NotReadyError(t);
|
|
926
1031
|
}
|
|
927
1032
|
}
|
|
928
1033
|
function forEachDependent(e, t) {
|
|
929
|
-
for (let n = e.I; n !== null; n = n.
|
|
1034
|
+
for (let n = e.I; n !== null; n = n.p) t(n.h);
|
|
930
1035
|
for (let n = e.N; n !== null; n = n.A) {
|
|
931
|
-
for (let e = n.I; e !== null; e = e.
|
|
1036
|
+
for (let e = n.I; e !== null; e = e.p) t(e.h);
|
|
932
1037
|
}
|
|
933
1038
|
}
|
|
934
1039
|
function settlePendingSource(e) {
|
|
@@ -937,30 +1042,30 @@ function settlePendingSource(e) {
|
|
|
937
1042
|
const settle = i => {
|
|
938
1043
|
if (n.has(i) || !removePendingSource(i, e)) return;
|
|
939
1044
|
n.add(i);
|
|
940
|
-
i.
|
|
941
|
-
const r = i.
|
|
1045
|
+
i.Ie = clock;
|
|
1046
|
+
const r = i.Ce ?? i.Pe?.values().next().value;
|
|
942
1047
|
if (r) {
|
|
943
1048
|
setPendingError(i, r);
|
|
944
1049
|
updatePendingSignal(i);
|
|
945
1050
|
} else {
|
|
946
|
-
i.
|
|
1051
|
+
i.he &= ~STATUS_PENDING;
|
|
947
1052
|
setPendingError(i);
|
|
948
1053
|
updatePendingSignal(i);
|
|
949
|
-
if (i.
|
|
950
|
-
if (i.
|
|
1054
|
+
if (i.Ge) {
|
|
1055
|
+
if (i.J === EFFECT_TRACKED) {
|
|
951
1056
|
const e = i;
|
|
952
|
-
if (!e.
|
|
953
|
-
e.
|
|
954
|
-
e
|
|
1057
|
+
if (!e.ee) {
|
|
1058
|
+
e.ee = true;
|
|
1059
|
+
e.te.enqueue(EFFECT_USER, e.ne);
|
|
955
1060
|
}
|
|
956
1061
|
} else {
|
|
957
|
-
const e = i.
|
|
958
|
-
if (e.
|
|
1062
|
+
const e = i._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
1063
|
+
if (e.C > i.o) e.C = i.o;
|
|
959
1064
|
insertIntoHeap(i, e);
|
|
960
1065
|
}
|
|
961
1066
|
t = true;
|
|
962
1067
|
}
|
|
963
|
-
i.
|
|
1068
|
+
i.Ge = false;
|
|
964
1069
|
}
|
|
965
1070
|
forEachDependent(i, settle);
|
|
966
1071
|
};
|
|
@@ -968,46 +1073,52 @@ function settlePendingSource(e) {
|
|
|
968
1073
|
if (t) schedule();
|
|
969
1074
|
}
|
|
970
1075
|
function handleAsync(e, t, n) {
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1076
|
+
let i = false;
|
|
1077
|
+
let r = false;
|
|
1078
|
+
if (typeof t === "object" && t !== null) {
|
|
1079
|
+
untrack(() => {
|
|
1080
|
+
i = t[Symbol.asyncIterator];
|
|
1081
|
+
r = !i && typeof t.then === "function";
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
if (!r && !i) {
|
|
1085
|
+
e.ve = null;
|
|
976
1086
|
return t;
|
|
977
1087
|
}
|
|
978
|
-
e.
|
|
979
|
-
let
|
|
1088
|
+
e.ve = t;
|
|
1089
|
+
let s;
|
|
980
1090
|
const handleError = n => {
|
|
981
|
-
if (e.
|
|
1091
|
+
if (e.ve !== t) return;
|
|
982
1092
|
globalQueue.initTransition(resolveTransition(e));
|
|
983
1093
|
notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
|
|
984
|
-
e.
|
|
1094
|
+
e.Ie = clock;
|
|
985
1095
|
};
|
|
986
1096
|
const asyncWrite = (i, r) => {
|
|
987
|
-
if (e.
|
|
988
|
-
if (e.
|
|
1097
|
+
if (e.ve !== t) return;
|
|
1098
|
+
if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
989
1099
|
globalQueue.initTransition(resolveTransition(e));
|
|
990
|
-
const s = !!(e.
|
|
1100
|
+
const s = !!(e.he & STATUS_UNINITIALIZED);
|
|
1101
|
+
trimStaleDeps(e);
|
|
991
1102
|
clearStatus(e);
|
|
992
1103
|
const o = resolveLane(e);
|
|
993
|
-
if (o) o.
|
|
1104
|
+
if (o) o.k.delete(e);
|
|
994
1105
|
if (n) n(i);
|
|
995
|
-
else if (e.
|
|
996
|
-
if (e.
|
|
1106
|
+
else if (e.K !== undefined) {
|
|
1107
|
+
if (e.K !== undefined && e.K !== NOT_PENDING) e.B = i;
|
|
997
1108
|
else {
|
|
998
|
-
e.
|
|
1109
|
+
e.ue = i;
|
|
999
1110
|
insertSubs(e);
|
|
1000
1111
|
}
|
|
1001
|
-
e.
|
|
1112
|
+
e.Ie = clock;
|
|
1002
1113
|
} else if (o) {
|
|
1003
|
-
const t = e.
|
|
1004
|
-
const n = e.
|
|
1005
|
-
const r = e.
|
|
1114
|
+
const t = e.J;
|
|
1115
|
+
const n = e.ue;
|
|
1116
|
+
const r = e.Fe;
|
|
1006
1117
|
if ((!t && s) || !r || !r(i, n)) {
|
|
1007
|
-
e.
|
|
1008
|
-
e.
|
|
1009
|
-
if (e.
|
|
1010
|
-
setSignal(e.
|
|
1118
|
+
e.ue = i;
|
|
1119
|
+
e.Ie = clock;
|
|
1120
|
+
if (e.ke) {
|
|
1121
|
+
setSignal(e.ke, i);
|
|
1011
1122
|
}
|
|
1012
1123
|
insertSubs(e, true);
|
|
1013
1124
|
}
|
|
@@ -1019,13 +1130,13 @@ function handleAsync(e, t, n) {
|
|
|
1019
1130
|
flush();
|
|
1020
1131
|
r?.();
|
|
1021
1132
|
};
|
|
1022
|
-
if (
|
|
1133
|
+
if (r) {
|
|
1023
1134
|
let n = false,
|
|
1024
1135
|
i = true;
|
|
1025
1136
|
t.then(
|
|
1026
1137
|
e => {
|
|
1027
1138
|
if (i) {
|
|
1028
|
-
|
|
1139
|
+
s = e;
|
|
1029
1140
|
n = true;
|
|
1030
1141
|
} else asyncWrite(e);
|
|
1031
1142
|
},
|
|
@@ -1039,7 +1150,7 @@ function handleAsync(e, t, n) {
|
|
|
1039
1150
|
throw new NotReadyError(context);
|
|
1040
1151
|
}
|
|
1041
1152
|
}
|
|
1042
|
-
if (
|
|
1153
|
+
if (i) {
|
|
1043
1154
|
const n = t[Symbol.asyncIterator]();
|
|
1044
1155
|
let i = false;
|
|
1045
1156
|
let r = false;
|
|
@@ -1054,16 +1165,16 @@ function handleAsync(e, t, n) {
|
|
|
1054
1165
|
} catch {}
|
|
1055
1166
|
});
|
|
1056
1167
|
const iterate = () => {
|
|
1057
|
-
let
|
|
1168
|
+
let o,
|
|
1058
1169
|
u = false,
|
|
1059
|
-
|
|
1170
|
+
l = true;
|
|
1060
1171
|
n.next().then(
|
|
1061
1172
|
n => {
|
|
1062
|
-
if (
|
|
1063
|
-
|
|
1173
|
+
if (l) {
|
|
1174
|
+
o = n;
|
|
1064
1175
|
u = true;
|
|
1065
1176
|
if (n.done) r = true;
|
|
1066
|
-
} else if (e.
|
|
1177
|
+
} else if (e.ve !== t) {
|
|
1067
1178
|
return;
|
|
1068
1179
|
} else if (!n.done) asyncWrite(n.value, iterate);
|
|
1069
1180
|
else {
|
|
@@ -1073,79 +1184,79 @@ function handleAsync(e, t, n) {
|
|
|
1073
1184
|
}
|
|
1074
1185
|
},
|
|
1075
1186
|
n => {
|
|
1076
|
-
if (!
|
|
1187
|
+
if (!l && e.ve === t) {
|
|
1077
1188
|
r = true;
|
|
1078
1189
|
handleError(n);
|
|
1079
1190
|
}
|
|
1080
1191
|
}
|
|
1081
1192
|
);
|
|
1082
|
-
|
|
1083
|
-
if (u && !
|
|
1084
|
-
|
|
1193
|
+
l = false;
|
|
1194
|
+
if (u && !o.done) {
|
|
1195
|
+
s = o.value;
|
|
1085
1196
|
i = true;
|
|
1086
1197
|
return iterate();
|
|
1087
1198
|
}
|
|
1088
|
-
return u &&
|
|
1199
|
+
return u && o.done;
|
|
1089
1200
|
};
|
|
1090
|
-
const
|
|
1091
|
-
if (!i && !
|
|
1201
|
+
const o = iterate();
|
|
1202
|
+
if (!i && !o) {
|
|
1092
1203
|
globalQueue.initTransition(resolveTransition(e));
|
|
1093
1204
|
throw new NotReadyError(context);
|
|
1094
1205
|
}
|
|
1095
1206
|
}
|
|
1096
|
-
return
|
|
1207
|
+
return s;
|
|
1097
1208
|
}
|
|
1098
1209
|
function clearStatus(e, t = false) {
|
|
1099
|
-
clearPendingSources(e);
|
|
1100
|
-
e.
|
|
1101
|
-
e.
|
|
1102
|
-
setPendingError(e);
|
|
1103
|
-
updatePendingSignal(e);
|
|
1104
|
-
e.
|
|
1210
|
+
if (e.Ce || e.Pe) clearPendingSources(e);
|
|
1211
|
+
if (e.Ge) e.Ge = false;
|
|
1212
|
+
e.he = t ? 0 : e.he & STATUS_UNINITIALIZED;
|
|
1213
|
+
if (e.Re) setPendingError(e);
|
|
1214
|
+
if (e.We) updatePendingSignal(e);
|
|
1215
|
+
if (e.xe) e.xe();
|
|
1105
1216
|
}
|
|
1106
1217
|
function notifyStatus(e, t, n, i, r) {
|
|
1107
1218
|
if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
|
|
1108
1219
|
n = new StatusError(e, n);
|
|
1109
1220
|
const s = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
|
|
1110
1221
|
const o = s === e;
|
|
1111
|
-
const u = t === STATUS_PENDING && e.
|
|
1112
|
-
const
|
|
1222
|
+
const u = t === STATUS_PENDING && e.K !== undefined && !o;
|
|
1223
|
+
const l = u && hasActiveOverride(e);
|
|
1113
1224
|
if (!i) {
|
|
1114
1225
|
if (t === STATUS_PENDING && s) {
|
|
1115
1226
|
addPendingSource(e, s);
|
|
1116
|
-
e.
|
|
1227
|
+
e.he = STATUS_PENDING | (e.he & STATUS_UNINITIALIZED);
|
|
1117
1228
|
setPendingError(e, s, n);
|
|
1118
1229
|
} else {
|
|
1119
1230
|
clearPendingSources(e);
|
|
1120
|
-
e.
|
|
1121
|
-
e.
|
|
1231
|
+
e.he = t | (t !== STATUS_ERROR ? e.he & STATUS_UNINITIALIZED : 0);
|
|
1232
|
+
e.Re = n;
|
|
1122
1233
|
}
|
|
1123
1234
|
updatePendingSignal(e);
|
|
1124
1235
|
}
|
|
1125
1236
|
if (r && !i) {
|
|
1126
1237
|
assignOrMergeLane(e, r);
|
|
1127
1238
|
}
|
|
1128
|
-
const
|
|
1129
|
-
const
|
|
1130
|
-
if (e.
|
|
1239
|
+
const c = i || l;
|
|
1240
|
+
const a = i || u ? undefined : r;
|
|
1241
|
+
if (e.xe) {
|
|
1131
1242
|
if (i && t === STATUS_PENDING) {
|
|
1132
1243
|
return;
|
|
1133
1244
|
}
|
|
1134
|
-
if (
|
|
1135
|
-
e.
|
|
1245
|
+
if (c) {
|
|
1246
|
+
e.xe(t, n);
|
|
1136
1247
|
} else {
|
|
1137
|
-
e.
|
|
1248
|
+
e.xe();
|
|
1138
1249
|
}
|
|
1139
1250
|
return;
|
|
1140
1251
|
}
|
|
1141
1252
|
forEachDependent(e, e => {
|
|
1142
|
-
e.
|
|
1253
|
+
e.Ie = clock;
|
|
1143
1254
|
if (
|
|
1144
|
-
(t === STATUS_PENDING && s && e.
|
|
1145
|
-
(t !== STATUS_PENDING && (e.
|
|
1255
|
+
(t === STATUS_PENDING && s && e.Ce !== s && !e.Pe?.has(s)) ||
|
|
1256
|
+
(t !== STATUS_PENDING && (e.Re !== n || e.Ce || e.Pe))
|
|
1146
1257
|
) {
|
|
1147
|
-
if (!
|
|
1148
|
-
notifyStatus(e, t, n,
|
|
1258
|
+
if (!c && !e.M) queuePendingNode(e);
|
|
1259
|
+
notifyStatus(e, t, n, c, a);
|
|
1149
1260
|
}
|
|
1150
1261
|
});
|
|
1151
1262
|
}
|
|
@@ -1172,8 +1283,8 @@ function enableExternalSource(e) {
|
|
|
1172
1283
|
externalSourceConfig = { factory: t, untrack: n };
|
|
1173
1284
|
}
|
|
1174
1285
|
}
|
|
1175
|
-
GlobalQueue.
|
|
1176
|
-
GlobalQueue.
|
|
1286
|
+
GlobalQueue.Ee = recompute;
|
|
1287
|
+
GlobalQueue.Se = disposeChildren;
|
|
1177
1288
|
let tracking = false;
|
|
1178
1289
|
let stale = false;
|
|
1179
1290
|
let refreshing = false;
|
|
@@ -1186,7 +1297,7 @@ let snapshotCaptureActive = false;
|
|
|
1186
1297
|
let snapshotSources = null;
|
|
1187
1298
|
function ownerInSnapshotScope(e) {
|
|
1188
1299
|
while (e) {
|
|
1189
|
-
if (e.
|
|
1300
|
+
if (e.He) return true;
|
|
1190
1301
|
e = e.i;
|
|
1191
1302
|
}
|
|
1192
1303
|
return false;
|
|
@@ -1196,38 +1307,38 @@ function setSnapshotCapture(e) {
|
|
|
1196
1307
|
if (e && !snapshotSources) snapshotSources = new Set();
|
|
1197
1308
|
}
|
|
1198
1309
|
function markSnapshotScope(e) {
|
|
1199
|
-
e.
|
|
1310
|
+
e.He = true;
|
|
1200
1311
|
}
|
|
1201
1312
|
function releaseSnapshotScope(e) {
|
|
1202
|
-
e.
|
|
1313
|
+
e.He = false;
|
|
1203
1314
|
releaseSubtree(e);
|
|
1204
1315
|
schedule();
|
|
1205
1316
|
}
|
|
1206
1317
|
function releaseSubtree(e) {
|
|
1207
|
-
let t = e.
|
|
1318
|
+
let t = e.ge;
|
|
1208
1319
|
while (t) {
|
|
1209
|
-
if (t.
|
|
1210
|
-
t = t.
|
|
1320
|
+
if (t.He) {
|
|
1321
|
+
t = t.De;
|
|
1211
1322
|
continue;
|
|
1212
1323
|
}
|
|
1213
1324
|
if (t.L) {
|
|
1214
1325
|
const e = t;
|
|
1215
|
-
e.
|
|
1216
|
-
if (e.
|
|
1217
|
-
e.
|
|
1218
|
-
e.
|
|
1219
|
-
if (dirtyQueue.
|
|
1326
|
+
e._e &= ~CONFIG_IN_SNAPSHOT_SCOPE;
|
|
1327
|
+
if (e._ & REACTIVE_SNAPSHOT_STALE) {
|
|
1328
|
+
e._ &= ~REACTIVE_SNAPSHOT_STALE;
|
|
1329
|
+
e._ |= REACTIVE_DIRTY;
|
|
1330
|
+
if (dirtyQueue.C > e.o) dirtyQueue.C = e.o;
|
|
1220
1331
|
insertIntoHeap(e, dirtyQueue);
|
|
1221
1332
|
}
|
|
1222
1333
|
}
|
|
1223
1334
|
releaseSubtree(t);
|
|
1224
|
-
t = t.
|
|
1335
|
+
t = t.De;
|
|
1225
1336
|
}
|
|
1226
1337
|
}
|
|
1227
1338
|
function clearSnapshots() {
|
|
1228
1339
|
if (snapshotSources) {
|
|
1229
1340
|
for (const e of snapshotSources) {
|
|
1230
|
-
delete e.
|
|
1341
|
+
delete e.pe;
|
|
1231
1342
|
delete e[STORE_SNAPSHOT_PROPS];
|
|
1232
1343
|
}
|
|
1233
1344
|
snapshotSources = null;
|
|
@@ -1235,236 +1346,307 @@ function clearSnapshots() {
|
|
|
1235
1346
|
snapshotCaptureActive = false;
|
|
1236
1347
|
}
|
|
1237
1348
|
function recompute(e, t = false) {
|
|
1238
|
-
const n = e.
|
|
1349
|
+
const n = e.J;
|
|
1239
1350
|
if (!t) {
|
|
1240
|
-
if (e.
|
|
1241
|
-
globalQueue.initTransition(e.
|
|
1242
|
-
deleteFromHeap(e, e.
|
|
1243
|
-
e.
|
|
1244
|
-
if (e.
|
|
1245
|
-
else {
|
|
1351
|
+
if (e.M && (!n || activeTransition) && activeTransition !== e.M)
|
|
1352
|
+
globalQueue.initTransition(e.M);
|
|
1353
|
+
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1354
|
+
e.ve = null;
|
|
1355
|
+
if (e.M || n === EFFECT_TRACKED) disposeChildren(e);
|
|
1356
|
+
else if (e.ge !== null || e.we !== null) {
|
|
1246
1357
|
markDisposal(e);
|
|
1247
|
-
e.
|
|
1248
|
-
e.
|
|
1358
|
+
e.Ae = e.we;
|
|
1359
|
+
e.Ne = e.ge;
|
|
1249
1360
|
e.we = null;
|
|
1250
|
-
e.
|
|
1251
|
-
e.
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
let i = !!(e.
|
|
1255
|
-
const r = e.
|
|
1256
|
-
const s = !!(e.
|
|
1257
|
-
const o = !!(e.
|
|
1361
|
+
e.ge = null;
|
|
1362
|
+
e.me = 0;
|
|
1363
|
+
} else;
|
|
1364
|
+
}
|
|
1365
|
+
let i = !!(e._ & REACTIVE_OPTIMISTIC_DIRTY);
|
|
1366
|
+
const r = e.K !== undefined && e.K !== NOT_PENDING;
|
|
1367
|
+
const s = !!(e.he & STATUS_PENDING);
|
|
1368
|
+
const o = !!(e.he & STATUS_UNINITIALIZED);
|
|
1258
1369
|
const u = context;
|
|
1259
1370
|
context = e;
|
|
1260
|
-
e.
|
|
1261
|
-
e.
|
|
1262
|
-
e.
|
|
1263
|
-
let
|
|
1264
|
-
let
|
|
1265
|
-
let
|
|
1371
|
+
e.ye = null;
|
|
1372
|
+
e._ = REACTIVE_RECOMPUTING_DEPS;
|
|
1373
|
+
e.Ie = clock;
|
|
1374
|
+
let l = e.B === NOT_PENDING ? e.ue : e.B;
|
|
1375
|
+
let c = e.o;
|
|
1376
|
+
let a = tracking;
|
|
1266
1377
|
let f = currentOptimisticLane;
|
|
1267
1378
|
tracking = true;
|
|
1268
1379
|
if (i) {
|
|
1269
1380
|
const t = resolveLane(e);
|
|
1270
1381
|
if (t) currentOptimisticLane = t;
|
|
1271
|
-
} else if (activeTransition && !t && activeTransition.
|
|
1272
|
-
for (let t = e.
|
|
1382
|
+
} else if (activeTransition && !t && activeTransition.Z.length) {
|
|
1383
|
+
for (let t = e.P; t; t = t.D) {
|
|
1273
1384
|
const n = t.m;
|
|
1274
|
-
if (n.
|
|
1385
|
+
if (n._ & REACTIVE_OPTIMISTIC_DIRTY) {
|
|
1275
1386
|
const t = resolveLane(n);
|
|
1276
1387
|
if (t) {
|
|
1277
1388
|
i = true;
|
|
1278
1389
|
currentOptimisticLane = t;
|
|
1279
|
-
e.
|
|
1390
|
+
e._ |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
1280
1391
|
assignOrMergeLane(e, t);
|
|
1281
1392
|
break;
|
|
1282
1393
|
}
|
|
1283
1394
|
}
|
|
1284
1395
|
}
|
|
1285
1396
|
}
|
|
1397
|
+
const E = n && n !== EFFECT_USER;
|
|
1398
|
+
const S = stale;
|
|
1399
|
+
if (E) stale = true;
|
|
1286
1400
|
try {
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1401
|
+
if (!false && e._e & CONFIG_SYNC) {
|
|
1402
|
+
l = e.L(l);
|
|
1403
|
+
e.ve = null;
|
|
1404
|
+
} else {
|
|
1405
|
+
const t = e.ve;
|
|
1406
|
+
const n = e.L(l);
|
|
1407
|
+
const i = typeof n === "object" && n !== null;
|
|
1408
|
+
const r = e.ve !== t;
|
|
1409
|
+
l = r || !i ? n : handleAsync(e, n);
|
|
1410
|
+
if (!r && !i) e.ve = null;
|
|
1411
|
+
}
|
|
1290
1412
|
clearStatus(e, t);
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1413
|
+
if (e.G) {
|
|
1414
|
+
const t = resolveLane(e);
|
|
1415
|
+
if (t) {
|
|
1416
|
+
t.k.delete(e);
|
|
1417
|
+
updatePendingSignal(t.F);
|
|
1418
|
+
}
|
|
1295
1419
|
}
|
|
1296
1420
|
} catch (t) {
|
|
1297
1421
|
if (t instanceof NotReadyError && currentOptimisticLane) {
|
|
1298
1422
|
const t = findLane(currentOptimisticLane);
|
|
1299
|
-
if (t.
|
|
1300
|
-
t.
|
|
1301
|
-
e.
|
|
1302
|
-
updatePendingSignal(t.
|
|
1423
|
+
if (t.F !== e) {
|
|
1424
|
+
t.k.add(e);
|
|
1425
|
+
e.G = t;
|
|
1426
|
+
updatePendingSignal(t.F);
|
|
1303
1427
|
}
|
|
1304
1428
|
}
|
|
1305
|
-
if (t instanceof NotReadyError) e.
|
|
1429
|
+
if (t instanceof NotReadyError) e.Ge = true;
|
|
1306
1430
|
notifyStatus(
|
|
1307
1431
|
e,
|
|
1308
1432
|
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
1309
1433
|
t,
|
|
1310
1434
|
undefined,
|
|
1311
|
-
t instanceof NotReadyError ? e.
|
|
1435
|
+
t instanceof NotReadyError ? e.G : undefined
|
|
1312
1436
|
);
|
|
1313
1437
|
} finally {
|
|
1314
|
-
tracking =
|
|
1315
|
-
|
|
1438
|
+
tracking = a;
|
|
1439
|
+
if (E) stale = S;
|
|
1440
|
+
e._ = REACTIVE_NONE | (t ? e._ & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1316
1441
|
context = u;
|
|
1317
1442
|
}
|
|
1318
|
-
if (!e.
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
if (E) {
|
|
1331
|
-
const o = r ? e.G : undefined;
|
|
1332
|
-
if (t || (n && activeTransition !== e.Z) || i) {
|
|
1333
|
-
e.ne = c;
|
|
1443
|
+
if (!e.Re) {
|
|
1444
|
+
trimStaleDeps(e);
|
|
1445
|
+
const u = r ? e.K : e.B === NOT_PENDING ? e.ue : e.B;
|
|
1446
|
+
const a = (!n && o) || !e.Fe || !e.Fe(u, l);
|
|
1447
|
+
if (n && a) {
|
|
1448
|
+
e.ee = !e.Re;
|
|
1449
|
+
if (!t) e.te.enqueue(n, GlobalQueue.Te.bind(null, e));
|
|
1450
|
+
}
|
|
1451
|
+
if (a) {
|
|
1452
|
+
const o = r ? e.K : undefined;
|
|
1453
|
+
if (t || (n && activeTransition !== e.M) || i) {
|
|
1454
|
+
e.ue = l;
|
|
1334
1455
|
if (r && i) {
|
|
1335
|
-
e.
|
|
1336
|
-
e.
|
|
1456
|
+
e.K = l;
|
|
1457
|
+
e.B = l;
|
|
1337
1458
|
}
|
|
1338
|
-
} else e.
|
|
1339
|
-
if (r && !i && s && !e
|
|
1340
|
-
if (!r || i || e.
|
|
1459
|
+
} else e.B = l;
|
|
1460
|
+
if (r && !i && s && !e.$) e.K = l;
|
|
1461
|
+
if (!r || i || e.K !== o) insertSubs(e, i || r);
|
|
1341
1462
|
} else if (r) {
|
|
1342
|
-
e.
|
|
1343
|
-
} else if (e.o !=
|
|
1344
|
-
for (let t = e.I; t !== null; t = t.
|
|
1345
|
-
insertIntoHeapHeight(t.
|
|
1463
|
+
e.B = l;
|
|
1464
|
+
} else if (e.o != c) {
|
|
1465
|
+
for (let t = e.I; t !== null; t = t.p) {
|
|
1466
|
+
insertIntoHeapHeight(t.h, t.h._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1346
1467
|
}
|
|
1347
1468
|
}
|
|
1348
1469
|
}
|
|
1349
1470
|
currentOptimisticLane = f;
|
|
1350
|
-
|
|
1351
|
-
|
|
1471
|
+
const T =
|
|
1472
|
+
e.B !== NOT_PENDING ||
|
|
1473
|
+
e.Ne !== null ||
|
|
1474
|
+
e.Ae !== null ||
|
|
1475
|
+
!!(e.he & (STATUS_PENDING | STATUS_UNINITIALIZED));
|
|
1476
|
+
T && (!t || e.he & STATUS_PENDING) && !e.M && !(activeTransition && r) && queuePendingNode(e);
|
|
1477
|
+
e.M && n && activeTransition !== e.M && runInTransition(e.M, () => recompute(e));
|
|
1352
1478
|
}
|
|
1353
1479
|
function updateIfNecessary(e) {
|
|
1354
|
-
if (e.
|
|
1355
|
-
for (let t = e.
|
|
1480
|
+
if (e._ & REACTIVE_CHECK) {
|
|
1481
|
+
for (let t = e.P; t; t = t.D) {
|
|
1356
1482
|
const n = t.m;
|
|
1357
1483
|
const i = n.V || n;
|
|
1358
1484
|
if (i.L) {
|
|
1359
1485
|
updateIfNecessary(i);
|
|
1360
1486
|
}
|
|
1361
|
-
if (e.
|
|
1487
|
+
if (e._ & REACTIVE_DIRTY) {
|
|
1362
1488
|
break;
|
|
1363
1489
|
}
|
|
1364
1490
|
}
|
|
1365
1491
|
}
|
|
1366
|
-
if (e.
|
|
1492
|
+
if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.Re && e.Ie < clock && !e.ve)) {
|
|
1367
1493
|
recompute(e);
|
|
1368
1494
|
}
|
|
1369
|
-
e.
|
|
1495
|
+
e._ = e._ & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
|
|
1370
1496
|
}
|
|
1371
1497
|
function computed(e, t) {
|
|
1372
1498
|
const n = t?.transparent ?? false;
|
|
1373
1499
|
const i = {
|
|
1374
1500
|
id: t?.id ?? (n ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1375
|
-
|
|
1501
|
+
_e:
|
|
1376
1502
|
(n ? CONFIG_TRANSPARENT : 0) |
|
|
1377
1503
|
(t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
|
|
1378
1504
|
(!context || t?.lazy ? CONFIG_AUTO_DISPOSE : 0) |
|
|
1505
|
+
(t?.sync ? CONFIG_SYNC : 0) |
|
|
1379
1506
|
(snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
|
|
1380
|
-
|
|
1381
|
-
|
|
1507
|
+
Fe: t?.equals != null ? t.equals : isEqual,
|
|
1508
|
+
X: t?.unobserved,
|
|
1382
1509
|
we: null,
|
|
1383
|
-
|
|
1510
|
+
te: context?.te ?? globalQueue,
|
|
1384
1511
|
Ve: context?.Ve ?? defaultContext,
|
|
1385
|
-
|
|
1512
|
+
me: 0,
|
|
1386
1513
|
L: e,
|
|
1387
|
-
|
|
1514
|
+
ue: undefined,
|
|
1388
1515
|
o: 0,
|
|
1389
1516
|
N: null,
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1517
|
+
T: undefined,
|
|
1518
|
+
S: null,
|
|
1519
|
+
P: null,
|
|
1520
|
+
ye: null,
|
|
1394
1521
|
I: null,
|
|
1395
|
-
|
|
1522
|
+
Ue: null,
|
|
1396
1523
|
i: context,
|
|
1524
|
+
De: null,
|
|
1525
|
+
be: null,
|
|
1397
1526
|
ge: null,
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1527
|
+
_: t?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
|
|
1528
|
+
he: STATUS_UNINITIALIZED,
|
|
1529
|
+
Ie: clock,
|
|
1530
|
+
B: NOT_PENDING,
|
|
1531
|
+
Ae: null,
|
|
1532
|
+
Ne: null,
|
|
1533
|
+
ve: null,
|
|
1534
|
+
M: null
|
|
1535
|
+
};
|
|
1536
|
+
setupComputedNode(i, t);
|
|
1537
|
+
return i;
|
|
1538
|
+
}
|
|
1539
|
+
function createEffectNode(e, t, n, i, r, s) {
|
|
1540
|
+
const o = s?.transparent ?? false;
|
|
1541
|
+
const u = {
|
|
1542
|
+
id: s?.id ?? (o ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1543
|
+
_e:
|
|
1544
|
+
(o ? CONFIG_TRANSPARENT : 0) |
|
|
1545
|
+
(s?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
|
|
1546
|
+
(s?.sync ? CONFIG_SYNC : 0) |
|
|
1547
|
+
(snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
|
|
1548
|
+
Fe: false,
|
|
1549
|
+
X: s?.unobserved,
|
|
1550
|
+
we: null,
|
|
1551
|
+
te: context?.te ?? globalQueue,
|
|
1552
|
+
Ve: context?.Ve ?? defaultContext,
|
|
1553
|
+
me: 0,
|
|
1554
|
+
L: e,
|
|
1555
|
+
ue: undefined,
|
|
1556
|
+
o: 0,
|
|
1557
|
+
N: null,
|
|
1558
|
+
T: undefined,
|
|
1559
|
+
S: null,
|
|
1560
|
+
P: null,
|
|
1404
1561
|
ye: null,
|
|
1562
|
+
I: null,
|
|
1563
|
+
Ue: null,
|
|
1564
|
+
i: context,
|
|
1405
1565
|
De: null,
|
|
1406
|
-
|
|
1566
|
+
be: null,
|
|
1567
|
+
ge: null,
|
|
1568
|
+
_: REACTIVE_LAZY,
|
|
1569
|
+
he: STATUS_UNINITIALIZED,
|
|
1570
|
+
Ie: clock,
|
|
1571
|
+
B: NOT_PENDING,
|
|
1572
|
+
Ae: null,
|
|
1573
|
+
Ne: null,
|
|
1574
|
+
ve: null,
|
|
1575
|
+
M: null,
|
|
1576
|
+
ee: false,
|
|
1577
|
+
Me: undefined,
|
|
1578
|
+
Qe: t,
|
|
1579
|
+
je: n,
|
|
1580
|
+
$e: undefined,
|
|
1581
|
+
Ke: false,
|
|
1582
|
+
J: i,
|
|
1583
|
+
xe: r
|
|
1407
1584
|
};
|
|
1408
|
-
|
|
1409
|
-
|
|
1585
|
+
setupComputedNode(u, lazyOptions);
|
|
1586
|
+
return u;
|
|
1587
|
+
}
|
|
1588
|
+
const lazyOptions = { lazy: true };
|
|
1589
|
+
function setupComputedNode(e, t) {
|
|
1590
|
+
e.S = e;
|
|
1591
|
+
const n = context?.t ? context.u : context;
|
|
1410
1592
|
if (context) {
|
|
1411
|
-
const
|
|
1412
|
-
if (
|
|
1413
|
-
context.
|
|
1593
|
+
const t = context.ge;
|
|
1594
|
+
if (t === null) {
|
|
1595
|
+
context.ge = e;
|
|
1414
1596
|
} else {
|
|
1415
|
-
|
|
1416
|
-
|
|
1597
|
+
e.De = t;
|
|
1598
|
+
t.be = e;
|
|
1599
|
+
context.ge = e;
|
|
1417
1600
|
}
|
|
1418
1601
|
}
|
|
1419
|
-
if (
|
|
1602
|
+
if (n) e.o = n.o + 1;
|
|
1420
1603
|
if (externalSourceConfig) {
|
|
1421
|
-
const
|
|
1422
|
-
const
|
|
1423
|
-
setSignal(
|
|
1604
|
+
const t = signal(undefined, { equals: false, ownedWrite: true });
|
|
1605
|
+
const n = externalSourceConfig.factory(e.L, () => {
|
|
1606
|
+
setSignal(t, undefined);
|
|
1424
1607
|
});
|
|
1425
|
-
cleanup(() =>
|
|
1426
|
-
|
|
1427
|
-
read(
|
|
1428
|
-
return
|
|
1608
|
+
cleanup(() => n.dispose());
|
|
1609
|
+
e.L = e => {
|
|
1610
|
+
read(t);
|
|
1611
|
+
return n.track(e);
|
|
1429
1612
|
};
|
|
1430
1613
|
}
|
|
1431
|
-
!t?.lazy && recompute(
|
|
1614
|
+
!t?.lazy && recompute(e, true);
|
|
1432
1615
|
if (snapshotCaptureActive && !t?.lazy) {
|
|
1433
|
-
if (!(
|
|
1434
|
-
|
|
1435
|
-
snapshotSources.add(
|
|
1616
|
+
if (!(e.he & STATUS_PENDING)) {
|
|
1617
|
+
e.pe = e.ue === undefined ? NO_SNAPSHOT : e.ue;
|
|
1618
|
+
snapshotSources.add(e);
|
|
1436
1619
|
}
|
|
1437
1620
|
}
|
|
1438
|
-
return i;
|
|
1439
1621
|
}
|
|
1440
1622
|
function signal(e, t, n = null) {
|
|
1441
1623
|
const i = {
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1624
|
+
Fe: t?.equals != null ? t.equals : isEqual,
|
|
1625
|
+
_e: (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) | (t?.Ye ? CONFIG_NO_SNAPSHOT : 0),
|
|
1626
|
+
X: t?.unobserved,
|
|
1627
|
+
ue: e,
|
|
1446
1628
|
I: null,
|
|
1447
|
-
|
|
1448
|
-
|
|
1629
|
+
Ue: null,
|
|
1630
|
+
Ie: clock,
|
|
1449
1631
|
V: n,
|
|
1450
1632
|
A: n?.N || null,
|
|
1451
|
-
|
|
1633
|
+
B: NOT_PENDING
|
|
1452
1634
|
};
|
|
1453
1635
|
n && (n.N = i);
|
|
1454
|
-
if (snapshotCaptureActive && !(i.
|
|
1455
|
-
i.
|
|
1636
|
+
if (snapshotCaptureActive && !(i._e & CONFIG_NO_SNAPSHOT) && !((n?.he ?? 0) & STATUS_PENDING)) {
|
|
1637
|
+
i.pe = e === undefined ? NO_SNAPSHOT : e;
|
|
1456
1638
|
snapshotSources.add(i);
|
|
1457
1639
|
}
|
|
1458
1640
|
return i;
|
|
1459
1641
|
}
|
|
1460
1642
|
function optimisticSignal(e, t) {
|
|
1461
1643
|
const n = signal(e, t);
|
|
1462
|
-
n.
|
|
1644
|
+
n.K = NOT_PENDING;
|
|
1463
1645
|
return n;
|
|
1464
1646
|
}
|
|
1465
1647
|
function optimisticComputed(e, t) {
|
|
1466
1648
|
const n = computed(e, t);
|
|
1467
|
-
n.
|
|
1649
|
+
n.K = NOT_PENDING;
|
|
1468
1650
|
return n;
|
|
1469
1651
|
}
|
|
1470
1652
|
function isEqual(e, t) {
|
|
@@ -1486,7 +1668,7 @@ function read(e) {
|
|
|
1486
1668
|
const t = getLatestValueComputed(e);
|
|
1487
1669
|
const n = latestReadActive;
|
|
1488
1670
|
latestReadActive = false;
|
|
1489
|
-
const i = e.
|
|
1671
|
+
const i = e.K !== undefined && e.K !== NOT_PENDING ? e.K : e.ue;
|
|
1490
1672
|
let r;
|
|
1491
1673
|
try {
|
|
1492
1674
|
r = read(t);
|
|
@@ -1496,11 +1678,11 @@ function read(e) {
|
|
|
1496
1678
|
} finally {
|
|
1497
1679
|
latestReadActive = n;
|
|
1498
1680
|
}
|
|
1499
|
-
if (t.
|
|
1500
|
-
if (stale && currentOptimisticLane && t.
|
|
1501
|
-
const e = findLane(t.
|
|
1681
|
+
if (t.he & STATUS_PENDING) return i;
|
|
1682
|
+
if (stale && currentOptimisticLane && t.G) {
|
|
1683
|
+
const e = findLane(t.G);
|
|
1502
1684
|
const n = findLane(currentOptimisticLane);
|
|
1503
|
-
if (e !== n && e.
|
|
1685
|
+
if (e !== n && e.k.size > 0) {
|
|
1504
1686
|
return i;
|
|
1505
1687
|
}
|
|
1506
1688
|
}
|
|
@@ -1510,8 +1692,8 @@ function read(e) {
|
|
|
1510
1692
|
const t = e.V;
|
|
1511
1693
|
const n = pendingCheckActive;
|
|
1512
1694
|
pendingCheckActive = false;
|
|
1513
|
-
if (t && e.
|
|
1514
|
-
if (e.
|
|
1695
|
+
if (t && e.K !== undefined) {
|
|
1696
|
+
if (e.K !== NOT_PENDING && (t.ve || !!(t.he & STATUS_PENDING))) {
|
|
1515
1697
|
foundPending = true;
|
|
1516
1698
|
}
|
|
1517
1699
|
let n = context;
|
|
@@ -1524,27 +1706,39 @@ function read(e) {
|
|
|
1524
1706
|
if (t && read(getPendingSignal(t))) foundPending = true;
|
|
1525
1707
|
}
|
|
1526
1708
|
pendingCheckActive = n;
|
|
1527
|
-
return e.
|
|
1709
|
+
return e.ue;
|
|
1528
1710
|
}
|
|
1529
1711
|
let t = context;
|
|
1530
1712
|
if (t?.t) t = t.u;
|
|
1531
1713
|
const n = e;
|
|
1532
1714
|
if (typeof n.L === "function") {
|
|
1533
1715
|
const t = e;
|
|
1534
|
-
if (
|
|
1535
|
-
|
|
1536
|
-
t.R &= ~REACTIVE_LAZY;
|
|
1716
|
+
if (t._ & REACTIVE_LAZY) {
|
|
1717
|
+
t._ &= ~REACTIVE_LAZY;
|
|
1537
1718
|
recompute(t, true);
|
|
1538
|
-
} else if (t.
|
|
1719
|
+
} else if (t._ & REACTIVE_DISPOSED) {
|
|
1539
1720
|
recompute(t, true);
|
|
1540
1721
|
}
|
|
1541
1722
|
}
|
|
1542
1723
|
const i = e.V || e;
|
|
1724
|
+
if (
|
|
1725
|
+
!n.L &&
|
|
1726
|
+
i === e &&
|
|
1727
|
+
e.K === undefined &&
|
|
1728
|
+
e.pe === undefined &&
|
|
1729
|
+
activeTransition === null &&
|
|
1730
|
+
currentOptimisticLane === null &&
|
|
1731
|
+
!snapshotCaptureActive &&
|
|
1732
|
+
true
|
|
1733
|
+
) {
|
|
1734
|
+
if (t && tracking) link(e, t);
|
|
1735
|
+
return !t || e.B === NOT_PENDING ? e.ue : e.B;
|
|
1736
|
+
}
|
|
1543
1737
|
if (t && tracking) {
|
|
1544
1738
|
link(e, t);
|
|
1545
1739
|
if (i.L) {
|
|
1546
|
-
const n = e.
|
|
1547
|
-
if (i.o >= (n ? zombieQueue.
|
|
1740
|
+
const n = e._ & REACTIVE_ZOMBIE;
|
|
1741
|
+
if (i.o >= (n ? zombieQueue.C : dirtyQueue.C)) {
|
|
1548
1742
|
markNode(t);
|
|
1549
1743
|
markHeap(n ? zombieQueue : dirtyQueue);
|
|
1550
1744
|
updateIfNecessary(i);
|
|
@@ -1555,71 +1749,71 @@ function read(e) {
|
|
|
1555
1749
|
}
|
|
1556
1750
|
}
|
|
1557
1751
|
}
|
|
1558
|
-
if (i.
|
|
1559
|
-
if (t && !(stale && i.
|
|
1752
|
+
if (i.he & STATUS_PENDING) {
|
|
1753
|
+
if (t && !(stale && i.M && activeTransition !== i.M)) {
|
|
1560
1754
|
if (currentOptimisticLane) {
|
|
1561
|
-
const n = i.
|
|
1755
|
+
const n = i.G;
|
|
1562
1756
|
const r = findLane(currentOptimisticLane);
|
|
1563
1757
|
if (n && findLane(n) === r && !hasActiveOverride(i)) {
|
|
1564
1758
|
if (!tracking && e !== t) link(e, t);
|
|
1565
|
-
throw i.
|
|
1759
|
+
throw i.Re;
|
|
1566
1760
|
}
|
|
1567
1761
|
} else {
|
|
1568
1762
|
if (!tracking && e !== t) link(e, t);
|
|
1569
|
-
throw i.
|
|
1763
|
+
throw i.Re;
|
|
1570
1764
|
}
|
|
1571
|
-
} else if (t && i !== e && i.
|
|
1765
|
+
} else if (t && i !== e && i.he & STATUS_UNINITIALIZED) {
|
|
1572
1766
|
if (!tracking && e !== t) link(e, t);
|
|
1573
|
-
throw i.
|
|
1574
|
-
} else if (!t && i.
|
|
1575
|
-
throw i.
|
|
1767
|
+
throw i.Re;
|
|
1768
|
+
} else if (!t && i.he & STATUS_UNINITIALIZED) {
|
|
1769
|
+
throw i.Re;
|
|
1576
1770
|
}
|
|
1577
1771
|
}
|
|
1578
|
-
if (e.L && e.
|
|
1579
|
-
if (e.
|
|
1772
|
+
if (e.L && e.he & STATUS_ERROR) {
|
|
1773
|
+
if (e.Ie < clock) {
|
|
1580
1774
|
recompute(e);
|
|
1581
1775
|
return read(e);
|
|
1582
|
-
} else throw e.
|
|
1776
|
+
} else throw e.Re;
|
|
1583
1777
|
}
|
|
1584
|
-
if (snapshotCaptureActive && t && t.
|
|
1585
|
-
const n = e.
|
|
1778
|
+
if (snapshotCaptureActive && t && t._e & CONFIG_IN_SNAPSHOT_SCOPE) {
|
|
1779
|
+
const n = e.pe;
|
|
1586
1780
|
if (n !== undefined) {
|
|
1587
1781
|
const i = n === NO_SNAPSHOT ? undefined : n;
|
|
1588
|
-
const r = e.
|
|
1589
|
-
if (r !== i) t.
|
|
1782
|
+
const r = e.B !== NOT_PENDING ? e.B : e.ue;
|
|
1783
|
+
if (r !== i) t._ |= REACTIVE_SNAPSHOT_STALE;
|
|
1590
1784
|
return i;
|
|
1591
1785
|
}
|
|
1592
1786
|
}
|
|
1593
|
-
if (e.
|
|
1594
|
-
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.
|
|
1595
|
-
return e.
|
|
1787
|
+
if (e.K !== undefined && e.K !== NOT_PENDING) {
|
|
1788
|
+
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.ue;
|
|
1789
|
+
return e.K;
|
|
1596
1790
|
}
|
|
1597
1791
|
if (
|
|
1598
1792
|
activeTransition !== null &&
|
|
1599
1793
|
currentOptimisticLane !== null &&
|
|
1600
1794
|
!latestReadActive &&
|
|
1601
|
-
e.
|
|
1795
|
+
e.B !== NOT_PENDING &&
|
|
1602
1796
|
i === e &&
|
|
1603
1797
|
!e.L &&
|
|
1604
1798
|
t
|
|
1605
1799
|
) {
|
|
1606
|
-
activeTransition.
|
|
1607
|
-
return e.
|
|
1800
|
+
activeTransition.oe.add(t);
|
|
1801
|
+
return e.ue;
|
|
1608
1802
|
}
|
|
1609
1803
|
const r =
|
|
1610
1804
|
!t ||
|
|
1611
1805
|
(currentOptimisticLane !== null &&
|
|
1612
|
-
(e.
|
|
1613
|
-
e.
|
|
1614
|
-
(stale && e.
|
|
1615
|
-
? e.
|
|
1616
|
-
: e.
|
|
1806
|
+
(e.K !== undefined || e.G || (i === e && stale) || !!(i.he & STATUS_PENDING))) ||
|
|
1807
|
+
e.B === NOT_PENDING ||
|
|
1808
|
+
(stale && e.M && activeTransition !== e.M)
|
|
1809
|
+
? e.ue
|
|
1810
|
+
: e.B;
|
|
1617
1811
|
if (
|
|
1618
1812
|
!t &&
|
|
1619
1813
|
i === e &&
|
|
1620
1814
|
typeof n.L === "function" &&
|
|
1621
|
-
e.
|
|
1622
|
-
!(i.
|
|
1815
|
+
e._e & CONFIG_AUTO_DISPOSE &&
|
|
1816
|
+
!(i.he & STATUS_PENDING) &&
|
|
1623
1817
|
!e.I
|
|
1624
1818
|
) {
|
|
1625
1819
|
unobserved(e);
|
|
@@ -1627,12 +1821,12 @@ function read(e) {
|
|
|
1627
1821
|
return r;
|
|
1628
1822
|
}
|
|
1629
1823
|
function setSignal(e, t) {
|
|
1630
|
-
if (e.
|
|
1631
|
-
const n = e.
|
|
1632
|
-
const i = e.
|
|
1633
|
-
const r = n ? (i ? e.
|
|
1824
|
+
if (e.M && activeTransition !== e.M) globalQueue.initTransition(e.M);
|
|
1825
|
+
const n = e.K !== undefined && !projectionWriteActive;
|
|
1826
|
+
const i = e.K !== undefined && e.K !== NOT_PENDING;
|
|
1827
|
+
const r = n ? (i ? e.K : e.ue) : e.B === NOT_PENDING ? e.ue : e.B;
|
|
1634
1828
|
if (typeof t === "function") t = t(r);
|
|
1635
|
-
const s = !e.
|
|
1829
|
+
const s = !e.Fe || !e.Fe(r, t) || !!(e.he & STATUS_UNINITIALIZED);
|
|
1636
1830
|
if (!s) {
|
|
1637
1831
|
if (n && i && e.L) {
|
|
1638
1832
|
insertSubs(e, true);
|
|
@@ -1641,29 +1835,39 @@ function setSignal(e, t) {
|
|
|
1641
1835
|
return t;
|
|
1642
1836
|
}
|
|
1643
1837
|
if (n) {
|
|
1644
|
-
const n = e.
|
|
1838
|
+
const n = e.K === NOT_PENDING;
|
|
1645
1839
|
if (!n) globalQueue.initTransition(resolveTransition(e));
|
|
1646
1840
|
if (n) {
|
|
1647
|
-
e.
|
|
1648
|
-
globalQueue.
|
|
1841
|
+
e.B = e.ue;
|
|
1842
|
+
globalQueue.Z.push(e);
|
|
1649
1843
|
}
|
|
1650
|
-
e
|
|
1844
|
+
e.$ = true;
|
|
1651
1845
|
const i = getOrCreateLane(e);
|
|
1652
|
-
e.
|
|
1653
|
-
e.
|
|
1846
|
+
e.G = i;
|
|
1847
|
+
e.K = t;
|
|
1654
1848
|
} else {
|
|
1655
|
-
if (e.
|
|
1656
|
-
e.
|
|
1849
|
+
if (e.B === NOT_PENDING) queuePendingNode(e);
|
|
1850
|
+
e.B = t;
|
|
1657
1851
|
}
|
|
1658
|
-
updatePendingSignal(e);
|
|
1659
|
-
if (e.
|
|
1660
|
-
setSignal(e.
|
|
1852
|
+
if (e.We) updatePendingSignal(e);
|
|
1853
|
+
if (e.ke) {
|
|
1854
|
+
setSignal(e.ke, t);
|
|
1661
1855
|
}
|
|
1662
|
-
e.
|
|
1856
|
+
e.Ie = clock;
|
|
1663
1857
|
insertSubs(e, n);
|
|
1664
1858
|
schedule();
|
|
1665
1859
|
return t;
|
|
1666
1860
|
}
|
|
1861
|
+
function suppressComputedRecompute(e) {
|
|
1862
|
+
deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1863
|
+
if (!(e._ & REACTIVE_MANUAL_WRITE) && e.B === NOT_PENDING) queuePendingNode(e);
|
|
1864
|
+
e._ = (e._ & -4) | REACTIVE_MANUAL_WRITE;
|
|
1865
|
+
}
|
|
1866
|
+
function setMemo(e, t) {
|
|
1867
|
+
const n = setSignal(e, t);
|
|
1868
|
+
suppressComputedRecompute(e);
|
|
1869
|
+
return n;
|
|
1870
|
+
}
|
|
1667
1871
|
function runWithOwner(e, t) {
|
|
1668
1872
|
const n = context;
|
|
1669
1873
|
const i = tracking;
|
|
@@ -1679,8 +1883,8 @@ function runWithOwner(e, t) {
|
|
|
1679
1883
|
function getPendingSignal(e) {
|
|
1680
1884
|
if (!e.We) {
|
|
1681
1885
|
e.We = optimisticSignal(false, { ownedWrite: true });
|
|
1682
|
-
if (e.
|
|
1683
|
-
e.We.
|
|
1886
|
+
if (e.U) {
|
|
1887
|
+
e.We.U = e;
|
|
1684
1888
|
}
|
|
1685
1889
|
if (computePendingState(e)) setSignal(e.We, true);
|
|
1686
1890
|
}
|
|
@@ -1689,56 +1893,56 @@ function getPendingSignal(e) {
|
|
|
1689
1893
|
function computePendingState(e) {
|
|
1690
1894
|
const t = e;
|
|
1691
1895
|
const n = e.V;
|
|
1692
|
-
if (n && e.
|
|
1693
|
-
return !n.
|
|
1896
|
+
if (n && e.B !== NOT_PENDING) {
|
|
1897
|
+
return !n.ve && !(n.he & STATUS_PENDING);
|
|
1694
1898
|
}
|
|
1695
|
-
if (e.
|
|
1696
|
-
if (t.
|
|
1697
|
-
if (e.
|
|
1698
|
-
const t = e.
|
|
1699
|
-
return !!(t && t.
|
|
1899
|
+
if (e.K !== undefined && e.K !== NOT_PENDING) {
|
|
1900
|
+
if (t.he & STATUS_PENDING && !(t.he & STATUS_UNINITIALIZED)) return true;
|
|
1901
|
+
if (e.U) {
|
|
1902
|
+
const t = e.G ? findLane(e.G) : null;
|
|
1903
|
+
return !!(t && t.k.size > 0);
|
|
1700
1904
|
}
|
|
1701
1905
|
return true;
|
|
1702
1906
|
}
|
|
1703
|
-
if (e.
|
|
1907
|
+
if (e.K !== undefined && e.K === NOT_PENDING && !e.U) {
|
|
1704
1908
|
return false;
|
|
1705
1909
|
}
|
|
1706
|
-
if (e.
|
|
1707
|
-
return !!(t.
|
|
1910
|
+
if (e.B !== NOT_PENDING && !(t.he & STATUS_UNINITIALIZED)) return true;
|
|
1911
|
+
return !!(t.he & STATUS_PENDING && !(t.he & STATUS_UNINITIALIZED));
|
|
1708
1912
|
}
|
|
1709
1913
|
function updatePendingSignal(e) {
|
|
1710
1914
|
if (e.We) {
|
|
1711
1915
|
const t = computePendingState(e);
|
|
1712
1916
|
const n = e.We;
|
|
1713
1917
|
setSignal(n, t);
|
|
1714
|
-
if (!t && n.
|
|
1918
|
+
if (!t && n.G) {
|
|
1715
1919
|
const t = resolveLane(e);
|
|
1716
|
-
if (t && t.
|
|
1717
|
-
const e = findLane(n.
|
|
1920
|
+
if (t && t.k.size > 0) {
|
|
1921
|
+
const e = findLane(n.G);
|
|
1718
1922
|
if (e !== t) {
|
|
1719
1923
|
mergeLanes(t, e);
|
|
1720
1924
|
}
|
|
1721
1925
|
}
|
|
1722
1926
|
signalLanes.delete(n);
|
|
1723
|
-
n.
|
|
1927
|
+
n.G = undefined;
|
|
1724
1928
|
}
|
|
1725
1929
|
}
|
|
1726
1930
|
}
|
|
1727
1931
|
function getLatestValueComputed(e) {
|
|
1728
|
-
if (!e.
|
|
1932
|
+
if (!e.ke) {
|
|
1729
1933
|
const t = latestReadActive;
|
|
1730
1934
|
latestReadActive = false;
|
|
1731
1935
|
const n = pendingCheckActive;
|
|
1732
1936
|
pendingCheckActive = false;
|
|
1733
1937
|
const i = context;
|
|
1734
1938
|
context = null;
|
|
1735
|
-
e.
|
|
1736
|
-
e.
|
|
1939
|
+
e.ke = optimisticComputed(() => read(e));
|
|
1940
|
+
e.ke.U = e;
|
|
1737
1941
|
context = i;
|
|
1738
1942
|
pendingCheckActive = n;
|
|
1739
1943
|
latestReadActive = t;
|
|
1740
1944
|
}
|
|
1741
|
-
return e.
|
|
1945
|
+
return e.ke;
|
|
1742
1946
|
}
|
|
1743
1947
|
function staleValues(e, t = true) {
|
|
1744
1948
|
const n = stale;
|
|
@@ -1777,11 +1981,11 @@ function refresh(e) {
|
|
|
1777
1981
|
let t = refreshing;
|
|
1778
1982
|
refreshing = true;
|
|
1779
1983
|
try {
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1984
|
+
const t = e?.[$REFRESH];
|
|
1985
|
+
if (false && !t);
|
|
1986
|
+
if (t && typeof t.L === "function" && !(t._ & REACTIVE_DISPOSED)) {
|
|
1987
|
+
recompute(t);
|
|
1783
1988
|
}
|
|
1784
|
-
return untrack(e);
|
|
1785
1989
|
} finally {
|
|
1786
1990
|
refreshing = t;
|
|
1787
1991
|
if (!t) {
|
|
@@ -1818,102 +2022,92 @@ function isUndefined(e) {
|
|
|
1818
2022
|
return typeof e === "undefined";
|
|
1819
2023
|
}
|
|
1820
2024
|
function effect(e, t, n, i) {
|
|
1821
|
-
|
|
1822
|
-
const s =
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
try {
|
|
1846
|
-
return o.Me
|
|
1847
|
-
? o.Me(e, () => {
|
|
1848
|
-
o.Qe?.();
|
|
1849
|
-
o.Qe = undefined;
|
|
1850
|
-
})
|
|
1851
|
-
: console.error(e);
|
|
1852
|
-
} catch (t) {
|
|
1853
|
-
e = t;
|
|
1854
|
-
}
|
|
2025
|
+
const r = !!i?.user;
|
|
2026
|
+
const s = createEffectNode(e, t, n, r ? EFFECT_USER : EFFECT_RENDER, notifyEffectStatus, i);
|
|
2027
|
+
recompute(s, true);
|
|
2028
|
+
!i?.defer &&
|
|
2029
|
+
(s.J === EFFECT_USER || i?.schedule
|
|
2030
|
+
? s.te.enqueue(s.J, runEffect.bind(null, s))
|
|
2031
|
+
: runEffect(s));
|
|
2032
|
+
}
|
|
2033
|
+
function notifyEffectStatus(e, t) {
|
|
2034
|
+
const n = e !== undefined ? e : this.he;
|
|
2035
|
+
const i = t !== undefined ? t : this.Re;
|
|
2036
|
+
if (n & STATUS_ERROR) {
|
|
2037
|
+
let e = i;
|
|
2038
|
+
this.te.notify(this, STATUS_PENDING, 0);
|
|
2039
|
+
if (this.J === EFFECT_USER) {
|
|
2040
|
+
try {
|
|
2041
|
+
return this.je
|
|
2042
|
+
? this.je(e, () => {
|
|
2043
|
+
this.$e?.();
|
|
2044
|
+
this.$e = undefined;
|
|
2045
|
+
})
|
|
2046
|
+
: console.error(e);
|
|
2047
|
+
} catch (t) {
|
|
2048
|
+
e = t;
|
|
1855
2049
|
}
|
|
1856
|
-
if (!o.$.notify(o, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1857
|
-
} else if (o.M === EFFECT_RENDER) {
|
|
1858
|
-
o.$.notify(o, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
1859
2050
|
}
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
this.Qe?.();
|
|
1870
|
-
this.Qe = undefined;
|
|
2051
|
+
if (!this.te.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
2052
|
+
} else if (this.J === EFFECT_RENDER) {
|
|
2053
|
+
this.te.notify(this, STATUS_PENDING | STATUS_ERROR, n, i);
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
function runEffect(e) {
|
|
2057
|
+
if (!e.ee || e._ & REACTIVE_DISPOSED) return;
|
|
2058
|
+
e.$e?.();
|
|
2059
|
+
e.$e = undefined;
|
|
1871
2060
|
try {
|
|
1872
|
-
const
|
|
1873
|
-
if (false &&
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
2061
|
+
const t = e.Qe(e.ue, e.Me);
|
|
2062
|
+
if (false && t !== undefined && typeof t !== "function");
|
|
2063
|
+
e.$e = t;
|
|
2064
|
+
if (e.$e && !e.Ke) {
|
|
2065
|
+
e.Ke = true;
|
|
2066
|
+
runWithOwner(e.i, () => cleanup(() => e.$e?.()));
|
|
2067
|
+
}
|
|
2068
|
+
} catch (t) {
|
|
2069
|
+
e.Re = new StatusError(e, t);
|
|
2070
|
+
e.he |= STATUS_ERROR;
|
|
2071
|
+
if (!e.te.notify(e, STATUS_ERROR, STATUS_ERROR)) throw t;
|
|
1879
2072
|
} finally {
|
|
1880
|
-
|
|
1881
|
-
|
|
2073
|
+
e.Me = e.ue;
|
|
2074
|
+
e.ee = false;
|
|
1882
2075
|
}
|
|
1883
2076
|
}
|
|
2077
|
+
GlobalQueue.Te = runEffect;
|
|
1884
2078
|
function trackedEffect(e, t) {
|
|
1885
2079
|
const run = () => {
|
|
1886
|
-
if (!n.
|
|
2080
|
+
if (!n.ee || n._ & REACTIVE_DISPOSED) return;
|
|
1887
2081
|
try {
|
|
1888
|
-
n.
|
|
2082
|
+
n.ee = false;
|
|
1889
2083
|
recompute(n);
|
|
1890
2084
|
} finally {
|
|
1891
2085
|
}
|
|
1892
2086
|
};
|
|
1893
2087
|
const n = computed(
|
|
1894
2088
|
() => {
|
|
1895
|
-
n
|
|
1896
|
-
n
|
|
2089
|
+
n.$e?.();
|
|
2090
|
+
n.$e = undefined;
|
|
1897
2091
|
const t = staleValues(e);
|
|
1898
|
-
n
|
|
2092
|
+
n.$e = t;
|
|
1899
2093
|
},
|
|
1900
2094
|
{ ...t, lazy: true }
|
|
1901
2095
|
);
|
|
1902
|
-
n
|
|
1903
|
-
n.
|
|
1904
|
-
n.
|
|
1905
|
-
n.
|
|
1906
|
-
n.
|
|
1907
|
-
const i = e !== undefined ? e : n.
|
|
2096
|
+
n.$e = undefined;
|
|
2097
|
+
n._e = (n._e & ~CONFIG_AUTO_DISPOSE) | CONFIG_CHILDREN_FORBIDDEN;
|
|
2098
|
+
n.ee = true;
|
|
2099
|
+
n.J = EFFECT_TRACKED;
|
|
2100
|
+
n.xe = (e, t) => {
|
|
2101
|
+
const i = e !== undefined ? e : n.he;
|
|
1908
2102
|
if (i & STATUS_ERROR) {
|
|
1909
|
-
n
|
|
1910
|
-
const e = t !== undefined ? t : n.
|
|
1911
|
-
if (!n
|
|
2103
|
+
n.te.notify(n, STATUS_PENDING, 0);
|
|
2104
|
+
const e = t !== undefined ? t : n.Re;
|
|
2105
|
+
if (!n.te.notify(n, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1912
2106
|
}
|
|
1913
2107
|
};
|
|
1914
|
-
n.
|
|
1915
|
-
n
|
|
1916
|
-
cleanup(() => n
|
|
2108
|
+
n.ne = run;
|
|
2109
|
+
n.te.enqueue(EFFECT_USER, run);
|
|
2110
|
+
cleanup(() => n.$e?.());
|
|
1917
2111
|
}
|
|
1918
2112
|
function restoreTransition(e, t) {
|
|
1919
2113
|
globalQueue.initTransition(e);
|
|
@@ -1927,11 +2121,11 @@ function action(e) {
|
|
|
1927
2121
|
const r = e(...t);
|
|
1928
2122
|
globalQueue.initTransition();
|
|
1929
2123
|
let s = activeTransition;
|
|
1930
|
-
s.
|
|
2124
|
+
s.re.push(r);
|
|
1931
2125
|
const done = (e, t) => {
|
|
1932
2126
|
s = currentTransition(s);
|
|
1933
|
-
const o = s.
|
|
1934
|
-
if (o >= 0) s.
|
|
2127
|
+
const o = s.re.indexOf(r);
|
|
2128
|
+
if (o >= 0) s.re.splice(o, 1);
|
|
1935
2129
|
setActiveTransition(s);
|
|
1936
2130
|
schedule();
|
|
1937
2131
|
t ? i(t) : n(e);
|
|
@@ -1963,13 +2157,15 @@ function onCleanup(e) {
|
|
|
1963
2157
|
return cleanup(e);
|
|
1964
2158
|
}
|
|
1965
2159
|
function accessor(e) {
|
|
1966
|
-
|
|
2160
|
+
const t = read.bind(null, e);
|
|
2161
|
+
t[$REFRESH] = e;
|
|
2162
|
+
return t;
|
|
1967
2163
|
}
|
|
1968
2164
|
function createSignal(e, t) {
|
|
1969
2165
|
if (typeof e === "function") {
|
|
1970
2166
|
const n = computed(e, t);
|
|
1971
|
-
n.
|
|
1972
|
-
return [accessor(n),
|
|
2167
|
+
n._e &= ~CONFIG_AUTO_DISPOSE;
|
|
2168
|
+
return [accessor(n), setMemo.bind(null, n)];
|
|
1973
2169
|
}
|
|
1974
2170
|
const n = signal(e, t);
|
|
1975
2171
|
return [accessor(n), setSignal.bind(null, n)];
|
|
@@ -2025,7 +2221,7 @@ function resolve(e) {
|
|
|
2025
2221
|
function createOptimistic(e, t) {
|
|
2026
2222
|
if (typeof e === "function") {
|
|
2027
2223
|
const n = optimisticComputed(e, t);
|
|
2028
|
-
n.
|
|
2224
|
+
n._e &= ~CONFIG_AUTO_DISPOSE;
|
|
2029
2225
|
return [accessor(n), setSignal.bind(null, n)];
|
|
2030
2226
|
}
|
|
2031
2227
|
const n = optimisticSignal(e, t);
|
|
@@ -2033,7 +2229,7 @@ function createOptimistic(e, t) {
|
|
|
2033
2229
|
}
|
|
2034
2230
|
function onSettled(e) {
|
|
2035
2231
|
const t = getOwner();
|
|
2036
|
-
t && !(t.
|
|
2232
|
+
t && !(t._e & CONFIG_CHILDREN_FORBIDDEN)
|
|
2037
2233
|
? createTrackedEffect(() => untrack(e), undefined)
|
|
2038
2234
|
: globalQueue.enqueue(EFFECT_USER, () => {
|
|
2039
2235
|
const t = e();
|
|
@@ -2043,9 +2239,9 @@ function onSettled(e) {
|
|
|
2043
2239
|
function unwrap(e) {
|
|
2044
2240
|
return e?.[$TARGET]?.[STORE_NODE] ?? e;
|
|
2045
2241
|
}
|
|
2046
|
-
function getOverrideValue(e, t, n, i
|
|
2047
|
-
if (
|
|
2048
|
-
return t &&
|
|
2242
|
+
function getOverrideValue(e, t, n, i) {
|
|
2243
|
+
if (i && n in i) return i[n];
|
|
2244
|
+
return t && n in t ? t[n] : e[n];
|
|
2049
2245
|
}
|
|
2050
2246
|
function getAllKeys(e, t, n) {
|
|
2051
2247
|
const i = getKeys(e, t);
|
|
@@ -2055,114 +2251,225 @@ function getAllKeys(e, t, n) {
|
|
|
2055
2251
|
function applyState(e, t, n) {
|
|
2056
2252
|
const i = t?.[$TARGET];
|
|
2057
2253
|
if (!i) return;
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
i
|
|
2066
|
-
if (
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2254
|
+
if (i[STORE_OVERRIDE] || i[STORE_OPTIMISTIC_OVERRIDE]) {
|
|
2255
|
+
applyStateSlow(e, i, n);
|
|
2256
|
+
} else {
|
|
2257
|
+
applyStateFast(e, i, n);
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
function applyStateFast(e, t, n) {
|
|
2261
|
+
const i = t[STORE_VALUE];
|
|
2262
|
+
if (e === i) return;
|
|
2263
|
+
(t[STORE_LOOKUP] || storeLookup).set(e, t[$PROXY]);
|
|
2264
|
+
t[STORE_VALUE] = e;
|
|
2265
|
+
if (Array.isArray(i)) {
|
|
2266
|
+
let r = false;
|
|
2267
|
+
const s = i.length;
|
|
2268
|
+
if (e.length && s && e[0] && n(e[0]) != null) {
|
|
2269
|
+
let o, u, l, c, a, f, E, S;
|
|
2270
|
+
for (
|
|
2271
|
+
l = 0, c = Math.min(s, e.length);
|
|
2272
|
+
l < c && ((f = i[l]) === e[l] || (f && e[l] && n(f) === n(e[l])));
|
|
2273
|
+
l++
|
|
2274
|
+
) {
|
|
2275
|
+
applyState(e[l], wrap(f, t), n);
|
|
2276
|
+
}
|
|
2277
|
+
const T = new Array(e.length),
|
|
2278
|
+
d = new Map();
|
|
2279
|
+
for (
|
|
2280
|
+
c = s - 1, a = e.length - 1;
|
|
2281
|
+
c >= l && a >= l && ((f = i[c]) === e[a] || (f && e[a] && n(f) === n(e[a])));
|
|
2282
|
+
c--, a--
|
|
2283
|
+
) {
|
|
2284
|
+
T[a] = f;
|
|
2285
|
+
}
|
|
2286
|
+
if (l > a || l > c) {
|
|
2287
|
+
for (u = l; u <= a; u++) {
|
|
2288
|
+
r = true;
|
|
2289
|
+
t[STORE_NODE][u] && setSignal(t[STORE_NODE][u], wrap(e[u], t));
|
|
2290
|
+
}
|
|
2291
|
+
for (; u < e.length; u++) {
|
|
2292
|
+
r = true;
|
|
2293
|
+
const i = wrap(T[u], t);
|
|
2294
|
+
t[STORE_NODE][u] && setSignal(t[STORE_NODE][u], i);
|
|
2295
|
+
applyState(e[u], i, n);
|
|
2296
|
+
}
|
|
2297
|
+
r && t[STORE_NODE][$TRACK] && setSignal(t[STORE_NODE][$TRACK], void 0);
|
|
2298
|
+
s !== e.length && t[STORE_NODE].length && setSignal(t[STORE_NODE].length, e.length);
|
|
2299
|
+
return;
|
|
2300
|
+
}
|
|
2301
|
+
E = new Array(a + 1);
|
|
2302
|
+
for (u = a; u >= l; u--) {
|
|
2303
|
+
f = e[u];
|
|
2304
|
+
S = f ? n(f) : f;
|
|
2305
|
+
o = d.get(S);
|
|
2306
|
+
E[u] = o === undefined ? -1 : o;
|
|
2307
|
+
d.set(S, u);
|
|
2308
|
+
}
|
|
2309
|
+
for (o = l; o <= c; o++) {
|
|
2310
|
+
f = i[o];
|
|
2311
|
+
S = f ? n(f) : f;
|
|
2312
|
+
u = d.get(S);
|
|
2313
|
+
if (u !== undefined && u !== -1) {
|
|
2314
|
+
T[u] = f;
|
|
2315
|
+
u = E[u];
|
|
2316
|
+
d.set(S, u);
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
for (u = l; u < e.length; u++) {
|
|
2320
|
+
if (u in T) {
|
|
2321
|
+
const i = wrap(T[u], t);
|
|
2322
|
+
t[STORE_NODE][u] && setSignal(t[STORE_NODE][u], i);
|
|
2323
|
+
applyState(e[u], i, n);
|
|
2324
|
+
} else t[STORE_NODE][u] && setSignal(t[STORE_NODE][u], wrap(e[u], t));
|
|
2325
|
+
}
|
|
2326
|
+
if (l < e.length) r = true;
|
|
2327
|
+
} else if (e.length) {
|
|
2328
|
+
for (let r = 0, s = e.length; r < s; r++) {
|
|
2329
|
+
const s = i[r];
|
|
2330
|
+
isWrappable(s)
|
|
2331
|
+
? applyState(e[r], wrap(s, t), n)
|
|
2332
|
+
: t[STORE_NODE][r] && setSignal(t[STORE_NODE][r], e[r]);
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
if (s !== e.length) {
|
|
2336
|
+
r = true;
|
|
2337
|
+
t[STORE_NODE].length && setSignal(t[STORE_NODE].length, e.length);
|
|
2338
|
+
}
|
|
2339
|
+
r && t[STORE_NODE][$TRACK] && setSignal(t[STORE_NODE][$TRACK], void 0);
|
|
2340
|
+
return;
|
|
2341
|
+
}
|
|
2342
|
+
let r = t[STORE_NODE];
|
|
2343
|
+
if (r) {
|
|
2344
|
+
const s = r[$TRACK];
|
|
2345
|
+
const o = s ? getAllKeys(i, undefined, e) : Object.keys(r);
|
|
2346
|
+
for (let u = 0, l = o.length; u < l; u++) {
|
|
2347
|
+
const l = o[u];
|
|
2348
|
+
const c = r[l];
|
|
2349
|
+
const a = unwrap(i[l]);
|
|
2350
|
+
let f = unwrap(e[l]);
|
|
2351
|
+
if (a === f) continue;
|
|
2352
|
+
if (!a || !isWrappable(a) || !isWrappable(f) || (n(a) != null && n(a) !== n(f))) {
|
|
2353
|
+
s && setSignal(s, void 0);
|
|
2354
|
+
c && setSignal(c, isWrappable(f) ? wrap(f, t) : f);
|
|
2355
|
+
} else applyState(f, wrap(a, t), n);
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
if ((r = t[STORE_HAS])) {
|
|
2359
|
+
const t = Object.keys(r);
|
|
2360
|
+
for (let n = 0, i = t.length; n < i; n++) {
|
|
2361
|
+
const i = t[n];
|
|
2362
|
+
setSignal(r[i], i in e);
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
function applyStateSlow(e, t, n) {
|
|
2367
|
+
const i = t[STORE_VALUE];
|
|
2368
|
+
const r = t[STORE_OVERRIDE];
|
|
2369
|
+
const s = t[STORE_OPTIMISTIC_OVERRIDE];
|
|
2370
|
+
let o = t[STORE_NODE];
|
|
2371
|
+
(t[STORE_LOOKUP] || storeLookup).set(e, t[$PROXY]);
|
|
2372
|
+
t[STORE_VALUE] = e;
|
|
2373
|
+
t[STORE_OVERRIDE] = undefined;
|
|
2374
|
+
if (Array.isArray(i)) {
|
|
2375
|
+
let o = false;
|
|
2376
|
+
const u = getOverrideValue(i, r, "length", s);
|
|
2377
|
+
if (e.length && u && e[0] && n(e[0]) != null) {
|
|
2378
|
+
let l, c, a, f, E, S, T, d;
|
|
2071
2379
|
for (
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
f++
|
|
2380
|
+
a = 0, f = Math.min(u, e.length);
|
|
2381
|
+
a < f && ((S = getOverrideValue(i, r, a, s)) === e[a] || (S && e[a] && n(S) === n(e[a])));
|
|
2382
|
+
a++
|
|
2076
2383
|
) {
|
|
2077
|
-
applyState(e[
|
|
2384
|
+
applyState(e[a], wrap(S, t), n);
|
|
2078
2385
|
}
|
|
2079
|
-
const
|
|
2386
|
+
const O = new Array(e.length),
|
|
2080
2387
|
_ = new Map();
|
|
2081
2388
|
for (
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
((S = getOverrideValue(
|
|
2086
|
-
|
|
2389
|
+
f = u - 1, E = e.length - 1;
|
|
2390
|
+
f >= a &&
|
|
2391
|
+
E >= a &&
|
|
2392
|
+
((S = getOverrideValue(i, r, f, s)) === e[E] || (S && e[E] && n(S) === n(e[E])));
|
|
2393
|
+
f--, E--
|
|
2087
2394
|
) {
|
|
2088
|
-
|
|
2395
|
+
O[E] = S;
|
|
2089
2396
|
}
|
|
2090
|
-
if (
|
|
2091
|
-
for (
|
|
2092
|
-
|
|
2093
|
-
|
|
2397
|
+
if (a > E || a > f) {
|
|
2398
|
+
for (c = a; c <= E; c++) {
|
|
2399
|
+
o = true;
|
|
2400
|
+
t[STORE_NODE][c] && setSignal(t[STORE_NODE][c], wrap(e[c], t));
|
|
2094
2401
|
}
|
|
2095
|
-
for (;
|
|
2096
|
-
|
|
2097
|
-
const
|
|
2098
|
-
|
|
2099
|
-
applyState(e[
|
|
2402
|
+
for (; c < e.length; c++) {
|
|
2403
|
+
o = true;
|
|
2404
|
+
const i = wrap(O[c], t);
|
|
2405
|
+
t[STORE_NODE][c] && setSignal(t[STORE_NODE][c], i);
|
|
2406
|
+
applyState(e[c], i, n);
|
|
2100
2407
|
}
|
|
2101
|
-
|
|
2102
|
-
|
|
2408
|
+
o && t[STORE_NODE][$TRACK] && setSignal(t[STORE_NODE][$TRACK], void 0);
|
|
2409
|
+
u !== e.length && t[STORE_NODE].length && setSignal(t[STORE_NODE].length, e.length);
|
|
2103
2410
|
return;
|
|
2104
2411
|
}
|
|
2105
|
-
|
|
2106
|
-
for (
|
|
2107
|
-
S = e[
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
_.set(
|
|
2112
|
-
}
|
|
2113
|
-
for (
|
|
2114
|
-
S = getOverrideValue(
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
if (
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
_.set(
|
|
2412
|
+
T = new Array(E + 1);
|
|
2413
|
+
for (c = E; c >= a; c--) {
|
|
2414
|
+
S = e[c];
|
|
2415
|
+
d = S ? n(S) : S;
|
|
2416
|
+
l = _.get(d);
|
|
2417
|
+
T[c] = l === undefined ? -1 : l;
|
|
2418
|
+
_.set(d, c);
|
|
2419
|
+
}
|
|
2420
|
+
for (l = a; l <= f; l++) {
|
|
2421
|
+
S = getOverrideValue(i, r, l, s);
|
|
2422
|
+
d = S ? n(S) : S;
|
|
2423
|
+
c = _.get(d);
|
|
2424
|
+
if (c !== undefined && c !== -1) {
|
|
2425
|
+
O[c] = S;
|
|
2426
|
+
c = T[c];
|
|
2427
|
+
_.set(d, c);
|
|
2121
2428
|
}
|
|
2122
2429
|
}
|
|
2123
|
-
for (
|
|
2124
|
-
if (
|
|
2125
|
-
const
|
|
2126
|
-
|
|
2127
|
-
applyState(e[
|
|
2128
|
-
} else
|
|
2430
|
+
for (c = a; c < e.length; c++) {
|
|
2431
|
+
if (c in O) {
|
|
2432
|
+
const i = wrap(O[c], t);
|
|
2433
|
+
t[STORE_NODE][c] && setSignal(t[STORE_NODE][c], i);
|
|
2434
|
+
applyState(e[c], i, n);
|
|
2435
|
+
} else t[STORE_NODE][c] && setSignal(t[STORE_NODE][c], wrap(e[c], t));
|
|
2129
2436
|
}
|
|
2130
|
-
if (
|
|
2437
|
+
if (a < e.length) o = true;
|
|
2131
2438
|
} else if (e.length) {
|
|
2132
|
-
for (let
|
|
2133
|
-
const
|
|
2134
|
-
isWrappable(
|
|
2135
|
-
? applyState(e[
|
|
2136
|
-
:
|
|
2439
|
+
for (let o = 0, u = e.length; o < u; o++) {
|
|
2440
|
+
const u = getOverrideValue(i, r, o, s);
|
|
2441
|
+
isWrappable(u)
|
|
2442
|
+
? applyState(e[o], wrap(u, t), n)
|
|
2443
|
+
: t[STORE_NODE][o] && setSignal(t[STORE_NODE][o], e[o]);
|
|
2137
2444
|
}
|
|
2138
2445
|
}
|
|
2139
|
-
if (
|
|
2140
|
-
|
|
2141
|
-
|
|
2446
|
+
if (u !== e.length) {
|
|
2447
|
+
o = true;
|
|
2448
|
+
t[STORE_NODE].length && setSignal(t[STORE_NODE].length, e.length);
|
|
2142
2449
|
}
|
|
2143
|
-
|
|
2450
|
+
o && t[STORE_NODE][$TRACK] && setSignal(t[STORE_NODE][$TRACK], void 0);
|
|
2144
2451
|
return;
|
|
2145
2452
|
}
|
|
2146
|
-
if (
|
|
2147
|
-
const
|
|
2148
|
-
const
|
|
2149
|
-
for (let
|
|
2150
|
-
const
|
|
2151
|
-
const f =
|
|
2152
|
-
const E = unwrap(getOverrideValue(
|
|
2153
|
-
let
|
|
2154
|
-
if (E ===
|
|
2155
|
-
if (!E || !isWrappable(E) || !isWrappable(
|
|
2156
|
-
|
|
2157
|
-
f && setSignal(f, isWrappable(
|
|
2158
|
-
} else applyState(
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
if ((
|
|
2162
|
-
const t = Object.keys(
|
|
2453
|
+
if (o) {
|
|
2454
|
+
const u = o[$TRACK];
|
|
2455
|
+
const l = u ? getAllKeys(i, r, e) : Object.keys(o);
|
|
2456
|
+
for (let c = 0, a = l.length; c < a; c++) {
|
|
2457
|
+
const a = l[c];
|
|
2458
|
+
const f = o[a];
|
|
2459
|
+
const E = unwrap(getOverrideValue(i, r, a, s));
|
|
2460
|
+
let S = unwrap(e[a]);
|
|
2461
|
+
if (E === S) continue;
|
|
2462
|
+
if (!E || !isWrappable(E) || !isWrappable(S) || (n(E) != null && n(E) !== n(S))) {
|
|
2463
|
+
u && setSignal(u, void 0);
|
|
2464
|
+
f && setSignal(f, isWrappable(S) ? wrap(S, t) : S);
|
|
2465
|
+
} else applyState(S, wrap(E, t), n);
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
if ((o = t[STORE_HAS])) {
|
|
2469
|
+
const t = Object.keys(o);
|
|
2163
2470
|
for (let n = 0, i = t.length; n < i; n++) {
|
|
2164
2471
|
const i = t[n];
|
|
2165
|
-
setSignal(
|
|
2472
|
+
setSignal(o[i], i in e);
|
|
2166
2473
|
}
|
|
2167
2474
|
}
|
|
2168
2475
|
}
|
|
@@ -2201,7 +2508,7 @@ function createProjectionInternal(e, t, n) {
|
|
|
2201
2508
|
if (!i) i = getOwner();
|
|
2202
2509
|
runProjectionComputed(s, e, n?.key || "id");
|
|
2203
2510
|
}, undefined);
|
|
2204
|
-
i.
|
|
2511
|
+
i._e &= ~CONFIG_AUTO_DISPOSE;
|
|
2205
2512
|
return { store: s, node: i };
|
|
2206
2513
|
}
|
|
2207
2514
|
function createProjection(e, t, n) {
|
|
@@ -2213,7 +2520,7 @@ function runProjectionComputed(e, t, n, i) {
|
|
|
2213
2520
|
let o;
|
|
2214
2521
|
const u = new Proxy(
|
|
2215
2522
|
e,
|
|
2216
|
-
createWriteTraps(() => !s || r.
|
|
2523
|
+
createWriteTraps(() => !s || r.ve === o)
|
|
2217
2524
|
);
|
|
2218
2525
|
storeSetter(u, u => {
|
|
2219
2526
|
o = t(u);
|
|
@@ -2299,8 +2606,14 @@ function createStoreProxy(e, t = storeTraps, n) {
|
|
|
2299
2606
|
if (Array.isArray(e)) {
|
|
2300
2607
|
i = [];
|
|
2301
2608
|
i.v = e;
|
|
2302
|
-
} else
|
|
2303
|
-
|
|
2609
|
+
} else {
|
|
2610
|
+
i = { v: e };
|
|
2611
|
+
const t = e?.[$TARGET]?.[STORE_VALUE] ?? e;
|
|
2612
|
+
const n = Object.getPrototypeOf(t);
|
|
2613
|
+
if (n !== null && n !== Object.prototype) {
|
|
2614
|
+
i[STORE_CUSTOM_PROTO] = true;
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2304
2617
|
n && n(i);
|
|
2305
2618
|
return (i[$PROXY] = new Proxy(i, t));
|
|
2306
2619
|
}
|
|
@@ -2312,12 +2625,8 @@ function wrap(e, t) {
|
|
|
2312
2625
|
return n;
|
|
2313
2626
|
}
|
|
2314
2627
|
function isWrappable(e) {
|
|
2315
|
-
return
|
|
2316
|
-
|
|
2317
|
-
typeof e === "object" &&
|
|
2318
|
-
!Object.isFrozen(e) &&
|
|
2319
|
-
!(typeof Node !== "undefined" && e instanceof Node)
|
|
2320
|
-
);
|
|
2628
|
+
if (e == null || typeof e !== "object" || Object.isFrozen(e)) return false;
|
|
2629
|
+
return typeof Node === "undefined" || !(e instanceof Node);
|
|
2321
2630
|
}
|
|
2322
2631
|
let writeOverride = false;
|
|
2323
2632
|
function setWriteOverride(e) {
|
|
@@ -2329,11 +2638,6 @@ function writeOnly(e) {
|
|
|
2329
2638
|
function unwrapStoreValue(e) {
|
|
2330
2639
|
return e?.[$TARGET]?.[STORE_VALUE] ?? e;
|
|
2331
2640
|
}
|
|
2332
|
-
function hasCustomPrototype(e) {
|
|
2333
|
-
if (Array.isArray(e)) return false;
|
|
2334
|
-
const t = Object.getPrototypeOf(e);
|
|
2335
|
-
return t !== null && t !== Object.prototype;
|
|
2336
|
-
}
|
|
2337
2641
|
function hasInheritedAccessor(e, t) {
|
|
2338
2642
|
let n = Object.getPrototypeOf(e);
|
|
2339
2643
|
while (n && n !== Object.prototype) {
|
|
@@ -2361,11 +2665,11 @@ function getNode(e, t, n, i, r = isEqual, s, o) {
|
|
|
2361
2665
|
i
|
|
2362
2666
|
);
|
|
2363
2667
|
if (s) {
|
|
2364
|
-
u.
|
|
2668
|
+
u.K = NOT_PENDING;
|
|
2365
2669
|
}
|
|
2366
2670
|
if (o && t in o) {
|
|
2367
2671
|
const e = o[t];
|
|
2368
|
-
u.
|
|
2672
|
+
u.pe = e === undefined ? NO_SNAPSHOT : e;
|
|
2369
2673
|
snapshotSources?.add(u);
|
|
2370
2674
|
}
|
|
2371
2675
|
return (e[t] = u);
|
|
@@ -2398,8 +2702,8 @@ function getPropertyDescriptor(e, t, n) {
|
|
|
2398
2702
|
function prepareStoreWrite(e, t, n) {
|
|
2399
2703
|
if (e[STORE_OPTIMISTIC]) {
|
|
2400
2704
|
const t = e[STORE_FIREWALL];
|
|
2401
|
-
if (t?.
|
|
2402
|
-
globalQueue.initTransition(t.
|
|
2705
|
+
if (t?.M) {
|
|
2706
|
+
globalQueue.initTransition(t.M);
|
|
2403
2707
|
}
|
|
2404
2708
|
}
|
|
2405
2709
|
const i = e[STORE_VALUE];
|
|
@@ -2407,7 +2711,7 @@ function prepareStoreWrite(e, t, n) {
|
|
|
2407
2711
|
if (
|
|
2408
2712
|
snapshotCaptureActive &&
|
|
2409
2713
|
typeof n !== "symbol" &&
|
|
2410
|
-
!((e[STORE_FIREWALL]?.
|
|
2714
|
+
!((e[STORE_FIREWALL]?.he ?? 0) & STATUS_PENDING)
|
|
2411
2715
|
) {
|
|
2412
2716
|
if (!e[STORE_SNAPSHOT_PROPS]) {
|
|
2413
2717
|
e[STORE_SNAPSHOT_PROPS] = Object.create(null);
|
|
@@ -2432,35 +2736,35 @@ function upsertStoreNode(e, t, n, i, r) {
|
|
|
2432
2736
|
function notifyStoreProperty(e, t, n, i, r, s) {
|
|
2433
2737
|
const o = projectionWriteActive || e[STORE_OPTIMISTIC];
|
|
2434
2738
|
const u = n !== "delete";
|
|
2435
|
-
const
|
|
2436
|
-
if (
|
|
2437
|
-
setSignal(
|
|
2739
|
+
const l = e[STORE_HAS]?.[t];
|
|
2740
|
+
if (l) {
|
|
2741
|
+
setSignal(l, u);
|
|
2438
2742
|
} else if (!o && n !== "invalidate" && s !== u) {
|
|
2439
2743
|
const n = upsertStoreNode(e, getNodes(e, STORE_HAS), t, s);
|
|
2440
2744
|
setSignal(n, u);
|
|
2441
2745
|
}
|
|
2442
|
-
const
|
|
2746
|
+
const c = getNodes(e, STORE_NODE);
|
|
2443
2747
|
if (n === "set") {
|
|
2444
|
-
if (
|
|
2445
|
-
setSignal(
|
|
2748
|
+
if (c[t]) {
|
|
2749
|
+
setSignal(c[t], () => (isWrappable(i) ? wrap(i, e) : i));
|
|
2446
2750
|
} else if (!o) {
|
|
2447
|
-
const n = upsertStoreNode(e,
|
|
2751
|
+
const n = upsertStoreNode(e, c, t, r, e[STORE_SNAPSHOT_PROPS]);
|
|
2448
2752
|
setSignal(n, () => (isWrappable(i) ? wrap(i, e) : i));
|
|
2449
2753
|
}
|
|
2450
2754
|
} else if (n === "invalidate") {
|
|
2451
|
-
if (
|
|
2452
|
-
setSignal(
|
|
2453
|
-
delete
|
|
2755
|
+
if (c[t]) {
|
|
2756
|
+
setSignal(c[t], {});
|
|
2757
|
+
delete c[t];
|
|
2454
2758
|
}
|
|
2455
2759
|
} else {
|
|
2456
|
-
if (
|
|
2457
|
-
setSignal(
|
|
2760
|
+
if (c[t]) {
|
|
2761
|
+
setSignal(c[t], undefined);
|
|
2458
2762
|
} else if (!o) {
|
|
2459
|
-
const n = upsertStoreNode(e,
|
|
2763
|
+
const n = upsertStoreNode(e, c, t, r, e[STORE_SNAPSHOT_PROPS]);
|
|
2460
2764
|
setSignal(n, undefined);
|
|
2461
2765
|
}
|
|
2462
2766
|
}
|
|
2463
|
-
|
|
2767
|
+
c[$TRACK] && setSignal(c[$TRACK], undefined);
|
|
2464
2768
|
}
|
|
2465
2769
|
let Writing = null;
|
|
2466
2770
|
const storeTraps = {
|
|
@@ -2474,10 +2778,25 @@ const storeTraps = {
|
|
|
2474
2778
|
}
|
|
2475
2779
|
const i = getNodes(e, STORE_NODE);
|
|
2476
2780
|
const r = i[t];
|
|
2477
|
-
const s = e[
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2781
|
+
const s = e[STORE_VALUE];
|
|
2782
|
+
if (
|
|
2783
|
+
!r &&
|
|
2784
|
+
!e[STORE_OVERRIDE] &&
|
|
2785
|
+
!e[STORE_OPTIMISTIC_OVERRIDE] &&
|
|
2786
|
+
!e[STORE_CUSTOM_PROTO] &&
|
|
2787
|
+
!e[STORE_OPTIMISTIC] &&
|
|
2788
|
+
!e[STORE_SNAPSHOT_PROPS] &&
|
|
2789
|
+
!s[$TARGET] &&
|
|
2790
|
+
!(t in s) &&
|
|
2791
|
+
getObserver() &&
|
|
2792
|
+
!writeOnly(n)
|
|
2793
|
+
) {
|
|
2794
|
+
return read(getNode(i, t, undefined, e[STORE_FIREWALL]));
|
|
2795
|
+
}
|
|
2796
|
+
const o = e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE];
|
|
2797
|
+
const u = o || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]);
|
|
2798
|
+
const l = !!e[STORE_VALUE][$TARGET];
|
|
2799
|
+
const c = o
|
|
2481
2800
|
? e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2482
2801
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2483
2802
|
? e[STORE_OVERRIDE]
|
|
@@ -2485,7 +2804,7 @@ const storeTraps = {
|
|
|
2485
2804
|
if (!r) {
|
|
2486
2805
|
const i = Object.getOwnPropertyDescriptor(c, t);
|
|
2487
2806
|
if (i && i.get) return i.get.call(n);
|
|
2488
|
-
if (!i && !
|
|
2807
|
+
if (!i && !u && e[STORE_CUSTOM_PROTO]) {
|
|
2489
2808
|
const e = unwrapStoreValue(c);
|
|
2490
2809
|
if (hasInheritedAccessor(e, t)) {
|
|
2491
2810
|
return Reflect.get(c, t, n);
|
|
@@ -2494,12 +2813,12 @@ const storeTraps = {
|
|
|
2494
2813
|
}
|
|
2495
2814
|
if (writeOnly(n)) {
|
|
2496
2815
|
let n =
|
|
2497
|
-
r && (
|
|
2498
|
-
? r.
|
|
2499
|
-
? r.
|
|
2500
|
-
: r.
|
|
2501
|
-
? r.
|
|
2502
|
-
: r.
|
|
2816
|
+
r && (u || !l)
|
|
2817
|
+
? r.K !== undefined && r.K !== NOT_PENDING
|
|
2818
|
+
? r.K
|
|
2819
|
+
: r.B !== NOT_PENDING
|
|
2820
|
+
? r.B
|
|
2821
|
+
: r.ue
|
|
2503
2822
|
: c[t];
|
|
2504
2823
|
n === $DELETED && (n = undefined);
|
|
2505
2824
|
if (!isWrappable(n)) return n;
|
|
@@ -2507,10 +2826,10 @@ const storeTraps = {
|
|
|
2507
2826
|
Writing?.add(i);
|
|
2508
2827
|
return i;
|
|
2509
2828
|
}
|
|
2510
|
-
let a = r ? (
|
|
2829
|
+
let a = r ? (u || !l ? read(i[t]) : (read(i[t]), c[t])) : c[t];
|
|
2511
2830
|
a === $DELETED && (a = undefined);
|
|
2512
2831
|
if (!r) {
|
|
2513
|
-
if (!
|
|
2832
|
+
if (!u && typeof a === "function" && !c.hasOwnProperty(t)) {
|
|
2514
2833
|
let t;
|
|
2515
2834
|
return !Array.isArray(e[STORE_VALUE]) &&
|
|
2516
2835
|
(t = Object.getPrototypeOf(e[STORE_VALUE])) &&
|
|
@@ -2560,38 +2879,38 @@ const storeTraps = {
|
|
|
2560
2879
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2561
2880
|
? e[STORE_OVERRIDE][t]
|
|
2562
2881
|
: r;
|
|
2563
|
-
const
|
|
2882
|
+
const l =
|
|
2564
2883
|
e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2565
2884
|
? e[STORE_OPTIMISTIC_OVERRIDE][t] !== $DELETED
|
|
2566
2885
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2567
2886
|
? e[STORE_OVERRIDE][t] !== $DELETED
|
|
2568
2887
|
: t in e[STORE_VALUE];
|
|
2569
|
-
const
|
|
2570
|
-
const
|
|
2571
|
-
const f =
|
|
2888
|
+
const c = unwrapStoreValue(n);
|
|
2889
|
+
const a = Array.isArray(o) && t !== "length";
|
|
2890
|
+
const f = a ? parseInt(t) + 1 : 0;
|
|
2572
2891
|
const E =
|
|
2573
|
-
|
|
2892
|
+
a &&
|
|
2574
2893
|
(e[STORE_OPTIMISTIC_OVERRIDE] && "length" in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2575
2894
|
? e[STORE_OPTIMISTIC_OVERRIDE].length
|
|
2576
2895
|
: e[STORE_OVERRIDE] && "length" in e[STORE_OVERRIDE]
|
|
2577
2896
|
? e[STORE_OVERRIDE].length
|
|
2578
2897
|
: o.length);
|
|
2579
|
-
const
|
|
2580
|
-
if (u ===
|
|
2581
|
-
if (
|
|
2898
|
+
const S = a && f > E ? f : undefined;
|
|
2899
|
+
if (u === c && S === undefined) return true;
|
|
2900
|
+
if (c !== undefined && c === r && S === undefined) delete e[s]?.[t];
|
|
2582
2901
|
else {
|
|
2583
2902
|
const n = e[s] || (e[s] = Object.create(null));
|
|
2584
|
-
n[t] =
|
|
2585
|
-
if (
|
|
2903
|
+
n[t] = c;
|
|
2904
|
+
if (S !== undefined) n.length = S;
|
|
2586
2905
|
}
|
|
2587
|
-
notifyStoreProperty(e, t, "set",
|
|
2588
|
-
if (Array.isArray(o) && t !== "length" &&
|
|
2906
|
+
notifyStoreProperty(e, t, "set", c, u, l);
|
|
2907
|
+
if (Array.isArray(o) && t !== "length" && S !== undefined) {
|
|
2589
2908
|
const t = getNodes(e, STORE_NODE);
|
|
2590
2909
|
if (t.length) {
|
|
2591
|
-
setSignal(t.length,
|
|
2910
|
+
setSignal(t.length, S);
|
|
2592
2911
|
} else if (!projectionWriteActive && !e[STORE_OPTIMISTIC]) {
|
|
2593
2912
|
const n = upsertStoreNode(e, t, "length", E, e[STORE_SNAPSHOT_PROPS]);
|
|
2594
|
-
setSignal(n,
|
|
2913
|
+
setSignal(n, S);
|
|
2595
2914
|
}
|
|
2596
2915
|
}
|
|
2597
2916
|
if (false);
|
|
@@ -2698,10 +3017,13 @@ function storeSetter(e, t) {
|
|
|
2698
3017
|
function createStore(e, t, n) {
|
|
2699
3018
|
const i = typeof e === "function",
|
|
2700
3019
|
r = i ? createProjectionInternal(e, t, n).store : wrap(e);
|
|
2701
|
-
return [
|
|
3020
|
+
return [
|
|
3021
|
+
r,
|
|
3022
|
+
i ? e => (storeSetter(r, e), suppressComputedRecompute(r[$REFRESH])) : e => storeSetter(r, e)
|
|
3023
|
+
];
|
|
2702
3024
|
}
|
|
2703
3025
|
function createOptimisticStore(e, t, n) {
|
|
2704
|
-
GlobalQueue.
|
|
3026
|
+
GlobalQueue.de ||= clearOptimisticStore;
|
|
2705
3027
|
const i = typeof e === "function";
|
|
2706
3028
|
const r = i ? t : e;
|
|
2707
3029
|
const s = i ? e : undefined;
|
|
@@ -2718,7 +3040,7 @@ function clearOptimisticStore(e) {
|
|
|
2718
3040
|
if (i) {
|
|
2719
3041
|
for (const e of Reflect.ownKeys(n)) {
|
|
2720
3042
|
if (i[e]) {
|
|
2721
|
-
i[e].
|
|
3043
|
+
i[e].G = undefined;
|
|
2722
3044
|
const n =
|
|
2723
3045
|
t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
|
|
2724
3046
|
const r = n === $DELETED ? undefined : n;
|
|
@@ -2726,7 +3048,7 @@ function clearOptimisticStore(e) {
|
|
|
2726
3048
|
}
|
|
2727
3049
|
}
|
|
2728
3050
|
if (i[$TRACK]) {
|
|
2729
|
-
i[$TRACK].
|
|
3051
|
+
i[$TRACK].G = undefined;
|
|
2730
3052
|
setSignal(i[$TRACK], undefined);
|
|
2731
3053
|
}
|
|
2732
3054
|
}
|
|
@@ -2774,7 +3096,7 @@ function createOptimisticProjectionInternal(e, t, n) {
|
|
|
2774
3096
|
setProjectionWriteActive(false);
|
|
2775
3097
|
}
|
|
2776
3098
|
}, undefined);
|
|
2777
|
-
i.
|
|
3099
|
+
i._e &= ~CONFIG_AUTO_DISPOSE;
|
|
2778
3100
|
}
|
|
2779
3101
|
return { store: s, node: i };
|
|
2780
3102
|
}
|
|
@@ -2851,7 +3173,7 @@ const storePath = Object.assign(
|
|
|
2851
3173
|
{ DELETE: DELETE }
|
|
2852
3174
|
);
|
|
2853
3175
|
function snapshotImpl(e, t, n, i) {
|
|
2854
|
-
let r, s, o, u,
|
|
3176
|
+
let r, s, o, u, l, c;
|
|
2855
3177
|
if (!isWrappable(e)) return e;
|
|
2856
3178
|
if (n && n.has(e)) return n.get(e);
|
|
2857
3179
|
if (!n) n = new Map();
|
|
@@ -2871,29 +3193,29 @@ function snapshotImpl(e, t, n, i) {
|
|
|
2871
3193
|
}
|
|
2872
3194
|
if (s) {
|
|
2873
3195
|
const s = o?.length || e.length;
|
|
2874
|
-
for (let
|
|
2875
|
-
|
|
2876
|
-
if (
|
|
2877
|
-
if (t && isWrappable(
|
|
2878
|
-
if ((
|
|
3196
|
+
for (let a = 0; a < s; a++) {
|
|
3197
|
+
c = o && a in o ? o[a] : e[a];
|
|
3198
|
+
if (c === $DELETED) continue;
|
|
3199
|
+
if (t && isWrappable(c)) wrap(c, r);
|
|
3200
|
+
if ((l = snapshotImpl(c, t, n, i)) !== c || u) {
|
|
2879
3201
|
if (!u) n.set(e, (u = [...e]));
|
|
2880
|
-
u[
|
|
3202
|
+
u[a] = l;
|
|
2881
3203
|
}
|
|
2882
3204
|
}
|
|
2883
3205
|
} else {
|
|
2884
3206
|
const s = getKeys(e, o);
|
|
2885
|
-
for (let
|
|
2886
|
-
let f = s[
|
|
3207
|
+
for (let a = 0, f = s.length; a < f; a++) {
|
|
3208
|
+
let f = s[a];
|
|
2887
3209
|
const E = getPropertyDescriptor(e, o, f);
|
|
2888
3210
|
if (E.get) continue;
|
|
2889
|
-
|
|
2890
|
-
if (t && isWrappable(
|
|
2891
|
-
if ((
|
|
3211
|
+
c = o && f in o ? o[f] : e[f];
|
|
3212
|
+
if (t && isWrappable(c)) wrap(c, r);
|
|
3213
|
+
if ((l = snapshotImpl(c, t, n, i)) !== e[f] || u) {
|
|
2892
3214
|
if (!u) {
|
|
2893
3215
|
u = Object.create(Object.getPrototypeOf(e));
|
|
2894
3216
|
Object.assign(u, e);
|
|
2895
3217
|
}
|
|
2896
|
-
u[f] =
|
|
3218
|
+
u[f] = l;
|
|
2897
3219
|
}
|
|
2898
3220
|
}
|
|
2899
3221
|
}
|
|
@@ -2946,8 +3268,9 @@ function merge(...e) {
|
|
|
2946
3268
|
const r = e[i];
|
|
2947
3269
|
t = t || (!!r && $PROXY in r);
|
|
2948
3270
|
const s = !!r && r[$SOURCES];
|
|
2949
|
-
if (s)
|
|
2950
|
-
|
|
3271
|
+
if (s) {
|
|
3272
|
+
for (let e = 0; e < s.length; e++) n.push(s[e]);
|
|
3273
|
+
} else n.push(typeof r === "function" ? ((t = true), createMemo(r)) : r);
|
|
2951
3274
|
}
|
|
2952
3275
|
if (SUPPORTS_PROXY && t) {
|
|
2953
3276
|
return new Proxy(
|
|
@@ -2966,9 +3289,12 @@ function merge(...e) {
|
|
|
2966
3289
|
return false;
|
|
2967
3290
|
},
|
|
2968
3291
|
keys() {
|
|
2969
|
-
const e =
|
|
2970
|
-
for (let t = 0; t < n.length; t++)
|
|
2971
|
-
|
|
3292
|
+
const e = new Set();
|
|
3293
|
+
for (let t = 0; t < n.length; t++) {
|
|
3294
|
+
const i = Object.keys(resolveSource(n[t]));
|
|
3295
|
+
for (let t = 0; t < i.length; t++) e.add(i[t]);
|
|
3296
|
+
}
|
|
3297
|
+
return [...e];
|
|
2972
3298
|
}
|
|
2973
3299
|
},
|
|
2974
3300
|
propTraps
|
|
@@ -3007,261 +3333,268 @@ function merge(...e) {
|
|
|
3007
3333
|
return o;
|
|
3008
3334
|
}
|
|
3009
3335
|
function omit(e, ...t) {
|
|
3010
|
-
const n = new Set(t);
|
|
3011
3336
|
if (SUPPORTS_PROXY && $PROXY in e) {
|
|
3012
3337
|
return new Proxy(
|
|
3013
3338
|
{
|
|
3014
|
-
get(
|
|
3015
|
-
return
|
|
3339
|
+
get(n) {
|
|
3340
|
+
return t.includes(n) ? undefined : e[n];
|
|
3016
3341
|
},
|
|
3017
|
-
has(
|
|
3018
|
-
return !
|
|
3342
|
+
has(n) {
|
|
3343
|
+
return !t.includes(n) && n in e;
|
|
3019
3344
|
},
|
|
3020
3345
|
keys() {
|
|
3021
|
-
return Object.keys(e).filter(e => !
|
|
3346
|
+
return Object.keys(e).filter(e => !t.includes(e));
|
|
3022
3347
|
}
|
|
3023
3348
|
},
|
|
3024
3349
|
propTraps
|
|
3025
3350
|
);
|
|
3026
3351
|
}
|
|
3027
|
-
const
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3352
|
+
const n = {};
|
|
3353
|
+
const i = Object.getOwnPropertyNames(e);
|
|
3354
|
+
const r = t.length > 4 && i.length > t.length ? new Set(t) : undefined;
|
|
3355
|
+
for (const s of i) {
|
|
3356
|
+
if (r ? !r.has(s) : !t.includes(s)) {
|
|
3357
|
+
const t = Object.getOwnPropertyDescriptor(e, s);
|
|
3358
|
+
!t.get && !t.set && t.enumerable && t.writable && t.configurable
|
|
3359
|
+
? (n[s] = t.value)
|
|
3360
|
+
: Object.defineProperty(n, s, t);
|
|
3034
3361
|
}
|
|
3035
3362
|
}
|
|
3036
|
-
return
|
|
3363
|
+
return n;
|
|
3037
3364
|
}
|
|
3038
3365
|
function mapArray(e, t, n) {
|
|
3039
3366
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
3040
3367
|
const r = t.length > 1;
|
|
3041
3368
|
const s = t;
|
|
3042
3369
|
const o = {
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3370
|
+
Ze: createOwner(),
|
|
3371
|
+
qe: 0,
|
|
3372
|
+
Be: e,
|
|
3373
|
+
ze: [],
|
|
3374
|
+
Xe: s,
|
|
3375
|
+
Je: [],
|
|
3376
|
+
et: [],
|
|
3377
|
+
tt: i,
|
|
3378
|
+
nt: i || n?.keyed === false ? [] : undefined,
|
|
3379
|
+
it: r && n?.keyed !== false ? [] : undefined,
|
|
3380
|
+
rt: n?.keyed === false,
|
|
3381
|
+
st: n?.fallback
|
|
3054
3382
|
};
|
|
3055
3383
|
const u = computed(updateKeyedMap.bind(o));
|
|
3056
|
-
o.
|
|
3057
|
-
u.
|
|
3384
|
+
o.Ze.u = u;
|
|
3385
|
+
u._e &= ~CONFIG_AUTO_DISPOSE;
|
|
3058
3386
|
return accessor(u);
|
|
3059
3387
|
}
|
|
3060
3388
|
const pureOptions = { ownedWrite: true };
|
|
3061
3389
|
function updateKeyedMap() {
|
|
3062
|
-
const e = this.
|
|
3390
|
+
const e = this.Be() || [],
|
|
3063
3391
|
t = e.length;
|
|
3064
3392
|
e[$TRACK];
|
|
3065
|
-
runWithOwner(this.
|
|
3393
|
+
runWithOwner(this.Ze, () => {
|
|
3066
3394
|
let n,
|
|
3067
3395
|
i,
|
|
3068
|
-
r = this.
|
|
3069
|
-
?
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3396
|
+
r = this.nt
|
|
3397
|
+
? this.rt
|
|
3398
|
+
? () => {
|
|
3399
|
+
this.nt[i] = signal(e[i], pureOptions);
|
|
3400
|
+
return this.Xe(accessor(this.nt[i]), i);
|
|
3401
|
+
}
|
|
3402
|
+
: () => {
|
|
3403
|
+
this.nt[i] = signal(e[i], pureOptions);
|
|
3404
|
+
this.it && (this.it[i] = signal(i, pureOptions));
|
|
3405
|
+
return this.Xe(accessor(this.nt[i]), this.it ? accessor(this.it[i]) : undefined);
|
|
3406
|
+
}
|
|
3407
|
+
: this.it
|
|
3075
3408
|
? () => {
|
|
3076
3409
|
const t = e[i];
|
|
3077
|
-
this.
|
|
3078
|
-
return this.
|
|
3410
|
+
this.it[i] = signal(i, pureOptions);
|
|
3411
|
+
return this.Xe(t, accessor(this.it[i]));
|
|
3079
3412
|
}
|
|
3080
3413
|
: () => {
|
|
3081
3414
|
const t = e[i];
|
|
3082
|
-
return this.
|
|
3415
|
+
return this.Xe(t);
|
|
3083
3416
|
};
|
|
3084
3417
|
if (t === 0) {
|
|
3085
|
-
if (this
|
|
3086
|
-
this.
|
|
3087
|
-
this.
|
|
3088
|
-
this.
|
|
3089
|
-
this.
|
|
3090
|
-
this
|
|
3091
|
-
this.
|
|
3092
|
-
this.
|
|
3093
|
-
}
|
|
3094
|
-
if (this.
|
|
3095
|
-
this.
|
|
3096
|
-
}
|
|
3097
|
-
} else if (this
|
|
3098
|
-
if (this.
|
|
3099
|
-
this.
|
|
3418
|
+
if (this.qe !== 0) {
|
|
3419
|
+
this.Ze.dispose(false);
|
|
3420
|
+
this.et = [];
|
|
3421
|
+
this.ze = [];
|
|
3422
|
+
this.Je = [];
|
|
3423
|
+
this.qe = 0;
|
|
3424
|
+
this.nt && (this.nt = []);
|
|
3425
|
+
this.it && (this.it = []);
|
|
3426
|
+
}
|
|
3427
|
+
if (this.st && !this.Je[0]) {
|
|
3428
|
+
this.Je[0] = runWithOwner((this.et[0] = createOwner()), this.st);
|
|
3429
|
+
}
|
|
3430
|
+
} else if (this.qe === 0) {
|
|
3431
|
+
if (this.et[0]) this.et[0].dispose();
|
|
3432
|
+
this.Je = new Array(t);
|
|
3100
3433
|
for (i = 0; i < t; i++) {
|
|
3101
|
-
this.
|
|
3102
|
-
this.
|
|
3434
|
+
this.ze[i] = e[i];
|
|
3435
|
+
this.Je[i] = runWithOwner((this.et[i] = createOwner()), r);
|
|
3103
3436
|
}
|
|
3104
|
-
this
|
|
3437
|
+
this.qe = t;
|
|
3105
3438
|
} else {
|
|
3106
3439
|
let s,
|
|
3107
3440
|
o,
|
|
3108
3441
|
u,
|
|
3442
|
+
l,
|
|
3109
3443
|
c,
|
|
3110
3444
|
a,
|
|
3111
|
-
l,
|
|
3112
3445
|
f,
|
|
3113
3446
|
E = new Array(t),
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
d = this.
|
|
3447
|
+
S = new Array(t),
|
|
3448
|
+
T = this.nt ? new Array(t) : undefined,
|
|
3449
|
+
d = this.it ? new Array(t) : undefined;
|
|
3117
3450
|
for (
|
|
3118
|
-
s = 0, o = Math.min(this
|
|
3119
|
-
s < o && (this.
|
|
3451
|
+
s = 0, o = Math.min(this.qe, t);
|
|
3452
|
+
s < o && (this.ze[s] === e[s] || (this.nt && compare(this.tt, this.ze[s], e[s])));
|
|
3120
3453
|
s++
|
|
3121
3454
|
) {
|
|
3122
|
-
if (this.
|
|
3455
|
+
if (this.nt) setSignal(this.nt[s], e[s]);
|
|
3123
3456
|
}
|
|
3124
3457
|
for (
|
|
3125
|
-
o = this
|
|
3458
|
+
o = this.qe - 1, u = t - 1;
|
|
3126
3459
|
o >= s &&
|
|
3127
3460
|
u >= s &&
|
|
3128
|
-
(this.
|
|
3461
|
+
(this.ze[o] === e[u] || (this.nt && compare(this.tt, this.ze[o], e[u])));
|
|
3129
3462
|
o--, u--
|
|
3130
3463
|
) {
|
|
3131
|
-
E[u] = this.
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
d && (d[u] = this.
|
|
3464
|
+
E[u] = this.Je[o];
|
|
3465
|
+
S[u] = this.et[o];
|
|
3466
|
+
T && (T[u] = this.nt[o]);
|
|
3467
|
+
d && (d[u] = this.it[o]);
|
|
3135
3468
|
}
|
|
3136
|
-
|
|
3469
|
+
a = new Map();
|
|
3137
3470
|
f = new Array(u + 1);
|
|
3138
3471
|
for (i = u; i >= s; i--) {
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
n =
|
|
3472
|
+
l = e[i];
|
|
3473
|
+
c = this.tt ? this.tt(l) : l;
|
|
3474
|
+
n = a.get(c);
|
|
3142
3475
|
f[i] = n === undefined ? -1 : n;
|
|
3143
|
-
|
|
3476
|
+
a.set(c, i);
|
|
3144
3477
|
}
|
|
3145
3478
|
for (n = s; n <= o; n++) {
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
i =
|
|
3479
|
+
l = this.ze[n];
|
|
3480
|
+
c = this.tt ? this.tt(l) : l;
|
|
3481
|
+
i = a.get(c);
|
|
3149
3482
|
if (i !== undefined && i !== -1) {
|
|
3150
|
-
E[i] = this.
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
d && (d[i] = this.
|
|
3483
|
+
E[i] = this.Je[n];
|
|
3484
|
+
S[i] = this.et[n];
|
|
3485
|
+
T && (T[i] = this.nt[n]);
|
|
3486
|
+
d && (d[i] = this.it[n]);
|
|
3154
3487
|
i = f[i];
|
|
3155
|
-
|
|
3156
|
-
} else this.
|
|
3488
|
+
a.set(c, i);
|
|
3489
|
+
} else this.et[n].dispose();
|
|
3157
3490
|
}
|
|
3158
3491
|
for (i = s; i < t; i++) {
|
|
3159
3492
|
if (i in E) {
|
|
3160
|
-
this.
|
|
3161
|
-
this.
|
|
3162
|
-
if (
|
|
3163
|
-
this.
|
|
3164
|
-
setSignal(this.
|
|
3493
|
+
this.Je[i] = E[i];
|
|
3494
|
+
this.et[i] = S[i];
|
|
3495
|
+
if (T) {
|
|
3496
|
+
this.nt[i] = T[i];
|
|
3497
|
+
setSignal(this.nt[i], e[i]);
|
|
3165
3498
|
}
|
|
3166
3499
|
if (d) {
|
|
3167
|
-
this.
|
|
3168
|
-
setSignal(this.
|
|
3500
|
+
this.it[i] = d[i];
|
|
3501
|
+
setSignal(this.it[i], i);
|
|
3169
3502
|
}
|
|
3170
3503
|
} else {
|
|
3171
|
-
this.
|
|
3504
|
+
this.Je[i] = runWithOwner((this.et[i] = createOwner()), r);
|
|
3172
3505
|
}
|
|
3173
3506
|
}
|
|
3174
|
-
this.
|
|
3175
|
-
this.
|
|
3507
|
+
this.Je = this.Je.slice(0, (this.qe = t));
|
|
3508
|
+
this.ze = e.slice(0);
|
|
3176
3509
|
}
|
|
3177
3510
|
});
|
|
3178
|
-
return this.
|
|
3511
|
+
return this.Je;
|
|
3179
3512
|
}
|
|
3180
3513
|
function repeat(e, t, n) {
|
|
3181
3514
|
const i = t;
|
|
3182
3515
|
const r = computed(
|
|
3183
3516
|
updateRepeat.bind({
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3517
|
+
Ze: createOwner(),
|
|
3518
|
+
qe: 0,
|
|
3519
|
+
ot: 0,
|
|
3520
|
+
ut: e,
|
|
3521
|
+
Xe: i,
|
|
3522
|
+
et: [],
|
|
3523
|
+
Je: [],
|
|
3524
|
+
lt: n?.from,
|
|
3525
|
+
st: n?.fallback
|
|
3193
3526
|
})
|
|
3194
3527
|
);
|
|
3195
|
-
r.
|
|
3528
|
+
r._e &= ~CONFIG_AUTO_DISPOSE;
|
|
3196
3529
|
return accessor(r);
|
|
3197
3530
|
}
|
|
3198
3531
|
function updateRepeat() {
|
|
3199
|
-
const e = this.
|
|
3200
|
-
const t = this.
|
|
3201
|
-
runWithOwner(this.
|
|
3532
|
+
const e = this.ut();
|
|
3533
|
+
const t = this.lt?.() || 0;
|
|
3534
|
+
runWithOwner(this.Ze, () => {
|
|
3202
3535
|
if (e === 0) {
|
|
3203
|
-
if (this
|
|
3204
|
-
this.
|
|
3205
|
-
this.
|
|
3206
|
-
this.
|
|
3207
|
-
this
|
|
3536
|
+
if (this.qe !== 0) {
|
|
3537
|
+
this.Ze.dispose(false);
|
|
3538
|
+
this.et = [];
|
|
3539
|
+
this.Je = [];
|
|
3540
|
+
this.qe = 0;
|
|
3208
3541
|
}
|
|
3209
|
-
if (this.
|
|
3210
|
-
this.
|
|
3542
|
+
if (this.st && !this.Je[0]) {
|
|
3543
|
+
this.Je[0] = runWithOwner((this.et[0] = createOwner()), this.st);
|
|
3211
3544
|
}
|
|
3212
3545
|
return;
|
|
3213
3546
|
}
|
|
3214
3547
|
const n = t + e;
|
|
3215
|
-
const i = this.
|
|
3216
|
-
if (this
|
|
3217
|
-
for (let e = n; e < i; e++) this.
|
|
3218
|
-
if (this.
|
|
3219
|
-
let e = this.
|
|
3220
|
-
while (e < t && e < this
|
|
3221
|
-
this.
|
|
3222
|
-
this.
|
|
3223
|
-
} else if (this.
|
|
3224
|
-
let n = i - this.
|
|
3225
|
-
let r = this.
|
|
3226
|
-
this.
|
|
3548
|
+
const i = this.ot + this.qe;
|
|
3549
|
+
if (this.qe === 0 && this.et[0]) this.et[0].dispose();
|
|
3550
|
+
for (let e = n; e < i; e++) this.et[e - this.ot].dispose();
|
|
3551
|
+
if (this.ot < t) {
|
|
3552
|
+
let e = this.ot;
|
|
3553
|
+
while (e < t && e < this.qe) this.et[e++].dispose();
|
|
3554
|
+
this.et.splice(0, t - this.ot);
|
|
3555
|
+
this.Je.splice(0, t - this.ot);
|
|
3556
|
+
} else if (this.ot > t) {
|
|
3557
|
+
let n = i - this.ot - 1;
|
|
3558
|
+
let r = this.ot - t;
|
|
3559
|
+
this.et.length = this.Je.length = e;
|
|
3227
3560
|
while (n >= r) {
|
|
3228
|
-
this.
|
|
3229
|
-
this.
|
|
3561
|
+
this.et[n] = this.et[n - r];
|
|
3562
|
+
this.Je[n] = this.Je[n - r];
|
|
3230
3563
|
n--;
|
|
3231
3564
|
}
|
|
3232
3565
|
for (let e = 0; e < r; e++) {
|
|
3233
|
-
this.
|
|
3566
|
+
this.Je[e] = runWithOwner((this.et[e] = createOwner()), () => this.Xe(e + t));
|
|
3234
3567
|
}
|
|
3235
3568
|
}
|
|
3236
3569
|
for (let e = i; e < n; e++) {
|
|
3237
|
-
this.
|
|
3570
|
+
this.Je[e - t] = runWithOwner((this.et[e - t] = createOwner()), () => this.Xe(e));
|
|
3238
3571
|
}
|
|
3239
|
-
this.
|
|
3240
|
-
this.
|
|
3241
|
-
this
|
|
3572
|
+
this.Je = this.Je.slice(0, e);
|
|
3573
|
+
this.ot = t;
|
|
3574
|
+
this.qe = e;
|
|
3242
3575
|
});
|
|
3243
|
-
return this.
|
|
3576
|
+
return this.Je;
|
|
3244
3577
|
}
|
|
3245
3578
|
function compare(e, t, n) {
|
|
3246
3579
|
return e ? e(t) === e(n) : true;
|
|
3247
3580
|
}
|
|
3248
3581
|
function boundaryComputed(e, t) {
|
|
3249
3582
|
const n = computed(e, { lazy: true });
|
|
3250
|
-
n.
|
|
3251
|
-
const i = e !== undefined ? e : n.
|
|
3252
|
-
const r = t !== undefined ? t : n.
|
|
3253
|
-
n.
|
|
3254
|
-
n
|
|
3583
|
+
n.xe = (e, t) => {
|
|
3584
|
+
const i = e !== undefined ? e : n.he;
|
|
3585
|
+
const r = t !== undefined ? t : n.Re;
|
|
3586
|
+
n.he &= ~n.ct;
|
|
3587
|
+
n.te.notify(n, n.ct, i, r);
|
|
3255
3588
|
};
|
|
3256
|
-
n.
|
|
3257
|
-
n.
|
|
3589
|
+
n.ct = t;
|
|
3590
|
+
n._e &= ~CONFIG_AUTO_DISPOSE;
|
|
3258
3591
|
recompute(n, true);
|
|
3259
3592
|
return n;
|
|
3260
3593
|
}
|
|
3261
3594
|
function createBoundChildren(e, t, n, i) {
|
|
3262
|
-
const r = e
|
|
3263
|
-
r.addChild((e
|
|
3264
|
-
cleanup(() => r.removeChild(e
|
|
3595
|
+
const r = e.te;
|
|
3596
|
+
r.addChild((e.te = n));
|
|
3597
|
+
cleanup(() => r.removeChild(e.te));
|
|
3265
3598
|
return runWithOwner(e, () => {
|
|
3266
3599
|
const e = computed(t);
|
|
3267
3600
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
|
|
@@ -3276,52 +3609,52 @@ function isRevealController(e) {
|
|
|
3276
3609
|
return e instanceof RevealController;
|
|
3277
3610
|
}
|
|
3278
3611
|
function isSlotReady(e) {
|
|
3279
|
-
return isRevealController(e) ? e.isReady() : e.
|
|
3612
|
+
return isRevealController(e) ? e.isReady() : e.ft.size === 0 && !e.Et;
|
|
3280
3613
|
}
|
|
3281
3614
|
function isSlotMinimallyReady(e) {
|
|
3282
3615
|
return isRevealController(e) ? e.isMinimallyReady() : isSlotReady(e);
|
|
3283
3616
|
}
|
|
3284
3617
|
function setSlotState(e, t, n, i) {
|
|
3285
|
-
setSignal(e.
|
|
3286
|
-
setSignal(e.
|
|
3618
|
+
setSignal(e.St, n);
|
|
3619
|
+
setSignal(e.Tt, i);
|
|
3287
3620
|
if (isRevealController(e)) {
|
|
3288
|
-
if (!n && e.
|
|
3621
|
+
if (!n && e.dt === t) e.dt = undefined;
|
|
3289
3622
|
return e.evaluate(n, i);
|
|
3290
3623
|
}
|
|
3291
|
-
if (!n && e.
|
|
3624
|
+
if (!n && e.Ot === t && e._t) e.Ot = undefined;
|
|
3292
3625
|
}
|
|
3293
3626
|
class RevealController {
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3627
|
+
Rt;
|
|
3628
|
+
It;
|
|
3629
|
+
ht = [];
|
|
3630
|
+
dt;
|
|
3631
|
+
St = signal(false, { ownedWrite: true, Ye: true });
|
|
3632
|
+
Tt = signal(false, { ownedWrite: true, Ye: true });
|
|
3633
|
+
Nt = true;
|
|
3634
|
+
At = true;
|
|
3635
|
+
Ct = false;
|
|
3303
3636
|
constructor(e, t) {
|
|
3304
|
-
this.
|
|
3305
|
-
this.
|
|
3637
|
+
this.Rt = e;
|
|
3638
|
+
this.It = t;
|
|
3306
3639
|
}
|
|
3307
|
-
|
|
3308
|
-
for (let t = 0; t < this.
|
|
3309
|
-
const n = this.
|
|
3310
|
-
if ((isRevealController(n) ? n.
|
|
3640
|
+
Pt(e) {
|
|
3641
|
+
for (let t = 0; t < this.ht.length; t++) {
|
|
3642
|
+
const n = this.ht[t];
|
|
3643
|
+
if ((isRevealController(n) ? n.dt : n.Ot) !== this) continue;
|
|
3311
3644
|
if (e(n) === false) return false;
|
|
3312
3645
|
}
|
|
3313
3646
|
return true;
|
|
3314
3647
|
}
|
|
3315
3648
|
isReady() {
|
|
3316
|
-
return this.
|
|
3649
|
+
return this.Pt(isSlotReady);
|
|
3317
3650
|
}
|
|
3318
3651
|
isMinimallyReady() {
|
|
3319
|
-
const e = untrack(this.
|
|
3652
|
+
const e = untrack(this.Rt);
|
|
3320
3653
|
if (e === "together") return this.isReady();
|
|
3321
3654
|
if (e === "natural") {
|
|
3322
3655
|
let e = false;
|
|
3323
3656
|
let t = false;
|
|
3324
|
-
this.
|
|
3657
|
+
this.Pt(n => {
|
|
3325
3658
|
e = true;
|
|
3326
3659
|
if (isSlotMinimallyReady(n)) {
|
|
3327
3660
|
t = true;
|
|
@@ -3331,58 +3664,58 @@ class RevealController {
|
|
|
3331
3664
|
return !e || t;
|
|
3332
3665
|
}
|
|
3333
3666
|
let t = true;
|
|
3334
|
-
this.
|
|
3667
|
+
this.Pt(e => {
|
|
3335
3668
|
t = isSlotMinimallyReady(e);
|
|
3336
3669
|
return false;
|
|
3337
3670
|
});
|
|
3338
3671
|
return t;
|
|
3339
3672
|
}
|
|
3340
3673
|
register(e) {
|
|
3341
|
-
if (this.
|
|
3342
|
-
this.
|
|
3343
|
-
const t = untrack(this.
|
|
3344
|
-
(setSignal(e.
|
|
3674
|
+
if (this.ht.includes(e)) return;
|
|
3675
|
+
this.ht.push(e);
|
|
3676
|
+
const t = untrack(this.Rt);
|
|
3677
|
+
(setSignal(e.St, true), setSignal(e.Tt, t === "sequential" ? !!untrack(this.It) : false));
|
|
3345
3678
|
untrack(() => this.evaluate());
|
|
3346
3679
|
}
|
|
3347
3680
|
unregister(e) {
|
|
3348
|
-
const t = this.
|
|
3349
|
-
if (t >= 0) this.
|
|
3681
|
+
const t = this.ht.indexOf(e);
|
|
3682
|
+
if (t >= 0) this.ht.splice(t, 1);
|
|
3350
3683
|
untrack(() => this.evaluate());
|
|
3351
3684
|
}
|
|
3352
3685
|
evaluate(e, t) {
|
|
3353
|
-
if (this.
|
|
3354
|
-
this.
|
|
3355
|
-
const n = this.
|
|
3356
|
-
const i = this.
|
|
3686
|
+
if (this.Ct) return;
|
|
3687
|
+
this.Ct = true;
|
|
3688
|
+
const n = this.Nt;
|
|
3689
|
+
const i = this.At;
|
|
3357
3690
|
try {
|
|
3358
|
-
const n = e ?? read(this.
|
|
3359
|
-
i = untrack(this.
|
|
3360
|
-
r = i === "sequential" && !!untrack(this.
|
|
3691
|
+
const n = e ?? read(this.St),
|
|
3692
|
+
i = untrack(this.Rt),
|
|
3693
|
+
r = i === "sequential" && !!untrack(this.It),
|
|
3361
3694
|
s = t ?? r;
|
|
3362
3695
|
if (n) {
|
|
3363
|
-
this.
|
|
3696
|
+
this.Pt(e => setSlotState(e, this, true, s));
|
|
3364
3697
|
} else if (i === "natural") {
|
|
3365
|
-
this.
|
|
3698
|
+
this.Pt(e => {
|
|
3366
3699
|
if (isRevealController(e)) {
|
|
3367
|
-
setSignal(e.
|
|
3368
|
-
setSignal(e.
|
|
3700
|
+
setSignal(e.Tt, false);
|
|
3701
|
+
setSignal(e.St, false);
|
|
3369
3702
|
e.evaluate(false, false);
|
|
3370
3703
|
} else {
|
|
3371
3704
|
setSlotState(e, this, !isSlotReady(e), false);
|
|
3372
3705
|
}
|
|
3373
3706
|
});
|
|
3374
3707
|
} else if (i === "together") {
|
|
3375
|
-
const e = this.
|
|
3376
|
-
this.
|
|
3708
|
+
const e = this.Pt(isSlotMinimallyReady);
|
|
3709
|
+
this.Pt(t => setSlotState(t, this, !e, false));
|
|
3377
3710
|
} else {
|
|
3378
3711
|
let e = false;
|
|
3379
|
-
this.
|
|
3712
|
+
this.Pt(t => {
|
|
3380
3713
|
if (e) return setSlotState(t, this, true, r);
|
|
3381
3714
|
if (isSlotReady(t)) return setSlotState(t, this, false, false);
|
|
3382
3715
|
e = true;
|
|
3383
3716
|
if (isRevealController(t)) {
|
|
3384
|
-
setSignal(t.
|
|
3385
|
-
setSignal(t.
|
|
3717
|
+
setSignal(t.Tt, false);
|
|
3718
|
+
setSignal(t.St, false);
|
|
3386
3719
|
t.evaluate(false, false);
|
|
3387
3720
|
} else {
|
|
3388
3721
|
setSlotState(t, this, true, false);
|
|
@@ -3390,96 +3723,96 @@ class RevealController {
|
|
|
3390
3723
|
});
|
|
3391
3724
|
}
|
|
3392
3725
|
} finally {
|
|
3393
|
-
this.
|
|
3394
|
-
this.
|
|
3395
|
-
this.
|
|
3726
|
+
this.Nt = this.isReady();
|
|
3727
|
+
this.At = this.isMinimallyReady();
|
|
3728
|
+
this.Ct = false;
|
|
3396
3729
|
}
|
|
3397
|
-
if (this.
|
|
3730
|
+
if (this.dt && (n !== this.Nt || i !== this.At)) this.dt.evaluate();
|
|
3398
3731
|
}
|
|
3399
3732
|
}
|
|
3400
3733
|
class CollectionQueue extends Queue {
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3734
|
+
gt;
|
|
3735
|
+
ft = new Set();
|
|
3736
|
+
Dt;
|
|
3737
|
+
Et = true;
|
|
3738
|
+
St = signal(false, { ownedWrite: true, Ye: true });
|
|
3739
|
+
Tt = signal(false, { ownedWrite: true, Ye: true });
|
|
3740
|
+
Ot;
|
|
3741
|
+
_t = false;
|
|
3742
|
+
yt;
|
|
3743
|
+
vt = ON_INIT;
|
|
3411
3744
|
constructor(e) {
|
|
3412
3745
|
super();
|
|
3413
|
-
this.
|
|
3746
|
+
this.gt = e;
|
|
3414
3747
|
}
|
|
3415
3748
|
run(e) {
|
|
3416
|
-
if (!e || (read(this.
|
|
3749
|
+
if (!e || (read(this.St) && (!_revealUsed || read(this.Tt)))) return;
|
|
3417
3750
|
return super.run(e);
|
|
3418
3751
|
}
|
|
3419
3752
|
notify(e, t, n, i) {
|
|
3420
|
-
if (!(t & this.
|
|
3421
|
-
if (this.
|
|
3753
|
+
if (!(t & this.gt)) return super.notify(e, t, n, i);
|
|
3754
|
+
if (this._t && this.yt) {
|
|
3422
3755
|
const e = untrack(() => {
|
|
3423
3756
|
try {
|
|
3424
|
-
return this.
|
|
3757
|
+
return this.yt();
|
|
3425
3758
|
} catch {
|
|
3426
3759
|
return ON_INIT;
|
|
3427
3760
|
}
|
|
3428
3761
|
});
|
|
3429
|
-
if (e !== this.
|
|
3430
|
-
this.
|
|
3431
|
-
this.
|
|
3432
|
-
this.
|
|
3762
|
+
if (e !== this.vt) {
|
|
3763
|
+
this.vt = e;
|
|
3764
|
+
this._t = false;
|
|
3765
|
+
this.ft.clear();
|
|
3433
3766
|
}
|
|
3434
3767
|
}
|
|
3435
|
-
if (this.
|
|
3436
|
-
if (this.
|
|
3768
|
+
if (this.gt & STATUS_PENDING && this._t) return super.notify(e, t, n, i);
|
|
3769
|
+
if (this.gt & STATUS_PENDING && n & STATUS_ERROR) {
|
|
3437
3770
|
return super.notify(e, STATUS_ERROR, n, i);
|
|
3438
3771
|
}
|
|
3439
|
-
if (n & this.
|
|
3440
|
-
this.
|
|
3441
|
-
const t = i?.source || e.
|
|
3772
|
+
if (n & this.gt) {
|
|
3773
|
+
this.Et = true;
|
|
3774
|
+
const t = i?.source || e.Re?.source;
|
|
3442
3775
|
if (t) {
|
|
3443
|
-
const e = this.
|
|
3444
|
-
this.
|
|
3445
|
-
if (e) setSignal(this.
|
|
3776
|
+
const e = this.ft.size === 0;
|
|
3777
|
+
this.ft.add(t);
|
|
3778
|
+
if (e) setSignal(this.St, true);
|
|
3446
3779
|
}
|
|
3447
3780
|
}
|
|
3448
|
-
t &= ~this.
|
|
3781
|
+
t &= ~this.gt;
|
|
3449
3782
|
return t ? super.notify(e, t, n, i) : true;
|
|
3450
3783
|
}
|
|
3451
3784
|
checkSources() {
|
|
3452
|
-
for (const e of this.
|
|
3785
|
+
for (const e of this.ft) {
|
|
3453
3786
|
if (
|
|
3454
|
-
e.
|
|
3455
|
-
(!(e.
|
|
3787
|
+
e._ & REACTIVE_DISPOSED ||
|
|
3788
|
+
(!(e.he & this.gt) && !(this.gt & STATUS_ERROR && e.he & STATUS_PENDING))
|
|
3456
3789
|
)
|
|
3457
|
-
this.
|
|
3790
|
+
this.ft.delete(e);
|
|
3458
3791
|
}
|
|
3459
|
-
if (!this.
|
|
3460
|
-
if (this.
|
|
3461
|
-
this.
|
|
3792
|
+
if (!this.ft.size) {
|
|
3793
|
+
if (this.gt & STATUS_PENDING && this.Et && !this._t && this.Dt) {
|
|
3794
|
+
this.Et = !!(this.Dt.he & this.gt);
|
|
3462
3795
|
} else {
|
|
3463
|
-
this.
|
|
3796
|
+
this.Et = false;
|
|
3464
3797
|
}
|
|
3465
|
-
if (!this.
|
|
3466
|
-
setSignal(this.
|
|
3467
|
-
if (this.
|
|
3798
|
+
if (!this.Et) {
|
|
3799
|
+
setSignal(this.St, false);
|
|
3800
|
+
if (this.yt) {
|
|
3468
3801
|
try {
|
|
3469
|
-
this.
|
|
3802
|
+
this.vt = untrack(() => this.yt());
|
|
3470
3803
|
} catch {}
|
|
3471
3804
|
}
|
|
3472
3805
|
}
|
|
3473
3806
|
}
|
|
3474
|
-
if (_revealUsed) this.
|
|
3807
|
+
if (_revealUsed) this.Ot?.evaluate();
|
|
3475
3808
|
}
|
|
3476
3809
|
}
|
|
3477
3810
|
function createCollectionBoundary(e, t, n, i) {
|
|
3478
3811
|
const r = createOwner();
|
|
3479
3812
|
if (_revealUsed) setContext(RevealControllerContext, null, r);
|
|
3480
3813
|
const s = new CollectionQueue(e);
|
|
3481
|
-
if (i) s.
|
|
3482
|
-
const o = (s.
|
|
3814
|
+
if (i) s.yt = i;
|
|
3815
|
+
const o = (s.Dt = createBoundChildren(r, t, s, e));
|
|
3483
3816
|
untrack(() => {
|
|
3484
3817
|
let t = false;
|
|
3485
3818
|
try {
|
|
@@ -3488,21 +3821,21 @@ function createCollectionBoundary(e, t, n, i) {
|
|
|
3488
3821
|
if (e instanceof NotReadyError) t = true;
|
|
3489
3822
|
else throw e;
|
|
3490
3823
|
}
|
|
3491
|
-
s.
|
|
3824
|
+
s.Et = t || !!(o.he & e) || o.Re instanceof NotReadyError;
|
|
3492
3825
|
});
|
|
3493
3826
|
const u = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
|
|
3494
3827
|
if (u) {
|
|
3495
|
-
s.
|
|
3828
|
+
s.Ot = u;
|
|
3496
3829
|
u.register(s);
|
|
3497
3830
|
cleanup(() => u.unregister(s));
|
|
3498
3831
|
}
|
|
3499
3832
|
return accessor(
|
|
3500
3833
|
computed(() => {
|
|
3501
|
-
if (!read(s.
|
|
3834
|
+
if (!read(s.St)) {
|
|
3502
3835
|
const e = read(o);
|
|
3503
|
-
if (!untrack(() => read(s.
|
|
3836
|
+
if (!untrack(() => read(s.St))) return ((s._t = true), e);
|
|
3504
3837
|
}
|
|
3505
|
-
if (_revealUsed && read(s.
|
|
3838
|
+
if (_revealUsed && read(s.Tt)) return undefined;
|
|
3506
3839
|
return n(s);
|
|
3507
3840
|
})
|
|
3508
3841
|
);
|
|
@@ -3512,10 +3845,10 @@ function createLoadingBoundary(e, t, n) {
|
|
|
3512
3845
|
}
|
|
3513
3846
|
function createErrorBoundary(e, t) {
|
|
3514
3847
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
3515
|
-
let n = e.
|
|
3516
|
-
const i = n.
|
|
3848
|
+
let n = e.ft.values().next().value;
|
|
3849
|
+
const i = n.Re?.cause ?? n.Re;
|
|
3517
3850
|
return t(i, () => {
|
|
3518
|
-
for (const t of e.
|
|
3851
|
+
for (const t of e.ft) recompute(t);
|
|
3519
3852
|
schedule();
|
|
3520
3853
|
});
|
|
3521
3854
|
});
|
|
@@ -3536,7 +3869,7 @@ function createRevealOrder(e, t) {
|
|
|
3536
3869
|
o.evaluate();
|
|
3537
3870
|
});
|
|
3538
3871
|
if (i) {
|
|
3539
|
-
o.
|
|
3872
|
+
o.dt = i;
|
|
3540
3873
|
i.register(o);
|
|
3541
3874
|
cleanup(() => i.unregister(o));
|
|
3542
3875
|
}
|