solid-js 1.8.22 → 1.9.0
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.cjs +7 -6
- package/dist/dev.js +567 -325
- package/dist/server.cjs +1 -1
- package/dist/server.js +169 -75
- package/dist/solid.cjs +7 -6
- package/dist/solid.js +494 -283
- package/h/dist/h.js +40 -9
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +13 -10
- package/h/jsx-runtime/types/jsx.d.ts +22 -1
- package/h/types/hyperscript.d.ts +11 -11
- package/h/types/index.d.ts +1 -1
- package/html/dist/html.cjs +4 -2
- package/html/dist/html.js +222 -95
- package/html/types/index.d.ts +1 -1
- package/html/types/lit.d.ts +52 -33
- package/package.json +1 -5
- package/store/dist/dev.cjs +1 -1
- package/store/dist/dev.js +123 -43
- package/store/dist/server.cjs +4 -0
- package/store/dist/server.js +23 -8
- package/store/dist/store.cjs +1 -1
- package/store/dist/store.js +114 -40
- package/store/package.json +0 -4
- package/store/types/index.d.ts +21 -7
- package/store/types/modifiers.d.ts +6 -3
- package/store/types/mutable.d.ts +5 -2
- package/store/types/server.d.ts +26 -5
- package/store/types/store.d.ts +219 -62
- package/types/index.d.ts +75 -10
- package/types/jsx.d.ts +35 -8
- package/types/reactive/array.d.ts +12 -4
- package/types/reactive/observable.d.ts +25 -17
- package/types/reactive/scheduler.d.ts +9 -6
- package/types/reactive/signal.d.ts +236 -143
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +64 -33
- package/types/render/flow.d.ts +43 -31
- package/types/render/hydration.d.ts +15 -15
- package/types/server/index.d.ts +57 -2
- package/types/server/reactive.d.ts +73 -42
- package/types/server/rendering.d.ts +169 -98
- package/universal/dist/dev.js +28 -12
- package/universal/dist/universal.js +28 -12
- package/universal/types/index.d.ts +3 -1
- package/universal/types/universal.d.ts +0 -1
- package/web/dist/dev.cjs +57 -24
- package/web/dist/dev.js +679 -101
- package/web/dist/server.cjs +96 -15
- package/web/dist/server.js +676 -105
- package/web/dist/web.cjs +53 -23
- package/web/dist/web.js +664 -99
- package/web/package.json +0 -4
- package/web/storage/dist/storage.js +3 -3
- package/web/types/client.d.ts +5 -3
- package/web/types/core.d.ts +10 -1
- package/web/types/index.d.ts +27 -10
- package/web/types/server-mock.d.ts +47 -32
- package/web/types/server.d.ts +88 -0
package/dist/solid.js
CHANGED
|
@@ -52,9 +52,11 @@ function enqueue(taskQueue, task) {
|
|
|
52
52
|
let m = 0;
|
|
53
53
|
let n = taskQueue.length - 1;
|
|
54
54
|
while (m <= n) {
|
|
55
|
-
const k = n + m >> 1;
|
|
55
|
+
const k = (n + m) >> 1;
|
|
56
56
|
const cmp = task.expirationTime - taskQueue[k].expirationTime;
|
|
57
|
-
if (cmp > 0) m = k + 1;
|
|
57
|
+
if (cmp > 0) m = k + 1;
|
|
58
|
+
else if (cmp < 0) n = k - 1;
|
|
59
|
+
else return k;
|
|
58
60
|
}
|
|
59
61
|
return m;
|
|
60
62
|
}
|
|
@@ -144,6 +146,7 @@ function nextHydrateContext() {
|
|
|
144
146
|
|
|
145
147
|
const equalFn = (a, b) => a === b;
|
|
146
148
|
const $PROXY = Symbol("solid-proxy");
|
|
149
|
+
const SUPPORTS_PROXY = typeof Proxy === "function";
|
|
147
150
|
const $TRACK = Symbol("solid-track");
|
|
148
151
|
const $DEVCOMP = Symbol("solid-dev-component");
|
|
149
152
|
const signalOptions = {
|
|
@@ -173,12 +176,14 @@ function createRoot(fn, detachedOwner) {
|
|
|
173
176
|
owner = Owner,
|
|
174
177
|
unowned = fn.length === 0,
|
|
175
178
|
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
176
|
-
root = unowned
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
root = unowned
|
|
180
|
+
? UNOWNED
|
|
181
|
+
: {
|
|
182
|
+
owned: null,
|
|
183
|
+
cleanups: null,
|
|
184
|
+
context: current ? current.context : null,
|
|
185
|
+
owner: current
|
|
186
|
+
},
|
|
182
187
|
updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
183
188
|
Owner = root;
|
|
184
189
|
Listener = null;
|
|
@@ -199,7 +204,8 @@ function createSignal(value, options) {
|
|
|
199
204
|
};
|
|
200
205
|
const setter = value => {
|
|
201
206
|
if (typeof value === "function") {
|
|
202
|
-
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
|
|
207
|
+
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
|
|
208
|
+
else value = value(s.value);
|
|
203
209
|
}
|
|
204
210
|
return writeSignal(s, value);
|
|
205
211
|
};
|
|
@@ -207,11 +213,13 @@ function createSignal(value, options) {
|
|
|
207
213
|
}
|
|
208
214
|
function createComputed(fn, value, options) {
|
|
209
215
|
const c = createComputation(fn, value, true, STALE);
|
|
210
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
216
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
217
|
+
else updateComputation(c);
|
|
211
218
|
}
|
|
212
219
|
function createRenderEffect(fn, value, options) {
|
|
213
220
|
const c = createComputation(fn, value, false, STALE);
|
|
214
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
221
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
222
|
+
else updateComputation(c);
|
|
215
223
|
}
|
|
216
224
|
function createEffect(fn, value, options) {
|
|
217
225
|
runEffects = runUserEffects;
|
|
@@ -223,10 +231,15 @@ function createEffect(fn, value, options) {
|
|
|
223
231
|
}
|
|
224
232
|
function createReaction(onInvalidate, options) {
|
|
225
233
|
let fn;
|
|
226
|
-
const c = createComputation(
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
234
|
+
const c = createComputation(
|
|
235
|
+
() => {
|
|
236
|
+
fn ? fn() : untrack(onInvalidate);
|
|
237
|
+
fn = undefined;
|
|
238
|
+
},
|
|
239
|
+
undefined,
|
|
240
|
+
false,
|
|
241
|
+
0
|
|
242
|
+
),
|
|
230
243
|
s = SuspenseContext && useContext(SuspenseContext);
|
|
231
244
|
if (s) c.suspense = s;
|
|
232
245
|
c.user = true;
|
|
@@ -254,7 +267,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
254
267
|
let source;
|
|
255
268
|
let fetcher;
|
|
256
269
|
let options;
|
|
257
|
-
if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
|
|
270
|
+
if ((arguments.length === 2 && typeof pFetcher === "object") || arguments.length === 1) {
|
|
258
271
|
source = true;
|
|
259
272
|
fetcher = pSource;
|
|
260
273
|
options = pFetcher || {};
|
|
@@ -268,7 +281,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
268
281
|
id = null,
|
|
269
282
|
loadedUnderTransition = false,
|
|
270
283
|
scheduled = false,
|
|
271
|
-
resolved =
|
|
284
|
+
resolved = "initialValue" in options,
|
|
272
285
|
dynamic = typeof source === "function" && createMemo(source);
|
|
273
286
|
const contexts = new Set(),
|
|
274
287
|
[value, setValue] = (options.storage || createSignal)(options.initialValue),
|
|
@@ -279,15 +292,19 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
279
292
|
[state, setState] = createSignal(resolved ? "ready" : "unresolved");
|
|
280
293
|
if (sharedConfig.context) {
|
|
281
294
|
id = sharedConfig.getNextContextId();
|
|
282
|
-
if (options.ssrLoadFrom === "initial") initP = options.initialValue;
|
|
295
|
+
if (options.ssrLoadFrom === "initial") initP = options.initialValue;
|
|
296
|
+
else if (sharedConfig.load && sharedConfig.has(id)) initP = sharedConfig.load(id);
|
|
283
297
|
}
|
|
284
298
|
function loadEnd(p, v, error, key) {
|
|
285
299
|
if (pr === p) {
|
|
286
300
|
pr = null;
|
|
287
301
|
key !== undefined && (resolved = true);
|
|
288
|
-
if ((p === initP || v === initP) && options.onHydrated)
|
|
289
|
-
|
|
290
|
-
|
|
302
|
+
if ((p === initP || v === initP) && options.onHydrated)
|
|
303
|
+
queueMicrotask(() =>
|
|
304
|
+
options.onHydrated(key, {
|
|
305
|
+
value: v
|
|
306
|
+
})
|
|
307
|
+
);
|
|
291
308
|
initP = NO_INIT;
|
|
292
309
|
if (Transition && p && loadedUnderTransition) {
|
|
293
310
|
Transition.promises.delete(p);
|
|
@@ -318,7 +335,8 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
318
335
|
createComputed(() => {
|
|
319
336
|
track();
|
|
320
337
|
if (pr) {
|
|
321
|
-
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
|
|
338
|
+
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
|
|
339
|
+
else if (!contexts.has(c)) {
|
|
322
340
|
c.increment();
|
|
323
341
|
contexts.add(c);
|
|
324
342
|
}
|
|
@@ -337,26 +355,35 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
337
355
|
return;
|
|
338
356
|
}
|
|
339
357
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
340
|
-
const p =
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
358
|
+
const p =
|
|
359
|
+
initP !== NO_INIT
|
|
360
|
+
? initP
|
|
361
|
+
: untrack(() =>
|
|
362
|
+
fetcher(lookup, {
|
|
363
|
+
value: value(),
|
|
364
|
+
refetching
|
|
365
|
+
})
|
|
366
|
+
);
|
|
344
367
|
if (!isPromise(p)) {
|
|
345
368
|
loadEnd(pr, p, undefined, lookup);
|
|
346
369
|
return p;
|
|
347
370
|
}
|
|
348
371
|
pr = p;
|
|
349
372
|
if ("value" in p) {
|
|
350
|
-
if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);
|
|
373
|
+
if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);
|
|
374
|
+
else loadEnd(pr, undefined, castError(p.value), lookup);
|
|
351
375
|
return p;
|
|
352
376
|
}
|
|
353
377
|
scheduled = true;
|
|
354
|
-
queueMicrotask(() => scheduled = false);
|
|
378
|
+
queueMicrotask(() => (scheduled = false));
|
|
355
379
|
runUpdates(() => {
|
|
356
380
|
setState(resolved ? "refreshing" : "pending");
|
|
357
381
|
trigger();
|
|
358
382
|
}, false);
|
|
359
|
-
return p.then(
|
|
383
|
+
return p.then(
|
|
384
|
+
v => loadEnd(p, v, undefined, lookup),
|
|
385
|
+
e => loadEnd(p, undefined, castError(e), lookup)
|
|
386
|
+
);
|
|
360
387
|
}
|
|
361
388
|
Object.defineProperties(read, {
|
|
362
389
|
state: {
|
|
@@ -380,50 +407,80 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
380
407
|
}
|
|
381
408
|
}
|
|
382
409
|
});
|
|
383
|
-
if (dynamic) createComputed(() => load(false));
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
410
|
+
if (dynamic) createComputed(() => load(false));
|
|
411
|
+
else load(false);
|
|
412
|
+
return [
|
|
413
|
+
read,
|
|
414
|
+
{
|
|
415
|
+
refetch: load,
|
|
416
|
+
mutate: setValue
|
|
417
|
+
}
|
|
418
|
+
];
|
|
388
419
|
}
|
|
389
420
|
function createDeferred(source, options) {
|
|
390
421
|
let t,
|
|
391
422
|
timeout = options ? options.timeoutMs : undefined;
|
|
392
|
-
const node = createComputation(
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
423
|
+
const node = createComputation(
|
|
424
|
+
() => {
|
|
425
|
+
if (!t || !t.fn)
|
|
426
|
+
t = requestCallback(
|
|
427
|
+
() => setDeferred(() => node.value),
|
|
428
|
+
timeout !== undefined
|
|
429
|
+
? {
|
|
430
|
+
timeout
|
|
431
|
+
}
|
|
432
|
+
: undefined
|
|
433
|
+
);
|
|
434
|
+
return source();
|
|
435
|
+
},
|
|
436
|
+
undefined,
|
|
437
|
+
true
|
|
438
|
+
);
|
|
439
|
+
const [deferred, setDeferred] = createSignal(
|
|
440
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
441
|
+
options
|
|
442
|
+
);
|
|
399
443
|
updateComputation(node);
|
|
400
|
-
setDeferred(() =>
|
|
444
|
+
setDeferred(() =>
|
|
445
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
446
|
+
);
|
|
401
447
|
return deferred;
|
|
402
448
|
}
|
|
403
449
|
function createSelector(source, fn = equalFn, options) {
|
|
404
450
|
const subs = new Map();
|
|
405
|
-
const node = createComputation(
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
for (const
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
451
|
+
const node = createComputation(
|
|
452
|
+
p => {
|
|
453
|
+
const v = source();
|
|
454
|
+
for (const [key, val] of subs.entries())
|
|
455
|
+
if (fn(key, v) !== fn(key, p)) {
|
|
456
|
+
for (const c of val.values()) {
|
|
457
|
+
c.state = STALE;
|
|
458
|
+
if (c.pure) Updates.push(c);
|
|
459
|
+
else Effects.push(c);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return v;
|
|
463
|
+
},
|
|
464
|
+
undefined,
|
|
465
|
+
true,
|
|
466
|
+
STALE
|
|
467
|
+
);
|
|
415
468
|
updateComputation(node);
|
|
416
469
|
return key => {
|
|
417
470
|
const listener = Listener;
|
|
418
471
|
if (listener) {
|
|
419
472
|
let l;
|
|
420
|
-
if (l = subs.get(key)) l.add(listener);
|
|
473
|
+
if ((l = subs.get(key))) l.add(listener);
|
|
474
|
+
else subs.set(key, (l = new Set([listener])));
|
|
421
475
|
onCleanup(() => {
|
|
422
476
|
l.delete(listener);
|
|
423
477
|
!l.size && subs.delete(key);
|
|
424
478
|
});
|
|
425
479
|
}
|
|
426
|
-
return fn(
|
|
480
|
+
return fn(
|
|
481
|
+
key,
|
|
482
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
483
|
+
);
|
|
427
484
|
};
|
|
428
485
|
}
|
|
429
486
|
function batch(fn) {
|
|
@@ -463,7 +520,9 @@ function onMount(fn) {
|
|
|
463
520
|
createEffect(() => untrack(fn));
|
|
464
521
|
}
|
|
465
522
|
function onCleanup(fn) {
|
|
466
|
-
if (Owner === null)
|
|
523
|
+
if (Owner === null);
|
|
524
|
+
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
525
|
+
else Owner.cleanups.push(fn);
|
|
467
526
|
return fn;
|
|
468
527
|
}
|
|
469
528
|
function catchError(fn, handler) {
|
|
@@ -517,15 +576,17 @@ function startTransition(fn) {
|
|
|
517
576
|
Owner = o;
|
|
518
577
|
let t;
|
|
519
578
|
if (Scheduler || SuspenseContext) {
|
|
520
|
-
t =
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
579
|
+
t =
|
|
580
|
+
Transition ||
|
|
581
|
+
(Transition = {
|
|
582
|
+
sources: new Set(),
|
|
583
|
+
effects: [],
|
|
584
|
+
promises: new Set(),
|
|
585
|
+
disposed: new Set(),
|
|
586
|
+
queue: new Set(),
|
|
587
|
+
running: true
|
|
588
|
+
});
|
|
589
|
+
t.done || (t.done = new Promise(res => (t.resolve = res)));
|
|
529
590
|
t.running = true;
|
|
530
591
|
}
|
|
531
592
|
runUpdates(fn, false);
|
|
@@ -533,7 +594,7 @@ function startTransition(fn) {
|
|
|
533
594
|
return t ? t.done : undefined;
|
|
534
595
|
});
|
|
535
596
|
}
|
|
536
|
-
const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
|
|
597
|
+
const [transPending, setTransPending] = /*@__PURE__*/ createSignal(false);
|
|
537
598
|
function useTransition() {
|
|
538
599
|
return [transPending, startTransition];
|
|
539
600
|
}
|
|
@@ -551,7 +612,9 @@ function createContext(defaultValue, options) {
|
|
|
551
612
|
}
|
|
552
613
|
function useContext(context) {
|
|
553
614
|
let value;
|
|
554
|
-
return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined
|
|
615
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined
|
|
616
|
+
? value
|
|
617
|
+
: context.defaultValue;
|
|
555
618
|
}
|
|
556
619
|
function children(fn) {
|
|
557
620
|
const children = createMemo(fn);
|
|
@@ -568,10 +631,7 @@ function getSuspenseContext() {
|
|
|
568
631
|
}
|
|
569
632
|
function enableExternalSource(factory, untrack = fn => fn()) {
|
|
570
633
|
if (ExternalSourceConfig) {
|
|
571
|
-
const {
|
|
572
|
-
factory: oldFactory,
|
|
573
|
-
untrack: oldUntrack
|
|
574
|
-
} = ExternalSourceConfig;
|
|
634
|
+
const { factory: oldFactory, untrack: oldUntrack } = ExternalSourceConfig;
|
|
575
635
|
ExternalSourceConfig = {
|
|
576
636
|
factory: (fn, trigger) => {
|
|
577
637
|
const oldSource = oldFactory(fn, trigger);
|
|
@@ -596,7 +656,8 @@ function enableExternalSource(factory, untrack = fn => fn()) {
|
|
|
596
656
|
function readSignal() {
|
|
597
657
|
const runningTransition = Transition && Transition.running;
|
|
598
658
|
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
599
|
-
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
659
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
660
|
+
else {
|
|
600
661
|
const updates = Updates;
|
|
601
662
|
Updates = null;
|
|
602
663
|
runUpdates(() => lookUpstream(this), false);
|
|
@@ -624,11 +685,12 @@ function readSignal() {
|
|
|
624
685
|
return this.value;
|
|
625
686
|
}
|
|
626
687
|
function writeSignal(node, value, isComp) {
|
|
627
|
-
let current =
|
|
688
|
+
let current =
|
|
689
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
628
690
|
if (!node.comparator || !node.comparator(current, value)) {
|
|
629
691
|
if (Transition) {
|
|
630
692
|
const TransitionRunning = Transition.running;
|
|
631
|
-
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
693
|
+
if (TransitionRunning || (!isComp && Transition.sources.has(node))) {
|
|
632
694
|
Transition.sources.add(node);
|
|
633
695
|
node.tValue = value;
|
|
634
696
|
}
|
|
@@ -641,14 +703,16 @@ function writeSignal(node, value, isComp) {
|
|
|
641
703
|
const TransitionRunning = Transition && Transition.running;
|
|
642
704
|
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
643
705
|
if (TransitionRunning ? !o.tState : !o.state) {
|
|
644
|
-
if (o.pure) Updates.push(o);
|
|
706
|
+
if (o.pure) Updates.push(o);
|
|
707
|
+
else Effects.push(o);
|
|
645
708
|
if (o.observers) markDownstream(o);
|
|
646
709
|
}
|
|
647
|
-
if (!TransitionRunning) o.state = STALE;
|
|
710
|
+
if (!TransitionRunning) o.state = STALE;
|
|
711
|
+
else o.tState = STALE;
|
|
648
712
|
}
|
|
649
713
|
if (Updates.length > 10e5) {
|
|
650
714
|
Updates = [];
|
|
651
|
-
if (false)
|
|
715
|
+
if (false);
|
|
652
716
|
throw new Error();
|
|
653
717
|
}
|
|
654
718
|
}, false);
|
|
@@ -660,7 +724,11 @@ function updateComputation(node) {
|
|
|
660
724
|
if (!node.fn) return;
|
|
661
725
|
cleanNode(node);
|
|
662
726
|
const time = ExecCount;
|
|
663
|
-
runComputation(
|
|
727
|
+
runComputation(
|
|
728
|
+
node,
|
|
729
|
+
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
730
|
+
time
|
|
731
|
+
);
|
|
664
732
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
665
733
|
queueMicrotask(() => {
|
|
666
734
|
runUpdates(() => {
|
|
@@ -725,11 +793,14 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
725
793
|
c.state = 0;
|
|
726
794
|
c.tState = state;
|
|
727
795
|
}
|
|
728
|
-
if (Owner === null)
|
|
796
|
+
if (Owner === null);
|
|
797
|
+
else if (Owner !== UNOWNED) {
|
|
729
798
|
if (Transition && Transition.running && Owner.pure) {
|
|
730
|
-
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
799
|
+
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
800
|
+
else Owner.tOwned.push(c);
|
|
731
801
|
} else {
|
|
732
|
-
if (!Owner.owned) Owner.owned = [c];
|
|
802
|
+
if (!Owner.owned) Owner.owned = [c];
|
|
803
|
+
else Owner.owned.push(c);
|
|
733
804
|
}
|
|
734
805
|
}
|
|
735
806
|
if (ExternalSourceConfig && c.fn) {
|
|
@@ -780,7 +851,8 @@ function runUpdates(fn, init) {
|
|
|
780
851
|
if (Updates) return fn();
|
|
781
852
|
let wait = false;
|
|
782
853
|
if (!init) Updates = [];
|
|
783
|
-
if (Effects) wait = true;
|
|
854
|
+
if (Effects) wait = true;
|
|
855
|
+
else Effects = [];
|
|
784
856
|
ExecCount++;
|
|
785
857
|
try {
|
|
786
858
|
const res = fn();
|
|
@@ -794,7 +866,8 @@ function runUpdates(fn, init) {
|
|
|
794
866
|
}
|
|
795
867
|
function completeUpdates(wait) {
|
|
796
868
|
if (Updates) {
|
|
797
|
-
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
869
|
+
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
870
|
+
else runQueue(Updates);
|
|
798
871
|
Updates = null;
|
|
799
872
|
}
|
|
800
873
|
if (wait) return;
|
|
@@ -862,7 +935,8 @@ function runUserEffects(queue) {
|
|
|
862
935
|
userLength = 0;
|
|
863
936
|
for (i = 0; i < queue.length; i++) {
|
|
864
937
|
const e = queue[i];
|
|
865
|
-
if (!e.user) runTop(e);
|
|
938
|
+
if (!e.user) runTop(e);
|
|
939
|
+
else queue[userLength++] = e;
|
|
866
940
|
}
|
|
867
941
|
if (sharedConfig.context) {
|
|
868
942
|
if (sharedConfig.count) {
|
|
@@ -881,13 +955,15 @@ function runUserEffects(queue) {
|
|
|
881
955
|
}
|
|
882
956
|
function lookUpstream(node, ignore) {
|
|
883
957
|
const runningTransition = Transition && Transition.running;
|
|
884
|
-
if (runningTransition) node.tState = 0;
|
|
958
|
+
if (runningTransition) node.tState = 0;
|
|
959
|
+
else node.state = 0;
|
|
885
960
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
886
961
|
const source = node.sources[i];
|
|
887
962
|
if (source.sources) {
|
|
888
963
|
const state = runningTransition ? source.tState : source.state;
|
|
889
964
|
if (state === STALE) {
|
|
890
|
-
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
965
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
966
|
+
runTop(source);
|
|
891
967
|
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
892
968
|
}
|
|
893
969
|
}
|
|
@@ -897,8 +973,10 @@ function markDownstream(node) {
|
|
|
897
973
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
898
974
|
const o = node.observers[i];
|
|
899
975
|
if (runningTransition ? !o.tState : !o.state) {
|
|
900
|
-
if (runningTransition) o.tState = PENDING;
|
|
901
|
-
|
|
976
|
+
if (runningTransition) o.tState = PENDING;
|
|
977
|
+
else o.state = PENDING;
|
|
978
|
+
if (o.pure) Updates.push(o);
|
|
979
|
+
else Effects.push(o);
|
|
902
980
|
o.observers && markDownstream(o);
|
|
903
981
|
}
|
|
904
982
|
}
|
|
@@ -921,11 +999,11 @@ function cleanNode(node) {
|
|
|
921
999
|
}
|
|
922
1000
|
}
|
|
923
1001
|
}
|
|
1002
|
+
if (node.tOwned) {
|
|
1003
|
+
for (i = node.tOwned.length - 1; i >= 0; i--) cleanNode(node.tOwned[i]);
|
|
1004
|
+
delete node.tOwned;
|
|
1005
|
+
}
|
|
924
1006
|
if (Transition && Transition.running && node.pure) {
|
|
925
|
-
if (node.tOwned) {
|
|
926
|
-
for (i = node.tOwned.length - 1; i >= 0; i--) cleanNode(node.tOwned[i]);
|
|
927
|
-
delete node.tOwned;
|
|
928
|
-
}
|
|
929
1007
|
reset(node, true);
|
|
930
1008
|
} else if (node.owned) {
|
|
931
1009
|
for (i = node.owned.length - 1; i >= 0; i--) cleanNode(node.owned[i]);
|
|
@@ -935,7 +1013,8 @@ function cleanNode(node) {
|
|
|
935
1013
|
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
936
1014
|
node.cleanups = null;
|
|
937
1015
|
}
|
|
938
|
-
if (Transition && Transition.running) node.tState = 0;
|
|
1016
|
+
if (Transition && Transition.running) node.tState = 0;
|
|
1017
|
+
else node.state = 0;
|
|
939
1018
|
}
|
|
940
1019
|
function reset(node, top) {
|
|
941
1020
|
if (!top) {
|
|
@@ -956,19 +1035,21 @@ function runErrors(err, fns, owner) {
|
|
|
956
1035
|
try {
|
|
957
1036
|
for (const f of fns) f(err);
|
|
958
1037
|
} catch (e) {
|
|
959
|
-
handleError(e, owner && owner.owner || null);
|
|
1038
|
+
handleError(e, (owner && owner.owner) || null);
|
|
960
1039
|
}
|
|
961
1040
|
}
|
|
962
1041
|
function handleError(err, owner = Owner) {
|
|
963
1042
|
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
964
1043
|
const error = castError(err);
|
|
965
1044
|
if (!fns) throw error;
|
|
966
|
-
if (Effects)
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
1045
|
+
if (Effects)
|
|
1046
|
+
Effects.push({
|
|
1047
|
+
fn() {
|
|
1048
|
+
runErrors(error, fns, owner);
|
|
1049
|
+
},
|
|
1050
|
+
state: STALE
|
|
1051
|
+
});
|
|
1052
|
+
else runErrors(error, fns, owner);
|
|
972
1053
|
}
|
|
973
1054
|
function resolveChildren(children) {
|
|
974
1055
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -985,19 +1066,24 @@ function resolveChildren(children) {
|
|
|
985
1066
|
function createProvider(id, options) {
|
|
986
1067
|
return function provider(props) {
|
|
987
1068
|
let res;
|
|
988
|
-
createRenderEffect(
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1069
|
+
createRenderEffect(
|
|
1070
|
+
() =>
|
|
1071
|
+
(res = untrack(() => {
|
|
1072
|
+
Owner.context = {
|
|
1073
|
+
...Owner.context,
|
|
1074
|
+
[id]: props.value
|
|
1075
|
+
};
|
|
1076
|
+
return children(() => props.children);
|
|
1077
|
+
})),
|
|
1078
|
+
undefined
|
|
1079
|
+
);
|
|
995
1080
|
return res;
|
|
996
1081
|
};
|
|
997
1082
|
}
|
|
998
1083
|
function onError(fn) {
|
|
999
1084
|
ERROR || (ERROR = Symbol("error"));
|
|
1000
|
-
if (Owner === null)
|
|
1085
|
+
if (Owner === null);
|
|
1086
|
+
else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
1001
1087
|
Owner.context = {
|
|
1002
1088
|
...Owner.context,
|
|
1003
1089
|
[ERROR]: [fn]
|
|
@@ -1026,7 +1112,8 @@ function observable(input) {
|
|
|
1026
1112
|
if (!(observer instanceof Object) || observer == null) {
|
|
1027
1113
|
throw new TypeError("Expected the observer to be an object.");
|
|
1028
1114
|
}
|
|
1029
|
-
const handler =
|
|
1115
|
+
const handler =
|
|
1116
|
+
typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1030
1117
|
if (!handler) {
|
|
1031
1118
|
return {
|
|
1032
1119
|
unsubscribe() {}
|
|
@@ -1057,7 +1144,7 @@ function from(producer) {
|
|
|
1057
1144
|
});
|
|
1058
1145
|
if ("subscribe" in producer) {
|
|
1059
1146
|
const unsub = producer.subscribe(v => set(() => v));
|
|
1060
|
-
onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
1147
|
+
onCleanup(() => ("unsubscribe" in unsub ? unsub.unsubscribe() : unsub()));
|
|
1061
1148
|
} else {
|
|
1062
1149
|
const clean = producer(set);
|
|
1063
1150
|
onCleanup(clean);
|
|
@@ -1101,8 +1188,7 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1101
1188
|
});
|
|
1102
1189
|
len = 1;
|
|
1103
1190
|
}
|
|
1104
|
-
}
|
|
1105
|
-
else if (len === 0) {
|
|
1191
|
+
} else if (len === 0) {
|
|
1106
1192
|
mapped = new Array(newLen);
|
|
1107
1193
|
for (j = 0; j < newLen; j++) {
|
|
1108
1194
|
items[j] = newItems[j];
|
|
@@ -1113,8 +1199,16 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1113
1199
|
temp = new Array(newLen);
|
|
1114
1200
|
tempdisposers = new Array(newLen);
|
|
1115
1201
|
indexes && (tempIndexes = new Array(newLen));
|
|
1116
|
-
for (
|
|
1117
|
-
|
|
1202
|
+
for (
|
|
1203
|
+
start = 0, end = Math.min(len, newLen);
|
|
1204
|
+
start < end && items[start] === newItems[start];
|
|
1205
|
+
start++
|
|
1206
|
+
);
|
|
1207
|
+
for (
|
|
1208
|
+
end = len - 1, newEnd = newLen - 1;
|
|
1209
|
+
end >= start && newEnd >= start && items[end] === newItems[newEnd];
|
|
1210
|
+
end--, newEnd--
|
|
1211
|
+
) {
|
|
1118
1212
|
temp[newEnd] = mapped[end];
|
|
1119
1213
|
tempdisposers[newEnd] = disposers[end];
|
|
1120
1214
|
indexes && (tempIndexes[newEnd] = indexes[end]);
|
|
@@ -1148,7 +1242,7 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1148
1242
|
}
|
|
1149
1243
|
} else mapped[j] = createRoot(mapper);
|
|
1150
1244
|
}
|
|
1151
|
-
mapped = mapped.slice(0, len = newLen);
|
|
1245
|
+
mapped = mapped.slice(0, (len = newLen));
|
|
1152
1246
|
items = newItems.slice(0);
|
|
1153
1247
|
}
|
|
1154
1248
|
return mapped;
|
|
@@ -1215,7 +1309,7 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1215
1309
|
}
|
|
1216
1310
|
len = signals.length = disposers.length = newLen;
|
|
1217
1311
|
items = newItems.slice(0);
|
|
1218
|
-
return mapped = mapped.slice(0, len);
|
|
1312
|
+
return (mapped = mapped.slice(0, len));
|
|
1219
1313
|
});
|
|
1220
1314
|
function mapper(disposer) {
|
|
1221
1315
|
disposers[i] = disposer;
|
|
@@ -1284,29 +1378,33 @@ function mergeProps(...sources) {
|
|
|
1284
1378
|
let proxy = false;
|
|
1285
1379
|
for (let i = 0; i < sources.length; i++) {
|
|
1286
1380
|
const s = sources[i];
|
|
1287
|
-
proxy = proxy || !!s && $PROXY in s;
|
|
1288
|
-
sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
|
|
1381
|
+
proxy = proxy || (!!s && $PROXY in s);
|
|
1382
|
+
sources[i] = typeof s === "function" ? ((proxy = true), createMemo(s)) : s;
|
|
1289
1383
|
}
|
|
1290
|
-
if (proxy) {
|
|
1291
|
-
return new Proxy(
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1384
|
+
if (SUPPORTS_PROXY && proxy) {
|
|
1385
|
+
return new Proxy(
|
|
1386
|
+
{
|
|
1387
|
+
get(property) {
|
|
1388
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1389
|
+
const v = resolveSource(sources[i])[property];
|
|
1390
|
+
if (v !== undefined) return v;
|
|
1391
|
+
}
|
|
1392
|
+
},
|
|
1393
|
+
has(property) {
|
|
1394
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1395
|
+
if (property in resolveSource(sources[i])) return true;
|
|
1396
|
+
}
|
|
1397
|
+
return false;
|
|
1398
|
+
},
|
|
1399
|
+
keys() {
|
|
1400
|
+
const keys = [];
|
|
1401
|
+
for (let i = 0; i < sources.length; i++)
|
|
1402
|
+
keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1403
|
+
return [...new Set(keys)];
|
|
1301
1404
|
}
|
|
1302
|
-
return false;
|
|
1303
1405
|
},
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1307
|
-
return [...new Set(keys)];
|
|
1308
|
-
}
|
|
1309
|
-
}, propTraps);
|
|
1406
|
+
propTraps
|
|
1407
|
+
);
|
|
1310
1408
|
}
|
|
1311
1409
|
const sourcesMap = {};
|
|
1312
1410
|
const defined = Object.create(null);
|
|
@@ -1319,15 +1417,20 @@ function mergeProps(...sources) {
|
|
|
1319
1417
|
if (key === "__proto__" || key === "constructor") continue;
|
|
1320
1418
|
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
1321
1419
|
if (!defined[key]) {
|
|
1322
|
-
defined[key] = desc.get
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1420
|
+
defined[key] = desc.get
|
|
1421
|
+
? {
|
|
1422
|
+
enumerable: true,
|
|
1423
|
+
configurable: true,
|
|
1424
|
+
get: resolveSources.bind((sourcesMap[key] = [desc.get.bind(source)]))
|
|
1425
|
+
}
|
|
1426
|
+
: desc.value !== undefined
|
|
1427
|
+
? desc
|
|
1428
|
+
: undefined;
|
|
1327
1429
|
} else {
|
|
1328
1430
|
const sources = sourcesMap[key];
|
|
1329
1431
|
if (sources) {
|
|
1330
|
-
if (desc.get) sources.push(desc.get.bind(source));
|
|
1432
|
+
if (desc.get) sources.push(desc.get.bind(source));
|
|
1433
|
+
else if (desc.value !== undefined) sources.push(() => desc.value);
|
|
1331
1434
|
}
|
|
1332
1435
|
}
|
|
1333
1436
|
}
|
|
@@ -1337,55 +1440,69 @@ function mergeProps(...sources) {
|
|
|
1337
1440
|
for (let i = definedKeys.length - 1; i >= 0; i--) {
|
|
1338
1441
|
const key = definedKeys[i],
|
|
1339
1442
|
desc = defined[key];
|
|
1340
|
-
if (desc && desc.get) Object.defineProperty(target, key, desc);
|
|
1443
|
+
if (desc && desc.get) Object.defineProperty(target, key, desc);
|
|
1444
|
+
else target[key] = desc ? desc.value : undefined;
|
|
1341
1445
|
}
|
|
1342
1446
|
return target;
|
|
1343
1447
|
}
|
|
1344
1448
|
function splitProps(props, ...keys) {
|
|
1345
|
-
if ($PROXY in props) {
|
|
1449
|
+
if (SUPPORTS_PROXY && $PROXY in props) {
|
|
1346
1450
|
const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
|
|
1347
1451
|
const res = keys.map(k => {
|
|
1348
|
-
return new Proxy(
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1452
|
+
return new Proxy(
|
|
1453
|
+
{
|
|
1454
|
+
get(property) {
|
|
1455
|
+
return k.includes(property) ? props[property] : undefined;
|
|
1456
|
+
},
|
|
1457
|
+
has(property) {
|
|
1458
|
+
return k.includes(property) && property in props;
|
|
1459
|
+
},
|
|
1460
|
+
keys() {
|
|
1461
|
+
return k.filter(property => property in props);
|
|
1462
|
+
}
|
|
1354
1463
|
},
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
}
|
|
1358
|
-
}, propTraps);
|
|
1464
|
+
propTraps
|
|
1465
|
+
);
|
|
1359
1466
|
});
|
|
1360
|
-
res.push(
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1467
|
+
res.push(
|
|
1468
|
+
new Proxy(
|
|
1469
|
+
{
|
|
1470
|
+
get(property) {
|
|
1471
|
+
return blocked.has(property) ? undefined : props[property];
|
|
1472
|
+
},
|
|
1473
|
+
has(property) {
|
|
1474
|
+
return blocked.has(property) ? false : property in props;
|
|
1475
|
+
},
|
|
1476
|
+
keys() {
|
|
1477
|
+
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1478
|
+
}
|
|
1479
|
+
},
|
|
1480
|
+
propTraps
|
|
1481
|
+
)
|
|
1482
|
+
);
|
|
1371
1483
|
return res;
|
|
1372
1484
|
}
|
|
1373
1485
|
const otherObject = {};
|
|
1374
1486
|
const objects = keys.map(() => ({}));
|
|
1375
1487
|
for (const propName of Object.getOwnPropertyNames(props)) {
|
|
1376
1488
|
const desc = Object.getOwnPropertyDescriptor(props, propName);
|
|
1377
|
-
const isDefaultDesc =
|
|
1489
|
+
const isDefaultDesc =
|
|
1490
|
+
!desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1378
1491
|
let blocked = false;
|
|
1379
1492
|
let objectIndex = 0;
|
|
1380
1493
|
for (const k of keys) {
|
|
1381
1494
|
if (k.includes(propName)) {
|
|
1382
1495
|
blocked = true;
|
|
1383
|
-
isDefaultDesc
|
|
1496
|
+
isDefaultDesc
|
|
1497
|
+
? (objects[objectIndex][propName] = desc.value)
|
|
1498
|
+
: Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1384
1499
|
}
|
|
1385
1500
|
++objectIndex;
|
|
1386
1501
|
}
|
|
1387
1502
|
if (!blocked) {
|
|
1388
|
-
isDefaultDesc
|
|
1503
|
+
isDefaultDesc
|
|
1504
|
+
? (otherObject[propName] = desc.value)
|
|
1505
|
+
: Object.defineProperty(otherObject, propName, desc);
|
|
1389
1506
|
}
|
|
1390
1507
|
}
|
|
1391
1508
|
return [...objects, otherObject];
|
|
@@ -1411,17 +1528,21 @@ function lazy(fn) {
|
|
|
1411
1528
|
comp = s;
|
|
1412
1529
|
}
|
|
1413
1530
|
let Comp;
|
|
1414
|
-
return createMemo(() =>
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1531
|
+
return createMemo(() =>
|
|
1532
|
+
(Comp = comp())
|
|
1533
|
+
? untrack(() => {
|
|
1534
|
+
if (false);
|
|
1535
|
+
if (!ctx || sharedConfig.done) return Comp(props);
|
|
1536
|
+
const c = sharedConfig.context;
|
|
1537
|
+
setHydrateContext(ctx);
|
|
1538
|
+
const r = Comp(props);
|
|
1539
|
+
setHydrateContext(c);
|
|
1540
|
+
return r;
|
|
1541
|
+
})
|
|
1542
|
+
: ""
|
|
1543
|
+
);
|
|
1423
1544
|
};
|
|
1424
|
-
wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
|
|
1545
|
+
wrap.preload = () => p || ((p = fn()).then(mod => (comp = () => mod.default)), p);
|
|
1425
1546
|
return wrap;
|
|
1426
1547
|
}
|
|
1427
1548
|
let counter = 0;
|
|
@@ -1446,49 +1567,77 @@ function Index(props) {
|
|
|
1446
1567
|
function Show(props) {
|
|
1447
1568
|
const keyed = props.keyed;
|
|
1448
1569
|
const condition = createMemo(() => props.when, undefined, {
|
|
1449
|
-
equals: (a, b) => keyed ? a === b : !a === !b
|
|
1570
|
+
equals: (a, b) => (keyed ? a === b : !a === !b)
|
|
1450
1571
|
});
|
|
1451
|
-
return createMemo(
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1572
|
+
return createMemo(
|
|
1573
|
+
() => {
|
|
1574
|
+
const c = condition();
|
|
1575
|
+
if (c) {
|
|
1576
|
+
const child = props.children;
|
|
1577
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1578
|
+
return fn
|
|
1579
|
+
? untrack(() =>
|
|
1580
|
+
child(
|
|
1581
|
+
keyed
|
|
1582
|
+
? c
|
|
1583
|
+
: () => {
|
|
1584
|
+
if (!untrack(condition)) throw narrowedError("Show");
|
|
1585
|
+
return props.when;
|
|
1586
|
+
}
|
|
1587
|
+
)
|
|
1588
|
+
)
|
|
1589
|
+
: child;
|
|
1590
|
+
}
|
|
1591
|
+
return props.fallback;
|
|
1592
|
+
},
|
|
1593
|
+
undefined,
|
|
1594
|
+
undefined
|
|
1595
|
+
);
|
|
1463
1596
|
}
|
|
1464
1597
|
function Switch(props) {
|
|
1465
1598
|
let keyed = false;
|
|
1466
1599
|
const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1467
1600
|
const conditions = children(() => props.children),
|
|
1468
|
-
evalConditions = createMemo(
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1601
|
+
evalConditions = createMemo(
|
|
1602
|
+
() => {
|
|
1603
|
+
let conds = conditions();
|
|
1604
|
+
if (!Array.isArray(conds)) conds = [conds];
|
|
1605
|
+
for (let i = 0; i < conds.length; i++) {
|
|
1606
|
+
const c = conds[i].when;
|
|
1607
|
+
if (c) {
|
|
1608
|
+
keyed = !!conds[i].keyed;
|
|
1609
|
+
return [i, c, conds[i]];
|
|
1610
|
+
}
|
|
1476
1611
|
}
|
|
1612
|
+
return [-1];
|
|
1613
|
+
},
|
|
1614
|
+
undefined,
|
|
1615
|
+
{
|
|
1616
|
+
equals
|
|
1477
1617
|
}
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1618
|
+
);
|
|
1619
|
+
return createMemo(
|
|
1620
|
+
() => {
|
|
1621
|
+
const [index, when, cond] = evalConditions();
|
|
1622
|
+
if (index < 0) return props.fallback;
|
|
1623
|
+
const c = cond.children;
|
|
1624
|
+
const fn = typeof c === "function" && c.length > 0;
|
|
1625
|
+
return fn
|
|
1626
|
+
? untrack(() =>
|
|
1627
|
+
c(
|
|
1628
|
+
keyed
|
|
1629
|
+
? when
|
|
1630
|
+
: () => {
|
|
1631
|
+
if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
|
|
1632
|
+
return cond.when;
|
|
1633
|
+
}
|
|
1634
|
+
)
|
|
1635
|
+
)
|
|
1636
|
+
: c;
|
|
1637
|
+
},
|
|
1638
|
+
undefined,
|
|
1639
|
+
undefined
|
|
1640
|
+
);
|
|
1492
1641
|
}
|
|
1493
1642
|
function Match(props) {
|
|
1494
1643
|
return props;
|
|
@@ -1499,23 +1648,29 @@ function resetErrorBoundaries() {
|
|
|
1499
1648
|
}
|
|
1500
1649
|
function ErrorBoundary(props) {
|
|
1501
1650
|
let err;
|
|
1502
|
-
if (sharedConfig.context && sharedConfig.load)
|
|
1651
|
+
if (sharedConfig.context && sharedConfig.load)
|
|
1652
|
+
err = sharedConfig.load(sharedConfig.getContextId());
|
|
1503
1653
|
const [errored, setErrored] = createSignal(err, undefined);
|
|
1504
1654
|
Errors || (Errors = new Set());
|
|
1505
1655
|
Errors.add(setErrored);
|
|
1506
1656
|
onCleanup(() => Errors.delete(setErrored));
|
|
1507
|
-
return createMemo(
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1657
|
+
return createMemo(
|
|
1658
|
+
() => {
|
|
1659
|
+
let e;
|
|
1660
|
+
if ((e = errored())) {
|
|
1661
|
+
const f = props.fallback;
|
|
1662
|
+
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
|
|
1663
|
+
}
|
|
1664
|
+
return catchError(() => props.children, setErrored);
|
|
1665
|
+
},
|
|
1666
|
+
undefined,
|
|
1667
|
+
undefined
|
|
1668
|
+
);
|
|
1515
1669
|
}
|
|
1516
1670
|
|
|
1517
|
-
const suspenseListEquals = (a, b) =>
|
|
1518
|
-
|
|
1671
|
+
const suspenseListEquals = (a, b) =>
|
|
1672
|
+
a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1673
|
+
const SuspenseListContext = /* #__PURE__ */ createContext();
|
|
1519
1674
|
function SuspenseList(props) {
|
|
1520
1675
|
let [wrapper, setWrapper] = createSignal(() => ({
|
|
1521
1676
|
inFallback: false
|
|
@@ -1526,51 +1681,51 @@ function SuspenseList(props) {
|
|
|
1526
1681
|
if (listContext) {
|
|
1527
1682
|
show = listContext.register(createMemo(() => wrapper()().inFallback));
|
|
1528
1683
|
}
|
|
1529
|
-
const resolved = createMemo(
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
showContent = true,
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
const res = reg.map(() => ({
|
|
1541
|
-
showContent: all && showContent,
|
|
1542
|
-
showFallback
|
|
1543
|
-
}));
|
|
1544
|
-
res.inFallback = !all;
|
|
1545
|
-
return res;
|
|
1546
|
-
}
|
|
1547
|
-
let stop = false;
|
|
1548
|
-
let inFallback = prev.inFallback;
|
|
1549
|
-
const res = [];
|
|
1550
|
-
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1551
|
-
const n = reverse ? len - i - 1 : i,
|
|
1552
|
-
s = reg[n]();
|
|
1553
|
-
if (!stop && !s) {
|
|
1554
|
-
res[n] = {
|
|
1555
|
-
showContent,
|
|
1684
|
+
const resolved = createMemo(
|
|
1685
|
+
prev => {
|
|
1686
|
+
const reveal = props.revealOrder,
|
|
1687
|
+
tail = props.tail,
|
|
1688
|
+
{ showContent = true, showFallback = true } = show ? show() : {},
|
|
1689
|
+
reg = registry(),
|
|
1690
|
+
reverse = reveal === "backwards";
|
|
1691
|
+
if (reveal === "together") {
|
|
1692
|
+
const all = reg.every(inFallback => !inFallback());
|
|
1693
|
+
const res = reg.map(() => ({
|
|
1694
|
+
showContent: all && showContent,
|
|
1556
1695
|
showFallback
|
|
1557
|
-
};
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
if (next) inFallback = true;
|
|
1561
|
-
res[n] = {
|
|
1562
|
-
showContent: next,
|
|
1563
|
-
showFallback: !tail || next && tail === "collapsed" ? showFallback : false
|
|
1564
|
-
};
|
|
1565
|
-
stop = true;
|
|
1696
|
+
}));
|
|
1697
|
+
res.inFallback = !all;
|
|
1698
|
+
return res;
|
|
1566
1699
|
}
|
|
1700
|
+
let stop = false;
|
|
1701
|
+
let inFallback = prev.inFallback;
|
|
1702
|
+
const res = [];
|
|
1703
|
+
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1704
|
+
const n = reverse ? len - i - 1 : i,
|
|
1705
|
+
s = reg[n]();
|
|
1706
|
+
if (!stop && !s) {
|
|
1707
|
+
res[n] = {
|
|
1708
|
+
showContent,
|
|
1709
|
+
showFallback
|
|
1710
|
+
};
|
|
1711
|
+
} else {
|
|
1712
|
+
const next = !stop;
|
|
1713
|
+
if (next) inFallback = true;
|
|
1714
|
+
res[n] = {
|
|
1715
|
+
showContent: next,
|
|
1716
|
+
showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
|
|
1717
|
+
};
|
|
1718
|
+
stop = true;
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
if (!stop) inFallback = false;
|
|
1722
|
+
res.inFallback = inFallback;
|
|
1723
|
+
return res;
|
|
1724
|
+
},
|
|
1725
|
+
{
|
|
1726
|
+
inFallback: false
|
|
1567
1727
|
}
|
|
1568
|
-
|
|
1569
|
-
res.inFallback = inFallback;
|
|
1570
|
-
return res;
|
|
1571
|
-
}, {
|
|
1572
|
-
inFallback: false
|
|
1573
|
-
});
|
|
1728
|
+
);
|
|
1574
1729
|
setWrapper(() => resolved);
|
|
1575
1730
|
return createComponent(SuspenseListContext.Provider, {
|
|
1576
1731
|
value: {
|
|
@@ -1615,23 +1770,27 @@ function Suspense(props) {
|
|
|
1615
1770
|
const key = sharedConfig.getContextId();
|
|
1616
1771
|
let ref = sharedConfig.load(key);
|
|
1617
1772
|
if (ref) {
|
|
1618
|
-
if (typeof ref !== "object" || ref.status !== "success") p = ref;
|
|
1773
|
+
if (typeof ref !== "object" || ref.status !== "success") p = ref;
|
|
1774
|
+
else sharedConfig.gather(key);
|
|
1619
1775
|
}
|
|
1620
1776
|
if (p && p !== "$$f") {
|
|
1621
1777
|
const [s, set] = createSignal(undefined, {
|
|
1622
1778
|
equals: false
|
|
1623
1779
|
});
|
|
1624
1780
|
flicker = s;
|
|
1625
|
-
p.then(
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1781
|
+
p.then(
|
|
1782
|
+
() => {
|
|
1783
|
+
if (sharedConfig.done) return set();
|
|
1784
|
+
sharedConfig.gather(key);
|
|
1785
|
+
setHydrateContext(ctx);
|
|
1786
|
+
set();
|
|
1787
|
+
setHydrateContext();
|
|
1788
|
+
},
|
|
1789
|
+
err => {
|
|
1790
|
+
error = err;
|
|
1791
|
+
set();
|
|
1792
|
+
}
|
|
1793
|
+
);
|
|
1635
1794
|
}
|
|
1636
1795
|
}
|
|
1637
1796
|
const listContext = useContext(SuspenseListContext);
|
|
@@ -1646,17 +1805,14 @@ function Suspense(props) {
|
|
|
1646
1805
|
ctx = sharedConfig.context;
|
|
1647
1806
|
if (flicker) {
|
|
1648
1807
|
flicker();
|
|
1649
|
-
return flicker = undefined;
|
|
1808
|
+
return (flicker = undefined);
|
|
1650
1809
|
}
|
|
1651
1810
|
if (ctx && p === "$$f") setHydrateContext();
|
|
1652
1811
|
const rendered = createMemo(() => props.children);
|
|
1653
1812
|
return createMemo(prev => {
|
|
1654
1813
|
const inFallback = store.inFallback(),
|
|
1655
|
-
{
|
|
1656
|
-
|
|
1657
|
-
showFallback = true
|
|
1658
|
-
} = show ? show() : {};
|
|
1659
|
-
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1814
|
+
{ showContent = true, showFallback = true } = show ? show() : {};
|
|
1815
|
+
if ((!inFallback || (p && p !== "$$f")) && showContent) {
|
|
1660
1816
|
store.resolved = true;
|
|
1661
1817
|
dispose && dispose();
|
|
1662
1818
|
dispose = ctx = p = undefined;
|
|
@@ -1684,4 +1840,59 @@ function Suspense(props) {
|
|
|
1684
1840
|
|
|
1685
1841
|
const DEV = undefined;
|
|
1686
1842
|
|
|
1687
|
-
export {
|
|
1843
|
+
export {
|
|
1844
|
+
$DEVCOMP,
|
|
1845
|
+
$PROXY,
|
|
1846
|
+
$TRACK,
|
|
1847
|
+
DEV,
|
|
1848
|
+
ErrorBoundary,
|
|
1849
|
+
For,
|
|
1850
|
+
Index,
|
|
1851
|
+
Match,
|
|
1852
|
+
Show,
|
|
1853
|
+
Suspense,
|
|
1854
|
+
SuspenseList,
|
|
1855
|
+
Switch,
|
|
1856
|
+
batch,
|
|
1857
|
+
cancelCallback,
|
|
1858
|
+
catchError,
|
|
1859
|
+
children,
|
|
1860
|
+
createComponent,
|
|
1861
|
+
createComputed,
|
|
1862
|
+
createContext,
|
|
1863
|
+
createDeferred,
|
|
1864
|
+
createEffect,
|
|
1865
|
+
createMemo,
|
|
1866
|
+
createReaction,
|
|
1867
|
+
createRenderEffect,
|
|
1868
|
+
createResource,
|
|
1869
|
+
createRoot,
|
|
1870
|
+
createSelector,
|
|
1871
|
+
createSignal,
|
|
1872
|
+
createUniqueId,
|
|
1873
|
+
enableExternalSource,
|
|
1874
|
+
enableHydration,
|
|
1875
|
+
enableScheduling,
|
|
1876
|
+
equalFn,
|
|
1877
|
+
from,
|
|
1878
|
+
getListener,
|
|
1879
|
+
getOwner,
|
|
1880
|
+
indexArray,
|
|
1881
|
+
lazy,
|
|
1882
|
+
mapArray,
|
|
1883
|
+
mergeProps,
|
|
1884
|
+
observable,
|
|
1885
|
+
on,
|
|
1886
|
+
onCleanup,
|
|
1887
|
+
onError,
|
|
1888
|
+
onMount,
|
|
1889
|
+
requestCallback,
|
|
1890
|
+
resetErrorBoundaries,
|
|
1891
|
+
runWithOwner,
|
|
1892
|
+
sharedConfig,
|
|
1893
|
+
splitProps,
|
|
1894
|
+
startTransition,
|
|
1895
|
+
untrack,
|
|
1896
|
+
useContext,
|
|
1897
|
+
useTransition
|
|
1898
|
+
};
|