@solidjs/signals 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.js +15 -4
- package/dist/node.cjs +310 -298
- package/dist/prod.js +309 -298
- package/dist/types/boundaries.d.ts +3 -1
- package/dist/types/core/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/node.cjs
CHANGED
|
@@ -27,16 +27,16 @@ var SUPPORTS_PROXY = typeof Proxy === "function";
|
|
|
27
27
|
// src/core/heap.ts
|
|
28
28
|
function actualInsertIntoHeap(n, heap) {
|
|
29
29
|
var _a, _b, _c;
|
|
30
|
-
const parentHeight = (((_a = n.
|
|
31
|
-
if (parentHeight >= n.
|
|
32
|
-
n.
|
|
33
|
-
const height = n.
|
|
34
|
-
const heapAtHeight = heap.
|
|
30
|
+
const parentHeight = (((_a = n.q) == null ? void 0 : _a._) ? (_b = n.q.$) == null ? void 0 : _b.c : (_c = n.q) == null ? void 0 : _c.c) ?? -1;
|
|
31
|
+
if (parentHeight >= n.c)
|
|
32
|
+
n.c = parentHeight + 1;
|
|
33
|
+
const height = n.c;
|
|
34
|
+
const heapAtHeight = heap.p[height];
|
|
35
35
|
if (heapAtHeight === void 0) {
|
|
36
|
-
heap.
|
|
36
|
+
heap.p[height] = n;
|
|
37
37
|
} else {
|
|
38
38
|
const tail = heapAtHeight.x;
|
|
39
|
-
tail.
|
|
39
|
+
tail.P = n;
|
|
40
40
|
n.x = tail;
|
|
41
41
|
heapAtHeight.x = n;
|
|
42
42
|
}
|
|
@@ -68,29 +68,29 @@ function deleteFromHeap(n, heap) {
|
|
|
68
68
|
if (!(flags & (8 /* InHeap */ | 16 /* InHeapHeight */)))
|
|
69
69
|
return;
|
|
70
70
|
n.b = flags & ~(8 /* InHeap */ | 16 /* InHeapHeight */);
|
|
71
|
-
const height = n.
|
|
71
|
+
const height = n.c;
|
|
72
72
|
if (n.x === n) {
|
|
73
|
-
heap.
|
|
73
|
+
heap.p[height] = void 0;
|
|
74
74
|
} else {
|
|
75
|
-
const next = n.
|
|
76
|
-
const dhh = heap.
|
|
75
|
+
const next = n.P;
|
|
76
|
+
const dhh = heap.p[height];
|
|
77
77
|
const end = next ?? dhh;
|
|
78
78
|
if (n === dhh) {
|
|
79
|
-
heap.
|
|
79
|
+
heap.p[height] = next;
|
|
80
80
|
} else {
|
|
81
|
-
n.x.
|
|
81
|
+
n.x.P = next;
|
|
82
82
|
}
|
|
83
83
|
end.x = n.x;
|
|
84
84
|
}
|
|
85
85
|
n.x = n;
|
|
86
|
-
n.
|
|
86
|
+
n.P = void 0;
|
|
87
87
|
}
|
|
88
88
|
function markHeap(heap) {
|
|
89
|
-
if (heap
|
|
89
|
+
if (heap.aa)
|
|
90
90
|
return;
|
|
91
|
-
heap
|
|
91
|
+
heap.aa = true;
|
|
92
92
|
for (let i = 0; i <= heap.J; i++) {
|
|
93
|
-
for (let el = heap.
|
|
93
|
+
for (let el = heap.p[i]; el !== void 0; el = el.P) {
|
|
94
94
|
if (el.b & 8 /* InHeap */)
|
|
95
95
|
markNode(el);
|
|
96
96
|
}
|
|
@@ -101,48 +101,48 @@ function markNode(el, newState = 2 /* Dirty */) {
|
|
|
101
101
|
if ((flags & (1 /* Check */ | 2 /* Dirty */)) >= newState)
|
|
102
102
|
return;
|
|
103
103
|
el.b = flags & ~(1 /* Check */ | 2 /* Dirty */) | newState;
|
|
104
|
-
for (let link2 = el.
|
|
105
|
-
markNode(link2.
|
|
104
|
+
for (let link2 = el.r; link2 !== null; link2 = link2.y) {
|
|
105
|
+
markNode(link2.j, 1 /* Check */);
|
|
106
106
|
}
|
|
107
|
-
if (el.
|
|
108
|
-
for (let child = el.
|
|
109
|
-
for (let link2 = child.
|
|
110
|
-
markNode(link2.
|
|
107
|
+
if (el.ba !== null) {
|
|
108
|
+
for (let child = el.ba; child !== null; child = child.ra) {
|
|
109
|
+
for (let link2 = child.r; link2 !== null; link2 = link2.y) {
|
|
110
|
+
markNode(link2.j, 1 /* Check */);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
function runHeap(heap, recompute2) {
|
|
116
|
-
heap
|
|
117
|
-
for (heap.
|
|
118
|
-
let el = heap.
|
|
116
|
+
heap.aa = false;
|
|
117
|
+
for (heap.n = 0; heap.n <= heap.J; heap.n++) {
|
|
118
|
+
let el = heap.p[heap.n];
|
|
119
119
|
while (el !== void 0) {
|
|
120
120
|
if (el.b & 8 /* InHeap */)
|
|
121
121
|
recompute2(el);
|
|
122
122
|
else {
|
|
123
123
|
adjustHeight(el, heap);
|
|
124
124
|
}
|
|
125
|
-
el = heap.
|
|
125
|
+
el = heap.p[heap.n];
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
heap.J = 0;
|
|
129
129
|
}
|
|
130
130
|
function adjustHeight(el, heap) {
|
|
131
131
|
deleteFromHeap(el, heap);
|
|
132
|
-
let newHeight = el.
|
|
132
|
+
let newHeight = el.c;
|
|
133
133
|
for (let d = el.u; d; d = d.E) {
|
|
134
|
-
const dep1 = d.
|
|
134
|
+
const dep1 = d.Q;
|
|
135
135
|
const dep = "_owner" in dep1 ? dep1.z : dep1;
|
|
136
136
|
if ("_fn" in dep) {
|
|
137
|
-
if (dep.
|
|
138
|
-
newHeight = dep.
|
|
137
|
+
if (dep.c >= newHeight) {
|
|
138
|
+
newHeight = dep.c + 1;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
if (el.
|
|
143
|
-
el.
|
|
144
|
-
for (let s = el.
|
|
145
|
-
insertIntoHeapHeight(s.
|
|
142
|
+
if (el.c !== newHeight) {
|
|
143
|
+
el.c = newHeight;
|
|
144
|
+
for (let s = el.r; s !== null; s = s.y) {
|
|
145
|
+
insertIntoHeapHeight(s.j, heap);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
}
|
|
@@ -157,40 +157,40 @@ function schedule() {
|
|
|
157
157
|
if (scheduled)
|
|
158
158
|
return;
|
|
159
159
|
scheduled = true;
|
|
160
|
-
if (!globalQueue.
|
|
160
|
+
if (!globalQueue.ca)
|
|
161
161
|
queueMicrotask(flush);
|
|
162
162
|
}
|
|
163
163
|
var dirtyQueue = {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
p: new Array(2e3).fill(void 0),
|
|
165
|
+
aa: false,
|
|
166
|
+
n: 0,
|
|
167
167
|
J: 0
|
|
168
168
|
};
|
|
169
169
|
var zombieQueue = {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
p: new Array(2e3).fill(void 0),
|
|
171
|
+
aa: false,
|
|
172
|
+
n: 0,
|
|
173
173
|
J: 0
|
|
174
174
|
};
|
|
175
175
|
var Queue = class {
|
|
176
|
-
|
|
176
|
+
q = null;
|
|
177
177
|
A = [[], []];
|
|
178
|
-
|
|
178
|
+
R = [];
|
|
179
179
|
created = clock;
|
|
180
180
|
addChild(child) {
|
|
181
|
-
this.
|
|
182
|
-
child.
|
|
181
|
+
this.R.push(child);
|
|
182
|
+
child.q = this;
|
|
183
183
|
}
|
|
184
184
|
removeChild(child) {
|
|
185
|
-
const index = this.
|
|
185
|
+
const index = this.R.indexOf(child);
|
|
186
186
|
if (index >= 0) {
|
|
187
|
-
this.
|
|
188
|
-
child.
|
|
187
|
+
this.R.splice(index, 1);
|
|
188
|
+
child.q = null;
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
notify(node, mask, flags) {
|
|
192
|
-
if (this.
|
|
193
|
-
return this.
|
|
192
|
+
if (this.q)
|
|
193
|
+
return this.q.notify(node, mask, flags);
|
|
194
194
|
return false;
|
|
195
195
|
}
|
|
196
196
|
run(type) {
|
|
@@ -199,8 +199,8 @@ var Queue = class {
|
|
|
199
199
|
this.A[type - 1] = [];
|
|
200
200
|
runQueue(effects, type);
|
|
201
201
|
}
|
|
202
|
-
for (let i = 0; i < this.
|
|
203
|
-
this.
|
|
202
|
+
for (let i = 0; i < this.R.length; i++) {
|
|
203
|
+
this.R[i].run(type);
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
enqueue(type, fn) {
|
|
@@ -210,19 +210,19 @@ var Queue = class {
|
|
|
210
210
|
}
|
|
211
211
|
};
|
|
212
212
|
var GlobalQueue = class _GlobalQueue extends Queue {
|
|
213
|
-
|
|
213
|
+
ca = false;
|
|
214
214
|
h = [];
|
|
215
|
-
static
|
|
216
|
-
static
|
|
215
|
+
static S;
|
|
216
|
+
static la;
|
|
217
217
|
flush() {
|
|
218
|
-
if (this.
|
|
218
|
+
if (this.ca)
|
|
219
219
|
return;
|
|
220
|
-
this.
|
|
220
|
+
this.ca = true;
|
|
221
221
|
try {
|
|
222
|
-
runHeap(dirtyQueue, _GlobalQueue.
|
|
222
|
+
runHeap(dirtyQueue, _GlobalQueue.S);
|
|
223
223
|
if (activeTransition) {
|
|
224
224
|
if (!transitionComplete(activeTransition)) {
|
|
225
|
-
runHeap(zombieQueue, _GlobalQueue.
|
|
225
|
+
runHeap(zombieQueue, _GlobalQueue.S);
|
|
226
226
|
globalQueue.h = [];
|
|
227
227
|
activeTransition.queues[0].push(...globalQueue.A[0]);
|
|
228
228
|
activeTransition.queues[1].push(...globalQueue.A[1]);
|
|
@@ -239,17 +239,17 @@ var GlobalQueue = class _GlobalQueue extends Queue {
|
|
|
239
239
|
transitions.delete(activeTransition);
|
|
240
240
|
activeTransition = null;
|
|
241
241
|
if (runPending(globalQueue.h, false))
|
|
242
|
-
runHeap(dirtyQueue, _GlobalQueue.
|
|
242
|
+
runHeap(dirtyQueue, _GlobalQueue.S);
|
|
243
243
|
} else if (transitions.size)
|
|
244
|
-
runHeap(zombieQueue, _GlobalQueue.
|
|
244
|
+
runHeap(zombieQueue, _GlobalQueue.S);
|
|
245
245
|
for (let i = 0; i < globalQueue.h.length; i++) {
|
|
246
246
|
const n = globalQueue.h[i];
|
|
247
|
-
if (n.
|
|
248
|
-
n.g = n.
|
|
249
|
-
n.
|
|
247
|
+
if (n.e !== NOT_PENDING) {
|
|
248
|
+
n.g = n.e;
|
|
249
|
+
n.e = NOT_PENDING;
|
|
250
250
|
}
|
|
251
251
|
if (n.ha)
|
|
252
|
-
_GlobalQueue.
|
|
252
|
+
_GlobalQueue.la(n, false, true);
|
|
253
253
|
}
|
|
254
254
|
globalQueue.h.length = 0;
|
|
255
255
|
clock++;
|
|
@@ -257,7 +257,7 @@ var GlobalQueue = class _GlobalQueue extends Queue {
|
|
|
257
257
|
this.run(1 /* Render */);
|
|
258
258
|
this.run(2 /* User */);
|
|
259
259
|
} finally {
|
|
260
|
-
this.
|
|
260
|
+
this.ca = false;
|
|
261
261
|
unobserved.length && notifyUnobserved();
|
|
262
262
|
}
|
|
263
263
|
}
|
|
@@ -275,7 +275,7 @@ var GlobalQueue = class _GlobalQueue extends Queue {
|
|
|
275
275
|
if (activeTransition && activeTransition.time === clock)
|
|
276
276
|
return;
|
|
277
277
|
if (!activeTransition) {
|
|
278
|
-
activeTransition = node.
|
|
278
|
+
activeTransition = node.T ?? {
|
|
279
279
|
time: clock,
|
|
280
280
|
pendingNodes: [],
|
|
281
281
|
asyncNodes: [],
|
|
@@ -286,7 +286,7 @@ var GlobalQueue = class _GlobalQueue extends Queue {
|
|
|
286
286
|
activeTransition.time = clock;
|
|
287
287
|
for (let i = 0; i < globalQueue.h.length; i++) {
|
|
288
288
|
const n = globalQueue.h[i];
|
|
289
|
-
n.
|
|
289
|
+
n.T = activeTransition;
|
|
290
290
|
activeTransition.pendingNodes.push(n);
|
|
291
291
|
}
|
|
292
292
|
globalQueue.h = activeTransition.pendingNodes;
|
|
@@ -297,9 +297,9 @@ function runPending(pendingNodes, value) {
|
|
|
297
297
|
const p = pendingNodes.slice();
|
|
298
298
|
for (let i = 0; i < p.length; i++) {
|
|
299
299
|
const n = p[i];
|
|
300
|
-
n.
|
|
300
|
+
n.T = activeTransition;
|
|
301
301
|
if (n.G) {
|
|
302
|
-
n.G.
|
|
302
|
+
n.G.da(value);
|
|
303
303
|
needsReset = true;
|
|
304
304
|
}
|
|
305
305
|
}
|
|
@@ -329,15 +329,15 @@ function notifyUnobserved() {
|
|
|
329
329
|
var _a, _b;
|
|
330
330
|
for (let i = 0; i < unobserved.length; i++) {
|
|
331
331
|
const source = unobserved[i];
|
|
332
|
-
if (!source.
|
|
333
|
-
(_b = (_a = unobserved[i]).
|
|
332
|
+
if (!source.r)
|
|
333
|
+
(_b = (_a = unobserved[i]).sa) == null ? void 0 : _b.call(_a);
|
|
334
334
|
}
|
|
335
335
|
unobserved = [];
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
// src/core/core.ts
|
|
339
|
-
GlobalQueue.
|
|
340
|
-
GlobalQueue.
|
|
339
|
+
GlobalQueue.S = recompute;
|
|
340
|
+
GlobalQueue.la = disposeChildren;
|
|
341
341
|
var tracking = false;
|
|
342
342
|
var stale = false;
|
|
343
343
|
var pendingValueCheck = false;
|
|
@@ -347,23 +347,23 @@ var defaultContext = {};
|
|
|
347
347
|
function recompute(el, create = false) {
|
|
348
348
|
var _a;
|
|
349
349
|
deleteFromHeap(el, el.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
|
|
350
|
-
if (el.
|
|
350
|
+
if (el.e !== NOT_PENDING || el.U || el.V)
|
|
351
351
|
disposeChildren(el);
|
|
352
352
|
else {
|
|
353
353
|
markDisposal(el);
|
|
354
354
|
globalQueue.h.push(el);
|
|
355
|
-
el.
|
|
356
|
-
el.
|
|
357
|
-
el.
|
|
358
|
-
el.
|
|
355
|
+
el.V = el.s;
|
|
356
|
+
el.U = el.o;
|
|
357
|
+
el.s = null;
|
|
358
|
+
el.o = null;
|
|
359
359
|
}
|
|
360
360
|
const oldcontext = context;
|
|
361
361
|
context = el;
|
|
362
362
|
el.H = null;
|
|
363
363
|
el.b = 4 /* RecomputingDeps */;
|
|
364
|
-
el.
|
|
365
|
-
let value = el.
|
|
366
|
-
let oldHeight = el.
|
|
364
|
+
el.W = clock;
|
|
365
|
+
let value = el.e === NOT_PENDING ? el.g : el.e;
|
|
366
|
+
let oldHeight = el.c;
|
|
367
367
|
let prevStatusFlags = el.f;
|
|
368
368
|
let prevError = el.B;
|
|
369
369
|
let prevTracking = tracking;
|
|
@@ -396,37 +396,37 @@ function recompute(el, create = false) {
|
|
|
396
396
|
el.u = null;
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
|
-
const valueChanged = !el.
|
|
399
|
+
const valueChanged = !el.ea || !el.ea(el.e === NOT_PENDING ? el.g : el.e, value);
|
|
400
400
|
const statusFlagsChanged = el.f !== prevStatusFlags || el.B !== prevError;
|
|
401
|
-
(_a = el.
|
|
401
|
+
(_a = el.ma) == null ? void 0 : _a.call(el, statusFlagsChanged, prevStatusFlags);
|
|
402
402
|
if (valueChanged || statusFlagsChanged) {
|
|
403
403
|
if (valueChanged) {
|
|
404
404
|
if (create || el.ia || el.I)
|
|
405
405
|
el.g = value;
|
|
406
406
|
else {
|
|
407
|
-
if (el.
|
|
407
|
+
if (el.e === NOT_PENDING)
|
|
408
408
|
globalQueue.h.push(el);
|
|
409
|
-
el.
|
|
409
|
+
el.e = value;
|
|
410
410
|
}
|
|
411
411
|
if (el.C)
|
|
412
|
-
el.C.
|
|
412
|
+
el.C.da(value);
|
|
413
413
|
}
|
|
414
|
-
for (let s = el.
|
|
415
|
-
const queue = s.
|
|
416
|
-
if (s.
|
|
417
|
-
queue.
|
|
418
|
-
insertIntoHeap(s.
|
|
414
|
+
for (let s = el.r; s !== null; s = s.y) {
|
|
415
|
+
const queue = s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue;
|
|
416
|
+
if (s.j.c < el.c && queue.n > s.j.c)
|
|
417
|
+
queue.n = s.j.c;
|
|
418
|
+
insertIntoHeap(s.j, queue);
|
|
419
419
|
}
|
|
420
|
-
} else if (el.
|
|
421
|
-
for (let s = el.
|
|
422
|
-
insertIntoHeapHeight(s.
|
|
420
|
+
} else if (el.c != oldHeight) {
|
|
421
|
+
for (let s = el.r; s !== null; s = s.y) {
|
|
422
|
+
insertIntoHeapHeight(s.j, s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
function updateIfNecessary(el) {
|
|
427
427
|
if (el.b & 1 /* Check */) {
|
|
428
428
|
for (let d = el.u; d; d = d.E) {
|
|
429
|
-
const dep1 = d.
|
|
429
|
+
const dep1 = d.Q;
|
|
430
430
|
const dep = "_owner" in dep1 ? dep1.z : dep1;
|
|
431
431
|
if ("_fn" in dep) {
|
|
432
432
|
updateIfNecessary(dep);
|
|
@@ -442,45 +442,45 @@ function updateIfNecessary(el) {
|
|
|
442
442
|
el.b = 0 /* None */;
|
|
443
443
|
}
|
|
444
444
|
function unlinkSubs(link2) {
|
|
445
|
-
const dep = link2.
|
|
445
|
+
const dep = link2.Q;
|
|
446
446
|
const nextDep = link2.E;
|
|
447
447
|
const nextSub = link2.y;
|
|
448
|
-
const prevSub = link2.
|
|
448
|
+
const prevSub = link2.na;
|
|
449
449
|
if (nextSub !== null) {
|
|
450
|
-
nextSub.
|
|
450
|
+
nextSub.na = prevSub;
|
|
451
451
|
} else {
|
|
452
|
-
dep.
|
|
452
|
+
dep.X = prevSub;
|
|
453
453
|
}
|
|
454
454
|
if (prevSub !== null) {
|
|
455
455
|
prevSub.y = nextSub;
|
|
456
456
|
} else {
|
|
457
|
-
dep.
|
|
457
|
+
dep.r = nextSub;
|
|
458
458
|
}
|
|
459
459
|
return nextDep;
|
|
460
460
|
}
|
|
461
461
|
function link(dep, sub) {
|
|
462
462
|
const prevDep = sub.H;
|
|
463
|
-
if (prevDep !== null && prevDep.
|
|
463
|
+
if (prevDep !== null && prevDep.Q === dep) {
|
|
464
464
|
return;
|
|
465
465
|
}
|
|
466
466
|
let nextDep = null;
|
|
467
467
|
const isRecomputing = sub.b & 4 /* RecomputingDeps */;
|
|
468
468
|
if (isRecomputing) {
|
|
469
469
|
nextDep = prevDep !== null ? prevDep.E : sub.u;
|
|
470
|
-
if (nextDep !== null && nextDep.
|
|
470
|
+
if (nextDep !== null && nextDep.Q === dep) {
|
|
471
471
|
sub.H = nextDep;
|
|
472
472
|
return;
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
-
const prevSub = dep.
|
|
476
|
-
if (prevSub !== null && prevSub.
|
|
475
|
+
const prevSub = dep.X;
|
|
476
|
+
if (prevSub !== null && prevSub.j === sub && (!isRecomputing || isValidLink(prevSub, sub))) {
|
|
477
477
|
return;
|
|
478
478
|
}
|
|
479
|
-
const newLink = sub.H = dep.
|
|
480
|
-
|
|
481
|
-
|
|
479
|
+
const newLink = sub.H = dep.X = {
|
|
480
|
+
Q: dep,
|
|
481
|
+
j: sub,
|
|
482
482
|
E: nextDep,
|
|
483
|
-
|
|
483
|
+
na: prevSub,
|
|
484
484
|
y: null
|
|
485
485
|
};
|
|
486
486
|
if (prevDep !== null) {
|
|
@@ -491,7 +491,7 @@ function link(dep, sub) {
|
|
|
491
491
|
if (prevSub !== null) {
|
|
492
492
|
prevSub.y = newLink;
|
|
493
493
|
} else {
|
|
494
|
-
dep.
|
|
494
|
+
dep.r = newLink;
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
function isValidLink(checkLink, sub) {
|
|
@@ -521,7 +521,7 @@ function clearStatusFlags(signal2) {
|
|
|
521
521
|
setStatusFlags(signal2, 0 /* None */);
|
|
522
522
|
}
|
|
523
523
|
function markDisposal(el) {
|
|
524
|
-
let child = el.
|
|
524
|
+
let child = el.o;
|
|
525
525
|
while (child) {
|
|
526
526
|
child.b |= 32 /* Zombie */;
|
|
527
527
|
const inHeap = child.b & 8 /* InHeap */;
|
|
@@ -538,7 +538,7 @@ function disposeChildren(node, self = false, zombie) {
|
|
|
538
538
|
return;
|
|
539
539
|
if (self)
|
|
540
540
|
node.b = 64 /* Disposed */;
|
|
541
|
-
let child = zombie ? node.
|
|
541
|
+
let child = zombie ? node.U : node.o;
|
|
542
542
|
while (child) {
|
|
543
543
|
const nextChild = child.K;
|
|
544
544
|
if (child.u) {
|
|
@@ -555,15 +555,15 @@ function disposeChildren(node, self = false, zombie) {
|
|
|
555
555
|
child = nextChild;
|
|
556
556
|
}
|
|
557
557
|
if (zombie) {
|
|
558
|
-
node.
|
|
558
|
+
node.U = null;
|
|
559
559
|
} else {
|
|
560
|
-
node.
|
|
560
|
+
node.o = null;
|
|
561
561
|
node.K = null;
|
|
562
562
|
}
|
|
563
563
|
runDisposal(node, zombie);
|
|
564
564
|
}
|
|
565
565
|
function runDisposal(node, zombie) {
|
|
566
|
-
let disposal = zombie ? node.
|
|
566
|
+
let disposal = zombie ? node.V : node.s;
|
|
567
567
|
if (!disposal)
|
|
568
568
|
return;
|
|
569
569
|
if (Array.isArray(disposal)) {
|
|
@@ -574,20 +574,20 @@ function runDisposal(node, zombie) {
|
|
|
574
574
|
} else {
|
|
575
575
|
disposal.call(disposal);
|
|
576
576
|
}
|
|
577
|
-
zombie ? node.
|
|
577
|
+
zombie ? node.V = null : node.s = null;
|
|
578
578
|
}
|
|
579
579
|
function withOptions(obj, options) {
|
|
580
580
|
obj.id = (options == null ? void 0 : options.id) ?? ((context == null ? void 0 : context.id) != null ? getNextChildId(context) : void 0);
|
|
581
|
-
obj.
|
|
582
|
-
obj.
|
|
583
|
-
obj.
|
|
581
|
+
obj.ea = (options == null ? void 0 : options.equals) != null ? options.equals : isEqual;
|
|
582
|
+
obj.ya = !!(options == null ? void 0 : options.pureWrite);
|
|
583
|
+
obj.sa = options == null ? void 0 : options.unobserved;
|
|
584
584
|
if (options == null ? void 0 : options.ja)
|
|
585
585
|
Object.assign(obj, options.ja);
|
|
586
586
|
return obj;
|
|
587
587
|
}
|
|
588
588
|
function getNextChildId(owner) {
|
|
589
589
|
if (owner.id != null)
|
|
590
|
-
return formatId(owner.id, owner.
|
|
590
|
+
return formatId(owner.id, owner.oa++);
|
|
591
591
|
throw new Error("Cannot get child id from owner without an id");
|
|
592
592
|
}
|
|
593
593
|
function formatId(prefix, id) {
|
|
@@ -597,47 +597,47 @@ function formatId(prefix, id) {
|
|
|
597
597
|
function computed(fn, initialValue, options) {
|
|
598
598
|
const self = withOptions(
|
|
599
599
|
{
|
|
600
|
-
|
|
600
|
+
s: null,
|
|
601
601
|
i: globalQueue,
|
|
602
602
|
D: defaultContext,
|
|
603
|
-
|
|
603
|
+
oa: 0,
|
|
604
604
|
ha: fn,
|
|
605
605
|
g: initialValue,
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
606
|
+
c: 0,
|
|
607
|
+
ba: null,
|
|
608
|
+
P: void 0,
|
|
609
609
|
x: null,
|
|
610
610
|
u: null,
|
|
611
611
|
H: null,
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
612
|
+
r: null,
|
|
613
|
+
X: null,
|
|
614
|
+
q: context,
|
|
615
615
|
K: null,
|
|
616
|
-
|
|
616
|
+
o: null,
|
|
617
617
|
b: 0 /* None */,
|
|
618
618
|
f: 4 /* Uninitialized */,
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
619
|
+
W: clock,
|
|
620
|
+
e: NOT_PENDING,
|
|
621
|
+
V: null,
|
|
622
|
+
U: null
|
|
623
623
|
},
|
|
624
624
|
options
|
|
625
625
|
);
|
|
626
626
|
self.x = self;
|
|
627
|
-
const parent = (context == null ? void 0 : context.
|
|
627
|
+
const parent = (context == null ? void 0 : context._) ? context.$ : context;
|
|
628
628
|
if (context) {
|
|
629
629
|
context.i && (self.i = context.i);
|
|
630
630
|
context.D && (self.D = context.D);
|
|
631
|
-
const lastChild = context.
|
|
631
|
+
const lastChild = context.o;
|
|
632
632
|
if (lastChild === null) {
|
|
633
|
-
context.
|
|
633
|
+
context.o = self;
|
|
634
634
|
} else {
|
|
635
635
|
self.K = lastChild;
|
|
636
|
-
context.
|
|
636
|
+
context.o = self;
|
|
637
637
|
}
|
|
638
638
|
}
|
|
639
639
|
if (parent)
|
|
640
|
-
self.
|
|
640
|
+
self.c = parent.c + 1;
|
|
641
641
|
recompute(self, true);
|
|
642
642
|
return self;
|
|
643
643
|
}
|
|
@@ -690,7 +690,7 @@ function asyncComputed(asyncFn, initialValue, options) {
|
|
|
690
690
|
throw new NotReadyError(context);
|
|
691
691
|
};
|
|
692
692
|
const self = computed(fn, initialValue, options);
|
|
693
|
-
self.
|
|
693
|
+
self.ta = () => {
|
|
694
694
|
refreshing = true;
|
|
695
695
|
recompute(self);
|
|
696
696
|
flush();
|
|
@@ -699,16 +699,16 @@ function asyncComputed(asyncFn, initialValue, options) {
|
|
|
699
699
|
}
|
|
700
700
|
function signal(v, options, firewall = null) {
|
|
701
701
|
if (firewall !== null) {
|
|
702
|
-
return firewall.
|
|
702
|
+
return firewall.ba = withOptions(
|
|
703
703
|
{
|
|
704
704
|
g: v,
|
|
705
|
-
|
|
706
|
-
|
|
705
|
+
r: null,
|
|
706
|
+
X: null,
|
|
707
707
|
z: firewall,
|
|
708
|
-
|
|
708
|
+
ra: firewall.ba,
|
|
709
709
|
f: 0 /* None */,
|
|
710
|
-
|
|
711
|
-
|
|
710
|
+
W: clock,
|
|
711
|
+
e: NOT_PENDING
|
|
712
712
|
},
|
|
713
713
|
options
|
|
714
714
|
);
|
|
@@ -716,11 +716,11 @@ function signal(v, options, firewall = null) {
|
|
|
716
716
|
return withOptions(
|
|
717
717
|
{
|
|
718
718
|
g: v,
|
|
719
|
-
|
|
720
|
-
|
|
719
|
+
r: null,
|
|
720
|
+
X: null,
|
|
721
721
|
f: 0 /* None */,
|
|
722
|
-
|
|
723
|
-
|
|
722
|
+
W: clock,
|
|
723
|
+
e: NOT_PENDING
|
|
724
724
|
},
|
|
725
725
|
options
|
|
726
726
|
);
|
|
@@ -741,30 +741,30 @@ function untrack(fn) {
|
|
|
741
741
|
}
|
|
742
742
|
function read(el) {
|
|
743
743
|
let c = context;
|
|
744
|
-
if (c == null ? void 0 : c.
|
|
745
|
-
c = c
|
|
744
|
+
if (c == null ? void 0 : c._)
|
|
745
|
+
c = c.$;
|
|
746
746
|
if (c && tracking) {
|
|
747
747
|
link(el, c);
|
|
748
748
|
const owner = "_owner" in el ? el.z : el;
|
|
749
749
|
if ("_fn" in owner) {
|
|
750
750
|
const isZombie = el.b & 32 /* Zombie */;
|
|
751
|
-
if (owner.
|
|
751
|
+
if (owner.c >= (isZombie ? zombieQueue.n : dirtyQueue.n)) {
|
|
752
752
|
markNode(c);
|
|
753
753
|
markHeap(isZombie ? zombieQueue : dirtyQueue);
|
|
754
754
|
updateIfNecessary(owner);
|
|
755
755
|
}
|
|
756
|
-
const height = owner.
|
|
757
|
-
if (height >= c.
|
|
758
|
-
c.
|
|
756
|
+
const height = owner.c;
|
|
757
|
+
if (height >= c.c && el.q !== c) {
|
|
758
|
+
c.c = height + 1;
|
|
759
759
|
}
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
762
|
if (pendingCheck) {
|
|
763
|
-
const pendingResult = (el.f & 1 /* Pending */) !== 0 || !!el.
|
|
763
|
+
const pendingResult = (el.f & 1 /* Pending */) !== 0 || !!el.T || false;
|
|
764
764
|
if (!el.G) {
|
|
765
765
|
el.G = signal(pendingResult);
|
|
766
766
|
el.G.ia = true;
|
|
767
|
-
el.G.
|
|
767
|
+
el.G.da = (v) => setSignal(el.G, v);
|
|
768
768
|
}
|
|
769
769
|
const prev = pendingCheck;
|
|
770
770
|
pendingCheck = null;
|
|
@@ -775,10 +775,10 @@ function read(el) {
|
|
|
775
775
|
if (pendingValueCheck) {
|
|
776
776
|
if (!el.C) {
|
|
777
777
|
el.C = signal(
|
|
778
|
-
el.
|
|
778
|
+
el.e === NOT_PENDING ? el.g : el.e
|
|
779
779
|
);
|
|
780
780
|
el.C.ia = true;
|
|
781
|
-
el.C.
|
|
781
|
+
el.C.da = (v) => queueMicrotask(() => queueMicrotask(() => setSignal(el.C, v)));
|
|
782
782
|
}
|
|
783
783
|
pendingValueCheck = false;
|
|
784
784
|
try {
|
|
@@ -799,39 +799,42 @@ function read(el) {
|
|
|
799
799
|
}
|
|
800
800
|
}
|
|
801
801
|
if (el.f & 2 /* Error */) {
|
|
802
|
-
if (el.
|
|
802
|
+
if (el.W < clock) {
|
|
803
803
|
recompute(el, true);
|
|
804
804
|
return read(el);
|
|
805
805
|
} else {
|
|
806
806
|
throw el.B;
|
|
807
807
|
}
|
|
808
808
|
}
|
|
809
|
-
return !c || el.
|
|
809
|
+
return !c || el.e === NOT_PENDING || stale && !pendingCheck && el.T && activeTransition !== el.T ? el.g : el.e;
|
|
810
810
|
}
|
|
811
811
|
function setSignal(el, v) {
|
|
812
812
|
if (typeof v === "function") {
|
|
813
813
|
v = v(
|
|
814
|
-
el.
|
|
814
|
+
el.e === NOT_PENDING ? el.g : el.e
|
|
815
815
|
);
|
|
816
816
|
}
|
|
817
|
-
const valueChanged = !el.
|
|
817
|
+
const valueChanged = !el.ea || !el.ea(el.e === NOT_PENDING ? el.g : el.e, v);
|
|
818
818
|
if (!valueChanged && !el.f)
|
|
819
819
|
return v;
|
|
820
820
|
if (valueChanged) {
|
|
821
821
|
if (el.ia)
|
|
822
822
|
el.g = v;
|
|
823
823
|
else {
|
|
824
|
-
if (el.
|
|
824
|
+
if (el.e === NOT_PENDING)
|
|
825
825
|
globalQueue.h.push(el);
|
|
826
|
-
el.
|
|
826
|
+
el.e = v;
|
|
827
827
|
}
|
|
828
828
|
if (el.C)
|
|
829
|
-
el.C.
|
|
829
|
+
el.C.da(v);
|
|
830
830
|
}
|
|
831
831
|
clearStatusFlags(el);
|
|
832
|
-
el.
|
|
833
|
-
for (let
|
|
834
|
-
|
|
832
|
+
el.W = clock;
|
|
833
|
+
for (let s = el.r; s !== null; s = s.y) {
|
|
834
|
+
const queue = s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue;
|
|
835
|
+
if (queue.n > s.j.c)
|
|
836
|
+
queue.n = s.j.c;
|
|
837
|
+
insertIntoHeap(s.j, queue);
|
|
835
838
|
}
|
|
836
839
|
schedule();
|
|
837
840
|
return v;
|
|
@@ -846,41 +849,41 @@ function onCleanup(fn) {
|
|
|
846
849
|
if (!context)
|
|
847
850
|
return fn;
|
|
848
851
|
const node = context;
|
|
849
|
-
if (!node.
|
|
850
|
-
node.
|
|
851
|
-
} else if (Array.isArray(node.
|
|
852
|
-
node.
|
|
852
|
+
if (!node.s) {
|
|
853
|
+
node.s = fn;
|
|
854
|
+
} else if (Array.isArray(node.s)) {
|
|
855
|
+
node.s.push(fn);
|
|
853
856
|
} else {
|
|
854
|
-
node.
|
|
857
|
+
node.s = [node.s, fn];
|
|
855
858
|
}
|
|
856
859
|
return fn;
|
|
857
860
|
}
|
|
858
861
|
function createOwner(options) {
|
|
859
862
|
const parent = context;
|
|
860
863
|
const owner = {
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
+
_: true,
|
|
865
|
+
$: (parent == null ? void 0 : parent._) ? parent.$ : parent,
|
|
866
|
+
o: null,
|
|
864
867
|
K: null,
|
|
865
|
-
|
|
868
|
+
s: null,
|
|
866
869
|
id: (options == null ? void 0 : options.id) ?? ((parent == null ? void 0 : parent.id) != null ? getNextChildId(parent) : void 0),
|
|
867
870
|
i: (parent == null ? void 0 : parent.i) ?? globalQueue,
|
|
868
871
|
D: (parent == null ? void 0 : parent.D) || defaultContext,
|
|
869
|
-
|
|
872
|
+
oa: 0,
|
|
873
|
+
V: null,
|
|
870
874
|
U: null,
|
|
871
|
-
|
|
872
|
-
s: parent,
|
|
875
|
+
q: parent,
|
|
873
876
|
dispose(self = true) {
|
|
874
877
|
disposeChildren(owner, self);
|
|
875
878
|
}
|
|
876
879
|
};
|
|
877
880
|
if (parent) {
|
|
878
|
-
const lastChild = parent.
|
|
881
|
+
const lastChild = parent.o;
|
|
879
882
|
if (lastChild === null) {
|
|
880
|
-
parent.
|
|
883
|
+
parent.o = owner;
|
|
881
884
|
} else {
|
|
882
885
|
owner.K = lastChild;
|
|
883
|
-
parent.
|
|
886
|
+
parent.o = owner;
|
|
884
887
|
}
|
|
885
888
|
}
|
|
886
889
|
return owner;
|
|
@@ -970,18 +973,18 @@ function effect(compute, effect2, error, initialValue, options) {
|
|
|
970
973
|
const node = computed(compute, initialValue, {
|
|
971
974
|
...options,
|
|
972
975
|
ja: {
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
976
|
+
fa: true,
|
|
977
|
+
pa: initialValue,
|
|
978
|
+
ua: effect2,
|
|
979
|
+
qa: error,
|
|
977
980
|
L: void 0,
|
|
978
981
|
i: ((_a = getOwner()) == null ? void 0 : _a.i) ?? globalQueue,
|
|
979
982
|
I: (options == null ? void 0 : options.render) ? 1 /* Render */ : 2 /* User */,
|
|
980
|
-
|
|
983
|
+
ma(statusFlagsChanged, prevStatusFlags) {
|
|
981
984
|
if (initialized) {
|
|
982
985
|
const errorChanged = this.f && this.f === prevStatusFlags && statusFlagsChanged;
|
|
983
|
-
this.
|
|
984
|
-
if (this.
|
|
986
|
+
this.fa = !(this.f & 2 /* Error */) && !(this.f & 1 /* Pending */ & ~prevStatusFlags) && !errorChanged;
|
|
987
|
+
if (this.fa)
|
|
985
988
|
this.i.enqueue(this.I, runEffect.bind(this));
|
|
986
989
|
}
|
|
987
990
|
if (this.f & 2 /* Error */) {
|
|
@@ -989,7 +992,7 @@ function effect(compute, effect2, error, initialValue, options) {
|
|
|
989
992
|
this.i.notify(this, 1 /* Pending */, 0);
|
|
990
993
|
if (this.I === 2 /* User */) {
|
|
991
994
|
try {
|
|
992
|
-
return this.
|
|
995
|
+
return this.qa ? this.qa(error2, () => {
|
|
993
996
|
var _a2;
|
|
994
997
|
(_a2 = this.L) == null ? void 0 : _a2.call(this);
|
|
995
998
|
this.L = void 0;
|
|
@@ -1022,18 +1025,18 @@ function effect(compute, effect2, error, initialValue, options) {
|
|
|
1022
1025
|
}
|
|
1023
1026
|
function runEffect() {
|
|
1024
1027
|
var _a;
|
|
1025
|
-
if (!this.
|
|
1028
|
+
if (!this.fa || this.b & 64 /* Disposed */)
|
|
1026
1029
|
return;
|
|
1027
1030
|
(_a = this.L) == null ? void 0 : _a.call(this);
|
|
1028
1031
|
this.L = void 0;
|
|
1029
1032
|
try {
|
|
1030
|
-
this.L = this.
|
|
1033
|
+
this.L = this.ua(this.g, this.pa);
|
|
1031
1034
|
} catch (error) {
|
|
1032
1035
|
if (!this.i.notify(this, 2 /* Error */, 2 /* Error */))
|
|
1033
1036
|
throw error;
|
|
1034
1037
|
} finally {
|
|
1035
|
-
this.
|
|
1036
|
-
this.
|
|
1038
|
+
this.pa = this.g;
|
|
1039
|
+
this.fa = false;
|
|
1037
1040
|
}
|
|
1038
1041
|
}
|
|
1039
1042
|
|
|
@@ -1064,7 +1067,7 @@ function createMemo(compute, value, options) {
|
|
|
1064
1067
|
function createAsync(compute, value, options) {
|
|
1065
1068
|
const node = asyncComputed(compute, value, options);
|
|
1066
1069
|
const ret = read.bind(null, node);
|
|
1067
|
-
ret.refresh = node.
|
|
1070
|
+
ret.refresh = node.ta;
|
|
1068
1071
|
return ret;
|
|
1069
1072
|
}
|
|
1070
1073
|
function createEffect(compute, effectFn, value, options) {
|
|
@@ -1379,7 +1382,7 @@ var storeTraps = {
|
|
|
1379
1382
|
return desc.get.call(receiver);
|
|
1380
1383
|
}
|
|
1381
1384
|
if (Writing == null ? void 0 : Writing.has(receiver)) {
|
|
1382
|
-
let value2 = tracked && (overridden || !proxySource) ? tracked.
|
|
1385
|
+
let value2 = tracked && (overridden || !proxySource) ? tracked.e !== NOT_PENDING ? tracked.e : tracked.g : storeValue[property];
|
|
1383
1386
|
value2 === $DELETED && (value2 = void 0);
|
|
1384
1387
|
if (!isWrappable(value2))
|
|
1385
1388
|
return value2;
|
|
@@ -1784,78 +1787,78 @@ function mapArray(list, map, options) {
|
|
|
1784
1787
|
return createMemo(
|
|
1785
1788
|
updateKeyedMap.bind({
|
|
1786
1789
|
z: createOwner(),
|
|
1787
|
-
|
|
1788
|
-
|
|
1790
|
+
k: 0,
|
|
1791
|
+
va: list,
|
|
1789
1792
|
F: [],
|
|
1790
1793
|
M: map,
|
|
1791
|
-
|
|
1794
|
+
d: [],
|
|
1792
1795
|
a: [],
|
|
1793
1796
|
N: keyFn,
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
+
l: keyFn || (options == null ? void 0 : options.keyed) === false ? [] : void 0,
|
|
1798
|
+
m: map.length > 1 ? [] : void 0,
|
|
1799
|
+
Y: options == null ? void 0 : options.fallback
|
|
1797
1800
|
})
|
|
1798
1801
|
);
|
|
1799
1802
|
}
|
|
1800
1803
|
var pureOptions = { pureWrite: true };
|
|
1801
1804
|
function updateKeyedMap() {
|
|
1802
|
-
const newItems = this.
|
|
1805
|
+
const newItems = this.va() || [], newLen = newItems.length;
|
|
1803
1806
|
newItems[$TRACK];
|
|
1804
1807
|
runWithOwner(this.z, () => {
|
|
1805
|
-
let i, j, mapper = this.
|
|
1806
|
-
this.
|
|
1807
|
-
this.
|
|
1808
|
+
let i, j, mapper = this.l ? () => {
|
|
1809
|
+
this.l[j] = signal(newItems[j], pureOptions);
|
|
1810
|
+
this.m && (this.m[j] = signal(j, pureOptions));
|
|
1808
1811
|
return this.M(
|
|
1809
|
-
read.bind(null, this.
|
|
1810
|
-
this.
|
|
1812
|
+
read.bind(null, this.l[j]),
|
|
1813
|
+
this.m ? read.bind(null, this.m[j]) : void 0
|
|
1811
1814
|
);
|
|
1812
|
-
} : this.
|
|
1815
|
+
} : this.m ? () => {
|
|
1813
1816
|
const item = newItems[j];
|
|
1814
|
-
this.
|
|
1817
|
+
this.m[j] = signal(j, pureOptions);
|
|
1815
1818
|
return this.M(
|
|
1816
1819
|
() => item,
|
|
1817
|
-
read.bind(null, this.
|
|
1820
|
+
read.bind(null, this.m[j])
|
|
1818
1821
|
);
|
|
1819
1822
|
} : () => {
|
|
1820
1823
|
const item = newItems[j];
|
|
1821
1824
|
return this.M(() => item);
|
|
1822
1825
|
};
|
|
1823
1826
|
if (newLen === 0) {
|
|
1824
|
-
if (this.
|
|
1827
|
+
if (this.k !== 0) {
|
|
1825
1828
|
this.z.dispose(false);
|
|
1826
1829
|
this.a = [];
|
|
1827
1830
|
this.F = [];
|
|
1828
|
-
this.
|
|
1829
|
-
this.
|
|
1830
|
-
this.k && (this.k = []);
|
|
1831
|
+
this.d = [];
|
|
1832
|
+
this.k = 0;
|
|
1831
1833
|
this.l && (this.l = []);
|
|
1834
|
+
this.m && (this.m = []);
|
|
1832
1835
|
}
|
|
1833
|
-
if (this.
|
|
1834
|
-
this.
|
|
1836
|
+
if (this.Y && !this.d[0]) {
|
|
1837
|
+
this.d[0] = runWithOwner(
|
|
1835
1838
|
this.a[0] = createOwner(),
|
|
1836
|
-
this.
|
|
1839
|
+
this.Y
|
|
1837
1840
|
);
|
|
1838
1841
|
}
|
|
1839
|
-
} else if (this.
|
|
1842
|
+
} else if (this.k === 0) {
|
|
1840
1843
|
if (this.a[0])
|
|
1841
1844
|
this.a[0].dispose();
|
|
1842
|
-
this.
|
|
1845
|
+
this.d = new Array(newLen);
|
|
1843
1846
|
for (j = 0; j < newLen; j++) {
|
|
1844
1847
|
this.F[j] = newItems[j];
|
|
1845
|
-
this.
|
|
1848
|
+
this.d[j] = runWithOwner(this.a[j] = createOwner(), mapper);
|
|
1846
1849
|
}
|
|
1847
|
-
this.
|
|
1850
|
+
this.k = newLen;
|
|
1848
1851
|
} else {
|
|
1849
|
-
let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.
|
|
1850
|
-
for (start = 0, end = Math.min(this.
|
|
1851
|
-
if (this.
|
|
1852
|
-
setSignal(this.
|
|
1852
|
+
let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.l ? new Array(newLen) : void 0, tempIndexes = this.m ? new Array(newLen) : void 0;
|
|
1853
|
+
for (start = 0, end = Math.min(this.k, newLen); start < end && (this.F[start] === newItems[start] || this.l && compare(this.N, this.F[start], newItems[start])); start++) {
|
|
1854
|
+
if (this.l)
|
|
1855
|
+
setSignal(this.l[start], newItems[start]);
|
|
1853
1856
|
}
|
|
1854
|
-
for (end = this.
|
|
1855
|
-
temp[newEnd] = this.
|
|
1857
|
+
for (end = this.k - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.F[end] === newItems[newEnd] || this.l && compare(this.N, this.F[end], newItems[newEnd])); end--, newEnd--) {
|
|
1858
|
+
temp[newEnd] = this.d[end];
|
|
1856
1859
|
tempNodes[newEnd] = this.a[end];
|
|
1857
|
-
tempRows && (tempRows[newEnd] = this.
|
|
1858
|
-
tempIndexes && (tempIndexes[newEnd] = this.
|
|
1860
|
+
tempRows && (tempRows[newEnd] = this.l[end]);
|
|
1861
|
+
tempIndexes && (tempIndexes[newEnd] = this.m[end]);
|
|
1859
1862
|
}
|
|
1860
1863
|
newIndices = /* @__PURE__ */ new Map();
|
|
1861
1864
|
newIndicesNext = new Array(newEnd + 1);
|
|
@@ -1871,10 +1874,10 @@ function updateKeyedMap() {
|
|
|
1871
1874
|
key = this.N ? this.N(item) : item;
|
|
1872
1875
|
j = newIndices.get(key);
|
|
1873
1876
|
if (j !== void 0 && j !== -1) {
|
|
1874
|
-
temp[j] = this.
|
|
1877
|
+
temp[j] = this.d[i];
|
|
1875
1878
|
tempNodes[j] = this.a[i];
|
|
1876
|
-
tempRows && (tempRows[j] = this.
|
|
1877
|
-
tempIndexes && (tempIndexes[j] = this.
|
|
1879
|
+
tempRows && (tempRows[j] = this.l[i]);
|
|
1880
|
+
tempIndexes && (tempIndexes[j] = this.m[i]);
|
|
1878
1881
|
j = newIndicesNext[j];
|
|
1879
1882
|
newIndices.set(key, j);
|
|
1880
1883
|
} else
|
|
@@ -1882,98 +1885,98 @@ function updateKeyedMap() {
|
|
|
1882
1885
|
}
|
|
1883
1886
|
for (j = start; j < newLen; j++) {
|
|
1884
1887
|
if (j in temp) {
|
|
1885
|
-
this.
|
|
1888
|
+
this.d[j] = temp[j];
|
|
1886
1889
|
this.a[j] = tempNodes[j];
|
|
1887
1890
|
if (tempRows) {
|
|
1888
|
-
this.
|
|
1889
|
-
setSignal(this.
|
|
1891
|
+
this.l[j] = tempRows[j];
|
|
1892
|
+
setSignal(this.l[j], newItems[j]);
|
|
1890
1893
|
}
|
|
1891
1894
|
if (tempIndexes) {
|
|
1892
|
-
this.
|
|
1893
|
-
setSignal(this.
|
|
1895
|
+
this.m[j] = tempIndexes[j];
|
|
1896
|
+
setSignal(this.m[j], j);
|
|
1894
1897
|
}
|
|
1895
1898
|
} else {
|
|
1896
|
-
this.
|
|
1899
|
+
this.d[j] = runWithOwner(this.a[j] = createOwner(), mapper);
|
|
1897
1900
|
}
|
|
1898
1901
|
}
|
|
1899
|
-
this.
|
|
1902
|
+
this.d = this.d.slice(0, this.k = newLen);
|
|
1900
1903
|
this.F = newItems.slice(0);
|
|
1901
1904
|
}
|
|
1902
1905
|
});
|
|
1903
|
-
return this.
|
|
1906
|
+
return this.d;
|
|
1904
1907
|
}
|
|
1905
1908
|
function repeat(count, map, options) {
|
|
1906
1909
|
return updateRepeat.bind({
|
|
1907
1910
|
z: createOwner(),
|
|
1908
|
-
|
|
1911
|
+
k: 0,
|
|
1909
1912
|
w: 0,
|
|
1910
|
-
|
|
1913
|
+
wa: count,
|
|
1911
1914
|
M: map,
|
|
1912
1915
|
a: [],
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
+
d: [],
|
|
1917
|
+
xa: options == null ? void 0 : options.from,
|
|
1918
|
+
Y: options == null ? void 0 : options.fallback
|
|
1916
1919
|
});
|
|
1917
1920
|
}
|
|
1918
1921
|
function updateRepeat() {
|
|
1919
1922
|
var _a;
|
|
1920
|
-
const newLen = this.
|
|
1921
|
-
const from = ((_a = this.
|
|
1923
|
+
const newLen = this.wa();
|
|
1924
|
+
const from = ((_a = this.xa) == null ? void 0 : _a.call(this)) || 0;
|
|
1922
1925
|
runWithOwner(this.z, () => {
|
|
1923
1926
|
if (newLen === 0) {
|
|
1924
|
-
if (this.
|
|
1927
|
+
if (this.k !== 0) {
|
|
1925
1928
|
this.z.dispose(false);
|
|
1926
1929
|
this.a = [];
|
|
1927
|
-
this.
|
|
1928
|
-
this.
|
|
1930
|
+
this.d = [];
|
|
1931
|
+
this.k = 0;
|
|
1929
1932
|
}
|
|
1930
|
-
if (this.
|
|
1931
|
-
this.
|
|
1933
|
+
if (this.Y && !this.d[0]) {
|
|
1934
|
+
this.d[0] = runWithOwner(
|
|
1932
1935
|
this.a[0] = createOwner(),
|
|
1933
|
-
this.
|
|
1936
|
+
this.Y
|
|
1934
1937
|
);
|
|
1935
1938
|
}
|
|
1936
1939
|
return;
|
|
1937
1940
|
}
|
|
1938
1941
|
const to = from + newLen;
|
|
1939
|
-
const prevTo = this.w + this.
|
|
1940
|
-
if (this.
|
|
1942
|
+
const prevTo = this.w + this.k;
|
|
1943
|
+
if (this.k === 0 && this.a[0])
|
|
1941
1944
|
this.a[0].dispose();
|
|
1942
1945
|
for (let i = to; i < prevTo; i++)
|
|
1943
1946
|
this.a[i - this.w].dispose();
|
|
1944
1947
|
if (this.w < from) {
|
|
1945
1948
|
let i = this.w;
|
|
1946
|
-
while (i < from && i < this.
|
|
1949
|
+
while (i < from && i < this.k)
|
|
1947
1950
|
this.a[i++].dispose();
|
|
1948
1951
|
this.a.splice(0, from - this.w);
|
|
1949
|
-
this.
|
|
1952
|
+
this.d.splice(0, from - this.w);
|
|
1950
1953
|
} else if (this.w > from) {
|
|
1951
1954
|
let i = prevTo - this.w - 1;
|
|
1952
1955
|
let difference = this.w - from;
|
|
1953
|
-
this.a.length = this.
|
|
1956
|
+
this.a.length = this.d.length = newLen;
|
|
1954
1957
|
while (i >= difference) {
|
|
1955
1958
|
this.a[i] = this.a[i - difference];
|
|
1956
|
-
this.
|
|
1959
|
+
this.d[i] = this.d[i - difference];
|
|
1957
1960
|
i--;
|
|
1958
1961
|
}
|
|
1959
1962
|
for (let i2 = 0; i2 < difference; i2++) {
|
|
1960
|
-
this.
|
|
1963
|
+
this.d[i2] = runWithOwner(
|
|
1961
1964
|
this.a[i2] = createOwner(),
|
|
1962
1965
|
() => this.M(i2 + from)
|
|
1963
1966
|
);
|
|
1964
1967
|
}
|
|
1965
1968
|
}
|
|
1966
1969
|
for (let i = prevTo; i < to; i++) {
|
|
1967
|
-
this.
|
|
1970
|
+
this.d[i - from] = runWithOwner(
|
|
1968
1971
|
this.a[i - from] = createOwner(),
|
|
1969
1972
|
() => this.M(i)
|
|
1970
1973
|
);
|
|
1971
1974
|
}
|
|
1972
|
-
this.
|
|
1975
|
+
this.d = this.d.slice(0, newLen);
|
|
1973
1976
|
this.w = from;
|
|
1974
|
-
this.
|
|
1977
|
+
this.k = newLen;
|
|
1975
1978
|
});
|
|
1976
|
-
return this.
|
|
1979
|
+
return this.d;
|
|
1977
1980
|
}
|
|
1978
1981
|
function compare(key, a, b) {
|
|
1979
1982
|
return key ? key(a) === key(b) : true;
|
|
@@ -1983,18 +1986,18 @@ function compare(key, a, b) {
|
|
|
1983
1986
|
function boundaryComputed(fn, propagationMask) {
|
|
1984
1987
|
const node = computed(fn, void 0, {
|
|
1985
1988
|
ja: {
|
|
1986
|
-
|
|
1989
|
+
ma() {
|
|
1987
1990
|
let flags = this.f;
|
|
1988
|
-
this.f &= ~this.
|
|
1989
|
-
if (this.
|
|
1991
|
+
this.f &= ~this.Z;
|
|
1992
|
+
if (this.Z & 1 /* Pending */ && !(this.f & 4 /* Uninitialized */)) {
|
|
1990
1993
|
flags &= ~1 /* Pending */;
|
|
1991
1994
|
}
|
|
1992
|
-
this.i.notify(this, this.
|
|
1995
|
+
this.i.notify(this, this.Z, flags);
|
|
1993
1996
|
},
|
|
1994
|
-
|
|
1997
|
+
Z: propagationMask
|
|
1995
1998
|
}
|
|
1996
1999
|
});
|
|
1997
|
-
node.
|
|
2000
|
+
node.Z = propagationMask;
|
|
1998
2001
|
return node;
|
|
1999
2002
|
}
|
|
2000
2003
|
function createBoundChildren(owner, fn, queue, mask) {
|
|
@@ -2007,20 +2010,20 @@ function createBoundChildren(owner, fn, queue, mask) {
|
|
|
2007
2010
|
});
|
|
2008
2011
|
}
|
|
2009
2012
|
var ConditionalQueue = class extends Queue {
|
|
2010
|
-
|
|
2011
|
-
|
|
2013
|
+
t;
|
|
2014
|
+
ga = /* @__PURE__ */ new Set();
|
|
2012
2015
|
h = /* @__PURE__ */ new Set();
|
|
2013
2016
|
constructor(disabled) {
|
|
2014
2017
|
super();
|
|
2015
|
-
this.
|
|
2018
|
+
this.t = disabled;
|
|
2016
2019
|
}
|
|
2017
2020
|
run(type) {
|
|
2018
|
-
if (!type || read(this.
|
|
2021
|
+
if (!type || read(this.t))
|
|
2019
2022
|
return;
|
|
2020
2023
|
return super.run(type);
|
|
2021
2024
|
}
|
|
2022
2025
|
notify(node, type, flags) {
|
|
2023
|
-
if (read(this.
|
|
2026
|
+
if (read(this.t)) {
|
|
2024
2027
|
if (type & 1 /* Pending */) {
|
|
2025
2028
|
if (flags & 1 /* Pending */) {
|
|
2026
2029
|
this.h.add(node);
|
|
@@ -2030,9 +2033,9 @@ var ConditionalQueue = class extends Queue {
|
|
|
2030
2033
|
}
|
|
2031
2034
|
if (type & 2 /* Error */) {
|
|
2032
2035
|
if (flags & 2 /* Error */) {
|
|
2033
|
-
this.
|
|
2036
|
+
this.ga.add(node);
|
|
2034
2037
|
type &= ~2 /* Error */;
|
|
2035
|
-
} else if (this.
|
|
2038
|
+
} else if (this.ga.delete(node))
|
|
2036
2039
|
type &= ~2 /* Error */;
|
|
2037
2040
|
}
|
|
2038
2041
|
}
|
|
@@ -2040,31 +2043,39 @@ var ConditionalQueue = class extends Queue {
|
|
|
2040
2043
|
}
|
|
2041
2044
|
};
|
|
2042
2045
|
var CollectionQueue = class extends Queue {
|
|
2043
|
-
|
|
2046
|
+
O;
|
|
2044
2047
|
a = /* @__PURE__ */ new Set();
|
|
2045
|
-
|
|
2048
|
+
t = signal(false, { pureWrite: true });
|
|
2049
|
+
ka = false;
|
|
2046
2050
|
constructor(type) {
|
|
2047
2051
|
super();
|
|
2048
|
-
this.
|
|
2052
|
+
this.O = type;
|
|
2049
2053
|
}
|
|
2050
2054
|
run(type) {
|
|
2051
|
-
if (!type || read(this.
|
|
2055
|
+
if (!type || read(this.t))
|
|
2052
2056
|
return;
|
|
2053
2057
|
return super.run(type);
|
|
2054
2058
|
}
|
|
2059
|
+
enqueue(type, fn) {
|
|
2060
|
+
var _a;
|
|
2061
|
+
if (this.O & 1 /* Pending */ && this.ka) {
|
|
2062
|
+
return (_a = this.q) == null ? void 0 : _a.enqueue(type, fn);
|
|
2063
|
+
}
|
|
2064
|
+
return super.enqueue(type, fn);
|
|
2065
|
+
}
|
|
2055
2066
|
notify(node, type, flags) {
|
|
2056
|
-
if (!(type & this.
|
|
2067
|
+
if (!(type & this.O) || this.O & 1 /* Pending */ && this.ka)
|
|
2057
2068
|
return super.notify(node, type, flags);
|
|
2058
|
-
if (flags & this.
|
|
2069
|
+
if (flags & this.O) {
|
|
2059
2070
|
this.a.add(node);
|
|
2060
2071
|
if (this.a.size === 1)
|
|
2061
|
-
setSignal(this.
|
|
2072
|
+
setSignal(this.t, true);
|
|
2062
2073
|
} else if (this.a.size > 0) {
|
|
2063
2074
|
this.a.delete(node);
|
|
2064
2075
|
if (this.a.size === 0)
|
|
2065
|
-
setSignal(this.
|
|
2076
|
+
setSignal(this.t, false);
|
|
2066
2077
|
}
|
|
2067
|
-
type &= ~this.
|
|
2078
|
+
type &= ~this.O;
|
|
2068
2079
|
return type ? super.notify(node, type, flags) : true;
|
|
2069
2080
|
}
|
|
2070
2081
|
};
|
|
@@ -2073,28 +2084,29 @@ function createBoundary(fn, condition) {
|
|
|
2073
2084
|
const queue = new ConditionalQueue(computed(() => condition() === "hidden" /* HIDDEN */));
|
|
2074
2085
|
const tree = createBoundChildren(owner, fn, queue, 0);
|
|
2075
2086
|
computed(() => {
|
|
2076
|
-
const disabled = read(queue.
|
|
2077
|
-
tree.
|
|
2087
|
+
const disabled = read(queue.t);
|
|
2088
|
+
tree.Z = disabled ? 2 /* Error */ | 1 /* Pending */ : 0;
|
|
2078
2089
|
if (!disabled) {
|
|
2079
2090
|
queue.h.forEach(
|
|
2080
2091
|
(node) => queue.notify(node, 1 /* Pending */, 1 /* Pending */)
|
|
2081
2092
|
);
|
|
2082
|
-
queue.
|
|
2093
|
+
queue.ga.forEach((node) => queue.notify(node, 2 /* Error */, 2 /* Error */));
|
|
2083
2094
|
queue.h.clear();
|
|
2084
|
-
queue.
|
|
2095
|
+
queue.ga.clear();
|
|
2085
2096
|
}
|
|
2086
2097
|
});
|
|
2087
|
-
return () => read(queue.
|
|
2098
|
+
return () => read(queue.t) ? void 0 : read(tree);
|
|
2088
2099
|
}
|
|
2089
2100
|
function createCollectionBoundary(type, fn, fallback) {
|
|
2090
2101
|
const owner = createOwner();
|
|
2091
2102
|
const queue = new CollectionQueue(type);
|
|
2092
2103
|
const tree = createBoundChildren(owner, fn, queue, type);
|
|
2093
2104
|
const decision = computed(() => {
|
|
2094
|
-
if (!read(queue.
|
|
2105
|
+
if (!read(queue.t)) {
|
|
2095
2106
|
const resolved = read(tree);
|
|
2096
|
-
if (!untrack(() => read(queue.
|
|
2097
|
-
|
|
2107
|
+
if (!untrack(() => read(queue.t)))
|
|
2108
|
+
queue.ka = true;
|
|
2109
|
+
return resolved;
|
|
2098
2110
|
}
|
|
2099
2111
|
return fallback(queue);
|
|
2100
2112
|
});
|