solid-js 1.8.8 → 1.8.10

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 (51) hide show
  1. package/dist/dev.cjs +17 -21
  2. package/dist/dev.js +554 -321
  3. package/dist/server.js +170 -75
  4. package/dist/solid.cjs +17 -21
  5. package/dist/solid.js +481 -279
  6. package/h/dist/h.js +34 -8
  7. package/h/jsx-runtime/dist/jsx.js +1 -1
  8. package/h/jsx-runtime/types/index.d.ts +11 -8
  9. package/h/jsx-runtime/types/jsx.d.ts +2 -1
  10. package/h/types/hyperscript.d.ts +11 -11
  11. package/html/dist/html.js +216 -94
  12. package/html/types/lit.d.ts +47 -33
  13. package/package.json +3 -2
  14. package/store/dist/dev.cjs +1 -1
  15. package/store/dist/dev.js +117 -42
  16. package/store/dist/server.js +19 -8
  17. package/store/dist/store.cjs +1 -1
  18. package/store/dist/store.js +108 -39
  19. package/store/types/index.d.ts +21 -7
  20. package/store/types/modifiers.d.ts +6 -3
  21. package/store/types/mutable.d.ts +5 -2
  22. package/store/types/server.d.ts +12 -4
  23. package/store/types/store.d.ts +218 -61
  24. package/types/index.d.ts +75 -10
  25. package/types/jsx.d.ts +2 -1
  26. package/types/reactive/array.d.ts +12 -4
  27. package/types/reactive/observable.d.ts +25 -17
  28. package/types/reactive/scheduler.d.ts +9 -6
  29. package/types/reactive/signal.d.ts +233 -142
  30. package/types/render/Suspense.d.ts +5 -5
  31. package/types/render/component.d.ts +64 -33
  32. package/types/render/flow.d.ts +43 -31
  33. package/types/render/hydration.d.ts +13 -13
  34. package/types/server/index.d.ts +57 -2
  35. package/types/server/reactive.d.ts +73 -42
  36. package/types/server/rendering.d.ts +167 -96
  37. package/universal/dist/dev.js +28 -12
  38. package/universal/dist/universal.js +28 -12
  39. package/universal/types/index.d.ts +3 -1
  40. package/universal/types/universal.d.ts +0 -1
  41. package/web/dist/dev.cjs +1 -1
  42. package/web/dist/dev.js +621 -82
  43. package/web/dist/server.cjs +53 -42
  44. package/web/dist/server.js +244 -127
  45. package/web/dist/storage.js +3 -3
  46. package/web/dist/web.cjs +1 -1
  47. package/web/dist/web.js +615 -81
  48. package/web/types/client.d.ts +2 -2
  49. package/web/types/core.d.ts +10 -1
  50. package/web/types/index.d.ts +27 -10
  51. 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
  }
@@ -165,20 +167,25 @@ function createRoot(fn, detachedOwner) {
165
167
  owner = Owner,
166
168
  unowned = fn.length === 0,
167
169
  current = detachedOwner === undefined ? owner : detachedOwner,
168
- root = unowned ? {
169
- owned: null,
170
- cleanups: null,
171
- context: null,
172
- owner: null
173
- } : {
174
- owned: null,
175
- cleanups: null,
176
- context: current ? current.context : null,
177
- owner: current
178
- },
179
- updateFn = unowned ? () => fn(() => {
180
- throw new Error("Dispose method must be an explicit argument to createRoot function");
181
- }) : () => fn(() => untrack(() => cleanNode(root)));
170
+ root = unowned
171
+ ? {
172
+ owned: null,
173
+ cleanups: null,
174
+ context: null,
175
+ owner: null
176
+ }
177
+ : {
178
+ owned: null,
179
+ cleanups: null,
180
+ context: current ? current.context : null,
181
+ owner: current
182
+ },
183
+ updateFn = unowned
184
+ ? () =>
185
+ fn(() => {
186
+ throw new Error("Dispose method must be an explicit argument to createRoot function");
187
+ })
188
+ : () => fn(() => untrack(() => cleanNode(root)));
182
189
  DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(root);
183
190
  Owner = root;
184
191
  Listener = null;
@@ -204,23 +211,26 @@ function createSignal(value, options) {
204
211
  }
205
212
  const setter = value => {
206
213
  if (typeof value === "function") {
207
- if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
214
+ if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
215
+ else value = value(s.value);
208
216
  }
209
217
  return writeSignal(s, value);
210
218
  };
211
219
  return [readSignal.bind(s), setter];
212
220
  }
213
221
  function createComputed(fn, value, options) {
214
- const c = createComputation(fn, value, true, STALE, options );
215
- if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
222
+ const c = createComputation(fn, value, true, STALE, options);
223
+ if (Scheduler && Transition && Transition.running) Updates.push(c);
224
+ else updateComputation(c);
216
225
  }
217
226
  function createRenderEffect(fn, value, options) {
218
- const c = createComputation(fn, value, false, STALE, options );
219
- if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
227
+ const c = createComputation(fn, value, false, STALE, options);
228
+ if (Scheduler && Transition && Transition.running) Updates.push(c);
229
+ else updateComputation(c);
220
230
  }
221
231
  function createEffect(fn, value, options) {
222
232
  runEffects = runUserEffects;
223
- const c = createComputation(fn, value, false, STALE, options ),
233
+ const c = createComputation(fn, value, false, STALE, options),
224
234
  s = SuspenseContext && useContext(SuspenseContext);
225
235
  if (s) c.suspense = s;
226
236
  if (!options || !options.render) c.user = true;
@@ -228,10 +238,16 @@ function createEffect(fn, value, options) {
228
238
  }
229
239
  function createReaction(onInvalidate, options) {
230
240
  let fn;
231
- const c = createComputation(() => {
232
- fn ? fn() : untrack(onInvalidate);
233
- fn = undefined;
234
- }, undefined, false, 0, options ),
241
+ const c = createComputation(
242
+ () => {
243
+ fn ? fn() : untrack(onInvalidate);
244
+ fn = undefined;
245
+ },
246
+ undefined,
247
+ false,
248
+ 0,
249
+ options
250
+ ),
235
251
  s = SuspenseContext && useContext(SuspenseContext);
236
252
  if (s) c.suspense = s;
237
253
  c.user = true;
@@ -242,7 +258,7 @@ function createReaction(onInvalidate, options) {
242
258
  }
243
259
  function createMemo(fn, value, options) {
244
260
  options = options ? Object.assign({}, signalOptions, options) : signalOptions;
245
- const c = createComputation(fn, value, true, 0, options );
261
+ const c = createComputation(fn, value, true, 0, options);
246
262
  c.observers = null;
247
263
  c.observerSlots = null;
248
264
  c.comparator = options.equals || undefined;
@@ -259,7 +275,7 @@ function createResource(pSource, pFetcher, pOptions) {
259
275
  let source;
260
276
  let fetcher;
261
277
  let options;
262
- if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
278
+ if ((arguments.length === 2 && typeof pFetcher === "object") || arguments.length === 1) {
263
279
  source = true;
264
280
  fetcher = pSource;
265
281
  options = pFetcher || {};
@@ -273,7 +289,7 @@ function createResource(pSource, pFetcher, pOptions) {
273
289
  id = null,
274
290
  loadedUnderTransition = false,
275
291
  scheduled = false,
276
- resolved = ("initialValue" in options),
292
+ resolved = "initialValue" in options,
277
293
  dynamic = typeof source === "function" && createMemo(source);
278
294
  const contexts = new Set(),
279
295
  [value, setValue] = (options.storage || createSignal)(options.initialValue),
@@ -285,15 +301,19 @@ function createResource(pSource, pFetcher, pOptions) {
285
301
  if (sharedConfig.context) {
286
302
  id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
287
303
  let v;
288
- if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
304
+ if (options.ssrLoadFrom === "initial") initP = options.initialValue;
305
+ else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
289
306
  }
290
307
  function loadEnd(p, v, error, key) {
291
308
  if (pr === p) {
292
309
  pr = null;
293
310
  key !== undefined && (resolved = true);
294
- if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
295
- value: v
296
- }));
311
+ if ((p === initP || v === initP) && options.onHydrated)
312
+ queueMicrotask(() =>
313
+ options.onHydrated(key, {
314
+ value: v
315
+ })
316
+ );
297
317
  initP = NO_INIT;
298
318
  if (Transition && p && loadedUnderTransition) {
299
319
  Transition.promises.delete(p);
@@ -324,7 +344,8 @@ function createResource(pSource, pFetcher, pOptions) {
324
344
  createComputed(() => {
325
345
  track();
326
346
  if (pr) {
327
- if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) {
347
+ if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
348
+ else if (!contexts.has(c)) {
328
349
  c.increment();
329
350
  contexts.add(c);
330
351
  }
@@ -343,26 +364,35 @@ function createResource(pSource, pFetcher, pOptions) {
343
364
  return;
344
365
  }
345
366
  if (Transition && pr) Transition.promises.delete(pr);
346
- const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {
347
- value: value(),
348
- refetching
349
- }));
367
+ const p =
368
+ initP !== NO_INIT
369
+ ? initP
370
+ : untrack(() =>
371
+ fetcher(lookup, {
372
+ value: value(),
373
+ refetching
374
+ })
375
+ );
350
376
  if (!isPromise(p)) {
351
377
  loadEnd(pr, p, undefined, lookup);
352
378
  return p;
353
379
  }
354
380
  pr = p;
355
381
  if ("value" in p) {
356
- if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);else loadEnd(pr, undefined, undefined, lookup);
382
+ if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);
383
+ else loadEnd(pr, undefined, undefined, lookup);
357
384
  return p;
358
385
  }
359
386
  scheduled = true;
360
- queueMicrotask(() => scheduled = false);
387
+ queueMicrotask(() => (scheduled = false));
361
388
  runUpdates(() => {
362
389
  setState(resolved ? "refreshing" : "pending");
363
390
  trigger();
364
391
  }, false);
365
- return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));
392
+ return p.then(
393
+ v => loadEnd(p, v, undefined, lookup),
394
+ e => loadEnd(p, undefined, castError(e), lookup)
395
+ );
366
396
  }
367
397
  Object.defineProperties(read, {
368
398
  state: {
@@ -386,50 +416,81 @@ function createResource(pSource, pFetcher, pOptions) {
386
416
  }
387
417
  }
388
418
  });
389
- if (dynamic) createComputed(() => load(false));else load(false);
390
- return [read, {
391
- refetch: load,
392
- mutate: setValue
393
- }];
419
+ if (dynamic) createComputed(() => load(false));
420
+ else load(false);
421
+ return [
422
+ read,
423
+ {
424
+ refetch: load,
425
+ mutate: setValue
426
+ }
427
+ ];
394
428
  }
395
429
  function createDeferred(source, options) {
396
430
  let t,
397
431
  timeout = options ? options.timeoutMs : undefined;
398
- const node = createComputation(() => {
399
- if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
400
- timeout
401
- } : undefined);
402
- return source();
403
- }, undefined, true);
404
- const [deferred, setDeferred] = createSignal(Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, options);
432
+ const node = createComputation(
433
+ () => {
434
+ if (!t || !t.fn)
435
+ t = requestCallback(
436
+ () => setDeferred(() => node.value),
437
+ timeout !== undefined
438
+ ? {
439
+ timeout
440
+ }
441
+ : undefined
442
+ );
443
+ return source();
444
+ },
445
+ undefined,
446
+ true
447
+ );
448
+ const [deferred, setDeferred] = createSignal(
449
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
450
+ options
451
+ );
405
452
  updateComputation(node);
406
- setDeferred(() => Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
453
+ setDeferred(() =>
454
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
455
+ );
407
456
  return deferred;
408
457
  }
409
458
  function createSelector(source, fn = equalFn, options) {
410
459
  const subs = new Map();
411
- const node = createComputation(p => {
412
- const v = source();
413
- for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
414
- for (const c of val.values()) {
415
- c.state = STALE;
416
- if (c.pure) Updates.push(c);else Effects.push(c);
417
- }
418
- }
419
- return v;
420
- }, undefined, true, STALE, options );
460
+ const node = createComputation(
461
+ p => {
462
+ const v = source();
463
+ for (const [key, val] of subs.entries())
464
+ if (fn(key, v) !== fn(key, p)) {
465
+ for (const c of val.values()) {
466
+ c.state = STALE;
467
+ if (c.pure) Updates.push(c);
468
+ else Effects.push(c);
469
+ }
470
+ }
471
+ return v;
472
+ },
473
+ undefined,
474
+ true,
475
+ STALE,
476
+ options
477
+ );
421
478
  updateComputation(node);
422
479
  return key => {
423
480
  const listener = Listener;
424
481
  if (listener) {
425
482
  let l;
426
- if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
483
+ if ((l = subs.get(key))) l.add(listener);
484
+ else subs.set(key, (l = new Set([listener])));
427
485
  onCleanup(() => {
428
486
  l.delete(listener);
429
487
  !l.size && subs.delete(key);
430
488
  });
431
489
  }
432
- return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
490
+ return fn(
491
+ key,
492
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
493
+ );
433
494
  };
434
495
  }
435
496
  function batch(fn) {
@@ -469,7 +530,10 @@ function onMount(fn) {
469
530
  createEffect(() => untrack(fn));
470
531
  }
471
532
  function onCleanup(fn) {
472
- 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);
533
+ if (Owner === null)
534
+ console.warn("cleanups created outside a `createRoot` or `render` will never be run");
535
+ else if (Owner.cleanups === null) Owner.cleanups = [fn];
536
+ else Owner.cleanups.push(fn);
473
537
  return fn;
474
538
  }
475
539
  function catchError(fn, handler) {
@@ -523,15 +587,17 @@ function startTransition(fn) {
523
587
  Owner = o;
524
588
  let t;
525
589
  if (Scheduler || SuspenseContext) {
526
- t = Transition || (Transition = {
527
- sources: new Set(),
528
- effects: [],
529
- promises: new Set(),
530
- disposed: new Set(),
531
- queue: new Set(),
532
- running: true
533
- });
534
- t.done || (t.done = new Promise(res => t.resolve = res));
590
+ t =
591
+ Transition ||
592
+ (Transition = {
593
+ sources: new Set(),
594
+ effects: [],
595
+ promises: new Set(),
596
+ disposed: new Set(),
597
+ queue: new Set(),
598
+ running: true
599
+ });
600
+ t.done || (t.done = new Promise(res => (t.resolve = res)));
535
601
  t.running = true;
536
602
  }
537
603
  runUpdates(fn, false);
@@ -539,7 +605,7 @@ function startTransition(fn) {
539
605
  return t ? t.done : undefined;
540
606
  });
541
607
  }
542
- const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
608
+ const [transPending, setTransPending] = /*@__PURE__*/ createSignal(false);
543
609
  function useTransition() {
544
610
  return [transPending, startTransition];
545
611
  }
@@ -548,12 +614,18 @@ function resumeEffects(e) {
548
614
  e.length = 0;
549
615
  }
550
616
  function devComponent(Comp, props) {
551
- const c = createComputation(() => untrack(() => {
552
- Object.assign(Comp, {
553
- [$DEVCOMP]: true
554
- });
555
- return Comp(props);
556
- }), undefined, true, 0);
617
+ const c = createComputation(
618
+ () =>
619
+ untrack(() => {
620
+ Object.assign(Comp, {
621
+ [$DEVCOMP]: true
622
+ });
623
+ return Comp(props);
624
+ }),
625
+ undefined,
626
+ true,
627
+ 0
628
+ );
557
629
  c.props = props;
558
630
  c.observers = null;
559
631
  c.observerSlots = null;
@@ -564,7 +636,8 @@ function devComponent(Comp, props) {
564
636
  }
565
637
  function registerGraph(value) {
566
638
  if (!Owner) return;
567
- if (Owner.sourceMap) Owner.sourceMap.push(value);else Owner.sourceMap = [value];
639
+ if (Owner.sourceMap) Owner.sourceMap.push(value);
640
+ else Owner.sourceMap = [value];
568
641
  value.graph = Owner;
569
642
  }
570
643
  function createContext(defaultValue, options) {
@@ -576,13 +649,15 @@ function createContext(defaultValue, options) {
576
649
  };
577
650
  }
578
651
  function useContext(context) {
579
- return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;
652
+ return Owner && Owner.context && Owner.context[context.id] !== undefined
653
+ ? Owner.context[context.id]
654
+ : context.defaultValue;
580
655
  }
581
656
  function children(fn) {
582
657
  const children = createMemo(fn);
583
658
  const memo = createMemo(() => resolveChildren(children()), undefined, {
584
659
  name: "children"
585
- }) ;
660
+ });
586
661
  memo.toArray = () => {
587
662
  const c = memo();
588
663
  return Array.isArray(c) ? c : c != null ? [c] : [];
@@ -595,10 +670,7 @@ function getSuspenseContext() {
595
670
  }
596
671
  function enableExternalSource(factory, untrack = fn => fn()) {
597
672
  if (ExternalSourceConfig) {
598
- const {
599
- factory: oldFactory,
600
- untrack: oldUntrack
601
- } = ExternalSourceConfig;
673
+ const { factory: oldFactory, untrack: oldUntrack } = ExternalSourceConfig;
602
674
  ExternalSourceConfig = {
603
675
  factory: (fn, trigger) => {
604
676
  const oldSource = oldFactory(fn, trigger);
@@ -623,7 +695,8 @@ function enableExternalSource(factory, untrack = fn => fn()) {
623
695
  function readSignal() {
624
696
  const runningTransition = Transition && Transition.running;
625
697
  if (this.sources && (runningTransition ? this.tState : this.state)) {
626
- if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
698
+ if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
699
+ else {
627
700
  const updates = Updates;
628
701
  Updates = null;
629
702
  runUpdates(() => lookUpstream(this), false);
@@ -651,11 +724,12 @@ function readSignal() {
651
724
  return this.value;
652
725
  }
653
726
  function writeSignal(node, value, isComp) {
654
- let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
727
+ let current =
728
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
655
729
  if (!node.comparator || !node.comparator(current, value)) {
656
730
  if (Transition) {
657
731
  const TransitionRunning = Transition.running;
658
- if (TransitionRunning || !isComp && Transition.sources.has(node)) {
732
+ if (TransitionRunning || (!isComp && Transition.sources.has(node))) {
659
733
  Transition.sources.add(node);
660
734
  node.tValue = value;
661
735
  }
@@ -668,10 +742,12 @@ function writeSignal(node, value, isComp) {
668
742
  const TransitionRunning = Transition && Transition.running;
669
743
  if (TransitionRunning && Transition.disposed.has(o)) continue;
670
744
  if (TransitionRunning ? !o.tState : !o.state) {
671
- if (o.pure) Updates.push(o);else Effects.push(o);
745
+ if (o.pure) Updates.push(o);
746
+ else Effects.push(o);
672
747
  if (o.observers) markDownstream(o);
673
748
  }
674
- if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
749
+ if (!TransitionRunning) o.state = STALE;
750
+ else o.tState = STALE;
675
751
  }
676
752
  if (Updates.length > 10e5) {
677
753
  Updates = [];
@@ -687,7 +763,11 @@ function updateComputation(node) {
687
763
  if (!node.fn) return;
688
764
  cleanNode(node);
689
765
  const time = ExecCount;
690
- runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
766
+ runComputation(
767
+ node,
768
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
769
+ time
770
+ );
691
771
  if (Transition && !Transition.running && Transition.sources.has(node)) {
692
772
  queueMicrotask(() => {
693
773
  runUpdates(() => {
@@ -752,11 +832,15 @@ function createComputation(fn, init, pure, state = STALE, options) {
752
832
  c.state = 0;
753
833
  c.tState = state;
754
834
  }
755
- if (Owner === null) console.warn("computations created outside a `createRoot` or `render` will never be disposed");else if (Owner !== UNOWNED) {
835
+ if (Owner === null)
836
+ console.warn("computations created outside a `createRoot` or `render` will never be disposed");
837
+ else if (Owner !== UNOWNED) {
756
838
  if (Transition && Transition.running && Owner.pure) {
757
- if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);
839
+ if (!Owner.tOwned) Owner.tOwned = [c];
840
+ else Owner.tOwned.push(c);
758
841
  } else {
759
- if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
842
+ if (!Owner.owned) Owner.owned = [c];
843
+ else Owner.owned.push(c);
760
844
  }
761
845
  }
762
846
  if (options && options.name) c.name = options.name;
@@ -809,7 +893,8 @@ function runUpdates(fn, init) {
809
893
  if (Updates) return fn();
810
894
  let wait = false;
811
895
  if (!init) Updates = [];
812
- if (Effects) wait = true;else Effects = [];
896
+ if (Effects) wait = true;
897
+ else Effects = [];
813
898
  ExecCount++;
814
899
  try {
815
900
  const res = fn();
@@ -823,7 +908,8 @@ function runUpdates(fn, init) {
823
908
  }
824
909
  function completeUpdates(wait) {
825
910
  if (Updates) {
826
- if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);
911
+ if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
912
+ else runQueue(Updates);
827
913
  Updates = null;
828
914
  }
829
915
  if (wait) return;
@@ -863,7 +949,8 @@ function completeUpdates(wait) {
863
949
  }
864
950
  const e = Effects;
865
951
  Effects = null;
866
- if (e.length) runUpdates(() => runEffects(e), false);else DevHooks.afterUpdate && DevHooks.afterUpdate();
952
+ if (e.length) runUpdates(() => runEffects(e), false);
953
+ else DevHooks.afterUpdate && DevHooks.afterUpdate();
867
954
  if (res) res();
868
955
  }
869
956
  function runQueue(queue) {
@@ -891,7 +978,8 @@ function runUserEffects(queue) {
891
978
  userLength = 0;
892
979
  for (i = 0; i < queue.length; i++) {
893
980
  const e = queue[i];
894
- if (!e.user) runTop(e);else queue[userLength++] = e;
981
+ if (!e.user) runTop(e);
982
+ else queue[userLength++] = e;
895
983
  }
896
984
  if (sharedConfig.context) {
897
985
  if (sharedConfig.count) {
@@ -909,13 +997,15 @@ function runUserEffects(queue) {
909
997
  }
910
998
  function lookUpstream(node, ignore) {
911
999
  const runningTransition = Transition && Transition.running;
912
- if (runningTransition) node.tState = 0;else node.state = 0;
1000
+ if (runningTransition) node.tState = 0;
1001
+ else node.state = 0;
913
1002
  for (let i = 0; i < node.sources.length; i += 1) {
914
1003
  const source = node.sources[i];
915
1004
  if (source.sources) {
916
1005
  const state = runningTransition ? source.tState : source.state;
917
1006
  if (state === STALE) {
918
- if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
1007
+ if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
1008
+ runTop(source);
919
1009
  } else if (state === PENDING) lookUpstream(source, ignore);
920
1010
  }
921
1011
  }
@@ -925,8 +1015,10 @@ function markDownstream(node) {
925
1015
  for (let i = 0; i < node.observers.length; i += 1) {
926
1016
  const o = node.observers[i];
927
1017
  if (runningTransition ? !o.tState : !o.state) {
928
- if (runningTransition) o.tState = PENDING;else o.state = PENDING;
929
- if (o.pure) Updates.push(o);else Effects.push(o);
1018
+ if (runningTransition) o.tState = PENDING;
1019
+ else o.state = PENDING;
1020
+ if (o.pure) Updates.push(o);
1021
+ else Effects.push(o);
930
1022
  o.observers && markDownstream(o);
931
1023
  }
932
1024
  }
@@ -963,7 +1055,8 @@ function cleanNode(node) {
963
1055
  for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
964
1056
  node.cleanups = null;
965
1057
  }
966
- if (Transition && Transition.running) node.tState = 0;else node.state = 0;
1058
+ if (Transition && Transition.running) node.tState = 0;
1059
+ else node.state = 0;
967
1060
  delete node.sourceMap;
968
1061
  }
969
1062
  function reset(node, top) {
@@ -985,19 +1078,21 @@ function runErrors(err, fns, owner) {
985
1078
  try {
986
1079
  for (const f of fns) f(err);
987
1080
  } catch (e) {
988
- handleError(e, owner && owner.owner || null);
1081
+ handleError(e, (owner && owner.owner) || null);
989
1082
  }
990
1083
  }
991
1084
  function handleError(err, owner = Owner) {
992
1085
  const fns = ERROR && owner && owner.context && owner.context[ERROR];
993
1086
  const error = castError(err);
994
1087
  if (!fns) throw error;
995
- if (Effects) Effects.push({
996
- fn() {
997
- runErrors(error, fns, owner);
998
- },
999
- state: STALE
1000
- });else runErrors(error, fns, owner);
1088
+ if (Effects)
1089
+ Effects.push({
1090
+ fn() {
1091
+ runErrors(error, fns, owner);
1092
+ },
1093
+ state: STALE
1094
+ });
1095
+ else runErrors(error, fns, owner);
1001
1096
  }
1002
1097
  function resolveChildren(children) {
1003
1098
  if (typeof children === "function" && !children.length) return resolveChildren(children());
@@ -1014,19 +1109,26 @@ function resolveChildren(children) {
1014
1109
  function createProvider(id, options) {
1015
1110
  return function provider(props) {
1016
1111
  let res;
1017
- createRenderEffect(() => res = untrack(() => {
1018
- Owner.context = {
1019
- ...Owner.context,
1020
- [id]: props.value
1021
- };
1022
- return children(() => props.children);
1023
- }), undefined, options);
1112
+ createRenderEffect(
1113
+ () =>
1114
+ (res = untrack(() => {
1115
+ Owner.context = {
1116
+ ...Owner.context,
1117
+ [id]: props.value
1118
+ };
1119
+ return children(() => props.children);
1120
+ })),
1121
+ undefined,
1122
+ options
1123
+ );
1024
1124
  return res;
1025
1125
  };
1026
1126
  }
1027
1127
  function onError(fn) {
1028
1128
  ERROR || (ERROR = Symbol("error"));
1029
- 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]) {
1129
+ if (Owner === null)
1130
+ console.warn("error handlers created outside a `createRoot` or `render` will never be run");
1131
+ else if (Owner.context === null || !Owner.context[ERROR]) {
1030
1132
  Owner.context = {
1031
1133
  ...Owner.context,
1032
1134
  [ERROR]: [fn]
@@ -1055,7 +1157,8 @@ function observable(input) {
1055
1157
  if (!(observer instanceof Object) || observer == null) {
1056
1158
  throw new TypeError("Expected the observer to be an object.");
1057
1159
  }
1058
- const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
1160
+ const handler =
1161
+ typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
1059
1162
  if (!handler) {
1060
1163
  return {
1061
1164
  unsubscribe() {}
@@ -1086,7 +1189,7 @@ function from(producer) {
1086
1189
  });
1087
1190
  if ("subscribe" in producer) {
1088
1191
  const unsub = producer.subscribe(v => set(() => v));
1089
- onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
1192
+ onCleanup(() => ("unsubscribe" in unsub ? unsub.unsubscribe() : unsub()));
1090
1193
  } else {
1091
1194
  const clean = producer(set);
1092
1195
  onCleanup(clean);
@@ -1138,8 +1241,7 @@ function mapArray(list, mapFn, options = {}) {
1138
1241
  });
1139
1242
  len = 1;
1140
1243
  }
1141
- }
1142
- else if (len === 0) {
1244
+ } else if (len === 0) {
1143
1245
  mapped = new Array(newLen);
1144
1246
  for (j = 0; j < newLen; j++) {
1145
1247
  items[j] = newItems[j];
@@ -1150,8 +1252,16 @@ function mapArray(list, mapFn, options = {}) {
1150
1252
  temp = new Array(newLen);
1151
1253
  tempdisposers = new Array(newLen);
1152
1254
  indexes && (tempIndexes = new Array(newLen));
1153
- for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);
1154
- for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
1255
+ for (
1256
+ start = 0, end = Math.min(len, newLen);
1257
+ start < end && items[start] === newItems[start];
1258
+ start++
1259
+ );
1260
+ for (
1261
+ end = len - 1, newEnd = newLen - 1;
1262
+ end >= start && newEnd >= start && items[end] === newItems[newEnd];
1263
+ end--, newEnd--
1264
+ ) {
1155
1265
  temp[newEnd] = mapped[end];
1156
1266
  tempdisposers[newEnd] = disposers[end];
1157
1267
  indexes && (tempIndexes[newEnd] = indexes[end]);
@@ -1185,7 +1295,7 @@ function mapArray(list, mapFn, options = {}) {
1185
1295
  }
1186
1296
  } else mapped[j] = createRoot(mapper);
1187
1297
  }
1188
- mapped = mapped.slice(0, len = newLen);
1298
+ mapped = mapped.slice(0, (len = newLen));
1189
1299
  items = newItems.slice(0);
1190
1300
  }
1191
1301
  return mapped;
@@ -1195,7 +1305,7 @@ function mapArray(list, mapFn, options = {}) {
1195
1305
  if (indexes) {
1196
1306
  const [s, set] = createSignal(j, {
1197
1307
  name: "index"
1198
- }) ;
1308
+ });
1199
1309
  indexes[j] = set;
1200
1310
  return mapFn(newItems[j], s);
1201
1311
  }
@@ -1253,13 +1363,13 @@ function indexArray(list, mapFn, options = {}) {
1253
1363
  }
1254
1364
  len = signals.length = disposers.length = newItems.length;
1255
1365
  items = newItems.slice(0);
1256
- return mapped = mapped.slice(0, len);
1366
+ return (mapped = mapped.slice(0, len));
1257
1367
  });
1258
1368
  function mapper(disposer) {
1259
1369
  disposers[i] = disposer;
1260
1370
  const [s, set] = createSignal(newItems[i], {
1261
1371
  name: "value"
1262
- }) ;
1372
+ });
1263
1373
  signals[i] = set;
1264
1374
  return mapFn(s, i);
1265
1375
  }
@@ -1275,7 +1385,7 @@ function createComponent(Comp, props) {
1275
1385
  if (sharedConfig.context) {
1276
1386
  const c = sharedConfig.context;
1277
1387
  setHydrateContext(nextHydrateContext());
1278
- const r = devComponent(Comp, props || {}) ;
1388
+ const r = devComponent(Comp, props || {});
1279
1389
  setHydrateContext(c);
1280
1390
  return r;
1281
1391
  }
@@ -1324,112 +1434,131 @@ function mergeProps(...sources) {
1324
1434
  let proxy = false;
1325
1435
  for (let i = 0; i < sources.length; i++) {
1326
1436
  const s = sources[i];
1327
- proxy = proxy || !!s && $PROXY in s;
1328
- sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
1437
+ proxy = proxy || (!!s && $PROXY in s);
1438
+ sources[i] = typeof s === "function" ? ((proxy = true), createMemo(s)) : s;
1329
1439
  }
1330
1440
  if (proxy) {
1331
- return new Proxy({
1332
- get(property) {
1333
- for (let i = sources.length - 1; i >= 0; i--) {
1334
- const v = resolveSource(sources[i])[property];
1335
- if (v !== undefined) return v;
1336
- }
1337
- },
1338
- has(property) {
1339
- for (let i = sources.length - 1; i >= 0; i--) {
1340
- if (property in resolveSource(sources[i])) return true;
1441
+ return new Proxy(
1442
+ {
1443
+ get(property) {
1444
+ for (let i = sources.length - 1; i >= 0; i--) {
1445
+ const v = resolveSource(sources[i])[property];
1446
+ if (v !== undefined) return v;
1447
+ }
1448
+ },
1449
+ has(property) {
1450
+ for (let i = sources.length - 1; i >= 0; i--) {
1451
+ if (property in resolveSource(sources[i])) return true;
1452
+ }
1453
+ return false;
1454
+ },
1455
+ keys() {
1456
+ const keys = [];
1457
+ for (let i = 0; i < sources.length; i++)
1458
+ keys.push(...Object.keys(resolveSource(sources[i])));
1459
+ return [...new Set(keys)];
1341
1460
  }
1342
- return false;
1343
1461
  },
1344
- keys() {
1345
- const keys = [];
1346
- for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
1347
- return [...new Set(keys)];
1348
- }
1349
- }, propTraps);
1462
+ propTraps
1463
+ );
1350
1464
  }
1351
- const target = {};
1352
1465
  const sourcesMap = {};
1353
- const defined = new Set();
1466
+ const defined = Object.create(null);
1354
1467
  for (let i = sources.length - 1; i >= 0; i--) {
1355
1468
  const source = sources[i];
1356
1469
  if (!source) continue;
1357
1470
  const sourceKeys = Object.getOwnPropertyNames(source);
1358
- for (let i = 0, length = sourceKeys.length; i < length; i++) {
1471
+ for (let i = sourceKeys.length - 1; i >= 0; i--) {
1359
1472
  const key = sourceKeys[i];
1360
1473
  if (key === "__proto__" || key === "constructor") continue;
1361
1474
  const desc = Object.getOwnPropertyDescriptor(source, key);
1362
- if (!defined.has(key)) {
1363
- if (desc.get) {
1364
- defined.add(key);
1365
- Object.defineProperty(target, key, {
1366
- enumerable: true,
1367
- configurable: true,
1368
- get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
1369
- });
1370
- } else {
1371
- if (desc.value !== undefined) defined.add(key);
1372
- target[key] = desc.value;
1373
- }
1475
+ if (!defined[key]) {
1476
+ defined[key] = desc.get
1477
+ ? {
1478
+ enumerable: true,
1479
+ configurable: true,
1480
+ get: resolveSources.bind((sourcesMap[key] = [desc.get.bind(source)]))
1481
+ }
1482
+ : desc.value !== undefined
1483
+ ? desc
1484
+ : undefined;
1374
1485
  } else {
1375
1486
  const sources = sourcesMap[key];
1376
1487
  if (sources) {
1377
- if (desc.get) {
1378
- sources.push(desc.get.bind(source));
1379
- } else if (desc.value !== undefined) {
1380
- sources.push(() => desc.value);
1381
- }
1382
- } else if (target[key] === undefined) target[key] = desc.value;
1488
+ if (desc.get) sources.push(desc.get.bind(source));
1489
+ else if (desc.value !== undefined) sources.push(() => desc.value);
1490
+ }
1383
1491
  }
1384
1492
  }
1385
1493
  }
1494
+ const target = {};
1495
+ const definedKeys = Object.keys(defined);
1496
+ for (let i = definedKeys.length - 1; i >= 0; i--) {
1497
+ const key = definedKeys[i],
1498
+ desc = defined[key];
1499
+ if (desc && desc.get) Object.defineProperty(target, key, desc);
1500
+ else target[key] = desc ? desc.value : undefined;
1501
+ }
1386
1502
  return target;
1387
1503
  }
1388
1504
  function splitProps(props, ...keys) {
1389
1505
  if ($PROXY in props) {
1390
1506
  const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
1391
1507
  const res = keys.map(k => {
1392
- return new Proxy({
1393
- get(property) {
1394
- return k.includes(property) ? props[property] : undefined;
1395
- },
1396
- has(property) {
1397
- return k.includes(property) && property in props;
1508
+ return new Proxy(
1509
+ {
1510
+ get(property) {
1511
+ return k.includes(property) ? props[property] : undefined;
1512
+ },
1513
+ has(property) {
1514
+ return k.includes(property) && property in props;
1515
+ },
1516
+ keys() {
1517
+ return k.filter(property => property in props);
1518
+ }
1398
1519
  },
1399
- keys() {
1400
- return k.filter(property => property in props);
1401
- }
1402
- }, propTraps);
1520
+ propTraps
1521
+ );
1403
1522
  });
1404
- res.push(new Proxy({
1405
- get(property) {
1406
- return blocked.has(property) ? undefined : props[property];
1407
- },
1408
- has(property) {
1409
- return blocked.has(property) ? false : property in props;
1410
- },
1411
- keys() {
1412
- return Object.keys(props).filter(k => !blocked.has(k));
1413
- }
1414
- }, propTraps));
1523
+ res.push(
1524
+ new Proxy(
1525
+ {
1526
+ get(property) {
1527
+ return blocked.has(property) ? undefined : props[property];
1528
+ },
1529
+ has(property) {
1530
+ return blocked.has(property) ? false : property in props;
1531
+ },
1532
+ keys() {
1533
+ return Object.keys(props).filter(k => !blocked.has(k));
1534
+ }
1535
+ },
1536
+ propTraps
1537
+ )
1538
+ );
1415
1539
  return res;
1416
1540
  }
1417
1541
  const otherObject = {};
1418
1542
  const objects = keys.map(() => ({}));
1419
1543
  for (const propName of Object.getOwnPropertyNames(props)) {
1420
1544
  const desc = Object.getOwnPropertyDescriptor(props, propName);
1421
- const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1545
+ const isDefaultDesc =
1546
+ !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1422
1547
  let blocked = false;
1423
1548
  let objectIndex = 0;
1424
1549
  for (const k of keys) {
1425
1550
  if (k.includes(propName)) {
1426
1551
  blocked = true;
1427
- isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
1552
+ isDefaultDesc
1553
+ ? (objects[objectIndex][propName] = desc.value)
1554
+ : Object.defineProperty(objects[objectIndex], propName, desc);
1428
1555
  }
1429
1556
  ++objectIndex;
1430
1557
  }
1431
1558
  if (!blocked) {
1432
- isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
1559
+ isDefaultDesc
1560
+ ? (otherObject[propName] = desc.value)
1561
+ : Object.defineProperty(otherObject, propName, desc);
1433
1562
  }
1434
1563
  }
1435
1564
  return [...objects, otherObject];
@@ -1455,19 +1584,24 @@ function lazy(fn) {
1455
1584
  comp = s;
1456
1585
  }
1457
1586
  let Comp;
1458
- return createMemo(() => (Comp = comp()) && untrack(() => {
1459
- if (true) Object.assign(Comp, {
1460
- [$DEVCOMP]: true
1461
- });
1462
- if (!ctx) return Comp(props);
1463
- const c = sharedConfig.context;
1464
- setHydrateContext(ctx);
1465
- const r = Comp(props);
1466
- setHydrateContext(c);
1467
- return r;
1468
- }));
1587
+ return createMemo(
1588
+ () =>
1589
+ (Comp = comp()) &&
1590
+ untrack(() => {
1591
+ if (true)
1592
+ Object.assign(Comp, {
1593
+ [$DEVCOMP]: true
1594
+ });
1595
+ if (!ctx) return Comp(props);
1596
+ const c = sharedConfig.context;
1597
+ setHydrateContext(ctx);
1598
+ const r = Comp(props);
1599
+ setHydrateContext(c);
1600
+ return r;
1601
+ })
1602
+ );
1469
1603
  };
1470
- wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
1604
+ wrap.preload = () => p || ((p = fn()).then(mod => (comp = () => mod.default)), p);
1471
1605
  return wrap;
1472
1606
  }
1473
1607
  let counter = 0;
@@ -1476,75 +1610,112 @@ function createUniqueId() {
1476
1610
  return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
1477
1611
  }
1478
1612
 
1479
- 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.` ;
1613
+ const narrowedError = name =>
1614
+ `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.`;
1480
1615
  function For(props) {
1481
1616
  const fallback = "fallback" in props && {
1482
1617
  fallback: () => props.fallback
1483
1618
  };
1484
- return createMemo(mapArray(() => props.each, props.children, fallback || undefined), undefined, {
1485
- name: "value"
1486
- }) ;
1619
+ return createMemo(
1620
+ mapArray(() => props.each, props.children, fallback || undefined),
1621
+ undefined,
1622
+ {
1623
+ name: "value"
1624
+ }
1625
+ );
1487
1626
  }
1488
1627
  function Index(props) {
1489
1628
  const fallback = "fallback" in props && {
1490
1629
  fallback: () => props.fallback
1491
1630
  };
1492
- return createMemo(indexArray(() => props.each, props.children, fallback || undefined), undefined, {
1493
- name: "value"
1494
- }) ;
1631
+ return createMemo(
1632
+ indexArray(() => props.each, props.children, fallback || undefined),
1633
+ undefined,
1634
+ {
1635
+ name: "value"
1636
+ }
1637
+ );
1495
1638
  }
1496
1639
  function Show(props) {
1497
1640
  const keyed = props.keyed;
1498
1641
  const condition = createMemo(() => props.when, undefined, {
1499
- equals: (a, b) => keyed ? a === b : !a === !b,
1642
+ equals: (a, b) => (keyed ? a === b : !a === !b),
1500
1643
  name: "condition"
1501
- } );
1502
- return createMemo(() => {
1503
- const c = condition();
1504
- if (c) {
1505
- const child = props.children;
1506
- const fn = typeof child === "function" && child.length > 0;
1507
- return fn ? untrack(() => child(keyed ? c : () => {
1508
- if (!untrack(condition)) throw narrowedError("Show");
1509
- return props.when;
1510
- })) : child;
1644
+ });
1645
+ return createMemo(
1646
+ () => {
1647
+ const c = condition();
1648
+ if (c) {
1649
+ const child = props.children;
1650
+ const fn = typeof child === "function" && child.length > 0;
1651
+ return fn
1652
+ ? untrack(() =>
1653
+ child(
1654
+ keyed
1655
+ ? c
1656
+ : () => {
1657
+ if (!untrack(condition)) throw narrowedError("Show");
1658
+ return props.when;
1659
+ }
1660
+ )
1661
+ )
1662
+ : child;
1663
+ }
1664
+ return props.fallback;
1665
+ },
1666
+ undefined,
1667
+ {
1668
+ name: "value"
1511
1669
  }
1512
- return props.fallback;
1513
- }, undefined, {
1514
- name: "value"
1515
- } );
1670
+ );
1516
1671
  }
1517
1672
  function Switch(props) {
1518
1673
  let keyed = false;
1519
1674
  const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1520
1675
  const conditions = children(() => props.children),
1521
- evalConditions = createMemo(() => {
1522
- let conds = conditions();
1523
- if (!Array.isArray(conds)) conds = [conds];
1524
- for (let i = 0; i < conds.length; i++) {
1525
- const c = conds[i].when;
1526
- if (c) {
1527
- keyed = !!conds[i].keyed;
1528
- return [i, c, conds[i]];
1676
+ evalConditions = createMemo(
1677
+ () => {
1678
+ let conds = conditions();
1679
+ if (!Array.isArray(conds)) conds = [conds];
1680
+ for (let i = 0; i < conds.length; i++) {
1681
+ const c = conds[i].when;
1682
+ if (c) {
1683
+ keyed = !!conds[i].keyed;
1684
+ return [i, c, conds[i]];
1685
+ }
1529
1686
  }
1687
+ return [-1];
1688
+ },
1689
+ undefined,
1690
+ {
1691
+ equals,
1692
+ name: "eval conditions"
1530
1693
  }
1531
- return [-1];
1532
- }, undefined, {
1533
- equals,
1534
- name: "eval conditions"
1535
- } );
1536
- return createMemo(() => {
1537
- const [index, when, cond] = evalConditions();
1538
- if (index < 0) return props.fallback;
1539
- const c = cond.children;
1540
- const fn = typeof c === "function" && c.length > 0;
1541
- return fn ? untrack(() => c(keyed ? when : () => {
1542
- if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1543
- return cond.when;
1544
- })) : c;
1545
- }, undefined, {
1546
- name: "value"
1547
- } );
1694
+ );
1695
+ return createMemo(
1696
+ () => {
1697
+ const [index, when, cond] = evalConditions();
1698
+ if (index < 0) return props.fallback;
1699
+ const c = cond.children;
1700
+ const fn = typeof c === "function" && c.length > 0;
1701
+ return fn
1702
+ ? untrack(() =>
1703
+ c(
1704
+ keyed
1705
+ ? when
1706
+ : () => {
1707
+ if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1708
+ return cond.when;
1709
+ }
1710
+ )
1711
+ )
1712
+ : c;
1713
+ },
1714
+ undefined,
1715
+ {
1716
+ name: "value"
1717
+ }
1718
+ );
1548
1719
  }
1549
1720
  function Match(props) {
1550
1721
  return props;
@@ -1555,27 +1726,33 @@ function resetErrorBoundaries() {
1555
1726
  }
1556
1727
  function ErrorBoundary(props) {
1557
1728
  let err;
1558
- if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
1729
+ if (sharedConfig.context && sharedConfig.load)
1730
+ err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
1559
1731
  const [errored, setErrored] = createSignal(err, {
1560
1732
  name: "errored"
1561
- } );
1733
+ });
1562
1734
  Errors || (Errors = new Set());
1563
1735
  Errors.add(setErrored);
1564
1736
  onCleanup(() => Errors.delete(setErrored));
1565
- return createMemo(() => {
1566
- let e;
1567
- if (e = errored()) {
1568
- const f = props.fallback;
1569
- if ((typeof f !== "function" || f.length == 0)) console.error(e);
1570
- return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1737
+ return createMemo(
1738
+ () => {
1739
+ let e;
1740
+ if ((e = errored())) {
1741
+ const f = props.fallback;
1742
+ if (typeof f !== "function" || f.length == 0) console.error(e);
1743
+ return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1744
+ }
1745
+ return catchError(() => props.children, setErrored);
1746
+ },
1747
+ undefined,
1748
+ {
1749
+ name: "value"
1571
1750
  }
1572
- return catchError(() => props.children, setErrored);
1573
- }, undefined, {
1574
- name: "value"
1575
- } );
1751
+ );
1576
1752
  }
1577
1753
 
1578
- const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
1754
+ const suspenseListEquals = (a, b) =>
1755
+ a.showContent === b.showContent && a.showFallback === b.showFallback;
1579
1756
  const SuspenseListContext = createContext();
1580
1757
  function SuspenseList(props) {
1581
1758
  let [wrapper, setWrapper] = createSignal(() => ({
@@ -1587,51 +1764,51 @@ function SuspenseList(props) {
1587
1764
  if (listContext) {
1588
1765
  show = listContext.register(createMemo(() => wrapper()().inFallback));
1589
1766
  }
1590
- const resolved = createMemo(prev => {
1591
- const reveal = props.revealOrder,
1592
- tail = props.tail,
1593
- {
1594
- showContent = true,
1595
- showFallback = true
1596
- } = show ? show() : {},
1597
- reg = registry(),
1598
- reverse = reveal === "backwards";
1599
- if (reveal === "together") {
1600
- const all = reg.every(inFallback => !inFallback());
1601
- const res = reg.map(() => ({
1602
- showContent: all && showContent,
1603
- showFallback
1604
- }));
1605
- res.inFallback = !all;
1606
- return res;
1607
- }
1608
- let stop = false;
1609
- let inFallback = prev.inFallback;
1610
- const res = [];
1611
- for (let i = 0, len = reg.length; i < len; i++) {
1612
- const n = reverse ? len - i - 1 : i,
1613
- s = reg[n]();
1614
- if (!stop && !s) {
1615
- res[n] = {
1616
- showContent,
1767
+ const resolved = createMemo(
1768
+ prev => {
1769
+ const reveal = props.revealOrder,
1770
+ tail = props.tail,
1771
+ { showContent = true, showFallback = true } = show ? show() : {},
1772
+ reg = registry(),
1773
+ reverse = reveal === "backwards";
1774
+ if (reveal === "together") {
1775
+ const all = reg.every(inFallback => !inFallback());
1776
+ const res = reg.map(() => ({
1777
+ showContent: all && showContent,
1617
1778
  showFallback
1618
- };
1619
- } else {
1620
- const next = !stop;
1621
- if (next) inFallback = true;
1622
- res[n] = {
1623
- showContent: next,
1624
- showFallback: !tail || next && tail === "collapsed" ? showFallback : false
1625
- };
1626
- stop = true;
1779
+ }));
1780
+ res.inFallback = !all;
1781
+ return res;
1782
+ }
1783
+ let stop = false;
1784
+ let inFallback = prev.inFallback;
1785
+ const res = [];
1786
+ for (let i = 0, len = reg.length; i < len; i++) {
1787
+ const n = reverse ? len - i - 1 : i,
1788
+ s = reg[n]();
1789
+ if (!stop && !s) {
1790
+ res[n] = {
1791
+ showContent,
1792
+ showFallback
1793
+ };
1794
+ } else {
1795
+ const next = !stop;
1796
+ if (next) inFallback = true;
1797
+ res[n] = {
1798
+ showContent: next,
1799
+ showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
1800
+ };
1801
+ stop = true;
1802
+ }
1627
1803
  }
1804
+ if (!stop) inFallback = false;
1805
+ res.inFallback = inFallback;
1806
+ return res;
1807
+ },
1808
+ {
1809
+ inFallback: false
1628
1810
  }
1629
- if (!stop) inFallback = false;
1630
- res.inFallback = inFallback;
1631
- return res;
1632
- }, {
1633
- inFallback: false
1634
- });
1811
+ );
1635
1812
  setWrapper(() => resolved);
1636
1813
  return createComponent(SuspenseListContext.Provider, {
1637
1814
  value: {
@@ -1706,17 +1883,14 @@ function Suspense(props) {
1706
1883
  ctx = sharedConfig.context;
1707
1884
  if (flicker) {
1708
1885
  flicker();
1709
- return flicker = undefined;
1886
+ return (flicker = undefined);
1710
1887
  }
1711
1888
  if (ctx && p === "$$f") setHydrateContext();
1712
1889
  const rendered = createMemo(() => props.children);
1713
1890
  return createMemo(prev => {
1714
1891
  const inFallback = store.inFallback(),
1715
- {
1716
- showContent = true,
1717
- showFallback = true
1718
- } = show ? show() : {};
1719
- if ((!inFallback || p && p !== "$$f") && showContent) {
1892
+ { showContent = true, showFallback = true } = show ? show() : {};
1893
+ if ((!inFallback || (p && p !== "$$f")) && showContent) {
1720
1894
  store.resolved = true;
1721
1895
  dispose && dispose();
1722
1896
  dispose = ctx = p = undefined;
@@ -1746,9 +1920,68 @@ const DEV = {
1746
1920
  hooks: DevHooks,
1747
1921
  writeSignal,
1748
1922
  registerGraph
1749
- } ;
1923
+ };
1750
1924
  if (globalThis) {
1751
- if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
1925
+ if (!globalThis.Solid$$) globalThis.Solid$$ = true;
1926
+ else
1927
+ console.warn(
1928
+ "You appear to have multiple instances of Solid. This can lead to unexpected behavior."
1929
+ );
1752
1930
  }
1753
1931
 
1754
- 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 };
1932
+ export {
1933
+ $DEVCOMP,
1934
+ $PROXY,
1935
+ $TRACK,
1936
+ DEV,
1937
+ ErrorBoundary,
1938
+ For,
1939
+ Index,
1940
+ Match,
1941
+ Show,
1942
+ Suspense,
1943
+ SuspenseList,
1944
+ Switch,
1945
+ batch,
1946
+ cancelCallback,
1947
+ catchError,
1948
+ children,
1949
+ createComponent,
1950
+ createComputed,
1951
+ createContext,
1952
+ createDeferred,
1953
+ createEffect,
1954
+ createMemo,
1955
+ createReaction,
1956
+ createRenderEffect,
1957
+ createResource,
1958
+ createRoot,
1959
+ createSelector,
1960
+ createSignal,
1961
+ createUniqueId,
1962
+ enableExternalSource,
1963
+ enableHydration,
1964
+ enableScheduling,
1965
+ equalFn,
1966
+ from,
1967
+ getListener,
1968
+ getOwner,
1969
+ indexArray,
1970
+ lazy,
1971
+ mapArray,
1972
+ mergeProps,
1973
+ observable,
1974
+ on,
1975
+ onCleanup,
1976
+ onError,
1977
+ onMount,
1978
+ requestCallback,
1979
+ resetErrorBoundaries,
1980
+ runWithOwner,
1981
+ sharedConfig,
1982
+ splitProps,
1983
+ startTransition,
1984
+ untrack,
1985
+ useContext,
1986
+ useTransition
1987
+ };