solid-js 1.8.13 → 1.8.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.js +307 -544
- package/dist/server.js +75 -170
- package/dist/solid.js +265 -471
- package/h/dist/h.js +8 -34
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +8 -11
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +94 -216
- package/html/types/lit.d.ts +33 -47
- package/package.json +3 -3
- package/store/dist/dev.js +43 -122
- package/store/dist/server.js +8 -19
- package/store/dist/store.js +40 -113
- package/store/types/index.d.ts +7 -21
- package/store/types/modifiers.d.ts +3 -6
- package/store/types/mutable.d.ts +2 -5
- package/store/types/server.d.ts +4 -12
- package/store/types/store.d.ts +61 -218
- package/types/index.d.ts +10 -75
- package/types/reactive/array.d.ts +4 -12
- package/types/reactive/observable.d.ts +17 -25
- package/types/reactive/scheduler.d.ts +6 -9
- package/types/reactive/signal.d.ts +142 -233
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +33 -64
- package/types/render/flow.d.ts +31 -43
- package/types/render/hydration.d.ts +13 -13
- package/types/server/index.d.ts +2 -57
- package/types/server/reactive.d.ts +42 -73
- package/types/server/rendering.d.ts +96 -167
- package/universal/dist/dev.js +12 -28
- package/universal/dist/universal.js +12 -28
- package/universal/types/index.d.ts +1 -3
- package/universal/types/universal.d.ts +1 -0
- package/web/dist/dev.js +82 -623
- package/web/dist/server.js +96 -210
- package/web/dist/web.js +80 -614
- package/web/storage/dist/storage.js +3 -3
- package/web/types/client.d.ts +2 -2
- package/web/types/core.d.ts +1 -10
- package/web/types/index.d.ts +10 -27
- package/web/types/server-mock.d.ts +32 -47
package/dist/solid.js
CHANGED
|
@@ -52,11 +52,9 @@ function enqueue(taskQueue, task) {
|
|
|
52
52
|
let m = 0;
|
|
53
53
|
let n = taskQueue.length - 1;
|
|
54
54
|
while (m <= n) {
|
|
55
|
-
const k =
|
|
55
|
+
const k = n + m >> 1;
|
|
56
56
|
const cmp = task.expirationTime - taskQueue[k].expirationTime;
|
|
57
|
-
if (cmp > 0) m = k + 1;
|
|
58
|
-
else if (cmp < 0) n = k - 1;
|
|
59
|
-
else return k;
|
|
57
|
+
if (cmp > 0) m = k + 1;else if (cmp < 0) n = k - 1;else return k;
|
|
60
58
|
}
|
|
61
59
|
return m;
|
|
62
60
|
}
|
|
@@ -162,14 +160,12 @@ function createRoot(fn, detachedOwner) {
|
|
|
162
160
|
owner = Owner,
|
|
163
161
|
unowned = fn.length === 0,
|
|
164
162
|
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
165
|
-
root = unowned
|
|
166
|
-
|
|
167
|
-
:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
owner: current
|
|
172
|
-
},
|
|
163
|
+
root = unowned ? UNOWNED : {
|
|
164
|
+
owned: null,
|
|
165
|
+
cleanups: null,
|
|
166
|
+
context: current ? current.context : null,
|
|
167
|
+
owner: current
|
|
168
|
+
},
|
|
173
169
|
updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
174
170
|
Owner = root;
|
|
175
171
|
Listener = null;
|
|
@@ -190,8 +186,7 @@ function createSignal(value, options) {
|
|
|
190
186
|
};
|
|
191
187
|
const setter = value => {
|
|
192
188
|
if (typeof value === "function") {
|
|
193
|
-
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
|
|
194
|
-
else value = value(s.value);
|
|
189
|
+
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
|
|
195
190
|
}
|
|
196
191
|
return writeSignal(s, value);
|
|
197
192
|
};
|
|
@@ -199,13 +194,11 @@ function createSignal(value, options) {
|
|
|
199
194
|
}
|
|
200
195
|
function createComputed(fn, value, options) {
|
|
201
196
|
const c = createComputation(fn, value, true, STALE);
|
|
202
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
203
|
-
else updateComputation(c);
|
|
197
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
204
198
|
}
|
|
205
199
|
function createRenderEffect(fn, value, options) {
|
|
206
200
|
const c = createComputation(fn, value, false, STALE);
|
|
207
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
208
|
-
else updateComputation(c);
|
|
201
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
209
202
|
}
|
|
210
203
|
function createEffect(fn, value, options) {
|
|
211
204
|
runEffects = runUserEffects;
|
|
@@ -217,15 +210,10 @@ function createEffect(fn, value, options) {
|
|
|
217
210
|
}
|
|
218
211
|
function createReaction(onInvalidate, options) {
|
|
219
212
|
let fn;
|
|
220
|
-
const c = createComputation(
|
|
221
|
-
()
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
},
|
|
225
|
-
undefined,
|
|
226
|
-
false,
|
|
227
|
-
0
|
|
228
|
-
),
|
|
213
|
+
const c = createComputation(() => {
|
|
214
|
+
fn ? fn() : untrack(onInvalidate);
|
|
215
|
+
fn = undefined;
|
|
216
|
+
}, undefined, false, 0),
|
|
229
217
|
s = SuspenseContext && useContext(SuspenseContext);
|
|
230
218
|
if (s) c.suspense = s;
|
|
231
219
|
c.user = true;
|
|
@@ -253,7 +241,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
253
241
|
let source;
|
|
254
242
|
let fetcher;
|
|
255
243
|
let options;
|
|
256
|
-
if (
|
|
244
|
+
if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
|
|
257
245
|
source = true;
|
|
258
246
|
fetcher = pSource;
|
|
259
247
|
options = pFetcher || {};
|
|
@@ -267,7 +255,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
267
255
|
id = null,
|
|
268
256
|
loadedUnderTransition = false,
|
|
269
257
|
scheduled = false,
|
|
270
|
-
resolved = "initialValue" in options,
|
|
258
|
+
resolved = ("initialValue" in options),
|
|
271
259
|
dynamic = typeof source === "function" && createMemo(source);
|
|
272
260
|
const contexts = new Set(),
|
|
273
261
|
[value, setValue] = (options.storage || createSignal)(options.initialValue),
|
|
@@ -279,19 +267,15 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
279
267
|
if (sharedConfig.context) {
|
|
280
268
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
281
269
|
let v;
|
|
282
|
-
if (options.ssrLoadFrom === "initial") initP = options.initialValue;
|
|
283
|
-
else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
|
|
270
|
+
if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
|
|
284
271
|
}
|
|
285
272
|
function loadEnd(p, v, error, key) {
|
|
286
273
|
if (pr === p) {
|
|
287
274
|
pr = null;
|
|
288
275
|
key !== undefined && (resolved = true);
|
|
289
|
-
if ((p === initP || v === initP) && options.onHydrated)
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
value: v
|
|
293
|
-
})
|
|
294
|
-
);
|
|
276
|
+
if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
|
|
277
|
+
value: v
|
|
278
|
+
}));
|
|
295
279
|
initP = NO_INIT;
|
|
296
280
|
if (Transition && p && loadedUnderTransition) {
|
|
297
281
|
Transition.promises.delete(p);
|
|
@@ -322,8 +306,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
322
306
|
createComputed(() => {
|
|
323
307
|
track();
|
|
324
308
|
if (pr) {
|
|
325
|
-
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
|
|
326
|
-
else if (!contexts.has(c)) {
|
|
309
|
+
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) {
|
|
327
310
|
c.increment();
|
|
328
311
|
contexts.add(c);
|
|
329
312
|
}
|
|
@@ -342,35 +325,26 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
342
325
|
return;
|
|
343
326
|
}
|
|
344
327
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
345
|
-
const p =
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
fetcher(lookup, {
|
|
350
|
-
value: value(),
|
|
351
|
-
refetching
|
|
352
|
-
})
|
|
353
|
-
);
|
|
328
|
+
const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {
|
|
329
|
+
value: value(),
|
|
330
|
+
refetching
|
|
331
|
+
}));
|
|
354
332
|
if (!isPromise(p)) {
|
|
355
333
|
loadEnd(pr, p, undefined, lookup);
|
|
356
334
|
return p;
|
|
357
335
|
}
|
|
358
336
|
pr = p;
|
|
359
337
|
if ("value" in p) {
|
|
360
|
-
if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);
|
|
361
|
-
else loadEnd(pr, undefined, undefined, lookup);
|
|
338
|
+
if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);else loadEnd(pr, undefined, undefined, lookup);
|
|
362
339
|
return p;
|
|
363
340
|
}
|
|
364
341
|
scheduled = true;
|
|
365
|
-
queueMicrotask(() =>
|
|
342
|
+
queueMicrotask(() => scheduled = false);
|
|
366
343
|
runUpdates(() => {
|
|
367
344
|
setState(resolved ? "refreshing" : "pending");
|
|
368
345
|
trigger();
|
|
369
346
|
}, false);
|
|
370
|
-
return p.then(
|
|
371
|
-
v => loadEnd(p, v, undefined, lookup),
|
|
372
|
-
e => loadEnd(p, undefined, castError(e), lookup)
|
|
373
|
-
);
|
|
347
|
+
return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));
|
|
374
348
|
}
|
|
375
349
|
Object.defineProperties(read, {
|
|
376
350
|
state: {
|
|
@@ -394,80 +368,50 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
394
368
|
}
|
|
395
369
|
}
|
|
396
370
|
});
|
|
397
|
-
if (dynamic) createComputed(() => load(false));
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
refetch: load,
|
|
403
|
-
mutate: setValue
|
|
404
|
-
}
|
|
405
|
-
];
|
|
371
|
+
if (dynamic) createComputed(() => load(false));else load(false);
|
|
372
|
+
return [read, {
|
|
373
|
+
refetch: load,
|
|
374
|
+
mutate: setValue
|
|
375
|
+
}];
|
|
406
376
|
}
|
|
407
377
|
function createDeferred(source, options) {
|
|
408
378
|
let t,
|
|
409
379
|
timeout = options ? options.timeoutMs : undefined;
|
|
410
|
-
const node = createComputation(
|
|
411
|
-
() => {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
timeout
|
|
418
|
-
}
|
|
419
|
-
: undefined
|
|
420
|
-
);
|
|
421
|
-
return source();
|
|
422
|
-
},
|
|
423
|
-
undefined,
|
|
424
|
-
true
|
|
425
|
-
);
|
|
426
|
-
const [deferred, setDeferred] = createSignal(
|
|
427
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
428
|
-
options
|
|
429
|
-
);
|
|
380
|
+
const node = createComputation(() => {
|
|
381
|
+
if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
|
|
382
|
+
timeout
|
|
383
|
+
} : undefined);
|
|
384
|
+
return source();
|
|
385
|
+
}, undefined, true);
|
|
386
|
+
const [deferred, setDeferred] = createSignal(Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, options);
|
|
430
387
|
updateComputation(node);
|
|
431
|
-
setDeferred(() =>
|
|
432
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
433
|
-
);
|
|
388
|
+
setDeferred(() => Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
434
389
|
return deferred;
|
|
435
390
|
}
|
|
436
391
|
function createSelector(source, fn = equalFn, options) {
|
|
437
392
|
const subs = new Map();
|
|
438
|
-
const node = createComputation(
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
for (const
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
}
|
|
449
|
-
return v;
|
|
450
|
-
},
|
|
451
|
-
undefined,
|
|
452
|
-
true,
|
|
453
|
-
STALE
|
|
454
|
-
);
|
|
393
|
+
const node = createComputation(p => {
|
|
394
|
+
const v = source();
|
|
395
|
+
for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
|
|
396
|
+
for (const c of val.values()) {
|
|
397
|
+
c.state = STALE;
|
|
398
|
+
if (c.pure) Updates.push(c);else Effects.push(c);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
return v;
|
|
402
|
+
}, undefined, true, STALE);
|
|
455
403
|
updateComputation(node);
|
|
456
404
|
return key => {
|
|
457
405
|
const listener = Listener;
|
|
458
406
|
if (listener) {
|
|
459
407
|
let l;
|
|
460
|
-
if (
|
|
461
|
-
else subs.set(key, (l = new Set([listener])));
|
|
408
|
+
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
462
409
|
onCleanup(() => {
|
|
463
410
|
l.delete(listener);
|
|
464
411
|
!l.size && subs.delete(key);
|
|
465
412
|
});
|
|
466
413
|
}
|
|
467
|
-
return fn(
|
|
468
|
-
key,
|
|
469
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
470
|
-
);
|
|
414
|
+
return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
471
415
|
};
|
|
472
416
|
}
|
|
473
417
|
function batch(fn) {
|
|
@@ -507,9 +451,7 @@ function onMount(fn) {
|
|
|
507
451
|
createEffect(() => untrack(fn));
|
|
508
452
|
}
|
|
509
453
|
function onCleanup(fn) {
|
|
510
|
-
if (Owner === null);
|
|
511
|
-
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
512
|
-
else Owner.cleanups.push(fn);
|
|
454
|
+
if (Owner === null) ;else if (Owner.cleanups === null) Owner.cleanups = [fn];else Owner.cleanups.push(fn);
|
|
513
455
|
return fn;
|
|
514
456
|
}
|
|
515
457
|
function catchError(fn, handler) {
|
|
@@ -563,17 +505,15 @@ function startTransition(fn) {
|
|
|
563
505
|
Owner = o;
|
|
564
506
|
let t;
|
|
565
507
|
if (Scheduler || SuspenseContext) {
|
|
566
|
-
t =
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
});
|
|
576
|
-
t.done || (t.done = new Promise(res => (t.resolve = res)));
|
|
508
|
+
t = Transition || (Transition = {
|
|
509
|
+
sources: new Set(),
|
|
510
|
+
effects: [],
|
|
511
|
+
promises: new Set(),
|
|
512
|
+
disposed: new Set(),
|
|
513
|
+
queue: new Set(),
|
|
514
|
+
running: true
|
|
515
|
+
});
|
|
516
|
+
t.done || (t.done = new Promise(res => t.resolve = res));
|
|
577
517
|
t.running = true;
|
|
578
518
|
}
|
|
579
519
|
runUpdates(fn, false);
|
|
@@ -581,7 +521,7 @@ function startTransition(fn) {
|
|
|
581
521
|
return t ? t.done : undefined;
|
|
582
522
|
});
|
|
583
523
|
}
|
|
584
|
-
const [transPending, setTransPending] = /*@__PURE__*/
|
|
524
|
+
const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
|
|
585
525
|
function useTransition() {
|
|
586
526
|
return [transPending, startTransition];
|
|
587
527
|
}
|
|
@@ -598,9 +538,7 @@ function createContext(defaultValue, options) {
|
|
|
598
538
|
};
|
|
599
539
|
}
|
|
600
540
|
function useContext(context) {
|
|
601
|
-
return Owner && Owner.context && Owner.context[context.id] !== undefined
|
|
602
|
-
? Owner.context[context.id]
|
|
603
|
-
: context.defaultValue;
|
|
541
|
+
return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;
|
|
604
542
|
}
|
|
605
543
|
function children(fn) {
|
|
606
544
|
const children = createMemo(fn);
|
|
@@ -617,7 +555,10 @@ function getSuspenseContext() {
|
|
|
617
555
|
}
|
|
618
556
|
function enableExternalSource(factory, untrack = fn => fn()) {
|
|
619
557
|
if (ExternalSourceConfig) {
|
|
620
|
-
const {
|
|
558
|
+
const {
|
|
559
|
+
factory: oldFactory,
|
|
560
|
+
untrack: oldUntrack
|
|
561
|
+
} = ExternalSourceConfig;
|
|
621
562
|
ExternalSourceConfig = {
|
|
622
563
|
factory: (fn, trigger) => {
|
|
623
564
|
const oldSource = oldFactory(fn, trigger);
|
|
@@ -642,8 +583,7 @@ function enableExternalSource(factory, untrack = fn => fn()) {
|
|
|
642
583
|
function readSignal() {
|
|
643
584
|
const runningTransition = Transition && Transition.running;
|
|
644
585
|
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
645
|
-
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
646
|
-
else {
|
|
586
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
|
|
647
587
|
const updates = Updates;
|
|
648
588
|
Updates = null;
|
|
649
589
|
runUpdates(() => lookUpstream(this), false);
|
|
@@ -671,12 +611,11 @@ function readSignal() {
|
|
|
671
611
|
return this.value;
|
|
672
612
|
}
|
|
673
613
|
function writeSignal(node, value, isComp) {
|
|
674
|
-
let current =
|
|
675
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
614
|
+
let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
676
615
|
if (!node.comparator || !node.comparator(current, value)) {
|
|
677
616
|
if (Transition) {
|
|
678
617
|
const TransitionRunning = Transition.running;
|
|
679
|
-
if (TransitionRunning ||
|
|
618
|
+
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
680
619
|
Transition.sources.add(node);
|
|
681
620
|
node.tValue = value;
|
|
682
621
|
}
|
|
@@ -689,16 +628,14 @@ function writeSignal(node, value, isComp) {
|
|
|
689
628
|
const TransitionRunning = Transition && Transition.running;
|
|
690
629
|
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
691
630
|
if (TransitionRunning ? !o.tState : !o.state) {
|
|
692
|
-
if (o.pure) Updates.push(o);
|
|
693
|
-
else Effects.push(o);
|
|
631
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
694
632
|
if (o.observers) markDownstream(o);
|
|
695
633
|
}
|
|
696
|
-
if (!TransitionRunning) o.state = STALE;
|
|
697
|
-
else o.tState = STALE;
|
|
634
|
+
if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
|
|
698
635
|
}
|
|
699
636
|
if (Updates.length > 10e5) {
|
|
700
637
|
Updates = [];
|
|
701
|
-
if (false);
|
|
638
|
+
if (false) ;
|
|
702
639
|
throw new Error();
|
|
703
640
|
}
|
|
704
641
|
}, false);
|
|
@@ -710,11 +647,7 @@ function updateComputation(node) {
|
|
|
710
647
|
if (!node.fn) return;
|
|
711
648
|
cleanNode(node);
|
|
712
649
|
const time = ExecCount;
|
|
713
|
-
runComputation(
|
|
714
|
-
node,
|
|
715
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
716
|
-
time
|
|
717
|
-
);
|
|
650
|
+
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
718
651
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
719
652
|
queueMicrotask(() => {
|
|
720
653
|
runUpdates(() => {
|
|
@@ -779,14 +712,11 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
779
712
|
c.state = 0;
|
|
780
713
|
c.tState = state;
|
|
781
714
|
}
|
|
782
|
-
if (Owner === null);
|
|
783
|
-
else if (Owner !== UNOWNED) {
|
|
715
|
+
if (Owner === null) ;else if (Owner !== UNOWNED) {
|
|
784
716
|
if (Transition && Transition.running && Owner.pure) {
|
|
785
|
-
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
786
|
-
else Owner.tOwned.push(c);
|
|
717
|
+
if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);
|
|
787
718
|
} else {
|
|
788
|
-
if (!Owner.owned) Owner.owned = [c];
|
|
789
|
-
else Owner.owned.push(c);
|
|
719
|
+
if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
|
|
790
720
|
}
|
|
791
721
|
}
|
|
792
722
|
if (ExternalSourceConfig && c.fn) {
|
|
@@ -837,8 +767,7 @@ function runUpdates(fn, init) {
|
|
|
837
767
|
if (Updates) return fn();
|
|
838
768
|
let wait = false;
|
|
839
769
|
if (!init) Updates = [];
|
|
840
|
-
if (Effects) wait = true;
|
|
841
|
-
else Effects = [];
|
|
770
|
+
if (Effects) wait = true;else Effects = [];
|
|
842
771
|
ExecCount++;
|
|
843
772
|
try {
|
|
844
773
|
const res = fn();
|
|
@@ -852,8 +781,7 @@ function runUpdates(fn, init) {
|
|
|
852
781
|
}
|
|
853
782
|
function completeUpdates(wait) {
|
|
854
783
|
if (Updates) {
|
|
855
|
-
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
856
|
-
else runQueue(Updates);
|
|
784
|
+
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);
|
|
857
785
|
Updates = null;
|
|
858
786
|
}
|
|
859
787
|
if (wait) return;
|
|
@@ -921,8 +849,7 @@ function runUserEffects(queue) {
|
|
|
921
849
|
userLength = 0;
|
|
922
850
|
for (i = 0; i < queue.length; i++) {
|
|
923
851
|
const e = queue[i];
|
|
924
|
-
if (!e.user) runTop(e);
|
|
925
|
-
else queue[userLength++] = e;
|
|
852
|
+
if (!e.user) runTop(e);else queue[userLength++] = e;
|
|
926
853
|
}
|
|
927
854
|
if (sharedConfig.context) {
|
|
928
855
|
if (sharedConfig.count) {
|
|
@@ -940,15 +867,13 @@ function runUserEffects(queue) {
|
|
|
940
867
|
}
|
|
941
868
|
function lookUpstream(node, ignore) {
|
|
942
869
|
const runningTransition = Transition && Transition.running;
|
|
943
|
-
if (runningTransition) node.tState = 0;
|
|
944
|
-
else node.state = 0;
|
|
870
|
+
if (runningTransition) node.tState = 0;else node.state = 0;
|
|
945
871
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
946
872
|
const source = node.sources[i];
|
|
947
873
|
if (source.sources) {
|
|
948
874
|
const state = runningTransition ? source.tState : source.state;
|
|
949
875
|
if (state === STALE) {
|
|
950
|
-
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
951
|
-
runTop(source);
|
|
876
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
|
|
952
877
|
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
953
878
|
}
|
|
954
879
|
}
|
|
@@ -958,10 +883,8 @@ function markDownstream(node) {
|
|
|
958
883
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
959
884
|
const o = node.observers[i];
|
|
960
885
|
if (runningTransition ? !o.tState : !o.state) {
|
|
961
|
-
if (runningTransition) o.tState = PENDING;
|
|
962
|
-
|
|
963
|
-
if (o.pure) Updates.push(o);
|
|
964
|
-
else Effects.push(o);
|
|
886
|
+
if (runningTransition) o.tState = PENDING;else o.state = PENDING;
|
|
887
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
965
888
|
o.observers && markDownstream(o);
|
|
966
889
|
}
|
|
967
890
|
}
|
|
@@ -998,8 +921,7 @@ function cleanNode(node) {
|
|
|
998
921
|
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
999
922
|
node.cleanups = null;
|
|
1000
923
|
}
|
|
1001
|
-
if (Transition && Transition.running) node.tState = 0;
|
|
1002
|
-
else node.state = 0;
|
|
924
|
+
if (Transition && Transition.running) node.tState = 0;else node.state = 0;
|
|
1003
925
|
}
|
|
1004
926
|
function reset(node, top) {
|
|
1005
927
|
if (!top) {
|
|
@@ -1020,21 +942,19 @@ function runErrors(err, fns, owner) {
|
|
|
1020
942
|
try {
|
|
1021
943
|
for (const f of fns) f(err);
|
|
1022
944
|
} catch (e) {
|
|
1023
|
-
handleError(e,
|
|
945
|
+
handleError(e, owner && owner.owner || null);
|
|
1024
946
|
}
|
|
1025
947
|
}
|
|
1026
948
|
function handleError(err, owner = Owner) {
|
|
1027
949
|
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
1028
950
|
const error = castError(err);
|
|
1029
951
|
if (!fns) throw error;
|
|
1030
|
-
if (Effects)
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
});
|
|
1037
|
-
else runErrors(error, fns, owner);
|
|
952
|
+
if (Effects) Effects.push({
|
|
953
|
+
fn() {
|
|
954
|
+
runErrors(error, fns, owner);
|
|
955
|
+
},
|
|
956
|
+
state: STALE
|
|
957
|
+
});else runErrors(error, fns, owner);
|
|
1038
958
|
}
|
|
1039
959
|
function resolveChildren(children) {
|
|
1040
960
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1051,24 +971,19 @@ function resolveChildren(children) {
|
|
|
1051
971
|
function createProvider(id, options) {
|
|
1052
972
|
return function provider(props) {
|
|
1053
973
|
let res;
|
|
1054
|
-
createRenderEffect(
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
return children(() => props.children);
|
|
1062
|
-
})),
|
|
1063
|
-
undefined
|
|
1064
|
-
);
|
|
974
|
+
createRenderEffect(() => res = untrack(() => {
|
|
975
|
+
Owner.context = {
|
|
976
|
+
...Owner.context,
|
|
977
|
+
[id]: props.value
|
|
978
|
+
};
|
|
979
|
+
return children(() => props.children);
|
|
980
|
+
}), undefined);
|
|
1065
981
|
return res;
|
|
1066
982
|
};
|
|
1067
983
|
}
|
|
1068
984
|
function onError(fn) {
|
|
1069
985
|
ERROR || (ERROR = Symbol("error"));
|
|
1070
|
-
if (Owner === null);
|
|
1071
|
-
else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
986
|
+
if (Owner === null) ;else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
1072
987
|
Owner.context = {
|
|
1073
988
|
...Owner.context,
|
|
1074
989
|
[ERROR]: [fn]
|
|
@@ -1097,8 +1012,7 @@ function observable(input) {
|
|
|
1097
1012
|
if (!(observer instanceof Object) || observer == null) {
|
|
1098
1013
|
throw new TypeError("Expected the observer to be an object.");
|
|
1099
1014
|
}
|
|
1100
|
-
const handler =
|
|
1101
|
-
typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1015
|
+
const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1102
1016
|
if (!handler) {
|
|
1103
1017
|
return {
|
|
1104
1018
|
unsubscribe() {}
|
|
@@ -1129,7 +1043,7 @@ function from(producer) {
|
|
|
1129
1043
|
});
|
|
1130
1044
|
if ("subscribe" in producer) {
|
|
1131
1045
|
const unsub = producer.subscribe(v => set(() => v));
|
|
1132
|
-
onCleanup(() =>
|
|
1046
|
+
onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
1133
1047
|
} else {
|
|
1134
1048
|
const clean = producer(set);
|
|
1135
1049
|
onCleanup(clean);
|
|
@@ -1181,7 +1095,8 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1181
1095
|
});
|
|
1182
1096
|
len = 1;
|
|
1183
1097
|
}
|
|
1184
|
-
}
|
|
1098
|
+
}
|
|
1099
|
+
else if (len === 0) {
|
|
1185
1100
|
mapped = new Array(newLen);
|
|
1186
1101
|
for (j = 0; j < newLen; j++) {
|
|
1187
1102
|
items[j] = newItems[j];
|
|
@@ -1192,16 +1107,8 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1192
1107
|
temp = new Array(newLen);
|
|
1193
1108
|
tempdisposers = new Array(newLen);
|
|
1194
1109
|
indexes && (tempIndexes = new Array(newLen));
|
|
1195
|
-
for (
|
|
1196
|
-
|
|
1197
|
-
start < end && items[start] === newItems[start];
|
|
1198
|
-
start++
|
|
1199
|
-
);
|
|
1200
|
-
for (
|
|
1201
|
-
end = len - 1, newEnd = newLen - 1;
|
|
1202
|
-
end >= start && newEnd >= start && items[end] === newItems[newEnd];
|
|
1203
|
-
end--, newEnd--
|
|
1204
|
-
) {
|
|
1110
|
+
for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);
|
|
1111
|
+
for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
|
|
1205
1112
|
temp[newEnd] = mapped[end];
|
|
1206
1113
|
tempdisposers[newEnd] = disposers[end];
|
|
1207
1114
|
indexes && (tempIndexes[newEnd] = indexes[end]);
|
|
@@ -1235,7 +1142,7 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1235
1142
|
}
|
|
1236
1143
|
} else mapped[j] = createRoot(mapper);
|
|
1237
1144
|
}
|
|
1238
|
-
mapped = mapped.slice(0,
|
|
1145
|
+
mapped = mapped.slice(0, len = newLen);
|
|
1239
1146
|
items = newItems.slice(0);
|
|
1240
1147
|
}
|
|
1241
1148
|
return mapped;
|
|
@@ -1301,7 +1208,7 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1301
1208
|
}
|
|
1302
1209
|
len = signals.length = disposers.length = newItems.length;
|
|
1303
1210
|
items = newItems.slice(0);
|
|
1304
|
-
return
|
|
1211
|
+
return mapped = mapped.slice(0, len);
|
|
1305
1212
|
});
|
|
1306
1213
|
function mapper(disposer) {
|
|
1307
1214
|
disposers[i] = disposer;
|
|
@@ -1370,33 +1277,29 @@ function mergeProps(...sources) {
|
|
|
1370
1277
|
let proxy = false;
|
|
1371
1278
|
for (let i = 0; i < sources.length; i++) {
|
|
1372
1279
|
const s = sources[i];
|
|
1373
|
-
proxy = proxy ||
|
|
1374
|
-
sources[i] = typeof s === "function" ? (
|
|
1280
|
+
proxy = proxy || !!s && $PROXY in s;
|
|
1281
|
+
sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
|
|
1375
1282
|
}
|
|
1376
1283
|
if (proxy) {
|
|
1377
|
-
return new Proxy(
|
|
1378
|
-
{
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
if (v !== undefined) return v;
|
|
1383
|
-
}
|
|
1384
|
-
},
|
|
1385
|
-
has(property) {
|
|
1386
|
-
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1387
|
-
if (property in resolveSource(sources[i])) return true;
|
|
1388
|
-
}
|
|
1389
|
-
return false;
|
|
1390
|
-
},
|
|
1391
|
-
keys() {
|
|
1392
|
-
const keys = [];
|
|
1393
|
-
for (let i = 0; i < sources.length; i++)
|
|
1394
|
-
keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1395
|
-
return [...new Set(keys)];
|
|
1284
|
+
return new Proxy({
|
|
1285
|
+
get(property) {
|
|
1286
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1287
|
+
const v = resolveSource(sources[i])[property];
|
|
1288
|
+
if (v !== undefined) return v;
|
|
1396
1289
|
}
|
|
1397
1290
|
},
|
|
1398
|
-
|
|
1399
|
-
|
|
1291
|
+
has(property) {
|
|
1292
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1293
|
+
if (property in resolveSource(sources[i])) return true;
|
|
1294
|
+
}
|
|
1295
|
+
return false;
|
|
1296
|
+
},
|
|
1297
|
+
keys() {
|
|
1298
|
+
const keys = [];
|
|
1299
|
+
for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1300
|
+
return [...new Set(keys)];
|
|
1301
|
+
}
|
|
1302
|
+
}, propTraps);
|
|
1400
1303
|
}
|
|
1401
1304
|
const sourcesMap = {};
|
|
1402
1305
|
const defined = Object.create(null);
|
|
@@ -1409,20 +1312,15 @@ function mergeProps(...sources) {
|
|
|
1409
1312
|
if (key === "__proto__" || key === "constructor") continue;
|
|
1410
1313
|
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
1411
1314
|
if (!defined[key]) {
|
|
1412
|
-
defined[key] = desc.get
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
}
|
|
1418
|
-
: desc.value !== undefined
|
|
1419
|
-
? desc
|
|
1420
|
-
: undefined;
|
|
1315
|
+
defined[key] = desc.get ? {
|
|
1316
|
+
enumerable: true,
|
|
1317
|
+
configurable: true,
|
|
1318
|
+
get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
|
|
1319
|
+
} : desc.value !== undefined ? desc : undefined;
|
|
1421
1320
|
} else {
|
|
1422
1321
|
const sources = sourcesMap[key];
|
|
1423
1322
|
if (sources) {
|
|
1424
|
-
if (desc.get) sources.push(desc.get.bind(source));
|
|
1425
|
-
else if (desc.value !== undefined) sources.push(() => desc.value);
|
|
1323
|
+
if (desc.get) sources.push(desc.get.bind(source));else if (desc.value !== undefined) sources.push(() => desc.value);
|
|
1426
1324
|
}
|
|
1427
1325
|
}
|
|
1428
1326
|
}
|
|
@@ -1432,8 +1330,7 @@ function mergeProps(...sources) {
|
|
|
1432
1330
|
for (let i = definedKeys.length - 1; i >= 0; i--) {
|
|
1433
1331
|
const key = definedKeys[i],
|
|
1434
1332
|
desc = defined[key];
|
|
1435
|
-
if (desc && desc.get) Object.defineProperty(target, key, desc);
|
|
1436
|
-
else target[key] = desc ? desc.value : undefined;
|
|
1333
|
+
if (desc && desc.get) Object.defineProperty(target, key, desc);else target[key] = desc ? desc.value : undefined;
|
|
1437
1334
|
}
|
|
1438
1335
|
return target;
|
|
1439
1336
|
}
|
|
@@ -1441,60 +1338,47 @@ function splitProps(props, ...keys) {
|
|
|
1441
1338
|
if ($PROXY in props) {
|
|
1442
1339
|
const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
|
|
1443
1340
|
const res = keys.map(k => {
|
|
1444
|
-
return new Proxy(
|
|
1445
|
-
{
|
|
1446
|
-
|
|
1447
|
-
return k.includes(property) ? props[property] : undefined;
|
|
1448
|
-
},
|
|
1449
|
-
has(property) {
|
|
1450
|
-
return k.includes(property) && property in props;
|
|
1451
|
-
},
|
|
1452
|
-
keys() {
|
|
1453
|
-
return k.filter(property => property in props);
|
|
1454
|
-
}
|
|
1341
|
+
return new Proxy({
|
|
1342
|
+
get(property) {
|
|
1343
|
+
return k.includes(property) ? props[property] : undefined;
|
|
1455
1344
|
},
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
});
|
|
1459
|
-
res.push(
|
|
1460
|
-
new Proxy(
|
|
1461
|
-
{
|
|
1462
|
-
get(property) {
|
|
1463
|
-
return blocked.has(property) ? undefined : props[property];
|
|
1464
|
-
},
|
|
1465
|
-
has(property) {
|
|
1466
|
-
return blocked.has(property) ? false : property in props;
|
|
1467
|
-
},
|
|
1468
|
-
keys() {
|
|
1469
|
-
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1470
|
-
}
|
|
1345
|
+
has(property) {
|
|
1346
|
+
return k.includes(property) && property in props;
|
|
1471
1347
|
},
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1348
|
+
keys() {
|
|
1349
|
+
return k.filter(property => property in props);
|
|
1350
|
+
}
|
|
1351
|
+
}, propTraps);
|
|
1352
|
+
});
|
|
1353
|
+
res.push(new Proxy({
|
|
1354
|
+
get(property) {
|
|
1355
|
+
return blocked.has(property) ? undefined : props[property];
|
|
1356
|
+
},
|
|
1357
|
+
has(property) {
|
|
1358
|
+
return blocked.has(property) ? false : property in props;
|
|
1359
|
+
},
|
|
1360
|
+
keys() {
|
|
1361
|
+
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1362
|
+
}
|
|
1363
|
+
}, propTraps));
|
|
1475
1364
|
return res;
|
|
1476
1365
|
}
|
|
1477
1366
|
const otherObject = {};
|
|
1478
1367
|
const objects = keys.map(() => ({}));
|
|
1479
1368
|
for (const propName of Object.getOwnPropertyNames(props)) {
|
|
1480
1369
|
const desc = Object.getOwnPropertyDescriptor(props, propName);
|
|
1481
|
-
const isDefaultDesc =
|
|
1482
|
-
!desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1370
|
+
const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1483
1371
|
let blocked = false;
|
|
1484
1372
|
let objectIndex = 0;
|
|
1485
1373
|
for (const k of keys) {
|
|
1486
1374
|
if (k.includes(propName)) {
|
|
1487
1375
|
blocked = true;
|
|
1488
|
-
isDefaultDesc
|
|
1489
|
-
? (objects[objectIndex][propName] = desc.value)
|
|
1490
|
-
: Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1376
|
+
isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1491
1377
|
}
|
|
1492
1378
|
++objectIndex;
|
|
1493
1379
|
}
|
|
1494
1380
|
if (!blocked) {
|
|
1495
|
-
isDefaultDesc
|
|
1496
|
-
? (otherObject[propName] = desc.value)
|
|
1497
|
-
: Object.defineProperty(otherObject, propName, desc);
|
|
1381
|
+
isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
|
|
1498
1382
|
}
|
|
1499
1383
|
}
|
|
1500
1384
|
return [...objects, otherObject];
|
|
@@ -1520,21 +1404,17 @@ function lazy(fn) {
|
|
|
1520
1404
|
comp = s;
|
|
1521
1405
|
}
|
|
1522
1406
|
let Comp;
|
|
1523
|
-
return createMemo(
|
|
1524
|
-
()
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
setHydrateContext(c);
|
|
1533
|
-
return r;
|
|
1534
|
-
})
|
|
1535
|
-
);
|
|
1407
|
+
return createMemo(() => (Comp = comp()) && untrack(() => {
|
|
1408
|
+
if (false) ;
|
|
1409
|
+
if (!ctx) return Comp(props);
|
|
1410
|
+
const c = sharedConfig.context;
|
|
1411
|
+
setHydrateContext(ctx);
|
|
1412
|
+
const r = Comp(props);
|
|
1413
|
+
setHydrateContext(c);
|
|
1414
|
+
return r;
|
|
1415
|
+
}));
|
|
1536
1416
|
};
|
|
1537
|
-
wrap.preload = () => p || ((p = fn()).then(mod =>
|
|
1417
|
+
wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
|
|
1538
1418
|
return wrap;
|
|
1539
1419
|
}
|
|
1540
1420
|
let counter = 0;
|
|
@@ -1559,77 +1439,49 @@ function Index(props) {
|
|
|
1559
1439
|
function Show(props) {
|
|
1560
1440
|
const keyed = props.keyed;
|
|
1561
1441
|
const condition = createMemo(() => props.when, undefined, {
|
|
1562
|
-
equals: (a, b) =>
|
|
1442
|
+
equals: (a, b) => keyed ? a === b : !a === !b
|
|
1563
1443
|
});
|
|
1564
|
-
return createMemo(
|
|
1565
|
-
()
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
if (!untrack(condition)) throw narrowedError("Show");
|
|
1577
|
-
return props.when;
|
|
1578
|
-
}
|
|
1579
|
-
)
|
|
1580
|
-
)
|
|
1581
|
-
: child;
|
|
1582
|
-
}
|
|
1583
|
-
return props.fallback;
|
|
1584
|
-
},
|
|
1585
|
-
undefined,
|
|
1586
|
-
undefined
|
|
1587
|
-
);
|
|
1444
|
+
return createMemo(() => {
|
|
1445
|
+
const c = condition();
|
|
1446
|
+
if (c) {
|
|
1447
|
+
const child = props.children;
|
|
1448
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1449
|
+
return fn ? untrack(() => child(keyed ? c : () => {
|
|
1450
|
+
if (!untrack(condition)) throw narrowedError("Show");
|
|
1451
|
+
return props.when;
|
|
1452
|
+
})) : child;
|
|
1453
|
+
}
|
|
1454
|
+
return props.fallback;
|
|
1455
|
+
}, undefined, undefined);
|
|
1588
1456
|
}
|
|
1589
1457
|
function Switch(props) {
|
|
1590
1458
|
let keyed = false;
|
|
1591
1459
|
const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1592
1460
|
const conditions = children(() => props.children),
|
|
1593
|
-
evalConditions = createMemo(
|
|
1594
|
-
()
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
return [i, c, conds[i]];
|
|
1602
|
-
}
|
|
1461
|
+
evalConditions = createMemo(() => {
|
|
1462
|
+
let conds = conditions();
|
|
1463
|
+
if (!Array.isArray(conds)) conds = [conds];
|
|
1464
|
+
for (let i = 0; i < conds.length; i++) {
|
|
1465
|
+
const c = conds[i].when;
|
|
1466
|
+
if (c) {
|
|
1467
|
+
keyed = !!conds[i].keyed;
|
|
1468
|
+
return [i, c, conds[i]];
|
|
1603
1469
|
}
|
|
1604
|
-
return [-1];
|
|
1605
|
-
},
|
|
1606
|
-
undefined,
|
|
1607
|
-
{
|
|
1608
|
-
equals
|
|
1609
1470
|
}
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
return cond.when;
|
|
1625
|
-
}
|
|
1626
|
-
)
|
|
1627
|
-
)
|
|
1628
|
-
: c;
|
|
1629
|
-
},
|
|
1630
|
-
undefined,
|
|
1631
|
-
undefined
|
|
1632
|
-
);
|
|
1471
|
+
return [-1];
|
|
1472
|
+
}, undefined, {
|
|
1473
|
+
equals
|
|
1474
|
+
});
|
|
1475
|
+
return createMemo(() => {
|
|
1476
|
+
const [index, when, cond] = evalConditions();
|
|
1477
|
+
if (index < 0) return props.fallback;
|
|
1478
|
+
const c = cond.children;
|
|
1479
|
+
const fn = typeof c === "function" && c.length > 0;
|
|
1480
|
+
return fn ? untrack(() => c(keyed ? when : () => {
|
|
1481
|
+
if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
|
|
1482
|
+
return cond.when;
|
|
1483
|
+
})) : c;
|
|
1484
|
+
}, undefined, undefined);
|
|
1633
1485
|
}
|
|
1634
1486
|
function Match(props) {
|
|
1635
1487
|
return props;
|
|
@@ -1640,28 +1492,22 @@ function resetErrorBoundaries() {
|
|
|
1640
1492
|
}
|
|
1641
1493
|
function ErrorBoundary(props) {
|
|
1642
1494
|
let err;
|
|
1643
|
-
if (sharedConfig.context && sharedConfig.load)
|
|
1644
|
-
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1495
|
+
if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1645
1496
|
const [errored, setErrored] = createSignal(err, undefined);
|
|
1646
1497
|
Errors || (Errors = new Set());
|
|
1647
1498
|
Errors.add(setErrored);
|
|
1648
1499
|
onCleanup(() => Errors.delete(setErrored));
|
|
1649
|
-
return createMemo(
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
},
|
|
1658
|
-
undefined,
|
|
1659
|
-
undefined
|
|
1660
|
-
);
|
|
1500
|
+
return createMemo(() => {
|
|
1501
|
+
let e;
|
|
1502
|
+
if (e = errored()) {
|
|
1503
|
+
const f = props.fallback;
|
|
1504
|
+
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
|
|
1505
|
+
}
|
|
1506
|
+
return catchError(() => props.children, setErrored);
|
|
1507
|
+
}, undefined, undefined);
|
|
1661
1508
|
}
|
|
1662
1509
|
|
|
1663
|
-
const suspenseListEquals = (a, b) =>
|
|
1664
|
-
a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1510
|
+
const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1665
1511
|
const SuspenseListContext = createContext();
|
|
1666
1512
|
function SuspenseList(props) {
|
|
1667
1513
|
let [wrapper, setWrapper] = createSignal(() => ({
|
|
@@ -1673,51 +1519,51 @@ function SuspenseList(props) {
|
|
|
1673
1519
|
if (listContext) {
|
|
1674
1520
|
show = listContext.register(createMemo(() => wrapper()().inFallback));
|
|
1675
1521
|
}
|
|
1676
|
-
const resolved = createMemo(
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1522
|
+
const resolved = createMemo(prev => {
|
|
1523
|
+
const reveal = props.revealOrder,
|
|
1524
|
+
tail = props.tail,
|
|
1525
|
+
{
|
|
1526
|
+
showContent = true,
|
|
1527
|
+
showFallback = true
|
|
1528
|
+
} = show ? show() : {},
|
|
1529
|
+
reg = registry(),
|
|
1530
|
+
reverse = reveal === "backwards";
|
|
1531
|
+
if (reveal === "together") {
|
|
1532
|
+
const all = reg.every(inFallback => !inFallback());
|
|
1533
|
+
const res = reg.map(() => ({
|
|
1534
|
+
showContent: all && showContent,
|
|
1535
|
+
showFallback
|
|
1536
|
+
}));
|
|
1537
|
+
res.inFallback = !all;
|
|
1538
|
+
return res;
|
|
1539
|
+
}
|
|
1540
|
+
let stop = false;
|
|
1541
|
+
let inFallback = prev.inFallback;
|
|
1542
|
+
const res = [];
|
|
1543
|
+
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1544
|
+
const n = reverse ? len - i - 1 : i,
|
|
1545
|
+
s = reg[n]();
|
|
1546
|
+
if (!stop && !s) {
|
|
1547
|
+
res[n] = {
|
|
1548
|
+
showContent,
|
|
1687
1549
|
showFallback
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
s = reg[n]();
|
|
1698
|
-
if (!stop && !s) {
|
|
1699
|
-
res[n] = {
|
|
1700
|
-
showContent,
|
|
1701
|
-
showFallback
|
|
1702
|
-
};
|
|
1703
|
-
} else {
|
|
1704
|
-
const next = !stop;
|
|
1705
|
-
if (next) inFallback = true;
|
|
1706
|
-
res[n] = {
|
|
1707
|
-
showContent: next,
|
|
1708
|
-
showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
|
|
1709
|
-
};
|
|
1710
|
-
stop = true;
|
|
1711
|
-
}
|
|
1550
|
+
};
|
|
1551
|
+
} else {
|
|
1552
|
+
const next = !stop;
|
|
1553
|
+
if (next) inFallback = true;
|
|
1554
|
+
res[n] = {
|
|
1555
|
+
showContent: next,
|
|
1556
|
+
showFallback: !tail || next && tail === "collapsed" ? showFallback : false
|
|
1557
|
+
};
|
|
1558
|
+
stop = true;
|
|
1712
1559
|
}
|
|
1713
|
-
if (!stop) inFallback = false;
|
|
1714
|
-
res.inFallback = inFallback;
|
|
1715
|
-
return res;
|
|
1716
|
-
},
|
|
1717
|
-
{
|
|
1718
|
-
inFallback: false
|
|
1719
1560
|
}
|
|
1720
|
-
|
|
1561
|
+
if (!stop) inFallback = false;
|
|
1562
|
+
res.inFallback = inFallback;
|
|
1563
|
+
return res;
|
|
1564
|
+
}, {
|
|
1565
|
+
inFallback: false
|
|
1566
|
+
});
|
|
1721
1567
|
setWrapper(() => resolved);
|
|
1722
1568
|
return createComponent(SuspenseListContext.Provider, {
|
|
1723
1569
|
value: {
|
|
@@ -1792,14 +1638,17 @@ function Suspense(props) {
|
|
|
1792
1638
|
ctx = sharedConfig.context;
|
|
1793
1639
|
if (flicker) {
|
|
1794
1640
|
flicker();
|
|
1795
|
-
return
|
|
1641
|
+
return flicker = undefined;
|
|
1796
1642
|
}
|
|
1797
1643
|
if (ctx && p === "$$f") setHydrateContext();
|
|
1798
1644
|
const rendered = createMemo(() => props.children);
|
|
1799
1645
|
return createMemo(prev => {
|
|
1800
1646
|
const inFallback = store.inFallback(),
|
|
1801
|
-
{
|
|
1802
|
-
|
|
1647
|
+
{
|
|
1648
|
+
showContent = true,
|
|
1649
|
+
showFallback = true
|
|
1650
|
+
} = show ? show() : {};
|
|
1651
|
+
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1803
1652
|
store.resolved = true;
|
|
1804
1653
|
dispose && dispose();
|
|
1805
1654
|
dispose = ctx = p = undefined;
|
|
@@ -1827,59 +1676,4 @@ function Suspense(props) {
|
|
|
1827
1676
|
|
|
1828
1677
|
const DEV = undefined;
|
|
1829
1678
|
|
|
1830
|
-
export {
|
|
1831
|
-
$DEVCOMP,
|
|
1832
|
-
$PROXY,
|
|
1833
|
-
$TRACK,
|
|
1834
|
-
DEV,
|
|
1835
|
-
ErrorBoundary,
|
|
1836
|
-
For,
|
|
1837
|
-
Index,
|
|
1838
|
-
Match,
|
|
1839
|
-
Show,
|
|
1840
|
-
Suspense,
|
|
1841
|
-
SuspenseList,
|
|
1842
|
-
Switch,
|
|
1843
|
-
batch,
|
|
1844
|
-
cancelCallback,
|
|
1845
|
-
catchError,
|
|
1846
|
-
children,
|
|
1847
|
-
createComponent,
|
|
1848
|
-
createComputed,
|
|
1849
|
-
createContext,
|
|
1850
|
-
createDeferred,
|
|
1851
|
-
createEffect,
|
|
1852
|
-
createMemo,
|
|
1853
|
-
createReaction,
|
|
1854
|
-
createRenderEffect,
|
|
1855
|
-
createResource,
|
|
1856
|
-
createRoot,
|
|
1857
|
-
createSelector,
|
|
1858
|
-
createSignal,
|
|
1859
|
-
createUniqueId,
|
|
1860
|
-
enableExternalSource,
|
|
1861
|
-
enableHydration,
|
|
1862
|
-
enableScheduling,
|
|
1863
|
-
equalFn,
|
|
1864
|
-
from,
|
|
1865
|
-
getListener,
|
|
1866
|
-
getOwner,
|
|
1867
|
-
indexArray,
|
|
1868
|
-
lazy,
|
|
1869
|
-
mapArray,
|
|
1870
|
-
mergeProps,
|
|
1871
|
-
observable,
|
|
1872
|
-
on,
|
|
1873
|
-
onCleanup,
|
|
1874
|
-
onError,
|
|
1875
|
-
onMount,
|
|
1876
|
-
requestCallback,
|
|
1877
|
-
resetErrorBoundaries,
|
|
1878
|
-
runWithOwner,
|
|
1879
|
-
sharedConfig,
|
|
1880
|
-
splitProps,
|
|
1881
|
-
startTransition,
|
|
1882
|
-
untrack,
|
|
1883
|
-
useContext,
|
|
1884
|
-
useTransition
|
|
1885
|
-
};
|
|
1679
|
+
export { $DEVCOMP, $PROXY, $TRACK, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, catchError, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, resetErrorBoundaries, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|