@solidjs/signals 0.13.13 → 2.0.0-beta.10
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/README.md +8 -7
- package/dist/dev.js +502 -244
- package/dist/node.cjs +1501 -1308
- package/dist/prod.js +1134 -929
- package/dist/types/boundaries.d.ts +124 -3
- package/dist/types/core/action.d.ts +34 -0
- package/dist/types/core/constants.d.ts +24 -0
- package/dist/types/core/context.d.ts +10 -2
- package/dist/types/core/core.d.ts +108 -9
- package/dist/types/core/dev.d.ts +1 -1
- package/dist/types/core/effect.d.ts +3 -2
- package/dist/types/core/error.d.ts +24 -0
- package/dist/types/core/external.d.ts +19 -0
- package/dist/types/core/graph.d.ts +1 -0
- package/dist/types/core/owner.d.ts +93 -3
- package/dist/types/core/scheduler.d.ts +27 -2
- package/dist/types/core/types.d.ts +3 -6
- package/dist/types/index.d.ts +2 -2
- package/dist/types/map.d.ts +32 -3
- package/dist/types/signals.d.ts +338 -39
- package/dist/types/store/optimistic.d.ts +38 -12
- package/dist/types/store/projection.d.ts +55 -15
- package/dist/types/store/reconcile.d.ts +22 -0
- package/dist/types/store/store.d.ts +72 -15
- package/dist/types/store/storePath.d.ts +28 -0
- package/dist/types/store/utils.d.ts +78 -7
- package/dist/types-cjs/boundaries.d.cts +173 -0
- package/dist/types-cjs/core/action.d.cts +35 -0
- package/dist/types-cjs/core/async.d.cts +6 -0
- package/dist/types-cjs/core/constants.d.cts +49 -0
- package/dist/types-cjs/core/context.d.cts +36 -0
- package/dist/types-cjs/core/core.d.cts +153 -0
- package/dist/types-cjs/core/dev.d.cts +49 -0
- package/dist/types-cjs/core/effect.d.cts +31 -0
- package/dist/types-cjs/core/error.d.cts +38 -0
- package/dist/types-cjs/core/external.d.cts +45 -0
- package/dist/types-cjs/core/graph.d.cts +4 -0
- package/dist/types-cjs/core/heap.d.cts +14 -0
- package/dist/types-cjs/core/index.d.cts +12 -0
- package/dist/types-cjs/core/lanes.d.cts +54 -0
- package/dist/types-cjs/core/owner.d.cts +116 -0
- package/dist/types-cjs/core/scheduler.d.cts +106 -0
- package/dist/types-cjs/core/types.d.cts +83 -0
- package/dist/types-cjs/index.d.cts +9 -0
- package/dist/types-cjs/map.d.cts +53 -0
- package/dist/types-cjs/package.json +3 -0
- package/dist/types-cjs/signals.d.cts +491 -0
- package/dist/types-cjs/store/index.d.cts +9 -0
- package/dist/types-cjs/store/optimistic.d.cts +45 -0
- package/dist/types-cjs/store/projection.d.cts +66 -0
- package/dist/types-cjs/store/reconcile.d.cts +23 -0
- package/dist/types-cjs/store/store.d.cts +125 -0
- package/dist/types-cjs/store/storePath.d.cts +58 -0
- package/dist/types-cjs/store/utils.d.cts +114 -0
- package/package.json +32 -24
package/dist/prod.js
CHANGED
|
@@ -33,6 +33,12 @@ 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 CONFIG_OWNED_WRITE = 1 << 0;
|
|
37
|
+
const CONFIG_NO_SNAPSHOT = 1 << 1;
|
|
38
|
+
const CONFIG_TRANSPARENT = 1 << 2;
|
|
39
|
+
const CONFIG_IN_SNAPSHOT_SCOPE = 1 << 3;
|
|
40
|
+
const CONFIG_CHILDREN_FORBIDDEN = 1 << 4;
|
|
41
|
+
const CONFIG_AUTO_DISPOSE = 1 << 5;
|
|
36
42
|
const STATUS_PENDING = 1 << 0;
|
|
37
43
|
const STATUS_ERROR = 1 << 1;
|
|
38
44
|
const STATUS_UNINITIALIZED = 1 << 2;
|
|
@@ -57,26 +63,26 @@ function actualInsertIntoHeap(e, t) {
|
|
|
57
63
|
e.T = t;
|
|
58
64
|
r.T = e;
|
|
59
65
|
}
|
|
60
|
-
if (i > t.
|
|
66
|
+
if (i > t.O) t.O = i;
|
|
61
67
|
}
|
|
62
68
|
function insertIntoHeap(e, t) {
|
|
63
|
-
let n = e.
|
|
69
|
+
let n = e.R;
|
|
64
70
|
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS)) return;
|
|
65
71
|
if (n & REACTIVE_CHECK) {
|
|
66
|
-
e.
|
|
67
|
-
} else e.
|
|
72
|
+
e.R = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
|
|
73
|
+
} else e.R = n | REACTIVE_IN_HEAP;
|
|
68
74
|
if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
|
|
69
75
|
}
|
|
70
76
|
function insertIntoHeapHeight(e, t) {
|
|
71
|
-
let n = e.
|
|
77
|
+
let n = e.R;
|
|
72
78
|
if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT)) return;
|
|
73
|
-
e.
|
|
79
|
+
e.R = n | REACTIVE_IN_HEAP_HEIGHT;
|
|
74
80
|
actualInsertIntoHeap(e, t);
|
|
75
81
|
}
|
|
76
82
|
function deleteFromHeap(e, t) {
|
|
77
|
-
const n = e.
|
|
83
|
+
const n = e.R;
|
|
78
84
|
if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
|
|
79
|
-
e.
|
|
85
|
+
e.R = n & -25;
|
|
80
86
|
const i = e.o;
|
|
81
87
|
if (e.T === e) t.l[i] = undefined;
|
|
82
88
|
else {
|
|
@@ -93,21 +99,21 @@ function deleteFromHeap(e, t) {
|
|
|
93
99
|
function markHeap(e) {
|
|
94
100
|
if (e._) return;
|
|
95
101
|
e._ = true;
|
|
96
|
-
for (let t = 0; t <= e.
|
|
102
|
+
for (let t = 0; t <= e.O; t++) {
|
|
97
103
|
for (let n = e.l[t]; n !== undefined; n = n.S) {
|
|
98
|
-
if (n.
|
|
104
|
+
if (n.R & REACTIVE_IN_HEAP) markNode(n);
|
|
99
105
|
}
|
|
100
106
|
}
|
|
101
107
|
}
|
|
102
108
|
function markNode(e, t = REACTIVE_DIRTY) {
|
|
103
|
-
const n = e.
|
|
109
|
+
const n = e.R;
|
|
104
110
|
if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
|
|
105
|
-
e.
|
|
111
|
+
e.R = (n & -4) | t;
|
|
106
112
|
for (let t = e.I; t !== null; t = t.h) {
|
|
107
113
|
markNode(t.p, REACTIVE_CHECK);
|
|
108
114
|
}
|
|
109
|
-
if (e.
|
|
110
|
-
for (let t = e.
|
|
115
|
+
if (e.N !== null) {
|
|
116
|
+
for (let t = e.N; t !== null; t = t.A) {
|
|
111
117
|
for (let e = t.I; e !== null; e = e.h) {
|
|
112
118
|
markNode(e.p, REACTIVE_CHECK);
|
|
113
119
|
}
|
|
@@ -116,15 +122,15 @@ function markNode(e, t = REACTIVE_DIRTY) {
|
|
|
116
122
|
}
|
|
117
123
|
function runHeap(e, t) {
|
|
118
124
|
e._ = false;
|
|
119
|
-
for (e.P = 0; e.P <= e.
|
|
125
|
+
for (e.P = 0; e.P <= e.O; e.P++) {
|
|
120
126
|
let n = e.l[e.P];
|
|
121
127
|
while (n !== undefined) {
|
|
122
|
-
if (n.
|
|
128
|
+
if (n.R & REACTIVE_IN_HEAP) t(n);
|
|
123
129
|
else adjustHeight(n, e);
|
|
124
130
|
n = e.l[e.P];
|
|
125
131
|
}
|
|
126
132
|
}
|
|
127
|
-
e.
|
|
133
|
+
e.O = 0;
|
|
128
134
|
}
|
|
129
135
|
function adjustHeight(e, t) {
|
|
130
136
|
deleteFromHeap(e, t);
|
|
@@ -143,23 +149,40 @@ function adjustHeight(e, t) {
|
|
|
143
149
|
}
|
|
144
150
|
const DEV$1 = undefined;
|
|
145
151
|
const transitions = new Set();
|
|
146
|
-
const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0,
|
|
147
|
-
const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0,
|
|
152
|
+
const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, O: 0 };
|
|
153
|
+
const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, O: 0 };
|
|
148
154
|
let clock = 0;
|
|
149
155
|
let activeTransition = null;
|
|
150
156
|
let scheduled = false;
|
|
151
157
|
let projectionWriteActive = false;
|
|
152
158
|
let stashedOptimisticReads = null;
|
|
159
|
+
const transientStoreNodes = new Set();
|
|
160
|
+
function registerTransientStoreNode(e) {
|
|
161
|
+
transientStoreNodes.add(e);
|
|
162
|
+
}
|
|
163
|
+
function sweepTransientStoreNodes() {
|
|
164
|
+
if (transientStoreNodes.size === 0) return;
|
|
165
|
+
for (const e of transientStoreNodes) {
|
|
166
|
+
if (e.I !== null) {
|
|
167
|
+
transientStoreNodes.delete(e);
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (e.U !== NOT_PENDING) continue;
|
|
171
|
+
if (e.G !== undefined && e.G !== NOT_PENDING) continue;
|
|
172
|
+
transientStoreNodes.delete(e);
|
|
173
|
+
e.k?.();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
153
176
|
function enforceLoadingBoundary(e) {}
|
|
154
177
|
function shouldReadStashedOptimisticValue(e) {
|
|
155
178
|
return !!stashedOptimisticReads?.has(e);
|
|
156
179
|
}
|
|
157
180
|
function runLaneEffects(e) {
|
|
158
181
|
for (const t of activeLanes) {
|
|
159
|
-
if (t.
|
|
160
|
-
const n = t.
|
|
182
|
+
if (t.F || t.W.size > 0) continue;
|
|
183
|
+
const n = t.H[e - 1];
|
|
161
184
|
if (n.length) {
|
|
162
|
-
t.
|
|
185
|
+
t.H[e - 1] = [];
|
|
163
186
|
runQueue(n, e);
|
|
164
187
|
}
|
|
165
188
|
}
|
|
@@ -167,15 +190,15 @@ function runLaneEffects(e) {
|
|
|
167
190
|
function queueStashedOptimisticEffects(e) {
|
|
168
191
|
for (let t = e.I; t !== null; t = t.h) {
|
|
169
192
|
const e = t.p;
|
|
170
|
-
if (!e.
|
|
171
|
-
if (e.
|
|
172
|
-
if (!e.
|
|
173
|
-
e.
|
|
174
|
-
e
|
|
193
|
+
if (!e.M) continue;
|
|
194
|
+
if (e.M === EFFECT_TRACKED) {
|
|
195
|
+
if (!e.j) {
|
|
196
|
+
e.j = true;
|
|
197
|
+
e.$.enqueue(EFFECT_USER, e.K);
|
|
175
198
|
}
|
|
176
199
|
continue;
|
|
177
200
|
}
|
|
178
|
-
const n = e.
|
|
201
|
+
const n = e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
179
202
|
if (n.P > e.o) n.P = e.o;
|
|
180
203
|
insertIntoHeap(e, n);
|
|
181
204
|
}
|
|
@@ -184,66 +207,67 @@ function setProjectionWriteActive(e) {
|
|
|
184
207
|
projectionWriteActive = e;
|
|
185
208
|
}
|
|
186
209
|
function mergeTransitionState(e, t) {
|
|
187
|
-
t.
|
|
188
|
-
e
|
|
189
|
-
for (const n of activeLanes) if (n.
|
|
190
|
-
e.
|
|
191
|
-
for (const n of t.
|
|
192
|
-
for (const [n, i] of t.
|
|
193
|
-
let t = e.
|
|
194
|
-
if (!t) e.
|
|
210
|
+
t.Y = e;
|
|
211
|
+
e.B.push(...t.B);
|
|
212
|
+
for (const n of activeLanes) if (n.Z === t) n.Z = e;
|
|
213
|
+
e.q.push(...t.q);
|
|
214
|
+
for (const n of t.X) e.X.add(n);
|
|
215
|
+
for (const [n, i] of t.J) {
|
|
216
|
+
let t = e.J.get(n);
|
|
217
|
+
if (!t) e.J.set(n, (t = new Set()));
|
|
195
218
|
for (const e of i) t.add(e);
|
|
196
219
|
}
|
|
220
|
+
for (const n of t.ee) e.ee.add(n);
|
|
197
221
|
}
|
|
198
222
|
function resolveOptimisticNodes(e) {
|
|
199
223
|
for (let t = 0; t < e.length; t++) {
|
|
200
224
|
const n = e[t];
|
|
201
|
-
n.
|
|
202
|
-
if (n.
|
|
203
|
-
n.
|
|
204
|
-
n.
|
|
225
|
+
n.te = undefined;
|
|
226
|
+
if (n.U !== NOT_PENDING) {
|
|
227
|
+
n.ne = n.U;
|
|
228
|
+
n.U = NOT_PENDING;
|
|
205
229
|
}
|
|
206
|
-
const i = n.
|
|
207
|
-
n.
|
|
208
|
-
if (i !== NOT_PENDING && n.
|
|
209
|
-
n.
|
|
230
|
+
const i = n.G;
|
|
231
|
+
n.G = NOT_PENDING;
|
|
232
|
+
if (i !== NOT_PENDING && n.ne !== i) insertSubs(n, true);
|
|
233
|
+
n.Z = null;
|
|
210
234
|
}
|
|
211
235
|
e.length = 0;
|
|
212
236
|
}
|
|
213
237
|
function cleanupCompletedLanes(e) {
|
|
214
238
|
for (const t of activeLanes) {
|
|
215
|
-
const n = e ? t.
|
|
239
|
+
const n = e ? t.Z === e : !t.Z;
|
|
216
240
|
if (!n) continue;
|
|
217
|
-
if (!t.
|
|
218
|
-
if (t.
|
|
219
|
-
if (t.
|
|
220
|
-
}
|
|
221
|
-
if (t.te
|
|
222
|
-
t.
|
|
223
|
-
t.
|
|
224
|
-
t.
|
|
241
|
+
if (!t.F) {
|
|
242
|
+
if (t.H[0].length) runQueue(t.H[0], EFFECT_RENDER);
|
|
243
|
+
if (t.H[1].length) runQueue(t.H[1], EFFECT_USER);
|
|
244
|
+
}
|
|
245
|
+
if (t.ie.te === t) t.ie.te = undefined;
|
|
246
|
+
t.W.clear();
|
|
247
|
+
t.H[0].length = 0;
|
|
248
|
+
t.H[1].length = 0;
|
|
225
249
|
activeLanes.delete(t);
|
|
226
|
-
signalLanes.delete(t.
|
|
250
|
+
signalLanes.delete(t.ie);
|
|
227
251
|
}
|
|
228
252
|
}
|
|
229
253
|
function schedule() {
|
|
230
254
|
if (scheduled) return;
|
|
231
255
|
scheduled = true;
|
|
232
|
-
if (!globalQueue.
|
|
256
|
+
if (!globalQueue.re && !projectionWriteActive) queueMicrotask(flush);
|
|
233
257
|
}
|
|
234
258
|
class Queue {
|
|
235
259
|
i = null;
|
|
236
|
-
|
|
237
|
-
|
|
260
|
+
se = [[], []];
|
|
261
|
+
oe = [];
|
|
238
262
|
created = clock;
|
|
239
263
|
addChild(e) {
|
|
240
|
-
this.
|
|
264
|
+
this.oe.push(e);
|
|
241
265
|
e.i = this;
|
|
242
266
|
}
|
|
243
267
|
removeChild(e) {
|
|
244
|
-
const t = this.
|
|
268
|
+
const t = this.oe.indexOf(e);
|
|
245
269
|
if (t >= 0) {
|
|
246
|
-
this.
|
|
270
|
+
this.oe.splice(t, 1);
|
|
247
271
|
e.i = null;
|
|
248
272
|
}
|
|
249
273
|
}
|
|
@@ -252,81 +276,81 @@ class Queue {
|
|
|
252
276
|
return false;
|
|
253
277
|
}
|
|
254
278
|
run(e) {
|
|
255
|
-
if (this.
|
|
256
|
-
const t = this.
|
|
257
|
-
this.
|
|
279
|
+
if (this.se[e - 1].length) {
|
|
280
|
+
const t = this.se[e - 1];
|
|
281
|
+
this.se[e - 1] = [];
|
|
258
282
|
runQueue(t, e);
|
|
259
283
|
}
|
|
260
|
-
for (let t = 0; t < this.
|
|
284
|
+
for (let t = 0; t < this.oe.length; t++) this.oe[t].run?.(e);
|
|
261
285
|
}
|
|
262
286
|
enqueue(e, t) {
|
|
263
287
|
if (e) {
|
|
264
288
|
if (currentOptimisticLane) {
|
|
265
289
|
const n = findLane(currentOptimisticLane);
|
|
266
|
-
n.
|
|
290
|
+
n.H[e - 1].push(t);
|
|
267
291
|
} else {
|
|
268
|
-
this.
|
|
292
|
+
this.se[e - 1].push(t);
|
|
269
293
|
}
|
|
270
294
|
}
|
|
271
295
|
schedule();
|
|
272
296
|
}
|
|
273
297
|
stashQueues(e) {
|
|
274
|
-
e.
|
|
275
|
-
e.
|
|
276
|
-
this.
|
|
277
|
-
for (let t = 0; t < this.
|
|
278
|
-
let n = this.
|
|
279
|
-
let i = e.
|
|
298
|
+
e.se[0].push(...this.se[0]);
|
|
299
|
+
e.se[1].push(...this.se[1]);
|
|
300
|
+
this.se = [[], []];
|
|
301
|
+
for (let t = 0; t < this.oe.length; t++) {
|
|
302
|
+
let n = this.oe[t];
|
|
303
|
+
let i = e.oe[t];
|
|
280
304
|
if (!i) {
|
|
281
|
-
i = {
|
|
282
|
-
e.
|
|
305
|
+
i = { se: [[], []], oe: [] };
|
|
306
|
+
e.oe[t] = i;
|
|
283
307
|
}
|
|
284
308
|
n.stashQueues(i);
|
|
285
309
|
}
|
|
286
310
|
}
|
|
287
311
|
restoreQueues(e) {
|
|
288
|
-
this.
|
|
289
|
-
this.
|
|
290
|
-
for (let t = 0; t < e.
|
|
291
|
-
const n = e.
|
|
292
|
-
let i = this.
|
|
312
|
+
this.se[0].push(...e.se[0]);
|
|
313
|
+
this.se[1].push(...e.se[1]);
|
|
314
|
+
for (let t = 0; t < e.oe.length; t++) {
|
|
315
|
+
const n = e.oe[t];
|
|
316
|
+
let i = this.oe[t];
|
|
293
317
|
if (i) i.restoreQueues(n);
|
|
294
318
|
}
|
|
295
319
|
}
|
|
296
320
|
}
|
|
297
321
|
class GlobalQueue extends Queue {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
static
|
|
303
|
-
static
|
|
304
|
-
static
|
|
322
|
+
re = false;
|
|
323
|
+
ue = [];
|
|
324
|
+
q = [];
|
|
325
|
+
X = new Set();
|
|
326
|
+
static ce;
|
|
327
|
+
static ae;
|
|
328
|
+
static le = null;
|
|
305
329
|
flush() {
|
|
306
|
-
if (this.
|
|
307
|
-
this.
|
|
330
|
+
if (this.re) return;
|
|
331
|
+
this.re = true;
|
|
308
332
|
try {
|
|
309
|
-
runHeap(dirtyQueue, GlobalQueue.
|
|
333
|
+
runHeap(dirtyQueue, GlobalQueue.ce);
|
|
310
334
|
if (activeTransition) {
|
|
311
335
|
const e = transitionComplete(activeTransition);
|
|
312
336
|
if (!e) {
|
|
313
337
|
const e = activeTransition;
|
|
314
|
-
runHeap(zombieQueue, GlobalQueue.
|
|
315
|
-
this.
|
|
316
|
-
this.
|
|
317
|
-
this.
|
|
338
|
+
runHeap(zombieQueue, GlobalQueue.ce);
|
|
339
|
+
this.ue = [];
|
|
340
|
+
this.q = [];
|
|
341
|
+
this.X = new Set();
|
|
318
342
|
runLaneEffects(EFFECT_RENDER);
|
|
319
343
|
runLaneEffects(EFFECT_USER);
|
|
320
|
-
this.stashQueues(e.
|
|
344
|
+
this.stashQueues(e.fe);
|
|
321
345
|
clock++;
|
|
322
|
-
scheduled = dirtyQueue.
|
|
323
|
-
reassignPendingTransition(e.
|
|
346
|
+
scheduled = dirtyQueue.O >= dirtyQueue.P;
|
|
347
|
+
reassignPendingTransition(e.ue);
|
|
324
348
|
activeTransition = null;
|
|
325
|
-
if (!e
|
|
349
|
+
if (!e.B.length && !e.J.size && e.q.length) {
|
|
326
350
|
stashedOptimisticReads = new Set();
|
|
327
|
-
for (let t = 0; t < e.
|
|
328
|
-
const n = e.
|
|
329
|
-
if (n.L || n.
|
|
351
|
+
for (let t = 0; t < e.q.length; t++) {
|
|
352
|
+
const n = e.q[t];
|
|
353
|
+
if (n.L || n.Ee & CONFIG_OWNED_WRITE) continue;
|
|
330
354
|
stashedOptimisticReads.add(n);
|
|
331
355
|
queueStashedOptimisticEffects(n);
|
|
332
356
|
}
|
|
@@ -338,36 +362,36 @@ class GlobalQueue extends Queue {
|
|
|
338
362
|
}
|
|
339
363
|
return;
|
|
340
364
|
}
|
|
341
|
-
this.
|
|
342
|
-
this.restoreQueues(activeTransition.
|
|
365
|
+
this.ue !== activeTransition.ue && this.ue.push(...activeTransition.ue);
|
|
366
|
+
this.restoreQueues(activeTransition.fe);
|
|
343
367
|
transitions.delete(activeTransition);
|
|
344
368
|
const t = activeTransition;
|
|
345
369
|
activeTransition = null;
|
|
346
|
-
reassignPendingTransition(this.
|
|
370
|
+
reassignPendingTransition(this.ue);
|
|
347
371
|
finalizePureQueue(t);
|
|
348
372
|
} else {
|
|
349
|
-
if (transitions.size) runHeap(zombieQueue, GlobalQueue.
|
|
373
|
+
if (transitions.size) runHeap(zombieQueue, GlobalQueue.ce);
|
|
350
374
|
finalizePureQueue();
|
|
351
375
|
}
|
|
352
376
|
clock++;
|
|
353
|
-
scheduled = dirtyQueue.
|
|
377
|
+
scheduled = dirtyQueue.O >= dirtyQueue.P;
|
|
354
378
|
runLaneEffects(EFFECT_RENDER);
|
|
355
379
|
this.run(EFFECT_RENDER);
|
|
356
380
|
runLaneEffects(EFFECT_USER);
|
|
357
381
|
this.run(EFFECT_USER);
|
|
358
382
|
if (false);
|
|
359
383
|
} finally {
|
|
360
|
-
this.
|
|
384
|
+
this.re = false;
|
|
361
385
|
}
|
|
362
386
|
}
|
|
363
387
|
notify(e, t, n, i) {
|
|
364
388
|
if (t & STATUS_PENDING) {
|
|
365
389
|
if (n & STATUS_PENDING) {
|
|
366
|
-
const t = i !== undefined ? i : e.
|
|
390
|
+
const t = i !== undefined ? i : e.Te;
|
|
367
391
|
if (activeTransition && t) {
|
|
368
392
|
const n = t.source;
|
|
369
|
-
let i = activeTransition.
|
|
370
|
-
if (!i) activeTransition.
|
|
393
|
+
let i = activeTransition.J.get(n);
|
|
394
|
+
if (!i) activeTransition.J.set(n, (i = new Set()));
|
|
371
395
|
const r = i.size;
|
|
372
396
|
i.add(e);
|
|
373
397
|
if (i.size !== r) schedule();
|
|
@@ -380,17 +404,18 @@ class GlobalQueue extends Queue {
|
|
|
380
404
|
initTransition(e) {
|
|
381
405
|
if (e) e = currentTransition(e);
|
|
382
406
|
if (e && e === activeTransition) return;
|
|
383
|
-
if (!e && activeTransition && activeTransition.
|
|
407
|
+
if (!e && activeTransition && activeTransition.Se === clock) return;
|
|
384
408
|
if (!activeTransition) {
|
|
385
409
|
activeTransition = e ?? {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
410
|
+
Se: clock,
|
|
411
|
+
ue: [],
|
|
412
|
+
J: new Map(),
|
|
413
|
+
q: [],
|
|
414
|
+
X: new Set(),
|
|
415
|
+
B: [],
|
|
416
|
+
fe: { se: [[], []], oe: [] },
|
|
417
|
+
Y: false,
|
|
418
|
+
ee: new Set()
|
|
394
419
|
};
|
|
395
420
|
} else if (e) {
|
|
396
421
|
const t = activeTransition;
|
|
@@ -399,71 +424,71 @@ class GlobalQueue extends Queue {
|
|
|
399
424
|
activeTransition = e;
|
|
400
425
|
}
|
|
401
426
|
transitions.add(activeTransition);
|
|
402
|
-
activeTransition.
|
|
403
|
-
if (this.
|
|
404
|
-
for (let e = 0; e < this.
|
|
405
|
-
const t = this.
|
|
406
|
-
t.
|
|
407
|
-
activeTransition.
|
|
427
|
+
activeTransition.Se = clock;
|
|
428
|
+
if (this.ue !== activeTransition.ue) {
|
|
429
|
+
for (let e = 0; e < this.ue.length; e++) {
|
|
430
|
+
const t = this.ue[e];
|
|
431
|
+
t.Z = activeTransition;
|
|
432
|
+
activeTransition.ue.push(t);
|
|
408
433
|
}
|
|
409
|
-
this.
|
|
434
|
+
this.ue = activeTransition.ue;
|
|
410
435
|
}
|
|
411
|
-
if (this.
|
|
412
|
-
for (let e = 0; e < this.
|
|
413
|
-
const t = this.
|
|
414
|
-
t.
|
|
415
|
-
activeTransition.
|
|
436
|
+
if (this.q !== activeTransition.q) {
|
|
437
|
+
for (let e = 0; e < this.q.length; e++) {
|
|
438
|
+
const t = this.q[e];
|
|
439
|
+
t.Z = activeTransition;
|
|
440
|
+
activeTransition.q.push(t);
|
|
416
441
|
}
|
|
417
|
-
this.
|
|
442
|
+
this.q = activeTransition.q;
|
|
418
443
|
}
|
|
419
444
|
for (const e of activeLanes) {
|
|
420
|
-
if (!e.
|
|
445
|
+
if (!e.Z) e.Z = activeTransition;
|
|
421
446
|
}
|
|
422
|
-
if (this.
|
|
423
|
-
for (const e of this.
|
|
424
|
-
this.
|
|
447
|
+
if (this.X !== activeTransition.X) {
|
|
448
|
+
for (const e of this.X) activeTransition.X.add(e);
|
|
449
|
+
this.X = activeTransition.X;
|
|
425
450
|
}
|
|
426
451
|
}
|
|
427
452
|
}
|
|
428
453
|
function insertSubs(e, t = false) {
|
|
429
|
-
const n = e.
|
|
454
|
+
const n = e.te || currentOptimisticLane;
|
|
430
455
|
const i = e.de !== undefined;
|
|
431
456
|
for (let r = e.I; r !== null; r = r.h) {
|
|
432
|
-
if (i && r.p.
|
|
433
|
-
r.p.
|
|
457
|
+
if (i && r.p.Ee & CONFIG_IN_SNAPSHOT_SCOPE) {
|
|
458
|
+
r.p.R |= REACTIVE_SNAPSHOT_STALE;
|
|
434
459
|
continue;
|
|
435
460
|
}
|
|
436
461
|
if (t && n) {
|
|
437
|
-
r.p.
|
|
462
|
+
r.p.R |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
438
463
|
assignOrMergeLane(r.p, n);
|
|
439
464
|
} else if (t) {
|
|
440
|
-
r.p.
|
|
441
|
-
r.p.
|
|
465
|
+
r.p.R |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
466
|
+
r.p.te = undefined;
|
|
442
467
|
}
|
|
443
468
|
const e = r.p;
|
|
444
|
-
if (e.
|
|
445
|
-
if (!e.
|
|
446
|
-
e.
|
|
447
|
-
e
|
|
469
|
+
if (e.M === EFFECT_TRACKED) {
|
|
470
|
+
if (!e.j) {
|
|
471
|
+
e.j = true;
|
|
472
|
+
e.$.enqueue(EFFECT_USER, e.K);
|
|
448
473
|
}
|
|
449
474
|
continue;
|
|
450
475
|
}
|
|
451
|
-
const s = r.p.
|
|
476
|
+
const s = r.p.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
452
477
|
if (s.P > r.p.o) s.P = r.p.o;
|
|
453
478
|
insertIntoHeap(r.p, s);
|
|
454
479
|
}
|
|
455
480
|
}
|
|
456
481
|
function commitPendingNodes() {
|
|
457
|
-
const e = globalQueue.
|
|
482
|
+
const e = globalQueue.ue;
|
|
458
483
|
for (let t = 0; t < e.length; t++) {
|
|
459
484
|
const n = e[t];
|
|
460
|
-
if (n.
|
|
461
|
-
n.
|
|
462
|
-
n.
|
|
463
|
-
if (n.
|
|
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;
|
|
464
489
|
}
|
|
465
|
-
if (!(n.
|
|
466
|
-
if (n.L) GlobalQueue.
|
|
490
|
+
if (!(n.Oe & STATUS_PENDING)) n.Oe &= ~STATUS_UNINITIALIZED;
|
|
491
|
+
if (n.L) GlobalQueue.ae(n, false, true);
|
|
467
492
|
}
|
|
468
493
|
e.length = 0;
|
|
469
494
|
}
|
|
@@ -471,39 +496,56 @@ function finalizePureQueue(e = null, t = false) {
|
|
|
471
496
|
const n = !t;
|
|
472
497
|
if (n) commitPendingNodes();
|
|
473
498
|
if (!t) checkBoundaryChildren(globalQueue);
|
|
474
|
-
if (dirtyQueue.
|
|
499
|
+
if (dirtyQueue.O >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.ce);
|
|
475
500
|
if (n) {
|
|
476
501
|
commitPendingNodes();
|
|
477
|
-
resolveOptimisticNodes(e ? e.
|
|
478
|
-
|
|
479
|
-
|
|
502
|
+
resolveOptimisticNodes(e ? e.q : globalQueue.q);
|
|
503
|
+
if (e && e.ee.size) {
|
|
504
|
+
for (const t of e.ee) {
|
|
505
|
+
if (t.R & REACTIVE_DISPOSED) continue;
|
|
506
|
+
if (t.M === EFFECT_TRACKED) {
|
|
507
|
+
if (!t.j) {
|
|
508
|
+
t.j = true;
|
|
509
|
+
t.$.enqueue(EFFECT_USER, t.K);
|
|
510
|
+
}
|
|
511
|
+
continue;
|
|
512
|
+
}
|
|
513
|
+
const e = t.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
514
|
+
if (e.P > t.o) e.P = t.o;
|
|
515
|
+
insertIntoHeap(t, e);
|
|
516
|
+
}
|
|
517
|
+
e.ee.clear();
|
|
518
|
+
}
|
|
519
|
+
const t = e ? e.X : globalQueue.X;
|
|
520
|
+
if (GlobalQueue.le && t.size) {
|
|
480
521
|
for (const e of t) {
|
|
481
|
-
GlobalQueue.
|
|
522
|
+
GlobalQueue.le(e);
|
|
482
523
|
}
|
|
483
524
|
t.clear();
|
|
484
525
|
schedule();
|
|
485
526
|
}
|
|
527
|
+
sweepTransientStoreNodes();
|
|
486
528
|
cleanupCompletedLanes(e);
|
|
487
529
|
}
|
|
488
530
|
}
|
|
489
531
|
function checkBoundaryChildren(e) {
|
|
490
|
-
for (const t of e.
|
|
532
|
+
for (const t of e.oe) {
|
|
491
533
|
t.checkSources?.();
|
|
492
534
|
checkBoundaryChildren(t);
|
|
493
535
|
}
|
|
494
536
|
}
|
|
495
537
|
function trackOptimisticStore(e) {
|
|
496
|
-
globalQueue.
|
|
538
|
+
globalQueue.X.add(e);
|
|
497
539
|
schedule();
|
|
498
540
|
}
|
|
499
541
|
function reassignPendingTransition(e) {
|
|
500
542
|
for (let t = 0; t < e.length; t++) {
|
|
501
|
-
e[t].
|
|
543
|
+
e[t].Z = activeTransition;
|
|
502
544
|
}
|
|
503
545
|
}
|
|
504
546
|
const globalQueue = new GlobalQueue();
|
|
505
547
|
function flush() {
|
|
506
|
-
if (globalQueue.
|
|
548
|
+
if (globalQueue.re) {
|
|
507
549
|
return;
|
|
508
550
|
}
|
|
509
551
|
while (scheduled || activeTransition) {
|
|
@@ -514,22 +556,22 @@ function runQueue(e, t) {
|
|
|
514
556
|
for (let n = 0; n < e.length; n++) e[n](t);
|
|
515
557
|
}
|
|
516
558
|
function reporterBlocksSource(e, t) {
|
|
517
|
-
if (e.
|
|
518
|
-
if (e.Re === t || e.
|
|
559
|
+
if (e.R & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
|
|
560
|
+
if (e.Re === t || e._e?.has(t)) return true;
|
|
519
561
|
for (let n = e.C; n; n = n.D) {
|
|
520
562
|
let e = n.m;
|
|
521
563
|
while (e) {
|
|
522
564
|
if (e === t || e.V === t) return true;
|
|
523
|
-
e = e.
|
|
565
|
+
e = e.Ie;
|
|
524
566
|
}
|
|
525
567
|
}
|
|
526
|
-
return !!(e.
|
|
568
|
+
return !!(e.Oe & STATUS_PENDING && e.Te instanceof NotReadyError && e.Te.source === t);
|
|
527
569
|
}
|
|
528
570
|
function transitionComplete(e) {
|
|
529
|
-
if (e.
|
|
530
|
-
if (e
|
|
571
|
+
if (e.Y) return true;
|
|
572
|
+
if (e.B.length) return false;
|
|
531
573
|
let t = true;
|
|
532
|
-
for (const [n, i] of e.
|
|
574
|
+
for (const [n, i] of e.J) {
|
|
533
575
|
let r = false;
|
|
534
576
|
for (const e of i) {
|
|
535
577
|
if (reporterBlocksSource(e, n)) {
|
|
@@ -538,32 +580,32 @@ function transitionComplete(e) {
|
|
|
538
580
|
}
|
|
539
581
|
i.delete(e);
|
|
540
582
|
}
|
|
541
|
-
if (!r) e.
|
|
542
|
-
else if (n.
|
|
583
|
+
if (!r) e.J.delete(n);
|
|
584
|
+
else if (n.Oe & STATUS_PENDING && n.Te?.source === n) {
|
|
543
585
|
t = false;
|
|
544
586
|
break;
|
|
545
587
|
}
|
|
546
588
|
}
|
|
547
589
|
if (t) {
|
|
548
|
-
for (let n = 0; n < e.
|
|
549
|
-
const i = e.
|
|
590
|
+
for (let n = 0; n < e.q.length; n++) {
|
|
591
|
+
const i = e.q[n];
|
|
550
592
|
if (
|
|
551
593
|
hasActiveOverride(i) &&
|
|
552
|
-
"
|
|
553
|
-
i.
|
|
554
|
-
i.
|
|
555
|
-
i.
|
|
594
|
+
"Oe" in i &&
|
|
595
|
+
i.Oe & STATUS_PENDING &&
|
|
596
|
+
i.Te instanceof NotReadyError &&
|
|
597
|
+
i.Te.source !== i
|
|
556
598
|
) {
|
|
557
599
|
t = false;
|
|
558
600
|
break;
|
|
559
601
|
}
|
|
560
602
|
}
|
|
561
603
|
}
|
|
562
|
-
t && (e.
|
|
604
|
+
t && (e.Y = true);
|
|
563
605
|
return t;
|
|
564
606
|
}
|
|
565
607
|
function currentTransition(e) {
|
|
566
|
-
while (e.
|
|
608
|
+
while (e.Y && typeof e.Y === "object") e = e.Y;
|
|
567
609
|
return e;
|
|
568
610
|
}
|
|
569
611
|
function setActiveTransition(e) {
|
|
@@ -585,111 +627,113 @@ function getOrCreateLane(e) {
|
|
|
585
627
|
if (t) {
|
|
586
628
|
return findLane(t);
|
|
587
629
|
}
|
|
588
|
-
const n = e.
|
|
589
|
-
const i = n?.
|
|
590
|
-
t = {
|
|
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 };
|
|
591
633
|
signalLanes.set(e, t);
|
|
592
634
|
activeLanes.add(t);
|
|
593
|
-
e.
|
|
635
|
+
e.pe = false;
|
|
594
636
|
return t;
|
|
595
637
|
}
|
|
596
638
|
function findLane(e) {
|
|
597
|
-
while (e.
|
|
639
|
+
while (e.F) e = e.F;
|
|
598
640
|
return e;
|
|
599
641
|
}
|
|
600
642
|
function mergeLanes(e, t) {
|
|
601
643
|
e = findLane(e);
|
|
602
644
|
t = findLane(t);
|
|
603
645
|
if (e === t) return e;
|
|
604
|
-
t.
|
|
605
|
-
for (const n of t.
|
|
606
|
-
e.
|
|
607
|
-
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]);
|
|
608
650
|
return e;
|
|
609
651
|
}
|
|
610
652
|
function resolveLane(e) {
|
|
611
|
-
const t = e.
|
|
653
|
+
const t = e.te;
|
|
612
654
|
if (!t) return undefined;
|
|
613
655
|
const n = findLane(t);
|
|
614
656
|
if (activeLanes.has(n)) return n;
|
|
615
|
-
e.
|
|
657
|
+
e.te = undefined;
|
|
616
658
|
return undefined;
|
|
617
659
|
}
|
|
618
660
|
function resolveTransition(e) {
|
|
619
|
-
return resolveLane(e)?.
|
|
661
|
+
return resolveLane(e)?.Z ?? e.Z;
|
|
620
662
|
}
|
|
621
663
|
function hasActiveOverride(e) {
|
|
622
|
-
return !!(e.
|
|
664
|
+
return !!(e.G !== undefined && e.G !== NOT_PENDING);
|
|
623
665
|
}
|
|
624
666
|
function assignOrMergeLane(e, t) {
|
|
625
667
|
const n = findLane(t);
|
|
626
|
-
const i = e.
|
|
668
|
+
const i = e.te;
|
|
627
669
|
if (i) {
|
|
628
|
-
if (i.
|
|
629
|
-
e.
|
|
670
|
+
if (i.F) {
|
|
671
|
+
e.te = t;
|
|
630
672
|
return;
|
|
631
673
|
}
|
|
632
674
|
const r = findLane(i);
|
|
633
675
|
if (activeLanes.has(r)) {
|
|
634
676
|
if (r !== n && !hasActiveOverride(e)) {
|
|
635
|
-
if (n.
|
|
636
|
-
e.
|
|
637
|
-
} else if (r.
|
|
677
|
+
if (n.he && findLane(n.he) === r) {
|
|
678
|
+
e.te = t;
|
|
679
|
+
} else if (r.he && findLane(r.he) === n);
|
|
638
680
|
else mergeLanes(n, r);
|
|
639
681
|
}
|
|
640
682
|
return;
|
|
641
683
|
}
|
|
642
684
|
}
|
|
643
|
-
e.
|
|
685
|
+
e.te = t;
|
|
644
686
|
}
|
|
645
687
|
function unlinkSubs(e) {
|
|
646
688
|
const t = e.m;
|
|
647
689
|
const n = e.D;
|
|
648
690
|
const i = e.h;
|
|
649
|
-
const r = e.
|
|
650
|
-
if (i !== null) i.
|
|
691
|
+
const r = e.Ne;
|
|
692
|
+
if (i !== null) i.Ne = r;
|
|
651
693
|
else t.Ae = r;
|
|
652
694
|
if (r !== null) r.h = i;
|
|
653
695
|
else {
|
|
654
696
|
t.I = i;
|
|
655
697
|
if (i === null) {
|
|
656
|
-
t.
|
|
657
|
-
|
|
698
|
+
t.k?.();
|
|
699
|
+
const e = t;
|
|
700
|
+
e.L && e.Ee & CONFIG_AUTO_DISPOSE && !(e.R & REACTIVE_ZOMBIE) && unobserved(e);
|
|
658
701
|
}
|
|
659
702
|
}
|
|
660
703
|
return n;
|
|
661
704
|
}
|
|
662
705
|
function unobserved(e) {
|
|
663
|
-
deleteFromHeap(e, e.
|
|
706
|
+
deleteFromHeap(e, e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
664
707
|
let t = e.C;
|
|
665
708
|
while (t !== null) {
|
|
666
709
|
t = unlinkSubs(t);
|
|
667
710
|
}
|
|
668
711
|
e.C = null;
|
|
712
|
+
e.Pe = null;
|
|
669
713
|
disposeChildren(e, true);
|
|
670
714
|
}
|
|
671
715
|
function link(e, t) {
|
|
672
|
-
const n = t.
|
|
716
|
+
const n = t.Pe;
|
|
673
717
|
if (n !== null && n.m === e) return;
|
|
674
718
|
let i = null;
|
|
675
|
-
const r = t.
|
|
719
|
+
const r = t.R & REACTIVE_RECOMPUTING_DEPS;
|
|
676
720
|
if (r) {
|
|
677
721
|
i = n !== null ? n.D : t.C;
|
|
678
722
|
if (i !== null && i.m === e) {
|
|
679
|
-
t.
|
|
723
|
+
t.Pe = i;
|
|
680
724
|
return;
|
|
681
725
|
}
|
|
682
726
|
}
|
|
683
727
|
const s = e.Ae;
|
|
684
728
|
if (s !== null && s.p === t && (!r || isValidLink(s, t))) return;
|
|
685
|
-
const o = (t.
|
|
729
|
+
const o = (t.Pe = e.Ae = { m: e, p: t, D: i, Ne: s, h: null });
|
|
686
730
|
if (n !== null) n.D = o;
|
|
687
731
|
else t.C = o;
|
|
688
732
|
if (s !== null) s.h = o;
|
|
689
733
|
else e.I = o;
|
|
690
734
|
}
|
|
691
735
|
function isValidLink(e, t) {
|
|
692
|
-
const n = t.
|
|
736
|
+
const n = t.Pe;
|
|
693
737
|
if (n !== null) {
|
|
694
738
|
let i = t.C;
|
|
695
739
|
do {
|
|
@@ -704,13 +748,13 @@ const PENDING_OWNER = {};
|
|
|
704
748
|
function markDisposal(e) {
|
|
705
749
|
let t = e.Ce;
|
|
706
750
|
while (t) {
|
|
707
|
-
t.
|
|
708
|
-
if (t.
|
|
751
|
+
t.R |= REACTIVE_ZOMBIE;
|
|
752
|
+
if (t.R & REACTIVE_IN_HEAP) {
|
|
709
753
|
deleteFromHeap(t, dirtyQueue);
|
|
710
754
|
insertIntoHeap(t, zombieQueue);
|
|
711
755
|
}
|
|
712
756
|
markDisposal(t);
|
|
713
|
-
t = t.
|
|
757
|
+
t = t.ge;
|
|
714
758
|
}
|
|
715
759
|
}
|
|
716
760
|
function dispose(e) {
|
|
@@ -719,39 +763,39 @@ function dispose(e) {
|
|
|
719
763
|
t = unlinkSubs(t);
|
|
720
764
|
} while (t !== null);
|
|
721
765
|
e.C = null;
|
|
722
|
-
e.
|
|
766
|
+
e.Pe = null;
|
|
723
767
|
disposeChildren(e, true);
|
|
724
768
|
}
|
|
725
769
|
function disposeChildren(e, t = false, n) {
|
|
726
|
-
if (e.
|
|
727
|
-
if (t) e.
|
|
728
|
-
if (t && e.L) e.
|
|
729
|
-
let i = n ? e.
|
|
770
|
+
if (e.R & REACTIVE_DISPOSED) return;
|
|
771
|
+
if (t) e.R = REACTIVE_DISPOSED;
|
|
772
|
+
if (t && e.L) e.De = null;
|
|
773
|
+
let i = n ? e.ye : e.Ce;
|
|
730
774
|
while (i) {
|
|
731
|
-
const e = i.
|
|
775
|
+
const e = i.ge;
|
|
732
776
|
if (i.C) {
|
|
733
777
|
const e = i;
|
|
734
|
-
deleteFromHeap(e, e.
|
|
778
|
+
deleteFromHeap(e, e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
735
779
|
let t = e.C;
|
|
736
780
|
do {
|
|
737
781
|
t = unlinkSubs(t);
|
|
738
782
|
} while (t !== null);
|
|
739
783
|
e.C = null;
|
|
740
|
-
e.
|
|
784
|
+
e.Pe = null;
|
|
741
785
|
}
|
|
742
786
|
disposeChildren(i, true);
|
|
743
787
|
i = e;
|
|
744
788
|
}
|
|
745
789
|
if (n) {
|
|
746
|
-
e.
|
|
790
|
+
e.ye = null;
|
|
747
791
|
} else {
|
|
748
792
|
e.Ce = null;
|
|
749
|
-
e.
|
|
793
|
+
e.ve = 0;
|
|
750
794
|
}
|
|
751
795
|
runDisposal(e, n);
|
|
752
796
|
}
|
|
753
797
|
function runDisposal(e, t) {
|
|
754
|
-
let n = t ? e.
|
|
798
|
+
let n = t ? e.me : e.we;
|
|
755
799
|
if (!n) return;
|
|
756
800
|
if (Array.isArray(n)) {
|
|
757
801
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -761,12 +805,12 @@ function runDisposal(e, t) {
|
|
|
761
805
|
} else {
|
|
762
806
|
n.call(n);
|
|
763
807
|
}
|
|
764
|
-
t ? (e.
|
|
808
|
+
t ? (e.me = null) : (e.we = null);
|
|
765
809
|
}
|
|
766
810
|
function childId(e, t) {
|
|
767
811
|
let n = e;
|
|
768
|
-
while (n.
|
|
769
|
-
if (n.id != null) return formatId(n.id, t ? n.
|
|
812
|
+
while (n.Ee & CONFIG_TRANSPARENT && n.i) n = n.i;
|
|
813
|
+
if (n.id != null) return formatId(n.id, t ? n.ve++ : n.ve);
|
|
770
814
|
throw new Error("Cannot get child id from owner without an id");
|
|
771
815
|
}
|
|
772
816
|
function getNextChildId(e) {
|
|
@@ -789,30 +833,30 @@ function getOwner() {
|
|
|
789
833
|
}
|
|
790
834
|
function cleanup(e) {
|
|
791
835
|
if (!context) return e;
|
|
792
|
-
if (!context.
|
|
793
|
-
else if (Array.isArray(context.
|
|
794
|
-
else context.
|
|
836
|
+
if (!context.we) context.we = e;
|
|
837
|
+
else if (Array.isArray(context.we)) context.we.push(e);
|
|
838
|
+
else context.we = [context.we, e];
|
|
795
839
|
return e;
|
|
796
840
|
}
|
|
797
841
|
function isDisposed(e) {
|
|
798
|
-
return !!(e.
|
|
842
|
+
return !!(e.R & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
|
|
799
843
|
}
|
|
800
844
|
function createOwner(e) {
|
|
801
845
|
const t = context;
|
|
802
846
|
const n = e?.transparent ?? false;
|
|
803
847
|
const i = {
|
|
804
848
|
id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
|
|
805
|
-
|
|
849
|
+
Ee: n ? CONFIG_TRANSPARENT : 0,
|
|
806
850
|
t: true,
|
|
807
851
|
u: t?.t ? t.u : t,
|
|
808
852
|
Ce: null,
|
|
809
|
-
|
|
810
|
-
Ve: null,
|
|
811
|
-
F: t?.F ?? globalQueue,
|
|
812
|
-
Le: t?.Le || defaultContext,
|
|
813
|
-
me: 0,
|
|
853
|
+
ge: null,
|
|
814
854
|
we: null,
|
|
815
|
-
|
|
855
|
+
$: t?.$ ?? globalQueue,
|
|
856
|
+
Ve: t?.Ve || defaultContext,
|
|
857
|
+
ve: 0,
|
|
858
|
+
me: null,
|
|
859
|
+
ye: null,
|
|
816
860
|
i: t,
|
|
817
861
|
dispose(e = true) {
|
|
818
862
|
disposeChildren(i, e);
|
|
@@ -823,7 +867,7 @@ function createOwner(e) {
|
|
|
823
867
|
if (e === null) {
|
|
824
868
|
t.Ce = i;
|
|
825
869
|
} else {
|
|
826
|
-
i.
|
|
870
|
+
i.ge = e;
|
|
827
871
|
t.Ce = i;
|
|
828
872
|
}
|
|
829
873
|
}
|
|
@@ -834,15 +878,15 @@ function createRoot(e, t) {
|
|
|
834
878
|
return runWithOwner(n, () => e(n.dispose));
|
|
835
879
|
}
|
|
836
880
|
function addPendingSource(e, t) {
|
|
837
|
-
if (e.Re === t || e.
|
|
881
|
+
if (e.Re === t || e._e?.has(t)) return false;
|
|
838
882
|
if (!e.Re) {
|
|
839
883
|
e.Re = t;
|
|
840
884
|
return true;
|
|
841
885
|
}
|
|
842
|
-
if (!e.
|
|
843
|
-
e.
|
|
886
|
+
if (!e._e) {
|
|
887
|
+
e._e = new Set([e.Re, t]);
|
|
844
888
|
} else {
|
|
845
|
-
e.
|
|
889
|
+
e._e.add(t);
|
|
846
890
|
}
|
|
847
891
|
e.Re = undefined;
|
|
848
892
|
return true;
|
|
@@ -853,37 +897,37 @@ function removePendingSource(e, t) {
|
|
|
853
897
|
e.Re = undefined;
|
|
854
898
|
return true;
|
|
855
899
|
}
|
|
856
|
-
if (!e.
|
|
857
|
-
if (e.
|
|
858
|
-
e.Re = e.
|
|
859
|
-
e.
|
|
860
|
-
} else if (e.
|
|
861
|
-
e.
|
|
900
|
+
if (!e._e?.delete(t)) return false;
|
|
901
|
+
if (e._e.size === 1) {
|
|
902
|
+
e.Re = e._e.values().next().value;
|
|
903
|
+
e._e = undefined;
|
|
904
|
+
} else if (e._e.size === 0) {
|
|
905
|
+
e._e = undefined;
|
|
862
906
|
}
|
|
863
907
|
return true;
|
|
864
908
|
}
|
|
865
909
|
function clearPendingSources(e) {
|
|
866
910
|
e.Re = undefined;
|
|
867
|
-
e.
|
|
868
|
-
e.
|
|
911
|
+
e._e?.clear();
|
|
912
|
+
e._e = undefined;
|
|
869
913
|
}
|
|
870
914
|
function setPendingError(e, t, n) {
|
|
871
915
|
if (!t) {
|
|
872
|
-
e.
|
|
916
|
+
e.Te = null;
|
|
873
917
|
return;
|
|
874
918
|
}
|
|
875
919
|
if (n instanceof NotReadyError && n.source === t) {
|
|
876
|
-
e.
|
|
920
|
+
e.Te = n;
|
|
877
921
|
return;
|
|
878
922
|
}
|
|
879
|
-
const i = e.
|
|
923
|
+
const i = e.Te;
|
|
880
924
|
if (!(i instanceof NotReadyError) || i.source !== t) {
|
|
881
|
-
e.
|
|
925
|
+
e.Te = new NotReadyError(t);
|
|
882
926
|
}
|
|
883
927
|
}
|
|
884
928
|
function forEachDependent(e, t) {
|
|
885
929
|
for (let n = e.I; n !== null; n = n.h) t(n.p);
|
|
886
|
-
for (let n = e.
|
|
930
|
+
for (let n = e.N; n !== null; n = n.A) {
|
|
887
931
|
for (let e = n.I; e !== null; e = e.h) t(e.p);
|
|
888
932
|
}
|
|
889
933
|
}
|
|
@@ -893,30 +937,30 @@ function settlePendingSource(e) {
|
|
|
893
937
|
const settle = i => {
|
|
894
938
|
if (n.has(i) || !removePendingSource(i, e)) return;
|
|
895
939
|
n.add(i);
|
|
896
|
-
i.
|
|
897
|
-
const r = i.Re ?? i.
|
|
940
|
+
i.Se = clock;
|
|
941
|
+
const r = i.Re ?? i._e?.values().next().value;
|
|
898
942
|
if (r) {
|
|
899
943
|
setPendingError(i, r);
|
|
900
944
|
updatePendingSignal(i);
|
|
901
945
|
} else {
|
|
902
|
-
i.
|
|
946
|
+
i.Oe &= ~STATUS_PENDING;
|
|
903
947
|
setPendingError(i);
|
|
904
948
|
updatePendingSignal(i);
|
|
905
|
-
if (i.
|
|
906
|
-
if (i.
|
|
949
|
+
if (i.be) {
|
|
950
|
+
if (i.M === EFFECT_TRACKED) {
|
|
907
951
|
const e = i;
|
|
908
|
-
if (!e.
|
|
909
|
-
e.
|
|
910
|
-
e
|
|
952
|
+
if (!e.j) {
|
|
953
|
+
e.j = true;
|
|
954
|
+
e.$.enqueue(EFFECT_USER, e.K);
|
|
911
955
|
}
|
|
912
956
|
} else {
|
|
913
|
-
const e = i.
|
|
957
|
+
const e = i.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
|
|
914
958
|
if (e.P > i.o) e.P = i.o;
|
|
915
959
|
insertIntoHeap(i, e);
|
|
916
960
|
}
|
|
917
961
|
t = true;
|
|
918
962
|
}
|
|
919
|
-
i.
|
|
963
|
+
i.be = false;
|
|
920
964
|
}
|
|
921
965
|
forEachDependent(i, settle);
|
|
922
966
|
};
|
|
@@ -928,42 +972,42 @@ function handleAsync(e, t, n) {
|
|
|
928
972
|
const r = i && untrack(() => t[Symbol.asyncIterator]);
|
|
929
973
|
const s = !r && i && untrack(() => typeof t.then === "function");
|
|
930
974
|
if (!s && !r) {
|
|
931
|
-
e.
|
|
975
|
+
e.De = null;
|
|
932
976
|
return t;
|
|
933
977
|
}
|
|
934
|
-
e.
|
|
978
|
+
e.De = t;
|
|
935
979
|
let o;
|
|
936
980
|
const handleError = n => {
|
|
937
|
-
if (e.
|
|
981
|
+
if (e.De !== t) return;
|
|
938
982
|
globalQueue.initTransition(resolveTransition(e));
|
|
939
983
|
notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
|
|
940
|
-
e.
|
|
984
|
+
e.Se = clock;
|
|
941
985
|
};
|
|
942
986
|
const asyncWrite = (i, r) => {
|
|
943
|
-
if (e.
|
|
944
|
-
if (e.
|
|
987
|
+
if (e.De !== t) return;
|
|
988
|
+
if (e.R & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
|
|
945
989
|
globalQueue.initTransition(resolveTransition(e));
|
|
946
|
-
const s = !!(e.
|
|
990
|
+
const s = !!(e.Oe & STATUS_UNINITIALIZED);
|
|
947
991
|
clearStatus(e);
|
|
948
992
|
const o = resolveLane(e);
|
|
949
|
-
if (o) o.
|
|
993
|
+
if (o) o.W.delete(e);
|
|
950
994
|
if (n) n(i);
|
|
951
|
-
else if (e.
|
|
952
|
-
if (e.
|
|
995
|
+
else if (e.G !== undefined) {
|
|
996
|
+
if (e.G !== undefined && e.G !== NOT_PENDING) e.U = i;
|
|
953
997
|
else {
|
|
954
|
-
e.
|
|
998
|
+
e.ne = i;
|
|
955
999
|
insertSubs(e);
|
|
956
1000
|
}
|
|
957
|
-
e.
|
|
1001
|
+
e.Se = clock;
|
|
958
1002
|
} else if (o) {
|
|
959
|
-
const t = e.
|
|
960
|
-
const n = e.
|
|
961
|
-
const r = e.
|
|
1003
|
+
const t = e.M;
|
|
1004
|
+
const n = e.ne;
|
|
1005
|
+
const r = e.Le;
|
|
962
1006
|
if ((!t && s) || !r || !r(i, n)) {
|
|
963
|
-
e.
|
|
964
|
-
e.
|
|
965
|
-
if (e.
|
|
966
|
-
setSignal(e.
|
|
1007
|
+
e.ne = i;
|
|
1008
|
+
e.Se = clock;
|
|
1009
|
+
if (e.Ue) {
|
|
1010
|
+
setSignal(e.Ue, i);
|
|
967
1011
|
}
|
|
968
1012
|
insertSubs(e, true);
|
|
969
1013
|
}
|
|
@@ -1019,7 +1063,7 @@ function handleAsync(e, t, n) {
|
|
|
1019
1063
|
s = n;
|
|
1020
1064
|
u = true;
|
|
1021
1065
|
if (n.done) r = true;
|
|
1022
|
-
} else if (e.
|
|
1066
|
+
} else if (e.De !== t) {
|
|
1023
1067
|
return;
|
|
1024
1068
|
} else if (!n.done) asyncWrite(n.value, iterate);
|
|
1025
1069
|
else {
|
|
@@ -1029,7 +1073,7 @@ function handleAsync(e, t, n) {
|
|
|
1029
1073
|
}
|
|
1030
1074
|
},
|
|
1031
1075
|
n => {
|
|
1032
|
-
if (!c && e.
|
|
1076
|
+
if (!c && e.De === t) {
|
|
1033
1077
|
r = true;
|
|
1034
1078
|
handleError(n);
|
|
1035
1079
|
}
|
|
@@ -1053,8 +1097,8 @@ function handleAsync(e, t, n) {
|
|
|
1053
1097
|
}
|
|
1054
1098
|
function clearStatus(e, t = false) {
|
|
1055
1099
|
clearPendingSources(e);
|
|
1056
|
-
e.
|
|
1057
|
-
e.
|
|
1100
|
+
e.be = false;
|
|
1101
|
+
e.Oe = t ? 0 : e.Oe & STATUS_UNINITIALIZED;
|
|
1058
1102
|
setPendingError(e);
|
|
1059
1103
|
updatePendingSignal(e);
|
|
1060
1104
|
e.Ge?.();
|
|
@@ -1064,17 +1108,17 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
1064
1108
|
n = new StatusError(e, n);
|
|
1065
1109
|
const s = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
|
|
1066
1110
|
const o = s === e;
|
|
1067
|
-
const u = t === STATUS_PENDING && e.
|
|
1111
|
+
const u = t === STATUS_PENDING && e.G !== undefined && !o;
|
|
1068
1112
|
const c = u && hasActiveOverride(e);
|
|
1069
1113
|
if (!i) {
|
|
1070
1114
|
if (t === STATUS_PENDING && s) {
|
|
1071
1115
|
addPendingSource(e, s);
|
|
1072
|
-
e.
|
|
1116
|
+
e.Oe = STATUS_PENDING | (e.Oe & STATUS_UNINITIALIZED);
|
|
1073
1117
|
setPendingError(e, s, n);
|
|
1074
1118
|
} else {
|
|
1075
1119
|
clearPendingSources(e);
|
|
1076
|
-
e.
|
|
1077
|
-
e.
|
|
1120
|
+
e.Oe = t | (t !== STATUS_ERROR ? e.Oe & STATUS_UNINITIALIZED : 0);
|
|
1121
|
+
e.Te = n;
|
|
1078
1122
|
}
|
|
1079
1123
|
updatePendingSignal(e);
|
|
1080
1124
|
}
|
|
@@ -1095,12 +1139,12 @@ function notifyStatus(e, t, n, i, r) {
|
|
|
1095
1139
|
return;
|
|
1096
1140
|
}
|
|
1097
1141
|
forEachDependent(e, e => {
|
|
1098
|
-
e.
|
|
1142
|
+
e.Se = clock;
|
|
1099
1143
|
if (
|
|
1100
|
-
(t === STATUS_PENDING && s && e.Re !== s && !e.
|
|
1101
|
-
(t !== STATUS_PENDING && (e.
|
|
1144
|
+
(t === STATUS_PENDING && s && e.Re !== s && !e._e?.has(s)) ||
|
|
1145
|
+
(t !== STATUS_PENDING && (e.Te !== n || e.Re || e._e))
|
|
1102
1146
|
) {
|
|
1103
|
-
if (!a && !e.
|
|
1147
|
+
if (!a && !e.Z) globalQueue.ue.push(e);
|
|
1104
1148
|
notifyStatus(e, t, n, a, l);
|
|
1105
1149
|
}
|
|
1106
1150
|
});
|
|
@@ -1128,8 +1172,8 @@ function enableExternalSource(e) {
|
|
|
1128
1172
|
externalSourceConfig = { factory: t, untrack: n };
|
|
1129
1173
|
}
|
|
1130
1174
|
}
|
|
1131
|
-
GlobalQueue.
|
|
1132
|
-
GlobalQueue.
|
|
1175
|
+
GlobalQueue.ce = recompute;
|
|
1176
|
+
GlobalQueue.ae = disposeChildren;
|
|
1133
1177
|
let tracking = false;
|
|
1134
1178
|
let stale = false;
|
|
1135
1179
|
let refreshing = false;
|
|
@@ -1142,7 +1186,7 @@ let snapshotCaptureActive = false;
|
|
|
1142
1186
|
let snapshotSources = null;
|
|
1143
1187
|
function ownerInSnapshotScope(e) {
|
|
1144
1188
|
while (e) {
|
|
1145
|
-
if (e.
|
|
1189
|
+
if (e.ke) return true;
|
|
1146
1190
|
e = e.i;
|
|
1147
1191
|
}
|
|
1148
1192
|
return false;
|
|
@@ -1152,32 +1196,32 @@ function setSnapshotCapture(e) {
|
|
|
1152
1196
|
if (e && !snapshotSources) snapshotSources = new Set();
|
|
1153
1197
|
}
|
|
1154
1198
|
function markSnapshotScope(e) {
|
|
1155
|
-
e.
|
|
1199
|
+
e.ke = true;
|
|
1156
1200
|
}
|
|
1157
1201
|
function releaseSnapshotScope(e) {
|
|
1158
|
-
e.
|
|
1202
|
+
e.ke = false;
|
|
1159
1203
|
releaseSubtree(e);
|
|
1160
1204
|
schedule();
|
|
1161
1205
|
}
|
|
1162
1206
|
function releaseSubtree(e) {
|
|
1163
1207
|
let t = e.Ce;
|
|
1164
1208
|
while (t) {
|
|
1165
|
-
if (t.
|
|
1166
|
-
t = t.
|
|
1209
|
+
if (t.ke) {
|
|
1210
|
+
t = t.ge;
|
|
1167
1211
|
continue;
|
|
1168
1212
|
}
|
|
1169
1213
|
if (t.L) {
|
|
1170
1214
|
const e = t;
|
|
1171
|
-
e.
|
|
1172
|
-
if (e.
|
|
1173
|
-
e.
|
|
1174
|
-
e.
|
|
1215
|
+
e.Ee &= ~CONFIG_IN_SNAPSHOT_SCOPE;
|
|
1216
|
+
if (e.R & REACTIVE_SNAPSHOT_STALE) {
|
|
1217
|
+
e.R &= ~REACTIVE_SNAPSHOT_STALE;
|
|
1218
|
+
e.R |= REACTIVE_DIRTY;
|
|
1175
1219
|
if (dirtyQueue.P > e.o) dirtyQueue.P = e.o;
|
|
1176
1220
|
insertIntoHeap(e, dirtyQueue);
|
|
1177
1221
|
}
|
|
1178
1222
|
}
|
|
1179
1223
|
releaseSubtree(t);
|
|
1180
|
-
t = t.
|
|
1224
|
+
t = t.ge;
|
|
1181
1225
|
}
|
|
1182
1226
|
}
|
|
1183
1227
|
function clearSnapshots() {
|
|
@@ -1191,32 +1235,32 @@ function clearSnapshots() {
|
|
|
1191
1235
|
snapshotCaptureActive = false;
|
|
1192
1236
|
}
|
|
1193
1237
|
function recompute(e, t = false) {
|
|
1194
|
-
const n = e.
|
|
1238
|
+
const n = e.M;
|
|
1195
1239
|
if (!t) {
|
|
1196
|
-
if (e.
|
|
1197
|
-
globalQueue.initTransition(e.
|
|
1198
|
-
deleteFromHeap(e, e.
|
|
1199
|
-
e.
|
|
1200
|
-
if (e.
|
|
1240
|
+
if (e.Z && (!n || activeTransition) && activeTransition !== e.Z)
|
|
1241
|
+
globalQueue.initTransition(e.Z);
|
|
1242
|
+
deleteFromHeap(e, e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1243
|
+
e.De = null;
|
|
1244
|
+
if (e.Z || n === EFFECT_TRACKED) disposeChildren(e);
|
|
1201
1245
|
else {
|
|
1202
1246
|
markDisposal(e);
|
|
1203
|
-
e.
|
|
1204
|
-
e.
|
|
1205
|
-
e.
|
|
1247
|
+
e.me = e.we;
|
|
1248
|
+
e.ye = e.Ce;
|
|
1249
|
+
e.we = null;
|
|
1206
1250
|
e.Ce = null;
|
|
1207
|
-
e.
|
|
1251
|
+
e.ve = 0;
|
|
1208
1252
|
}
|
|
1209
1253
|
}
|
|
1210
|
-
|
|
1211
|
-
const r = e.
|
|
1212
|
-
const s = !!(e.
|
|
1213
|
-
const o = !!(e.
|
|
1254
|
+
let i = !!(e.R & REACTIVE_OPTIMISTIC_DIRTY);
|
|
1255
|
+
const r = e.G !== undefined && e.G !== NOT_PENDING;
|
|
1256
|
+
const s = !!(e.Oe & STATUS_PENDING);
|
|
1257
|
+
const o = !!(e.Oe & STATUS_UNINITIALIZED);
|
|
1214
1258
|
const u = context;
|
|
1215
1259
|
context = e;
|
|
1216
|
-
e.
|
|
1217
|
-
e.
|
|
1218
|
-
e.
|
|
1219
|
-
let c = e.
|
|
1260
|
+
e.Pe = null;
|
|
1261
|
+
e.R = REACTIVE_RECOMPUTING_DEPS;
|
|
1262
|
+
e.Se = clock;
|
|
1263
|
+
let c = e.U === NOT_PENDING ? e.ne : e.U;
|
|
1220
1264
|
let a = e.o;
|
|
1221
1265
|
let l = tracking;
|
|
1222
1266
|
let f = currentOptimisticLane;
|
|
@@ -1224,39 +1268,55 @@ function recompute(e, t = false) {
|
|
|
1224
1268
|
if (i) {
|
|
1225
1269
|
const t = resolveLane(e);
|
|
1226
1270
|
if (t) currentOptimisticLane = t;
|
|
1271
|
+
} else if (activeTransition && !t && activeTransition.q.length) {
|
|
1272
|
+
for (let t = e.C; t; t = t.D) {
|
|
1273
|
+
const n = t.m;
|
|
1274
|
+
if (n.R & REACTIVE_OPTIMISTIC_DIRTY) {
|
|
1275
|
+
const t = resolveLane(n);
|
|
1276
|
+
if (t) {
|
|
1277
|
+
i = true;
|
|
1278
|
+
currentOptimisticLane = t;
|
|
1279
|
+
e.R |= REACTIVE_OPTIMISTIC_DIRTY;
|
|
1280
|
+
assignOrMergeLane(e, t);
|
|
1281
|
+
break;
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1227
1285
|
}
|
|
1228
1286
|
try {
|
|
1229
|
-
|
|
1287
|
+
const n = e.De;
|
|
1288
|
+
const i = e.L(c);
|
|
1289
|
+
c = e.De !== n ? i : handleAsync(e, i);
|
|
1230
1290
|
clearStatus(e, t);
|
|
1231
|
-
const
|
|
1232
|
-
if (
|
|
1233
|
-
|
|
1234
|
-
updatePendingSignal(
|
|
1291
|
+
const r = resolveLane(e);
|
|
1292
|
+
if (r) {
|
|
1293
|
+
r.W.delete(e);
|
|
1294
|
+
updatePendingSignal(r.ie);
|
|
1235
1295
|
}
|
|
1236
1296
|
} catch (t) {
|
|
1237
1297
|
if (t instanceof NotReadyError && currentOptimisticLane) {
|
|
1238
1298
|
const t = findLane(currentOptimisticLane);
|
|
1239
|
-
if (t.
|
|
1240
|
-
t.
|
|
1241
|
-
e.
|
|
1242
|
-
updatePendingSignal(t.
|
|
1299
|
+
if (t.ie !== e) {
|
|
1300
|
+
t.W.add(e);
|
|
1301
|
+
e.te = t;
|
|
1302
|
+
updatePendingSignal(t.ie);
|
|
1243
1303
|
}
|
|
1244
1304
|
}
|
|
1245
|
-
if (t instanceof NotReadyError) e.
|
|
1305
|
+
if (t instanceof NotReadyError) e.be = true;
|
|
1246
1306
|
notifyStatus(
|
|
1247
1307
|
e,
|
|
1248
1308
|
t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
|
|
1249
1309
|
t,
|
|
1250
1310
|
undefined,
|
|
1251
|
-
t instanceof NotReadyError ? e.
|
|
1311
|
+
t instanceof NotReadyError ? e.te : undefined
|
|
1252
1312
|
);
|
|
1253
1313
|
} finally {
|
|
1254
1314
|
tracking = l;
|
|
1255
|
-
e.
|
|
1315
|
+
e.R = REACTIVE_NONE | (t ? e.R & REACTIVE_SNAPSHOT_STALE : 0);
|
|
1256
1316
|
context = u;
|
|
1257
1317
|
}
|
|
1258
|
-
if (!e.
|
|
1259
|
-
const u = e.
|
|
1318
|
+
if (!e.Te) {
|
|
1319
|
+
const u = e.Pe;
|
|
1260
1320
|
let l = u !== null ? u.D : e.C;
|
|
1261
1321
|
if (l !== null) {
|
|
1262
1322
|
do {
|
|
@@ -1265,132 +1325,133 @@ function recompute(e, t = false) {
|
|
|
1265
1325
|
if (u !== null) u.D = null;
|
|
1266
1326
|
else e.C = null;
|
|
1267
1327
|
}
|
|
1268
|
-
const f = r ? e.
|
|
1269
|
-
const E = (!n && o) || !e.
|
|
1328
|
+
const f = r ? e.G : e.U === NOT_PENDING ? e.ne : e.U;
|
|
1329
|
+
const E = (!n && o) || !e.Le || !e.Le(f, c);
|
|
1270
1330
|
if (E) {
|
|
1271
|
-
const o = r ? e.
|
|
1272
|
-
if (t || (n && activeTransition !== e.
|
|
1273
|
-
e.
|
|
1331
|
+
const o = r ? e.G : undefined;
|
|
1332
|
+
if (t || (n && activeTransition !== e.Z) || i) {
|
|
1333
|
+
e.ne = c;
|
|
1274
1334
|
if (r && i) {
|
|
1275
|
-
e.
|
|
1276
|
-
e.
|
|
1335
|
+
e.G = c;
|
|
1336
|
+
e.U = c;
|
|
1277
1337
|
}
|
|
1278
|
-
} else e.
|
|
1279
|
-
if (r && !i && s && !e.
|
|
1280
|
-
if (!r || i || e.
|
|
1338
|
+
} else e.U = c;
|
|
1339
|
+
if (r && !i && s && !e.pe) e.G = c;
|
|
1340
|
+
if (!r || i || e.G !== o) insertSubs(e, i || r);
|
|
1281
1341
|
} else if (r) {
|
|
1282
|
-
e.
|
|
1342
|
+
e.U = c;
|
|
1283
1343
|
} else if (e.o != a) {
|
|
1284
1344
|
for (let t = e.I; t !== null; t = t.h) {
|
|
1285
|
-
insertIntoHeapHeight(t.p, t.p.
|
|
1345
|
+
insertIntoHeapHeight(t.p, t.p.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
|
|
1286
1346
|
}
|
|
1287
1347
|
}
|
|
1288
1348
|
}
|
|
1289
1349
|
currentOptimisticLane = f;
|
|
1290
|
-
(!t || e.
|
|
1291
|
-
e.
|
|
1350
|
+
(!t || e.Oe & STATUS_PENDING) && !e.Z && !(activeTransition && r) && globalQueue.ue.push(e);
|
|
1351
|
+
e.Z && n && activeTransition !== e.Z && runInTransition(e.Z, () => recompute(e));
|
|
1292
1352
|
}
|
|
1293
1353
|
function updateIfNecessary(e) {
|
|
1294
|
-
if (e.
|
|
1354
|
+
if (e.R & REACTIVE_CHECK) {
|
|
1295
1355
|
for (let t = e.C; t; t = t.D) {
|
|
1296
1356
|
const n = t.m;
|
|
1297
1357
|
const i = n.V || n;
|
|
1298
1358
|
if (i.L) {
|
|
1299
1359
|
updateIfNecessary(i);
|
|
1300
1360
|
}
|
|
1301
|
-
if (e.
|
|
1361
|
+
if (e.R & REACTIVE_DIRTY) {
|
|
1302
1362
|
break;
|
|
1303
1363
|
}
|
|
1304
1364
|
}
|
|
1305
1365
|
}
|
|
1306
|
-
if (e.
|
|
1366
|
+
if (e.R & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.Te && e.Se < clock && !e.De)) {
|
|
1307
1367
|
recompute(e);
|
|
1308
1368
|
}
|
|
1309
|
-
e.
|
|
1310
|
-
}
|
|
1311
|
-
function computed(e, t
|
|
1312
|
-
const
|
|
1313
|
-
const
|
|
1314
|
-
id:
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1369
|
+
e.R = e.R & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
|
|
1370
|
+
}
|
|
1371
|
+
function computed(e, t) {
|
|
1372
|
+
const n = t?.transparent ?? false;
|
|
1373
|
+
const i = {
|
|
1374
|
+
id: t?.id ?? (n ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
|
|
1375
|
+
Ee:
|
|
1376
|
+
(n ? CONFIG_TRANSPARENT : 0) |
|
|
1377
|
+
(t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
|
|
1378
|
+
(!context || t?.lazy ? CONFIG_AUTO_DISPOSE : 0) |
|
|
1379
|
+
(snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
|
|
1380
|
+
Le: t?.equals != null ? t.equals : isEqual,
|
|
1381
|
+
k: t?.unobserved,
|
|
1382
|
+
we: null,
|
|
1383
|
+
$: context?.$ ?? globalQueue,
|
|
1384
|
+
Ve: context?.Ve ?? defaultContext,
|
|
1385
|
+
ve: 0,
|
|
1323
1386
|
L: e,
|
|
1324
|
-
|
|
1387
|
+
ne: undefined,
|
|
1325
1388
|
o: 0,
|
|
1326
|
-
|
|
1389
|
+
N: null,
|
|
1327
1390
|
S: undefined,
|
|
1328
1391
|
T: null,
|
|
1329
1392
|
C: null,
|
|
1330
|
-
|
|
1393
|
+
Pe: null,
|
|
1331
1394
|
I: null,
|
|
1332
1395
|
Ae: null,
|
|
1333
1396
|
i: context,
|
|
1334
|
-
|
|
1397
|
+
ge: null,
|
|
1335
1398
|
Ce: null,
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
ve: null,
|
|
1399
|
+
R: t?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
|
|
1400
|
+
Oe: STATUS_UNINITIALIZED,
|
|
1401
|
+
Se: clock,
|
|
1402
|
+
U: NOT_PENDING,
|
|
1403
|
+
me: null,
|
|
1342
1404
|
ye: null,
|
|
1343
|
-
|
|
1405
|
+
De: null,
|
|
1406
|
+
Z: null
|
|
1344
1407
|
};
|
|
1345
|
-
|
|
1346
|
-
const
|
|
1408
|
+
i.T = i;
|
|
1409
|
+
const r = context?.t ? context.u : context;
|
|
1347
1410
|
if (context) {
|
|
1348
1411
|
const e = context.Ce;
|
|
1349
1412
|
if (e === null) {
|
|
1350
|
-
context.Ce =
|
|
1413
|
+
context.Ce = i;
|
|
1351
1414
|
} else {
|
|
1352
|
-
|
|
1353
|
-
context.Ce =
|
|
1415
|
+
i.ge = e;
|
|
1416
|
+
context.Ce = i;
|
|
1354
1417
|
}
|
|
1355
1418
|
}
|
|
1356
|
-
if (
|
|
1357
|
-
if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.Te = true;
|
|
1419
|
+
if (r) i.o = r.o + 1;
|
|
1358
1420
|
if (externalSourceConfig) {
|
|
1359
|
-
const e = signal(undefined, { equals: false,
|
|
1360
|
-
const t = externalSourceConfig.factory(
|
|
1421
|
+
const e = signal(undefined, { equals: false, ownedWrite: true });
|
|
1422
|
+
const t = externalSourceConfig.factory(i.L, () => {
|
|
1361
1423
|
setSignal(e, undefined);
|
|
1362
1424
|
});
|
|
1363
1425
|
cleanup(() => t.dispose());
|
|
1364
|
-
|
|
1426
|
+
i.L = n => {
|
|
1365
1427
|
read(e);
|
|
1366
1428
|
return t.track(n);
|
|
1367
1429
|
};
|
|
1368
1430
|
}
|
|
1369
|
-
!
|
|
1370
|
-
if (snapshotCaptureActive && !
|
|
1371
|
-
if (!(
|
|
1372
|
-
|
|
1373
|
-
snapshotSources.add(
|
|
1431
|
+
!t?.lazy && recompute(i, true);
|
|
1432
|
+
if (snapshotCaptureActive && !t?.lazy) {
|
|
1433
|
+
if (!(i.Oe & STATUS_PENDING)) {
|
|
1434
|
+
i.de = i.ne === undefined ? NO_SNAPSHOT : i.ne;
|
|
1435
|
+
snapshotSources.add(i);
|
|
1374
1436
|
}
|
|
1375
1437
|
}
|
|
1376
|
-
return
|
|
1438
|
+
return i;
|
|
1377
1439
|
}
|
|
1378
1440
|
function signal(e, t, n = null) {
|
|
1379
1441
|
const i = {
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
J: e,
|
|
1442
|
+
Le: t?.equals != null ? t.equals : isEqual,
|
|
1443
|
+
Ee: (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) | (t?.Fe ? CONFIG_NO_SNAPSHOT : 0),
|
|
1444
|
+
k: t?.unobserved,
|
|
1445
|
+
ne: e,
|
|
1385
1446
|
I: null,
|
|
1386
1447
|
Ae: null,
|
|
1387
|
-
|
|
1448
|
+
Se: clock,
|
|
1388
1449
|
V: n,
|
|
1389
|
-
|
|
1390
|
-
|
|
1450
|
+
A: n?.N || null,
|
|
1451
|
+
U: NOT_PENDING
|
|
1391
1452
|
};
|
|
1392
|
-
n && (n.
|
|
1393
|
-
if (snapshotCaptureActive && !i.
|
|
1453
|
+
n && (n.N = i);
|
|
1454
|
+
if (snapshotCaptureActive && !(i.Ee & CONFIG_NO_SNAPSHOT) && !((n?.Oe ?? 0) & STATUS_PENDING)) {
|
|
1394
1455
|
i.de = e === undefined ? NO_SNAPSHOT : e;
|
|
1395
1456
|
snapshotSources.add(i);
|
|
1396
1457
|
}
|
|
@@ -1398,13 +1459,13 @@ function signal(e, t, n = null) {
|
|
|
1398
1459
|
}
|
|
1399
1460
|
function optimisticSignal(e, t) {
|
|
1400
1461
|
const n = signal(e, t);
|
|
1401
|
-
n.
|
|
1462
|
+
n.G = NOT_PENDING;
|
|
1402
1463
|
return n;
|
|
1403
1464
|
}
|
|
1404
|
-
function optimisticComputed(e, t
|
|
1405
|
-
const
|
|
1406
|
-
|
|
1407
|
-
return
|
|
1465
|
+
function optimisticComputed(e, t) {
|
|
1466
|
+
const n = computed(e, t);
|
|
1467
|
+
n.G = NOT_PENDING;
|
|
1468
|
+
return n;
|
|
1408
1469
|
}
|
|
1409
1470
|
function isEqual(e, t) {
|
|
1410
1471
|
return e === t;
|
|
@@ -1425,7 +1486,7 @@ function read(e) {
|
|
|
1425
1486
|
const t = getLatestValueComputed(e);
|
|
1426
1487
|
const n = latestReadActive;
|
|
1427
1488
|
latestReadActive = false;
|
|
1428
|
-
const i = e.
|
|
1489
|
+
const i = e.G !== undefined && e.G !== NOT_PENDING ? e.G : e.ne;
|
|
1429
1490
|
let r;
|
|
1430
1491
|
try {
|
|
1431
1492
|
r = read(t);
|
|
@@ -1435,11 +1496,11 @@ function read(e) {
|
|
|
1435
1496
|
} finally {
|
|
1436
1497
|
latestReadActive = n;
|
|
1437
1498
|
}
|
|
1438
|
-
if (t.
|
|
1439
|
-
if (stale && currentOptimisticLane && t.
|
|
1440
|
-
const e = findLane(t.
|
|
1499
|
+
if (t.Oe & STATUS_PENDING) return i;
|
|
1500
|
+
if (stale && currentOptimisticLane && t.te) {
|
|
1501
|
+
const e = findLane(t.te);
|
|
1441
1502
|
const n = findLane(currentOptimisticLane);
|
|
1442
|
-
if (e !== n && e.
|
|
1503
|
+
if (e !== n && e.W.size > 0) {
|
|
1443
1504
|
return i;
|
|
1444
1505
|
}
|
|
1445
1506
|
}
|
|
@@ -1449,8 +1510,8 @@ function read(e) {
|
|
|
1449
1510
|
const t = e.V;
|
|
1450
1511
|
const n = pendingCheckActive;
|
|
1451
1512
|
pendingCheckActive = false;
|
|
1452
|
-
if (t && e.
|
|
1453
|
-
if (e.
|
|
1513
|
+
if (t && e.G !== undefined) {
|
|
1514
|
+
if (e.G !== NOT_PENDING && (t.De || !!(t.Oe & STATUS_PENDING))) {
|
|
1454
1515
|
foundPending = true;
|
|
1455
1516
|
}
|
|
1456
1517
|
let n = context;
|
|
@@ -1463,86 +1524,115 @@ function read(e) {
|
|
|
1463
1524
|
if (t && read(getPendingSignal(t))) foundPending = true;
|
|
1464
1525
|
}
|
|
1465
1526
|
pendingCheckActive = n;
|
|
1466
|
-
return e.
|
|
1527
|
+
return e.ne;
|
|
1467
1528
|
}
|
|
1468
1529
|
let t = context;
|
|
1469
1530
|
if (t?.t) t = t.u;
|
|
1470
|
-
|
|
1471
|
-
if (
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1531
|
+
const n = e;
|
|
1532
|
+
if (typeof n.L === "function") {
|
|
1533
|
+
const t = e;
|
|
1534
|
+
if (refreshing && !(t.R & REACTIVE_DISPOSED)) recompute(t);
|
|
1535
|
+
if (t.R & REACTIVE_LAZY) {
|
|
1536
|
+
t.R &= ~REACTIVE_LAZY;
|
|
1537
|
+
recompute(t, true);
|
|
1538
|
+
} else if (t.R & REACTIVE_DISPOSED) {
|
|
1539
|
+
recompute(t, true);
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
const i = e.V || e;
|
|
1476
1543
|
if (t && tracking) {
|
|
1477
|
-
if (e.L && e.O & REACTIVE_DISPOSED) recompute(e);
|
|
1478
1544
|
link(e, t);
|
|
1479
|
-
if (
|
|
1480
|
-
const
|
|
1481
|
-
if (
|
|
1545
|
+
if (i.L) {
|
|
1546
|
+
const n = e.R & REACTIVE_ZOMBIE;
|
|
1547
|
+
if (i.o >= (n ? zombieQueue.P : dirtyQueue.P)) {
|
|
1482
1548
|
markNode(t);
|
|
1483
|
-
markHeap(
|
|
1484
|
-
updateIfNecessary(
|
|
1549
|
+
markHeap(n ? zombieQueue : dirtyQueue);
|
|
1550
|
+
updateIfNecessary(i);
|
|
1485
1551
|
}
|
|
1486
|
-
const r =
|
|
1552
|
+
const r = i.o;
|
|
1487
1553
|
if (r >= t.o && e.i !== t) {
|
|
1488
1554
|
t.o = r + 1;
|
|
1489
1555
|
}
|
|
1490
1556
|
}
|
|
1491
1557
|
}
|
|
1492
|
-
if (
|
|
1493
|
-
if (t && !(stale &&
|
|
1558
|
+
if (i.Oe & STATUS_PENDING) {
|
|
1559
|
+
if (t && !(stale && i.Z && activeTransition !== i.Z)) {
|
|
1494
1560
|
if (currentOptimisticLane) {
|
|
1495
|
-
const
|
|
1561
|
+
const n = i.te;
|
|
1496
1562
|
const r = findLane(currentOptimisticLane);
|
|
1497
|
-
if (
|
|
1563
|
+
if (n && findLane(n) === r && !hasActiveOverride(i)) {
|
|
1498
1564
|
if (!tracking && e !== t) link(e, t);
|
|
1499
|
-
throw
|
|
1565
|
+
throw i.Te;
|
|
1500
1566
|
}
|
|
1501
1567
|
} else {
|
|
1502
1568
|
if (!tracking && e !== t) link(e, t);
|
|
1503
|
-
throw
|
|
1569
|
+
throw i.Te;
|
|
1504
1570
|
}
|
|
1505
|
-
} else if (t &&
|
|
1571
|
+
} else if (t && i !== e && i.Oe & STATUS_UNINITIALIZED) {
|
|
1506
1572
|
if (!tracking && e !== t) link(e, t);
|
|
1507
|
-
throw
|
|
1508
|
-
} else if (!t &&
|
|
1509
|
-
throw
|
|
1573
|
+
throw i.Te;
|
|
1574
|
+
} else if (!t && i.Oe & STATUS_UNINITIALIZED) {
|
|
1575
|
+
throw i.Te;
|
|
1510
1576
|
}
|
|
1511
1577
|
}
|
|
1512
|
-
if (e.L && e.
|
|
1513
|
-
if (e.
|
|
1578
|
+
if (e.L && e.Oe & STATUS_ERROR) {
|
|
1579
|
+
if (e.Se < clock) {
|
|
1514
1580
|
recompute(e);
|
|
1515
1581
|
return read(e);
|
|
1516
|
-
} else throw e.
|
|
1582
|
+
} else throw e.Te;
|
|
1517
1583
|
}
|
|
1518
|
-
if (snapshotCaptureActive && t && t.
|
|
1584
|
+
if (snapshotCaptureActive && t && t.Ee & CONFIG_IN_SNAPSHOT_SCOPE) {
|
|
1519
1585
|
const n = e.de;
|
|
1520
1586
|
if (n !== undefined) {
|
|
1521
1587
|
const i = n === NO_SNAPSHOT ? undefined : n;
|
|
1522
|
-
const r = e.
|
|
1523
|
-
if (r !== i) t.
|
|
1588
|
+
const r = e.U !== NOT_PENDING ? e.U : e.ne;
|
|
1589
|
+
if (r !== i) t.R |= REACTIVE_SNAPSHOT_STALE;
|
|
1524
1590
|
return i;
|
|
1525
1591
|
}
|
|
1526
1592
|
}
|
|
1527
|
-
if (e.
|
|
1528
|
-
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.
|
|
1529
|
-
return e.
|
|
1593
|
+
if (e.G !== undefined && e.G !== NOT_PENDING) {
|
|
1594
|
+
if (t && stale && shouldReadStashedOptimisticValue(e)) return e.ne;
|
|
1595
|
+
return e.G;
|
|
1596
|
+
}
|
|
1597
|
+
if (
|
|
1598
|
+
activeTransition !== null &&
|
|
1599
|
+
currentOptimisticLane !== null &&
|
|
1600
|
+
!latestReadActive &&
|
|
1601
|
+
e.U !== NOT_PENDING &&
|
|
1602
|
+
i === e &&
|
|
1603
|
+
!e.L &&
|
|
1604
|
+
t
|
|
1605
|
+
) {
|
|
1606
|
+
activeTransition.ee.add(t);
|
|
1607
|
+
return e.ne;
|
|
1530
1608
|
}
|
|
1531
|
-
|
|
1609
|
+
const r =
|
|
1610
|
+
!t ||
|
|
1532
1611
|
(currentOptimisticLane !== null &&
|
|
1533
|
-
(e.
|
|
1534
|
-
e.
|
|
1535
|
-
(stale && e.
|
|
1536
|
-
|
|
1537
|
-
|
|
1612
|
+
(e.G !== undefined || e.te || (i === e && stale) || !!(i.Oe & STATUS_PENDING))) ||
|
|
1613
|
+
e.U === NOT_PENDING ||
|
|
1614
|
+
(stale && e.Z && activeTransition !== e.Z)
|
|
1615
|
+
? e.ne
|
|
1616
|
+
: e.U;
|
|
1617
|
+
if (
|
|
1618
|
+
!t &&
|
|
1619
|
+
i === e &&
|
|
1620
|
+
typeof n.L === "function" &&
|
|
1621
|
+
e.Ee & CONFIG_AUTO_DISPOSE &&
|
|
1622
|
+
!(i.Oe & STATUS_PENDING) &&
|
|
1623
|
+
!e.I
|
|
1624
|
+
) {
|
|
1625
|
+
unobserved(e);
|
|
1626
|
+
}
|
|
1627
|
+
return r;
|
|
1538
1628
|
}
|
|
1539
1629
|
function setSignal(e, t) {
|
|
1540
|
-
if (e.
|
|
1541
|
-
const n = e.
|
|
1542
|
-
const i = e.
|
|
1543
|
-
const r = n ? (i ? e.
|
|
1630
|
+
if (e.Z && activeTransition !== e.Z) globalQueue.initTransition(e.Z);
|
|
1631
|
+
const n = e.G !== undefined && !projectionWriteActive;
|
|
1632
|
+
const i = e.G !== undefined && e.G !== NOT_PENDING;
|
|
1633
|
+
const r = n ? (i ? e.G : e.ne) : e.U === NOT_PENDING ? e.ne : e.U;
|
|
1544
1634
|
if (typeof t === "function") t = t(r);
|
|
1545
|
-
const s = !e.
|
|
1635
|
+
const s = !e.Le || !e.Le(r, t) || !!(e.Oe & STATUS_UNINITIALIZED);
|
|
1546
1636
|
if (!s) {
|
|
1547
1637
|
if (n && i && e.L) {
|
|
1548
1638
|
insertSubs(e, true);
|
|
@@ -1551,25 +1641,25 @@ function setSignal(e, t) {
|
|
|
1551
1641
|
return t;
|
|
1552
1642
|
}
|
|
1553
1643
|
if (n) {
|
|
1554
|
-
const n = e.
|
|
1644
|
+
const n = e.G === NOT_PENDING;
|
|
1555
1645
|
if (!n) globalQueue.initTransition(resolveTransition(e));
|
|
1556
1646
|
if (n) {
|
|
1557
|
-
e.
|
|
1558
|
-
globalQueue.
|
|
1647
|
+
e.U = e.ne;
|
|
1648
|
+
globalQueue.q.push(e);
|
|
1559
1649
|
}
|
|
1560
|
-
e.
|
|
1650
|
+
e.pe = true;
|
|
1561
1651
|
const i = getOrCreateLane(e);
|
|
1562
|
-
e.
|
|
1563
|
-
e.
|
|
1652
|
+
e.te = i;
|
|
1653
|
+
e.G = t;
|
|
1564
1654
|
} else {
|
|
1565
|
-
if (e.
|
|
1566
|
-
e.
|
|
1655
|
+
if (e.U === NOT_PENDING) globalQueue.ue.push(e);
|
|
1656
|
+
e.U = t;
|
|
1567
1657
|
}
|
|
1568
1658
|
updatePendingSignal(e);
|
|
1569
|
-
if (e.
|
|
1570
|
-
setSignal(e.
|
|
1659
|
+
if (e.Ue) {
|
|
1660
|
+
setSignal(e.Ue, t);
|
|
1571
1661
|
}
|
|
1572
|
-
e.
|
|
1662
|
+
e.Se = clock;
|
|
1573
1663
|
insertSubs(e, n);
|
|
1574
1664
|
schedule();
|
|
1575
1665
|
return t;
|
|
@@ -1587,68 +1677,68 @@ function runWithOwner(e, t) {
|
|
|
1587
1677
|
}
|
|
1588
1678
|
}
|
|
1589
1679
|
function getPendingSignal(e) {
|
|
1590
|
-
if (!e.
|
|
1591
|
-
e.
|
|
1592
|
-
if (e.
|
|
1593
|
-
e.
|
|
1680
|
+
if (!e.We) {
|
|
1681
|
+
e.We = optimisticSignal(false, { ownedWrite: true });
|
|
1682
|
+
if (e.Ie) {
|
|
1683
|
+
e.We.Ie = e;
|
|
1594
1684
|
}
|
|
1595
|
-
if (computePendingState(e)) setSignal(e.
|
|
1685
|
+
if (computePendingState(e)) setSignal(e.We, true);
|
|
1596
1686
|
}
|
|
1597
|
-
return e.
|
|
1687
|
+
return e.We;
|
|
1598
1688
|
}
|
|
1599
1689
|
function computePendingState(e) {
|
|
1600
1690
|
const t = e;
|
|
1601
1691
|
const n = e.V;
|
|
1602
|
-
if (n && e.
|
|
1603
|
-
return !n.
|
|
1692
|
+
if (n && e.U !== NOT_PENDING) {
|
|
1693
|
+
return !n.De && !(n.Oe & STATUS_PENDING);
|
|
1604
1694
|
}
|
|
1605
|
-
if (e.
|
|
1606
|
-
if (t.
|
|
1607
|
-
if (e.
|
|
1608
|
-
const t = e.
|
|
1609
|
-
return !!(t && t.
|
|
1695
|
+
if (e.G !== undefined && e.G !== NOT_PENDING) {
|
|
1696
|
+
if (t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
|
|
1697
|
+
if (e.Ie) {
|
|
1698
|
+
const t = e.te ? findLane(e.te) : null;
|
|
1699
|
+
return !!(t && t.W.size > 0);
|
|
1610
1700
|
}
|
|
1611
1701
|
return true;
|
|
1612
1702
|
}
|
|
1613
|
-
if (e.
|
|
1703
|
+
if (e.G !== undefined && e.G === NOT_PENDING && !e.Ie) {
|
|
1614
1704
|
return false;
|
|
1615
1705
|
}
|
|
1616
|
-
if (e.
|
|
1617
|
-
return !!(t.
|
|
1706
|
+
if (e.U !== NOT_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
|
|
1707
|
+
return !!(t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED));
|
|
1618
1708
|
}
|
|
1619
1709
|
function updatePendingSignal(e) {
|
|
1620
|
-
if (e.
|
|
1710
|
+
if (e.We) {
|
|
1621
1711
|
const t = computePendingState(e);
|
|
1622
|
-
const n = e.
|
|
1712
|
+
const n = e.We;
|
|
1623
1713
|
setSignal(n, t);
|
|
1624
|
-
if (!t && n.
|
|
1714
|
+
if (!t && n.te) {
|
|
1625
1715
|
const t = resolveLane(e);
|
|
1626
|
-
if (t && t.
|
|
1627
|
-
const e = findLane(n.
|
|
1716
|
+
if (t && t.W.size > 0) {
|
|
1717
|
+
const e = findLane(n.te);
|
|
1628
1718
|
if (e !== t) {
|
|
1629
1719
|
mergeLanes(t, e);
|
|
1630
1720
|
}
|
|
1631
1721
|
}
|
|
1632
1722
|
signalLanes.delete(n);
|
|
1633
|
-
n.
|
|
1723
|
+
n.te = undefined;
|
|
1634
1724
|
}
|
|
1635
1725
|
}
|
|
1636
1726
|
}
|
|
1637
1727
|
function getLatestValueComputed(e) {
|
|
1638
|
-
if (!e.
|
|
1728
|
+
if (!e.Ue) {
|
|
1639
1729
|
const t = latestReadActive;
|
|
1640
1730
|
latestReadActive = false;
|
|
1641
1731
|
const n = pendingCheckActive;
|
|
1642
1732
|
pendingCheckActive = false;
|
|
1643
1733
|
const i = context;
|
|
1644
1734
|
context = null;
|
|
1645
|
-
e.
|
|
1646
|
-
e.
|
|
1735
|
+
e.Ue = optimisticComputed(() => read(e));
|
|
1736
|
+
e.Ue.Ie = e;
|
|
1647
1737
|
context = i;
|
|
1648
1738
|
pendingCheckActive = n;
|
|
1649
1739
|
latestReadActive = t;
|
|
1650
1740
|
}
|
|
1651
|
-
return e.
|
|
1741
|
+
return e.Ue;
|
|
1652
1742
|
}
|
|
1653
1743
|
function staleValues(e, t = true) {
|
|
1654
1744
|
const n = stale;
|
|
@@ -1709,7 +1799,7 @@ function getContext(e, t = getOwner()) {
|
|
|
1709
1799
|
if (!t) {
|
|
1710
1800
|
throw new NoOwnerError();
|
|
1711
1801
|
}
|
|
1712
|
-
const n = hasContext(e, t) ? t.
|
|
1802
|
+
const n = hasContext(e, t) ? t.Ve[e.id] : e.defaultValue;
|
|
1713
1803
|
if (isUndefined(n)) {
|
|
1714
1804
|
throw new ContextNotFoundError();
|
|
1715
1805
|
}
|
|
@@ -1719,109 +1809,111 @@ function setContext(e, t, n = getOwner()) {
|
|
|
1719
1809
|
if (!n) {
|
|
1720
1810
|
throw new NoOwnerError();
|
|
1721
1811
|
}
|
|
1722
|
-
n.
|
|
1812
|
+
n.Ve = { ...n.Ve, [e.id]: isUndefined(t) ? e.defaultValue : t };
|
|
1723
1813
|
}
|
|
1724
1814
|
function hasContext(e, t) {
|
|
1725
|
-
return !isUndefined(t?.
|
|
1815
|
+
return !isUndefined(t?.Ve[e.id]);
|
|
1726
1816
|
}
|
|
1727
1817
|
function isUndefined(e) {
|
|
1728
1818
|
return typeof e === "undefined";
|
|
1729
1819
|
}
|
|
1730
|
-
function effect(e, t, n, i
|
|
1731
|
-
let
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1820
|
+
function effect(e, t, n, i) {
|
|
1821
|
+
let r = false;
|
|
1822
|
+
const s = !!i?.user;
|
|
1823
|
+
const o = computed(s ? e : t => staleValues(() => e(t)), {
|
|
1824
|
+
...i,
|
|
1734
1825
|
equals: () => {
|
|
1735
|
-
o.
|
|
1736
|
-
if (
|
|
1826
|
+
o.j = !o.Te;
|
|
1827
|
+
if (r) o.$.enqueue(o.M, runEffect.bind(o));
|
|
1737
1828
|
return false;
|
|
1738
1829
|
},
|
|
1739
1830
|
lazy: true
|
|
1740
1831
|
});
|
|
1741
|
-
o.
|
|
1742
|
-
o.
|
|
1743
|
-
o.
|
|
1744
|
-
o
|
|
1745
|
-
o.
|
|
1832
|
+
o.Ee &= ~CONFIG_AUTO_DISPOSE;
|
|
1833
|
+
o.xe = undefined;
|
|
1834
|
+
o.He = t;
|
|
1835
|
+
o.Me = n;
|
|
1836
|
+
o.Qe = undefined;
|
|
1837
|
+
o.M = s ? EFFECT_USER : EFFECT_RENDER;
|
|
1746
1838
|
o.Ge = (e, t) => {
|
|
1747
|
-
const n = e !== undefined ? e : o.
|
|
1748
|
-
const i = t !== undefined ? t : o.
|
|
1839
|
+
const n = e !== undefined ? e : o.Oe;
|
|
1840
|
+
const i = t !== undefined ? t : o.Te;
|
|
1749
1841
|
if (n & STATUS_ERROR) {
|
|
1750
1842
|
let e = i;
|
|
1751
|
-
o
|
|
1752
|
-
if (o.
|
|
1843
|
+
o.$.notify(o, STATUS_PENDING, 0);
|
|
1844
|
+
if (o.M === EFFECT_USER) {
|
|
1753
1845
|
try {
|
|
1754
|
-
return o.
|
|
1755
|
-
? o.
|
|
1756
|
-
o
|
|
1757
|
-
o
|
|
1846
|
+
return o.Me
|
|
1847
|
+
? o.Me(e, () => {
|
|
1848
|
+
o.Qe?.();
|
|
1849
|
+
o.Qe = undefined;
|
|
1758
1850
|
})
|
|
1759
1851
|
: console.error(e);
|
|
1760
1852
|
} catch (t) {
|
|
1761
1853
|
e = t;
|
|
1762
1854
|
}
|
|
1763
1855
|
}
|
|
1764
|
-
if (!o
|
|
1765
|
-
} else if (o.
|
|
1766
|
-
o
|
|
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);
|
|
1767
1859
|
}
|
|
1768
1860
|
};
|
|
1769
1861
|
recompute(o, true);
|
|
1770
|
-
!
|
|
1771
|
-
|
|
1772
|
-
|
|
1862
|
+
!i?.defer &&
|
|
1863
|
+
(o.M === EFFECT_USER || i?.schedule ? o.$.enqueue(o.M, runEffect.bind(o)) : runEffect.call(o));
|
|
1864
|
+
r = true;
|
|
1865
|
+
cleanup(() => o.Qe?.());
|
|
1773
1866
|
}
|
|
1774
1867
|
function runEffect() {
|
|
1775
|
-
if (!this.
|
|
1776
|
-
this
|
|
1777
|
-
this
|
|
1868
|
+
if (!this.j || this.R & REACTIVE_DISPOSED) return;
|
|
1869
|
+
this.Qe?.();
|
|
1870
|
+
this.Qe = undefined;
|
|
1778
1871
|
try {
|
|
1779
|
-
const e = this.
|
|
1872
|
+
const e = this.He(this.ne, this.xe);
|
|
1780
1873
|
if (false && e !== undefined && typeof e !== "function");
|
|
1781
|
-
this
|
|
1874
|
+
this.Qe = e;
|
|
1782
1875
|
} catch (e) {
|
|
1783
|
-
this.
|
|
1784
|
-
this.
|
|
1785
|
-
if (!this
|
|
1876
|
+
this.Te = new StatusError(this, e);
|
|
1877
|
+
this.Oe |= STATUS_ERROR;
|
|
1878
|
+
if (!this.$.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1786
1879
|
} finally {
|
|
1787
|
-
this.
|
|
1788
|
-
this.
|
|
1880
|
+
this.xe = this.ne;
|
|
1881
|
+
this.j = false;
|
|
1789
1882
|
}
|
|
1790
1883
|
}
|
|
1791
1884
|
function trackedEffect(e, t) {
|
|
1792
1885
|
const run = () => {
|
|
1793
|
-
if (!n.
|
|
1886
|
+
if (!n.j || n.R & REACTIVE_DISPOSED) return;
|
|
1794
1887
|
try {
|
|
1795
|
-
n.
|
|
1888
|
+
n.j = false;
|
|
1796
1889
|
recompute(n);
|
|
1797
1890
|
} finally {
|
|
1798
1891
|
}
|
|
1799
1892
|
};
|
|
1800
1893
|
const n = computed(
|
|
1801
1894
|
() => {
|
|
1802
|
-
n
|
|
1803
|
-
n
|
|
1895
|
+
n.Qe?.();
|
|
1896
|
+
n.Qe = undefined;
|
|
1804
1897
|
const t = staleValues(e);
|
|
1805
|
-
n
|
|
1898
|
+
n.Qe = t;
|
|
1806
1899
|
},
|
|
1807
|
-
undefined,
|
|
1808
1900
|
{ ...t, lazy: true }
|
|
1809
1901
|
);
|
|
1810
|
-
n
|
|
1811
|
-
n.
|
|
1812
|
-
n.
|
|
1813
|
-
n.
|
|
1902
|
+
n.Qe = undefined;
|
|
1903
|
+
n.Ee = (n.Ee & ~CONFIG_AUTO_DISPOSE) | CONFIG_CHILDREN_FORBIDDEN;
|
|
1904
|
+
n.j = true;
|
|
1905
|
+
n.M = EFFECT_TRACKED;
|
|
1814
1906
|
n.Ge = (e, t) => {
|
|
1815
|
-
const i = e !== undefined ? e : n.
|
|
1907
|
+
const i = e !== undefined ? e : n.Oe;
|
|
1816
1908
|
if (i & STATUS_ERROR) {
|
|
1817
|
-
n
|
|
1818
|
-
const e = t !== undefined ? t : n.
|
|
1819
|
-
if (!n
|
|
1909
|
+
n.$.notify(n, STATUS_PENDING, 0);
|
|
1910
|
+
const e = t !== undefined ? t : n.Te;
|
|
1911
|
+
if (!n.$.notify(n, STATUS_ERROR, STATUS_ERROR)) throw e;
|
|
1820
1912
|
}
|
|
1821
1913
|
};
|
|
1822
|
-
n.
|
|
1823
|
-
n
|
|
1824
|
-
cleanup(() => n
|
|
1914
|
+
n.K = run;
|
|
1915
|
+
n.$.enqueue(EFFECT_USER, run);
|
|
1916
|
+
cleanup(() => n.Qe?.());
|
|
1825
1917
|
}
|
|
1826
1918
|
function restoreTransition(e, t) {
|
|
1827
1919
|
globalQueue.initTransition(e);
|
|
@@ -1835,11 +1927,11 @@ function action(e) {
|
|
|
1835
1927
|
const r = e(...t);
|
|
1836
1928
|
globalQueue.initTransition();
|
|
1837
1929
|
let s = activeTransition;
|
|
1838
|
-
s
|
|
1930
|
+
s.B.push(r);
|
|
1839
1931
|
const done = (e, t) => {
|
|
1840
1932
|
s = currentTransition(s);
|
|
1841
|
-
const o = s
|
|
1842
|
-
if (o >= 0) s
|
|
1933
|
+
const o = s.B.indexOf(r);
|
|
1934
|
+
if (o >= 0) s.B.splice(o, 1);
|
|
1843
1935
|
setActiveTransition(s);
|
|
1844
1936
|
schedule();
|
|
1845
1937
|
t ? i(t) : n(e);
|
|
@@ -1871,27 +1963,25 @@ function onCleanup(e) {
|
|
|
1871
1963
|
return cleanup(e);
|
|
1872
1964
|
}
|
|
1873
1965
|
function accessor(e) {
|
|
1874
|
-
|
|
1875
|
-
t.$r = true;
|
|
1876
|
-
return t;
|
|
1966
|
+
return read.bind(null, e);
|
|
1877
1967
|
}
|
|
1878
|
-
function createSignal(e, t
|
|
1968
|
+
function createSignal(e, t) {
|
|
1879
1969
|
if (typeof e === "function") {
|
|
1880
|
-
const
|
|
1881
|
-
|
|
1970
|
+
const n = computed(e, t);
|
|
1971
|
+
n.Ee &= ~CONFIG_AUTO_DISPOSE;
|
|
1972
|
+
return [accessor(n), setSignal.bind(null, n)];
|
|
1882
1973
|
}
|
|
1883
|
-
const
|
|
1884
|
-
return [accessor(
|
|
1974
|
+
const n = signal(e, t);
|
|
1975
|
+
return [accessor(n), setSignal.bind(null, n)];
|
|
1885
1976
|
}
|
|
1886
|
-
function createMemo(e, t
|
|
1887
|
-
|
|
1888
|
-
return accessor(i);
|
|
1977
|
+
function createMemo(e, t) {
|
|
1978
|
+
return accessor(computed(e, t));
|
|
1889
1979
|
}
|
|
1890
|
-
function createEffect(e, t, n
|
|
1891
|
-
effect(e, t.effect || t, t.error,
|
|
1980
|
+
function createEffect(e, t, n) {
|
|
1981
|
+
effect(e, t.effect || t, t.error, { user: true, ...n });
|
|
1892
1982
|
}
|
|
1893
|
-
function createRenderEffect(e, t, n
|
|
1894
|
-
effect(e, t, undefined, n
|
|
1983
|
+
function createRenderEffect(e, t, n) {
|
|
1984
|
+
effect(e, t, undefined, n);
|
|
1895
1985
|
}
|
|
1896
1986
|
function createTrackedEffect(e, t) {
|
|
1897
1987
|
trackedEffect(e, t);
|
|
@@ -1912,8 +2002,7 @@ function createReaction(e, t) {
|
|
|
1912
2002
|
dispose(t);
|
|
1913
2003
|
},
|
|
1914
2004
|
e.error,
|
|
1915
|
-
|
|
1916
|
-
{ defer: true, ...(false ? { ...t, name: t?.name ?? "effect" } : t) }
|
|
2005
|
+
{ ...(false ? { ...t, name: t?.name ?? "effect" } : t), user: true, defer: true }
|
|
1917
2006
|
);
|
|
1918
2007
|
});
|
|
1919
2008
|
};
|
|
@@ -1933,17 +2022,18 @@ function resolve(e) {
|
|
|
1933
2022
|
});
|
|
1934
2023
|
});
|
|
1935
2024
|
}
|
|
1936
|
-
function createOptimistic(e, t
|
|
2025
|
+
function createOptimistic(e, t) {
|
|
1937
2026
|
if (typeof e === "function") {
|
|
1938
|
-
const
|
|
1939
|
-
|
|
2027
|
+
const n = optimisticComputed(e, t);
|
|
2028
|
+
n.Ee &= ~CONFIG_AUTO_DISPOSE;
|
|
2029
|
+
return [accessor(n), setSignal.bind(null, n)];
|
|
1940
2030
|
}
|
|
1941
|
-
const
|
|
1942
|
-
return [accessor(
|
|
2031
|
+
const n = optimisticSignal(e, t);
|
|
2032
|
+
return [accessor(n), setSignal.bind(null, n)];
|
|
1943
2033
|
}
|
|
1944
2034
|
function onSettled(e) {
|
|
1945
2035
|
const t = getOwner();
|
|
1946
|
-
t && !t.
|
|
2036
|
+
t && !(t.Ee & CONFIG_CHILDREN_FORBIDDEN)
|
|
1947
2037
|
? createTrackedEffect(() => untrack(e), undefined)
|
|
1948
2038
|
: globalQueue.enqueue(EFFECT_USER, () => {
|
|
1949
2039
|
const t = e();
|
|
@@ -1977,34 +2067,34 @@ function applyState(e, t, n) {
|
|
|
1977
2067
|
let t = false;
|
|
1978
2068
|
const c = getOverrideValue(r, s, u, "length", o);
|
|
1979
2069
|
if (e.length && c && e[0] && n(e[0]) != null) {
|
|
1980
|
-
let a, l, f, E,
|
|
2070
|
+
let a, l, f, E, T, S, d, O;
|
|
1981
2071
|
for (
|
|
1982
2072
|
f = 0, E = Math.min(c, e.length);
|
|
1983
2073
|
f < E &&
|
|
1984
|
-
((
|
|
2074
|
+
((S = getOverrideValue(r, s, u, f, o)) === e[f] || (S && e[f] && n(S) === n(e[f])));
|
|
1985
2075
|
f++
|
|
1986
2076
|
) {
|
|
1987
|
-
applyState(e[f], wrap(
|
|
2077
|
+
applyState(e[f], wrap(S, i), n);
|
|
1988
2078
|
}
|
|
1989
|
-
const
|
|
2079
|
+
const R = new Array(e.length),
|
|
1990
2080
|
_ = new Map();
|
|
1991
2081
|
for (
|
|
1992
|
-
E = c - 1,
|
|
2082
|
+
E = c - 1, T = e.length - 1;
|
|
1993
2083
|
E >= f &&
|
|
1994
|
-
|
|
1995
|
-
((
|
|
1996
|
-
E--,
|
|
2084
|
+
T >= f &&
|
|
2085
|
+
((S = getOverrideValue(r, s, u, E, o)) === e[T] || (S && e[T] && n(S) === n(e[T])));
|
|
2086
|
+
E--, T--
|
|
1997
2087
|
) {
|
|
1998
|
-
|
|
2088
|
+
R[T] = S;
|
|
1999
2089
|
}
|
|
2000
|
-
if (f >
|
|
2001
|
-
for (l = f; l <=
|
|
2090
|
+
if (f > T || f > E) {
|
|
2091
|
+
for (l = f; l <= T; l++) {
|
|
2002
2092
|
t = true;
|
|
2003
2093
|
i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], wrap(e[l], i));
|
|
2004
2094
|
}
|
|
2005
2095
|
for (; l < e.length; l++) {
|
|
2006
2096
|
t = true;
|
|
2007
|
-
const r = wrap(
|
|
2097
|
+
const r = wrap(R[l], i);
|
|
2008
2098
|
i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], r);
|
|
2009
2099
|
applyState(e[l], r, n);
|
|
2010
2100
|
}
|
|
@@ -2012,27 +2102,27 @@ function applyState(e, t, n) {
|
|
|
2012
2102
|
c !== e.length && i[STORE_NODE].length && setSignal(i[STORE_NODE].length, e.length);
|
|
2013
2103
|
return;
|
|
2014
2104
|
}
|
|
2015
|
-
|
|
2016
|
-
for (l =
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
a = _.get(
|
|
2020
|
-
|
|
2021
|
-
_.set(
|
|
2105
|
+
d = new Array(T + 1);
|
|
2106
|
+
for (l = T; l >= f; l--) {
|
|
2107
|
+
S = e[l];
|
|
2108
|
+
O = S ? n(S) : S;
|
|
2109
|
+
a = _.get(O);
|
|
2110
|
+
d[l] = a === undefined ? -1 : a;
|
|
2111
|
+
_.set(O, l);
|
|
2022
2112
|
}
|
|
2023
2113
|
for (a = f; a <= E; a++) {
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
l = _.get(
|
|
2114
|
+
S = getOverrideValue(r, s, u, a, o);
|
|
2115
|
+
O = S ? n(S) : S;
|
|
2116
|
+
l = _.get(O);
|
|
2027
2117
|
if (l !== undefined && l !== -1) {
|
|
2028
|
-
|
|
2029
|
-
l =
|
|
2030
|
-
_.set(
|
|
2118
|
+
R[l] = S;
|
|
2119
|
+
l = d[l];
|
|
2120
|
+
_.set(O, l);
|
|
2031
2121
|
}
|
|
2032
2122
|
}
|
|
2033
2123
|
for (l = f; l < e.length; l++) {
|
|
2034
|
-
if (l in
|
|
2035
|
-
const t = wrap(
|
|
2124
|
+
if (l in R) {
|
|
2125
|
+
const t = wrap(R[l], i);
|
|
2036
2126
|
i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], t);
|
|
2037
2127
|
applyState(e[l], t, n);
|
|
2038
2128
|
} else i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], wrap(e[l], i));
|
|
@@ -2060,12 +2150,12 @@ function applyState(e, t, n) {
|
|
|
2060
2150
|
const l = c[a];
|
|
2061
2151
|
const f = u[l];
|
|
2062
2152
|
const E = unwrap(getOverrideValue(r, s, u, l, o));
|
|
2063
|
-
let
|
|
2064
|
-
if (E ===
|
|
2065
|
-
if (!E || !isWrappable(E) || !isWrappable(
|
|
2153
|
+
let T = unwrap(e[l]);
|
|
2154
|
+
if (E === T) continue;
|
|
2155
|
+
if (!E || !isWrappable(E) || !isWrappable(T) || (n(E) != null && n(E) !== n(T))) {
|
|
2066
2156
|
t && setSignal(t, void 0);
|
|
2067
|
-
f && setSignal(f, isWrappable(
|
|
2068
|
-
} else applyState(
|
|
2157
|
+
f && setSignal(f, isWrappable(T) ? wrap(T, i) : T);
|
|
2158
|
+
} else applyState(T, wrap(E, i), n);
|
|
2069
2159
|
}
|
|
2070
2160
|
}
|
|
2071
2161
|
if ((u = i[STORE_HAS])) {
|
|
@@ -2086,7 +2176,7 @@ function reconcile(e, t) {
|
|
|
2086
2176
|
applyState(e, n, i);
|
|
2087
2177
|
};
|
|
2088
2178
|
}
|
|
2089
|
-
function createProjectionInternal(e, t
|
|
2179
|
+
function createProjectionInternal(e, t, n) {
|
|
2090
2180
|
let i;
|
|
2091
2181
|
const r = new WeakMap();
|
|
2092
2182
|
const wrapper = e => {
|
|
@@ -2108,28 +2198,35 @@ function createProjectionInternal(e, t = {}, n) {
|
|
|
2108
2198
|
};
|
|
2109
2199
|
const s = wrapProjection(t);
|
|
2110
2200
|
i = computed(() => {
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
s,
|
|
2116
|
-
createWriteTraps(() => !i || t.ye === r)
|
|
2117
|
-
);
|
|
2118
|
-
storeSetter(o, o => {
|
|
2119
|
-
r = e(o);
|
|
2120
|
-
i = true;
|
|
2121
|
-
const u = handleAsync(t, r, e => {
|
|
2122
|
-
e !== o && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id"));
|
|
2123
|
-
});
|
|
2124
|
-
u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
|
|
2125
|
-
});
|
|
2126
|
-
});
|
|
2127
|
-
i.Pe = true;
|
|
2201
|
+
if (!i) i = getOwner();
|
|
2202
|
+
runProjectionComputed(s, e, n?.key || "id");
|
|
2203
|
+
}, undefined);
|
|
2204
|
+
i.Ee &= ~CONFIG_AUTO_DISPOSE;
|
|
2128
2205
|
return { store: s, node: i };
|
|
2129
2206
|
}
|
|
2130
|
-
function createProjection(e, t
|
|
2207
|
+
function createProjection(e, t, n) {
|
|
2131
2208
|
return createProjectionInternal(e, t, n).store;
|
|
2132
2209
|
}
|
|
2210
|
+
function runProjectionComputed(e, t, n, i) {
|
|
2211
|
+
const r = getOwner();
|
|
2212
|
+
let s = false;
|
|
2213
|
+
let o;
|
|
2214
|
+
const u = new Proxy(
|
|
2215
|
+
e,
|
|
2216
|
+
createWriteTraps(() => !s || r.De === o)
|
|
2217
|
+
);
|
|
2218
|
+
storeSetter(u, u => {
|
|
2219
|
+
o = t(u);
|
|
2220
|
+
s = true;
|
|
2221
|
+
const commit = t => {
|
|
2222
|
+
if (t === u || t === undefined) return;
|
|
2223
|
+
const write = () => storeSetter(e, reconcile(t, n));
|
|
2224
|
+
i ? i(write) : write();
|
|
2225
|
+
};
|
|
2226
|
+
commit(handleAsync(r, o, commit));
|
|
2227
|
+
});
|
|
2228
|
+
return r;
|
|
2229
|
+
}
|
|
2133
2230
|
function createWriteTraps(e) {
|
|
2134
2231
|
const t = {
|
|
2135
2232
|
get(e, n) {
|
|
@@ -2192,6 +2289,7 @@ const STORE_VALUE = "v",
|
|
|
2192
2289
|
STORE_OPTIMISTIC_OVERRIDE = "x",
|
|
2193
2290
|
STORE_NODE = "n",
|
|
2194
2291
|
STORE_HAS = "h",
|
|
2292
|
+
STORE_CUSTOM_PROTO = "c",
|
|
2195
2293
|
STORE_WRAP = "w",
|
|
2196
2294
|
STORE_LOOKUP = "l",
|
|
2197
2295
|
STORE_FIREWALL = "f",
|
|
@@ -2202,6 +2300,7 @@ function createStoreProxy(e, t = storeTraps, n) {
|
|
|
2202
2300
|
i = [];
|
|
2203
2301
|
i.v = e;
|
|
2204
2302
|
} else i = { v: e };
|
|
2303
|
+
i[STORE_CUSTOM_PROTO] = hasCustomPrototype(unwrapStoreValue(e));
|
|
2205
2304
|
n && n(i);
|
|
2206
2305
|
return (i[$PROXY] = new Proxy(i, t));
|
|
2207
2306
|
}
|
|
@@ -2227,6 +2326,23 @@ function setWriteOverride(e) {
|
|
|
2227
2326
|
function writeOnly(e) {
|
|
2228
2327
|
return writeOverride || !!Writing?.has(e);
|
|
2229
2328
|
}
|
|
2329
|
+
function unwrapStoreValue(e) {
|
|
2330
|
+
return e?.[$TARGET]?.[STORE_VALUE] ?? e;
|
|
2331
|
+
}
|
|
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
|
+
function hasInheritedAccessor(e, t) {
|
|
2338
|
+
let n = Object.getPrototypeOf(e);
|
|
2339
|
+
while (n && n !== Object.prototype) {
|
|
2340
|
+
const e = Reflect.getOwnPropertyDescriptor(n, t);
|
|
2341
|
+
if (e) return !!e.get;
|
|
2342
|
+
n = Object.getPrototypeOf(n);
|
|
2343
|
+
}
|
|
2344
|
+
return false;
|
|
2345
|
+
}
|
|
2230
2346
|
function getNodes(e, t) {
|
|
2231
2347
|
let n = e[t];
|
|
2232
2348
|
if (!n) e[t] = n = Object.create(null);
|
|
@@ -2239,13 +2355,13 @@ function getNode(e, t, n, i, r = isEqual, s, o) {
|
|
|
2239
2355
|
{
|
|
2240
2356
|
equals: r,
|
|
2241
2357
|
unobserved() {
|
|
2242
|
-
delete e[t];
|
|
2358
|
+
if (e[t] === u) delete e[t];
|
|
2243
2359
|
}
|
|
2244
2360
|
},
|
|
2245
2361
|
i
|
|
2246
2362
|
);
|
|
2247
2363
|
if (s) {
|
|
2248
|
-
u.
|
|
2364
|
+
u.G = NOT_PENDING;
|
|
2249
2365
|
}
|
|
2250
2366
|
if (o && t in o) {
|
|
2251
2367
|
const e = o[t];
|
|
@@ -2282,8 +2398,8 @@ function getPropertyDescriptor(e, t, n) {
|
|
|
2282
2398
|
function prepareStoreWrite(e, t, n) {
|
|
2283
2399
|
if (e[STORE_OPTIMISTIC]) {
|
|
2284
2400
|
const t = e[STORE_FIREWALL];
|
|
2285
|
-
if (t?.
|
|
2286
|
-
globalQueue.initTransition(t.
|
|
2401
|
+
if (t?.Z) {
|
|
2402
|
+
globalQueue.initTransition(t.Z);
|
|
2287
2403
|
}
|
|
2288
2404
|
}
|
|
2289
2405
|
const i = e[STORE_VALUE];
|
|
@@ -2291,7 +2407,7 @@ function prepareStoreWrite(e, t, n) {
|
|
|
2291
2407
|
if (
|
|
2292
2408
|
snapshotCaptureActive &&
|
|
2293
2409
|
typeof n !== "symbol" &&
|
|
2294
|
-
!((e[STORE_FIREWALL]?.
|
|
2410
|
+
!((e[STORE_FIREWALL]?.Oe ?? 0) & STATUS_PENDING)
|
|
2295
2411
|
) {
|
|
2296
2412
|
if (!e[STORE_SNAPSHOT_PROPS]) {
|
|
2297
2413
|
e[STORE_SNAPSHOT_PROPS] = Object.create(null);
|
|
@@ -2306,20 +2422,45 @@ function prepareStoreWrite(e, t, n) {
|
|
|
2306
2422
|
if (s) trackOptimisticStore(t);
|
|
2307
2423
|
return { base: r, overrideKey: o, state: i };
|
|
2308
2424
|
}
|
|
2309
|
-
function
|
|
2310
|
-
if (
|
|
2311
|
-
const
|
|
2425
|
+
function upsertStoreNode(e, t, n, i, r) {
|
|
2426
|
+
if (t[n]) return t[n];
|
|
2427
|
+
const s = isWrappable(i) ? wrap(i, e) : i;
|
|
2428
|
+
const o = getNode(t, n, s, e[STORE_FIREWALL], isEqual, e[STORE_OPTIMISTIC], r);
|
|
2429
|
+
registerTransientStoreNode(o);
|
|
2430
|
+
return o;
|
|
2431
|
+
}
|
|
2432
|
+
function notifyStoreProperty(e, t, n, i, r, s) {
|
|
2433
|
+
const o = projectionWriteActive || e[STORE_OPTIMISTIC];
|
|
2434
|
+
const u = n !== "delete";
|
|
2435
|
+
const c = e[STORE_HAS]?.[t];
|
|
2436
|
+
if (c) {
|
|
2437
|
+
setSignal(c, u);
|
|
2438
|
+
} else if (!o && n !== "invalidate" && s !== u) {
|
|
2439
|
+
const n = upsertStoreNode(e, getNodes(e, STORE_HAS), t, s);
|
|
2440
|
+
setSignal(n, u);
|
|
2441
|
+
}
|
|
2442
|
+
const a = getNodes(e, STORE_NODE);
|
|
2312
2443
|
if (n === "set") {
|
|
2313
|
-
|
|
2444
|
+
if (a[t]) {
|
|
2445
|
+
setSignal(a[t], () => (isWrappable(i) ? wrap(i, e) : i));
|
|
2446
|
+
} else if (!o) {
|
|
2447
|
+
const n = upsertStoreNode(e, a, t, r, e[STORE_SNAPSHOT_PROPS]);
|
|
2448
|
+
setSignal(n, () => (isWrappable(i) ? wrap(i, e) : i));
|
|
2449
|
+
}
|
|
2314
2450
|
} else if (n === "invalidate") {
|
|
2315
|
-
if (
|
|
2316
|
-
setSignal(
|
|
2317
|
-
delete
|
|
2451
|
+
if (a[t]) {
|
|
2452
|
+
setSignal(a[t], {});
|
|
2453
|
+
delete a[t];
|
|
2318
2454
|
}
|
|
2319
2455
|
} else {
|
|
2320
|
-
|
|
2456
|
+
if (a[t]) {
|
|
2457
|
+
setSignal(a[t], undefined);
|
|
2458
|
+
} else if (!o) {
|
|
2459
|
+
const n = upsertStoreNode(e, a, t, r, e[STORE_SNAPSHOT_PROPS]);
|
|
2460
|
+
setSignal(n, undefined);
|
|
2461
|
+
}
|
|
2321
2462
|
}
|
|
2322
|
-
|
|
2463
|
+
a[$TRACK] && setSignal(a[$TRACK], undefined);
|
|
2323
2464
|
}
|
|
2324
2465
|
let Writing = null;
|
|
2325
2466
|
const storeTraps = {
|
|
@@ -2342,17 +2483,23 @@ const storeTraps = {
|
|
|
2342
2483
|
? e[STORE_OVERRIDE]
|
|
2343
2484
|
: e[STORE_VALUE];
|
|
2344
2485
|
if (!r) {
|
|
2345
|
-
const
|
|
2346
|
-
if (
|
|
2486
|
+
const i = Object.getOwnPropertyDescriptor(c, t);
|
|
2487
|
+
if (i && i.get) return i.get.call(n);
|
|
2488
|
+
if (!i && !o && e[STORE_CUSTOM_PROTO]) {
|
|
2489
|
+
const e = unwrapStoreValue(c);
|
|
2490
|
+
if (hasInheritedAccessor(e, t)) {
|
|
2491
|
+
return Reflect.get(c, t, n);
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2347
2494
|
}
|
|
2348
2495
|
if (writeOnly(n)) {
|
|
2349
2496
|
let n =
|
|
2350
2497
|
r && (o || !u)
|
|
2351
|
-
? r.
|
|
2352
|
-
? r.
|
|
2353
|
-
: r.
|
|
2354
|
-
? r.
|
|
2355
|
-
: r.
|
|
2498
|
+
? r.G !== undefined && r.G !== NOT_PENDING
|
|
2499
|
+
? r.G
|
|
2500
|
+
: r.U !== NOT_PENDING
|
|
2501
|
+
? r.U
|
|
2502
|
+
: r.ne
|
|
2356
2503
|
: c[t];
|
|
2357
2504
|
n === $DELETED && (n = undefined);
|
|
2358
2505
|
if (!isWrappable(n)) return n;
|
|
@@ -2394,11 +2541,11 @@ const storeTraps = {
|
|
|
2394
2541
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2395
2542
|
? e[STORE_OVERRIDE][t] !== $DELETED
|
|
2396
2543
|
: t in e[STORE_VALUE];
|
|
2397
|
-
if (
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2544
|
+
if (writeOnly(e[$PROXY])) return n;
|
|
2545
|
+
const i = getNodes(e, STORE_HAS);
|
|
2546
|
+
if (i[t]) return read(i[t]);
|
|
2547
|
+
if (getObserver()) {
|
|
2548
|
+
return read(getNode(i, t, n, e[STORE_FIREWALL], isEqual, e[STORE_OPTIMISTIC]));
|
|
2402
2549
|
}
|
|
2403
2550
|
return n;
|
|
2404
2551
|
},
|
|
@@ -2413,29 +2560,39 @@ const storeTraps = {
|
|
|
2413
2560
|
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2414
2561
|
? e[STORE_OVERRIDE][t]
|
|
2415
2562
|
: r;
|
|
2416
|
-
const c =
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2563
|
+
const c =
|
|
2564
|
+
e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2565
|
+
? e[STORE_OPTIMISTIC_OVERRIDE][t] !== $DELETED
|
|
2566
|
+
: e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
|
|
2567
|
+
? e[STORE_OVERRIDE][t] !== $DELETED
|
|
2568
|
+
: t in e[STORE_VALUE];
|
|
2569
|
+
const a = unwrapStoreValue(n);
|
|
2570
|
+
const l = Array.isArray(o) && t !== "length";
|
|
2571
|
+
const f = l ? parseInt(t) + 1 : 0;
|
|
2572
|
+
const E =
|
|
2573
|
+
l &&
|
|
2421
2574
|
(e[STORE_OPTIMISTIC_OVERRIDE] && "length" in e[STORE_OPTIMISTIC_OVERRIDE]
|
|
2422
2575
|
? e[STORE_OPTIMISTIC_OVERRIDE].length
|
|
2423
2576
|
: e[STORE_OVERRIDE] && "length" in e[STORE_OVERRIDE]
|
|
2424
2577
|
? e[STORE_OVERRIDE].length
|
|
2425
2578
|
: o.length);
|
|
2426
|
-
const
|
|
2427
|
-
if (u ===
|
|
2428
|
-
if (
|
|
2579
|
+
const T = l && f > E ? f : undefined;
|
|
2580
|
+
if (u === a && T === undefined) return true;
|
|
2581
|
+
if (a !== undefined && a === r && T === undefined) delete e[s]?.[t];
|
|
2429
2582
|
else {
|
|
2430
2583
|
const n = e[s] || (e[s] = Object.create(null));
|
|
2431
|
-
n[t] =
|
|
2432
|
-
if (
|
|
2584
|
+
n[t] = a;
|
|
2585
|
+
if (T !== undefined) n.length = T;
|
|
2433
2586
|
}
|
|
2434
|
-
notifyStoreProperty(e, t, "set", c);
|
|
2435
|
-
if (Array.isArray(o)) {
|
|
2436
|
-
const
|
|
2437
|
-
|
|
2438
|
-
|
|
2587
|
+
notifyStoreProperty(e, t, "set", a, u, c);
|
|
2588
|
+
if (Array.isArray(o) && t !== "length" && T !== undefined) {
|
|
2589
|
+
const t = getNodes(e, STORE_NODE);
|
|
2590
|
+
if (t.length) {
|
|
2591
|
+
setSignal(t.length, T);
|
|
2592
|
+
} else if (!projectionWriteActive && !e[STORE_OPTIMISTIC]) {
|
|
2593
|
+
const n = upsertStoreNode(e, t, "length", E, e[STORE_SNAPSHOT_PROPS]);
|
|
2594
|
+
setSignal(n, T);
|
|
2595
|
+
}
|
|
2439
2596
|
}
|
|
2440
2597
|
if (false);
|
|
2441
2598
|
});
|
|
@@ -2447,7 +2604,7 @@ const storeTraps = {
|
|
|
2447
2604
|
if (writeOnly(i)) {
|
|
2448
2605
|
untrack(() => {
|
|
2449
2606
|
const { base: r, overrideKey: s } = prepareStoreWrite(e, i, t);
|
|
2450
|
-
const o = "value" in n ? { ...n, value: n.value
|
|
2607
|
+
const o = "value" in n ? { ...n, value: unwrapStoreValue(n.value) } : n;
|
|
2451
2608
|
Object.defineProperty(e[s] || (e[s] = Object.create(null)), t, o);
|
|
2452
2609
|
notifyStoreProperty(e, t, "invalidate");
|
|
2453
2610
|
if (false);
|
|
@@ -2474,7 +2631,7 @@ const storeTraps = {
|
|
|
2474
2631
|
} else if (e[i] && t in e[i]) {
|
|
2475
2632
|
delete e[i][t];
|
|
2476
2633
|
} else return true;
|
|
2477
|
-
notifyStoreProperty(e, t, "delete");
|
|
2634
|
+
notifyStoreProperty(e, t, "delete", undefined, r, true);
|
|
2478
2635
|
});
|
|
2479
2636
|
}
|
|
2480
2637
|
return true;
|
|
@@ -2544,9 +2701,9 @@ function createStore(e, t, n) {
|
|
|
2544
2701
|
return [r, e => storeSetter(r, e)];
|
|
2545
2702
|
}
|
|
2546
2703
|
function createOptimisticStore(e, t, n) {
|
|
2547
|
-
GlobalQueue.
|
|
2704
|
+
GlobalQueue.le ||= clearOptimisticStore;
|
|
2548
2705
|
const i = typeof e === "function";
|
|
2549
|
-
const r =
|
|
2706
|
+
const r = i ? t : e;
|
|
2550
2707
|
const s = i ? e : undefined;
|
|
2551
2708
|
const { store: o } = createOptimisticProjectionInternal(s, r, n);
|
|
2552
2709
|
return [o, e => storeSetter(o, e)];
|
|
@@ -2561,7 +2718,7 @@ function clearOptimisticStore(e) {
|
|
|
2561
2718
|
if (i) {
|
|
2562
2719
|
for (const e of Reflect.ownKeys(n)) {
|
|
2563
2720
|
if (i[e]) {
|
|
2564
|
-
i[e].
|
|
2721
|
+
i[e].te = undefined;
|
|
2565
2722
|
const n =
|
|
2566
2723
|
t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
|
|
2567
2724
|
const r = n === $DELETED ? undefined : n;
|
|
@@ -2569,7 +2726,7 @@ function clearOptimisticStore(e) {
|
|
|
2569
2726
|
}
|
|
2570
2727
|
}
|
|
2571
2728
|
if (i[$TRACK]) {
|
|
2572
|
-
i[$TRACK].
|
|
2729
|
+
i[$TRACK].te = undefined;
|
|
2573
2730
|
setSignal(i[$TRACK], undefined);
|
|
2574
2731
|
}
|
|
2575
2732
|
}
|
|
@@ -2578,7 +2735,7 @@ function clearOptimisticStore(e) {
|
|
|
2578
2735
|
}
|
|
2579
2736
|
delete t[STORE_OPTIMISTIC_OVERRIDE];
|
|
2580
2737
|
}
|
|
2581
|
-
function createOptimisticProjectionInternal(e, t
|
|
2738
|
+
function createOptimisticProjectionInternal(e, t, n) {
|
|
2582
2739
|
let i;
|
|
2583
2740
|
const r = new WeakMap();
|
|
2584
2741
|
const wrapper = e => {
|
|
@@ -2601,38 +2758,30 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
|
|
|
2601
2758
|
};
|
|
2602
2759
|
const s = wrapProjection(t);
|
|
2603
2760
|
if (e) {
|
|
2761
|
+
const wrapCommit = e => {
|
|
2762
|
+
setProjectionWriteActive(true);
|
|
2763
|
+
try {
|
|
2764
|
+
e();
|
|
2765
|
+
} finally {
|
|
2766
|
+
setProjectionWriteActive(false);
|
|
2767
|
+
}
|
|
2768
|
+
};
|
|
2604
2769
|
i = computed(() => {
|
|
2605
|
-
const t = getOwner();
|
|
2606
|
-
let i = false;
|
|
2607
|
-
let r;
|
|
2608
|
-
const o = new Proxy(
|
|
2609
|
-
s,
|
|
2610
|
-
createWriteTraps(() => !i || t.ye === r)
|
|
2611
|
-
);
|
|
2612
2770
|
setProjectionWriteActive(true);
|
|
2613
2771
|
try {
|
|
2614
|
-
|
|
2615
|
-
r = e(o);
|
|
2616
|
-
i = true;
|
|
2617
|
-
const u = handleAsync(t, r, e => {
|
|
2618
|
-
setProjectionWriteActive(true);
|
|
2619
|
-
try {
|
|
2620
|
-
e !== o && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id"));
|
|
2621
|
-
} finally {
|
|
2622
|
-
setProjectionWriteActive(false);
|
|
2623
|
-
}
|
|
2624
|
-
});
|
|
2625
|
-
u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
|
|
2626
|
-
});
|
|
2772
|
+
runProjectionComputed(s, e, n?.key || "id", wrapCommit);
|
|
2627
2773
|
} finally {
|
|
2628
2774
|
setProjectionWriteActive(false);
|
|
2629
2775
|
}
|
|
2630
|
-
});
|
|
2631
|
-
i.
|
|
2776
|
+
}, undefined);
|
|
2777
|
+
i.Ee &= ~CONFIG_AUTO_DISPOSE;
|
|
2632
2778
|
}
|
|
2633
2779
|
return { store: s, node: i };
|
|
2634
2780
|
}
|
|
2635
2781
|
const DELETE = Symbol(0);
|
|
2782
|
+
function isPrototypePollutionKey(e) {
|
|
2783
|
+
return e === "__proto__" || e === "constructor" || e === "prototype";
|
|
2784
|
+
}
|
|
2636
2785
|
function updatePath(e, t, n = 0) {
|
|
2637
2786
|
let i,
|
|
2638
2787
|
r = e;
|
|
@@ -2640,6 +2789,7 @@ function updatePath(e, t, n = 0) {
|
|
|
2640
2789
|
i = t[n];
|
|
2641
2790
|
const s = typeof i;
|
|
2642
2791
|
const o = Array.isArray(e);
|
|
2792
|
+
if (s === "string" && isPrototypePollutionKey(i)) return;
|
|
2643
2793
|
if (Array.isArray(i)) {
|
|
2644
2794
|
for (let r = 0; r < i.length; r++) {
|
|
2645
2795
|
t[n] = i[r];
|
|
@@ -2683,6 +2833,7 @@ function updatePath(e, t, n = 0) {
|
|
|
2683
2833
|
const n = Object.keys(s);
|
|
2684
2834
|
for (let e = 0; e < n.length; e++) {
|
|
2685
2835
|
const i = n[e];
|
|
2836
|
+
if (isPrototypePollutionKey(i)) continue;
|
|
2686
2837
|
const r = Object.getOwnPropertyDescriptor(s, i);
|
|
2687
2838
|
if (r.get || r.set) Object.defineProperty(t, i, r);
|
|
2688
2839
|
else t[i] = r.value;
|
|
@@ -2888,67 +3039,69 @@ function mapArray(e, t, n) {
|
|
|
2888
3039
|
const i = typeof n?.keyed === "function" ? n.keyed : undefined;
|
|
2889
3040
|
const r = t.length > 1;
|
|
2890
3041
|
const s = t;
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
3042
|
+
const o = {
|
|
3043
|
+
je: createOwner(),
|
|
3044
|
+
$e: 0,
|
|
3045
|
+
Ke: e,
|
|
3046
|
+
Ye: [],
|
|
3047
|
+
Be: s,
|
|
3048
|
+
Ze: [],
|
|
3049
|
+
qe: [],
|
|
3050
|
+
ze: i,
|
|
3051
|
+
Xe: i || n?.keyed === false ? [] : undefined,
|
|
3052
|
+
Je: r ? [] : undefined,
|
|
3053
|
+
et: n?.fallback
|
|
3054
|
+
};
|
|
3055
|
+
const u = computed(updateKeyedMap.bind(o));
|
|
3056
|
+
o.je.u = u;
|
|
3057
|
+
u.Ee &= ~CONFIG_AUTO_DISPOSE;
|
|
3058
|
+
return accessor(u);
|
|
2906
3059
|
}
|
|
2907
|
-
const pureOptions = {
|
|
3060
|
+
const pureOptions = { ownedWrite: true };
|
|
2908
3061
|
function updateKeyedMap() {
|
|
2909
|
-
const e = this.
|
|
3062
|
+
const e = this.Ke() || [],
|
|
2910
3063
|
t = e.length;
|
|
2911
3064
|
e[$TRACK];
|
|
2912
|
-
runWithOwner(this.
|
|
3065
|
+
runWithOwner(this.je, () => {
|
|
2913
3066
|
let n,
|
|
2914
3067
|
i,
|
|
2915
|
-
r = this.
|
|
3068
|
+
r = this.Xe
|
|
2916
3069
|
? () => {
|
|
2917
|
-
this.
|
|
2918
|
-
this.
|
|
2919
|
-
return this.
|
|
3070
|
+
this.Xe[i] = signal(e[i], pureOptions);
|
|
3071
|
+
this.Je && (this.Je[i] = signal(i, pureOptions));
|
|
3072
|
+
return this.Be(accessor(this.Xe[i]), this.Je ? accessor(this.Je[i]) : undefined);
|
|
2920
3073
|
}
|
|
2921
|
-
: this.
|
|
3074
|
+
: this.Je
|
|
2922
3075
|
? () => {
|
|
2923
3076
|
const t = e[i];
|
|
2924
|
-
this.
|
|
2925
|
-
return this.
|
|
3077
|
+
this.Je[i] = signal(i, pureOptions);
|
|
3078
|
+
return this.Be(() => t, accessor(this.Je[i]));
|
|
2926
3079
|
}
|
|
2927
3080
|
: () => {
|
|
2928
3081
|
const t = e[i];
|
|
2929
|
-
return this.
|
|
3082
|
+
return this.Be(() => t);
|
|
2930
3083
|
};
|
|
2931
3084
|
if (t === 0) {
|
|
2932
|
-
if (this
|
|
2933
|
-
this.
|
|
2934
|
-
this.Je = [];
|
|
3085
|
+
if (this.$e !== 0) {
|
|
3086
|
+
this.je.dispose(false);
|
|
2935
3087
|
this.qe = [];
|
|
2936
|
-
this.
|
|
2937
|
-
this.Ze =
|
|
2938
|
-
this
|
|
2939
|
-
this.
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
this.
|
|
3088
|
+
this.Ye = [];
|
|
3089
|
+
this.Ze = [];
|
|
3090
|
+
this.$e = 0;
|
|
3091
|
+
this.Xe && (this.Xe = []);
|
|
3092
|
+
this.Je && (this.Je = []);
|
|
3093
|
+
}
|
|
3094
|
+
if (this.et && !this.Ze[0]) {
|
|
3095
|
+
this.Ze[0] = runWithOwner((this.qe[0] = createOwner()), this.et);
|
|
3096
|
+
}
|
|
3097
|
+
} else if (this.$e === 0) {
|
|
3098
|
+
if (this.qe[0]) this.qe[0].dispose();
|
|
3099
|
+
this.Ze = new Array(t);
|
|
2947
3100
|
for (i = 0; i < t; i++) {
|
|
2948
|
-
this.
|
|
2949
|
-
this.
|
|
3101
|
+
this.Ye[i] = e[i];
|
|
3102
|
+
this.Ze[i] = runWithOwner((this.qe[i] = createOwner()), r);
|
|
2950
3103
|
}
|
|
2951
|
-
this
|
|
3104
|
+
this.$e = t;
|
|
2952
3105
|
} else {
|
|
2953
3106
|
let s,
|
|
2954
3107
|
o,
|
|
@@ -2958,153 +3111,157 @@ function updateKeyedMap() {
|
|
|
2958
3111
|
l,
|
|
2959
3112
|
f,
|
|
2960
3113
|
E = new Array(t),
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
3114
|
+
T = new Array(t),
|
|
3115
|
+
S = this.Xe ? new Array(t) : undefined,
|
|
3116
|
+
d = this.Je ? new Array(t) : undefined;
|
|
2964
3117
|
for (
|
|
2965
|
-
s = 0, o = Math.min(this
|
|
2966
|
-
s < o && (this.
|
|
3118
|
+
s = 0, o = Math.min(this.$e, t);
|
|
3119
|
+
s < o && (this.Ye[s] === e[s] || (this.Xe && compare(this.ze, this.Ye[s], e[s])));
|
|
2967
3120
|
s++
|
|
2968
3121
|
) {
|
|
2969
|
-
if (this.
|
|
3122
|
+
if (this.Xe) setSignal(this.Xe[s], e[s]);
|
|
2970
3123
|
}
|
|
2971
3124
|
for (
|
|
2972
|
-
o = this
|
|
3125
|
+
o = this.$e - 1, u = t - 1;
|
|
2973
3126
|
o >= s &&
|
|
2974
3127
|
u >= s &&
|
|
2975
|
-
(this.
|
|
3128
|
+
(this.Ye[o] === e[u] || (this.Xe && compare(this.ze, this.Ye[o], e[u])));
|
|
2976
3129
|
o--, u--
|
|
2977
3130
|
) {
|
|
2978
|
-
E[u] = this.
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
3131
|
+
E[u] = this.Ze[o];
|
|
3132
|
+
T[u] = this.qe[o];
|
|
3133
|
+
S && (S[u] = this.Xe[o]);
|
|
3134
|
+
d && (d[u] = this.Je[o]);
|
|
2982
3135
|
}
|
|
2983
3136
|
l = new Map();
|
|
2984
3137
|
f = new Array(u + 1);
|
|
2985
3138
|
for (i = u; i >= s; i--) {
|
|
2986
3139
|
c = e[i];
|
|
2987
|
-
a = this.
|
|
3140
|
+
a = this.ze ? this.ze(c) : c;
|
|
2988
3141
|
n = l.get(a);
|
|
2989
3142
|
f[i] = n === undefined ? -1 : n;
|
|
2990
3143
|
l.set(a, i);
|
|
2991
3144
|
}
|
|
2992
3145
|
for (n = s; n <= o; n++) {
|
|
2993
|
-
c = this.
|
|
2994
|
-
a = this.
|
|
3146
|
+
c = this.Ye[n];
|
|
3147
|
+
a = this.ze ? this.ze(c) : c;
|
|
2995
3148
|
i = l.get(a);
|
|
2996
3149
|
if (i !== undefined && i !== -1) {
|
|
2997
|
-
E[i] = this.
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3150
|
+
E[i] = this.Ze[n];
|
|
3151
|
+
T[i] = this.qe[n];
|
|
3152
|
+
S && (S[i] = this.Xe[n]);
|
|
3153
|
+
d && (d[i] = this.Je[n]);
|
|
3001
3154
|
i = f[i];
|
|
3002
3155
|
l.set(a, i);
|
|
3003
|
-
} else this.
|
|
3156
|
+
} else this.qe[n].dispose();
|
|
3004
3157
|
}
|
|
3005
3158
|
for (i = s; i < t; i++) {
|
|
3006
3159
|
if (i in E) {
|
|
3007
|
-
this.
|
|
3008
|
-
this.
|
|
3009
|
-
if (T) {
|
|
3010
|
-
this.tt[i] = T[i];
|
|
3011
|
-
setSignal(this.tt[i], e[i]);
|
|
3012
|
-
}
|
|
3160
|
+
this.Ze[i] = E[i];
|
|
3161
|
+
this.qe[i] = T[i];
|
|
3013
3162
|
if (S) {
|
|
3014
|
-
this.
|
|
3015
|
-
setSignal(this.
|
|
3163
|
+
this.Xe[i] = S[i];
|
|
3164
|
+
setSignal(this.Xe[i], e[i]);
|
|
3165
|
+
}
|
|
3166
|
+
if (d) {
|
|
3167
|
+
this.Je[i] = d[i];
|
|
3168
|
+
setSignal(this.Je[i], i);
|
|
3016
3169
|
}
|
|
3017
3170
|
} else {
|
|
3018
|
-
this.
|
|
3171
|
+
this.Ze[i] = runWithOwner((this.qe[i] = createOwner()), r);
|
|
3019
3172
|
}
|
|
3020
3173
|
}
|
|
3021
|
-
this.
|
|
3022
|
-
this.
|
|
3174
|
+
this.Ze = this.Ze.slice(0, (this.$e = t));
|
|
3175
|
+
this.Ye = e.slice(0);
|
|
3023
3176
|
}
|
|
3024
3177
|
});
|
|
3025
|
-
return this.
|
|
3178
|
+
return this.Ze;
|
|
3026
3179
|
}
|
|
3027
3180
|
function repeat(e, t, n) {
|
|
3028
3181
|
const i = t;
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3182
|
+
const r = computed(
|
|
3183
|
+
updateRepeat.bind({
|
|
3184
|
+
je: createOwner(),
|
|
3185
|
+
$e: 0,
|
|
3186
|
+
tt: 0,
|
|
3187
|
+
nt: e,
|
|
3188
|
+
Be: i,
|
|
3189
|
+
qe: [],
|
|
3190
|
+
Ze: [],
|
|
3191
|
+
it: n?.from,
|
|
3192
|
+
et: n?.fallback
|
|
3193
|
+
})
|
|
3194
|
+
);
|
|
3195
|
+
r.Ee &= ~CONFIG_AUTO_DISPOSE;
|
|
3196
|
+
return accessor(r);
|
|
3040
3197
|
}
|
|
3041
3198
|
function updateRepeat() {
|
|
3042
|
-
const e = this.
|
|
3043
|
-
const t = this.
|
|
3044
|
-
runWithOwner(this.
|
|
3199
|
+
const e = this.nt();
|
|
3200
|
+
const t = this.it?.() || 0;
|
|
3201
|
+
runWithOwner(this.je, () => {
|
|
3045
3202
|
if (e === 0) {
|
|
3046
|
-
if (this
|
|
3047
|
-
this.
|
|
3048
|
-
this.
|
|
3049
|
-
this.
|
|
3050
|
-
this
|
|
3203
|
+
if (this.$e !== 0) {
|
|
3204
|
+
this.je.dispose(false);
|
|
3205
|
+
this.qe = [];
|
|
3206
|
+
this.Ze = [];
|
|
3207
|
+
this.$e = 0;
|
|
3051
3208
|
}
|
|
3052
|
-
if (this.
|
|
3053
|
-
this.
|
|
3209
|
+
if (this.et && !this.Ze[0]) {
|
|
3210
|
+
this.Ze[0] = runWithOwner((this.qe[0] = createOwner()), this.et);
|
|
3054
3211
|
}
|
|
3055
3212
|
return;
|
|
3056
3213
|
}
|
|
3057
3214
|
const n = t + e;
|
|
3058
|
-
const i = this.
|
|
3059
|
-
if (this
|
|
3060
|
-
for (let e = n; e < i; e++) this.
|
|
3061
|
-
if (this.
|
|
3062
|
-
let e = this.
|
|
3063
|
-
while (e < t && e < this
|
|
3064
|
-
this.
|
|
3065
|
-
this.
|
|
3066
|
-
} else if (this.
|
|
3067
|
-
let n = i - this.
|
|
3068
|
-
let r = this.
|
|
3069
|
-
this.
|
|
3215
|
+
const i = this.tt + this.$e;
|
|
3216
|
+
if (this.$e === 0 && this.qe[0]) this.qe[0].dispose();
|
|
3217
|
+
for (let e = n; e < i; e++) this.qe[e - this.tt].dispose();
|
|
3218
|
+
if (this.tt < t) {
|
|
3219
|
+
let e = this.tt;
|
|
3220
|
+
while (e < t && e < this.$e) this.qe[e++].dispose();
|
|
3221
|
+
this.qe.splice(0, t - this.tt);
|
|
3222
|
+
this.Ze.splice(0, t - this.tt);
|
|
3223
|
+
} else if (this.tt > t) {
|
|
3224
|
+
let n = i - this.tt - 1;
|
|
3225
|
+
let r = this.tt - t;
|
|
3226
|
+
this.qe.length = this.Ze.length = e;
|
|
3070
3227
|
while (n >= r) {
|
|
3071
|
-
this.
|
|
3072
|
-
this.
|
|
3228
|
+
this.qe[n] = this.qe[n - r];
|
|
3229
|
+
this.Ze[n] = this.Ze[n - r];
|
|
3073
3230
|
n--;
|
|
3074
3231
|
}
|
|
3075
3232
|
for (let e = 0; e < r; e++) {
|
|
3076
|
-
this.
|
|
3233
|
+
this.Ze[e] = runWithOwner((this.qe[e] = createOwner()), () => this.Be(e + t));
|
|
3077
3234
|
}
|
|
3078
3235
|
}
|
|
3079
3236
|
for (let e = i; e < n; e++) {
|
|
3080
|
-
this.
|
|
3237
|
+
this.Ze[e - t] = runWithOwner((this.qe[e - t] = createOwner()), () => this.Be(e));
|
|
3081
3238
|
}
|
|
3082
|
-
this.
|
|
3083
|
-
this.
|
|
3084
|
-
this
|
|
3239
|
+
this.Ze = this.Ze.slice(0, e);
|
|
3240
|
+
this.tt = t;
|
|
3241
|
+
this.$e = e;
|
|
3085
3242
|
});
|
|
3086
|
-
return this.
|
|
3243
|
+
return this.Ze;
|
|
3087
3244
|
}
|
|
3088
3245
|
function compare(e, t, n) {
|
|
3089
3246
|
return e ? e(t) === e(n) : true;
|
|
3090
3247
|
}
|
|
3091
3248
|
function boundaryComputed(e, t) {
|
|
3092
|
-
const n = computed(e,
|
|
3249
|
+
const n = computed(e, { lazy: true });
|
|
3093
3250
|
n.Ge = (e, t) => {
|
|
3094
|
-
const i = e !== undefined ? e : n.
|
|
3095
|
-
const r = t !== undefined ? t : n.
|
|
3096
|
-
n.
|
|
3097
|
-
n
|
|
3251
|
+
const i = e !== undefined ? e : n.Oe;
|
|
3252
|
+
const r = t !== undefined ? t : n.Te;
|
|
3253
|
+
n.Oe &= ~n.rt;
|
|
3254
|
+
n.$.notify(n, n.rt, i, r);
|
|
3098
3255
|
};
|
|
3099
|
-
n.
|
|
3100
|
-
n.
|
|
3256
|
+
n.rt = t;
|
|
3257
|
+
n.Ee &= ~CONFIG_AUTO_DISPOSE;
|
|
3101
3258
|
recompute(n, true);
|
|
3102
3259
|
return n;
|
|
3103
3260
|
}
|
|
3104
3261
|
function createBoundChildren(e, t, n, i) {
|
|
3105
|
-
const r = e
|
|
3106
|
-
r.addChild((e
|
|
3107
|
-
cleanup(() => r.removeChild(e
|
|
3262
|
+
const r = e.$;
|
|
3263
|
+
r.addChild((e.$ = n));
|
|
3264
|
+
cleanup(() => r.removeChild(e.$));
|
|
3108
3265
|
return runWithOwner(e, () => {
|
|
3109
3266
|
const e = computed(t);
|
|
3110
3267
|
return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
|
|
@@ -3114,168 +3271,215 @@ const ON_INIT = Symbol();
|
|
|
3114
3271
|
const RevealControllerContext = createContext(null);
|
|
3115
3272
|
let _revealUsed = false;
|
|
3116
3273
|
const FALSE_ACCESSOR = () => false;
|
|
3274
|
+
const SEQUENTIAL_ACCESSOR = () => "sequential";
|
|
3117
3275
|
function isRevealController(e) {
|
|
3118
3276
|
return e instanceof RevealController;
|
|
3119
3277
|
}
|
|
3120
3278
|
function isSlotReady(e) {
|
|
3121
|
-
return isRevealController(e) ? e.isReady() : e.
|
|
3279
|
+
return isRevealController(e) ? e.isReady() : e.st.size === 0 && !e.ot;
|
|
3280
|
+
}
|
|
3281
|
+
function isSlotMinimallyReady(e) {
|
|
3282
|
+
return isRevealController(e) ? e.isMinimallyReady() : isSlotReady(e);
|
|
3122
3283
|
}
|
|
3123
3284
|
function setSlotState(e, t, n, i) {
|
|
3124
|
-
setSignal(e.
|
|
3125
|
-
setSignal(e.
|
|
3285
|
+
setSignal(e.ut, n);
|
|
3286
|
+
setSignal(e.ct, i);
|
|
3126
3287
|
if (isRevealController(e)) {
|
|
3127
|
-
if (!n && e.
|
|
3288
|
+
if (!n && e.lt === t) e.lt = undefined;
|
|
3128
3289
|
return e.evaluate(n, i);
|
|
3129
3290
|
}
|
|
3130
|
-
if (!n && e.
|
|
3291
|
+
if (!n && e.ft === t && e.Et) e.ft = undefined;
|
|
3131
3292
|
}
|
|
3132
3293
|
class RevealController {
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3294
|
+
Tt;
|
|
3295
|
+
St;
|
|
3296
|
+
dt = [];
|
|
3297
|
+
lt;
|
|
3298
|
+
ut = signal(false, { ownedWrite: true, Fe: true });
|
|
3299
|
+
ct = signal(false, { ownedWrite: true, Fe: true });
|
|
3300
|
+
Ot = true;
|
|
3301
|
+
Rt = true;
|
|
3302
|
+
_t = false;
|
|
3141
3303
|
constructor(e, t) {
|
|
3142
|
-
this.
|
|
3143
|
-
this.
|
|
3304
|
+
this.Tt = e;
|
|
3305
|
+
this.St = t;
|
|
3144
3306
|
}
|
|
3145
|
-
|
|
3146
|
-
for (let t = 0; t < this.
|
|
3147
|
-
const n = this.
|
|
3148
|
-
if ((isRevealController(n) ? n.
|
|
3307
|
+
It(e) {
|
|
3308
|
+
for (let t = 0; t < this.dt.length; t++) {
|
|
3309
|
+
const n = this.dt[t];
|
|
3310
|
+
if ((isRevealController(n) ? n.lt : n.ft) !== this) continue;
|
|
3149
3311
|
if (e(n) === false) return false;
|
|
3150
3312
|
}
|
|
3151
3313
|
return true;
|
|
3152
3314
|
}
|
|
3153
3315
|
isReady() {
|
|
3154
|
-
return this.
|
|
3316
|
+
return this.It(isSlotReady);
|
|
3317
|
+
}
|
|
3318
|
+
isMinimallyReady() {
|
|
3319
|
+
const e = untrack(this.Tt);
|
|
3320
|
+
if (e === "together") return this.isReady();
|
|
3321
|
+
if (e === "natural") {
|
|
3322
|
+
let e = false;
|
|
3323
|
+
let t = false;
|
|
3324
|
+
this.It(n => {
|
|
3325
|
+
e = true;
|
|
3326
|
+
if (isSlotMinimallyReady(n)) {
|
|
3327
|
+
t = true;
|
|
3328
|
+
return false;
|
|
3329
|
+
}
|
|
3330
|
+
});
|
|
3331
|
+
return !e || t;
|
|
3332
|
+
}
|
|
3333
|
+
let t = true;
|
|
3334
|
+
this.It(e => {
|
|
3335
|
+
t = isSlotMinimallyReady(e);
|
|
3336
|
+
return false;
|
|
3337
|
+
});
|
|
3338
|
+
return t;
|
|
3155
3339
|
}
|
|
3156
3340
|
register(e) {
|
|
3157
|
-
if (this.
|
|
3158
|
-
this.
|
|
3159
|
-
const t =
|
|
3160
|
-
setSignal(e.
|
|
3341
|
+
if (this.dt.includes(e)) return;
|
|
3342
|
+
this.dt.push(e);
|
|
3343
|
+
const t = untrack(this.Tt);
|
|
3344
|
+
(setSignal(e.ut, true), setSignal(e.ct, t === "sequential" ? !!untrack(this.St) : false));
|
|
3161
3345
|
untrack(() => this.evaluate());
|
|
3162
3346
|
}
|
|
3163
3347
|
unregister(e) {
|
|
3164
|
-
const t = this.
|
|
3165
|
-
if (t >= 0) this.
|
|
3348
|
+
const t = this.dt.indexOf(e);
|
|
3349
|
+
if (t >= 0) this.dt.splice(t, 1);
|
|
3166
3350
|
untrack(() => this.evaluate());
|
|
3167
3351
|
}
|
|
3168
3352
|
evaluate(e, t) {
|
|
3169
|
-
if (this.
|
|
3170
|
-
this.
|
|
3171
|
-
const n = this.
|
|
3353
|
+
if (this._t) return;
|
|
3354
|
+
this._t = true;
|
|
3355
|
+
const n = this.Ot;
|
|
3356
|
+
const i = this.Rt;
|
|
3172
3357
|
try {
|
|
3173
|
-
const n = e ?? read(this.
|
|
3174
|
-
i =
|
|
3175
|
-
r =
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3358
|
+
const n = e ?? read(this.ut),
|
|
3359
|
+
i = untrack(this.Tt),
|
|
3360
|
+
r = i === "sequential" && !!untrack(this.St),
|
|
3361
|
+
s = t ?? r;
|
|
3362
|
+
if (n) {
|
|
3363
|
+
this.It(e => setSlotState(e, this, true, s));
|
|
3364
|
+
} else if (i === "natural") {
|
|
3365
|
+
this.It(e => {
|
|
3366
|
+
if (isRevealController(e)) {
|
|
3367
|
+
setSignal(e.ct, false);
|
|
3368
|
+
setSignal(e.ut, false);
|
|
3369
|
+
e.evaluate(false, false);
|
|
3370
|
+
} else {
|
|
3371
|
+
setSlotState(e, this, !isSlotReady(e), false);
|
|
3372
|
+
}
|
|
3373
|
+
});
|
|
3374
|
+
} else if (i === "together") {
|
|
3375
|
+
const e = this.It(isSlotMinimallyReady);
|
|
3376
|
+
this.It(t => setSlotState(t, this, !e, false));
|
|
3180
3377
|
} else {
|
|
3181
3378
|
let e = false;
|
|
3182
|
-
this.
|
|
3183
|
-
if (e) return setSlotState(t, this, true,
|
|
3379
|
+
this.It(t => {
|
|
3380
|
+
if (e) return setSlotState(t, this, true, r);
|
|
3184
3381
|
if (isSlotReady(t)) return setSlotState(t, this, false, false);
|
|
3185
3382
|
e = true;
|
|
3186
|
-
|
|
3383
|
+
if (isRevealController(t)) {
|
|
3384
|
+
setSignal(t.ct, false);
|
|
3385
|
+
setSignal(t.ut, false);
|
|
3386
|
+
t.evaluate(false, false);
|
|
3387
|
+
} else {
|
|
3388
|
+
setSlotState(t, this, true, false);
|
|
3389
|
+
}
|
|
3187
3390
|
});
|
|
3188
3391
|
}
|
|
3189
3392
|
} finally {
|
|
3190
|
-
this.
|
|
3191
|
-
this.
|
|
3393
|
+
this.Ot = this.isReady();
|
|
3394
|
+
this.Rt = this.isMinimallyReady();
|
|
3395
|
+
this._t = false;
|
|
3192
3396
|
}
|
|
3193
|
-
if (this.
|
|
3397
|
+
if (this.lt && (n !== this.Ot || i !== this.Rt)) this.lt.evaluate();
|
|
3194
3398
|
}
|
|
3195
3399
|
}
|
|
3196
3400
|
class CollectionQueue extends Queue {
|
|
3401
|
+
ht;
|
|
3402
|
+
st = new Set();
|
|
3197
3403
|
Nt;
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
ft
|
|
3202
|
-
Et =
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
gt;
|
|
3206
|
-
Ct = ON_INIT;
|
|
3404
|
+
ot = true;
|
|
3405
|
+
ut = signal(false, { ownedWrite: true, Fe: true });
|
|
3406
|
+
ct = signal(false, { ownedWrite: true, Fe: true });
|
|
3407
|
+
ft;
|
|
3408
|
+
Et = false;
|
|
3409
|
+
At;
|
|
3410
|
+
Pt = ON_INIT;
|
|
3207
3411
|
constructor(e) {
|
|
3208
3412
|
super();
|
|
3209
|
-
this.
|
|
3413
|
+
this.ht = e;
|
|
3210
3414
|
}
|
|
3211
3415
|
run(e) {
|
|
3212
|
-
if (!e || (read(this.
|
|
3416
|
+
if (!e || (read(this.ut) && (!_revealUsed || read(this.ct)))) return;
|
|
3213
3417
|
return super.run(e);
|
|
3214
3418
|
}
|
|
3215
3419
|
notify(e, t, n, i) {
|
|
3216
|
-
if (!(t & this.
|
|
3217
|
-
if (this.
|
|
3420
|
+
if (!(t & this.ht)) return super.notify(e, t, n, i);
|
|
3421
|
+
if (this.Et && this.At) {
|
|
3218
3422
|
const e = untrack(() => {
|
|
3219
3423
|
try {
|
|
3220
|
-
return this.
|
|
3424
|
+
return this.At();
|
|
3221
3425
|
} catch {
|
|
3222
3426
|
return ON_INIT;
|
|
3223
3427
|
}
|
|
3224
3428
|
});
|
|
3225
|
-
if (e !== this.
|
|
3226
|
-
this.
|
|
3227
|
-
this.
|
|
3228
|
-
this.
|
|
3429
|
+
if (e !== this.Pt) {
|
|
3430
|
+
this.Pt = e;
|
|
3431
|
+
this.Et = false;
|
|
3432
|
+
this.st.clear();
|
|
3229
3433
|
}
|
|
3230
3434
|
}
|
|
3231
|
-
if (this.
|
|
3232
|
-
if (this.
|
|
3435
|
+
if (this.ht & STATUS_PENDING && this.Et) return super.notify(e, t, n, i);
|
|
3436
|
+
if (this.ht & STATUS_PENDING && n & STATUS_ERROR) {
|
|
3233
3437
|
return super.notify(e, STATUS_ERROR, n, i);
|
|
3234
3438
|
}
|
|
3235
|
-
if (n & this.
|
|
3236
|
-
this.
|
|
3237
|
-
const t = i?.source || e.
|
|
3439
|
+
if (n & this.ht) {
|
|
3440
|
+
this.ot = true;
|
|
3441
|
+
const t = i?.source || e.Te?.source;
|
|
3238
3442
|
if (t) {
|
|
3239
|
-
const e = this.
|
|
3240
|
-
this.
|
|
3241
|
-
if (e) setSignal(this.
|
|
3443
|
+
const e = this.st.size === 0;
|
|
3444
|
+
this.st.add(t);
|
|
3445
|
+
if (e) setSignal(this.ut, true);
|
|
3242
3446
|
}
|
|
3243
3447
|
}
|
|
3244
|
-
t &= ~this.
|
|
3448
|
+
t &= ~this.ht;
|
|
3245
3449
|
return t ? super.notify(e, t, n, i) : true;
|
|
3246
3450
|
}
|
|
3247
3451
|
checkSources() {
|
|
3248
|
-
for (const e of this.
|
|
3452
|
+
for (const e of this.st) {
|
|
3249
3453
|
if (
|
|
3250
|
-
e.
|
|
3251
|
-
(!(e.
|
|
3454
|
+
e.R & REACTIVE_DISPOSED ||
|
|
3455
|
+
(!(e.Oe & this.ht) && !(this.ht & STATUS_ERROR && e.Oe & STATUS_PENDING))
|
|
3252
3456
|
)
|
|
3253
|
-
this.
|
|
3457
|
+
this.st.delete(e);
|
|
3254
3458
|
}
|
|
3255
|
-
if (!this.
|
|
3256
|
-
if (this.
|
|
3257
|
-
this.
|
|
3459
|
+
if (!this.st.size) {
|
|
3460
|
+
if (this.ht & STATUS_PENDING && this.ot && !this.Et && this.Nt) {
|
|
3461
|
+
this.ot = !!(this.Nt.Oe & this.ht);
|
|
3258
3462
|
} else {
|
|
3259
|
-
this.
|
|
3463
|
+
this.ot = false;
|
|
3260
3464
|
}
|
|
3261
|
-
if (!this.
|
|
3262
|
-
setSignal(this.
|
|
3263
|
-
if (this.
|
|
3465
|
+
if (!this.ot) {
|
|
3466
|
+
setSignal(this.ut, false);
|
|
3467
|
+
if (this.At) {
|
|
3264
3468
|
try {
|
|
3265
|
-
this.
|
|
3469
|
+
this.Pt = untrack(() => this.At());
|
|
3266
3470
|
} catch {}
|
|
3267
3471
|
}
|
|
3268
3472
|
}
|
|
3269
3473
|
}
|
|
3270
|
-
if (_revealUsed) this.
|
|
3474
|
+
if (_revealUsed) this.ft?.evaluate();
|
|
3271
3475
|
}
|
|
3272
3476
|
}
|
|
3273
3477
|
function createCollectionBoundary(e, t, n, i) {
|
|
3274
3478
|
const r = createOwner();
|
|
3275
3479
|
if (_revealUsed) setContext(RevealControllerContext, null, r);
|
|
3276
3480
|
const s = new CollectionQueue(e);
|
|
3277
|
-
if (i) s.
|
|
3278
|
-
const o = (s.
|
|
3481
|
+
if (i) s.At = i;
|
|
3482
|
+
const o = (s.Nt = createBoundChildren(r, t, s, e));
|
|
3279
3483
|
untrack(() => {
|
|
3280
3484
|
let t = false;
|
|
3281
3485
|
try {
|
|
@@ -3284,33 +3488,34 @@ function createCollectionBoundary(e, t, n, i) {
|
|
|
3284
3488
|
if (e instanceof NotReadyError) t = true;
|
|
3285
3489
|
else throw e;
|
|
3286
3490
|
}
|
|
3287
|
-
s.
|
|
3491
|
+
s.ot = t || !!(o.Oe & e) || o.Te instanceof NotReadyError;
|
|
3288
3492
|
});
|
|
3289
3493
|
const u = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
|
|
3290
3494
|
if (u) {
|
|
3291
|
-
s.
|
|
3495
|
+
s.ft = u;
|
|
3292
3496
|
u.register(s);
|
|
3293
3497
|
cleanup(() => u.unregister(s));
|
|
3294
3498
|
}
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3499
|
+
return accessor(
|
|
3500
|
+
computed(() => {
|
|
3501
|
+
if (!read(s.ut)) {
|
|
3502
|
+
const e = read(o);
|
|
3503
|
+
if (!untrack(() => read(s.ut))) return ((s.Et = true), e);
|
|
3504
|
+
}
|
|
3505
|
+
if (_revealUsed && read(s.ct)) return undefined;
|
|
3506
|
+
return n(s);
|
|
3507
|
+
})
|
|
3508
|
+
);
|
|
3304
3509
|
}
|
|
3305
3510
|
function createLoadingBoundary(e, t, n) {
|
|
3306
3511
|
return createCollectionBoundary(STATUS_PENDING, e, () => t(), n?.on);
|
|
3307
3512
|
}
|
|
3308
3513
|
function createErrorBoundary(e, t) {
|
|
3309
3514
|
return createCollectionBoundary(STATUS_ERROR, e, e => {
|
|
3310
|
-
let n = e.
|
|
3311
|
-
const i = n.
|
|
3515
|
+
let n = e.st.values().next().value;
|
|
3516
|
+
const i = n.Te?.cause ?? n.Te;
|
|
3312
3517
|
return t(i, () => {
|
|
3313
|
-
for (const t of e.
|
|
3518
|
+
for (const t of e.st) recompute(t);
|
|
3314
3519
|
schedule();
|
|
3315
3520
|
});
|
|
3316
3521
|
});
|
|
@@ -3319,7 +3524,7 @@ function createRevealOrder(e, t) {
|
|
|
3319
3524
|
_revealUsed = true;
|
|
3320
3525
|
const n = createOwner();
|
|
3321
3526
|
const i = getContext(RevealControllerContext);
|
|
3322
|
-
const r = t?.
|
|
3527
|
+
const r = t?.order || SEQUENTIAL_ACCESSOR,
|
|
3323
3528
|
s = t?.collapsed || FALSE_ACCESSOR;
|
|
3324
3529
|
const o = new RevealController(r, s);
|
|
3325
3530
|
setContext(RevealControllerContext, o, n);
|
|
@@ -3331,7 +3536,7 @@ function createRevealOrder(e, t) {
|
|
|
3331
3536
|
o.evaluate();
|
|
3332
3537
|
});
|
|
3333
3538
|
if (i) {
|
|
3334
|
-
o.
|
|
3539
|
+
o.lt = i;
|
|
3335
3540
|
i.register(o);
|
|
3336
3541
|
cleanup(() => i.unregister(o));
|
|
3337
3542
|
}
|