solid-js 1.9.11 → 1.9.12

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.
package/dist/dev.cjs CHANGED
@@ -15,9 +15,12 @@ let taskIdCounter = 1,
15
15
  const maxSigned31BitInt = 1073741823;
16
16
  function setupScheduler() {
17
17
  const channel = new MessageChannel(),
18
+ port1 = channel.port1,
18
19
  port = channel.port2;
20
+ if (typeof port1.unref === "function") port1.unref();
21
+ if (typeof port.unref === "function") port.unref();
19
22
  scheduleCallback = () => port.postMessage(null);
20
- channel.port1.onmessage = () => {
23
+ port1.onmessage = () => {
21
24
  if (scheduledCallback !== null) {
22
25
  const currentTime = performance.now();
23
26
  deadline = currentTime + yieldInterval;
@@ -159,11 +162,7 @@ let runEffects = runQueue;
159
162
  const STALE = 1;
160
163
  const PENDING = 2;
161
164
  const UNOWNED = {
162
- owned: null,
163
- cleanups: null,
164
- context: null,
165
- owner: null
166
- };
165
+ };
167
166
  const NO_INIT = {};
168
167
  var Owner = null;
169
168
  let Transition = null;
@@ -764,6 +763,7 @@ function runComputation(node, value, time) {
764
763
  if (node.updatedAt != null && "observers" in node) {
765
764
  writeSignal(node, nextValue, true);
766
765
  } else if (Transition && Transition.running && node.pure) {
766
+ if (!Transition.sources.has(node)) node.value = nextValue;
767
767
  Transition.sources.add(node);
768
768
  node.tValue = nextValue;
769
769
  } else node.value = nextValue;
@@ -797,16 +797,26 @@ function createComputation(fn, init, pure, state = STALE, options) {
797
797
  }
798
798
  if (options && options.name) c.name = options.name;
799
799
  if (ExternalSourceConfig && c.fn) {
800
+ const sourceFn = c.fn;
800
801
  const [track, trigger] = createSignal(undefined, {
801
802
  equals: false
802
803
  });
803
- const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
804
+ const ordinary = ExternalSourceConfig.factory(sourceFn, trigger);
804
805
  onCleanup(() => ordinary.dispose());
805
- const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());
806
- const inTransition = ExternalSourceConfig.factory(c.fn, triggerInTransition);
806
+ let inTransition;
807
+ const triggerInTransition = () => startTransition(trigger).then(() => {
808
+ if (inTransition) {
809
+ inTransition.dispose();
810
+ inTransition = undefined;
811
+ }
812
+ });
807
813
  c.fn = x => {
808
814
  track();
809
- return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
815
+ if (Transition && Transition.running) {
816
+ if (!inTransition) inTransition = ExternalSourceConfig.factory(sourceFn, triggerInTransition);
817
+ return inTransition.track(x);
818
+ }
819
+ return ordinary.track(x);
810
820
  };
811
821
  }
812
822
  DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(c);
package/dist/dev.js CHANGED
@@ -13,9 +13,12 @@ let taskIdCounter = 1,
13
13
  const maxSigned31BitInt = 1073741823;
14
14
  function setupScheduler() {
15
15
  const channel = new MessageChannel(),
16
+ port1 = channel.port1,
16
17
  port = channel.port2;
18
+ if (typeof port1.unref === "function") port1.unref();
19
+ if (typeof port.unref === "function") port.unref();
17
20
  scheduleCallback = () => port.postMessage(null);
18
- channel.port1.onmessage = () => {
21
+ port1.onmessage = () => {
19
22
  if (scheduledCallback !== null) {
20
23
  const currentTime = performance.now();
21
24
  deadline = currentTime + yieldInterval;
@@ -157,11 +160,7 @@ let runEffects = runQueue;
157
160
  const STALE = 1;
158
161
  const PENDING = 2;
159
162
  const UNOWNED = {
160
- owned: null,
161
- cleanups: null,
162
- context: null,
163
- owner: null
164
- };
163
+ };
165
164
  const NO_INIT = {};
166
165
  var Owner = null;
167
166
  let Transition = null;
@@ -762,6 +761,7 @@ function runComputation(node, value, time) {
762
761
  if (node.updatedAt != null && "observers" in node) {
763
762
  writeSignal(node, nextValue, true);
764
763
  } else if (Transition && Transition.running && node.pure) {
764
+ if (!Transition.sources.has(node)) node.value = nextValue;
765
765
  Transition.sources.add(node);
766
766
  node.tValue = nextValue;
767
767
  } else node.value = nextValue;
@@ -795,16 +795,26 @@ function createComputation(fn, init, pure, state = STALE, options) {
795
795
  }
796
796
  if (options && options.name) c.name = options.name;
797
797
  if (ExternalSourceConfig && c.fn) {
798
+ const sourceFn = c.fn;
798
799
  const [track, trigger] = createSignal(undefined, {
799
800
  equals: false
800
801
  });
801
- const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
802
+ const ordinary = ExternalSourceConfig.factory(sourceFn, trigger);
802
803
  onCleanup(() => ordinary.dispose());
803
- const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());
804
- const inTransition = ExternalSourceConfig.factory(c.fn, triggerInTransition);
804
+ let inTransition;
805
+ const triggerInTransition = () => startTransition(trigger).then(() => {
806
+ if (inTransition) {
807
+ inTransition.dispose();
808
+ inTransition = undefined;
809
+ }
810
+ });
805
811
  c.fn = x => {
806
812
  track();
807
- return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
813
+ if (Transition && Transition.running) {
814
+ if (!inTransition) inTransition = ExternalSourceConfig.factory(sourceFn, triggerInTransition);
815
+ return inTransition.track(x);
816
+ }
817
+ return ordinary.track(x);
808
818
  };
809
819
  }
810
820
  DevHooks.afterCreateOwner && DevHooks.afterCreateOwner(c);
package/dist/solid.cjs CHANGED
@@ -15,9 +15,12 @@ let taskIdCounter = 1,
15
15
  const maxSigned31BitInt = 1073741823;
16
16
  function setupScheduler() {
17
17
  const channel = new MessageChannel(),
18
+ port1 = channel.port1,
18
19
  port = channel.port2;
20
+ if (typeof port1.unref === "function") port1.unref();
21
+ if (typeof port.unref === "function") port.unref();
19
22
  scheduleCallback = () => port.postMessage(null);
20
- channel.port1.onmessage = () => {
23
+ port1.onmessage = () => {
21
24
  if (scheduledCallback !== null) {
22
25
  const currentTime = performance.now();
23
26
  deadline = currentTime + yieldInterval;
@@ -717,6 +720,7 @@ function runComputation(node, value, time) {
717
720
  if (node.updatedAt != null && "observers" in node) {
718
721
  writeSignal(node, nextValue, true);
719
722
  } else if (Transition && Transition.running && node.pure) {
723
+ if (!Transition.sources.has(node)) node.value = nextValue;
720
724
  Transition.sources.add(node);
721
725
  node.tValue = nextValue;
722
726
  } else node.value = nextValue;
@@ -749,16 +753,26 @@ function createComputation(fn, init, pure, state = STALE, options) {
749
753
  }
750
754
  }
751
755
  if (ExternalSourceConfig && c.fn) {
756
+ const sourceFn = c.fn;
752
757
  const [track, trigger] = createSignal(undefined, {
753
758
  equals: false
754
759
  });
755
- const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
760
+ const ordinary = ExternalSourceConfig.factory(sourceFn, trigger);
756
761
  onCleanup(() => ordinary.dispose());
757
- const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());
758
- const inTransition = ExternalSourceConfig.factory(c.fn, triggerInTransition);
762
+ let inTransition;
763
+ const triggerInTransition = () => startTransition(trigger).then(() => {
764
+ if (inTransition) {
765
+ inTransition.dispose();
766
+ inTransition = undefined;
767
+ }
768
+ });
759
769
  c.fn = x => {
760
770
  track();
761
- return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
771
+ if (Transition && Transition.running) {
772
+ if (!inTransition) inTransition = ExternalSourceConfig.factory(sourceFn, triggerInTransition);
773
+ return inTransition.track(x);
774
+ }
775
+ return ordinary.track(x);
762
776
  };
763
777
  }
764
778
  return c;
package/dist/solid.js CHANGED
@@ -13,9 +13,12 @@ let taskIdCounter = 1,
13
13
  const maxSigned31BitInt = 1073741823;
14
14
  function setupScheduler() {
15
15
  const channel = new MessageChannel(),
16
+ port1 = channel.port1,
16
17
  port = channel.port2;
18
+ if (typeof port1.unref === "function") port1.unref();
19
+ if (typeof port.unref === "function") port.unref();
17
20
  scheduleCallback = () => port.postMessage(null);
18
- channel.port1.onmessage = () => {
21
+ port1.onmessage = () => {
19
22
  if (scheduledCallback !== null) {
20
23
  const currentTime = performance.now();
21
24
  deadline = currentTime + yieldInterval;
@@ -715,6 +718,7 @@ function runComputation(node, value, time) {
715
718
  if (node.updatedAt != null && "observers" in node) {
716
719
  writeSignal(node, nextValue, true);
717
720
  } else if (Transition && Transition.running && node.pure) {
721
+ if (!Transition.sources.has(node)) node.value = nextValue;
718
722
  Transition.sources.add(node);
719
723
  node.tValue = nextValue;
720
724
  } else node.value = nextValue;
@@ -747,16 +751,26 @@ function createComputation(fn, init, pure, state = STALE, options) {
747
751
  }
748
752
  }
749
753
  if (ExternalSourceConfig && c.fn) {
754
+ const sourceFn = c.fn;
750
755
  const [track, trigger] = createSignal(undefined, {
751
756
  equals: false
752
757
  });
753
- const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
758
+ const ordinary = ExternalSourceConfig.factory(sourceFn, trigger);
754
759
  onCleanup(() => ordinary.dispose());
755
- const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());
756
- const inTransition = ExternalSourceConfig.factory(c.fn, triggerInTransition);
760
+ let inTransition;
761
+ const triggerInTransition = () => startTransition(trigger).then(() => {
762
+ if (inTransition) {
763
+ inTransition.dispose();
764
+ inTransition = undefined;
765
+ }
766
+ });
757
767
  c.fn = x => {
758
768
  track();
759
- return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
769
+ if (Transition && Transition.running) {
770
+ if (!inTransition) inTransition = ExternalSourceConfig.factory(sourceFn, triggerInTransition);
771
+ return inTransition.track(x);
772
+ }
773
+ return ordinary.track(x);
760
774
  };
761
775
  }
762
776
  return c;
package/h/dist/h.js CHANGED
@@ -1,4 +1,4 @@
1
- import { spread, assign, insert, createComponent, dynamicProperty, SVGElements } from 'solid-js/web';
1
+ import { SVGElements, dynamicProperty, createComponent, insert, assign, spread } from 'solid-js/web';
2
2
 
3
3
  const $ELEMENT = Symbol("hyper-element");
4
4
  function createHyperScript(r) {
@@ -64,7 +64,7 @@ function parseTag(tag) {
64
64
  }
65
65
  function pushTextNode(list, html, start) {
66
66
  const end = html.indexOf('<', start);
67
- const content = html.slice(start, end === -1 ? undefined : end);
67
+ const content = html.slice(start, end === -1 ? void 0 : end);
68
68
  if (!/^\s*$/.test(content)) {
69
69
  list.push({
70
70
  type: 'text',
@@ -83,7 +83,7 @@ function pushCommentNode(list, tag) {
83
83
  }
84
84
  function parse(html) {
85
85
  const result = [];
86
- let current = undefined;
86
+ let current = void 0;
87
87
  let level = -1;
88
88
  const arr = [];
89
89
  const byTag = {};
@@ -92,7 +92,7 @@ function parse(html) {
92
92
  const isComment = tag.slice(0, 4) === '<!--';
93
93
  const start = index + tag.length;
94
94
  const nextChar = html.charAt(start);
95
- let parent = undefined;
95
+ let parent = void 0;
96
96
  if (isOpen && !isComment) {
97
97
  level++;
98
98
  current = parseTag(tag);
package/html/dist/html.js CHANGED
@@ -1,4 +1,4 @@
1
- import { effect, style, insert, untrack, spread, createComponent, delegateEvents, classList, mergeProps, dynamicProperty, setAttribute, setAttributeNS, addEventListener, Aliases, getPropAlias, Properties, ChildProperties, DelegatedEvents, SVGElements, SVGNamespace } from 'solid-js/web';
1
+ import { SVGNamespace, SVGElements, DelegatedEvents, ChildProperties, Properties, getPropAlias, Aliases, addEventListener, setAttributeNS, setAttribute, dynamicProperty, mergeProps, classList, delegateEvents, createComponent, spread, untrack, insert, style, effect } from 'solid-js/web';
2
2
 
3
3
  const tagRE = /(?:<!--[\S\s]*?-->|<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>)/g;
4
4
  const attrRE = /(?:\s(?<boolean>[^/\s><=]+?)(?=[\s/>]))|(?:(?<name>\S+?)(?:\s*=\s*(?:(['"])(?<quotedValue>[\s\S]*?)\3|(?<unquotedValue>[^\s>]+))))/g;
@@ -62,7 +62,7 @@ function parseTag(tag) {
62
62
  }
63
63
  function pushTextNode(list, html, start) {
64
64
  const end = html.indexOf('<', start);
65
- const content = html.slice(start, end === -1 ? undefined : end);
65
+ const content = html.slice(start, end === -1 ? void 0 : end);
66
66
  if (!/^\s*$/.test(content)) {
67
67
  list.push({
68
68
  type: 'text',
@@ -81,7 +81,7 @@ function pushCommentNode(list, tag) {
81
81
  }
82
82
  function parse(html) {
83
83
  const result = [];
84
- let current = undefined;
84
+ let current = void 0;
85
85
  let level = -1;
86
86
  const arr = [];
87
87
  const byTag = {};
@@ -90,7 +90,7 @@ function parse(html) {
90
90
  const isComment = tag.slice(0, 4) === '<!--';
91
91
  const start = index + tag.length;
92
92
  const nextChar = html.charAt(start);
93
- let parent = undefined;
93
+ let parent = void 0;
94
94
  if (isOpen && !isComment) {
95
95
  level++;
96
96
  current = parseTag(tag);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "solid-js",
3
3
  "description": "A declarative JavaScript library for building user interfaces.",
4
- "version": "1.9.11",
4
+ "version": "1.9.12",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
package/store/dist/dev.js CHANGED
@@ -1,4 +1,4 @@
1
- import { DEV as DEV$1, $PROXY, $TRACK, getListener, batch, createSignal } from 'solid-js';
1
+ import { $PROXY, DEV as DEV$1, batch, $TRACK, getListener, createSignal } from 'solid-js';
2
2
 
3
3
  const $RAW = Symbol("store-raw"),
4
4
  $NODE = Symbol("store-node"),
@@ -1,4 +1,4 @@
1
- import { $PROXY, $TRACK, getListener, batch, createSignal } from 'solid-js';
1
+ import { batch, $PROXY, $TRACK, getListener, createSignal } from 'solid-js';
2
2
 
3
3
  const $RAW = Symbol("store-raw"),
4
4
  $NODE = Symbol("store-node"),
@@ -1,4 +1,4 @@
1
- import { createMemo, createRoot, createRenderEffect, mergeProps, createComponent, untrack } from 'solid-js';
1
+ import { createMemo, createComponent, createRenderEffect, mergeProps, untrack, createRoot } from 'solid-js';
2
2
 
3
3
  const memo = fn => createMemo(() => fn());
4
4
 
@@ -1,4 +1,4 @@
1
- import { createMemo, createRoot, createRenderEffect, mergeProps, createComponent, untrack } from 'solid-js';
1
+ import { createMemo, createComponent, createRenderEffect, mergeProps, untrack, createRoot } from 'solid-js';
2
2
 
3
3
  const memo = fn => createMemo(() => fn());
4
4
 
package/web/dist/dev.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createMemo, createRoot, createRenderEffect, untrack, sharedConfig, enableHydration, getOwner, createEffect, runWithOwner, createSignal, onCleanup, $DEVCOMP, splitProps } from 'solid-js';
1
+ import { createMemo, sharedConfig, createRenderEffect, createRoot, untrack, splitProps, getOwner, createEffect, runWithOwner, createSignal, onCleanup, $DEVCOMP, enableHydration } from 'solid-js';
2
2
  export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, mergeProps, untrack } from 'solid-js';
3
3
 
4
4
  const booleans = ["allowfullscreen", "async", "alpha",
@@ -415,13 +415,13 @@ function renderToStream(code, options = {}) {
415
415
  writable = {
416
416
  end() {
417
417
  writer.releaseLock();
418
- w.close();
418
+ w.close().catch(() => {});
419
419
  resolve();
420
420
  }
421
421
  };
422
422
  buffer = {
423
423
  write(payload) {
424
- writer.write(encoder.encode(payload));
424
+ writer.write(encoder.encode(payload)).catch(() => {});
425
425
  }
426
426
  };
427
427
  buffer.write(tmp);
@@ -1,6 +1,6 @@
1
1
  import { createMemo, sharedConfig, createRoot, splitProps } from 'solid-js';
2
2
  export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, mergeProps, untrack } from 'solid-js';
3
- import { Feature, Serializer, getCrossReferenceHeader } from 'seroval';
3
+ import { Serializer, Feature, getCrossReferenceHeader } from 'seroval';
4
4
  import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
5
5
 
6
6
  const booleans = ["allowfullscreen", "async", "alpha",
@@ -414,13 +414,13 @@ function renderToStream(code, options = {}) {
414
414
  writable = {
415
415
  end() {
416
416
  writer.releaseLock();
417
- w.close();
417
+ w.close().catch(() => {});
418
418
  resolve();
419
419
  }
420
420
  };
421
421
  buffer = {
422
422
  write(payload) {
423
- writer.write(encoder.encode(payload));
423
+ writer.write(encoder.encode(payload)).catch(() => {});
424
424
  }
425
425
  };
426
426
  buffer.write(tmp);
package/web/dist/web.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createMemo, createRoot, createRenderEffect, untrack, sharedConfig, enableHydration, getOwner, createEffect, runWithOwner, createSignal, onCleanup, splitProps } from 'solid-js';
1
+ import { createMemo, sharedConfig, createRenderEffect, createRoot, untrack, splitProps, getOwner, createEffect, runWithOwner, createSignal, onCleanup, enableHydration } from 'solid-js';
2
2
  export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, mergeProps, untrack } from 'solid-js';
3
3
 
4
4
  const booleans = ["allowfullscreen", "async", "alpha",
@@ -9,7 +9,12 @@ export const SVGNamespace: Record<string, string>;
9
9
  export function getPropAlias(prop: string, tagName: string): string | undefined;
10
10
 
11
11
  type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
12
- export function render(code: () => JSX.Element, element: MountableElement): () => void;
12
+ export function render(
13
+ code: () => JSX.Element,
14
+ element: MountableElement,
15
+ init?: JSX.Element,
16
+ options?: { owner?: unknown }
17
+ ): () => void;
13
18
  export function template(html: string, isCE?: boolean, isSVG?: boolean): () => Element;
14
19
  export function effect<T>(fn: (prev?: T) => T, init?: T): void;
15
20
  export function memo<T>(fn: () => T, equal: boolean): () => T;
@@ -29,12 +34,20 @@ export function spread<T>(
29
34
  isSVG?: Boolean,
30
35
  skipChildren?: Boolean
31
36
  ): void;
32
- export function assign(node: Element, props: any, isSVG?: Boolean, skipChildren?: Boolean): void;
37
+ export function assign(
38
+ node: Element,
39
+ props: any,
40
+ isSVG?: Boolean,
41
+ skipChildren?: Boolean,
42
+ prevProps?: any,
43
+ skipRef?: Boolean
44
+ ): void;
33
45
  export function setAttribute(node: Element, name: string, value: string): void;
34
46
  export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
35
47
  export function setBoolAttribute(node: Element, name: string, value: any): void;
36
48
  export function className(node: Element, value: string): void;
37
49
  export function setProperty(node: Element, name: string, value: any): void;
50
+ export function setStyleProperty(node: Element, name: string, value: any): void;
38
51
  export function addEventListener(
39
52
  node: Element,
40
53
  name: string,
@@ -54,6 +67,7 @@ export function style(
54
67
  export function getOwner(): unknown;
55
68
  export function mergeProps(...sources: unknown[]): unknown;
56
69
  export function dynamicProperty(props: unknown, key: string): unknown;
70
+ export function use<Arg, Ret>(fn: (node: Element, arg: Arg) => Ret, node: Element, arg?: Arg): Ret
57
71
 
58
72
  export function hydrate(
59
73
  fn: () => JSX.Element,
@@ -61,7 +75,7 @@ export function hydrate(
61
75
  options?: { renderId?: string; owner?: unknown }
62
76
  ): () => void;
63
77
  export function getHydrationKey(): string;
64
- export function getNextElement(template?: HTMLTemplateElement): Element;
78
+ export function getNextElement(template?: () => Element): Element;
65
79
  export function getNextMatch(start: Node, elementName: string): Element;
66
80
  export function getNextMarker(start: Node): [Node, Array<Node>];
67
81
  export function useAssets(fn: () => JSX.Element): void;