solid-js 1.8.6 → 1.8.8

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 +31 -21
  2. package/dist/dev.js +327 -552
  3. package/dist/server.js +75 -170
  4. package/dist/solid.cjs +31 -21
  5. package/dist/solid.js +285 -479
  6. package/h/dist/h.js +8 -34
  7. package/h/jsx-runtime/dist/jsx.js +1 -1
  8. package/h/jsx-runtime/types/index.d.ts +8 -11
  9. package/h/jsx-runtime/types/jsx.d.ts +15 -1
  10. package/h/types/hyperscript.d.ts +11 -11
  11. package/html/dist/html.js +94 -216
  12. package/html/types/lit.d.ts +33 -47
  13. package/package.json +2 -2
  14. package/store/dist/dev.cjs +3 -2
  15. package/store/dist/dev.js +44 -115
  16. package/store/dist/server.js +8 -19
  17. package/store/dist/store.cjs +3 -2
  18. package/store/dist/store.js +41 -106
  19. package/store/types/index.d.ts +7 -21
  20. package/store/types/modifiers.d.ts +3 -6
  21. package/store/types/mutable.d.ts +2 -5
  22. package/store/types/server.d.ts +4 -12
  23. package/store/types/store.d.ts +61 -218
  24. package/types/index.d.ts +10 -75
  25. package/types/jsx.d.ts +15 -1
  26. package/types/reactive/array.d.ts +4 -12
  27. package/types/reactive/observable.d.ts +17 -25
  28. package/types/reactive/scheduler.d.ts +6 -9
  29. package/types/reactive/signal.d.ts +142 -231
  30. package/types/render/Suspense.d.ts +5 -5
  31. package/types/render/component.d.ts +33 -62
  32. package/types/render/flow.d.ts +31 -43
  33. package/types/render/hydration.d.ts +13 -13
  34. package/types/server/index.d.ts +2 -57
  35. package/types/server/reactive.d.ts +42 -73
  36. package/types/server/rendering.d.ts +96 -166
  37. package/universal/dist/dev.js +12 -28
  38. package/universal/dist/universal.js +12 -28
  39. package/universal/types/index.d.ts +1 -3
  40. package/universal/types/universal.d.ts +1 -0
  41. package/web/dist/dev.js +81 -620
  42. package/web/dist/server.cjs +23 -15
  43. package/web/dist/server.js +117 -191
  44. package/web/dist/storage.js +3 -3
  45. package/web/dist/web.js +80 -614
  46. package/web/types/client.d.ts +2 -2
  47. package/web/types/core.d.ts +1 -10
  48. package/web/types/index.d.ts +10 -27
  49. package/web/types/server-mock.d.ts +32 -47
package/dist/dev.cjs CHANGED
@@ -152,7 +152,7 @@ const NO_INIT = {};
152
152
  var Owner = null;
153
153
  let Transition = null;
154
154
  let Scheduler = null;
155
- let ExternalSourceFactory = null;
155
+ let ExternalSourceConfig = null;
156
156
  let Listener = null;
157
157
  let Updates = null;
158
158
  let Effects = null;
@@ -162,7 +162,6 @@ const DevHooks = {
162
162
  afterCreateOwner: null,
163
163
  afterCreateSignal: null
164
164
  };
165
- const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
166
165
  function createRoot(fn, detachedOwner) {
167
166
  const listener = Listener,
168
167
  owner = Owner,
@@ -439,10 +438,11 @@ function batch(fn) {
439
438
  return runUpdates(fn, false);
440
439
  }
441
440
  function untrack(fn) {
442
- if (Listener === null) return fn();
441
+ if (!ExternalSourceConfig && Listener === null) return fn();
443
442
  const listener = Listener;
444
443
  Listener = null;
445
444
  try {
445
+ if (ExternalSourceConfig) return ExternalSourceConfig.untrack(fn);
446
446
  return fn();
447
447
  } finally {
448
448
  Listener = listener;
@@ -541,6 +541,7 @@ function startTransition(fn) {
541
541
  return t ? t.done : undefined;
542
542
  });
543
543
  }
544
+ const [transPending, setTransPending] = /*@__PURE__*/createSignal(false);
544
545
  function useTransition() {
545
546
  return [transPending, startTransition];
546
547
  }
@@ -594,22 +595,31 @@ let SuspenseContext;
594
595
  function getSuspenseContext() {
595
596
  return SuspenseContext || (SuspenseContext = createContext());
596
597
  }
597
- function enableExternalSource(factory) {
598
- if (ExternalSourceFactory) {
599
- const oldFactory = ExternalSourceFactory;
600
- ExternalSourceFactory = (fn, trigger) => {
601
- const oldSource = oldFactory(fn, trigger);
602
- const source = factory(x => oldSource.track(x), trigger);
603
- return {
604
- track: x => source.track(x),
605
- dispose() {
606
- source.dispose();
607
- oldSource.dispose();
608
- }
609
- };
598
+ function enableExternalSource(factory, untrack = fn => fn()) {
599
+ if (ExternalSourceConfig) {
600
+ const {
601
+ factory: oldFactory,
602
+ untrack: oldUntrack
603
+ } = ExternalSourceConfig;
604
+ ExternalSourceConfig = {
605
+ factory: (fn, trigger) => {
606
+ const oldSource = oldFactory(fn, trigger);
607
+ const source = factory(x => oldSource.track(x), trigger);
608
+ return {
609
+ track: x => source.track(x),
610
+ dispose() {
611
+ source.dispose();
612
+ oldSource.dispose();
613
+ }
614
+ };
615
+ },
616
+ untrack: fn => oldUntrack(() => untrack(fn))
610
617
  };
611
618
  } else {
612
- ExternalSourceFactory = factory;
619
+ ExternalSourceConfig = {
620
+ factory,
621
+ untrack
622
+ };
613
623
  }
614
624
  }
615
625
  function readSignal() {
@@ -752,14 +762,14 @@ function createComputation(fn, init, pure, state = STALE, options) {
752
762
  }
753
763
  }
754
764
  if (options && options.name) c.name = options.name;
755
- if (ExternalSourceFactory) {
765
+ if (ExternalSourceConfig && c.fn) {
756
766
  const [track, trigger] = createSignal(undefined, {
757
767
  equals: false
758
768
  });
759
- const ordinary = ExternalSourceFactory(c.fn, trigger);
769
+ const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
760
770
  onCleanup(() => ordinary.dispose());
761
771
  const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());
762
- const inTransition = ExternalSourceFactory(c.fn, triggerInTransition);
772
+ const inTransition = ExternalSourceConfig.factory(c.fn, triggerInTransition);
763
773
  c.fn = x => {
764
774
  track();
765
775
  return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
@@ -1508,7 +1518,7 @@ function Show(props) {
1508
1518
  }
1509
1519
  function Switch(props) {
1510
1520
  let keyed = false;
1511
- const equals = (a, b) => a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1521
+ const equals = (a, b) => (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
1512
1522
  const conditions = children(() => props.children),
1513
1523
  evalConditions = createMemo(() => {
1514
1524
  let conds = conditions();