solid-js 1.8.17 → 1.8.19

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 (52) hide show
  1. package/README.md +223 -223
  2. package/dist/dev.cjs +29 -24
  3. package/dist/dev.js +344 -580
  4. package/dist/server.cjs +31 -18
  5. package/dist/server.js +103 -185
  6. package/dist/solid.cjs +29 -24
  7. package/dist/solid.js +302 -507
  8. package/h/dist/h.cjs +12 -1
  9. package/h/dist/h.js +19 -34
  10. package/h/jsx-runtime/dist/jsx.js +1 -1
  11. package/h/jsx-runtime/types/index.d.ts +8 -11
  12. package/h/jsx-runtime/types/jsx.d.ts +5 -0
  13. package/h/types/hyperscript.d.ts +11 -11
  14. package/html/dist/html.js +94 -216
  15. package/html/types/lit.d.ts +33 -47
  16. package/package.json +3 -3
  17. package/store/dist/dev.js +43 -122
  18. package/store/dist/server.js +8 -19
  19. package/store/dist/store.js +40 -113
  20. package/store/types/index.d.ts +7 -21
  21. package/store/types/modifiers.d.ts +3 -6
  22. package/store/types/mutable.d.ts +2 -5
  23. package/store/types/server.d.ts +4 -12
  24. package/store/types/store.d.ts +62 -219
  25. package/types/index.d.ts +10 -75
  26. package/types/jsx.d.ts +5 -0
  27. package/types/reactive/array.d.ts +6 -14
  28. package/types/reactive/observable.d.ts +18 -26
  29. package/types/reactive/scheduler.d.ts +6 -9
  30. package/types/reactive/signal.d.ts +164 -255
  31. package/types/render/Suspense.d.ts +7 -7
  32. package/types/render/component.d.ts +33 -64
  33. package/types/render/flow.d.ts +37 -49
  34. package/types/render/hydration.d.ts +15 -13
  35. package/types/server/index.d.ts +2 -57
  36. package/types/server/reactive.d.ts +42 -73
  37. package/types/server/rendering.d.ts +99 -168
  38. package/universal/dist/dev.js +12 -28
  39. package/universal/dist/universal.js +12 -28
  40. package/universal/types/index.d.ts +1 -3
  41. package/universal/types/universal.d.ts +1 -0
  42. package/web/dist/dev.cjs +6 -4
  43. package/web/dist/dev.js +88 -630
  44. package/web/dist/server.cjs +6 -6
  45. package/web/dist/server.js +102 -216
  46. package/web/dist/web.cjs +6 -4
  47. package/web/dist/web.js +86 -621
  48. package/web/storage/dist/storage.js +3 -3
  49. package/web/types/client.d.ts +2 -2
  50. package/web/types/core.d.ts +1 -10
  51. package/web/types/index.d.ts +12 -29
  52. package/web/types/server-mock.d.ts +32 -47
package/h/dist/h.cjs CHANGED
@@ -7,12 +7,14 @@ function createHyperScript(r) {
7
7
  function h() {
8
8
  let args = [].slice.call(arguments),
9
9
  e,
10
+ classes = [],
10
11
  multiExpression = false;
11
12
  while (Array.isArray(args[0])) args = args[0];
12
13
  if (args[0][$ELEMENT]) args.unshift(h.Fragment);
13
14
  typeof args[0] === "string" && detectMultiExpression(args);
14
15
  const ret = () => {
15
16
  while (args.length) item(args.shift());
17
+ if (e instanceof Element && classes.length) e.classList.add(...classes);
16
18
  return e;
17
19
  };
18
20
  ret[$ELEMENT] = true;
@@ -31,6 +33,15 @@ function createHyperScript(r) {
31
33
  let dynamic = false;
32
34
  const d = Object.getOwnPropertyDescriptors(l);
33
35
  for (const k in d) {
36
+ if (k === "class" && classes.length !== 0) {
37
+ const fixedClasses = classes.join(" "),
38
+ value = typeof d["class"].value === "function" ? () => fixedClasses + " " + d["class"].value() : fixedClasses + " " + l["class"];
39
+ Object.defineProperty(l, "class", {
40
+ ...d[k],
41
+ value
42
+ });
43
+ classes = [];
44
+ }
34
45
  if (k !== "ref" && k.slice(0, 2) !== "on" && typeof d[k].value === "function") {
35
46
  r.dynamicProperty(l, k);
36
47
  dynamic = true;
@@ -74,7 +85,7 @@ function createHyperScript(r) {
74
85
  const v = m[i],
75
86
  s = v.substring(1, v.length);
76
87
  if (!v) continue;
77
- if (!e) e = r.SVGElements.has(v) ? document.createElementNS("http://www.w3.org/2000/svg", v) : document.createElement(v);else if (v[0] === ".") e.classList.add(s);else if (v[0] === "#") e.setAttribute("id", s);
88
+ if (!e) e = r.SVGElements.has(v) ? document.createElementNS("http://www.w3.org/2000/svg", v) : document.createElement(v);else if (v[0] === ".") classes.push(s);else if (v[0] === "#") e.setAttribute("id", s);
78
89
  }
79
90
  }
80
91
  function detectMultiExpression(list) {
package/h/dist/h.js CHANGED
@@ -1,39 +1,27 @@
1
- import {
2
- spread,
3
- assign,
4
- insert,
5
- createComponent,
6
- dynamicProperty,
7
- SVGElements
8
- } from "solid-js/web";
1
+ import { spread, assign, insert, createComponent, dynamicProperty, SVGElements } from 'solid-js/web';
9
2
 
10
3
  const $ELEMENT = Symbol("hyper-element");
11
4
  function createHyperScript(r) {
12
5
  function h() {
13
6
  let args = [].slice.call(arguments),
14
7
  e,
8
+ classes = [],
15
9
  multiExpression = false;
16
10
  while (Array.isArray(args[0])) args = args[0];
17
11
  if (args[0][$ELEMENT]) args.unshift(h.Fragment);
18
12
  typeof args[0] === "string" && detectMultiExpression(args);
19
13
  const ret = () => {
20
14
  while (args.length) item(args.shift());
15
+ if (e instanceof Element && classes.length) e.classList.add(...classes);
21
16
  return e;
22
17
  };
23
18
  ret[$ELEMENT] = true;
24
19
  return ret;
25
20
  function item(l) {
26
21
  const type = typeof l;
27
- if (l == null);
28
- else if ("string" === type) {
29
- if (!e) parseClass(l);
30
- else e.appendChild(document.createTextNode(l));
31
- } else if (
32
- "number" === type ||
33
- "boolean" === type ||
34
- l instanceof Date ||
35
- l instanceof RegExp
36
- ) {
22
+ if (l == null) ;else if ("string" === type) {
23
+ if (!e) parseClass(l);else e.appendChild(document.createTextNode(l));
24
+ } else if ("number" === type || "boolean" === type || l instanceof Date || l instanceof RegExp) {
37
25
  e.appendChild(document.createTextNode(l.toString()));
38
26
  } else if (Array.isArray(l)) {
39
27
  for (let i = 0; i < l.length; i++) item(l[i]);
@@ -43,23 +31,26 @@ function createHyperScript(r) {
43
31
  let dynamic = false;
44
32
  const d = Object.getOwnPropertyDescriptors(l);
45
33
  for (const k in d) {
34
+ if (k === "class" && classes.length !== 0) {
35
+ const fixedClasses = classes.join(" "),
36
+ value = typeof d["class"].value === "function" ? () => fixedClasses + " " + d["class"].value() : fixedClasses + " " + l["class"];
37
+ Object.defineProperty(l, "class", {
38
+ ...d[k],
39
+ value
40
+ });
41
+ classes = [];
42
+ }
46
43
  if (k !== "ref" && k.slice(0, 2) !== "on" && typeof d[k].value === "function") {
47
44
  r.dynamicProperty(l, k);
48
45
  dynamic = true;
49
46
  } else if (d[k].get) dynamic = true;
50
47
  }
51
- dynamic
52
- ? r.spread(e, l, e instanceof SVGElement, !!args.length)
53
- : r.assign(e, l, e instanceof SVGElement, !!args.length);
48
+ dynamic ? r.spread(e, l, e instanceof SVGElement, !!args.length) : r.assign(e, l, e instanceof SVGElement, !!args.length);
54
49
  } else if ("function" === type) {
55
50
  if (!e) {
56
51
  let props,
57
52
  next = args[0];
58
- if (
59
- next == null ||
60
- (typeof next === "object" && !Array.isArray(next) && !(next instanceof Element))
61
- )
62
- props = args.shift();
53
+ if (next == null || typeof next === "object" && !Array.isArray(next) && !(next instanceof Element)) props = args.shift();
63
54
  props || (props = {});
64
55
  if (args.length) {
65
56
  props.children = args.length > 1 ? args : args[0];
@@ -75,8 +66,7 @@ function createHyperScript(r) {
75
66
  return list;
76
67
  };
77
68
  r.dynamicProperty(props, k);
78
- } else if (typeof d[k].value === "function" && !d[k].value.length)
79
- r.dynamicProperty(props, k);
69
+ } else if (typeof d[k].value === "function" && !d[k].value.length) r.dynamicProperty(props, k);
80
70
  }
81
71
  e = r.createComponent(l, props);
82
72
  args = [];
@@ -93,12 +83,7 @@ function createHyperScript(r) {
93
83
  const v = m[i],
94
84
  s = v.substring(1, v.length);
95
85
  if (!v) continue;
96
- if (!e)
97
- e = r.SVGElements.has(v)
98
- ? document.createElementNS("http://www.w3.org/2000/svg", v)
99
- : document.createElement(v);
100
- else if (v[0] === ".") e.classList.add(s);
101
- else if (v[0] === "#") e.setAttribute("id", s);
86
+ if (!e) e = r.SVGElements.has(v) ? document.createElementNS("http://www.w3.org/2000/svg", v) : document.createElement(v);else if (v[0] === ".") classes.push(s);else if (v[0] === "#") e.setAttribute("id", s);
102
87
  }
103
88
  }
104
89
  function detectMultiExpression(list) {
@@ -1,4 +1,4 @@
1
- import h from "solid-js/h";
1
+ import h from 'solid-js/h';
2
2
 
3
3
  function Fragment(props) {
4
4
  return props.children;
@@ -1,14 +1,11 @@
1
1
  export type { JSX } from "./jsx";
2
2
  import type { JSX } from "./jsx";
3
- declare function Fragment(props: { children: JSX.Element }): JSX.Element;
4
- declare function jsx(
5
- type: any,
6
- props: any
7
- ): () =>
8
- | (Node & {
9
- [key: string]: any;
10
- })
11
- | (Node & {
12
- [key: string]: any;
13
- })[];
3
+ declare function Fragment(props: {
4
+ children: JSX.Element;
5
+ }): JSX.Element;
6
+ declare function jsx(type: any, props: any): () => (Node & {
7
+ [key: string]: any;
8
+ }) | (Node & {
9
+ [key: string]: any;
10
+ })[];
14
11
  export { jsx, jsx as jsxs, jsx as jsxDEV, Fragment };
@@ -155,6 +155,7 @@ export namespace JSX {
155
155
  onAnimationStart?: EventHandlerUnion<T, AnimationEvent>;
156
156
  onAuxClick?: EventHandlerUnion<T, MouseEvent>;
157
157
  onBeforeInput?: EventHandlerUnion<T, InputEvent>;
158
+ onBeforeToggle?: EventHandlerUnion<T, ToggleEvent>;
158
159
  onBlur?: EventHandlerUnion<T, FocusEvent>;
159
160
  onCanPlay?: EventHandlerUnion<T, Event>;
160
161
  onCanPlayThrough?: EventHandlerUnion<T, Event>;
@@ -220,6 +221,7 @@ export namespace JSX {
220
221
  >;
221
222
  onSuspend?: EventHandlerUnion<T, Event>;
222
223
  onTimeUpdate?: EventHandlerUnion<T, Event>;
224
+ onToggle?: EventHandlerUnion<T, ToggleEvent>;
223
225
  onTouchCancel?: EventHandlerUnion<T, TouchEvent>;
224
226
  onTouchEnd?: EventHandlerUnion<T, TouchEvent>;
225
227
  onTouchMove?: EventHandlerUnion<T, TouchEvent>;
@@ -242,6 +244,7 @@ export namespace JSX {
242
244
  onanimationstart?: EventHandlerUnion<T, AnimationEvent>;
243
245
  onauxclick?: EventHandlerUnion<T, MouseEvent>;
244
246
  onbeforeinput?: EventHandlerUnion<T, InputEvent>;
247
+ onbeforetoggle?: EventHandlerUnion<T, ToggleEvent>;
245
248
  onblur?: EventHandlerUnion<T, FocusEvent>;
246
249
  oncanplay?: EventHandlerUnion<T, Event>;
247
250
  oncanplaythrough?: EventHandlerUnion<T, Event>;
@@ -307,6 +310,7 @@ export namespace JSX {
307
310
  >;
308
311
  onsuspend?: EventHandlerUnion<T, Event>;
309
312
  ontimeupdate?: EventHandlerUnion<T, Event>;
313
+ ontoggle?: EventHandlerUnion<T, ToggleEvent>;
310
314
  ontouchcancel?: EventHandlerUnion<T, TouchEvent>;
311
315
  ontouchend?: EventHandlerUnion<T, TouchEvent>;
312
316
  ontouchmove?: EventHandlerUnion<T, TouchEvent>;
@@ -1820,6 +1824,7 @@ export namespace JSX {
1820
1824
  contentScriptType?: FunctionMaybe<string>;
1821
1825
  contentStyleType?: FunctionMaybe<string>;
1822
1826
  xmlns?: FunctionMaybe<string>;
1827
+ "xmlns:xlink"?: FunctionMaybe<string>;
1823
1828
  }
1824
1829
  interface SwitchSVGAttributes<T>
1825
1830
  extends ContainerElementSVGAttributes<T>,
@@ -1,20 +1,20 @@
1
1
  type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
2
2
  interface Runtime {
3
- insert(parent: MountableElement, accessor: any, marker?: Node | null, init?: any): any;
4
- spread(node: Element, accessor: any, isSVG?: Boolean, skipChildren?: Boolean): void;
5
- assign(node: Element, props: any, isSVG?: Boolean, skipChildren?: Boolean): void;
6
- createComponent(Comp: (props: any) => any, props: any): any;
7
- dynamicProperty(props: any, key: string): any;
8
- SVGElements: Set<string>;
3
+ insert(parent: MountableElement, accessor: any, marker?: Node | null, init?: any): any;
4
+ spread(node: Element, accessor: any, isSVG?: Boolean, skipChildren?: Boolean): void;
5
+ assign(node: Element, props: any, isSVG?: Boolean, skipChildren?: Boolean): void;
6
+ createComponent(Comp: (props: any) => any, props: any): any;
7
+ dynamicProperty(props: any, key: string): any;
8
+ SVGElements: Set<string>;
9
9
  }
10
10
  type ExpandableNode = Node & {
11
- [key: string]: any;
11
+ [key: string]: any;
12
12
  };
13
13
  export type HyperScript = {
14
- (...args: any[]): () => ExpandableNode | ExpandableNode[];
15
- Fragment: (props: {
16
- children: (() => ExpandableNode) | (() => ExpandableNode)[];
17
- }) => ExpandableNode[];
14
+ (...args: any[]): () => ExpandableNode | ExpandableNode[];
15
+ Fragment: (props: {
16
+ children: (() => ExpandableNode) | (() => ExpandableNode)[];
17
+ }) => ExpandableNode[];
18
18
  };
19
19
  export declare function createHyperScript(r: Runtime): HyperScript;
20
20
  export {};