solid-js 1.7.12 → 1.8.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/dev.cjs +14 -11
  2. package/dist/dev.js +544 -306
  3. package/dist/server.cjs +4 -4
  4. package/dist/server.js +172 -78
  5. package/dist/solid.cjs +14 -11
  6. package/dist/solid.js +471 -264
  7. package/h/dist/h.js +34 -8
  8. package/h/jsx-runtime/dist/jsx.js +1 -1
  9. package/h/jsx-runtime/types/index.d.ts +11 -8
  10. package/h/types/hyperscript.d.ts +11 -11
  11. package/html/dist/html.js +216 -94
  12. package/html/types/lit.d.ts +45 -31
  13. package/package.json +2 -2
  14. package/store/dist/dev.js +114 -42
  15. package/store/dist/server.js +19 -8
  16. package/store/dist/store.js +105 -39
  17. package/store/types/index.d.ts +21 -7
  18. package/store/types/modifiers.d.ts +6 -3
  19. package/store/types/mutable.d.ts +5 -2
  20. package/store/types/server.d.ts +12 -4
  21. package/store/types/store.d.ts +218 -61
  22. package/types/index.d.ts +72 -9
  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 +228 -140
  27. package/types/render/Suspense.d.ts +5 -5
  28. package/types/render/component.d.ts +62 -31
  29. package/types/render/flow.d.ts +43 -31
  30. package/types/render/hydration.d.ts +12 -12
  31. package/types/server/index.d.ts +56 -2
  32. package/types/server/reactive.d.ts +67 -40
  33. package/types/server/rendering.d.ts +166 -95
  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 +8 -5
  39. package/web/dist/dev.js +616 -82
  40. package/web/dist/server.cjs +91 -56
  41. package/web/dist/server.js +244 -125
  42. package/web/dist/web.cjs +8 -5
  43. package/web/dist/web.js +616 -82
  44. package/web/types/client.d.ts +2 -2
  45. package/web/types/core.d.ts +10 -1
  46. package/web/types/index.d.ts +27 -10
  47. 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
  }
@@ -159,26 +161,31 @@ const DevHooks = {
159
161
  afterUpdate: null,
160
162
  afterCreateOwner: null
161
163
  };
162
- const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
164
+ const [transPending, setTransPending] = /*@__PURE__*/ createSignal(false);
163
165
  function createRoot(fn, detachedOwner) {
164
166
  const listener = Listener,
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;
@@ -203,23 +210,26 @@ function createSignal(value, options) {
203
210
  }
204
211
  const setter = value => {
205
212
  if (typeof value === "function") {
206
- if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
213
+ if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
214
+ else value = value(s.value);
207
215
  }
208
216
  return writeSignal(s, value);
209
217
  };
210
218
  return [readSignal.bind(s), setter];
211
219
  }
212
220
  function createComputed(fn, value, options) {
213
- const c = createComputation(fn, value, true, STALE, options );
214
- if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
221
+ const c = createComputation(fn, value, true, STALE, options);
222
+ if (Scheduler && Transition && Transition.running) Updates.push(c);
223
+ else updateComputation(c);
215
224
  }
216
225
  function createRenderEffect(fn, value, options) {
217
- const c = createComputation(fn, value, false, STALE, options );
218
- if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
226
+ const c = createComputation(fn, value, false, STALE, options);
227
+ if (Scheduler && Transition && Transition.running) Updates.push(c);
228
+ else updateComputation(c);
219
229
  }
220
230
  function createEffect(fn, value, options) {
221
231
  runEffects = runUserEffects;
222
- const c = createComputation(fn, value, false, STALE, options ),
232
+ const c = createComputation(fn, value, false, STALE, options),
223
233
  s = SuspenseContext && useContext(SuspenseContext);
224
234
  if (s) c.suspense = s;
225
235
  if (!options || !options.render) c.user = true;
@@ -227,10 +237,16 @@ function createEffect(fn, value, options) {
227
237
  }
228
238
  function createReaction(onInvalidate, options) {
229
239
  let fn;
230
- const c = createComputation(() => {
231
- fn ? fn() : untrack(onInvalidate);
232
- fn = undefined;
233
- }, undefined, false, 0, options ),
240
+ const c = createComputation(
241
+ () => {
242
+ fn ? fn() : untrack(onInvalidate);
243
+ fn = undefined;
244
+ },
245
+ undefined,
246
+ false,
247
+ 0,
248
+ options
249
+ ),
234
250
  s = SuspenseContext && useContext(SuspenseContext);
235
251
  if (s) c.suspense = s;
236
252
  c.user = true;
@@ -241,7 +257,7 @@ function createReaction(onInvalidate, options) {
241
257
  }
242
258
  function createMemo(fn, value, options) {
243
259
  options = options ? Object.assign({}, signalOptions, options) : signalOptions;
244
- const c = createComputation(fn, value, true, 0, options );
260
+ const c = createComputation(fn, value, true, 0, options);
245
261
  c.observers = null;
246
262
  c.observerSlots = null;
247
263
  c.comparator = options.equals || undefined;
@@ -251,11 +267,14 @@ function createMemo(fn, value, options) {
251
267
  } else updateComputation(c);
252
268
  return readSignal.bind(c);
253
269
  }
270
+ function isPromise(v) {
271
+ return v && typeof v === "object" && "then" in v;
272
+ }
254
273
  function createResource(pSource, pFetcher, pOptions) {
255
274
  let source;
256
275
  let fetcher;
257
276
  let options;
258
- if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
277
+ if ((arguments.length === 2 && typeof pFetcher === "object") || arguments.length === 1) {
259
278
  source = true;
260
279
  fetcher = pSource;
261
280
  options = pFetcher || {};
@@ -269,7 +288,7 @@ function createResource(pSource, pFetcher, pOptions) {
269
288
  id = null,
270
289
  loadedUnderTransition = false,
271
290
  scheduled = false,
272
- resolved = ("initialValue" in options),
291
+ resolved = "initialValue" in options,
273
292
  dynamic = typeof source === "function" && createMemo(source);
274
293
  const contexts = new Set(),
275
294
  [value, setValue] = (options.storage || createSignal)(options.initialValue),
@@ -281,15 +300,20 @@ function createResource(pSource, pFetcher, pOptions) {
281
300
  if (sharedConfig.context) {
282
301
  id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
283
302
  let v;
284
- if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
303
+ if (options.ssrLoadFrom === "initial") initP = options.initialValue;
304
+ else if (sharedConfig.load && (v = sharedConfig.load(id)))
305
+ initP = isPromise(v) && "value" in v ? v.value : v;
285
306
  }
286
307
  function loadEnd(p, v, error, key) {
287
308
  if (pr === p) {
288
309
  pr = null;
289
310
  key !== undefined && (resolved = true);
290
- if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
291
- value: v
292
- }));
311
+ if ((p === initP || v === initP) && options.onHydrated)
312
+ queueMicrotask(() =>
313
+ options.onHydrated(key, {
314
+ value: v
315
+ })
316
+ );
293
317
  initP = NO_INIT;
294
318
  if (Transition && p && loadedUnderTransition) {
295
319
  Transition.promises.delete(p);
@@ -320,7 +344,8 @@ function createResource(pSource, pFetcher, pOptions) {
320
344
  createComputed(() => {
321
345
  track();
322
346
  if (pr) {
323
- 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)) {
324
349
  c.increment();
325
350
  contexts.add(c);
326
351
  }
@@ -339,22 +364,30 @@ function createResource(pSource, pFetcher, pOptions) {
339
364
  return;
340
365
  }
341
366
  if (Transition && pr) Transition.promises.delete(pr);
342
- const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {
343
- value: value(),
344
- refetching
345
- }));
346
- if (typeof p !== "object" || !(p && "then" in p)) {
367
+ const p =
368
+ initP !== NO_INIT
369
+ ? initP
370
+ : untrack(() =>
371
+ fetcher(lookup, {
372
+ value: value(),
373
+ refetching
374
+ })
375
+ );
376
+ if (!isPromise(p)) {
347
377
  loadEnd(pr, p, undefined, lookup);
348
378
  return p;
349
379
  }
350
380
  pr = p;
351
381
  scheduled = true;
352
- queueMicrotask(() => scheduled = false);
382
+ queueMicrotask(() => (scheduled = false));
353
383
  runUpdates(() => {
354
384
  setState(resolved ? "refreshing" : "pending");
355
385
  trigger();
356
386
  }, false);
357
- return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));
387
+ return p.then(
388
+ v => loadEnd(p, v, undefined, lookup),
389
+ e => loadEnd(p, undefined, castError(e), lookup)
390
+ );
358
391
  }
359
392
  Object.defineProperties(read, {
360
393
  state: {
@@ -378,50 +411,81 @@ function createResource(pSource, pFetcher, pOptions) {
378
411
  }
379
412
  }
380
413
  });
381
- if (dynamic) createComputed(() => load(false));else load(false);
382
- return [read, {
383
- refetch: load,
384
- mutate: setValue
385
- }];
414
+ if (dynamic) createComputed(() => load(false));
415
+ else load(false);
416
+ return [
417
+ read,
418
+ {
419
+ refetch: load,
420
+ mutate: setValue
421
+ }
422
+ ];
386
423
  }
387
424
  function createDeferred(source, options) {
388
425
  let t,
389
426
  timeout = options ? options.timeoutMs : undefined;
390
- const node = createComputation(() => {
391
- if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
392
- timeout
393
- } : undefined);
394
- return source();
395
- }, undefined, true);
396
- const [deferred, setDeferred] = createSignal(Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, options);
427
+ const node = createComputation(
428
+ () => {
429
+ if (!t || !t.fn)
430
+ t = requestCallback(
431
+ () => setDeferred(() => node.value),
432
+ timeout !== undefined
433
+ ? {
434
+ timeout
435
+ }
436
+ : undefined
437
+ );
438
+ return source();
439
+ },
440
+ undefined,
441
+ true
442
+ );
443
+ const [deferred, setDeferred] = createSignal(
444
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
445
+ options
446
+ );
397
447
  updateComputation(node);
398
- setDeferred(() => Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
448
+ setDeferred(() =>
449
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
450
+ );
399
451
  return deferred;
400
452
  }
401
453
  function createSelector(source, fn = equalFn, options) {
402
454
  const subs = new Map();
403
- const node = createComputation(p => {
404
- const v = source();
405
- for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
406
- for (const c of val.values()) {
407
- c.state = STALE;
408
- if (c.pure) Updates.push(c);else Effects.push(c);
409
- }
410
- }
411
- return v;
412
- }, undefined, true, STALE, options );
455
+ const node = createComputation(
456
+ p => {
457
+ const v = source();
458
+ for (const [key, val] of subs.entries())
459
+ if (fn(key, v) !== fn(key, p)) {
460
+ for (const c of val.values()) {
461
+ c.state = STALE;
462
+ if (c.pure) Updates.push(c);
463
+ else Effects.push(c);
464
+ }
465
+ }
466
+ return v;
467
+ },
468
+ undefined,
469
+ true,
470
+ STALE,
471
+ options
472
+ );
413
473
  updateComputation(node);
414
474
  return key => {
415
475
  const listener = Listener;
416
476
  if (listener) {
417
477
  let l;
418
- if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
478
+ if ((l = subs.get(key))) l.add(listener);
479
+ else subs.set(key, (l = new Set([listener])));
419
480
  onCleanup(() => {
420
481
  l.delete(listener);
421
482
  !l.size && subs.delete(key);
422
483
  });
423
484
  }
424
- return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
485
+ return fn(
486
+ key,
487
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
488
+ );
425
489
  };
426
490
  }
427
491
  function batch(fn) {
@@ -460,7 +524,10 @@ function onMount(fn) {
460
524
  createEffect(() => untrack(fn));
461
525
  }
462
526
  function onCleanup(fn) {
463
- 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);
527
+ if (Owner === null)
528
+ console.warn("cleanups created outside a `createRoot` or `render` will never be run");
529
+ else if (Owner.cleanups === null) Owner.cleanups = [fn];
530
+ else Owner.cleanups.push(fn);
464
531
  return fn;
465
532
  }
466
533
  function catchError(fn, handler) {
@@ -514,15 +581,17 @@ function startTransition(fn) {
514
581
  Owner = o;
515
582
  let t;
516
583
  if (Scheduler || SuspenseContext) {
517
- t = Transition || (Transition = {
518
- sources: new Set(),
519
- effects: [],
520
- promises: new Set(),
521
- disposed: new Set(),
522
- queue: new Set(),
523
- running: true
524
- });
525
- t.done || (t.done = new Promise(res => t.resolve = res));
584
+ t =
585
+ Transition ||
586
+ (Transition = {
587
+ sources: new Set(),
588
+ effects: [],
589
+ promises: new Set(),
590
+ disposed: new Set(),
591
+ queue: new Set(),
592
+ running: true
593
+ });
594
+ t.done || (t.done = new Promise(res => (t.resolve = res)));
526
595
  t.running = true;
527
596
  }
528
597
  runUpdates(fn, false);
@@ -538,12 +607,18 @@ function resumeEffects(e) {
538
607
  e.length = 0;
539
608
  }
540
609
  function devComponent(Comp, props) {
541
- const c = createComputation(() => untrack(() => {
542
- Object.assign(Comp, {
543
- [$DEVCOMP]: true
544
- });
545
- return Comp(props);
546
- }), undefined, true, 0);
610
+ const c = createComputation(
611
+ () =>
612
+ untrack(() => {
613
+ Object.assign(Comp, {
614
+ [$DEVCOMP]: true
615
+ });
616
+ return Comp(props);
617
+ }),
618
+ undefined,
619
+ true,
620
+ 0
621
+ );
547
622
  c.props = props;
548
623
  c.observers = null;
549
624
  c.observerSlots = null;
@@ -554,7 +629,8 @@ function devComponent(Comp, props) {
554
629
  }
555
630
  function registerGraph(value) {
556
631
  if (!Owner) return;
557
- if (Owner.sourceMap) Owner.sourceMap.push(value);else Owner.sourceMap = [value];
632
+ if (Owner.sourceMap) Owner.sourceMap.push(value);
633
+ else Owner.sourceMap = [value];
558
634
  value.graph = Owner;
559
635
  }
560
636
  function createContext(defaultValue, options) {
@@ -566,13 +642,15 @@ function createContext(defaultValue, options) {
566
642
  };
567
643
  }
568
644
  function useContext(context) {
569
- return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;
645
+ return Owner && Owner.context && Owner.context[context.id] !== undefined
646
+ ? Owner.context[context.id]
647
+ : context.defaultValue;
570
648
  }
571
649
  function children(fn) {
572
650
  const children = createMemo(fn);
573
651
  const memo = createMemo(() => resolveChildren(children()), undefined, {
574
652
  name: "children"
575
- }) ;
653
+ });
576
654
  memo.toArray = () => {
577
655
  const c = memo();
578
656
  return Array.isArray(c) ? c : c != null ? [c] : [];
@@ -604,7 +682,8 @@ function enableExternalSource(factory) {
604
682
  function readSignal() {
605
683
  const runningTransition = Transition && Transition.running;
606
684
  if (this.sources && (runningTransition ? this.tState : this.state)) {
607
- if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
685
+ if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
686
+ else {
608
687
  const updates = Updates;
609
688
  Updates = null;
610
689
  runUpdates(() => lookUpstream(this), false);
@@ -632,11 +711,12 @@ function readSignal() {
632
711
  return this.value;
633
712
  }
634
713
  function writeSignal(node, value, isComp) {
635
- let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
714
+ let current =
715
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
636
716
  if (!node.comparator || !node.comparator(current, value)) {
637
717
  if (Transition) {
638
718
  const TransitionRunning = Transition.running;
639
- if (TransitionRunning || !isComp && Transition.sources.has(node)) {
719
+ if (TransitionRunning || (!isComp && Transition.sources.has(node))) {
640
720
  Transition.sources.add(node);
641
721
  node.tValue = value;
642
722
  }
@@ -649,10 +729,12 @@ function writeSignal(node, value, isComp) {
649
729
  const TransitionRunning = Transition && Transition.running;
650
730
  if (TransitionRunning && Transition.disposed.has(o)) continue;
651
731
  if (TransitionRunning ? !o.tState : !o.state) {
652
- if (o.pure) Updates.push(o);else Effects.push(o);
732
+ if (o.pure) Updates.push(o);
733
+ else Effects.push(o);
653
734
  if (o.observers) markDownstream(o);
654
735
  }
655
- if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
736
+ if (!TransitionRunning) o.state = STALE;
737
+ else o.tState = STALE;
656
738
  }
657
739
  if (Updates.length > 10e5) {
658
740
  Updates = [];
@@ -671,7 +753,11 @@ function updateComputation(node) {
671
753
  listener = Listener,
672
754
  time = ExecCount;
673
755
  Listener = Owner = node;
674
- runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
756
+ runComputation(
757
+ node,
758
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
759
+ time
760
+ );
675
761
  if (Transition && !Transition.running && Transition.sources.has(node)) {
676
762
  queueMicrotask(() => {
677
763
  runUpdates(() => {
@@ -732,11 +818,15 @@ function createComputation(fn, init, pure, state = STALE, options) {
732
818
  c.state = 0;
733
819
  c.tState = state;
734
820
  }
735
- if (Owner === null) console.warn("computations created outside a `createRoot` or `render` will never be disposed");else if (Owner !== UNOWNED) {
821
+ if (Owner === null)
822
+ console.warn("computations created outside a `createRoot` or `render` will never be disposed");
823
+ else if (Owner !== UNOWNED) {
736
824
  if (Transition && Transition.running && Owner.pure) {
737
- if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);
825
+ if (!Owner.tOwned) Owner.tOwned = [c];
826
+ else Owner.tOwned.push(c);
738
827
  } else {
739
- if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
828
+ if (!Owner.owned) Owner.owned = [c];
829
+ else Owner.owned.push(c);
740
830
  }
741
831
  }
742
832
  if (options && options.name) c.name = options.name;
@@ -789,7 +879,8 @@ function runUpdates(fn, init) {
789
879
  if (Updates) return fn();
790
880
  let wait = false;
791
881
  if (!init) Updates = [];
792
- if (Effects) wait = true;else Effects = [];
882
+ if (Effects) wait = true;
883
+ else Effects = [];
793
884
  ExecCount++;
794
885
  try {
795
886
  const res = fn();
@@ -803,7 +894,8 @@ function runUpdates(fn, init) {
803
894
  }
804
895
  function completeUpdates(wait) {
805
896
  if (Updates) {
806
- if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);
897
+ if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
898
+ else runQueue(Updates);
807
899
  Updates = null;
808
900
  }
809
901
  if (wait) return;
@@ -843,7 +935,8 @@ function completeUpdates(wait) {
843
935
  }
844
936
  const e = Effects;
845
937
  Effects = null;
846
- if (e.length) runUpdates(() => runEffects(e), false);else DevHooks.afterUpdate && DevHooks.afterUpdate();
938
+ if (e.length) runUpdates(() => runEffects(e), false);
939
+ else DevHooks.afterUpdate && DevHooks.afterUpdate();
847
940
  if (res) res();
848
941
  }
849
942
  function runQueue(queue) {
@@ -871,7 +964,8 @@ function runUserEffects(queue) {
871
964
  userLength = 0;
872
965
  for (i = 0; i < queue.length; i++) {
873
966
  const e = queue[i];
874
- if (!e.user) runTop(e);else queue[userLength++] = e;
967
+ if (!e.user) runTop(e);
968
+ else queue[userLength++] = e;
875
969
  }
876
970
  if (sharedConfig.context) {
877
971
  if (sharedConfig.count) {
@@ -889,13 +983,15 @@ function runUserEffects(queue) {
889
983
  }
890
984
  function lookUpstream(node, ignore) {
891
985
  const runningTransition = Transition && Transition.running;
892
- if (runningTransition) node.tState = 0;else node.state = 0;
986
+ if (runningTransition) node.tState = 0;
987
+ else node.state = 0;
893
988
  for (let i = 0; i < node.sources.length; i += 1) {
894
989
  const source = node.sources[i];
895
990
  if (source.sources) {
896
991
  const state = runningTransition ? source.tState : source.state;
897
992
  if (state === STALE) {
898
- if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
993
+ if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
994
+ runTop(source);
899
995
  } else if (state === PENDING) lookUpstream(source, ignore);
900
996
  }
901
997
  }
@@ -905,8 +1001,10 @@ function markDownstream(node) {
905
1001
  for (let i = 0; i < node.observers.length; i += 1) {
906
1002
  const o = node.observers[i];
907
1003
  if (runningTransition ? !o.tState : !o.state) {
908
- if (runningTransition) o.tState = PENDING;else o.state = PENDING;
909
- if (o.pure) Updates.push(o);else Effects.push(o);
1004
+ if (runningTransition) o.tState = PENDING;
1005
+ else o.state = PENDING;
1006
+ if (o.pure) Updates.push(o);
1007
+ else Effects.push(o);
910
1008
  o.observers && markDownstream(o);
911
1009
  }
912
1010
  }
@@ -943,7 +1041,8 @@ function cleanNode(node) {
943
1041
  for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
944
1042
  node.cleanups = null;
945
1043
  }
946
- if (Transition && Transition.running) node.tState = 0;else node.state = 0;
1044
+ if (Transition && Transition.running) node.tState = 0;
1045
+ else node.state = 0;
947
1046
  delete node.sourceMap;
948
1047
  }
949
1048
  function reset(node, top) {
@@ -965,19 +1064,21 @@ function runErrors(err, fns, owner) {
965
1064
  try {
966
1065
  for (const f of fns) f(err);
967
1066
  } catch (e) {
968
- handleError(e, owner && owner.owner || null);
1067
+ handleError(e, (owner && owner.owner) || null);
969
1068
  }
970
1069
  }
971
1070
  function handleError(err, owner = Owner) {
972
1071
  const fns = ERROR && owner && owner.context && owner.context[ERROR];
973
1072
  const error = castError(err);
974
1073
  if (!fns) throw error;
975
- if (Effects) Effects.push({
976
- fn() {
977
- runErrors(error, fns, owner);
978
- },
979
- state: STALE
980
- });else runErrors(error, fns, owner);
1074
+ if (Effects)
1075
+ Effects.push({
1076
+ fn() {
1077
+ runErrors(error, fns, owner);
1078
+ },
1079
+ state: STALE
1080
+ });
1081
+ else runErrors(error, fns, owner);
981
1082
  }
982
1083
  function resolveChildren(children) {
983
1084
  if (typeof children === "function" && !children.length) return resolveChildren(children());
@@ -994,19 +1095,26 @@ function resolveChildren(children) {
994
1095
  function createProvider(id, options) {
995
1096
  return function provider(props) {
996
1097
  let res;
997
- createRenderEffect(() => res = untrack(() => {
998
- Owner.context = {
999
- ...Owner.context,
1000
- [id]: props.value
1001
- };
1002
- return children(() => props.children);
1003
- }), undefined, options);
1098
+ createRenderEffect(
1099
+ () =>
1100
+ (res = untrack(() => {
1101
+ Owner.context = {
1102
+ ...Owner.context,
1103
+ [id]: props.value
1104
+ };
1105
+ return children(() => props.children);
1106
+ })),
1107
+ undefined,
1108
+ options
1109
+ );
1004
1110
  return res;
1005
1111
  };
1006
1112
  }
1007
1113
  function onError(fn) {
1008
1114
  ERROR || (ERROR = Symbol("error"));
1009
- 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]) {
1115
+ if (Owner === null)
1116
+ console.warn("error handlers created outside a `createRoot` or `render` will never be run");
1117
+ else if (Owner.context === null || !Owner.context[ERROR]) {
1010
1118
  Owner.context = {
1011
1119
  ...Owner.context,
1012
1120
  [ERROR]: [fn]
@@ -1035,7 +1143,8 @@ function observable(input) {
1035
1143
  if (!(observer instanceof Object) || observer == null) {
1036
1144
  throw new TypeError("Expected the observer to be an object.");
1037
1145
  }
1038
- const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
1146
+ const handler =
1147
+ typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
1039
1148
  if (!handler) {
1040
1149
  return {
1041
1150
  unsubscribe() {}
@@ -1066,7 +1175,7 @@ function from(producer) {
1066
1175
  });
1067
1176
  if ("subscribe" in producer) {
1068
1177
  const unsub = producer.subscribe(v => set(() => v));
1069
- onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
1178
+ onCleanup(() => ("unsubscribe" in unsub ? unsub.unsubscribe() : unsub()));
1070
1179
  } else {
1071
1180
  const clean = producer(set);
1072
1181
  onCleanup(clean);
@@ -1118,8 +1227,7 @@ function mapArray(list, mapFn, options = {}) {
1118
1227
  });
1119
1228
  len = 1;
1120
1229
  }
1121
- }
1122
- else if (len === 0) {
1230
+ } else if (len === 0) {
1123
1231
  mapped = new Array(newLen);
1124
1232
  for (j = 0; j < newLen; j++) {
1125
1233
  items[j] = newItems[j];
@@ -1130,8 +1238,16 @@ function mapArray(list, mapFn, options = {}) {
1130
1238
  temp = new Array(newLen);
1131
1239
  tempdisposers = new Array(newLen);
1132
1240
  indexes && (tempIndexes = new Array(newLen));
1133
- for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);
1134
- for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
1241
+ for (
1242
+ start = 0, end = Math.min(len, newLen);
1243
+ start < end && items[start] === newItems[start];
1244
+ start++
1245
+ );
1246
+ for (
1247
+ end = len - 1, newEnd = newLen - 1;
1248
+ end >= start && newEnd >= start && items[end] === newItems[newEnd];
1249
+ end--, newEnd--
1250
+ ) {
1135
1251
  temp[newEnd] = mapped[end];
1136
1252
  tempdisposers[newEnd] = disposers[end];
1137
1253
  indexes && (tempIndexes[newEnd] = indexes[end]);
@@ -1165,7 +1281,7 @@ function mapArray(list, mapFn, options = {}) {
1165
1281
  }
1166
1282
  } else mapped[j] = createRoot(mapper);
1167
1283
  }
1168
- mapped = mapped.slice(0, len = newLen);
1284
+ mapped = mapped.slice(0, (len = newLen));
1169
1285
  items = newItems.slice(0);
1170
1286
  }
1171
1287
  return mapped;
@@ -1175,7 +1291,7 @@ function mapArray(list, mapFn, options = {}) {
1175
1291
  if (indexes) {
1176
1292
  const [s, set] = createSignal(j, {
1177
1293
  name: "index"
1178
- }) ;
1294
+ });
1179
1295
  indexes[j] = set;
1180
1296
  return mapFn(newItems[j], s);
1181
1297
  }
@@ -1233,13 +1349,13 @@ function indexArray(list, mapFn, options = {}) {
1233
1349
  }
1234
1350
  len = signals.length = disposers.length = newItems.length;
1235
1351
  items = newItems.slice(0);
1236
- return mapped = mapped.slice(0, len);
1352
+ return (mapped = mapped.slice(0, len));
1237
1353
  });
1238
1354
  function mapper(disposer) {
1239
1355
  disposers[i] = disposer;
1240
1356
  const [s, set] = createSignal(newItems[i], {
1241
1357
  name: "value"
1242
- }) ;
1358
+ });
1243
1359
  signals[i] = set;
1244
1360
  return mapFn(s, i);
1245
1361
  }
@@ -1255,7 +1371,7 @@ function createComponent(Comp, props) {
1255
1371
  if (sharedConfig.context) {
1256
1372
  const c = sharedConfig.context;
1257
1373
  setHydrateContext(nextHydrateContext());
1258
- const r = devComponent(Comp, props || {}) ;
1374
+ const r = devComponent(Comp, props || {});
1259
1375
  setHydrateContext(c);
1260
1376
  return r;
1261
1377
  }
@@ -1304,29 +1420,33 @@ function mergeProps(...sources) {
1304
1420
  let proxy = false;
1305
1421
  for (let i = 0; i < sources.length; i++) {
1306
1422
  const s = sources[i];
1307
- proxy = proxy || !!s && $PROXY in s;
1308
- sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
1423
+ proxy = proxy || (!!s && $PROXY in s);
1424
+ sources[i] = typeof s === "function" ? ((proxy = true), createMemo(s)) : s;
1309
1425
  }
1310
1426
  if (proxy) {
1311
- return new Proxy({
1312
- get(property) {
1313
- for (let i = sources.length - 1; i >= 0; i--) {
1314
- const v = resolveSource(sources[i])[property];
1315
- if (v !== undefined) return v;
1316
- }
1317
- },
1318
- has(property) {
1319
- for (let i = sources.length - 1; i >= 0; i--) {
1320
- if (property in resolveSource(sources[i])) return true;
1427
+ return new Proxy(
1428
+ {
1429
+ get(property) {
1430
+ for (let i = sources.length - 1; i >= 0; i--) {
1431
+ const v = resolveSource(sources[i])[property];
1432
+ if (v !== undefined) return v;
1433
+ }
1434
+ },
1435
+ has(property) {
1436
+ for (let i = sources.length - 1; i >= 0; i--) {
1437
+ if (property in resolveSource(sources[i])) return true;
1438
+ }
1439
+ return false;
1440
+ },
1441
+ keys() {
1442
+ const keys = [];
1443
+ for (let i = 0; i < sources.length; i++)
1444
+ keys.push(...Object.keys(resolveSource(sources[i])));
1445
+ return [...new Set(keys)];
1321
1446
  }
1322
- return false;
1323
1447
  },
1324
- keys() {
1325
- const keys = [];
1326
- for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
1327
- return [...new Set(keys)];
1328
- }
1329
- }, propTraps);
1448
+ propTraps
1449
+ );
1330
1450
  }
1331
1451
  const target = {};
1332
1452
  const sourcesMap = {};
@@ -1345,7 +1465,7 @@ function mergeProps(...sources) {
1345
1465
  Object.defineProperty(target, key, {
1346
1466
  enumerable: true,
1347
1467
  configurable: true,
1348
- get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
1468
+ get: resolveSources.bind((sourcesMap[key] = [desc.get.bind(source)]))
1349
1469
  });
1350
1470
  } else {
1351
1471
  if (desc.value !== undefined) defined.add(key);
@@ -1369,47 +1489,60 @@ function splitProps(props, ...keys) {
1369
1489
  if ($PROXY in props) {
1370
1490
  const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
1371
1491
  const res = keys.map(k => {
1372
- return new Proxy({
1373
- get(property) {
1374
- return k.includes(property) ? props[property] : undefined;
1375
- },
1376
- has(property) {
1377
- return k.includes(property) && property in props;
1492
+ return new Proxy(
1493
+ {
1494
+ get(property) {
1495
+ return k.includes(property) ? props[property] : undefined;
1496
+ },
1497
+ has(property) {
1498
+ return k.includes(property) && property in props;
1499
+ },
1500
+ keys() {
1501
+ return k.filter(property => property in props);
1502
+ }
1378
1503
  },
1379
- keys() {
1380
- return k.filter(property => property in props);
1381
- }
1382
- }, propTraps);
1504
+ propTraps
1505
+ );
1383
1506
  });
1384
- res.push(new Proxy({
1385
- get(property) {
1386
- return blocked.has(property) ? undefined : props[property];
1387
- },
1388
- has(property) {
1389
- return blocked.has(property) ? false : property in props;
1390
- },
1391
- keys() {
1392
- return Object.keys(props).filter(k => !blocked.has(k));
1393
- }
1394
- }, propTraps));
1507
+ res.push(
1508
+ new Proxy(
1509
+ {
1510
+ get(property) {
1511
+ return blocked.has(property) ? undefined : props[property];
1512
+ },
1513
+ has(property) {
1514
+ return blocked.has(property) ? false : property in props;
1515
+ },
1516
+ keys() {
1517
+ return Object.keys(props).filter(k => !blocked.has(k));
1518
+ }
1519
+ },
1520
+ propTraps
1521
+ )
1522
+ );
1395
1523
  return res;
1396
1524
  }
1397
1525
  const otherObject = {};
1398
1526
  const objects = keys.map(() => ({}));
1399
1527
  for (const propName of Object.getOwnPropertyNames(props)) {
1400
1528
  const desc = Object.getOwnPropertyDescriptor(props, propName);
1401
- const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1529
+ const isDefaultDesc =
1530
+ !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1402
1531
  let blocked = false;
1403
1532
  let objectIndex = 0;
1404
1533
  for (const k of keys) {
1405
1534
  if (k.includes(propName)) {
1406
1535
  blocked = true;
1407
- isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
1536
+ isDefaultDesc
1537
+ ? (objects[objectIndex][propName] = desc.value)
1538
+ : Object.defineProperty(objects[objectIndex], propName, desc);
1408
1539
  }
1409
1540
  ++objectIndex;
1410
1541
  }
1411
1542
  if (!blocked) {
1412
- isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
1543
+ isDefaultDesc
1544
+ ? (otherObject[propName] = desc.value)
1545
+ : Object.defineProperty(otherObject, propName, desc);
1413
1546
  }
1414
1547
  }
1415
1548
  return [...objects, otherObject];
@@ -1435,19 +1568,24 @@ function lazy(fn) {
1435
1568
  comp = s;
1436
1569
  }
1437
1570
  let Comp;
1438
- return createMemo(() => (Comp = comp()) && untrack(() => {
1439
- if (true) Object.assign(Comp, {
1440
- [$DEVCOMP]: true
1441
- });
1442
- if (!ctx) return Comp(props);
1443
- const c = sharedConfig.context;
1444
- setHydrateContext(ctx);
1445
- const r = Comp(props);
1446
- setHydrateContext(c);
1447
- return r;
1448
- }));
1571
+ return createMemo(
1572
+ () =>
1573
+ (Comp = comp()) &&
1574
+ untrack(() => {
1575
+ if (true)
1576
+ Object.assign(Comp, {
1577
+ [$DEVCOMP]: true
1578
+ });
1579
+ if (!ctx) return Comp(props);
1580
+ const c = sharedConfig.context;
1581
+ setHydrateContext(ctx);
1582
+ const r = Comp(props);
1583
+ setHydrateContext(c);
1584
+ return r;
1585
+ })
1586
+ );
1449
1587
  };
1450
- wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
1588
+ wrap.preload = () => p || ((p = fn()).then(mod => (comp = () => mod.default)), p);
1451
1589
  return wrap;
1452
1590
  }
1453
1591
  let counter = 0;
@@ -1456,75 +1594,113 @@ function createUniqueId() {
1456
1594
  return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
1457
1595
  }
1458
1596
 
1459
- 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.` ;
1597
+ const narrowedError = name =>
1598
+ `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.`;
1460
1599
  function For(props) {
1461
1600
  const fallback = "fallback" in props && {
1462
1601
  fallback: () => props.fallback
1463
1602
  };
1464
- return createMemo(mapArray(() => props.each, props.children, fallback || undefined), undefined, {
1465
- name: "value"
1466
- }) ;
1603
+ return createMemo(
1604
+ mapArray(() => props.each, props.children, fallback || undefined),
1605
+ undefined,
1606
+ {
1607
+ name: "value"
1608
+ }
1609
+ );
1467
1610
  }
1468
1611
  function Index(props) {
1469
1612
  const fallback = "fallback" in props && {
1470
1613
  fallback: () => props.fallback
1471
1614
  };
1472
- return createMemo(indexArray(() => props.each, props.children, fallback || undefined), undefined, {
1473
- name: "value"
1474
- }) ;
1615
+ return createMemo(
1616
+ indexArray(() => props.each, props.children, fallback || undefined),
1617
+ undefined,
1618
+ {
1619
+ name: "value"
1620
+ }
1621
+ );
1475
1622
  }
1476
1623
  function Show(props) {
1477
1624
  const keyed = props.keyed;
1478
1625
  const condition = createMemo(() => props.when, undefined, {
1479
- equals: (a, b) => keyed ? a === b : !a === !b,
1626
+ equals: (a, b) => (keyed ? a === b : !a === !b),
1480
1627
  name: "condition"
1481
- } );
1482
- return createMemo(() => {
1483
- const c = condition();
1484
- if (c) {
1485
- const child = props.children;
1486
- const fn = typeof child === "function" && child.length > 0;
1487
- return fn ? untrack(() => child(keyed ? c : () => {
1488
- if (!untrack(condition)) throw narrowedError("Show");
1489
- return props.when;
1490
- })) : child;
1628
+ });
1629
+ return createMemo(
1630
+ () => {
1631
+ const c = condition();
1632
+ if (c) {
1633
+ const child = props.children;
1634
+ const fn = typeof child === "function" && child.length > 0;
1635
+ return fn
1636
+ ? untrack(() =>
1637
+ child(
1638
+ keyed
1639
+ ? c
1640
+ : () => {
1641
+ if (!untrack(condition)) throw narrowedError("Show");
1642
+ return props.when;
1643
+ }
1644
+ )
1645
+ )
1646
+ : child;
1647
+ }
1648
+ return props.fallback;
1649
+ },
1650
+ undefined,
1651
+ {
1652
+ name: "value"
1491
1653
  }
1492
- return props.fallback;
1493
- }, undefined, {
1494
- name: "value"
1495
- } );
1654
+ );
1496
1655
  }
1497
1656
  function Switch(props) {
1498
1657
  let keyed = false;
1499
- const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1658
+ const equals = (a, b) =>
1659
+ a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1500
1660
  const conditions = children(() => props.children),
1501
- evalConditions = createMemo(() => {
1502
- let conds = conditions();
1503
- if (!Array.isArray(conds)) conds = [conds];
1504
- for (let i = 0; i < conds.length; i++) {
1505
- const c = conds[i].when;
1506
- if (c) {
1507
- keyed = !!conds[i].keyed;
1508
- return [i, c, conds[i]];
1661
+ evalConditions = createMemo(
1662
+ () => {
1663
+ let conds = conditions();
1664
+ if (!Array.isArray(conds)) conds = [conds];
1665
+ for (let i = 0; i < conds.length; i++) {
1666
+ const c = conds[i].when;
1667
+ if (c) {
1668
+ keyed = !!conds[i].keyed;
1669
+ return [i, c, conds[i]];
1670
+ }
1509
1671
  }
1672
+ return [-1];
1673
+ },
1674
+ undefined,
1675
+ {
1676
+ equals,
1677
+ name: "eval conditions"
1510
1678
  }
1511
- return [-1];
1512
- }, undefined, {
1513
- equals,
1514
- name: "eval conditions"
1515
- } );
1516
- return createMemo(() => {
1517
- const [index, when, cond] = evalConditions();
1518
- if (index < 0) return props.fallback;
1519
- const c = cond.children;
1520
- const fn = typeof c === "function" && c.length > 0;
1521
- return fn ? untrack(() => c(keyed ? when : () => {
1522
- if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1523
- return cond.when;
1524
- })) : c;
1525
- }, undefined, {
1526
- name: "value"
1527
- } );
1679
+ );
1680
+ return createMemo(
1681
+ () => {
1682
+ const [index, when, cond] = evalConditions();
1683
+ if (index < 0) return props.fallback;
1684
+ const c = cond.children;
1685
+ const fn = typeof c === "function" && c.length > 0;
1686
+ return fn
1687
+ ? untrack(() =>
1688
+ c(
1689
+ keyed
1690
+ ? when
1691
+ : () => {
1692
+ if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1693
+ return cond.when;
1694
+ }
1695
+ )
1696
+ )
1697
+ : c;
1698
+ },
1699
+ undefined,
1700
+ {
1701
+ name: "value"
1702
+ }
1703
+ );
1528
1704
  }
1529
1705
  function Match(props) {
1530
1706
  return props;
@@ -1535,28 +1711,33 @@ function resetErrorBoundaries() {
1535
1711
  }
1536
1712
  function ErrorBoundary(props) {
1537
1713
  let err;
1538
- let v;
1539
- if (sharedConfig.context && sharedConfig.load && (v = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count))) err = v[0];
1714
+ if (sharedConfig.context && sharedConfig.load)
1715
+ err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
1540
1716
  const [errored, setErrored] = createSignal(err, {
1541
1717
  name: "errored"
1542
- } );
1718
+ });
1543
1719
  Errors || (Errors = new Set());
1544
1720
  Errors.add(setErrored);
1545
1721
  onCleanup(() => Errors.delete(setErrored));
1546
- return createMemo(() => {
1547
- let e;
1548
- if (e = errored()) {
1549
- const f = props.fallback;
1550
- if ((typeof f !== "function" || f.length == 0)) console.error(e);
1551
- return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1722
+ return createMemo(
1723
+ () => {
1724
+ let e;
1725
+ if ((e = errored())) {
1726
+ const f = props.fallback;
1727
+ if (typeof f !== "function" || f.length == 0) console.error(e);
1728
+ return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1729
+ }
1730
+ return catchError(() => props.children, setErrored);
1731
+ },
1732
+ undefined,
1733
+ {
1734
+ name: "value"
1552
1735
  }
1553
- return catchError(() => props.children, setErrored);
1554
- }, undefined, {
1555
- name: "value"
1556
- } );
1736
+ );
1557
1737
  }
1558
1738
 
1559
- const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
1739
+ const suspenseListEquals = (a, b) =>
1740
+ a.showContent === b.showContent && a.showFallback === b.showFallback;
1560
1741
  const SuspenseListContext = createContext();
1561
1742
  function SuspenseList(props) {
1562
1743
  let [wrapper, setWrapper] = createSignal(() => ({
@@ -1568,51 +1749,51 @@ function SuspenseList(props) {
1568
1749
  if (listContext) {
1569
1750
  show = listContext.register(createMemo(() => wrapper()().inFallback));
1570
1751
  }
1571
- const resolved = createMemo(prev => {
1572
- const reveal = props.revealOrder,
1573
- tail = props.tail,
1574
- {
1575
- showContent = true,
1576
- showFallback = true
1577
- } = show ? show() : {},
1578
- reg = registry(),
1579
- reverse = reveal === "backwards";
1580
- if (reveal === "together") {
1581
- const all = reg.every(inFallback => !inFallback());
1582
- const res = reg.map(() => ({
1583
- showContent: all && showContent,
1584
- showFallback
1585
- }));
1586
- res.inFallback = !all;
1587
- return res;
1588
- }
1589
- let stop = false;
1590
- let inFallback = prev.inFallback;
1591
- const res = [];
1592
- for (let i = 0, len = reg.length; i < len; i++) {
1593
- const n = reverse ? len - i - 1 : i,
1594
- s = reg[n]();
1595
- if (!stop && !s) {
1596
- res[n] = {
1597
- showContent,
1752
+ const resolved = createMemo(
1753
+ prev => {
1754
+ const reveal = props.revealOrder,
1755
+ tail = props.tail,
1756
+ { showContent = true, showFallback = true } = show ? show() : {},
1757
+ reg = registry(),
1758
+ reverse = reveal === "backwards";
1759
+ if (reveal === "together") {
1760
+ const all = reg.every(inFallback => !inFallback());
1761
+ const res = reg.map(() => ({
1762
+ showContent: all && showContent,
1598
1763
  showFallback
1599
- };
1600
- } else {
1601
- const next = !stop;
1602
- if (next) inFallback = true;
1603
- res[n] = {
1604
- showContent: next,
1605
- showFallback: !tail || next && tail === "collapsed" ? showFallback : false
1606
- };
1607
- stop = true;
1764
+ }));
1765
+ res.inFallback = !all;
1766
+ return res;
1608
1767
  }
1768
+ let stop = false;
1769
+ let inFallback = prev.inFallback;
1770
+ const res = [];
1771
+ for (let i = 0, len = reg.length; i < len; i++) {
1772
+ const n = reverse ? len - i - 1 : i,
1773
+ s = reg[n]();
1774
+ if (!stop && !s) {
1775
+ res[n] = {
1776
+ showContent,
1777
+ showFallback
1778
+ };
1779
+ } else {
1780
+ const next = !stop;
1781
+ if (next) inFallback = true;
1782
+ res[n] = {
1783
+ showContent: next,
1784
+ showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
1785
+ };
1786
+ stop = true;
1787
+ }
1788
+ }
1789
+ if (!stop) inFallback = false;
1790
+ res.inFallback = inFallback;
1791
+ return res;
1792
+ },
1793
+ {
1794
+ inFallback: false
1609
1795
  }
1610
- if (!stop) inFallback = false;
1611
- res.inFallback = inFallback;
1612
- return res;
1613
- }, {
1614
- inFallback: false
1615
- });
1796
+ );
1616
1797
  setWrapper(() => resolved);
1617
1798
  return createComponent(SuspenseListContext.Provider, {
1618
1799
  value: {
@@ -1656,21 +1837,22 @@ function Suspense(props) {
1656
1837
  if (sharedConfig.context && sharedConfig.load) {
1657
1838
  const key = sharedConfig.context.id + sharedConfig.context.count;
1658
1839
  let ref = sharedConfig.load(key);
1659
- if (ref && (p = ref[0]) && p !== "$$f") {
1660
- if (typeof p !== "object" || !("then" in p)) p = Promise.resolve(p);
1840
+ if (ref && (typeof ref !== "object" || !("value" in ref))) p = ref;
1841
+ if (p && p !== "$$f") {
1661
1842
  const [s, set] = createSignal(undefined, {
1662
1843
  equals: false
1663
1844
  });
1664
1845
  flicker = s;
1665
- p.then(err => {
1666
- if (err || sharedConfig.done) {
1667
- err && (error = err);
1668
- return set();
1669
- }
1846
+ p.then(() => {
1670
1847
  sharedConfig.gather(key);
1671
1848
  setHydrateContext(ctx);
1672
1849
  set();
1673
1850
  setHydrateContext();
1851
+ }).catch(err => {
1852
+ if (err || sharedConfig.done) {
1853
+ err && (error = err);
1854
+ return set();
1855
+ }
1674
1856
  });
1675
1857
  }
1676
1858
  }
@@ -1686,17 +1868,14 @@ function Suspense(props) {
1686
1868
  ctx = sharedConfig.context;
1687
1869
  if (flicker) {
1688
1870
  flicker();
1689
- return flicker = undefined;
1871
+ return (flicker = undefined);
1690
1872
  }
1691
1873
  if (ctx && p === "$$f") setHydrateContext();
1692
1874
  const rendered = createMemo(() => props.children);
1693
1875
  return createMemo(prev => {
1694
1876
  const inFallback = store.inFallback(),
1695
- {
1696
- showContent = true,
1697
- showFallback = true
1698
- } = show ? show() : {};
1699
- if ((!inFallback || p && p !== "$$f") && showContent) {
1877
+ { showContent = true, showFallback = true } = show ? show() : {};
1878
+ if ((!inFallback || (p && p !== "$$f")) && showContent) {
1700
1879
  store.resolved = true;
1701
1880
  dispose && dispose();
1702
1881
  dispose = ctx = p = undefined;
@@ -1726,9 +1905,68 @@ const DEV = {
1726
1905
  hooks: DevHooks,
1727
1906
  writeSignal,
1728
1907
  registerGraph
1729
- } ;
1908
+ };
1730
1909
  if (globalThis) {
1731
- if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
1910
+ if (!globalThis.Solid$$) globalThis.Solid$$ = true;
1911
+ else
1912
+ console.warn(
1913
+ "You appear to have multiple instances of Solid. This can lead to unexpected behavior."
1914
+ );
1732
1915
  }
1733
1916
 
1734
- 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 };
1917
+ export {
1918
+ $DEVCOMP,
1919
+ $PROXY,
1920
+ $TRACK,
1921
+ DEV,
1922
+ ErrorBoundary,
1923
+ For,
1924
+ Index,
1925
+ Match,
1926
+ Show,
1927
+ Suspense,
1928
+ SuspenseList,
1929
+ Switch,
1930
+ batch,
1931
+ cancelCallback,
1932
+ catchError,
1933
+ children,
1934
+ createComponent,
1935
+ createComputed,
1936
+ createContext,
1937
+ createDeferred,
1938
+ createEffect,
1939
+ createMemo,
1940
+ createReaction,
1941
+ createRenderEffect,
1942
+ createResource,
1943
+ createRoot,
1944
+ createSelector,
1945
+ createSignal,
1946
+ createUniqueId,
1947
+ enableExternalSource,
1948
+ enableHydration,
1949
+ enableScheduling,
1950
+ equalFn,
1951
+ from,
1952
+ getListener,
1953
+ getOwner,
1954
+ indexArray,
1955
+ lazy,
1956
+ mapArray,
1957
+ mergeProps,
1958
+ observable,
1959
+ on,
1960
+ onCleanup,
1961
+ onError,
1962
+ onMount,
1963
+ requestCallback,
1964
+ resetErrorBoundaries,
1965
+ runWithOwner,
1966
+ sharedConfig,
1967
+ splitProps,
1968
+ startTransition,
1969
+ untrack,
1970
+ useContext,
1971
+ useTransition
1972
+ };