solid-js 1.7.8 → 1.7.9

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.js +534 -296
  2. package/dist/server.js +175 -77
  3. package/dist/solid.js +461 -254
  4. package/h/dist/h.cjs +2 -2
  5. package/h/dist/h.js +36 -10
  6. package/h/jsx-runtime/dist/jsx.js +1 -1
  7. package/h/jsx-runtime/types/index.d.ts +11 -8
  8. package/h/jsx-runtime/types/jsx.d.ts +3 -0
  9. package/h/types/hyperscript.d.ts +11 -11
  10. package/h/types/index.d.ts +3 -2
  11. package/html/dist/html.cjs +2 -2
  12. package/html/dist/html.js +218 -96
  13. package/html/types/index.d.ts +3 -2
  14. package/html/types/lit.d.ts +45 -31
  15. package/package.json +1 -1
  16. package/store/dist/dev.cjs +34 -32
  17. package/store/dist/dev.js +141 -67
  18. package/store/dist/server.js +19 -8
  19. package/store/dist/store.cjs +34 -32
  20. package/store/dist/store.js +132 -64
  21. package/store/types/index.d.ts +21 -7
  22. package/store/types/modifiers.d.ts +6 -3
  23. package/store/types/mutable.d.ts +5 -2
  24. package/store/types/server.d.ts +12 -4
  25. package/store/types/store.d.ts +217 -63
  26. package/types/index.d.ts +69 -9
  27. package/types/jsx.d.ts +3 -0
  28. package/types/reactive/array.d.ts +12 -4
  29. package/types/reactive/observable.d.ts +25 -17
  30. package/types/reactive/scheduler.d.ts +9 -6
  31. package/types/reactive/signal.d.ts +227 -136
  32. package/types/render/Suspense.d.ts +5 -5
  33. package/types/render/component.d.ts +62 -31
  34. package/types/render/flow.d.ts +43 -31
  35. package/types/render/hydration.d.ts +12 -12
  36. package/types/server/index.d.ts +55 -2
  37. package/types/server/reactive.d.ts +67 -40
  38. package/types/server/rendering.d.ts +171 -95
  39. package/universal/dist/dev.js +28 -12
  40. package/universal/dist/universal.js +28 -12
  41. package/universal/types/index.d.ts +3 -1
  42. package/universal/types/universal.d.ts +0 -1
  43. package/web/dist/dev.js +610 -79
  44. package/web/dist/server.js +176 -77
  45. package/web/dist/web.js +610 -79
  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/solid.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
  }
@@ -155,17 +157,19 @@ let Listener = null;
155
157
  let Updates = null;
156
158
  let Effects = null;
157
159
  let ExecCount = 0;
158
- const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
160
+ const [transPending, setTransPending] = /*@__PURE__*/ createSignal(false);
159
161
  function createRoot(fn, detachedOwner) {
160
162
  const listener = Listener,
161
163
  owner = Owner,
162
164
  unowned = fn.length === 0,
163
- root = unowned ? UNOWNED : {
164
- owned: null,
165
- cleanups: null,
166
- context: null,
167
- owner: detachedOwner === undefined ? owner : detachedOwner
168
- },
165
+ root = unowned
166
+ ? UNOWNED
167
+ : {
168
+ owned: null,
169
+ cleanups: null,
170
+ context: null,
171
+ owner: detachedOwner === undefined ? owner : detachedOwner
172
+ },
169
173
  updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
170
174
  Owner = root;
171
175
  Listener = null;
@@ -186,7 +190,8 @@ function createSignal(value, options) {
186
190
  };
187
191
  const setter = value => {
188
192
  if (typeof value === "function") {
189
- if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);else value = value(s.value);
193
+ if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.tValue);
194
+ else value = value(s.value);
190
195
  }
191
196
  return writeSignal(s, value);
192
197
  };
@@ -194,11 +199,13 @@ function createSignal(value, options) {
194
199
  }
195
200
  function createComputed(fn, value, options) {
196
201
  const c = createComputation(fn, value, true, STALE);
197
- if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
202
+ if (Scheduler && Transition && Transition.running) Updates.push(c);
203
+ else updateComputation(c);
198
204
  }
199
205
  function createRenderEffect(fn, value, options) {
200
206
  const c = createComputation(fn, value, false, STALE);
201
- if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c);
207
+ if (Scheduler && Transition && Transition.running) Updates.push(c);
208
+ else updateComputation(c);
202
209
  }
203
210
  function createEffect(fn, value, options) {
204
211
  runEffects = runUserEffects;
@@ -210,10 +217,15 @@ function createEffect(fn, value, options) {
210
217
  }
211
218
  function createReaction(onInvalidate, options) {
212
219
  let fn;
213
- const c = createComputation(() => {
214
- fn ? fn() : untrack(onInvalidate);
215
- fn = undefined;
216
- }, undefined, false, 0),
220
+ const c = createComputation(
221
+ () => {
222
+ fn ? fn() : untrack(onInvalidate);
223
+ fn = undefined;
224
+ },
225
+ undefined,
226
+ false,
227
+ 0
228
+ ),
217
229
  s = SuspenseContext && lookup(Owner, SuspenseContext.id);
218
230
  if (s) c.suspense = s;
219
231
  c.user = true;
@@ -238,7 +250,7 @@ function createResource(pSource, pFetcher, pOptions) {
238
250
  let source;
239
251
  let fetcher;
240
252
  let options;
241
- if (arguments.length === 2 && typeof pFetcher === "object" || arguments.length === 1) {
253
+ if ((arguments.length === 2 && typeof pFetcher === "object") || arguments.length === 1) {
242
254
  source = true;
243
255
  fetcher = pSource;
244
256
  options = pFetcher || {};
@@ -252,7 +264,7 @@ function createResource(pSource, pFetcher, pOptions) {
252
264
  id = null,
253
265
  loadedUnderTransition = false,
254
266
  scheduled = false,
255
- resolved = ("initialValue" in options),
267
+ resolved = "initialValue" in options,
256
268
  dynamic = typeof source === "function" && createMemo(source);
257
269
  const contexts = new Set(),
258
270
  [value, setValue] = (options.storage || createSignal)(options.initialValue),
@@ -264,15 +276,19 @@ function createResource(pSource, pFetcher, pOptions) {
264
276
  if (sharedConfig.context) {
265
277
  id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
266
278
  let v;
267
- if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
279
+ if (options.ssrLoadFrom === "initial") initP = options.initialValue;
280
+ else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
268
281
  }
269
282
  function loadEnd(p, v, error, key) {
270
283
  if (pr === p) {
271
284
  pr = null;
272
285
  key !== undefined && (resolved = true);
273
- if ((p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, {
274
- value: v
275
- }));
286
+ if ((p === initP || v === initP) && options.onHydrated)
287
+ queueMicrotask(() =>
288
+ options.onHydrated(key, {
289
+ value: v
290
+ })
291
+ );
276
292
  initP = NO_INIT;
277
293
  if (Transition && p && loadedUnderTransition) {
278
294
  Transition.promises.delete(p);
@@ -303,7 +319,8 @@ function createResource(pSource, pFetcher, pOptions) {
303
319
  createComputed(() => {
304
320
  track();
305
321
  if (pr) {
306
- if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);else if (!contexts.has(c)) {
322
+ if (c.resolved && Transition && loadedUnderTransition) Transition.promises.add(pr);
323
+ else if (!contexts.has(c)) {
307
324
  c.increment();
308
325
  contexts.add(c);
309
326
  }
@@ -322,22 +339,30 @@ function createResource(pSource, pFetcher, pOptions) {
322
339
  return;
323
340
  }
324
341
  if (Transition && pr) Transition.promises.delete(pr);
325
- const p = initP !== NO_INIT ? initP : untrack(() => fetcher(lookup, {
326
- value: value(),
327
- refetching
328
- }));
342
+ const p =
343
+ initP !== NO_INIT
344
+ ? initP
345
+ : untrack(() =>
346
+ fetcher(lookup, {
347
+ value: value(),
348
+ refetching
349
+ })
350
+ );
329
351
  if (typeof p !== "object" || !(p && "then" in p)) {
330
352
  loadEnd(pr, p, undefined, lookup);
331
353
  return p;
332
354
  }
333
355
  pr = p;
334
356
  scheduled = true;
335
- queueMicrotask(() => scheduled = false);
357
+ queueMicrotask(() => (scheduled = false));
336
358
  runUpdates(() => {
337
359
  setState(resolved ? "refreshing" : "pending");
338
360
  trigger();
339
361
  }, false);
340
- return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, undefined, castError(e), lookup));
362
+ return p.then(
363
+ v => loadEnd(p, v, undefined, lookup),
364
+ e => loadEnd(p, undefined, castError(e), lookup)
365
+ );
341
366
  }
342
367
  Object.defineProperties(read, {
343
368
  state: {
@@ -361,21 +386,35 @@ function createResource(pSource, pFetcher, pOptions) {
361
386
  }
362
387
  }
363
388
  });
364
- if (dynamic) createComputed(() => load(false));else load(false);
365
- return [read, {
366
- refetch: load,
367
- mutate: setValue
368
- }];
389
+ if (dynamic) createComputed(() => load(false));
390
+ else load(false);
391
+ return [
392
+ read,
393
+ {
394
+ refetch: load,
395
+ mutate: setValue
396
+ }
397
+ ];
369
398
  }
370
399
  function createDeferred(source, options) {
371
400
  let t,
372
401
  timeout = options ? options.timeoutMs : undefined;
373
- const node = createComputation(() => {
374
- if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? {
375
- timeout
376
- } : undefined);
377
- return source();
378
- }, undefined, true);
402
+ const node = createComputation(
403
+ () => {
404
+ if (!t || !t.fn)
405
+ t = requestCallback(
406
+ () => setDeferred(() => node.value),
407
+ timeout !== undefined
408
+ ? {
409
+ timeout
410
+ }
411
+ : undefined
412
+ );
413
+ return source();
414
+ },
415
+ undefined,
416
+ true
417
+ );
379
418
  const [deferred, setDeferred] = createSignal(node.value, options);
380
419
  updateComputation(node);
381
420
  setDeferred(() => node.value);
@@ -383,28 +422,39 @@ function createDeferred(source, options) {
383
422
  }
384
423
  function createSelector(source, fn = equalFn, options) {
385
424
  const subs = new Map();
386
- const node = createComputation(p => {
387
- const v = source();
388
- for (const [key, val] of subs.entries()) if (fn(key, v) !== fn(key, p)) {
389
- for (const c of val.values()) {
390
- c.state = STALE;
391
- if (c.pure) Updates.push(c);else Effects.push(c);
392
- }
393
- }
394
- return v;
395
- }, undefined, true, STALE);
425
+ const node = createComputation(
426
+ p => {
427
+ const v = source();
428
+ for (const [key, val] of subs.entries())
429
+ if (fn(key, v) !== fn(key, p)) {
430
+ for (const c of val.values()) {
431
+ c.state = STALE;
432
+ if (c.pure) Updates.push(c);
433
+ else Effects.push(c);
434
+ }
435
+ }
436
+ return v;
437
+ },
438
+ undefined,
439
+ true,
440
+ STALE
441
+ );
396
442
  updateComputation(node);
397
443
  return key => {
398
444
  const listener = Listener;
399
445
  if (listener) {
400
446
  let l;
401
- if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener]));
447
+ if ((l = subs.get(key))) l.add(listener);
448
+ else subs.set(key, (l = new Set([listener])));
402
449
  onCleanup(() => {
403
450
  l.delete(listener);
404
451
  !l.size && subs.delete(key);
405
452
  });
406
453
  }
407
- return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value);
454
+ return fn(
455
+ key,
456
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value
457
+ );
408
458
  };
409
459
  }
410
460
  function batch(fn) {
@@ -443,7 +493,9 @@ function onMount(fn) {
443
493
  createEffect(() => untrack(fn));
444
494
  }
445
495
  function onCleanup(fn) {
446
- if (Owner === null) ;else if (Owner.cleanups === null) Owner.cleanups = [fn];else Owner.cleanups.push(fn);
496
+ if (Owner === null);
497
+ else if (Owner.cleanups === null) Owner.cleanups = [fn];
498
+ else Owner.cleanups.push(fn);
447
499
  return fn;
448
500
  }
449
501
  function catchError(fn, handler) {
@@ -463,9 +515,13 @@ function catchError(fn, handler) {
463
515
  }
464
516
  function onError(fn) {
465
517
  ERROR || (ERROR = Symbol("error"));
466
- if (Owner === null) ;else if (Owner.context === null) Owner.context = {
467
- [ERROR]: [fn]
468
- };else if (!Owner.context[ERROR]) Owner.context[ERROR] = [fn];else Owner.context[ERROR].push(fn);
518
+ if (Owner === null);
519
+ else if (Owner.context === null)
520
+ Owner.context = {
521
+ [ERROR]: [fn]
522
+ };
523
+ else if (!Owner.context[ERROR]) Owner.context[ERROR] = [fn];
524
+ else Owner.context[ERROR].push(fn);
469
525
  }
470
526
  function getListener() {
471
527
  return Listener;
@@ -502,15 +558,17 @@ function startTransition(fn) {
502
558
  Owner = o;
503
559
  let t;
504
560
  if (Scheduler || SuspenseContext) {
505
- t = Transition || (Transition = {
506
- sources: new Set(),
507
- effects: [],
508
- promises: new Set(),
509
- disposed: new Set(),
510
- queue: new Set(),
511
- running: true
512
- });
513
- t.done || (t.done = new Promise(res => t.resolve = res));
561
+ t =
562
+ Transition ||
563
+ (Transition = {
564
+ sources: new Set(),
565
+ effects: [],
566
+ promises: new Set(),
567
+ disposed: new Set(),
568
+ queue: new Set(),
569
+ running: true
570
+ });
571
+ t.done || (t.done = new Promise(res => (t.resolve = res)));
514
572
  t.running = true;
515
573
  }
516
574
  runUpdates(fn, false);
@@ -571,7 +629,8 @@ function enableExternalSource(factory) {
571
629
  function readSignal() {
572
630
  const runningTransition = Transition && Transition.running;
573
631
  if (this.sources && (runningTransition ? this.tState : this.state)) {
574
- if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);else {
632
+ if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
633
+ else {
575
634
  const updates = Updates;
576
635
  Updates = null;
577
636
  runUpdates(() => lookUpstream(this), false);
@@ -599,11 +658,12 @@ function readSignal() {
599
658
  return this.value;
600
659
  }
601
660
  function writeSignal(node, value, isComp) {
602
- let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
661
+ let current =
662
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
603
663
  if (!node.comparator || !node.comparator(current, value)) {
604
664
  if (Transition) {
605
665
  const TransitionRunning = Transition.running;
606
- if (TransitionRunning || !isComp && Transition.sources.has(node)) {
666
+ if (TransitionRunning || (!isComp && Transition.sources.has(node))) {
607
667
  Transition.sources.add(node);
608
668
  node.tValue = value;
609
669
  }
@@ -616,14 +676,16 @@ function writeSignal(node, value, isComp) {
616
676
  const TransitionRunning = Transition && Transition.running;
617
677
  if (TransitionRunning && Transition.disposed.has(o)) continue;
618
678
  if (TransitionRunning ? !o.tState : !o.state) {
619
- if (o.pure) Updates.push(o);else Effects.push(o);
679
+ if (o.pure) Updates.push(o);
680
+ else Effects.push(o);
620
681
  if (o.observers) markDownstream(o);
621
682
  }
622
- if (!TransitionRunning) o.state = STALE;else o.tState = STALE;
683
+ if (!TransitionRunning) o.state = STALE;
684
+ else o.tState = STALE;
623
685
  }
624
686
  if (Updates.length > 10e5) {
625
687
  Updates = [];
626
- if (false) ;
688
+ if (false);
627
689
  throw new Error();
628
690
  }
629
691
  }, false);
@@ -638,7 +700,11 @@ function updateComputation(node) {
638
700
  listener = Listener,
639
701
  time = ExecCount;
640
702
  Listener = Owner = node;
641
- runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
703
+ runComputation(
704
+ node,
705
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
706
+ time
707
+ );
642
708
  if (Transition && !Transition.running && Transition.sources.has(node)) {
643
709
  queueMicrotask(() => {
644
710
  runUpdates(() => {
@@ -699,11 +765,14 @@ function createComputation(fn, init, pure, state = STALE, options) {
699
765
  c.state = 0;
700
766
  c.tState = state;
701
767
  }
702
- if (Owner === null) ;else if (Owner !== UNOWNED) {
768
+ if (Owner === null);
769
+ else if (Owner !== UNOWNED) {
703
770
  if (Transition && Transition.running && Owner.pure) {
704
- if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c);
771
+ if (!Owner.tOwned) Owner.tOwned = [c];
772
+ else Owner.tOwned.push(c);
705
773
  } else {
706
- if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c);
774
+ if (!Owner.owned) Owner.owned = [c];
775
+ else Owner.owned.push(c);
707
776
  }
708
777
  }
709
778
  if (ExternalSourceFactory) {
@@ -754,7 +823,8 @@ function runUpdates(fn, init) {
754
823
  if (Updates) return fn();
755
824
  let wait = false;
756
825
  if (!init) Updates = [];
757
- if (Effects) wait = true;else Effects = [];
826
+ if (Effects) wait = true;
827
+ else Effects = [];
758
828
  ExecCount++;
759
829
  try {
760
830
  const res = fn();
@@ -768,7 +838,8 @@ function runUpdates(fn, init) {
768
838
  }
769
839
  function completeUpdates(wait) {
770
840
  if (Updates) {
771
- if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates);
841
+ if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
842
+ else runQueue(Updates);
772
843
  Updates = null;
773
844
  }
774
845
  if (wait) return;
@@ -836,7 +907,8 @@ function runUserEffects(queue) {
836
907
  userLength = 0;
837
908
  for (i = 0; i < queue.length; i++) {
838
909
  const e = queue[i];
839
- if (!e.user) runTop(e);else queue[userLength++] = e;
910
+ if (!e.user) runTop(e);
911
+ else queue[userLength++] = e;
840
912
  }
841
913
  if (sharedConfig.context) {
842
914
  if (sharedConfig.count) {
@@ -854,13 +926,15 @@ function runUserEffects(queue) {
854
926
  }
855
927
  function lookUpstream(node, ignore) {
856
928
  const runningTransition = Transition && Transition.running;
857
- if (runningTransition) node.tState = 0;else node.state = 0;
929
+ if (runningTransition) node.tState = 0;
930
+ else node.state = 0;
858
931
  for (let i = 0; i < node.sources.length; i += 1) {
859
932
  const source = node.sources[i];
860
933
  if (source.sources) {
861
934
  const state = runningTransition ? source.tState : source.state;
862
935
  if (state === STALE) {
863
- if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
936
+ if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
937
+ runTop(source);
864
938
  } else if (state === PENDING) lookUpstream(source, ignore);
865
939
  }
866
940
  }
@@ -870,8 +944,10 @@ function markDownstream(node) {
870
944
  for (let i = 0; i < node.observers.length; i += 1) {
871
945
  const o = node.observers[i];
872
946
  if (runningTransition ? !o.tState : !o.state) {
873
- if (runningTransition) o.tState = PENDING;else o.state = PENDING;
874
- if (o.pure) Updates.push(o);else Effects.push(o);
947
+ if (runningTransition) o.tState = PENDING;
948
+ else o.state = PENDING;
949
+ if (o.pure) Updates.push(o);
950
+ else Effects.push(o);
875
951
  o.observers && markDownstream(o);
876
952
  }
877
953
  }
@@ -908,7 +984,8 @@ function cleanNode(node) {
908
984
  for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
909
985
  node.cleanups = null;
910
986
  }
911
- if (Transition && Transition.running) node.tState = 0;else node.state = 0;
987
+ if (Transition && Transition.running) node.tState = 0;
988
+ else node.state = 0;
912
989
  node.context = null;
913
990
  }
914
991
  function reset(node, top) {
@@ -930,22 +1007,28 @@ function runErrors(err, fns, owner) {
930
1007
  try {
931
1008
  for (const f of fns) f(err);
932
1009
  } catch (e) {
933
- handleError(e, owner && owner.owner || null);
1010
+ handleError(e, (owner && owner.owner) || null);
934
1011
  }
935
1012
  }
936
1013
  function handleError(err, owner = Owner) {
937
1014
  const fns = ERROR && lookup(owner, ERROR);
938
1015
  const error = castError(err);
939
1016
  if (!fns) throw error;
940
- if (Effects) Effects.push({
941
- fn() {
942
- runErrors(error, fns, owner);
943
- },
944
- state: STALE
945
- });else runErrors(error, fns, owner);
1017
+ if (Effects)
1018
+ Effects.push({
1019
+ fn() {
1020
+ runErrors(error, fns, owner);
1021
+ },
1022
+ state: STALE
1023
+ });
1024
+ else runErrors(error, fns, owner);
946
1025
  }
947
1026
  function lookup(owner, key) {
948
- return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined;
1027
+ return owner
1028
+ ? owner.context && owner.context[key] !== undefined
1029
+ ? owner.context[key]
1030
+ : lookup(owner.owner, key)
1031
+ : undefined;
949
1032
  }
950
1033
  function resolveChildren(children) {
951
1034
  if (typeof children === "function" && !children.length) return resolveChildren(children());
@@ -962,12 +1045,16 @@ function resolveChildren(children) {
962
1045
  function createProvider(id, options) {
963
1046
  return function provider(props) {
964
1047
  let res;
965
- createRenderEffect(() => res = untrack(() => {
966
- Owner.context = {
967
- [id]: props.value
968
- };
969
- return children(() => props.children);
970
- }), undefined);
1048
+ createRenderEffect(
1049
+ () =>
1050
+ (res = untrack(() => {
1051
+ Owner.context = {
1052
+ [id]: props.value
1053
+ };
1054
+ return children(() => props.children);
1055
+ })),
1056
+ undefined
1057
+ );
971
1058
  return res;
972
1059
  };
973
1060
  }
@@ -978,7 +1065,8 @@ function observable(input) {
978
1065
  if (!(observer instanceof Object) || observer == null) {
979
1066
  throw new TypeError("Expected the observer to be an object.");
980
1067
  }
981
- const handler = typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
1068
+ const handler =
1069
+ typeof observer === "function" ? observer : observer.next && observer.next.bind(observer);
982
1070
  if (!handler) {
983
1071
  return {
984
1072
  unsubscribe() {}
@@ -1009,7 +1097,7 @@ function from(producer) {
1009
1097
  });
1010
1098
  if ("subscribe" in producer) {
1011
1099
  const unsub = producer.subscribe(v => set(() => v));
1012
- onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub());
1100
+ onCleanup(() => ("unsubscribe" in unsub ? unsub.unsubscribe() : unsub()));
1013
1101
  } else {
1014
1102
  const clean = producer(set);
1015
1103
  onCleanup(clean);
@@ -1061,8 +1149,7 @@ function mapArray(list, mapFn, options = {}) {
1061
1149
  });
1062
1150
  len = 1;
1063
1151
  }
1064
- }
1065
- else if (len === 0) {
1152
+ } else if (len === 0) {
1066
1153
  mapped = new Array(newLen);
1067
1154
  for (j = 0; j < newLen; j++) {
1068
1155
  items[j] = newItems[j];
@@ -1073,8 +1160,16 @@ function mapArray(list, mapFn, options = {}) {
1073
1160
  temp = new Array(newLen);
1074
1161
  tempdisposers = new Array(newLen);
1075
1162
  indexes && (tempIndexes = new Array(newLen));
1076
- for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++);
1077
- for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
1163
+ for (
1164
+ start = 0, end = Math.min(len, newLen);
1165
+ start < end && items[start] === newItems[start];
1166
+ start++
1167
+ );
1168
+ for (
1169
+ end = len - 1, newEnd = newLen - 1;
1170
+ end >= start && newEnd >= start && items[end] === newItems[newEnd];
1171
+ end--, newEnd--
1172
+ ) {
1078
1173
  temp[newEnd] = mapped[end];
1079
1174
  tempdisposers[newEnd] = disposers[end];
1080
1175
  indexes && (tempIndexes[newEnd] = indexes[end]);
@@ -1108,7 +1203,7 @@ function mapArray(list, mapFn, options = {}) {
1108
1203
  }
1109
1204
  } else mapped[j] = createRoot(mapper);
1110
1205
  }
1111
- mapped = mapped.slice(0, len = newLen);
1206
+ mapped = mapped.slice(0, (len = newLen));
1112
1207
  items = newItems.slice(0);
1113
1208
  }
1114
1209
  return mapped;
@@ -1174,7 +1269,7 @@ function indexArray(list, mapFn, options = {}) {
1174
1269
  }
1175
1270
  len = signals.length = disposers.length = newItems.length;
1176
1271
  items = newItems.slice(0);
1177
- return mapped = mapped.slice(0, len);
1272
+ return (mapped = mapped.slice(0, len));
1178
1273
  });
1179
1274
  function mapper(disposer) {
1180
1275
  disposers[i] = disposer;
@@ -1243,29 +1338,33 @@ function mergeProps(...sources) {
1243
1338
  let proxy = false;
1244
1339
  for (let i = 0; i < sources.length; i++) {
1245
1340
  const s = sources[i];
1246
- proxy = proxy || !!s && $PROXY in s;
1247
- sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
1341
+ proxy = proxy || (!!s && $PROXY in s);
1342
+ sources[i] = typeof s === "function" ? ((proxy = true), createMemo(s)) : s;
1248
1343
  }
1249
1344
  if (proxy) {
1250
- return new Proxy({
1251
- get(property) {
1252
- for (let i = sources.length - 1; i >= 0; i--) {
1253
- const v = resolveSource(sources[i])[property];
1254
- if (v !== undefined) return v;
1255
- }
1256
- },
1257
- has(property) {
1258
- for (let i = sources.length - 1; i >= 0; i--) {
1259
- if (property in resolveSource(sources[i])) return true;
1345
+ return new Proxy(
1346
+ {
1347
+ get(property) {
1348
+ for (let i = sources.length - 1; i >= 0; i--) {
1349
+ const v = resolveSource(sources[i])[property];
1350
+ if (v !== undefined) return v;
1351
+ }
1352
+ },
1353
+ has(property) {
1354
+ for (let i = sources.length - 1; i >= 0; i--) {
1355
+ if (property in resolveSource(sources[i])) return true;
1356
+ }
1357
+ return false;
1358
+ },
1359
+ keys() {
1360
+ const keys = [];
1361
+ for (let i = 0; i < sources.length; i++)
1362
+ keys.push(...Object.keys(resolveSource(sources[i])));
1363
+ return [...new Set(keys)];
1260
1364
  }
1261
- return false;
1262
1365
  },
1263
- keys() {
1264
- const keys = [];
1265
- for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
1266
- return [...new Set(keys)];
1267
- }
1268
- }, propTraps);
1366
+ propTraps
1367
+ );
1269
1368
  }
1270
1369
  const target = {};
1271
1370
  const sourcesMap = {};
@@ -1284,7 +1383,7 @@ function mergeProps(...sources) {
1284
1383
  Object.defineProperty(target, key, {
1285
1384
  enumerable: true,
1286
1385
  configurable: true,
1287
- get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
1386
+ get: resolveSources.bind((sourcesMap[key] = [desc.get.bind(source)]))
1288
1387
  });
1289
1388
  } else {
1290
1389
  if (desc.value !== undefined) defined.add(key);
@@ -1308,47 +1407,60 @@ function splitProps(props, ...keys) {
1308
1407
  if ($PROXY in props) {
1309
1408
  const blocked = new Set(keys.length > 1 ? keys.flat() : keys[0]);
1310
1409
  const res = keys.map(k => {
1311
- return new Proxy({
1312
- get(property) {
1313
- return k.includes(property) ? props[property] : undefined;
1314
- },
1315
- has(property) {
1316
- return k.includes(property) && property in props;
1410
+ return new Proxy(
1411
+ {
1412
+ get(property) {
1413
+ return k.includes(property) ? props[property] : undefined;
1414
+ },
1415
+ has(property) {
1416
+ return k.includes(property) && property in props;
1417
+ },
1418
+ keys() {
1419
+ return k.filter(property => property in props);
1420
+ }
1317
1421
  },
1318
- keys() {
1319
- return k.filter(property => property in props);
1320
- }
1321
- }, propTraps);
1422
+ propTraps
1423
+ );
1322
1424
  });
1323
- res.push(new Proxy({
1324
- get(property) {
1325
- return blocked.has(property) ? undefined : props[property];
1326
- },
1327
- has(property) {
1328
- return blocked.has(property) ? false : property in props;
1329
- },
1330
- keys() {
1331
- return Object.keys(props).filter(k => !blocked.has(k));
1332
- }
1333
- }, propTraps));
1425
+ res.push(
1426
+ new Proxy(
1427
+ {
1428
+ get(property) {
1429
+ return blocked.has(property) ? undefined : props[property];
1430
+ },
1431
+ has(property) {
1432
+ return blocked.has(property) ? false : property in props;
1433
+ },
1434
+ keys() {
1435
+ return Object.keys(props).filter(k => !blocked.has(k));
1436
+ }
1437
+ },
1438
+ propTraps
1439
+ )
1440
+ );
1334
1441
  return res;
1335
1442
  }
1336
1443
  const otherObject = {};
1337
1444
  const objects = keys.map(() => ({}));
1338
1445
  for (const propName of Object.getOwnPropertyNames(props)) {
1339
1446
  const desc = Object.getOwnPropertyDescriptor(props, propName);
1340
- const isDefaultDesc = !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1447
+ const isDefaultDesc =
1448
+ !desc.get && !desc.set && desc.enumerable && desc.writable && desc.configurable;
1341
1449
  let blocked = false;
1342
1450
  let objectIndex = 0;
1343
1451
  for (const k of keys) {
1344
1452
  if (k.includes(propName)) {
1345
1453
  blocked = true;
1346
- isDefaultDesc ? objects[objectIndex][propName] = desc.value : Object.defineProperty(objects[objectIndex], propName, desc);
1454
+ isDefaultDesc
1455
+ ? (objects[objectIndex][propName] = desc.value)
1456
+ : Object.defineProperty(objects[objectIndex], propName, desc);
1347
1457
  }
1348
1458
  ++objectIndex;
1349
1459
  }
1350
1460
  if (!blocked) {
1351
- isDefaultDesc ? otherObject[propName] = desc.value : Object.defineProperty(otherObject, propName, desc);
1461
+ isDefaultDesc
1462
+ ? (otherObject[propName] = desc.value)
1463
+ : Object.defineProperty(otherObject, propName, desc);
1352
1464
  }
1353
1465
  }
1354
1466
  return [...objects, otherObject];
@@ -1374,17 +1486,21 @@ function lazy(fn) {
1374
1486
  comp = s;
1375
1487
  }
1376
1488
  let Comp;
1377
- return createMemo(() => (Comp = comp()) && untrack(() => {
1378
- if (false) ;
1379
- if (!ctx) return Comp(props);
1380
- const c = sharedConfig.context;
1381
- setHydrateContext(ctx);
1382
- const r = Comp(props);
1383
- setHydrateContext(c);
1384
- return r;
1385
- }));
1489
+ return createMemo(
1490
+ () =>
1491
+ (Comp = comp()) &&
1492
+ untrack(() => {
1493
+ if (false);
1494
+ if (!ctx) return Comp(props);
1495
+ const c = sharedConfig.context;
1496
+ setHydrateContext(ctx);
1497
+ const r = Comp(props);
1498
+ setHydrateContext(c);
1499
+ return r;
1500
+ })
1501
+ );
1386
1502
  };
1387
- wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
1503
+ wrap.preload = () => p || ((p = fn()).then(mod => (comp = () => mod.default)), p);
1388
1504
  return wrap;
1389
1505
  }
1390
1506
  let counter = 0;
@@ -1409,49 +1525,78 @@ function Index(props) {
1409
1525
  function Show(props) {
1410
1526
  const keyed = props.keyed;
1411
1527
  const condition = createMemo(() => props.when, undefined, {
1412
- equals: (a, b) => keyed ? a === b : !a === !b
1528
+ equals: (a, b) => (keyed ? a === b : !a === !b)
1413
1529
  });
1414
- return createMemo(() => {
1415
- const c = condition();
1416
- if (c) {
1417
- const child = props.children;
1418
- const fn = typeof child === "function" && child.length > 0;
1419
- return fn ? untrack(() => child(keyed ? c : () => {
1420
- if (!untrack(condition)) throw narrowedError("Show");
1421
- return props.when;
1422
- })) : child;
1423
- }
1424
- return props.fallback;
1425
- }, undefined, undefined);
1530
+ return createMemo(
1531
+ () => {
1532
+ const c = condition();
1533
+ if (c) {
1534
+ const child = props.children;
1535
+ const fn = typeof child === "function" && child.length > 0;
1536
+ return fn
1537
+ ? untrack(() =>
1538
+ child(
1539
+ keyed
1540
+ ? c
1541
+ : () => {
1542
+ if (!untrack(condition)) throw narrowedError("Show");
1543
+ return props.when;
1544
+ }
1545
+ )
1546
+ )
1547
+ : child;
1548
+ }
1549
+ return props.fallback;
1550
+ },
1551
+ undefined,
1552
+ undefined
1553
+ );
1426
1554
  }
1427
1555
  function Switch(props) {
1428
1556
  let keyed = false;
1429
- const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1557
+ const equals = (a, b) =>
1558
+ a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1430
1559
  const conditions = children(() => props.children),
1431
- evalConditions = createMemo(() => {
1432
- let conds = conditions();
1433
- if (!Array.isArray(conds)) conds = [conds];
1434
- for (let i = 0; i < conds.length; i++) {
1435
- const c = conds[i].when;
1436
- if (c) {
1437
- keyed = !!conds[i].keyed;
1438
- return [i, c, conds[i]];
1560
+ evalConditions = createMemo(
1561
+ () => {
1562
+ let conds = conditions();
1563
+ if (!Array.isArray(conds)) conds = [conds];
1564
+ for (let i = 0; i < conds.length; i++) {
1565
+ const c = conds[i].when;
1566
+ if (c) {
1567
+ keyed = !!conds[i].keyed;
1568
+ return [i, c, conds[i]];
1569
+ }
1439
1570
  }
1571
+ return [-1];
1572
+ },
1573
+ undefined,
1574
+ {
1575
+ equals
1440
1576
  }
1441
- return [-1];
1442
- }, undefined, {
1443
- equals
1444
- });
1445
- return createMemo(() => {
1446
- const [index, when, cond] = evalConditions();
1447
- if (index < 0) return props.fallback;
1448
- const c = cond.children;
1449
- const fn = typeof c === "function" && c.length > 0;
1450
- return fn ? untrack(() => c(keyed ? when : () => {
1451
- if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1452
- return cond.when;
1453
- })) : c;
1454
- }, undefined, undefined);
1577
+ );
1578
+ return createMemo(
1579
+ () => {
1580
+ const [index, when, cond] = evalConditions();
1581
+ if (index < 0) return props.fallback;
1582
+ const c = cond.children;
1583
+ const fn = typeof c === "function" && c.length > 0;
1584
+ return fn
1585
+ ? untrack(() =>
1586
+ c(
1587
+ keyed
1588
+ ? when
1589
+ : () => {
1590
+ if (untrack(evalConditions)[0] !== index) throw narrowedError("Match");
1591
+ return cond.when;
1592
+ }
1593
+ )
1594
+ )
1595
+ : c;
1596
+ },
1597
+ undefined,
1598
+ undefined
1599
+ );
1455
1600
  }
1456
1601
  function Match(props) {
1457
1602
  return props;
@@ -1463,22 +1608,32 @@ function resetErrorBoundaries() {
1463
1608
  function ErrorBoundary(props) {
1464
1609
  let err;
1465
1610
  let v;
1466
- if (sharedConfig.context && sharedConfig.load && (v = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count))) err = v[0];
1611
+ if (
1612
+ sharedConfig.context &&
1613
+ sharedConfig.load &&
1614
+ (v = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count))
1615
+ )
1616
+ err = v[0];
1467
1617
  const [errored, setErrored] = createSignal(err, undefined);
1468
1618
  Errors || (Errors = new Set());
1469
1619
  Errors.add(setErrored);
1470
1620
  onCleanup(() => Errors.delete(setErrored));
1471
- return createMemo(() => {
1472
- let e;
1473
- if (e = errored()) {
1474
- const f = props.fallback;
1475
- return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1476
- }
1477
- return catchError(() => props.children, setErrored);
1478
- }, undefined, undefined);
1621
+ return createMemo(
1622
+ () => {
1623
+ let e;
1624
+ if ((e = errored())) {
1625
+ const f = props.fallback;
1626
+ return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored())) : f;
1627
+ }
1628
+ return catchError(() => props.children, setErrored);
1629
+ },
1630
+ undefined,
1631
+ undefined
1632
+ );
1479
1633
  }
1480
1634
 
1481
- const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
1635
+ const suspenseListEquals = (a, b) =>
1636
+ a.showContent === b.showContent && a.showFallback === b.showFallback;
1482
1637
  const SuspenseListContext = createContext();
1483
1638
  function SuspenseList(props) {
1484
1639
  let [wrapper, setWrapper] = createSignal(() => ({
@@ -1490,51 +1645,51 @@ function SuspenseList(props) {
1490
1645
  if (listContext) {
1491
1646
  show = listContext.register(createMemo(() => wrapper()().inFallback));
1492
1647
  }
1493
- const resolved = createMemo(prev => {
1494
- const reveal = props.revealOrder,
1495
- tail = props.tail,
1496
- {
1497
- showContent = true,
1498
- showFallback = true
1499
- } = show ? show() : {},
1500
- reg = registry(),
1501
- reverse = reveal === "backwards";
1502
- if (reveal === "together") {
1503
- const all = reg.every(inFallback => !inFallback());
1504
- const res = reg.map(() => ({
1505
- showContent: all && showContent,
1506
- showFallback
1507
- }));
1508
- res.inFallback = !all;
1509
- return res;
1510
- }
1511
- let stop = false;
1512
- let inFallback = prev.inFallback;
1513
- const res = [];
1514
- for (let i = 0, len = reg.length; i < len; i++) {
1515
- const n = reverse ? len - i - 1 : i,
1516
- s = reg[n]();
1517
- if (!stop && !s) {
1518
- res[n] = {
1519
- showContent,
1648
+ const resolved = createMemo(
1649
+ prev => {
1650
+ const reveal = props.revealOrder,
1651
+ tail = props.tail,
1652
+ { showContent = true, showFallback = true } = show ? show() : {},
1653
+ reg = registry(),
1654
+ reverse = reveal === "backwards";
1655
+ if (reveal === "together") {
1656
+ const all = reg.every(inFallback => !inFallback());
1657
+ const res = reg.map(() => ({
1658
+ showContent: all && showContent,
1520
1659
  showFallback
1521
- };
1522
- } else {
1523
- const next = !stop;
1524
- if (next) inFallback = true;
1525
- res[n] = {
1526
- showContent: next,
1527
- showFallback: !tail || next && tail === "collapsed" ? showFallback : false
1528
- };
1529
- stop = true;
1660
+ }));
1661
+ res.inFallback = !all;
1662
+ return res;
1530
1663
  }
1664
+ let stop = false;
1665
+ let inFallback = prev.inFallback;
1666
+ const res = [];
1667
+ for (let i = 0, len = reg.length; i < len; i++) {
1668
+ const n = reverse ? len - i - 1 : i,
1669
+ s = reg[n]();
1670
+ if (!stop && !s) {
1671
+ res[n] = {
1672
+ showContent,
1673
+ showFallback
1674
+ };
1675
+ } else {
1676
+ const next = !stop;
1677
+ if (next) inFallback = true;
1678
+ res[n] = {
1679
+ showContent: next,
1680
+ showFallback: !tail || (next && tail === "collapsed") ? showFallback : false
1681
+ };
1682
+ stop = true;
1683
+ }
1684
+ }
1685
+ if (!stop) inFallback = false;
1686
+ res.inFallback = inFallback;
1687
+ return res;
1688
+ },
1689
+ {
1690
+ inFallback: false
1531
1691
  }
1532
- if (!stop) inFallback = false;
1533
- res.inFallback = inFallback;
1534
- return res;
1535
- }, {
1536
- inFallback: false
1537
- });
1692
+ );
1538
1693
  setWrapper(() => resolved);
1539
1694
  return createComponent(SuspenseListContext.Provider, {
1540
1695
  value: {
@@ -1608,17 +1763,14 @@ function Suspense(props) {
1608
1763
  ctx = sharedConfig.context;
1609
1764
  if (flicker) {
1610
1765
  flicker();
1611
- return flicker = undefined;
1766
+ return (flicker = undefined);
1612
1767
  }
1613
1768
  if (ctx && p === "$$f") setHydrateContext();
1614
1769
  const rendered = createMemo(() => props.children);
1615
1770
  return createMemo(prev => {
1616
1771
  const inFallback = store.inFallback(),
1617
- {
1618
- showContent = true,
1619
- showFallback = true
1620
- } = show ? show() : {};
1621
- if ((!inFallback || p && p !== "$$f") && showContent) {
1772
+ { showContent = true, showFallback = true } = show ? show() : {};
1773
+ if ((!inFallback || (p && p !== "$$f")) && showContent) {
1622
1774
  store.resolved = true;
1623
1775
  dispose && dispose();
1624
1776
  dispose = ctx = p = undefined;
@@ -1646,4 +1798,59 @@ function Suspense(props) {
1646
1798
 
1647
1799
  const DEV = undefined;
1648
1800
 
1649
- 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 };
1801
+ export {
1802
+ $DEVCOMP,
1803
+ $PROXY,
1804
+ $TRACK,
1805
+ DEV,
1806
+ ErrorBoundary,
1807
+ For,
1808
+ Index,
1809
+ Match,
1810
+ Show,
1811
+ Suspense,
1812
+ SuspenseList,
1813
+ Switch,
1814
+ batch,
1815
+ cancelCallback,
1816
+ catchError,
1817
+ children,
1818
+ createComponent,
1819
+ createComputed,
1820
+ createContext,
1821
+ createDeferred,
1822
+ createEffect,
1823
+ createMemo,
1824
+ createReaction,
1825
+ createRenderEffect,
1826
+ createResource,
1827
+ createRoot,
1828
+ createSelector,
1829
+ createSignal,
1830
+ createUniqueId,
1831
+ enableExternalSource,
1832
+ enableHydration,
1833
+ enableScheduling,
1834
+ equalFn,
1835
+ from,
1836
+ getListener,
1837
+ getOwner,
1838
+ indexArray,
1839
+ lazy,
1840
+ mapArray,
1841
+ mergeProps,
1842
+ observable,
1843
+ on,
1844
+ onCleanup,
1845
+ onError,
1846
+ onMount,
1847
+ requestCallback,
1848
+ resetErrorBoundaries,
1849
+ runWithOwner,
1850
+ sharedConfig,
1851
+ splitProps,
1852
+ startTransition,
1853
+ untrack,
1854
+ useContext,
1855
+ useTransition
1856
+ };