solid-js 1.8.5 → 1.8.6

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 (49) hide show
  1. package/dist/dev.cjs +12 -9
  2. package/dist/dev.js +545 -307
  3. package/dist/server.js +170 -75
  4. package/dist/solid.cjs +7 -6
  5. package/dist/solid.js +467 -262
  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 +12 -5
  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 +7 -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 +75 -9
  23. package/types/jsx.d.ts +11 -5
  24. package/types/reactive/array.d.ts +12 -4
  25. package/types/reactive/observable.d.ts +25 -17
  26. package/types/reactive/scheduler.d.ts +9 -6
  27. package/types/reactive/signal.d.ts +229 -140
  28. package/types/render/Suspense.d.ts +5 -5
  29. package/types/render/component.d.ts +62 -31
  30. package/types/render/flow.d.ts +43 -31
  31. package/types/render/hydration.d.ts +13 -13
  32. package/types/server/index.d.ts +57 -2
  33. package/types/server/reactive.d.ts +73 -42
  34. package/types/server/rendering.d.ts +166 -95
  35. package/universal/dist/dev.js +28 -12
  36. package/universal/dist/universal.js +28 -12
  37. package/universal/types/index.d.ts +3 -1
  38. package/universal/types/universal.d.ts +0 -1
  39. package/web/dist/dev.cjs +1 -1
  40. package/web/dist/dev.js +620 -81
  41. package/web/dist/server.cjs +22 -10
  42. package/web/dist/server.js +195 -101
  43. package/web/dist/storage.js +3 -3
  44. package/web/dist/web.cjs +1 -1
  45. package/web/dist/web.js +614 -80
  46. package/web/types/client.d.ts +2 -2
  47. package/web/types/core.d.ts +10 -1
  48. package/web/types/index.d.ts +27 -10
  49. 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
  }
@@ -157,28 +159,34 @@ let Effects = null;
157
159
  let ExecCount = 0;
158
160
  const DevHooks = {
159
161
  afterUpdate: null,
160
- afterCreateOwner: null
162
+ afterCreateOwner: null,
163
+ afterCreateSignal: null
161
164
  };
162
- const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
165
+ const [transPending, setTransPending] = /*@__PURE__*/ createSignal(false);
163
166
  function createRoot(fn, detachedOwner) {
164
167
  const listener = Listener,
165
168
  owner = Owner,
166
169
  unowned = fn.length === 0,
167
170
  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)));
171
+ root = unowned
172
+ ? {
173
+ owned: null,
174
+ cleanups: null,
175
+ context: null,
176
+ owner: null
177
+ }
178
+ : {
179
+ owned: null,
180
+ cleanups: null,
181
+ context: current ? current.context : null,
182
+ owner: current
183
+ },
184
+ updateFn = unowned
185
+ ? () =>
186
+ fn(() => {
187
+ throw new Error("Dispose method must be an explicit argument to createRoot function");
188
+ })
189
+ : () => fn(() => untrack(() => cleanNode(root)));
182
190
  DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(root);
183
191
  Owner = root;
184
192
  Listener = null;
@@ -197,29 +205,33 @@ function createSignal(value, options) {
197
205
  observerSlots: null,
198
206
  comparator: options.equals || undefined
199
207
  };
200
- if (!options.internal) {
208
+ {
201
209
  if (options.name) s.name = options.name;
202
- registerGraph(s);
210
+ if (DevHooks.afterCreateSignal) DevHooks.afterCreateSignal(s);
211
+ if (!options.internal) registerGraph(s);
203
212
  }
204
213
  const setter = value => {
205
214
  if (typeof value === "function") {
206
- if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
215
+ if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
216
+ else value = value(s.value);
207
217
  }
208
218
  return writeSignal(s, value);
209
219
  };
210
220
  return [readSignal.bind(s), setter];
211
221
  }
212
222
  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);
223
+ const c = createComputation(fn, value, true, STALE, options);
224
+ if (Scheduler && Transition && Transition.running) Updates.push(c);
225
+ else updateComputation(c);
215
226
  }
216
227
  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);
228
+ const c = createComputation(fn, value, false, STALE, options);
229
+ if (Scheduler && Transition && Transition.running) Updates.push(c);
230
+ else updateComputation(c);
219
231
  }
220
232
  function createEffect(fn, value, options) {
221
233
  runEffects = runUserEffects;
222
- const c = createComputation(fn, value, false, STALE, options ),
234
+ const c = createComputation(fn, value, false, STALE, options),
223
235
  s = SuspenseContext && useContext(SuspenseContext);
224
236
  if (s) c.suspense = s;
225
237
  if (!options || !options.render) c.user = true;
@@ -227,10 +239,16 @@ function createEffect(fn, value, options) {
227
239
  }
228
240
  function createReaction(onInvalidate, options) {
229
241
  let fn;
230
- const c = createComputation(() => {
231
- fn ? fn() : untrack(onInvalidate);
232
- fn = undefined;
233
- }, undefined, false, 0, options ),
242
+ const c = createComputation(
243
+ () => {
244
+ fn ? fn() : untrack(onInvalidate);
245
+ fn = undefined;
246
+ },
247
+ undefined,
248
+ false,
249
+ 0,
250
+ options
251
+ ),
234
252
  s = SuspenseContext && useContext(SuspenseContext);
235
253
  if (s) c.suspense = s;
236
254
  c.user = true;
@@ -241,7 +259,7 @@ function createReaction(onInvalidate, options) {
241
259
  }
242
260
  function createMemo(fn, value, options) {
243
261
  options = options ? Object.assign({}, signalOptions, options) : signalOptions;
244
- const c = createComputation(fn, value, true, 0, options );
262
+ const c = createComputation(fn, value, true, 0, options);
245
263
  c.observers = null;
246
264
  c.observerSlots = null;
247
265
  c.comparator = options.equals || undefined;
@@ -258,7 +276,7 @@ function createResource(pSource, pFetcher, pOptions) {
258
276
  let source;
259
277
  let fetcher;
260
278
  let options;
261
- if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
279
+ if ((arguments.length === 2 && typeof pFetcher === "object") || arguments.length === 1) {
262
280
  source = true;
263
281
  fetcher = pSource;
264
282
  options = pFetcher || {};
@@ -272,7 +290,7 @@ function createResource(pSource, pFetcher, pOptions) {
272
290
  id = null,
273
291
  loadedUnderTransition = false,
274
292
  scheduled = false,
275
- resolved = ("initialValue" in options),
293
+ resolved = "initialValue" in options,
276
294
  dynamic = typeof source === "function" && createMemo(source);
277
295
  const contexts = new Set(),
278
296
  [value, setValue] = (options.storage || createSignal)(options.initialValue),
@@ -284,15 +302,19 @@ function createResource(pSource, pFetcher, pOptions) {
284
302
  if (sharedConfig.context) {
285
303
  id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
286
304
  let v;
287
- if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
305
+ if (options.ssrLoadFrom === "initial") initP = options.initialValue;
306
+ else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
288
307
  }
289
308
  function loadEnd(p, v, error, key) {
290
309
  if (pr === p) {
291
310
  pr = null;
292
311
  key !== undefined && (resolved = true);
293
- if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
294
- value: v
295
- }));
312
+ if ((p === initP || v === initP) && options.onHydrated)
313
+ queueMicrotask(() =>
314
+ options.onHydrated(key, {
315
+ value: v
316
+ })
317
+ );
296
318
  initP = NO_INIT;
297
319
  if (Transition && p && loadedUnderTransition) {
298
320
  Transition.promises.delete(p);
@@ -323,7 +345,8 @@ function createResource(pSource, pFetcher, pOptions) {
323
345
  createComputed(() => {
324
346
  track();
325
347
  if (pr) {
326
- if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) {
348
+ if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
349
+ else if (!contexts.has(c)) {
327
350
  c.increment();
328
351
  contexts.add(c);
329
352
  }
@@ -342,26 +365,35 @@ function createResource(pSource, pFetcher, pOptions) {
342
365
  return;
343
366
  }
344
367
  if (Transition && pr) Transition.promises.delete(pr);
345
- const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {
346
- value: value(),
347
- refetching
348
- }));
368
+ const p =
369
+ initP !== NO_INIT
370
+ ? initP
371
+ : untrack(() =>
372
+ fetcher(lookup, {
373
+ value: value(),
374
+ refetching
375
+ })
376
+ );
349
377
  if (!isPromise(p)) {
350
378
  loadEnd(pr, p, undefined, lookup);
351
379
  return p;
352
380
  }
353
381
  pr = p;
354
382
  if ("value" in p) {
355
- if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);else loadEnd(pr, undefined, undefined, lookup);
383
+ if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);
384
+ else loadEnd(pr, undefined, undefined, lookup);
356
385
  return p;
357
386
  }
358
387
  scheduled = true;
359
- queueMicrotask(() => scheduled = false);
388
+ queueMicrotask(() => (scheduled = false));
360
389
  runUpdates(() => {
361
390
  setState(resolved ? "refreshing" : "pending");
362
391
  trigger();
363
392
  }, false);
364
- return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));
393
+ return p.then(
394
+ v => loadEnd(p, v, undefined, lookup),
395
+ e => loadEnd(p, undefined, castError(e), lookup)
396
+ );
365
397
  }
366
398
  Object.defineProperties(read, {
367
399
  state: {
@@ -385,50 +417,81 @@ function createResource(pSource, pFetcher, pOptions) {
385
417
  }
386
418
  }
387
419
  });
388
- if (dynamic) createComputed(() => load(false));else load(false);
389
- return [read, {
390
- refetch: load,
391
- mutate: setValue
392
- }];
420
+ if (dynamic) createComputed(() => load(false));
421
+ else load(false);
422
+ return [
423
+ read,
424
+ {
425
+ refetch: load,
426
+ mutate: setValue
427
+ }
428
+ ];
393
429
  }
394
430
  function createDeferred(source, options) {
395
431
  let t,
396
432
  timeout = options ? options.timeoutMs : undefined;
397
- const node = createComputation(() => {
398
- if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
399
- timeout
400
- } : undefined);
401
- return source();
402
- }, undefined, true);
403
- const [deferred, setDeferred] = createSignal(Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, options);
433
+ const node = createComputation(
434
+ () => {
435
+ if (!t || !t.fn)
436
+ t = requestCallback(
437
+ () => setDeferred(() => node.value),
438
+ timeout !== undefined
439
+ ? {
440
+ timeout
441
+ }
442
+ : undefined
443
+ );
444
+ return source();
445
+ },
446
+ undefined,
447
+ true
448
+ );
449
+ const [deferred, setDeferred] = createSignal(
450
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
451
+ options
452
+ );
404
453
  updateComputation(node);
405
- setDeferred(() => Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
454
+ setDeferred(() =>
455
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
456
+ );
406
457
  return deferred;
407
458
  }
408
459
  function createSelector(source, fn = equalFn, options) {
409
460
  const subs = new Map();
410
- const node = createComputation(p => {
411
- const v = source();
412
- for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
413
- for (const c of val.values()) {
414
- c.state = STALE;
415
- if (c.pure) Updates.push(c);else Effects.push(c);
416
- }
417
- }
418
- return v;
419
- }, undefined, true, STALE, options );
461
+ const node = createComputation(
462
+ p => {
463
+ const v = source();
464
+ for (const [key, val] of subs.entries())
465
+ if (fn(key, v) !== fn(key, p)) {
466
+ for (const c of val.values()) {
467
+ c.state = STALE;
468
+ if (c.pure) Updates.push(c);
469
+ else Effects.push(c);
470
+ }
471
+ }
472
+ return v;
473
+ },
474
+ undefined,
475
+ true,
476
+ STALE,
477
+ options
478
+ );
420
479
  updateComputation(node);
421
480
  return key => {
422
481
  const listener = Listener;
423
482
  if (listener) {
424
483
  let l;
425
- if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
484
+ if ((l = subs.get(key))) l.add(listener);
485
+ else subs.set(key, (l = new Set([listener])));
426
486
  onCleanup(() => {
427
487
  l.delete(listener);
428
488
  !l.size && subs.delete(key);
429
489
  });
430
490
  }
431
- return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
491
+ return fn(
492
+ key,
493
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
494
+ );
432
495
  };
433
496
  }
434
497
  function batch(fn) {
@@ -467,7 +530,10 @@ function onMount(fn) {
467
530
  createEffect(() => untrack(fn));
468
531
  }
469
532
  function onCleanup(fn) {
470
- 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);
471
537
  return fn;
472
538
  }
473
539
  function catchError(fn, handler) {
@@ -521,15 +587,17 @@ function startTransition(fn) {
521
587
  Owner = o;
522
588
  let t;
523
589
  if (Scheduler || SuspenseContext) {
524
- t = Transition || (Transition = {
525
- sources: new Set(),
526
- effects: [],
527
- promises: new Set(),
528
- disposed: new Set(),
529
- queue: new Set(),
530
- running: true
531
- });
532
- 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)));
533
601
  t.running = true;
534
602
  }
535
603
  runUpdates(fn, false);
@@ -545,12 +613,18 @@ function resumeEffects(e) {
545
613
  e.length = 0;
546
614
  }
547
615
  function devComponent(Comp, props) {
548
- const c = createComputation(() => untrack(() => {
549
- Object.assign(Comp, {
550
- [$DEVCOMP]: true
551
- });
552
- return Comp(props);
553
- }), undefined, true, 0);
616
+ const c = createComputation(
617
+ () =>
618
+ untrack(() => {
619
+ Object.assign(Comp, {
620
+ [$DEVCOMP]: true
621
+ });
622
+ return Comp(props);
623
+ }),
624
+ undefined,
625
+ true,
626
+ 0
627
+ );
554
628
  c.props = props;
555
629
  c.observers = null;
556
630
  c.observerSlots = null;
@@ -561,7 +635,8 @@ function devComponent(Comp, props) {
561
635
  }
562
636
  function registerGraph(value) {
563
637
  if (!Owner) return;
564
- if (Owner.sourceMap) Owner.sourceMap.push(value);else Owner.sourceMap = [value];
638
+ if (Owner.sourceMap) Owner.sourceMap.push(value);
639
+ else Owner.sourceMap = [value];
565
640
  value.graph = Owner;
566
641
  }
567
642
  function createContext(defaultValue, options) {
@@ -573,13 +648,15 @@ function createContext(defaultValue, options) {
573
648
  };
574
649
  }
575
650
  function useContext(context) {
576
- return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;
651
+ return Owner && Owner.context && Owner.context[context.id] !== undefined
652
+ ? Owner.context[context.id]
653
+ : context.defaultValue;
577
654
  }
578
655
  function children(fn) {
579
656
  const children = createMemo(fn);
580
657
  const memo = createMemo(() => resolveChildren(children()), undefined, {
581
658
  name: "children"
582
- }) ;
659
+ });
583
660
  memo.toArray = () => {
584
661
  const c = memo();
585
662
  return Array.isArray(c) ? c : c != null ? [c] : [];
@@ -611,7 +688,8 @@ function enableExternalSource(factory) {
611
688
  function readSignal() {
612
689
  const runningTransition = Transition && Transition.running;
613
690
  if (this.sources && (runningTransition ? this.tState : this.state)) {
614
- if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
691
+ if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
692
+ else {
615
693
  const updates = Updates;
616
694
  Updates = null;
617
695
  runUpdates(() => lookUpstream(this), false);
@@ -639,11 +717,12 @@ function readSignal() {
639
717
  return this.value;
640
718
  }
641
719
  function writeSignal(node, value, isComp) {
642
- let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
720
+ let current =
721
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
643
722
  if (!node.comparator || !node.comparator(current, value)) {
644
723
  if (Transition) {
645
724
  const TransitionRunning = Transition.running;
646
- if (TransitionRunning || !isComp && Transition.sources.has(node)) {
725
+ if (TransitionRunning || (!isComp && Transition.sources.has(node))) {
647
726
  Transition.sources.add(node);
648
727
  node.tValue = value;
649
728
  }
@@ -656,10 +735,12 @@ function writeSignal(node, value, isComp) {
656
735
  const TransitionRunning = Transition && Transition.running;
657
736
  if (TransitionRunning && Transition.disposed.has(o)) continue;
658
737
  if (TransitionRunning ? !o.tState : !o.state) {
659
- if (o.pure) Updates.push(o);else Effects.push(o);
738
+ if (o.pure) Updates.push(o);
739
+ else Effects.push(o);
660
740
  if (o.observers) markDownstream(o);
661
741
  }
662
- if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
742
+ if (!TransitionRunning) o.state = STALE;
743
+ else o.tState = STALE;
663
744
  }
664
745
  if (Updates.length > 10e5) {
665
746
  Updates = [];
@@ -674,11 +755,12 @@ function writeSignal(node, value, isComp) {
674
755
  function updateComputation(node) {
675
756
  if (!node.fn) return;
676
757
  cleanNode(node);
677
- const owner = Owner,
678
- listener = Listener,
679
- time = ExecCount;
680
- Listener = Owner = node;
681
- runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
758
+ const time = ExecCount;
759
+ runComputation(
760
+ node,
761
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
762
+ time
763
+ );
682
764
  if (Transition && !Transition.running && Transition.sources.has(node)) {
683
765
  queueMicrotask(() => {
684
766
  runUpdates(() => {
@@ -689,11 +771,12 @@ function updateComputation(node) {
689
771
  }, false);
690
772
  });
691
773
  }
692
- Listener = listener;
693
- Owner = owner;
694
774
  }
695
775
  function runComputation(node, value, time) {
696
776
  let nextValue;
777
+ const owner = Owner,
778
+ listener = Listener;
779
+ Listener = Owner = node;
697
780
  try {
698
781
  nextValue = node.fn(value);
699
782
  } catch (err) {
@@ -710,6 +793,9 @@ function runComputation(node, value, time) {
710
793
  }
711
794
  node.updatedAt = time + 1;
712
795
  return handleError(err);
796
+ } finally {
797
+ Listener = listener;
798
+ Owner = owner;
713
799
  }
714
800
  if (!node.updatedAt || node.updatedAt <= time) {
715
801
  if (node.updatedAt != null && "observers" in node) {
@@ -739,11 +825,15 @@ function createComputation(fn, init, pure, state = STALE, options) {
739
825
  c.state = 0;
740
826
  c.tState = state;
741
827
  }
742
- if (Owner === null) console.warn("computations created outside a `createRoot` or `render` will never be disposed");else if (Owner !== UNOWNED) {
828
+ if (Owner === null)
829
+ console.warn("computations created outside a `createRoot` or `render` will never be disposed");
830
+ else if (Owner !== UNOWNED) {
743
831
  if (Transition && Transition.running && Owner.pure) {
744
- if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);
832
+ if (!Owner.tOwned) Owner.tOwned = [c];
833
+ else Owner.tOwned.push(c);
745
834
  } else {
746
- if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
835
+ if (!Owner.owned) Owner.owned = [c];
836
+ else Owner.owned.push(c);
747
837
  }
748
838
  }
749
839
  if (options && options.name) c.name = options.name;
@@ -796,7 +886,8 @@ function runUpdates(fn, init) {
796
886
  if (Updates) return fn();
797
887
  let wait = false;
798
888
  if (!init) Updates = [];
799
- if (Effects) wait = true;else Effects = [];
889
+ if (Effects) wait = true;
890
+ else Effects = [];
800
891
  ExecCount++;
801
892
  try {
802
893
  const res = fn();
@@ -810,7 +901,8 @@ function runUpdates(fn, init) {
810
901
  }
811
902
  function completeUpdates(wait) {
812
903
  if (Updates) {
813
- if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);
904
+ if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
905
+ else runQueue(Updates);
814
906
  Updates = null;
815
907
  }
816
908
  if (wait) return;
@@ -850,7 +942,8 @@ function completeUpdates(wait) {
850
942
  }
851
943
  const e = Effects;
852
944
  Effects = null;
853
- if (e.length) runUpdates(() => runEffects(e), false);else DevHooks.afterUpdate && DevHooks.afterUpdate();
945
+ if (e.length) runUpdates(() => runEffects(e), false);
946
+ else DevHooks.afterUpdate && DevHooks.afterUpdate();
854
947
  if (res) res();
855
948
  }
856
949
  function runQueue(queue) {
@@ -878,7 +971,8 @@ function runUserEffects(queue) {
878
971
  userLength = 0;
879
972
  for (i = 0; i < queue.length; i++) {
880
973
  const e = queue[i];
881
- if (!e.user) runTop(e);else queue[userLength++] = e;
974
+ if (!e.user) runTop(e);
975
+ else queue[userLength++] = e;
882
976
  }
883
977
  if (sharedConfig.context) {
884
978
  if (sharedConfig.count) {
@@ -896,13 +990,15 @@ function runUserEffects(queue) {
896
990
  }
897
991
  function lookUpstream(node, ignore) {
898
992
  const runningTransition = Transition && Transition.running;
899
- if (runningTransition) node.tState = 0;else node.state = 0;
993
+ if (runningTransition) node.tState = 0;
994
+ else node.state = 0;
900
995
  for (let i = 0; i < node.sources.length; i += 1) {
901
996
  const source = node.sources[i];
902
997
  if (source.sources) {
903
998
  const state = runningTransition ? source.tState : source.state;
904
999
  if (state === STALE) {
905
- if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
1000
+ if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
1001
+ runTop(source);
906
1002
  } else if (state === PENDING) lookUpstream(source, ignore);
907
1003
  }
908
1004
  }
@@ -912,8 +1008,10 @@ function markDownstream(node) {
912
1008
  for (let i = 0; i < node.observers.length; i += 1) {
913
1009
  const o = node.observers[i];
914
1010
  if (runningTransition ? !o.tState : !o.state) {
915
- if (runningTransition) o.tState = PENDING;else o.state = PENDING;
916
- if (o.pure) Updates.push(o);else Effects.push(o);
1011
+ if (runningTransition) o.tState = PENDING;
1012
+ else o.state = PENDING;
1013
+ if (o.pure) Updates.push(o);
1014
+ else Effects.push(o);
917
1015
  o.observers && markDownstream(o);
918
1016
  }
919
1017
  }
@@ -950,7 +1048,8 @@ function cleanNode(node) {
950
1048
  for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
951
1049
  node.cleanups = null;
952
1050
  }
953
- if (Transition && Transition.running) node.tState = 0;else node.state = 0;
1051
+ if (Transition && Transition.running) node.tState = 0;
1052
+ else node.state = 0;
954
1053
  delete node.sourceMap;
955
1054
  }
956
1055
  function reset(node, top) {
@@ -972,19 +1071,21 @@ function runErrors(err, fns, owner) {
972
1071
  try {
973
1072
  for (const f of fns) f(err);
974
1073
  } catch (e) {
975
- handleError(e, owner && owner.owner || null);
1074
+ handleError(e, (owner && owner.owner) || null);
976
1075
  }
977
1076
  }
978
1077
  function handleError(err, owner = Owner) {
979
1078
  const fns = ERROR && owner && owner.context && owner.context[ERROR];
980
1079
  const error = castError(err);
981
1080
  if (!fns) throw error;
982
- if (Effects) Effects.push({
983
- fn() {
984
- runErrors(error, fns, owner);
985
- },
986
- state: STALE
987
- });else runErrors(error, fns, owner);
1081
+ if (Effects)
1082
+ Effects.push({
1083
+ fn() {
1084
+ runErrors(error, fns, owner);
1085
+ },
1086
+ state: STALE
1087
+ });
1088
+ else runErrors(error, fns, owner);
988
1089
  }
989
1090
  function resolveChildren(children) {
990
1091
  if (typeof children === "function" && !children.length) return resolveChildren(children());
@@ -1001,19 +1102,26 @@ function resolveChildren(children) {
1001
1102
  function createProvider(id, options) {
1002
1103
  return function provider(props) {
1003
1104
  let res;
1004
- createRenderEffect(() => res = untrack(() => {
1005
- Owner.context = {
1006
- ...Owner.context,
1007
- [id]: props.value
1008
- };
1009
- return children(() => props.children);
1010
- }), undefined, options);
1105
+ createRenderEffect(
1106
+ () =>
1107
+ (res = untrack(() => {
1108
+ Owner.context = {
1109
+ ...Owner.context,
1110
+ [id]: props.value
1111
+ };
1112
+ return children(() => props.children);
1113
+ })),
1114
+ undefined,
1115
+ options
1116
+ );
1011
1117
  return res;
1012
1118
  };
1013
1119
  }
1014
1120
  function onError(fn) {
1015
1121
  ERROR || (ERROR = Symbol("error"));
1016
- 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]) {
1122
+ if (Owner === null)
1123
+ console.warn("error handlers created outside a `createRoot` or `render` will never be run");
1124
+ else if (Owner.context === null || !Owner.context[ERROR]) {
1017
1125
  Owner.context = {
1018
1126
  ...Owner.context,
1019
1127
  [ERROR]: [fn]
@@ -1042,7 +1150,8 @@ function observable(input) {
1042
1150
  if (!(observer instanceof Object) || observer == null) {
1043
1151
  throw new TypeError("Expected the observer to be an object.");
1044
1152
  }
1045
- const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
1153
+ const handler =
1154
+ typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
1046
1155
  if (!handler) {
1047
1156
  return {
1048
1157
  unsubscribe() {}
@@ -1073,7 +1182,7 @@ function from(producer) {
1073
1182
  });
1074
1183
  if ("subscribe" in producer) {
1075
1184
  const unsub = producer.subscribe(v => set(() => v));
1076
- onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
1185
+ onCleanup(() => ("unsubscribe" in unsub ? unsub.unsubscribe() : unsub()));
1077
1186
  } else {
1078
1187
  const clean = producer(set);
1079
1188
  onCleanup(clean);
@@ -1125,8 +1234,7 @@ function mapArray(list, mapFn, options = {}) {
1125
1234
  });
1126
1235
  len = 1;
1127
1236
  }
1128
- }
1129
- else if (len === 0) {
1237
+ } else if (len === 0) {
1130
1238
  mapped = new Array(newLen);
1131
1239
  for (j = 0; j < newLen; j++) {
1132
1240
  items[j] = newItems[j];
@@ -1137,8 +1245,16 @@ function mapArray(list, mapFn, options = {}) {
1137
1245
  temp = new Array(newLen);
1138
1246
  tempdisposers = new Array(newLen);
1139
1247
  indexes && (tempIndexes = new Array(newLen));
1140
- for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);
1141
- for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
1248
+ for (
1249
+ start = 0, end = Math.min(len, newLen);
1250
+ start < end && items[start] === newItems[start];
1251
+ start++
1252
+ );
1253
+ for (
1254
+ end = len - 1, newEnd = newLen - 1;
1255
+ end >= start && newEnd >= start && items[end] === newItems[newEnd];
1256
+ end--, newEnd--
1257
+ ) {
1142
1258
  temp[newEnd] = mapped[end];
1143
1259
  tempdisposers[newEnd] = disposers[end];
1144
1260
  indexes && (tempIndexes[newEnd] = indexes[end]);
@@ -1172,7 +1288,7 @@ function mapArray(list, mapFn, options = {}) {
1172
1288
  }
1173
1289
  } else mapped[j] = createRoot(mapper);
1174
1290
  }
1175
- mapped = mapped.slice(0, len = newLen);
1291
+ mapped = mapped.slice(0, (len = newLen));
1176
1292
  items = newItems.slice(0);
1177
1293
  }
1178
1294
  return mapped;
@@ -1182,7 +1298,7 @@ function mapArray(list, mapFn, options = {}) {
1182
1298
  if (indexes) {
1183
1299
  const [s, set] = createSignal(j, {
1184
1300
  name: "index"
1185
- }) ;
1301
+ });
1186
1302
  indexes[j] = set;
1187
1303
  return mapFn(newItems[j], s);
1188
1304
  }
@@ -1240,13 +1356,13 @@ function indexArray(list, mapFn, options = {}) {
1240
1356
  }
1241
1357
  len = signals.length = disposers.length = newItems.length;
1242
1358
  items = newItems.slice(0);
1243
- return mapped = mapped.slice(0, len);
1359
+ return (mapped = mapped.slice(0, len));
1244
1360
  });
1245
1361
  function mapper(disposer) {
1246
1362
  disposers[i] = disposer;
1247
1363
  const [s, set] = createSignal(newItems[i], {
1248
1364
  name: "value"
1249
- }) ;
1365
+ });
1250
1366
  signals[i] = set;
1251
1367
  return mapFn(s, i);
1252
1368
  }
@@ -1262,7 +1378,7 @@ function createComponent(Comp, props) {
1262
1378
  if (sharedConfig.context) {
1263
1379
  const c = sharedConfig.context;
1264
1380
  setHydrateContext(nextHydrateContext());
1265
- const r = devComponent(Comp, props || {}) ;
1381
+ const r = devComponent(Comp, props || {});
1266
1382
  setHydrateContext(c);
1267
1383
  return r;
1268
1384
  }
@@ -1311,29 +1427,33 @@ function mergeProps(...sources) {
1311
1427
  let proxy = false;
1312
1428
  for (let i = 0; i < sources.length; i++) {
1313
1429
  const s = sources[i];
1314
- proxy = proxy || !!s && $PROXY in s;
1315
- sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
1430
+ proxy = proxy || (!!s && $PROXY in s);
1431
+ sources[i] = typeof s === "function" ? ((proxy = true), createMemo(s)) : s;
1316
1432
  }
1317
1433
  if (proxy) {
1318
- return new Proxy({
1319
- get(property) {
1320
- for (let i = sources.length - 1; i >= 0; i--) {
1321
- const v = resolveSource(sources[i])[property];
1322
- if (v !== undefined) return v;
1323
- }
1324
- },
1325
- has(property) {
1326
- for (let i = sources.length - 1; i >= 0; i--) {
1327
- if (property in resolveSource(sources[i])) return true;
1434
+ return new Proxy(
1435
+ {
1436
+ get(property) {
1437
+ for (let i = sources.length - 1; i >= 0; i--) {
1438
+ const v = resolveSource(sources[i])[property];
1439
+ if (v !== undefined) return v;
1440
+ }
1441
+ },
1442
+ has(property) {
1443
+ for (let i = sources.length - 1; i >= 0; i--) {
1444
+ if (property in resolveSource(sources[i])) return true;
1445
+ }
1446
+ return false;
1447
+ },
1448
+ keys() {
1449
+ const keys = [];
1450
+ for (let i = 0; i < sources.length; i++)
1451
+ keys.push(...Object.keys(resolveSource(sources[i])));
1452
+ return [...new Set(keys)];
1328
1453
  }
1329
- return false;
1330
1454
  },
1331
- keys() {
1332
- const keys = [];
1333
- for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
1334
- return [...new Set(keys)];
1335
- }
1336
- }, propTraps);
1455
+ propTraps
1456
+ );
1337
1457
  }
1338
1458
  const target = {};
1339
1459
  const sourcesMap = {};
@@ -1352,7 +1472,7 @@ function mergeProps(...sources) {
1352
1472
  Object.defineProperty(target, key, {
1353
1473
  enumerable: true,
1354
1474
  configurable: true,
1355
- get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
1475
+ get: resolveSources.bind((sourcesMap[key] = [desc.get.bind(source)]))
1356
1476
  });
1357
1477
  } else {
1358
1478
  if (desc.value !== undefined) defined.add(key);
@@ -1376,47 +1496,60 @@ function splitProps(props, ...keys) {
1376
1496
  if ($PROXY in props) {
1377
1497
  const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
1378
1498
  const res = keys.map(k => {
1379
- return new Proxy({
1380
- get(property) {
1381
- return k.includes(property) ? props[property] : undefined;
1382
- },
1383
- has(property) {
1384
- return k.includes(property) && property in props;
1499
+ return new Proxy(
1500
+ {
1501
+ get(property) {
1502
+ return k.includes(property) ? props[property] : undefined;
1503
+ },
1504
+ has(property) {
1505
+ return k.includes(property) && property in props;
1506
+ },
1507
+ keys() {
1508
+ return k.filter(property => property in props);
1509
+ }
1385
1510
  },
1386
- keys() {
1387
- return k.filter(property => property in props);
1388
- }
1389
- }, propTraps);
1511
+ propTraps
1512
+ );
1390
1513
  });
1391
- res.push(new Proxy({
1392
- get(property) {
1393
- return blocked.has(property) ? undefined : props[property];
1394
- },
1395
- has(property) {
1396
- return blocked.has(property) ? false : property in props;
1397
- },
1398
- keys() {
1399
- return Object.keys(props).filter(k => !blocked.has(k));
1400
- }
1401
- }, propTraps));
1514
+ res.push(
1515
+ new Proxy(
1516
+ {
1517
+ get(property) {
1518
+ return blocked.has(property) ? undefined : props[property];
1519
+ },
1520
+ has(property) {
1521
+ return blocked.has(property) ? false : property in props;
1522
+ },
1523
+ keys() {
1524
+ return Object.keys(props).filter(k => !blocked.has(k));
1525
+ }
1526
+ },
1527
+ propTraps
1528
+ )
1529
+ );
1402
1530
  return res;
1403
1531
  }
1404
1532
  const otherObject = {};
1405
1533
  const objects = keys.map(() => ({}));
1406
1534
  for (const propName of Object.getOwnPropertyNames(props)) {
1407
1535
  const desc = Object.getOwnPropertyDescriptor(props, propName);
1408
- const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1536
+ const isDefaultDesc =
1537
+ !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1409
1538
  let blocked = false;
1410
1539
  let objectIndex = 0;
1411
1540
  for (const k of keys) {
1412
1541
  if (k.includes(propName)) {
1413
1542
  blocked = true;
1414
- isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
1543
+ isDefaultDesc
1544
+ ? (objects[objectIndex][propName] = desc.value)
1545
+ : Object.defineProperty(objects[objectIndex], propName, desc);
1415
1546
  }
1416
1547
  ++objectIndex;
1417
1548
  }
1418
1549
  if (!blocked) {
1419
- isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
1550
+ isDefaultDesc
1551
+ ? (otherObject[propName] = desc.value)
1552
+ : Object.defineProperty(otherObject, propName, desc);
1420
1553
  }
1421
1554
  }
1422
1555
  return [...objects, otherObject];
@@ -1442,19 +1575,24 @@ function lazy(fn) {
1442
1575
  comp = s;
1443
1576
  }
1444
1577
  let Comp;
1445
- return createMemo(() => (Comp = comp()) && untrack(() => {
1446
- if (true) Object.assign(Comp, {
1447
- [$DEVCOMP]: true
1448
- });
1449
- if (!ctx) return Comp(props);
1450
- const c = sharedConfig.context;
1451
- setHydrateContext(ctx);
1452
- const r = Comp(props);
1453
- setHydrateContext(c);
1454
- return r;
1455
- }));
1578
+ return createMemo(
1579
+ () =>
1580
+ (Comp = comp()) &&
1581
+ untrack(() => {
1582
+ if (true)
1583
+ Object.assign(Comp, {
1584
+ [$DEVCOMP]: true
1585
+ });
1586
+ if (!ctx) return Comp(props);
1587
+ const c = sharedConfig.context;
1588
+ setHydrateContext(ctx);
1589
+ const r = Comp(props);
1590
+ setHydrateContext(c);
1591
+ return r;
1592
+ })
1593
+ );
1456
1594
  };
1457
- wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
1595
+ wrap.preload = () => p || ((p = fn()).then(mod => (comp = () => mod.default)), p);
1458
1596
  return wrap;
1459
1597
  }
1460
1598
  let counter = 0;
@@ -1463,75 +1601,113 @@ function createUniqueId() {
1463
1601
  return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
1464
1602
  }
1465
1603
 
1466
- 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.` ;
1604
+ const narrowedError = name =>
1605
+ `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.`;
1467
1606
  function For(props) {
1468
1607
  const fallback = "fallback" in props && {
1469
1608
  fallback: () => props.fallback
1470
1609
  };
1471
- return createMemo(mapArray(() => props.each, props.children, fallback || undefined), undefined, {
1472
- name: "value"
1473
- }) ;
1610
+ return createMemo(
1611
+ mapArray(() => props.each, props.children, fallback || undefined),
1612
+ undefined,
1613
+ {
1614
+ name: "value"
1615
+ }
1616
+ );
1474
1617
  }
1475
1618
  function Index(props) {
1476
1619
  const fallback = "fallback" in props && {
1477
1620
  fallback: () => props.fallback
1478
1621
  };
1479
- return createMemo(indexArray(() => props.each, props.children, fallback || undefined), undefined, {
1480
- name: "value"
1481
- }) ;
1622
+ return createMemo(
1623
+ indexArray(() => props.each, props.children, fallback || undefined),
1624
+ undefined,
1625
+ {
1626
+ name: "value"
1627
+ }
1628
+ );
1482
1629
  }
1483
1630
  function Show(props) {
1484
1631
  const keyed = props.keyed;
1485
1632
  const condition = createMemo(() => props.when, undefined, {
1486
- equals: (a, b) => keyed ? a === b : !a === !b,
1633
+ equals: (a, b) => (keyed ? a === b : !a === !b),
1487
1634
  name: "condition"
1488
- } );
1489
- return createMemo(() => {
1490
- const c = condition();
1491
- if (c) {
1492
- const child = props.children;
1493
- const fn = typeof child === "function" && child.length > 0;
1494
- return fn ? untrack(() => child(keyed ? c : () => {
1495
- if (!untrack(condition)) throw narrowedError("Show");
1496
- return props.when;
1497
- })) : child;
1635
+ });
1636
+ return createMemo(
1637
+ () => {
1638
+ const c = condition();
1639
+ if (c) {
1640
+ const child = props.children;
1641
+ const fn = typeof child === "function" && child.length > 0;
1642
+ return fn
1643
+ ? untrack(() =>
1644
+ child(
1645
+ keyed
1646
+ ? c
1647
+ : () => {
1648
+ if (!untrack(condition)) throw narrowedError("Show");
1649
+ return props.when;
1650
+ }
1651
+ )
1652
+ )
1653
+ : child;
1654
+ }
1655
+ return props.fallback;
1656
+ },
1657
+ undefined,
1658
+ {
1659
+ name: "value"
1498
1660
  }
1499
- return props.fallback;
1500
- }, undefined, {
1501
- name: "value"
1502
- } );
1661
+ );
1503
1662
  }
1504
1663
  function Switch(props) {
1505
1664
  let keyed = false;
1506
- const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1665
+ const equals = (a, b) =>
1666
+ a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1507
1667
  const conditions = children(() => props.children),
1508
- evalConditions = createMemo(() => {
1509
- let conds = conditions();
1510
- if (!Array.isArray(conds)) conds = [conds];
1511
- for (let i = 0; i < conds.length; i++) {
1512
- const c = conds[i].when;
1513
- if (c) {
1514
- keyed = !!conds[i].keyed;
1515
- return [i, c, conds[i]];
1668
+ evalConditions = createMemo(
1669
+ () => {
1670
+ let conds = conditions();
1671
+ if (!Array.isArray(conds)) conds = [conds];
1672
+ for (let i = 0; i < conds.length; i++) {
1673
+ const c = conds[i].when;
1674
+ if (c) {
1675
+ keyed = !!conds[i].keyed;
1676
+ return [i, c, conds[i]];
1677
+ }
1516
1678
  }
1679
+ return [-1];
1680
+ },
1681
+ undefined,
1682
+ {
1683
+ equals,
1684
+ name: "eval conditions"
1517
1685
  }
1518
- return [-1];
1519
- }, undefined, {
1520
- equals,
1521
- name: "eval conditions"
1522
- } );
1523
- return createMemo(() => {
1524
- const [index, when, cond] = evalConditions();
1525
- if (index < 0) return props.fallback;
1526
- const c = cond.children;
1527
- const fn = typeof c === "function" && c.length > 0;
1528
- return fn ? untrack(() => c(keyed ? when : () => {
1529
- if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1530
- return cond.when;
1531
- })) : c;
1532
- }, undefined, {
1533
- name: "value"
1534
- } );
1686
+ );
1687
+ return createMemo(
1688
+ () => {
1689
+ const [index, when, cond] = evalConditions();
1690
+ if (index < 0) return props.fallback;
1691
+ const c = cond.children;
1692
+ const fn = typeof c === "function" && c.length > 0;
1693
+ return fn
1694
+ ? untrack(() =>
1695
+ c(
1696
+ keyed
1697
+ ? when
1698
+ : () => {
1699
+ if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1700
+ return cond.when;
1701
+ }
1702
+ )
1703
+ )
1704
+ : c;
1705
+ },
1706
+ undefined,
1707
+ {
1708
+ name: "value"
1709
+ }
1710
+ );
1535
1711
  }
1536
1712
  function Match(props) {
1537
1713
  return props;
@@ -1542,27 +1718,33 @@ function resetErrorBoundaries() {
1542
1718
  }
1543
1719
  function ErrorBoundary(props) {
1544
1720
  let err;
1545
- if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
1721
+ if (sharedConfig.context && sharedConfig.load)
1722
+ err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
1546
1723
  const [errored, setErrored] = createSignal(err, {
1547
1724
  name: "errored"
1548
- } );
1725
+ });
1549
1726
  Errors || (Errors = new Set());
1550
1727
  Errors.add(setErrored);
1551
1728
  onCleanup(() => Errors.delete(setErrored));
1552
- return createMemo(() => {
1553
- let e;
1554
- if (e = errored()) {
1555
- const f = props.fallback;
1556
- if ((typeof f !== "function" || f.length == 0)) console.error(e);
1557
- return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1729
+ return createMemo(
1730
+ () => {
1731
+ let e;
1732
+ if ((e = errored())) {
1733
+ const f = props.fallback;
1734
+ if (typeof f !== "function" || f.length == 0) console.error(e);
1735
+ return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1736
+ }
1737
+ return catchError(() => props.children, setErrored);
1738
+ },
1739
+ undefined,
1740
+ {
1741
+ name: "value"
1558
1742
  }
1559
- return catchError(() => props.children, setErrored);
1560
- }, undefined, {
1561
- name: "value"
1562
- } );
1743
+ );
1563
1744
  }
1564
1745
 
1565
- const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
1746
+ const suspenseListEquals = (a, b) =>
1747
+ a.showContent === b.showContent && a.showFallback === b.showFallback;
1566
1748
  const SuspenseListContext = createContext();
1567
1749
  function SuspenseList(props) {
1568
1750
  let [wrapper, setWrapper] = createSignal(() => ({
@@ -1574,51 +1756,51 @@ function SuspenseList(props) {
1574
1756
  if (listContext) {
1575
1757
  show = listContext.register(createMemo(() => wrapper()().inFallback));
1576
1758
  }
1577
- const resolved = createMemo(prev => {
1578
- const reveal = props.revealOrder,
1579
- tail = props.tail,
1580
- {
1581
- showContent = true,
1582
- showFallback = true
1583
- } = show ? show() : {},
1584
- reg = registry(),
1585
- reverse = reveal === "backwards";
1586
- if (reveal === "together") {
1587
- const all = reg.every(inFallback => !inFallback());
1588
- const res = reg.map(() => ({
1589
- showContent: all && showContent,
1590
- showFallback
1591
- }));
1592
- res.inFallback = !all;
1593
- return res;
1594
- }
1595
- let stop = false;
1596
- let inFallback = prev.inFallback;
1597
- const res = [];
1598
- for (let i = 0, len = reg.length; i < len; i++) {
1599
- const n = reverse ? len - i - 1 : i,
1600
- s = reg[n]();
1601
- if (!stop && !s) {
1602
- res[n] = {
1603
- showContent,
1759
+ const resolved = createMemo(
1760
+ prev => {
1761
+ const reveal = props.revealOrder,
1762
+ tail = props.tail,
1763
+ { showContent = true, showFallback = true } = show ? show() : {},
1764
+ reg = registry(),
1765
+ reverse = reveal === "backwards";
1766
+ if (reveal === "together") {
1767
+ const all = reg.every(inFallback => !inFallback());
1768
+ const res = reg.map(() => ({
1769
+ showContent: all && showContent,
1604
1770
  showFallback
1605
- };
1606
- } else {
1607
- const next = !stop;
1608
- if (next) inFallback = true;
1609
- res[n] = {
1610
- showContent: next,
1611
- showFallback: !tail || next && tail === "collapsed" ? showFallback : false
1612
- };
1613
- stop = true;
1771
+ }));
1772
+ res.inFallback = !all;
1773
+ return res;
1614
1774
  }
1775
+ let stop = false;
1776
+ let inFallback = prev.inFallback;
1777
+ const res = [];
1778
+ for (let i = 0, len = reg.length; i < len; i++) {
1779
+ const n = reverse ? len - i - 1 : i,
1780
+ s = reg[n]();
1781
+ if (!stop && !s) {
1782
+ res[n] = {
1783
+ showContent,
1784
+ showFallback
1785
+ };
1786
+ } else {
1787
+ const next = !stop;
1788
+ if (next) inFallback = true;
1789
+ res[n] = {
1790
+ showContent: next,
1791
+ showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
1792
+ };
1793
+ stop = true;
1794
+ }
1795
+ }
1796
+ if (!stop) inFallback = false;
1797
+ res.inFallback = inFallback;
1798
+ return res;
1799
+ },
1800
+ {
1801
+ inFallback: false
1615
1802
  }
1616
- if (!stop) inFallback = false;
1617
- res.inFallback = inFallback;
1618
- return res;
1619
- }, {
1620
- inFallback: false
1621
- });
1803
+ );
1622
1804
  setWrapper(() => resolved);
1623
1805
  return createComponent(SuspenseListContext.Provider, {
1624
1806
  value: {
@@ -1693,17 +1875,14 @@ function Suspense(props) {
1693
1875
  ctx = sharedConfig.context;
1694
1876
  if (flicker) {
1695
1877
  flicker();
1696
- return flicker = undefined;
1878
+ return (flicker = undefined);
1697
1879
  }
1698
1880
  if (ctx && p === "$$f") setHydrateContext();
1699
1881
  const rendered = createMemo(() => props.children);
1700
1882
  return createMemo(prev => {
1701
1883
  const inFallback = store.inFallback(),
1702
- {
1703
- showContent = true,
1704
- showFallback = true
1705
- } = show ? show() : {};
1706
- if ((!inFallback || p && p !== "$$f") && showContent) {
1884
+ { showContent = true, showFallback = true } = show ? show() : {};
1885
+ if ((!inFallback || (p && p !== "$$f")) && showContent) {
1707
1886
  store.resolved = true;
1708
1887
  dispose && dispose();
1709
1888
  dispose = ctx = p = undefined;
@@ -1733,9 +1912,68 @@ const DEV = {
1733
1912
  hooks: DevHooks,
1734
1913
  writeSignal,
1735
1914
  registerGraph
1736
- } ;
1915
+ };
1737
1916
  if (globalThis) {
1738
- if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
1917
+ if (!globalThis.Solid$$) globalThis.Solid$$ = true;
1918
+ else
1919
+ console.warn(
1920
+ "You appear to have multiple instances of Solid. This can lead to unexpected behavior."
1921
+ );
1739
1922
  }
1740
1923
 
1741
- 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 };
1924
+ export {
1925
+ $DEVCOMP,
1926
+ $PROXY,
1927
+ $TRACK,
1928
+ DEV,
1929
+ ErrorBoundary,
1930
+ For,
1931
+ Index,
1932
+ Match,
1933
+ Show,
1934
+ Suspense,
1935
+ SuspenseList,
1936
+ Switch,
1937
+ batch,
1938
+ cancelCallback,
1939
+ catchError,
1940
+ children,
1941
+ createComponent,
1942
+ createComputed,
1943
+ createContext,
1944
+ createDeferred,
1945
+ createEffect,
1946
+ createMemo,
1947
+ createReaction,
1948
+ createRenderEffect,
1949
+ createResource,
1950
+ createRoot,
1951
+ createSelector,
1952
+ createSignal,
1953
+ createUniqueId,
1954
+ enableExternalSource,
1955
+ enableHydration,
1956
+ enableScheduling,
1957
+ equalFn,
1958
+ from,
1959
+ getListener,
1960
+ getOwner,
1961
+ indexArray,
1962
+ lazy,
1963
+ mapArray,
1964
+ mergeProps,
1965
+ observable,
1966
+ on,
1967
+ onCleanup,
1968
+ onError,
1969
+ onMount,
1970
+ requestCallback,
1971
+ resetErrorBoundaries,
1972
+ runWithOwner,
1973
+ sharedConfig,
1974
+ splitProps,
1975
+ startTransition,
1976
+ untrack,
1977
+ useContext,
1978
+ useTransition
1979
+ };