solid-js 1.8.22 → 1.9.0

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 (59) hide show
  1. package/dist/dev.cjs +7 -6
  2. package/dist/dev.js +567 -325
  3. package/dist/server.cjs +1 -1
  4. package/dist/server.js +169 -75
  5. package/dist/solid.cjs +7 -6
  6. package/dist/solid.js +494 -283
  7. package/h/dist/h.js +40 -9
  8. package/h/jsx-runtime/dist/jsx.js +1 -1
  9. package/h/jsx-runtime/types/index.d.ts +13 -10
  10. package/h/jsx-runtime/types/jsx.d.ts +22 -1
  11. package/h/types/hyperscript.d.ts +11 -11
  12. package/h/types/index.d.ts +1 -1
  13. package/html/dist/html.cjs +4 -2
  14. package/html/dist/html.js +222 -95
  15. package/html/types/index.d.ts +1 -1
  16. package/html/types/lit.d.ts +52 -33
  17. package/package.json +1 -5
  18. package/store/dist/dev.cjs +1 -1
  19. package/store/dist/dev.js +123 -43
  20. package/store/dist/server.cjs +4 -0
  21. package/store/dist/server.js +23 -8
  22. package/store/dist/store.cjs +1 -1
  23. package/store/dist/store.js +114 -40
  24. package/store/package.json +0 -4
  25. package/store/types/index.d.ts +21 -7
  26. package/store/types/modifiers.d.ts +6 -3
  27. package/store/types/mutable.d.ts +5 -2
  28. package/store/types/server.d.ts +26 -5
  29. package/store/types/store.d.ts +219 -62
  30. package/types/index.d.ts +75 -10
  31. package/types/jsx.d.ts +35 -8
  32. package/types/reactive/array.d.ts +12 -4
  33. package/types/reactive/observable.d.ts +25 -17
  34. package/types/reactive/scheduler.d.ts +9 -6
  35. package/types/reactive/signal.d.ts +236 -143
  36. package/types/render/Suspense.d.ts +5 -5
  37. package/types/render/component.d.ts +64 -33
  38. package/types/render/flow.d.ts +43 -31
  39. package/types/render/hydration.d.ts +15 -15
  40. package/types/server/index.d.ts +57 -2
  41. package/types/server/reactive.d.ts +73 -42
  42. package/types/server/rendering.d.ts +169 -98
  43. package/universal/dist/dev.js +28 -12
  44. package/universal/dist/universal.js +28 -12
  45. package/universal/types/index.d.ts +3 -1
  46. package/universal/types/universal.d.ts +0 -1
  47. package/web/dist/dev.cjs +57 -24
  48. package/web/dist/dev.js +679 -101
  49. package/web/dist/server.cjs +96 -15
  50. package/web/dist/server.js +676 -105
  51. package/web/dist/web.cjs +53 -23
  52. package/web/dist/web.js +664 -99
  53. package/web/package.json +0 -4
  54. package/web/storage/dist/storage.js +3 -3
  55. package/web/types/client.d.ts +5 -3
  56. package/web/types/core.d.ts +10 -1
  57. package/web/types/index.d.ts +27 -10
  58. package/web/types/server-mock.d.ts +47 -32
  59. package/web/types/server.d.ts +88 -0
package/web/package.json CHANGED
@@ -2,10 +2,6 @@
2
2
  "name": "solid-js/web",
3
3
  "main": "./dist/server.cjs",
4
4
  "module": "./dist/server.js",
5
- "browser": {
6
- "./dist/server.cjs": "./dist/web.cjs",
7
- "./dist/server.js": "./dist/web.js"
8
- },
9
5
  "unpkg": "./dist/web.cjs",
10
6
  "types": "./types/index.d.ts",
11
7
  "type": "module",
@@ -1,9 +1,9 @@
1
- import { AsyncLocalStorage } from 'node:async_hooks';
2
- import { isServer, RequestContext } from 'solid-js/web';
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ import { isServer, RequestContext } from "solid-js/web";
3
3
 
4
4
  function provideRequestEvent(init, cb) {
5
5
  if (!isServer) throw new Error("Attempting to use server context in non-server build");
6
- const ctx = globalThis[RequestContext] = globalThis[RequestContext] || new AsyncLocalStorage();
6
+ const ctx = (globalThis[RequestContext] = globalThis[RequestContext] || new AsyncLocalStorage());
7
7
  return ctx.run(init, cb);
8
8
  }
9
9
 
@@ -32,12 +32,13 @@ export function spread<T>(
32
32
  export function assign(node: Element, props: any, isSVG?: Boolean, skipChildren?: Boolean): void;
33
33
  export function setAttribute(node: Element, name: string, value: string): void;
34
34
  export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
35
+ export function setBoolAttribute(node: Element, name: string, value: any): void;
35
36
  export function className(node: Element, value: string): void;
36
37
  export function setProperty(node: Element, name: string, value: any): void;
37
38
  export function addEventListener(
38
39
  node: Element,
39
40
  name: string,
40
- handler: () => void,
41
+ handler: EventListener | EventListenerObject | (EventListenerObject & AddEventListenerOptions),
41
42
  delegate: boolean
42
43
  ): void;
43
44
  export function classList(
@@ -57,7 +58,7 @@ export function dynamicProperty(props: unknown, key: string): unknown;
57
58
  export function hydrate(
58
59
  fn: () => JSX.Element,
59
60
  node: MountableElement,
60
- options?: { renderId?: string, owner?: unknown }
61
+ options?: { renderId?: string; owner?: unknown }
61
62
  ): () => void;
62
63
  export function getHydrationKey(): string;
63
64
  export function getNextElement(template?: HTMLTemplateElement): Element;
@@ -74,4 +75,5 @@ export interface RequestEvent {
74
75
  request: Request;
75
76
  }
76
77
  export declare const RequestContext: unique symbol;
77
- export function getRequestEvent(): RequestEvent | undefined;
78
+ export function getRequestEvent(): RequestEvent | undefined;
79
+ export function runHydrationEvents(): void;
@@ -1 +1,10 @@
1
- export { getOwner, createComponent, createRoot as root, createRenderEffect as effect, createMemo as memo, sharedConfig, untrack, mergeProps } from "solid-js";
1
+ export {
2
+ getOwner,
3
+ createComponent,
4
+ createRoot as root,
5
+ createRenderEffect as effect,
6
+ createMemo as memo,
7
+ sharedConfig,
8
+ untrack,
9
+ mergeProps
10
+ } from "solid-js";
@@ -1,7 +1,17 @@
1
1
  import { hydrate as hydrateCore } from "./client.js";
2
2
  import { JSX, ComponentProps, ValidComponent } from "solid-js";
3
3
  export * from "./client.js";
4
- export { For, Show, Suspense, SuspenseList, Switch, Match, Index, ErrorBoundary, mergeProps } from "solid-js";
4
+ export {
5
+ For,
6
+ Show,
7
+ Suspense,
8
+ SuspenseList,
9
+ Switch,
10
+ Match,
11
+ Index,
12
+ ErrorBoundary,
13
+ mergeProps
14
+ } from "solid-js";
5
15
  export * from "./server-mock.js";
6
16
  export declare const isServer: boolean;
7
17
  export declare const isDev: boolean;
@@ -14,18 +24,25 @@ export declare const hydrate: typeof hydrateCore;
14
24
  * @description https://docs.solidjs.com/reference/components/portal
15
25
  */
16
26
  export declare function Portal<T extends boolean = false, S extends boolean = false>(props: {
17
- mount?: Node;
18
- useShadow?: T;
19
- isSVG?: S;
20
- ref?: (S extends true ? SVGGElement : HTMLDivElement) | ((el: (T extends true ? {
21
- readonly shadowRoot: ShadowRoot;
22
- } : {}) & (S extends true ? SVGGElement : HTMLDivElement)) => void);
23
- children: JSX.Element;
27
+ mount?: Node;
28
+ useShadow?: T;
29
+ isSVG?: S;
30
+ ref?:
31
+ | (S extends true ? SVGGElement : HTMLDivElement)
32
+ | ((
33
+ el: (T extends true
34
+ ? {
35
+ readonly shadowRoot: ShadowRoot;
36
+ }
37
+ : {}) &
38
+ (S extends true ? SVGGElement : HTMLDivElement)
39
+ ) => void);
40
+ children: JSX.Element;
24
41
  }): Text;
25
42
  export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
26
- [K in keyof P]: P[K];
43
+ [K in keyof P]: P[K];
27
44
  } & {
28
- component: T | undefined;
45
+ component: T | undefined;
29
46
  };
30
47
  /**
31
48
  * Renders an arbitrary custom or native component and passes the other props
@@ -1,39 +1,46 @@
1
- export declare function renderToString<T>(fn: () => T, options?: {
1
+ export declare function renderToString<T>(
2
+ fn: () => T,
3
+ options?: {
2
4
  nonce?: string;
3
5
  renderId?: string;
4
- }): string;
5
- export declare function renderToStringAsync<T>(fn: () => T, options?: {
6
+ }
7
+ ): string;
8
+ export declare function renderToStringAsync<T>(
9
+ fn: () => T,
10
+ options?: {
6
11
  timeoutMs?: number;
7
12
  nonce?: string;
8
13
  renderId?: string;
9
- }): Promise<string>;
10
- export declare function renderToStream<T>(fn: () => T, options?: {
14
+ }
15
+ ): Promise<string>;
16
+ export declare function renderToStream<T>(
17
+ fn: () => T,
18
+ options?: {
11
19
  nonce?: string;
12
20
  renderId?: string;
13
- onCompleteShell?: (info: {
14
- write: (v: string) => void;
15
- }) => void;
16
- onCompleteAll?: (info: {
17
- write: (v: string) => void;
18
- }) => void;
19
- }): {
20
- pipe: (writable: {
21
- write: (v: string) => void;
22
- }) => void;
23
- pipeTo: (writable: WritableStream) => void;
21
+ onCompleteShell?: (info: { write: (v: string) => void }) => void;
22
+ onCompleteAll?: (info: { write: (v: string) => void }) => void;
23
+ }
24
+ ): {
25
+ pipe: (writable: { write: (v: string) => void }) => void;
26
+ pipeTo: (writable: WritableStream) => void;
24
27
  };
25
- export declare function ssr(template: string[] | string, ...nodes: any[]): {
26
- t: string;
28
+ export declare function ssr(
29
+ template: string[] | string,
30
+ ...nodes: any[]
31
+ ): {
32
+ t: string;
27
33
  };
28
- export declare function ssrElement(name: string, props: any, children: any, needsId: boolean): {
29
- t: string;
34
+ export declare function ssrElement(
35
+ name: string,
36
+ props: any,
37
+ children: any,
38
+ needsId: boolean
39
+ ): {
40
+ t: string;
30
41
  };
31
- export declare function ssrClassList(value: {
32
- [k: string]: boolean;
33
- }): string;
34
- export declare function ssrStyle(value: {
35
- [k: string]: string;
36
- }): string;
42
+ export declare function ssrClassList(value: { [k: string]: boolean }): string;
43
+ export declare function ssrStyle(value: { [k: string]: string }): string;
37
44
  export declare function ssrAttribute(key: string, value: boolean): string;
38
45
  export declare function ssrHydrationKey(): string;
39
46
  export declare function resolveSSRNode(node: any): string;
@@ -43,23 +50,31 @@ export declare function escape(html: string): string;
43
50
  */
44
51
  export declare function ssrSpread(props: any, isSVG: boolean, skipChildren: boolean): void;
45
52
  export type LegacyResults = {
46
- startWriting: () => void;
53
+ startWriting: () => void;
47
54
  };
48
55
  /**
49
56
  * @deprecated Replaced by renderToStream
50
57
  */
51
- export declare function pipeToWritable<T>(fn: () => T, writable: WritableStream, options?: {
58
+ export declare function pipeToWritable<T>(
59
+ fn: () => T,
60
+ writable: WritableStream,
61
+ options?: {
52
62
  nonce?: string;
53
63
  onReady?: (res: LegacyResults) => void;
54
64
  onCompleteAll?: () => void;
55
- }): void;
65
+ }
66
+ ): void;
56
67
  /**
57
68
  * @deprecated Replaced by renderToStream
58
69
  */
59
- export declare function pipeToNodeWritable<T>(fn: () => T, writable: {
70
+ export declare function pipeToNodeWritable<T>(
71
+ fn: () => T,
72
+ writable: {
60
73
  write: (v: string) => void;
61
- }, options?: {
74
+ },
75
+ options?: {
62
76
  nonce?: string;
63
77
  onReady?: (res: LegacyResults) => void;
64
78
  onCompleteAll?: () => void;
65
- }): void;
79
+ }
80
+ ): void;
@@ -1,3 +1,15 @@
1
+ import { JSX } from "./jsx.js";
2
+ export const Aliases: Record<string, string>;
3
+ export const Properties: Set<string>;
4
+ export const ChildProperties: Set<string>;
5
+ export const DelegatedEvents: Set<string>;
6
+ export const DOMElements: Set<string>;
7
+ export const SVGElements: Set<string>;
8
+ export const SVGNamespace: Record<string, string>;
9
+ export function getPropAlias(prop: string, tagName: string): string | undefined;
10
+
11
+ type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
12
+
1
13
  export function renderToString<T>(
2
14
  fn: () => T,
3
15
  options?: {
@@ -87,3 +99,79 @@ export function pipeToNodeWritable<T>(
87
99
  onCompleteAll?: () => void;
88
100
  }
89
101
  ): void;
102
+
103
+ export function untrack<T>(fn: () => T): T;
104
+
105
+ // client-only APIs
106
+
107
+ /** @deprecated not supported on the server side */
108
+ export function classList(
109
+ node: Element,
110
+ value: { [k: string]: boolean },
111
+ prev?: { [k: string]: boolean }
112
+ ): { [k: string]: boolean };
113
+
114
+ /** @deprecated not supported on the server side */
115
+ export function style(
116
+ node: Element,
117
+ value: { [k: string]: string },
118
+ prev?: { [k: string]: string }
119
+ ): void;
120
+
121
+ /** @deprecated not supported on the server side */
122
+ export function insert<T>(
123
+ parent: MountableElement,
124
+ accessor: (() => T) | T,
125
+ marker?: Node | null,
126
+ init?: JSX.Element
127
+ ): JSX.Element;
128
+
129
+ /** @deprecated not supported on the server side */
130
+ export function spread<T>(
131
+ node: Element,
132
+ accessor: (() => T) | T,
133
+ isSVG?: Boolean,
134
+ skipChildren?: Boolean
135
+ ): void;
136
+
137
+ /** @deprecated not supported on the server side */
138
+ export function delegateEvents(eventNames: string[], d?: Document): void;
139
+ /** @deprecated not supported on the server side */
140
+ export function dynamicProperty(props: unknown, key: string): unknown;
141
+ /** @deprecated not supported on the server side */
142
+ export function setAttribute(node: Element, name: string, value: string): void;
143
+ /** @deprecated not supported on the server side */
144
+ export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
145
+
146
+ /** @deprecated not supported on the server side */
147
+ export function addEventListener(
148
+ node: Element,
149
+ name: string,
150
+ handler: () => void,
151
+ delegate: boolean
152
+ ): void;
153
+
154
+ /** @deprecated not supported on the server side */
155
+ export function render(code: () => JSX.Element, element: MountableElement): () => void;
156
+ /** @deprecated not supported on the server side */
157
+ export function template(html: string, isCE?: boolean, isSVG?: boolean): () => Element;
158
+ /** @deprecated not supported on the server side */
159
+ export function setProperty(node: Element, name: string, value: any): void;
160
+ /** @deprecated not supported on the server side */
161
+ export function className(node: Element, value: string): void;
162
+ /** @deprecated not supported on the server side */
163
+ export function assign(node: Element, props: any, isSVG?: Boolean, skipChildren?: Boolean): void;
164
+
165
+ /** @deprecated not supported on the server side */
166
+ export function hydrate(
167
+ fn: () => JSX.Element,
168
+ node: MountableElement,
169
+ options?: { renderId?: string; owner?: unknown }
170
+ ): () => void;
171
+
172
+ /** @deprecated not supported on the server side */
173
+ export function getNextElement(template?: HTMLTemplateElement): Element;
174
+ /** @deprecated not supported on the server side */
175
+ export function getNextMatch(start: Node, elementName: string): Element;
176
+ /** @deprecated not supported on the server side */
177
+ export function getNextMarker(start: Node): [Node, Array<Node>];