solid-js 1.8.19 → 1.8.21

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.
Files changed (48) hide show
  1. package/dist/dev.cjs +6 -6
  2. package/dist/dev.js +562 -321
  3. package/dist/server.js +168 -74
  4. package/dist/solid.cjs +6 -6
  5. package/dist/solid.js +489 -279
  6. package/h/dist/h.js +38 -9
  7. package/h/jsx-runtime/dist/jsx.js +1 -1
  8. package/h/jsx-runtime/types/index.d.ts +11 -8
  9. package/h/types/hyperscript.d.ts +11 -11
  10. package/html/dist/html.js +216 -94
  11. package/html/types/lit.d.ts +47 -33
  12. package/package.json +1 -1
  13. package/store/dist/dev.js +122 -43
  14. package/store/dist/server.js +19 -8
  15. package/store/dist/store.js +113 -40
  16. package/store/types/index.d.ts +21 -7
  17. package/store/types/modifiers.d.ts +6 -3
  18. package/store/types/mutable.d.ts +5 -2
  19. package/store/types/server.d.ts +12 -4
  20. package/store/types/store.d.ts +218 -61
  21. package/types/index.d.ts +75 -10
  22. package/types/jsx.d.ts +913 -862
  23. package/types/reactive/array.d.ts +12 -4
  24. package/types/reactive/observable.d.ts +25 -17
  25. package/types/reactive/scheduler.d.ts +9 -6
  26. package/types/reactive/signal.d.ts +233 -142
  27. package/types/render/Suspense.d.ts +5 -5
  28. package/types/render/component.d.ts +64 -33
  29. package/types/render/flow.d.ts +43 -31
  30. package/types/render/hydration.d.ts +15 -15
  31. package/types/server/index.d.ts +57 -2
  32. package/types/server/reactive.d.ts +73 -42
  33. package/types/server/rendering.d.ts +169 -98
  34. package/universal/dist/dev.js +28 -12
  35. package/universal/dist/universal.js +28 -12
  36. package/universal/types/index.d.ts +3 -1
  37. package/universal/types/universal.d.ts +0 -1
  38. package/web/dist/dev.cjs +34 -18
  39. package/web/dist/dev.js +655 -97
  40. package/web/dist/server.cjs +1 -1
  41. package/web/dist/server.js +210 -96
  42. package/web/dist/web.cjs +32 -16
  43. package/web/dist/web.js +646 -95
  44. package/web/storage/dist/storage.js +3 -3
  45. package/web/types/client.d.ts +2 -2
  46. package/web/types/core.d.ts +10 -1
  47. package/web/types/index.d.ts +27 -10
  48. package/web/types/server-mock.d.ts +47 -32
package/dist/dev.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;else if (cmp < 0) n = k - 1;else return k;
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
  }
@@ -117,6 +119,7 @@ function workLoop(hasTimeRemaining, initialTime) {
117
119
  const sharedConfig = {
118
120
  context: undefined,
119
121
  registry: undefined,
122
+ done: false,
120
123
  getContextId() {
121
124
  return getContextId(this.context.count);
122
125
  },
@@ -176,20 +179,25 @@ function createRoot(fn, detachedOwner) {
176
179
  owner = Owner,
177
180
  unowned = fn.length === 0,
178
181
  current = detachedOwner === undefined ? owner : detachedOwner,
179
- root = unowned ? {
180
- owned: null,
181
- cleanups: null,
182
- context: null,
183
- owner: null
184
- } : {
185
- owned: null,
186
- cleanups: null,
187
- context: current ? current.context : null,
188
- owner: current
189
- },
190
- updateFn = unowned ? () => fn(() => {
191
- throw new Error("Dispose method must be an explicit argument to createRoot function");
192
- }) : () => fn(() => untrack(() => cleanNode(root)));
182
+ root = unowned
183
+ ? {
184
+ owned: null,
185
+ cleanups: null,
186
+ context: null,
187
+ owner: null
188
+ }
189
+ : {
190
+ owned: null,
191
+ cleanups: null,
192
+ context: current ? current.context : null,
193
+ owner: current
194
+ },
195
+ updateFn = unowned
196
+ ? () =>
197
+ fn(() => {
198
+ throw new Error("Dispose method must be an explicit argument to createRoot function");
199
+ })
200
+ : () => fn(() => untrack(() => cleanNode(root)));
193
201
  DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(root);
194
202
  Owner = root;
195
203
  Listener = null;
@@ -215,23 +223,26 @@ function createSignal(value, options) {
215
223
  }
216
224
  const setter = value => {
217
225
  if (typeof value === "function") {
218
- if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
226
+ if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
227
+ else value = value(s.value);
219
228
  }
220
229
  return writeSignal(s, value);
221
230
  };
222
231
  return [readSignal.bind(s), setter];
223
232
  }
224
233
  function createComputed(fn, value, options) {
225
- const c = createComputation(fn, value, true, STALE, options );
226
- if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
234
+ const c = createComputation(fn, value, true, STALE, options);
235
+ if (Scheduler && Transition && Transition.running) Updates.push(c);
236
+ else updateComputation(c);
227
237
  }
228
238
  function createRenderEffect(fn, value, options) {
229
- const c = createComputation(fn, value, false, STALE, options );
230
- if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
239
+ const c = createComputation(fn, value, false, STALE, options);
240
+ if (Scheduler && Transition && Transition.running) Updates.push(c);
241
+ else updateComputation(c);
231
242
  }
232
243
  function createEffect(fn, value, options) {
233
244
  runEffects = runUserEffects;
234
- const c = createComputation(fn, value, false, STALE, options ),
245
+ const c = createComputation(fn, value, false, STALE, options),
235
246
  s = SuspenseContext && useContext(SuspenseContext);
236
247
  if (s) c.suspense = s;
237
248
  if (!options || !options.render) c.user = true;
@@ -239,10 +250,16 @@ function createEffect(fn, value, options) {
239
250
  }
240
251
  function createReaction(onInvalidate, options) {
241
252
  let fn;
242
- const c = createComputation(() => {
243
- fn ? fn() : untrack(onInvalidate);
244
- fn = undefined;
245
- }, undefined, false, 0, options ),
253
+ const c = createComputation(
254
+ () => {
255
+ fn ? fn() : untrack(onInvalidate);
256
+ fn = undefined;
257
+ },
258
+ undefined,
259
+ false,
260
+ 0,
261
+ options
262
+ ),
246
263
  s = SuspenseContext && useContext(SuspenseContext);
247
264
  if (s) c.suspense = s;
248
265
  c.user = true;
@@ -253,7 +270,7 @@ function createReaction(onInvalidate, options) {
253
270
  }
254
271
  function createMemo(fn, value, options) {
255
272
  options = options ? Object.assign({}, signalOptions, options) : signalOptions;
256
- const c = createComputation(fn, value, true, 0, options );
273
+ const c = createComputation(fn, value, true, 0, options);
257
274
  c.observers = null;
258
275
  c.observerSlots = null;
259
276
  c.comparator = options.equals || undefined;
@@ -270,7 +287,7 @@ function createResource(pSource, pFetcher, pOptions) {
270
287
  let source;
271
288
  let fetcher;
272
289
  let options;
273
- if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
290
+ if ((arguments.length === 2 && typeof pFetcher === "object") || arguments.length === 1) {
274
291
  source = true;
275
292
  fetcher = pSource;
276
293
  options = pFetcher || {};
@@ -284,7 +301,7 @@ function createResource(pSource, pFetcher, pOptions) {
284
301
  id = null,
285
302
  loadedUnderTransition = false,
286
303
  scheduled = false,
287
- resolved = ("initialValue" in options),
304
+ resolved = "initialValue" in options,
288
305
  dynamic = typeof source === "function" && createMemo(source);
289
306
  const contexts = new Set(),
290
307
  [value, setValue] = (options.storage || createSignal)(options.initialValue),
@@ -295,16 +312,19 @@ function createResource(pSource, pFetcher, pOptions) {
295
312
  [state, setState] = createSignal(resolved ? "ready" : "unresolved");
296
313
  if (sharedConfig.context) {
297
314
  id = sharedConfig.getNextContextId();
298
- let v;
299
- if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
315
+ if (options.ssrLoadFrom === "initial") initP = options.initialValue;
316
+ else if (sharedConfig.load && sharedConfig.has(id)) initP = sharedConfig.load(id);
300
317
  }
301
318
  function loadEnd(p, v, error, key) {
302
319
  if (pr === p) {
303
320
  pr = null;
304
321
  key !== undefined && (resolved = true);
305
- if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
306
- value: v
307
- }));
322
+ if ((p === initP || v === initP) && options.onHydrated)
323
+ queueMicrotask(() =>
324
+ options.onHydrated(key, {
325
+ value: v
326
+ })
327
+ );
308
328
  initP = NO_INIT;
309
329
  if (Transition && p && loadedUnderTransition) {
310
330
  Transition.promises.delete(p);
@@ -335,7 +355,8 @@ function createResource(pSource, pFetcher, pOptions) {
335
355
  createComputed(() => {
336
356
  track();
337
357
  if (pr) {
338
- if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) {
358
+ if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
359
+ else if (!contexts.has(c)) {
339
360
  c.increment();
340
361
  contexts.add(c);
341
362
  }
@@ -354,26 +375,35 @@ function createResource(pSource, pFetcher, pOptions) {
354
375
  return;
355
376
  }
356
377
  if (Transition && pr) Transition.promises.delete(pr);
357
- const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {
358
- value: value(),
359
- refetching
360
- }));
378
+ const p =
379
+ initP !== NO_INIT
380
+ ? initP
381
+ : untrack(() =>
382
+ fetcher(lookup, {
383
+ value: value(),
384
+ refetching
385
+ })
386
+ );
361
387
  if (!isPromise(p)) {
362
388
  loadEnd(pr, p, undefined, lookup);
363
389
  return p;
364
390
  }
365
391
  pr = p;
366
392
  if ("value" in p) {
367
- if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);else loadEnd(pr, undefined, castError(p.value), lookup);
393
+ if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);
394
+ else loadEnd(pr, undefined, castError(p.value), lookup);
368
395
  return p;
369
396
  }
370
397
  scheduled = true;
371
- queueMicrotask(() => scheduled = false);
398
+ queueMicrotask(() => (scheduled = false));
372
399
  runUpdates(() => {
373
400
  setState(resolved ? "refreshing" : "pending");
374
401
  trigger();
375
402
  }, false);
376
- return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));
403
+ return p.then(
404
+ v => loadEnd(p, v, undefined, lookup),
405
+ e => loadEnd(p, undefined, castError(e), lookup)
406
+ );
377
407
  }
378
408
  Object.defineProperties(read, {
379
409
  state: {
@@ -397,50 +427,81 @@ function createResource(pSource, pFetcher, pOptions) {
397
427
  }
398
428
  }
399
429
  });
400
- if (dynamic) createComputed(() => load(false));else load(false);
401
- return [read, {
402
- refetch: load,
403
- mutate: setValue
404
- }];
430
+ if (dynamic) createComputed(() => load(false));
431
+ else load(false);
432
+ return [
433
+ read,
434
+ {
435
+ refetch: load,
436
+ mutate: setValue
437
+ }
438
+ ];
405
439
  }
406
440
  function createDeferred(source, options) {
407
441
  let t,
408
442
  timeout = options ? options.timeoutMs : undefined;
409
- const node = createComputation(() => {
410
- if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
411
- timeout
412
- } : undefined);
413
- return source();
414
- }, undefined, true);
415
- const [deferred, setDeferred] = createSignal(Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, options);
443
+ const node = createComputation(
444
+ () => {
445
+ if (!t || !t.fn)
446
+ t = requestCallback(
447
+ () => setDeferred(() => node.value),
448
+ timeout !== undefined
449
+ ? {
450
+ timeout
451
+ }
452
+ : undefined
453
+ );
454
+ return source();
455
+ },
456
+ undefined,
457
+ true
458
+ );
459
+ const [deferred, setDeferred] = createSignal(
460
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
461
+ options
462
+ );
416
463
  updateComputation(node);
417
- setDeferred(() => Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
464
+ setDeferred(() =>
465
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
466
+ );
418
467
  return deferred;
419
468
  }
420
469
  function createSelector(source, fn = equalFn, options) {
421
470
  const subs = new Map();
422
- const node = createComputation(p => {
423
- const v = source();
424
- for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
425
- for (const c of val.values()) {
426
- c.state = STALE;
427
- if (c.pure) Updates.push(c);else Effects.push(c);
428
- }
429
- }
430
- return v;
431
- }, undefined, true, STALE, options );
471
+ const node = createComputation(
472
+ p => {
473
+ const v = source();
474
+ for (const [key, val] of subs.entries())
475
+ if (fn(key, v) !== fn(key, p)) {
476
+ for (const c of val.values()) {
477
+ c.state = STALE;
478
+ if (c.pure) Updates.push(c);
479
+ else Effects.push(c);
480
+ }
481
+ }
482
+ return v;
483
+ },
484
+ undefined,
485
+ true,
486
+ STALE,
487
+ options
488
+ );
432
489
  updateComputation(node);
433
490
  return key => {
434
491
  const listener = Listener;
435
492
  if (listener) {
436
493
  let l;
437
- if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
494
+ if ((l = subs.get(key))) l.add(listener);
495
+ else subs.set(key, (l = new Set([listener])));
438
496
  onCleanup(() => {
439
497
  l.delete(listener);
440
498
  !l.size && subs.delete(key);
441
499
  });
442
500
  }
443
- return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
501
+ return fn(
502
+ key,
503
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
504
+ );
444
505
  };
445
506
  }
446
507
  function batch(fn) {
@@ -480,7 +541,10 @@ function onMount(fn) {
480
541
  createEffect(() => untrack(fn));
481
542
  }
482
543
  function onCleanup(fn) {
483
- if (Owner === null) console.warn("cleanups created outside a `createRoot` or `render` will never be run");else if (Owner.cleanups === null) Owner.cleanups = [fn];else Owner.cleanups.push(fn);
544
+ if (Owner === null)
545
+ console.warn("cleanups created outside a `createRoot` or `render` will never be run");
546
+ else if (Owner.cleanups === null) Owner.cleanups = [fn];
547
+ else Owner.cleanups.push(fn);
484
548
  return fn;
485
549
  }
486
550
  function catchError(fn, handler) {
@@ -534,15 +598,17 @@ function startTransition(fn) {
534
598
  Owner = o;
535
599
  let t;
536
600
  if (Scheduler || SuspenseContext) {
537
- t = Transition || (Transition = {
538
- sources: new Set(),
539
- effects: [],
540
- promises: new Set(),
541
- disposed: new Set(),
542
- queue: new Set(),
543
- running: true
544
- });
545
- t.done || (t.done = new Promise(res => t.resolve = res));
601
+ t =
602
+ Transition ||
603
+ (Transition = {
604
+ sources: new Set(),
605
+ effects: [],
606
+ promises: new Set(),
607
+ disposed: new Set(),
608
+ queue: new Set(),
609
+ running: true
610
+ });
611
+ t.done || (t.done = new Promise(res => (t.resolve = res)));
546
612
  t.running = true;
547
613
  }
548
614
  runUpdates(fn, false);
@@ -550,7 +616,7 @@ function startTransition(fn) {
550
616
  return t ? t.done : undefined;
551
617
  });
552
618
  }
553
- const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
619
+ const [transPending, setTransPending] = /*@__PURE__*/ createSignal(false);
554
620
  function useTransition() {
555
621
  return [transPending, startTransition];
556
622
  }
@@ -559,12 +625,18 @@ function resumeEffects(e) {
559
625
  e.length = 0;
560
626
  }
561
627
  function devComponent(Comp, props) {
562
- const c = createComputation(() => untrack(() => {
563
- Object.assign(Comp, {
564
- [$DEVCOMP]: true
565
- });
566
- return Comp(props);
567
- }), undefined, true, 0);
628
+ const c = createComputation(
629
+ () =>
630
+ untrack(() => {
631
+ Object.assign(Comp, {
632
+ [$DEVCOMP]: true
633
+ });
634
+ return Comp(props);
635
+ }),
636
+ undefined,
637
+ true,
638
+ 0
639
+ );
568
640
  c.props = props;
569
641
  c.observers = null;
570
642
  c.observerSlots = null;
@@ -575,7 +647,8 @@ function devComponent(Comp, props) {
575
647
  }
576
648
  function registerGraph(value) {
577
649
  if (!Owner) return;
578
- if (Owner.sourceMap) Owner.sourceMap.push(value);else Owner.sourceMap = [value];
650
+ if (Owner.sourceMap) Owner.sourceMap.push(value);
651
+ else Owner.sourceMap = [value];
579
652
  value.graph = Owner;
580
653
  }
581
654
  function createContext(defaultValue, options) {
@@ -588,13 +661,15 @@ function createContext(defaultValue, options) {
588
661
  }
589
662
  function useContext(context) {
590
663
  let value;
591
- return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined ? value : context.defaultValue;
664
+ return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined
665
+ ? value
666
+ : context.defaultValue;
592
667
  }
593
668
  function children(fn) {
594
669
  const children = createMemo(fn);
595
670
  const memo = createMemo(() => resolveChildren(children()), undefined, {
596
671
  name: "children"
597
- }) ;
672
+ });
598
673
  memo.toArray = () => {
599
674
  const c = memo();
600
675
  return Array.isArray(c) ? c : c != null ? [c] : [];
@@ -607,10 +682,7 @@ function getSuspenseContext() {
607
682
  }
608
683
  function enableExternalSource(factory, untrack = fn => fn()) {
609
684
  if (ExternalSourceConfig) {
610
- const {
611
- factory: oldFactory,
612
- untrack: oldUntrack
613
- } = ExternalSourceConfig;
685
+ const { factory: oldFactory, untrack: oldUntrack } = ExternalSourceConfig;
614
686
  ExternalSourceConfig = {
615
687
  factory: (fn, trigger) => {
616
688
  const oldSource = oldFactory(fn, trigger);
@@ -635,7 +707,8 @@ function enableExternalSource(factory, untrack = fn => fn()) {
635
707
  function readSignal() {
636
708
  const runningTransition = Transition && Transition.running;
637
709
  if (this.sources && (runningTransition ? this.tState : this.state)) {
638
- if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
710
+ if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
711
+ else {
639
712
  const updates = Updates;
640
713
  Updates = null;
641
714
  runUpdates(() => lookUpstream(this), false);
@@ -663,11 +736,12 @@ function readSignal() {
663
736
  return this.value;
664
737
  }
665
738
  function writeSignal(node, value, isComp) {
666
- let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
739
+ let current =
740
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
667
741
  if (!node.comparator || !node.comparator(current, value)) {
668
742
  if (Transition) {
669
743
  const TransitionRunning = Transition.running;
670
- if (TransitionRunning || !isComp && Transition.sources.has(node)) {
744
+ if (TransitionRunning || (!isComp && Transition.sources.has(node))) {
671
745
  Transition.sources.add(node);
672
746
  node.tValue = value;
673
747
  }
@@ -680,10 +754,12 @@ function writeSignal(node, value, isComp) {
680
754
  const TransitionRunning = Transition && Transition.running;
681
755
  if (TransitionRunning && Transition.disposed.has(o)) continue;
682
756
  if (TransitionRunning ? !o.tState : !o.state) {
683
- if (o.pure) Updates.push(o);else Effects.push(o);
757
+ if (o.pure) Updates.push(o);
758
+ else Effects.push(o);
684
759
  if (o.observers) markDownstream(o);
685
760
  }
686
- if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
761
+ if (!TransitionRunning) o.state = STALE;
762
+ else o.tState = STALE;
687
763
  }
688
764
  if (Updates.length > 10e5) {
689
765
  Updates = [];
@@ -699,7 +775,11 @@ function updateComputation(node) {
699
775
  if (!node.fn) return;
700
776
  cleanNode(node);
701
777
  const time = ExecCount;
702
- runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
778
+ runComputation(
779
+ node,
780
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
781
+ time
782
+ );
703
783
  if (Transition && !Transition.running && Transition.sources.has(node)) {
704
784
  queueMicrotask(() => {
705
785
  runUpdates(() => {
@@ -764,11 +844,15 @@ function createComputation(fn, init, pure, state = STALE, options) {
764
844
  c.state = 0;
765
845
  c.tState = state;
766
846
  }
767
- if (Owner === null) console.warn("computations created outside a `createRoot` or `render` will never be disposed");else if (Owner !== UNOWNED) {
847
+ if (Owner === null)
848
+ console.warn("computations created outside a `createRoot` or `render` will never be disposed");
849
+ else if (Owner !== UNOWNED) {
768
850
  if (Transition && Transition.running && Owner.pure) {
769
- if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);
851
+ if (!Owner.tOwned) Owner.tOwned = [c];
852
+ else Owner.tOwned.push(c);
770
853
  } else {
771
- if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
854
+ if (!Owner.owned) Owner.owned = [c];
855
+ else Owner.owned.push(c);
772
856
  }
773
857
  }
774
858
  if (options && options.name) c.name = options.name;
@@ -821,7 +905,8 @@ function runUpdates(fn, init) {
821
905
  if (Updates) return fn();
822
906
  let wait = false;
823
907
  if (!init) Updates = [];
824
- if (Effects) wait = true;else Effects = [];
908
+ if (Effects) wait = true;
909
+ else Effects = [];
825
910
  ExecCount++;
826
911
  try {
827
912
  const res = fn();
@@ -835,7 +920,8 @@ function runUpdates(fn, init) {
835
920
  }
836
921
  function completeUpdates(wait) {
837
922
  if (Updates) {
838
- if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);
923
+ if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
924
+ else runQueue(Updates);
839
925
  Updates = null;
840
926
  }
841
927
  if (wait) return;
@@ -875,7 +961,8 @@ function completeUpdates(wait) {
875
961
  }
876
962
  const e = Effects;
877
963
  Effects = null;
878
- if (e.length) runUpdates(() => runEffects(e), false);else DevHooks.afterUpdate && DevHooks.afterUpdate();
964
+ if (e.length) runUpdates(() => runEffects(e), false);
965
+ else DevHooks.afterUpdate && DevHooks.afterUpdate();
879
966
  if (res) res();
880
967
  }
881
968
  function runQueue(queue) {
@@ -903,7 +990,8 @@ function runUserEffects(queue) {
903
990
  userLength = 0;
904
991
  for (i = 0; i < queue.length; i++) {
905
992
  const e = queue[i];
906
- if (!e.user) runTop(e);else queue[userLength++] = e;
993
+ if (!e.user) runTop(e);
994
+ else queue[userLength++] = e;
907
995
  }
908
996
  if (sharedConfig.context) {
909
997
  if (sharedConfig.count) {
@@ -921,13 +1009,15 @@ function runUserEffects(queue) {
921
1009
  }
922
1010
  function lookUpstream(node, ignore) {
923
1011
  const runningTransition = Transition && Transition.running;
924
- if (runningTransition) node.tState = 0;else node.state = 0;
1012
+ if (runningTransition) node.tState = 0;
1013
+ else node.state = 0;
925
1014
  for (let i = 0; i < node.sources.length; i += 1) {
926
1015
  const source = node.sources[i];
927
1016
  if (source.sources) {
928
1017
  const state = runningTransition ? source.tState : source.state;
929
1018
  if (state === STALE) {
930
- if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
1019
+ if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
1020
+ runTop(source);
931
1021
  } else if (state === PENDING) lookUpstream(source, ignore);
932
1022
  }
933
1023
  }
@@ -937,8 +1027,10 @@ function markDownstream(node) {
937
1027
  for (let i = 0; i < node.observers.length; i += 1) {
938
1028
  const o = node.observers[i];
939
1029
  if (runningTransition ? !o.tState : !o.state) {
940
- if (runningTransition) o.tState = PENDING;else o.state = PENDING;
941
- if (o.pure) Updates.push(o);else Effects.push(o);
1030
+ if (runningTransition) o.tState = PENDING;
1031
+ else o.state = PENDING;
1032
+ if (o.pure) Updates.push(o);
1033
+ else Effects.push(o);
942
1034
  o.observers && markDownstream(o);
943
1035
  }
944
1036
  }
@@ -975,7 +1067,8 @@ function cleanNode(node) {
975
1067
  for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
976
1068
  node.cleanups = null;
977
1069
  }
978
- if (Transition && Transition.running) node.tState = 0;else node.state = 0;
1070
+ if (Transition && Transition.running) node.tState = 0;
1071
+ else node.state = 0;
979
1072
  delete node.sourceMap;
980
1073
  }
981
1074
  function reset(node, top) {
@@ -997,19 +1090,21 @@ function runErrors(err, fns, owner) {
997
1090
  try {
998
1091
  for (const f of fns) f(err);
999
1092
  } catch (e) {
1000
- handleError(e, owner && owner.owner || null);
1093
+ handleError(e, (owner && owner.owner) || null);
1001
1094
  }
1002
1095
  }
1003
1096
  function handleError(err, owner = Owner) {
1004
1097
  const fns = ERROR && owner && owner.context && owner.context[ERROR];
1005
1098
  const error = castError(err);
1006
1099
  if (!fns) throw error;
1007
- if (Effects) Effects.push({
1008
- fn() {
1009
- runErrors(error, fns, owner);
1010
- },
1011
- state: STALE
1012
- });else runErrors(error, fns, owner);
1100
+ if (Effects)
1101
+ Effects.push({
1102
+ fn() {
1103
+ runErrors(error, fns, owner);
1104
+ },
1105
+ state: STALE
1106
+ });
1107
+ else runErrors(error, fns, owner);
1013
1108
  }
1014
1109
  function resolveChildren(children) {
1015
1110
  if (typeof children === "function" && !children.length) return resolveChildren(children());
@@ -1026,19 +1121,26 @@ function resolveChildren(children) {
1026
1121
  function createProvider(id, options) {
1027
1122
  return function provider(props) {
1028
1123
  let res;
1029
- createRenderEffect(() => res = untrack(() => {
1030
- Owner.context = {
1031
- ...Owner.context,
1032
- [id]: props.value
1033
- };
1034
- return children(() => props.children);
1035
- }), undefined, options);
1124
+ createRenderEffect(
1125
+ () =>
1126
+ (res = untrack(() => {
1127
+ Owner.context = {
1128
+ ...Owner.context,
1129
+ [id]: props.value
1130
+ };
1131
+ return children(() => props.children);
1132
+ })),
1133
+ undefined,
1134
+ options
1135
+ );
1036
1136
  return res;
1037
1137
  };
1038
1138
  }
1039
1139
  function onError(fn) {
1040
1140
  ERROR || (ERROR = Symbol("error"));
1041
- if (Owner === null) console.warn("error handlers created outside a `createRoot` or `render` will never be run");else if (Owner.context === null || !Owner.context[ERROR]) {
1141
+ if (Owner === null)
1142
+ console.warn("error handlers created outside a `createRoot` or `render` will never be run");
1143
+ else if (Owner.context === null || !Owner.context[ERROR]) {
1042
1144
  Owner.context = {
1043
1145
  ...Owner.context,
1044
1146
  [ERROR]: [fn]
@@ -1067,7 +1169,8 @@ function observable(input) {
1067
1169
  if (!(observer instanceof Object) || observer == null) {
1068
1170
  throw new TypeError("Expected the observer to be an object.");
1069
1171
  }
1070
- const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
1172
+ const handler =
1173
+ typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
1071
1174
  if (!handler) {
1072
1175
  return {
1073
1176
  unsubscribe() {}
@@ -1098,7 +1201,7 @@ function from(producer) {
1098
1201
  });
1099
1202
  if ("subscribe" in producer) {
1100
1203
  const unsub = producer.subscribe(v => set(() => v));
1101
- onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
1204
+ onCleanup(() => ("unsubscribe" in unsub ? unsub.unsubscribe() : unsub()));
1102
1205
  } else {
1103
1206
  const clean = producer(set);
1104
1207
  onCleanup(clean);
@@ -1142,8 +1245,7 @@ function mapArray(list, mapFn, options = {}) {
1142
1245
  });
1143
1246
  len = 1;
1144
1247
  }
1145
- }
1146
- else if (len === 0) {
1248
+ } else if (len === 0) {
1147
1249
  mapped = new Array(newLen);
1148
1250
  for (j = 0; j < newLen; j++) {
1149
1251
  items[j] = newItems[j];
@@ -1154,8 +1256,16 @@ function mapArray(list, mapFn, options = {}) {
1154
1256
  temp = new Array(newLen);
1155
1257
  tempdisposers = new Array(newLen);
1156
1258
  indexes && (tempIndexes = new Array(newLen));
1157
- for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);
1158
- for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
1259
+ for (
1260
+ start = 0, end = Math.min(len, newLen);
1261
+ start < end && items[start] === newItems[start];
1262
+ start++
1263
+ );
1264
+ for (
1265
+ end = len - 1, newEnd = newLen - 1;
1266
+ end >= start && newEnd >= start && items[end] === newItems[newEnd];
1267
+ end--, newEnd--
1268
+ ) {
1159
1269
  temp[newEnd] = mapped[end];
1160
1270
  tempdisposers[newEnd] = disposers[end];
1161
1271
  indexes && (tempIndexes[newEnd] = indexes[end]);
@@ -1189,7 +1299,7 @@ function mapArray(list, mapFn, options = {}) {
1189
1299
  }
1190
1300
  } else mapped[j] = createRoot(mapper);
1191
1301
  }
1192
- mapped = mapped.slice(0, len = newLen);
1302
+ mapped = mapped.slice(0, (len = newLen));
1193
1303
  items = newItems.slice(0);
1194
1304
  }
1195
1305
  return mapped;
@@ -1199,7 +1309,7 @@ function mapArray(list, mapFn, options = {}) {
1199
1309
  if (indexes) {
1200
1310
  const [s, set] = createSignal(j, {
1201
1311
  name: "index"
1202
- }) ;
1312
+ });
1203
1313
  indexes[j] = set;
1204
1314
  return mapFn(newItems[j], s);
1205
1315
  }
@@ -1258,13 +1368,13 @@ function indexArray(list, mapFn, options = {}) {
1258
1368
  }
1259
1369
  len = signals.length = disposers.length = newLen;
1260
1370
  items = newItems.slice(0);
1261
- return mapped = mapped.slice(0, len);
1371
+ return (mapped = mapped.slice(0, len));
1262
1372
  });
1263
1373
  function mapper(disposer) {
1264
1374
  disposers[i] = disposer;
1265
1375
  const [s, set] = createSignal(newItems[i], {
1266
1376
  name: "value"
1267
- }) ;
1377
+ });
1268
1378
  signals[i] = set;
1269
1379
  return mapFn(s, i);
1270
1380
  }
@@ -1280,7 +1390,7 @@ function createComponent(Comp, props) {
1280
1390
  if (sharedConfig.context) {
1281
1391
  const c = sharedConfig.context;
1282
1392
  setHydrateContext(nextHydrateContext());
1283
- const r = devComponent(Comp, props || {}) ;
1393
+ const r = devComponent(Comp, props || {});
1284
1394
  setHydrateContext(c);
1285
1395
  return r;
1286
1396
  }
@@ -1329,29 +1439,33 @@ function mergeProps(...sources) {
1329
1439
  let proxy = false;
1330
1440
  for (let i = 0; i < sources.length; i++) {
1331
1441
  const s = sources[i];
1332
- proxy = proxy || !!s && $PROXY in s;
1333
- sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
1442
+ proxy = proxy || (!!s && $PROXY in s);
1443
+ sources[i] = typeof s === "function" ? ((proxy = true), createMemo(s)) : s;
1334
1444
  }
1335
1445
  if (proxy) {
1336
- return new Proxy({
1337
- get(property) {
1338
- for (let i = sources.length - 1; i >= 0; i--) {
1339
- const v = resolveSource(sources[i])[property];
1340
- if (v !== undefined) return v;
1341
- }
1342
- },
1343
- has(property) {
1344
- for (let i = sources.length - 1; i >= 0; i--) {
1345
- if (property in resolveSource(sources[i])) return true;
1446
+ return new Proxy(
1447
+ {
1448
+ get(property) {
1449
+ for (let i = sources.length - 1; i >= 0; i--) {
1450
+ const v = resolveSource(sources[i])[property];
1451
+ if (v !== undefined) return v;
1452
+ }
1453
+ },
1454
+ has(property) {
1455
+ for (let i = sources.length - 1; i >= 0; i--) {
1456
+ if (property in resolveSource(sources[i])) return true;
1457
+ }
1458
+ return false;
1459
+ },
1460
+ keys() {
1461
+ const keys = [];
1462
+ for (let i = 0; i < sources.length; i++)
1463
+ keys.push(...Object.keys(resolveSource(sources[i])));
1464
+ return [...new Set(keys)];
1346
1465
  }
1347
- return false;
1348
1466
  },
1349
- keys() {
1350
- const keys = [];
1351
- for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
1352
- return [...new Set(keys)];
1353
- }
1354
- }, propTraps);
1467
+ propTraps
1468
+ );
1355
1469
  }
1356
1470
  const sourcesMap = {};
1357
1471
  const defined = Object.create(null);
@@ -1364,15 +1478,20 @@ function mergeProps(...sources) {
1364
1478
  if (key === "__proto__" || key === "constructor") continue;
1365
1479
  const desc = Object.getOwnPropertyDescriptor(source, key);
1366
1480
  if (!defined[key]) {
1367
- defined[key] = desc.get ? {
1368
- enumerable: true,
1369
- configurable: true,
1370
- get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
1371
- } : desc.value !== undefined ? desc : undefined;
1481
+ defined[key] = desc.get
1482
+ ? {
1483
+ enumerable: true,
1484
+ configurable: true,
1485
+ get: resolveSources.bind((sourcesMap[key] = [desc.get.bind(source)]))
1486
+ }
1487
+ : desc.value !== undefined
1488
+ ? desc
1489
+ : undefined;
1372
1490
  } else {
1373
1491
  const sources = sourcesMap[key];
1374
1492
  if (sources) {
1375
- if (desc.get) sources.push(desc.get.bind(source));else if (desc.value !== undefined) sources.push(() => desc.value);
1493
+ if (desc.get) sources.push(desc.get.bind(source));
1494
+ else if (desc.value !== undefined) sources.push(() => desc.value);
1376
1495
  }
1377
1496
  }
1378
1497
  }
@@ -1382,7 +1501,8 @@ function mergeProps(...sources) {
1382
1501
  for (let i = definedKeys.length - 1; i >= 0; i--) {
1383
1502
  const key = definedKeys[i],
1384
1503
  desc = defined[key];
1385
- if (desc && desc.get) Object.defineProperty(target, key, desc);else target[key] = desc ? desc.value : undefined;
1504
+ if (desc && desc.get) Object.defineProperty(target, key, desc);
1505
+ else target[key] = desc ? desc.value : undefined;
1386
1506
  }
1387
1507
  return target;
1388
1508
  }
@@ -1390,47 +1510,60 @@ function splitProps(props, ...keys) {
1390
1510
  if ($PROXY in props) {
1391
1511
  const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
1392
1512
  const res = keys.map(k => {
1393
- return new Proxy({
1394
- get(property) {
1395
- return k.includes(property) ? props[property] : undefined;
1396
- },
1397
- has(property) {
1398
- return k.includes(property) && property in props;
1513
+ return new Proxy(
1514
+ {
1515
+ get(property) {
1516
+ return k.includes(property) ? props[property] : undefined;
1517
+ },
1518
+ has(property) {
1519
+ return k.includes(property) && property in props;
1520
+ },
1521
+ keys() {
1522
+ return k.filter(property => property in props);
1523
+ }
1399
1524
  },
1400
- keys() {
1401
- return k.filter(property => property in props);
1402
- }
1403
- }, propTraps);
1525
+ propTraps
1526
+ );
1404
1527
  });
1405
- res.push(new Proxy({
1406
- get(property) {
1407
- return blocked.has(property) ? undefined : props[property];
1408
- },
1409
- has(property) {
1410
- return blocked.has(property) ? false : property in props;
1411
- },
1412
- keys() {
1413
- return Object.keys(props).filter(k => !blocked.has(k));
1414
- }
1415
- }, propTraps));
1528
+ res.push(
1529
+ new Proxy(
1530
+ {
1531
+ get(property) {
1532
+ return blocked.has(property) ? undefined : props[property];
1533
+ },
1534
+ has(property) {
1535
+ return blocked.has(property) ? false : property in props;
1536
+ },
1537
+ keys() {
1538
+ return Object.keys(props).filter(k => !blocked.has(k));
1539
+ }
1540
+ },
1541
+ propTraps
1542
+ )
1543
+ );
1416
1544
  return res;
1417
1545
  }
1418
1546
  const otherObject = {};
1419
1547
  const objects = keys.map(() => ({}));
1420
1548
  for (const propName of Object.getOwnPropertyNames(props)) {
1421
1549
  const desc = Object.getOwnPropertyDescriptor(props, propName);
1422
- const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1550
+ const isDefaultDesc =
1551
+ !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1423
1552
  let blocked = false;
1424
1553
  let objectIndex = 0;
1425
1554
  for (const k of keys) {
1426
1555
  if (k.includes(propName)) {
1427
1556
  blocked = true;
1428
- isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
1557
+ isDefaultDesc
1558
+ ? (objects[objectIndex][propName] = desc.value)
1559
+ : Object.defineProperty(objects[objectIndex], propName, desc);
1429
1560
  }
1430
1561
  ++objectIndex;
1431
1562
  }
1432
1563
  if (!blocked) {
1433
- isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
1564
+ isDefaultDesc
1565
+ ? (otherObject[propName] = desc.value)
1566
+ : Object.defineProperty(otherObject, propName, desc);
1434
1567
  }
1435
1568
  }
1436
1569
  return [...objects, otherObject];
@@ -1445,7 +1578,7 @@ function lazy(fn) {
1445
1578
  sharedConfig.count || (sharedConfig.count = 0);
1446
1579
  sharedConfig.count++;
1447
1580
  (p || (p = fn())).then(mod => {
1448
- setHydrateContext(ctx);
1581
+ !sharedConfig.done && setHydrateContext(ctx);
1449
1582
  sharedConfig.count--;
1450
1583
  set(() => mod.default);
1451
1584
  setHydrateContext();
@@ -1456,19 +1589,24 @@ function lazy(fn) {
1456
1589
  comp = s;
1457
1590
  }
1458
1591
  let Comp;
1459
- return createMemo(() => (Comp = comp()) && untrack(() => {
1460
- if (true) Object.assign(Comp, {
1461
- [$DEVCOMP]: true
1462
- });
1463
- if (!ctx) return Comp(props);
1464
- const c = sharedConfig.context;
1465
- setHydrateContext(ctx);
1466
- const r = Comp(props);
1467
- setHydrateContext(c);
1468
- return r;
1469
- }));
1592
+ return createMemo(() =>
1593
+ (Comp = comp())
1594
+ ? untrack(() => {
1595
+ if (true)
1596
+ Object.assign(Comp, {
1597
+ [$DEVCOMP]: true
1598
+ });
1599
+ if (!ctx || sharedConfig.done) return Comp(props);
1600
+ const c = sharedConfig.context;
1601
+ setHydrateContext(ctx);
1602
+ const r = Comp(props);
1603
+ setHydrateContext(c);
1604
+ return r;
1605
+ })
1606
+ : ""
1607
+ );
1470
1608
  };
1471
- wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
1609
+ wrap.preload = () => p || ((p = fn()).then(mod => (comp = () => mod.default)), p);
1472
1610
  return wrap;
1473
1611
  }
1474
1612
  let counter = 0;
@@ -1477,75 +1615,112 @@ function createUniqueId() {
1477
1615
  return ctx ? sharedConfig.getNextContextId() : `cl-${counter++}`;
1478
1616
  }
1479
1617
 
1480
- const narrowedError = name => `Attempting to access a stale value from <${name}> that could possibly be undefined. This may occur because you are reading the accessor returned from the component at a time where it has already been unmounted. We recommend cleaning up any stale timers or async, or reading from the initial condition.` ;
1618
+ const narrowedError = name =>
1619
+ `Attempting to access a stale value from <${name}> that could possibly be undefined. This may occur because you are reading the accessor returned from the component at a time where it has already been unmounted. We recommend cleaning up any stale timers or async, or reading from the initial condition.`;
1481
1620
  function For(props) {
1482
1621
  const fallback = "fallback" in props && {
1483
1622
  fallback: () => props.fallback
1484
1623
  };
1485
- return createMemo(mapArray(() => props.each, props.children, fallback || undefined), undefined, {
1486
- name: "value"
1487
- }) ;
1624
+ return createMemo(
1625
+ mapArray(() => props.each, props.children, fallback || undefined),
1626
+ undefined,
1627
+ {
1628
+ name: "value"
1629
+ }
1630
+ );
1488
1631
  }
1489
1632
  function Index(props) {
1490
1633
  const fallback = "fallback" in props && {
1491
1634
  fallback: () => props.fallback
1492
1635
  };
1493
- return createMemo(indexArray(() => props.each, props.children, fallback || undefined), undefined, {
1494
- name: "value"
1495
- }) ;
1636
+ return createMemo(
1637
+ indexArray(() => props.each, props.children, fallback || undefined),
1638
+ undefined,
1639
+ {
1640
+ name: "value"
1641
+ }
1642
+ );
1496
1643
  }
1497
1644
  function Show(props) {
1498
1645
  const keyed = props.keyed;
1499
1646
  const condition = createMemo(() => props.when, undefined, {
1500
- equals: (a, b) => keyed ? a === b : !a === !b,
1647
+ equals: (a, b) => (keyed ? a === b : !a === !b),
1501
1648
  name: "condition"
1502
- } );
1503
- return createMemo(() => {
1504
- const c = condition();
1505
- if (c) {
1506
- const child = props.children;
1507
- const fn = typeof child === "function" && child.length > 0;
1508
- return fn ? untrack(() => child(keyed ? c : () => {
1509
- if (!untrack(condition)) throw narrowedError("Show");
1510
- return props.when;
1511
- })) : child;
1649
+ });
1650
+ return createMemo(
1651
+ () => {
1652
+ const c = condition();
1653
+ if (c) {
1654
+ const child = props.children;
1655
+ const fn = typeof child === "function" && child.length > 0;
1656
+ return fn
1657
+ ? untrack(() =>
1658
+ child(
1659
+ keyed
1660
+ ? c
1661
+ : () => {
1662
+ if (!untrack(condition)) throw narrowedError("Show");
1663
+ return props.when;
1664
+ }
1665
+ )
1666
+ )
1667
+ : child;
1668
+ }
1669
+ return props.fallback;
1670
+ },
1671
+ undefined,
1672
+ {
1673
+ name: "value"
1512
1674
  }
1513
- return props.fallback;
1514
- }, undefined, {
1515
- name: "value"
1516
- } );
1675
+ );
1517
1676
  }
1518
1677
  function Switch(props) {
1519
1678
  let keyed = false;
1520
1679
  const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1521
1680
  const conditions = children(() => props.children),
1522
- evalConditions = createMemo(() => {
1523
- let conds = conditions();
1524
- if (!Array.isArray(conds)) conds = [conds];
1525
- for (let i = 0; i < conds.length; i++) {
1526
- const c = conds[i].when;
1527
- if (c) {
1528
- keyed = !!conds[i].keyed;
1529
- return [i, c, conds[i]];
1681
+ evalConditions = createMemo(
1682
+ () => {
1683
+ let conds = conditions();
1684
+ if (!Array.isArray(conds)) conds = [conds];
1685
+ for (let i = 0; i < conds.length; i++) {
1686
+ const c = conds[i].when;
1687
+ if (c) {
1688
+ keyed = !!conds[i].keyed;
1689
+ return [i, c, conds[i]];
1690
+ }
1530
1691
  }
1692
+ return [-1];
1693
+ },
1694
+ undefined,
1695
+ {
1696
+ equals,
1697
+ name: "eval conditions"
1531
1698
  }
1532
- return [-1];
1533
- }, undefined, {
1534
- equals,
1535
- name: "eval conditions"
1536
- } );
1537
- return createMemo(() => {
1538
- const [index, when, cond] = evalConditions();
1539
- if (index < 0) return props.fallback;
1540
- const c = cond.children;
1541
- const fn = typeof c === "function" && c.length > 0;
1542
- return fn ? untrack(() => c(keyed ? when : () => {
1543
- if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1544
- return cond.when;
1545
- })) : c;
1546
- }, undefined, {
1547
- name: "value"
1548
- } );
1699
+ );
1700
+ return createMemo(
1701
+ () => {
1702
+ const [index, when, cond] = evalConditions();
1703
+ if (index < 0) return props.fallback;
1704
+ const c = cond.children;
1705
+ const fn = typeof c === "function" && c.length > 0;
1706
+ return fn
1707
+ ? untrack(() =>
1708
+ c(
1709
+ keyed
1710
+ ? when
1711
+ : () => {
1712
+ if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1713
+ return cond.when;
1714
+ }
1715
+ )
1716
+ )
1717
+ : c;
1718
+ },
1719
+ undefined,
1720
+ {
1721
+ name: "value"
1722
+ }
1723
+ );
1549
1724
  }
1550
1725
  function Match(props) {
1551
1726
  return props;
@@ -1556,28 +1731,34 @@ function resetErrorBoundaries() {
1556
1731
  }
1557
1732
  function ErrorBoundary(props) {
1558
1733
  let err;
1559
- if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.getContextId());
1734
+ if (sharedConfig.context && sharedConfig.load)
1735
+ err = sharedConfig.load(sharedConfig.getContextId());
1560
1736
  const [errored, setErrored] = createSignal(err, {
1561
1737
  name: "errored"
1562
- } );
1738
+ });
1563
1739
  Errors || (Errors = new Set());
1564
1740
  Errors.add(setErrored);
1565
1741
  onCleanup(() => Errors.delete(setErrored));
1566
- return createMemo(() => {
1567
- let e;
1568
- if (e = errored()) {
1569
- const f = props.fallback;
1570
- if ((typeof f !== "function" || f.length == 0)) console.error(e);
1571
- return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1742
+ return createMemo(
1743
+ () => {
1744
+ let e;
1745
+ if ((e = errored())) {
1746
+ const f = props.fallback;
1747
+ if (typeof f !== "function" || f.length == 0) console.error(e);
1748
+ return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1749
+ }
1750
+ return catchError(() => props.children, setErrored);
1751
+ },
1752
+ undefined,
1753
+ {
1754
+ name: "value"
1572
1755
  }
1573
- return catchError(() => props.children, setErrored);
1574
- }, undefined, {
1575
- name: "value"
1576
- } );
1756
+ );
1577
1757
  }
1578
1758
 
1579
- const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
1580
- const SuspenseListContext = /* #__PURE__ */createContext();
1759
+ const suspenseListEquals = (a, b) =>
1760
+ a.showContent === b.showContent && a.showFallback === b.showFallback;
1761
+ const SuspenseListContext = /* #__PURE__ */ createContext();
1581
1762
  function SuspenseList(props) {
1582
1763
  let [wrapper, setWrapper] = createSignal(() => ({
1583
1764
  inFallback: false
@@ -1588,51 +1769,51 @@ function SuspenseList(props) {
1588
1769
  if (listContext) {
1589
1770
  show = listContext.register(createMemo(() => wrapper()().inFallback));
1590
1771
  }
1591
- const resolved = createMemo(prev => {
1592
- const reveal = props.revealOrder,
1593
- tail = props.tail,
1594
- {
1595
- showContent = true,
1596
- showFallback = true
1597
- } = show ? show() : {},
1598
- reg = registry(),
1599
- reverse = reveal === "backwards";
1600
- if (reveal === "together") {
1601
- const all = reg.every(inFallback => !inFallback());
1602
- const res = reg.map(() => ({
1603
- showContent: all && showContent,
1604
- showFallback
1605
- }));
1606
- res.inFallback = !all;
1607
- return res;
1608
- }
1609
- let stop = false;
1610
- let inFallback = prev.inFallback;
1611
- const res = [];
1612
- for (let i = 0, len = reg.length; i < len; i++) {
1613
- const n = reverse ? len - i - 1 : i,
1614
- s = reg[n]();
1615
- if (!stop && !s) {
1616
- res[n] = {
1617
- showContent,
1772
+ const resolved = createMemo(
1773
+ prev => {
1774
+ const reveal = props.revealOrder,
1775
+ tail = props.tail,
1776
+ { showContent = true, showFallback = true } = show ? show() : {},
1777
+ reg = registry(),
1778
+ reverse = reveal === "backwards";
1779
+ if (reveal === "together") {
1780
+ const all = reg.every(inFallback => !inFallback());
1781
+ const res = reg.map(() => ({
1782
+ showContent: all && showContent,
1618
1783
  showFallback
1619
- };
1620
- } else {
1621
- const next = !stop;
1622
- if (next) inFallback = true;
1623
- res[n] = {
1624
- showContent: next,
1625
- showFallback: !tail || next && tail === "collapsed" ? showFallback : false
1626
- };
1627
- stop = true;
1784
+ }));
1785
+ res.inFallback = !all;
1786
+ return res;
1628
1787
  }
1788
+ let stop = false;
1789
+ let inFallback = prev.inFallback;
1790
+ const res = [];
1791
+ for (let i = 0, len = reg.length; i < len; i++) {
1792
+ const n = reverse ? len - i - 1 : i,
1793
+ s = reg[n]();
1794
+ if (!stop && !s) {
1795
+ res[n] = {
1796
+ showContent,
1797
+ showFallback
1798
+ };
1799
+ } else {
1800
+ const next = !stop;
1801
+ if (next) inFallback = true;
1802
+ res[n] = {
1803
+ showContent: next,
1804
+ showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
1805
+ };
1806
+ stop = true;
1807
+ }
1808
+ }
1809
+ if (!stop) inFallback = false;
1810
+ res.inFallback = inFallback;
1811
+ return res;
1812
+ },
1813
+ {
1814
+ inFallback: false
1629
1815
  }
1630
- if (!stop) inFallback = false;
1631
- res.inFallback = inFallback;
1632
- return res;
1633
- }, {
1634
- inFallback: false
1635
- });
1816
+ );
1636
1817
  setWrapper(() => resolved);
1637
1818
  return createComponent(SuspenseListContext.Provider, {
1638
1819
  value: {
@@ -1677,23 +1858,27 @@ function Suspense(props) {
1677
1858
  const key = sharedConfig.getContextId();
1678
1859
  let ref = sharedConfig.load(key);
1679
1860
  if (ref) {
1680
- if (typeof ref !== "object" || ref.status !== "success") p = ref;else sharedConfig.gather(key);
1861
+ if (typeof ref !== "object" || ref.status !== "success") p = ref;
1862
+ else sharedConfig.gather(key);
1681
1863
  }
1682
1864
  if (p && p !== "$$f") {
1683
1865
  const [s, set] = createSignal(undefined, {
1684
1866
  equals: false
1685
1867
  });
1686
1868
  flicker = s;
1687
- p.then(() => {
1688
- if (sharedConfig.done) return set();
1689
- sharedConfig.gather(key);
1690
- setHydrateContext(ctx);
1691
- set();
1692
- setHydrateContext();
1693
- }, err => {
1694
- error = err;
1695
- set();
1696
- });
1869
+ p.then(
1870
+ () => {
1871
+ if (sharedConfig.done) return set();
1872
+ sharedConfig.gather(key);
1873
+ setHydrateContext(ctx);
1874
+ set();
1875
+ setHydrateContext();
1876
+ },
1877
+ err => {
1878
+ error = err;
1879
+ set();
1880
+ }
1881
+ );
1697
1882
  }
1698
1883
  }
1699
1884
  const listContext = useContext(SuspenseListContext);
@@ -1708,17 +1893,14 @@ function Suspense(props) {
1708
1893
  ctx = sharedConfig.context;
1709
1894
  if (flicker) {
1710
1895
  flicker();
1711
- return flicker = undefined;
1896
+ return (flicker = undefined);
1712
1897
  }
1713
1898
  if (ctx && p === "$$f") setHydrateContext();
1714
1899
  const rendered = createMemo(() => props.children);
1715
1900
  return createMemo(prev => {
1716
1901
  const inFallback = store.inFallback(),
1717
- {
1718
- showContent = true,
1719
- showFallback = true
1720
- } = show ? show() : {};
1721
- if ((!inFallback || p && p !== "$$f") && showContent) {
1902
+ { showContent = true, showFallback = true } = show ? show() : {};
1903
+ if ((!inFallback || (p && p !== "$$f")) && showContent) {
1722
1904
  store.resolved = true;
1723
1905
  dispose && dispose();
1724
1906
  dispose = ctx = p = undefined;
@@ -1748,9 +1930,68 @@ const DEV = {
1748
1930
  hooks: DevHooks,
1749
1931
  writeSignal,
1750
1932
  registerGraph
1751
- } ;
1933
+ };
1752
1934
  if (globalThis) {
1753
- if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
1935
+ if (!globalThis.Solid$$) globalThis.Solid$$ = true;
1936
+ else
1937
+ console.warn(
1938
+ "You appear to have multiple instances of Solid. This can lead to unexpected behavior."
1939
+ );
1754
1940
  }
1755
1941
 
1756
- 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 };
1942
+ export {
1943
+ $DEVCOMP,
1944
+ $PROXY,
1945
+ $TRACK,
1946
+ DEV,
1947
+ ErrorBoundary,
1948
+ For,
1949
+ Index,
1950
+ Match,
1951
+ Show,
1952
+ Suspense,
1953
+ SuspenseList,
1954
+ Switch,
1955
+ batch,
1956
+ cancelCallback,
1957
+ catchError,
1958
+ children,
1959
+ createComponent,
1960
+ createComputed,
1961
+ createContext,
1962
+ createDeferred,
1963
+ createEffect,
1964
+ createMemo,
1965
+ createReaction,
1966
+ createRenderEffect,
1967
+ createResource,
1968
+ createRoot,
1969
+ createSelector,
1970
+ createSignal,
1971
+ createUniqueId,
1972
+ enableExternalSource,
1973
+ enableHydration,
1974
+ enableScheduling,
1975
+ equalFn,
1976
+ from,
1977
+ getListener,
1978
+ getOwner,
1979
+ indexArray,
1980
+ lazy,
1981
+ mapArray,
1982
+ mergeProps,
1983
+ observable,
1984
+ on,
1985
+ onCleanup,
1986
+ onError,
1987
+ onMount,
1988
+ requestCallback,
1989
+ resetErrorBoundaries,
1990
+ runWithOwner,
1991
+ sharedConfig,
1992
+ splitProps,
1993
+ startTransition,
1994
+ untrack,
1995
+ useContext,
1996
+ useTransition
1997
+ };