solid-js 1.8.1 → 1.8.2
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 +5 -1
- package/dist/dev.js +301 -532
- package/dist/server.cjs +18 -4
- package/dist/server.js +89 -170
- package/dist/solid.cjs +5 -1
- package/dist/solid.js +259 -459
- 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 +31 -45
- package/package.json +2 -2
- package/store/dist/dev.js +42 -114
- package/store/dist/server.js +8 -19
- package/store/dist/store.js +39 -105
- 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 +9 -72
- 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 +140 -228
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +31 -62
- package/types/render/flow.d.ts +31 -43
- package/types/render/hydration.d.ts +14 -14
- package/types/server/index.d.ts +2 -56
- package/types/server/reactive.d.ts +44 -68
- package/types/server/rendering.d.ts +95 -166
- 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 +81 -617
- package/web/dist/server.cjs +1 -1
- package/web/dist/server.js +93 -176
- package/web/dist/web.js +80 -611
- 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
|
}
|
|
@@ -157,20 +155,18 @@ let Listener = null;
|
|
|
157
155
|
let Updates = null;
|
|
158
156
|
let Effects = null;
|
|
159
157
|
let ExecCount = 0;
|
|
160
|
-
const [transPending, setTransPending] = /*@__PURE__*/
|
|
158
|
+
const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
|
|
161
159
|
function createRoot(fn, detachedOwner) {
|
|
162
160
|
const listener = Listener,
|
|
163
161
|
owner = Owner,
|
|
164
162
|
unowned = fn.length === 0,
|
|
165
163
|
current = detachedOwner === undefined ? owner : detachedOwner,
|
|
166
|
-
root = unowned
|
|
167
|
-
|
|
168
|
-
:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
owner: current
|
|
173
|
-
},
|
|
164
|
+
root = unowned ? UNOWNED : {
|
|
165
|
+
owned: null,
|
|
166
|
+
cleanups: null,
|
|
167
|
+
context: current ? current.context : null,
|
|
168
|
+
owner: current
|
|
169
|
+
},
|
|
174
170
|
updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
175
171
|
Owner = root;
|
|
176
172
|
Listener = null;
|
|
@@ -191,8 +187,7 @@ function createSignal(value, options) {
|
|
|
191
187
|
};
|
|
192
188
|
const setter = value => {
|
|
193
189
|
if (typeof value === "function") {
|
|
194
|
-
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
|
|
195
|
-
else value = value(s.value);
|
|
190
|
+
if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
|
|
196
191
|
}
|
|
197
192
|
return writeSignal(s, value);
|
|
198
193
|
};
|
|
@@ -200,13 +195,11 @@ function createSignal(value, options) {
|
|
|
200
195
|
}
|
|
201
196
|
function createComputed(fn, value, options) {
|
|
202
197
|
const c = createComputation(fn, value, true, STALE);
|
|
203
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
204
|
-
else updateComputation(c);
|
|
198
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
205
199
|
}
|
|
206
200
|
function createRenderEffect(fn, value, options) {
|
|
207
201
|
const c = createComputation(fn, value, false, STALE);
|
|
208
|
-
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
209
|
-
else updateComputation(c);
|
|
202
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
|
|
210
203
|
}
|
|
211
204
|
function createEffect(fn, value, options) {
|
|
212
205
|
runEffects = runUserEffects;
|
|
@@ -218,15 +211,10 @@ function createEffect(fn, value, options) {
|
|
|
218
211
|
}
|
|
219
212
|
function createReaction(onInvalidate, options) {
|
|
220
213
|
let fn;
|
|
221
|
-
const c = createComputation(
|
|
222
|
-
()
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
},
|
|
226
|
-
undefined,
|
|
227
|
-
false,
|
|
228
|
-
0
|
|
229
|
-
),
|
|
214
|
+
const c = createComputation(() => {
|
|
215
|
+
fn ? fn() : untrack(onInvalidate);
|
|
216
|
+
fn = undefined;
|
|
217
|
+
}, undefined, false, 0),
|
|
230
218
|
s = SuspenseContext && useContext(SuspenseContext);
|
|
231
219
|
if (s) c.suspense = s;
|
|
232
220
|
c.user = true;
|
|
@@ -254,7 +242,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
254
242
|
let source;
|
|
255
243
|
let fetcher;
|
|
256
244
|
let options;
|
|
257
|
-
if (
|
|
245
|
+
if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
|
|
258
246
|
source = true;
|
|
259
247
|
fetcher = pSource;
|
|
260
248
|
options = pFetcher || {};
|
|
@@ -268,7 +256,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
268
256
|
id = null,
|
|
269
257
|
loadedUnderTransition = false,
|
|
270
258
|
scheduled = false,
|
|
271
|
-
resolved = "initialValue" in options,
|
|
259
|
+
resolved = ("initialValue" in options),
|
|
272
260
|
dynamic = typeof source === "function" && createMemo(source);
|
|
273
261
|
const contexts = new Set(),
|
|
274
262
|
[value, setValue] = (options.storage || createSignal)(options.initialValue),
|
|
@@ -280,20 +268,15 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
280
268
|
if (sharedConfig.context) {
|
|
281
269
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
282
270
|
let v;
|
|
283
|
-
if (options.ssrLoadFrom === "initial") initP = options.initialValue;
|
|
284
|
-
else if (sharedConfig.load && (v = sharedConfig.load(id)))
|
|
285
|
-
initP = isPromise(v) && "value" in v ? v.value : v;
|
|
271
|
+
if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
|
|
286
272
|
}
|
|
287
273
|
function loadEnd(p, v, error, key) {
|
|
288
274
|
if (pr === p) {
|
|
289
275
|
pr = null;
|
|
290
276
|
key !== undefined && (resolved = true);
|
|
291
|
-
if ((p === initP || v === initP) && options.onHydrated)
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
value: v
|
|
295
|
-
})
|
|
296
|
-
);
|
|
277
|
+
if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
|
|
278
|
+
value: v
|
|
279
|
+
}));
|
|
297
280
|
initP = NO_INIT;
|
|
298
281
|
if (Transition && p && loadedUnderTransition) {
|
|
299
282
|
Transition.promises.delete(p);
|
|
@@ -324,8 +307,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
324
307
|
createComputed(() => {
|
|
325
308
|
track();
|
|
326
309
|
if (pr) {
|
|
327
|
-
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
|
|
328
|
-
else if (!contexts.has(c)) {
|
|
310
|
+
if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) {
|
|
329
311
|
c.increment();
|
|
330
312
|
contexts.add(c);
|
|
331
313
|
}
|
|
@@ -344,30 +326,26 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
344
326
|
return;
|
|
345
327
|
}
|
|
346
328
|
if (Transition && pr) Transition.promises.delete(pr);
|
|
347
|
-
const p =
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
fetcher(lookup, {
|
|
352
|
-
value: value(),
|
|
353
|
-
refetching
|
|
354
|
-
})
|
|
355
|
-
);
|
|
329
|
+
const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {
|
|
330
|
+
value: value(),
|
|
331
|
+
refetching
|
|
332
|
+
}));
|
|
356
333
|
if (!isPromise(p)) {
|
|
357
334
|
loadEnd(pr, p, undefined, lookup);
|
|
358
335
|
return p;
|
|
359
336
|
}
|
|
337
|
+
if ("value" in p) {
|
|
338
|
+
if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);else loadEnd(pr, undefined, undefined, lookup);
|
|
339
|
+
return p;
|
|
340
|
+
}
|
|
360
341
|
pr = p;
|
|
361
342
|
scheduled = true;
|
|
362
|
-
queueMicrotask(() =>
|
|
343
|
+
queueMicrotask(() => scheduled = false);
|
|
363
344
|
runUpdates(() => {
|
|
364
345
|
setState(resolved ? "refreshing" : "pending");
|
|
365
346
|
trigger();
|
|
366
347
|
}, false);
|
|
367
|
-
return p.then(
|
|
368
|
-
v => loadEnd(p, v, undefined, lookup),
|
|
369
|
-
e => loadEnd(p, undefined, castError(e), lookup)
|
|
370
|
-
);
|
|
348
|
+
return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));
|
|
371
349
|
}
|
|
372
350
|
Object.defineProperties(read, {
|
|
373
351
|
state: {
|
|
@@ -391,80 +369,50 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
391
369
|
}
|
|
392
370
|
}
|
|
393
371
|
});
|
|
394
|
-
if (dynamic) createComputed(() => load(false));
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
refetch: load,
|
|
400
|
-
mutate: setValue
|
|
401
|
-
}
|
|
402
|
-
];
|
|
372
|
+
if (dynamic) createComputed(() => load(false));else load(false);
|
|
373
|
+
return [read, {
|
|
374
|
+
refetch: load,
|
|
375
|
+
mutate: setValue
|
|
376
|
+
}];
|
|
403
377
|
}
|
|
404
378
|
function createDeferred(source, options) {
|
|
405
379
|
let t,
|
|
406
380
|
timeout = options ? options.timeoutMs : undefined;
|
|
407
|
-
const node = createComputation(
|
|
408
|
-
() => {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
timeout
|
|
415
|
-
}
|
|
416
|
-
: undefined
|
|
417
|
-
);
|
|
418
|
-
return source();
|
|
419
|
-
},
|
|
420
|
-
undefined,
|
|
421
|
-
true
|
|
422
|
-
);
|
|
423
|
-
const [deferred, setDeferred] = createSignal(
|
|
424
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
425
|
-
options
|
|
426
|
-
);
|
|
381
|
+
const node = createComputation(() => {
|
|
382
|
+
if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
|
|
383
|
+
timeout
|
|
384
|
+
} : undefined);
|
|
385
|
+
return source();
|
|
386
|
+
}, undefined, true);
|
|
387
|
+
const [deferred, setDeferred] = createSignal(Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, options);
|
|
427
388
|
updateComputation(node);
|
|
428
|
-
setDeferred(() =>
|
|
429
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
430
|
-
);
|
|
389
|
+
setDeferred(() => Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
431
390
|
return deferred;
|
|
432
391
|
}
|
|
433
392
|
function createSelector(source, fn = equalFn, options) {
|
|
434
393
|
const subs = new Map();
|
|
435
|
-
const node = createComputation(
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
for (const
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}
|
|
446
|
-
return v;
|
|
447
|
-
},
|
|
448
|
-
undefined,
|
|
449
|
-
true,
|
|
450
|
-
STALE
|
|
451
|
-
);
|
|
394
|
+
const node = createComputation(p => {
|
|
395
|
+
const v = source();
|
|
396
|
+
for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
|
|
397
|
+
for (const c of val.values()) {
|
|
398
|
+
c.state = STALE;
|
|
399
|
+
if (c.pure) Updates.push(c);else Effects.push(c);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return v;
|
|
403
|
+
}, undefined, true, STALE);
|
|
452
404
|
updateComputation(node);
|
|
453
405
|
return key => {
|
|
454
406
|
const listener = Listener;
|
|
455
407
|
if (listener) {
|
|
456
408
|
let l;
|
|
457
|
-
if (
|
|
458
|
-
else subs.set(key, (l = new Set([listener])));
|
|
409
|
+
if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
|
|
459
410
|
onCleanup(() => {
|
|
460
411
|
l.delete(listener);
|
|
461
412
|
!l.size && subs.delete(key);
|
|
462
413
|
});
|
|
463
414
|
}
|
|
464
|
-
return fn(
|
|
465
|
-
key,
|
|
466
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
|
|
467
|
-
);
|
|
415
|
+
return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
|
|
468
416
|
};
|
|
469
417
|
}
|
|
470
418
|
function batch(fn) {
|
|
@@ -503,9 +451,7 @@ function onMount(fn) {
|
|
|
503
451
|
createEffect(() => untrack(fn));
|
|
504
452
|
}
|
|
505
453
|
function onCleanup(fn) {
|
|
506
|
-
if (Owner === null);
|
|
507
|
-
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
508
|
-
else Owner.cleanups.push(fn);
|
|
454
|
+
if (Owner === null) ;else if (Owner.cleanups === null) Owner.cleanups = [fn];else Owner.cleanups.push(fn);
|
|
509
455
|
return fn;
|
|
510
456
|
}
|
|
511
457
|
function catchError(fn, handler) {
|
|
@@ -559,17 +505,15 @@ function startTransition(fn) {
|
|
|
559
505
|
Owner = o;
|
|
560
506
|
let t;
|
|
561
507
|
if (Scheduler || SuspenseContext) {
|
|
562
|
-
t =
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
});
|
|
572
|
-
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));
|
|
573
517
|
t.running = true;
|
|
574
518
|
}
|
|
575
519
|
runUpdates(fn, false);
|
|
@@ -593,9 +537,7 @@ function createContext(defaultValue, options) {
|
|
|
593
537
|
};
|
|
594
538
|
}
|
|
595
539
|
function useContext(context) {
|
|
596
|
-
return Owner && Owner.context && Owner.context[context.id] !== undefined
|
|
597
|
-
? Owner.context[context.id]
|
|
598
|
-
: context.defaultValue;
|
|
540
|
+
return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;
|
|
599
541
|
}
|
|
600
542
|
function children(fn) {
|
|
601
543
|
const children = createMemo(fn);
|
|
@@ -631,8 +573,7 @@ function enableExternalSource(factory) {
|
|
|
631
573
|
function readSignal() {
|
|
632
574
|
const runningTransition = Transition && Transition.running;
|
|
633
575
|
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
634
|
-
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
635
|
-
else {
|
|
576
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
|
|
636
577
|
const updates = Updates;
|
|
637
578
|
Updates = null;
|
|
638
579
|
runUpdates(() => lookUpstream(this), false);
|
|
@@ -660,12 +601,11 @@ function readSignal() {
|
|
|
660
601
|
return this.value;
|
|
661
602
|
}
|
|
662
603
|
function writeSignal(node, value, isComp) {
|
|
663
|
-
let current =
|
|
664
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
604
|
+
let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
665
605
|
if (!node.comparator || !node.comparator(current, value)) {
|
|
666
606
|
if (Transition) {
|
|
667
607
|
const TransitionRunning = Transition.running;
|
|
668
|
-
if (TransitionRunning ||
|
|
608
|
+
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
669
609
|
Transition.sources.add(node);
|
|
670
610
|
node.tValue = value;
|
|
671
611
|
}
|
|
@@ -678,16 +618,14 @@ function writeSignal(node, value, isComp) {
|
|
|
678
618
|
const TransitionRunning = Transition && Transition.running;
|
|
679
619
|
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
680
620
|
if (TransitionRunning ? !o.tState : !o.state) {
|
|
681
|
-
if (o.pure) Updates.push(o);
|
|
682
|
-
else Effects.push(o);
|
|
621
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
683
622
|
if (o.observers) markDownstream(o);
|
|
684
623
|
}
|
|
685
|
-
if (!TransitionRunning) o.state = STALE;
|
|
686
|
-
else o.tState = STALE;
|
|
624
|
+
if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
|
|
687
625
|
}
|
|
688
626
|
if (Updates.length > 10e5) {
|
|
689
627
|
Updates = [];
|
|
690
|
-
if (false);
|
|
628
|
+
if (false) ;
|
|
691
629
|
throw new Error();
|
|
692
630
|
}
|
|
693
631
|
}, false);
|
|
@@ -702,11 +640,7 @@ function updateComputation(node) {
|
|
|
702
640
|
listener = Listener,
|
|
703
641
|
time = ExecCount;
|
|
704
642
|
Listener = Owner = node;
|
|
705
|
-
runComputation(
|
|
706
|
-
node,
|
|
707
|
-
Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
|
|
708
|
-
time
|
|
709
|
-
);
|
|
643
|
+
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
710
644
|
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
711
645
|
queueMicrotask(() => {
|
|
712
646
|
runUpdates(() => {
|
|
@@ -767,14 +701,11 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
767
701
|
c.state = 0;
|
|
768
702
|
c.tState = state;
|
|
769
703
|
}
|
|
770
|
-
if (Owner === null);
|
|
771
|
-
else if (Owner !== UNOWNED) {
|
|
704
|
+
if (Owner === null) ;else if (Owner !== UNOWNED) {
|
|
772
705
|
if (Transition && Transition.running && Owner.pure) {
|
|
773
|
-
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
774
|
-
else Owner.tOwned.push(c);
|
|
706
|
+
if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);
|
|
775
707
|
} else {
|
|
776
|
-
if (!Owner.owned) Owner.owned = [c];
|
|
777
|
-
else Owner.owned.push(c);
|
|
708
|
+
if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
|
|
778
709
|
}
|
|
779
710
|
}
|
|
780
711
|
if (ExternalSourceFactory) {
|
|
@@ -825,8 +756,7 @@ function runUpdates(fn, init) {
|
|
|
825
756
|
if (Updates) return fn();
|
|
826
757
|
let wait = false;
|
|
827
758
|
if (!init) Updates = [];
|
|
828
|
-
if (Effects) wait = true;
|
|
829
|
-
else Effects = [];
|
|
759
|
+
if (Effects) wait = true;else Effects = [];
|
|
830
760
|
ExecCount++;
|
|
831
761
|
try {
|
|
832
762
|
const res = fn();
|
|
@@ -840,8 +770,7 @@ function runUpdates(fn, init) {
|
|
|
840
770
|
}
|
|
841
771
|
function completeUpdates(wait) {
|
|
842
772
|
if (Updates) {
|
|
843
|
-
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
844
|
-
else runQueue(Updates);
|
|
773
|
+
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);
|
|
845
774
|
Updates = null;
|
|
846
775
|
}
|
|
847
776
|
if (wait) return;
|
|
@@ -909,8 +838,7 @@ function runUserEffects(queue) {
|
|
|
909
838
|
userLength = 0;
|
|
910
839
|
for (i = 0; i < queue.length; i++) {
|
|
911
840
|
const e = queue[i];
|
|
912
|
-
if (!e.user) runTop(e);
|
|
913
|
-
else queue[userLength++] = e;
|
|
841
|
+
if (!e.user) runTop(e);else queue[userLength++] = e;
|
|
914
842
|
}
|
|
915
843
|
if (sharedConfig.context) {
|
|
916
844
|
if (sharedConfig.count) {
|
|
@@ -928,15 +856,13 @@ function runUserEffects(queue) {
|
|
|
928
856
|
}
|
|
929
857
|
function lookUpstream(node, ignore) {
|
|
930
858
|
const runningTransition = Transition && Transition.running;
|
|
931
|
-
if (runningTransition) node.tState = 0;
|
|
932
|
-
else node.state = 0;
|
|
859
|
+
if (runningTransition) node.tState = 0;else node.state = 0;
|
|
933
860
|
for (let i = 0; i < node.sources.length; i += 1) {
|
|
934
861
|
const source = node.sources[i];
|
|
935
862
|
if (source.sources) {
|
|
936
863
|
const state = runningTransition ? source.tState : source.state;
|
|
937
864
|
if (state === STALE) {
|
|
938
|
-
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
|
|
939
|
-
runTop(source);
|
|
865
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
|
|
940
866
|
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
941
867
|
}
|
|
942
868
|
}
|
|
@@ -946,10 +872,8 @@ function markDownstream(node) {
|
|
|
946
872
|
for (let i = 0; i < node.observers.length; i += 1) {
|
|
947
873
|
const o = node.observers[i];
|
|
948
874
|
if (runningTransition ? !o.tState : !o.state) {
|
|
949
|
-
if (runningTransition) o.tState = PENDING;
|
|
950
|
-
|
|
951
|
-
if (o.pure) Updates.push(o);
|
|
952
|
-
else Effects.push(o);
|
|
875
|
+
if (runningTransition) o.tState = PENDING;else o.state = PENDING;
|
|
876
|
+
if (o.pure) Updates.push(o);else Effects.push(o);
|
|
953
877
|
o.observers && markDownstream(o);
|
|
954
878
|
}
|
|
955
879
|
}
|
|
@@ -986,8 +910,7 @@ function cleanNode(node) {
|
|
|
986
910
|
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
987
911
|
node.cleanups = null;
|
|
988
912
|
}
|
|
989
|
-
if (Transition && Transition.running) node.tState = 0;
|
|
990
|
-
else node.state = 0;
|
|
913
|
+
if (Transition && Transition.running) node.tState = 0;else node.state = 0;
|
|
991
914
|
}
|
|
992
915
|
function reset(node, top) {
|
|
993
916
|
if (!top) {
|
|
@@ -1008,21 +931,19 @@ function runErrors(err, fns, owner) {
|
|
|
1008
931
|
try {
|
|
1009
932
|
for (const f of fns) f(err);
|
|
1010
933
|
} catch (e) {
|
|
1011
|
-
handleError(e,
|
|
934
|
+
handleError(e, owner && owner.owner || null);
|
|
1012
935
|
}
|
|
1013
936
|
}
|
|
1014
937
|
function handleError(err, owner = Owner) {
|
|
1015
938
|
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
1016
939
|
const error = castError(err);
|
|
1017
940
|
if (!fns) throw error;
|
|
1018
|
-
if (Effects)
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
});
|
|
1025
|
-
else runErrors(error, fns, owner);
|
|
941
|
+
if (Effects) Effects.push({
|
|
942
|
+
fn() {
|
|
943
|
+
runErrors(error, fns, owner);
|
|
944
|
+
},
|
|
945
|
+
state: STALE
|
|
946
|
+
});else runErrors(error, fns, owner);
|
|
1026
947
|
}
|
|
1027
948
|
function resolveChildren(children) {
|
|
1028
949
|
if (typeof children === "function" && !children.length) return resolveChildren(children());
|
|
@@ -1039,24 +960,19 @@ function resolveChildren(children) {
|
|
|
1039
960
|
function createProvider(id, options) {
|
|
1040
961
|
return function provider(props) {
|
|
1041
962
|
let res;
|
|
1042
|
-
createRenderEffect(
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
return children(() => props.children);
|
|
1050
|
-
})),
|
|
1051
|
-
undefined
|
|
1052
|
-
);
|
|
963
|
+
createRenderEffect(() => res = untrack(() => {
|
|
964
|
+
Owner.context = {
|
|
965
|
+
...Owner.context,
|
|
966
|
+
[id]: props.value
|
|
967
|
+
};
|
|
968
|
+
return children(() => props.children);
|
|
969
|
+
}), undefined);
|
|
1053
970
|
return res;
|
|
1054
971
|
};
|
|
1055
972
|
}
|
|
1056
973
|
function onError(fn) {
|
|
1057
974
|
ERROR || (ERROR = Symbol("error"));
|
|
1058
|
-
if (Owner === null);
|
|
1059
|
-
else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
975
|
+
if (Owner === null) ;else if (Owner.context === null || !Owner.context[ERROR]) {
|
|
1060
976
|
Owner.context = {
|
|
1061
977
|
...Owner.context,
|
|
1062
978
|
[ERROR]: [fn]
|
|
@@ -1085,8 +1001,7 @@ function observable(input) {
|
|
|
1085
1001
|
if (!(observer instanceof Object) || observer == null) {
|
|
1086
1002
|
throw new TypeError("Expected the observer to be an object.");
|
|
1087
1003
|
}
|
|
1088
|
-
const handler =
|
|
1089
|
-
typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1004
|
+
const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
|
|
1090
1005
|
if (!handler) {
|
|
1091
1006
|
return {
|
|
1092
1007
|
unsubscribe() {}
|
|
@@ -1117,7 +1032,7 @@ function from(producer) {
|
|
|
1117
1032
|
});
|
|
1118
1033
|
if ("subscribe" in producer) {
|
|
1119
1034
|
const unsub = producer.subscribe(v => set(() => v));
|
|
1120
|
-
onCleanup(() =>
|
|
1035
|
+
onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
|
|
1121
1036
|
} else {
|
|
1122
1037
|
const clean = producer(set);
|
|
1123
1038
|
onCleanup(clean);
|
|
@@ -1169,7 +1084,8 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1169
1084
|
});
|
|
1170
1085
|
len = 1;
|
|
1171
1086
|
}
|
|
1172
|
-
}
|
|
1087
|
+
}
|
|
1088
|
+
else if (len === 0) {
|
|
1173
1089
|
mapped = new Array(newLen);
|
|
1174
1090
|
for (j = 0; j < newLen; j++) {
|
|
1175
1091
|
items[j] = newItems[j];
|
|
@@ -1180,16 +1096,8 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1180
1096
|
temp = new Array(newLen);
|
|
1181
1097
|
tempdisposers = new Array(newLen);
|
|
1182
1098
|
indexes && (tempIndexes = new Array(newLen));
|
|
1183
|
-
for (
|
|
1184
|
-
|
|
1185
|
-
start < end && items[start] === newItems[start];
|
|
1186
|
-
start++
|
|
1187
|
-
);
|
|
1188
|
-
for (
|
|
1189
|
-
end = len - 1, newEnd = newLen - 1;
|
|
1190
|
-
end >= start && newEnd >= start && items[end] === newItems[newEnd];
|
|
1191
|
-
end--, newEnd--
|
|
1192
|
-
) {
|
|
1099
|
+
for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);
|
|
1100
|
+
for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
|
|
1193
1101
|
temp[newEnd] = mapped[end];
|
|
1194
1102
|
tempdisposers[newEnd] = disposers[end];
|
|
1195
1103
|
indexes && (tempIndexes[newEnd] = indexes[end]);
|
|
@@ -1223,7 +1131,7 @@ function mapArray(list, mapFn, options = {}) {
|
|
|
1223
1131
|
}
|
|
1224
1132
|
} else mapped[j] = createRoot(mapper);
|
|
1225
1133
|
}
|
|
1226
|
-
mapped = mapped.slice(0,
|
|
1134
|
+
mapped = mapped.slice(0, len = newLen);
|
|
1227
1135
|
items = newItems.slice(0);
|
|
1228
1136
|
}
|
|
1229
1137
|
return mapped;
|
|
@@ -1289,7 +1197,7 @@ function indexArray(list, mapFn, options = {}) {
|
|
|
1289
1197
|
}
|
|
1290
1198
|
len = signals.length = disposers.length = newItems.length;
|
|
1291
1199
|
items = newItems.slice(0);
|
|
1292
|
-
return
|
|
1200
|
+
return mapped = mapped.slice(0, len);
|
|
1293
1201
|
});
|
|
1294
1202
|
function mapper(disposer) {
|
|
1295
1203
|
disposers[i] = disposer;
|
|
@@ -1358,33 +1266,29 @@ function mergeProps(...sources) {
|
|
|
1358
1266
|
let proxy = false;
|
|
1359
1267
|
for (let i = 0; i < sources.length; i++) {
|
|
1360
1268
|
const s = sources[i];
|
|
1361
|
-
proxy = proxy ||
|
|
1362
|
-
sources[i] = typeof s === "function" ? (
|
|
1269
|
+
proxy = proxy || !!s && $PROXY in s;
|
|
1270
|
+
sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
|
|
1363
1271
|
}
|
|
1364
1272
|
if (proxy) {
|
|
1365
|
-
return new Proxy(
|
|
1366
|
-
{
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
if (v !== undefined) return v;
|
|
1371
|
-
}
|
|
1372
|
-
},
|
|
1373
|
-
has(property) {
|
|
1374
|
-
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1375
|
-
if (property in resolveSource(sources[i])) return true;
|
|
1376
|
-
}
|
|
1377
|
-
return false;
|
|
1378
|
-
},
|
|
1379
|
-
keys() {
|
|
1380
|
-
const keys = [];
|
|
1381
|
-
for (let i = 0; i < sources.length; i++)
|
|
1382
|
-
keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1383
|
-
return [...new Set(keys)];
|
|
1273
|
+
return new Proxy({
|
|
1274
|
+
get(property) {
|
|
1275
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1276
|
+
const v = resolveSource(sources[i])[property];
|
|
1277
|
+
if (v !== undefined) return v;
|
|
1384
1278
|
}
|
|
1385
1279
|
},
|
|
1386
|
-
|
|
1387
|
-
|
|
1280
|
+
has(property) {
|
|
1281
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
1282
|
+
if (property in resolveSource(sources[i])) return true;
|
|
1283
|
+
}
|
|
1284
|
+
return false;
|
|
1285
|
+
},
|
|
1286
|
+
keys() {
|
|
1287
|
+
const keys = [];
|
|
1288
|
+
for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
|
|
1289
|
+
return [...new Set(keys)];
|
|
1290
|
+
}
|
|
1291
|
+
}, propTraps);
|
|
1388
1292
|
}
|
|
1389
1293
|
const target = {};
|
|
1390
1294
|
const sourcesMap = {};
|
|
@@ -1403,7 +1307,7 @@ function mergeProps(...sources) {
|
|
|
1403
1307
|
Object.defineProperty(target, key, {
|
|
1404
1308
|
enumerable: true,
|
|
1405
1309
|
configurable: true,
|
|
1406
|
-
get: resolveSources.bind(
|
|
1310
|
+
get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
|
|
1407
1311
|
});
|
|
1408
1312
|
} else {
|
|
1409
1313
|
if (desc.value !== undefined) defined.add(key);
|
|
@@ -1427,60 +1331,47 @@ function splitProps(props, ...keys) {
|
|
|
1427
1331
|
if ($PROXY in props) {
|
|
1428
1332
|
const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
|
|
1429
1333
|
const res = keys.map(k => {
|
|
1430
|
-
return new Proxy(
|
|
1431
|
-
{
|
|
1432
|
-
|
|
1433
|
-
return k.includes(property) ? props[property] : undefined;
|
|
1434
|
-
},
|
|
1435
|
-
has(property) {
|
|
1436
|
-
return k.includes(property) && property in props;
|
|
1437
|
-
},
|
|
1438
|
-
keys() {
|
|
1439
|
-
return k.filter(property => property in props);
|
|
1440
|
-
}
|
|
1334
|
+
return new Proxy({
|
|
1335
|
+
get(property) {
|
|
1336
|
+
return k.includes(property) ? props[property] : undefined;
|
|
1441
1337
|
},
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
});
|
|
1445
|
-
res.push(
|
|
1446
|
-
new Proxy(
|
|
1447
|
-
{
|
|
1448
|
-
get(property) {
|
|
1449
|
-
return blocked.has(property) ? undefined : props[property];
|
|
1450
|
-
},
|
|
1451
|
-
has(property) {
|
|
1452
|
-
return blocked.has(property) ? false : property in props;
|
|
1453
|
-
},
|
|
1454
|
-
keys() {
|
|
1455
|
-
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1456
|
-
}
|
|
1338
|
+
has(property) {
|
|
1339
|
+
return k.includes(property) && property in props;
|
|
1457
1340
|
},
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1341
|
+
keys() {
|
|
1342
|
+
return k.filter(property => property in props);
|
|
1343
|
+
}
|
|
1344
|
+
}, propTraps);
|
|
1345
|
+
});
|
|
1346
|
+
res.push(new Proxy({
|
|
1347
|
+
get(property) {
|
|
1348
|
+
return blocked.has(property) ? undefined : props[property];
|
|
1349
|
+
},
|
|
1350
|
+
has(property) {
|
|
1351
|
+
return blocked.has(property) ? false : property in props;
|
|
1352
|
+
},
|
|
1353
|
+
keys() {
|
|
1354
|
+
return Object.keys(props).filter(k => !blocked.has(k));
|
|
1355
|
+
}
|
|
1356
|
+
}, propTraps));
|
|
1461
1357
|
return res;
|
|
1462
1358
|
}
|
|
1463
1359
|
const otherObject = {};
|
|
1464
1360
|
const objects = keys.map(() => ({}));
|
|
1465
1361
|
for (const propName of Object.getOwnPropertyNames(props)) {
|
|
1466
1362
|
const desc = Object.getOwnPropertyDescriptor(props, propName);
|
|
1467
|
-
const isDefaultDesc =
|
|
1468
|
-
!desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1363
|
+
const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
|
|
1469
1364
|
let blocked = false;
|
|
1470
1365
|
let objectIndex = 0;
|
|
1471
1366
|
for (const k of keys) {
|
|
1472
1367
|
if (k.includes(propName)) {
|
|
1473
1368
|
blocked = true;
|
|
1474
|
-
isDefaultDesc
|
|
1475
|
-
? (objects[objectIndex][propName] = desc.value)
|
|
1476
|
-
: Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1369
|
+
isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
|
|
1477
1370
|
}
|
|
1478
1371
|
++objectIndex;
|
|
1479
1372
|
}
|
|
1480
1373
|
if (!blocked) {
|
|
1481
|
-
isDefaultDesc
|
|
1482
|
-
? (otherObject[propName] = desc.value)
|
|
1483
|
-
: Object.defineProperty(otherObject, propName, desc);
|
|
1374
|
+
isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
|
|
1484
1375
|
}
|
|
1485
1376
|
}
|
|
1486
1377
|
return [...objects, otherObject];
|
|
@@ -1506,21 +1397,17 @@ function lazy(fn) {
|
|
|
1506
1397
|
comp = s;
|
|
1507
1398
|
}
|
|
1508
1399
|
let Comp;
|
|
1509
|
-
return createMemo(
|
|
1510
|
-
()
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
setHydrateContext(c);
|
|
1519
|
-
return r;
|
|
1520
|
-
})
|
|
1521
|
-
);
|
|
1400
|
+
return createMemo(() => (Comp = comp()) && untrack(() => {
|
|
1401
|
+
if (false) ;
|
|
1402
|
+
if (!ctx) return Comp(props);
|
|
1403
|
+
const c = sharedConfig.context;
|
|
1404
|
+
setHydrateContext(ctx);
|
|
1405
|
+
const r = Comp(props);
|
|
1406
|
+
setHydrateContext(c);
|
|
1407
|
+
return r;
|
|
1408
|
+
}));
|
|
1522
1409
|
};
|
|
1523
|
-
wrap.preload = () => p || ((p = fn()).then(mod =>
|
|
1410
|
+
wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
|
|
1524
1411
|
return wrap;
|
|
1525
1412
|
}
|
|
1526
1413
|
let counter = 0;
|
|
@@ -1545,78 +1432,49 @@ function Index(props) {
|
|
|
1545
1432
|
function Show(props) {
|
|
1546
1433
|
const keyed = props.keyed;
|
|
1547
1434
|
const condition = createMemo(() => props.when, undefined, {
|
|
1548
|
-
equals: (a, b) =>
|
|
1435
|
+
equals: (a, b) => keyed ? a === b : !a === !b
|
|
1549
1436
|
});
|
|
1550
|
-
return createMemo(
|
|
1551
|
-
()
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
if (!untrack(condition)) throw narrowedError("Show");
|
|
1563
|
-
return props.when;
|
|
1564
|
-
}
|
|
1565
|
-
)
|
|
1566
|
-
)
|
|
1567
|
-
: child;
|
|
1568
|
-
}
|
|
1569
|
-
return props.fallback;
|
|
1570
|
-
},
|
|
1571
|
-
undefined,
|
|
1572
|
-
undefined
|
|
1573
|
-
);
|
|
1437
|
+
return createMemo(() => {
|
|
1438
|
+
const c = condition();
|
|
1439
|
+
if (c) {
|
|
1440
|
+
const child = props.children;
|
|
1441
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1442
|
+
return fn ? untrack(() => child(keyed ? c : () => {
|
|
1443
|
+
if (!untrack(condition)) throw narrowedError("Show");
|
|
1444
|
+
return props.when;
|
|
1445
|
+
})) : child;
|
|
1446
|
+
}
|
|
1447
|
+
return props.fallback;
|
|
1448
|
+
}, undefined, undefined);
|
|
1574
1449
|
}
|
|
1575
1450
|
function Switch(props) {
|
|
1576
1451
|
let keyed = false;
|
|
1577
|
-
const equals = (a, b) =>
|
|
1578
|
-
a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1452
|
+
const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
|
|
1579
1453
|
const conditions = children(() => props.children),
|
|
1580
|
-
evalConditions = createMemo(
|
|
1581
|
-
()
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
return [i, c, conds[i]];
|
|
1589
|
-
}
|
|
1454
|
+
evalConditions = createMemo(() => {
|
|
1455
|
+
let conds = conditions();
|
|
1456
|
+
if (!Array.isArray(conds)) conds = [conds];
|
|
1457
|
+
for (let i = 0; i < conds.length; i++) {
|
|
1458
|
+
const c = conds[i].when;
|
|
1459
|
+
if (c) {
|
|
1460
|
+
keyed = !!conds[i].keyed;
|
|
1461
|
+
return [i, c, conds[i]];
|
|
1590
1462
|
}
|
|
1591
|
-
return [-1];
|
|
1592
|
-
},
|
|
1593
|
-
undefined,
|
|
1594
|
-
{
|
|
1595
|
-
equals
|
|
1596
1463
|
}
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
return cond.when;
|
|
1612
|
-
}
|
|
1613
|
-
)
|
|
1614
|
-
)
|
|
1615
|
-
: c;
|
|
1616
|
-
},
|
|
1617
|
-
undefined,
|
|
1618
|
-
undefined
|
|
1619
|
-
);
|
|
1464
|
+
return [-1];
|
|
1465
|
+
}, undefined, {
|
|
1466
|
+
equals
|
|
1467
|
+
});
|
|
1468
|
+
return createMemo(() => {
|
|
1469
|
+
const [index, when, cond] = evalConditions();
|
|
1470
|
+
if (index < 0) return props.fallback;
|
|
1471
|
+
const c = cond.children;
|
|
1472
|
+
const fn = typeof c === "function" && c.length > 0;
|
|
1473
|
+
return fn ? untrack(() => c(keyed ? when : () => {
|
|
1474
|
+
if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
|
|
1475
|
+
return cond.when;
|
|
1476
|
+
})) : c;
|
|
1477
|
+
}, undefined, undefined);
|
|
1620
1478
|
}
|
|
1621
1479
|
function Match(props) {
|
|
1622
1480
|
return props;
|
|
@@ -1627,28 +1485,22 @@ function resetErrorBoundaries() {
|
|
|
1627
1485
|
}
|
|
1628
1486
|
function ErrorBoundary(props) {
|
|
1629
1487
|
let err;
|
|
1630
|
-
if (sharedConfig.context && sharedConfig.load)
|
|
1631
|
-
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1488
|
+
if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1632
1489
|
const [errored, setErrored] = createSignal(err, undefined);
|
|
1633
1490
|
Errors || (Errors = new Set());
|
|
1634
1491
|
Errors.add(setErrored);
|
|
1635
1492
|
onCleanup(() => Errors.delete(setErrored));
|
|
1636
|
-
return createMemo(
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
},
|
|
1645
|
-
undefined,
|
|
1646
|
-
undefined
|
|
1647
|
-
);
|
|
1493
|
+
return createMemo(() => {
|
|
1494
|
+
let e;
|
|
1495
|
+
if (e = errored()) {
|
|
1496
|
+
const f = props.fallback;
|
|
1497
|
+
return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
|
|
1498
|
+
}
|
|
1499
|
+
return catchError(() => props.children, setErrored);
|
|
1500
|
+
}, undefined, undefined);
|
|
1648
1501
|
}
|
|
1649
1502
|
|
|
1650
|
-
const suspenseListEquals = (a, b) =>
|
|
1651
|
-
a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1503
|
+
const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1652
1504
|
const SuspenseListContext = createContext();
|
|
1653
1505
|
function SuspenseList(props) {
|
|
1654
1506
|
let [wrapper, setWrapper] = createSignal(() => ({
|
|
@@ -1660,51 +1512,51 @@ function SuspenseList(props) {
|
|
|
1660
1512
|
if (listContext) {
|
|
1661
1513
|
show = listContext.register(createMemo(() => wrapper()().inFallback));
|
|
1662
1514
|
}
|
|
1663
|
-
const resolved = createMemo(
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1515
|
+
const resolved = createMemo(prev => {
|
|
1516
|
+
const reveal = props.revealOrder,
|
|
1517
|
+
tail = props.tail,
|
|
1518
|
+
{
|
|
1519
|
+
showContent = true,
|
|
1520
|
+
showFallback = true
|
|
1521
|
+
} = show ? show() : {},
|
|
1522
|
+
reg = registry(),
|
|
1523
|
+
reverse = reveal === "backwards";
|
|
1524
|
+
if (reveal === "together") {
|
|
1525
|
+
const all = reg.every(inFallback => !inFallback());
|
|
1526
|
+
const res = reg.map(() => ({
|
|
1527
|
+
showContent: all && showContent,
|
|
1528
|
+
showFallback
|
|
1529
|
+
}));
|
|
1530
|
+
res.inFallback = !all;
|
|
1531
|
+
return res;
|
|
1532
|
+
}
|
|
1533
|
+
let stop = false;
|
|
1534
|
+
let inFallback = prev.inFallback;
|
|
1535
|
+
const res = [];
|
|
1536
|
+
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1537
|
+
const n = reverse ? len - i - 1 : i,
|
|
1538
|
+
s = reg[n]();
|
|
1539
|
+
if (!stop && !s) {
|
|
1540
|
+
res[n] = {
|
|
1541
|
+
showContent,
|
|
1674
1542
|
showFallback
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
s = reg[n]();
|
|
1685
|
-
if (!stop && !s) {
|
|
1686
|
-
res[n] = {
|
|
1687
|
-
showContent,
|
|
1688
|
-
showFallback
|
|
1689
|
-
};
|
|
1690
|
-
} else {
|
|
1691
|
-
const next = !stop;
|
|
1692
|
-
if (next) inFallback = true;
|
|
1693
|
-
res[n] = {
|
|
1694
|
-
showContent: next,
|
|
1695
|
-
showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
|
|
1696
|
-
};
|
|
1697
|
-
stop = true;
|
|
1698
|
-
}
|
|
1543
|
+
};
|
|
1544
|
+
} else {
|
|
1545
|
+
const next = !stop;
|
|
1546
|
+
if (next) inFallback = true;
|
|
1547
|
+
res[n] = {
|
|
1548
|
+
showContent: next,
|
|
1549
|
+
showFallback: !tail || next && tail === "collapsed" ? showFallback : false
|
|
1550
|
+
};
|
|
1551
|
+
stop = true;
|
|
1699
1552
|
}
|
|
1700
|
-
if (!stop) inFallback = false;
|
|
1701
|
-
res.inFallback = inFallback;
|
|
1702
|
-
return res;
|
|
1703
|
-
},
|
|
1704
|
-
{
|
|
1705
|
-
inFallback: false
|
|
1706
1553
|
}
|
|
1707
|
-
|
|
1554
|
+
if (!stop) inFallback = false;
|
|
1555
|
+
res.inFallback = inFallback;
|
|
1556
|
+
return res;
|
|
1557
|
+
}, {
|
|
1558
|
+
inFallback: false
|
|
1559
|
+
});
|
|
1708
1560
|
setWrapper(() => resolved);
|
|
1709
1561
|
return createComponent(SuspenseListContext.Provider, {
|
|
1710
1562
|
value: {
|
|
@@ -1779,14 +1631,17 @@ function Suspense(props) {
|
|
|
1779
1631
|
ctx = sharedConfig.context;
|
|
1780
1632
|
if (flicker) {
|
|
1781
1633
|
flicker();
|
|
1782
|
-
return
|
|
1634
|
+
return flicker = undefined;
|
|
1783
1635
|
}
|
|
1784
1636
|
if (ctx && p === "$$f") setHydrateContext();
|
|
1785
1637
|
const rendered = createMemo(() => props.children);
|
|
1786
1638
|
return createMemo(prev => {
|
|
1787
1639
|
const inFallback = store.inFallback(),
|
|
1788
|
-
{
|
|
1789
|
-
|
|
1640
|
+
{
|
|
1641
|
+
showContent = true,
|
|
1642
|
+
showFallback = true
|
|
1643
|
+
} = show ? show() : {};
|
|
1644
|
+
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1790
1645
|
store.resolved = true;
|
|
1791
1646
|
dispose && dispose();
|
|
1792
1647
|
dispose = ctx = p = undefined;
|
|
@@ -1814,59 +1669,4 @@ function Suspense(props) {
|
|
|
1814
1669
|
|
|
1815
1670
|
const DEV = undefined;
|
|
1816
1671
|
|
|
1817
|
-
export {
|
|
1818
|
-
$DEVCOMP,
|
|
1819
|
-
$PROXY,
|
|
1820
|
-
$TRACK,
|
|
1821
|
-
DEV,
|
|
1822
|
-
ErrorBoundary,
|
|
1823
|
-
For,
|
|
1824
|
-
Index,
|
|
1825
|
-
Match,
|
|
1826
|
-
Show,
|
|
1827
|
-
Suspense,
|
|
1828
|
-
SuspenseList,
|
|
1829
|
-
Switch,
|
|
1830
|
-
batch,
|
|
1831
|
-
cancelCallback,
|
|
1832
|
-
catchError,
|
|
1833
|
-
children,
|
|
1834
|
-
createComponent,
|
|
1835
|
-
createComputed,
|
|
1836
|
-
createContext,
|
|
1837
|
-
createDeferred,
|
|
1838
|
-
createEffect,
|
|
1839
|
-
createMemo,
|
|
1840
|
-
createReaction,
|
|
1841
|
-
createRenderEffect,
|
|
1842
|
-
createResource,
|
|
1843
|
-
createRoot,
|
|
1844
|
-
createSelector,
|
|
1845
|
-
createSignal,
|
|
1846
|
-
createUniqueId,
|
|
1847
|
-
enableExternalSource,
|
|
1848
|
-
enableHydration,
|
|
1849
|
-
enableScheduling,
|
|
1850
|
-
equalFn,
|
|
1851
|
-
from,
|
|
1852
|
-
getListener,
|
|
1853
|
-
getOwner,
|
|
1854
|
-
indexArray,
|
|
1855
|
-
lazy,
|
|
1856
|
-
mapArray,
|
|
1857
|
-
mergeProps,
|
|
1858
|
-
observable,
|
|
1859
|
-
on,
|
|
1860
|
-
onCleanup,
|
|
1861
|
-
onError,
|
|
1862
|
-
onMount,
|
|
1863
|
-
requestCallback,
|
|
1864
|
-
resetErrorBoundaries,
|
|
1865
|
-
runWithOwner,
|
|
1866
|
-
sharedConfig,
|
|
1867
|
-
splitProps,
|
|
1868
|
-
startTransition,
|
|
1869
|
-
untrack,
|
|
1870
|
-
useContext,
|
|
1871
|
-
useTransition
|
|
1872
|
-
};
|
|
1672
|
+
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 };
|