@solidjs/web 2.0.0-experimental.13 → 2.0.0-experimental.15

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.
@@ -0,0 +1,72 @@
1
+ export declare function renderToString<T>(fn: () => T, options?: {
2
+ nonce?: string;
3
+ renderId?: string;
4
+ noScripts?: boolean;
5
+ plugins?: any[];
6
+ manifest?: Record<string, {
7
+ file: string;
8
+ css?: string[];
9
+ isEntry?: boolean;
10
+ isDynamicEntry?: boolean;
11
+ imports?: string[];
12
+ }>;
13
+ onError?: (err: any) => void;
14
+ }): string;
15
+ export declare function renderToStringAsync<T>(fn: () => T, options?: {
16
+ timeoutMs?: number;
17
+ nonce?: string;
18
+ renderId?: string;
19
+ noScripts?: boolean;
20
+ plugins?: any[];
21
+ manifest?: Record<string, {
22
+ file: string;
23
+ css?: string[];
24
+ isEntry?: boolean;
25
+ isDynamicEntry?: boolean;
26
+ imports?: string[];
27
+ }>;
28
+ onError?: (err: any) => void;
29
+ }): Promise<string>;
30
+ export declare function renderToStream<T>(fn: () => T, options?: {
31
+ nonce?: string;
32
+ renderId?: string;
33
+ noScripts?: boolean;
34
+ plugins?: any[];
35
+ manifest?: Record<string, {
36
+ file: string;
37
+ css?: string[];
38
+ isEntry?: boolean;
39
+ isDynamicEntry?: boolean;
40
+ imports?: string[];
41
+ }>;
42
+ onCompleteShell?: (info: {
43
+ write: (v: string) => void;
44
+ }) => void;
45
+ onCompleteAll?: (info: {
46
+ write: (v: string) => void;
47
+ }) => void;
48
+ onError?: (err: any) => void;
49
+ }): {
50
+ then: (fn: (html: string) => void) => void;
51
+ pipe: (writable: {
52
+ write: (v: string) => void;
53
+ end: () => void;
54
+ }) => void;
55
+ pipeTo: (writable: WritableStream) => Promise<void>;
56
+ };
57
+ export declare function ssr(template: string[] | string, ...nodes: any[]): {
58
+ t: string;
59
+ };
60
+ export declare function ssrElement(name: string, props: any, children: any, needsId: boolean): {
61
+ t: string;
62
+ };
63
+ export declare function ssrClassList(value: {
64
+ [k: string]: boolean;
65
+ }): string;
66
+ export declare function ssrStyle(value: {
67
+ [k: string]: string;
68
+ }): string;
69
+ export declare function ssrAttribute(key: string, value: boolean): string;
70
+ export declare function ssrHydrationKey(): string;
71
+ export declare function resolveSSRNode(node: any): string;
72
+ export declare function escape(html: string): string;
@@ -0,0 +1,2 @@
1
+ import type { RequestEvent } from "@solidjs/web";
2
+ export declare function provideRequestEvent<T extends RequestEvent, U>(init: T, cb: () => U): U;
package/types/client.d.ts CHANGED
@@ -7,8 +7,13 @@ export const SVGElements: Set<string>;
7
7
  export const SVGNamespace: Record<string, string>;
8
8
 
9
9
  type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
10
- export function render(code: () => JSX.Element, element: MountableElement): () => void;
11
- export function template(html: string, isCE?: boolean, isSVG?: boolean): () => Element;
10
+ export function render(
11
+ code: () => JSX.Element,
12
+ element: MountableElement,
13
+ init?: JSX.Element,
14
+ options?: { owner?: unknown }
15
+ ): () => void;
16
+ export function template(html: string, isImportNode?: boolean, isSVG?: boolean, isMathML?: boolean): () => Element;
12
17
  export function effect<T>(fn: (prev?: T) => T, effect: (value: T, prev?: T) => void, init?: T): void;
13
18
  export function memo<T>(fn: () => T, equal: boolean): () => T;
14
19
  export function untrack<T>(fn: () => T): T;
@@ -27,7 +32,14 @@ export function spread<T>(
27
32
  isSVG?: Boolean,
28
33
  skipChildren?: Boolean
29
34
  ): void;
30
- export function assign(node: Element, props: any, isSVG?: Boolean, skipChildren?: Boolean): void;
35
+ export function assign(
36
+ node: Element,
37
+ props: any,
38
+ isSVG?: Boolean,
39
+ skipChildren?: Boolean,
40
+ prevProps?: any,
41
+ skipRef?: Boolean
42
+ ): void;
31
43
  export function setAttribute(node: Element, name: string, value: string): void;
32
44
  export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
33
45
  type ClassList =
@@ -35,6 +47,7 @@ type ClassList =
35
47
  | Array<string | number | boolean | null | undefined | Record<string, boolean>>;
36
48
  export function className(node: Element, value: string | ClassList, isSvg?: boolean, prev?: string | ClassList): 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,
@@ -49,25 +62,27 @@ export function style(
49
62
  export function getOwner(): unknown;
50
63
  export function mergeProps(...sources: unknown[]): unknown;
51
64
  export function dynamicProperty(props: unknown, key: string): unknown;
65
+ export function use<Arg, Ret>(fn: (node: Element, arg: Arg) => Ret, node: Element, arg?: Arg): Ret
52
66
 
53
67
  export function hydrate(
54
68
  fn: () => JSX.Element,
55
69
  node: MountableElement,
56
70
  options?: { renderId?: string; owner?: unknown }
57
71
  ): () => void;
58
- export function getHydrationKey(): string;
59
- export function getNextElement(template?: HTMLTemplateElement): Element;
72
+ export function getHydrationKey(): string | undefined;
73
+ export function getNextElement(template?: () => Element): Element;
60
74
  export function getNextMatch(start: Node, elementName: string): Element;
61
75
  export function getNextMarker(start: Node): [Node, Array<Node>];
62
76
  export function useAssets(fn: () => JSX.Element): void;
63
77
  export function getAssets(): string;
64
- export function HydrationScript(): JSX.Element;
65
- export function generateHydrationScript(): string;
78
+ export function HydrationScript(props?: { nonce?: string; eventNames?: string[] }): JSX.Element;
79
+ export function generateHydrationScript(options?: { nonce?: string; eventNames?: string[] }): string;
66
80
  export function Assets(props: { children?: JSX.Element }): JSX.Element;
67
81
  export function Hydration(props: { children?: JSX.Element }): JSX.Element;
68
82
  export function NoHydration(props: { children?: JSX.Element }): JSX.Element;
69
83
  export interface RequestEvent {
70
84
  request: Request;
85
+ locals: Record<string | number | symbol, any>;
71
86
  }
72
87
  export declare const RequestContext: unique symbol;
73
88
  export function getRequestEvent(): RequestEvent | undefined;
@@ -1,26 +1,58 @@
1
1
  export declare function renderToString<T>(fn: () => T, options?: {
2
2
  nonce?: string;
3
3
  renderId?: string;
4
+ noScripts?: boolean;
5
+ plugins?: any[];
6
+ manifest?: Record<string, {
7
+ file: string;
8
+ css?: string[];
9
+ isEntry?: boolean;
10
+ isDynamicEntry?: boolean;
11
+ imports?: string[];
12
+ }>;
13
+ onError?: (err: any) => void;
4
14
  }): string;
5
15
  export declare function renderToStringAsync<T>(fn: () => T, options?: {
6
16
  timeoutMs?: number;
7
17
  nonce?: string;
8
18
  renderId?: string;
19
+ noScripts?: boolean;
20
+ plugins?: any[];
21
+ manifest?: Record<string, {
22
+ file: string;
23
+ css?: string[];
24
+ isEntry?: boolean;
25
+ isDynamicEntry?: boolean;
26
+ imports?: string[];
27
+ }>;
28
+ onError?: (err: any) => void;
9
29
  }): Promise<string>;
10
30
  export declare function renderToStream<T>(fn: () => T, options?: {
11
31
  nonce?: string;
12
32
  renderId?: string;
33
+ noScripts?: boolean;
34
+ plugins?: any[];
35
+ manifest?: Record<string, {
36
+ file: string;
37
+ css?: string[];
38
+ isEntry?: boolean;
39
+ isDynamicEntry?: boolean;
40
+ imports?: string[];
41
+ }>;
13
42
  onCompleteShell?: (info: {
14
43
  write: (v: string) => void;
15
44
  }) => void;
16
45
  onCompleteAll?: (info: {
17
46
  write: (v: string) => void;
18
47
  }) => void;
48
+ onError?: (err: any) => void;
19
49
  }): {
50
+ then: (fn: (html: string) => void) => void;
20
51
  pipe: (writable: {
21
52
  write: (v: string) => void;
53
+ end: () => void;
22
54
  }) => void;
23
- pipeTo: (writable: WritableStream) => void;
55
+ pipeTo: (writable: WritableStream) => Promise<void>;
24
56
  };
25
57
  export declare function ssr(template: string[] | string, ...nodes: any[]): {
26
58
  t: string;
package/types/server.d.ts CHANGED
@@ -13,9 +13,12 @@ export function renderToString<T>(
13
13
  options?: {
14
14
  nonce?: string;
15
15
  renderId?: string;
16
+ noScripts?: boolean;
17
+ plugins?: any[];
16
18
  onError?: (err: any) => void;
17
19
  }
18
20
  ): string;
21
+ /** @deprecated use renderToStream which also returns a promise */
19
22
  export function renderToStringAsync<T>(
20
23
  fn: () => T,
21
24
  options?: {
@@ -23,6 +26,7 @@ export function renderToStringAsync<T>(
23
26
  nonce?: string;
24
27
  renderId?: string;
25
28
  noScripts?: boolean;
29
+ plugins?: any[];
26
30
  onError?: (err: any) => void;
27
31
  }
28
32
  ): Promise<string>;
@@ -31,12 +35,15 @@ export function renderToStream<T>(
31
35
  options?: {
32
36
  nonce?: string;
33
37
  renderId?: string;
38
+ noScripts?: boolean;
39
+ plugins?: any[];
34
40
  onCompleteShell?: (info: { write: (v: string) => void }) => void;
35
41
  onCompleteAll?: (info: { write: (v: string) => void }) => void;
36
42
  onError?: (err: any) => void;
37
43
  }
38
44
  ): {
39
- pipe: (writable: { write: (v: string) => void }) => void;
45
+ then: (fn: (html: string) => void) => void;
46
+ pipe: (writable: { write: (v: string) => void; end: () => void }) => void;
40
47
  pipeTo: (writable: WritableStream) => Promise<void>;
41
48
  };
42
49
 
@@ -48,21 +55,23 @@ export function ssrElement(
48
55
  children: any,
49
56
  needsId: boolean
50
57
  ): { t: string };
51
- export function ssrClassList(value: { [k: string]: boolean }): string;
52
- export function ssrStyle(value: { [k: string]: string }): string;
53
- export function ssrAttribute(key: string, value: any, isBoolean: boolean): string;
58
+ export function ssrClassName(value: string | { [k: string]: boolean } | Array<any>): string;
59
+ export function ssrStyle(value: string | { [k: string]: string }): string;
60
+ export function ssrStyleProperty(name: string, value: any): string;
61
+ export function ssrAttribute(key: string, value: any): string;
54
62
  export function ssrHydrationKey(): string;
55
- export function resolveSSRNode(node: any): string;
56
- export function escape(html: string): string;
63
+ export function resolveSSRNode(node: any, result?: any, top?: boolean): any;
64
+ export function escape(s: any, attr?: boolean): any;
57
65
  export function useAssets(fn: () => JSX.Element): void;
58
66
  export function getAssets(): string;
59
- export function getHydrationKey(): string;
60
- export function effect<T>(fn: (prev?: T) => T, init?: T): void;
67
+ export function getHydrationKey(): string | undefined;
68
+ export function effect<T>(fn: (prev?: T) => T, effect: (value: T, prev?: T) => void, init?: T): void;
61
69
  export function memo<T>(fn: () => T, equal: boolean): () => T;
62
70
  export function createComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element;
63
71
  export function mergeProps(...sources: unknown[]): unknown;
64
72
  export function getOwner(): unknown;
65
- export function generateHydrationScript(options: { nonce?: string; eventNames?: string[] }): string;
73
+ export function ssrRunInScope(fn: () => void, owner: unknown): void;
74
+ export function generateHydrationScript(options?: { nonce?: string; eventNames?: string[] }): string;
66
75
  export declare const RequestContext: unique symbol;
67
76
  export interface RequestEvent {
68
77
  request: Request;
@@ -77,13 +86,6 @@ export function untrack<T>(fn: () => T): T;
77
86
 
78
87
  // client-only APIs
79
88
 
80
- /** @deprecated not supported on the server side */
81
- export function classList(
82
- node: Element,
83
- value: { [k: string]: boolean },
84
- prev?: { [k: string]: boolean }
85
- ): { [k: string]: boolean };
86
-
87
89
  /** @deprecated not supported on the server side */
88
90
  export function style(
89
91
  node: Element,
@@ -127,7 +129,7 @@ export function addEventListener(
127
129
  /** @deprecated not supported on the server side */
128
130
  export function render(code: () => JSX.Element, element: MountableElement): () => void;
129
131
  /** @deprecated not supported on the server side */
130
- export function template(html: string, isCE?: boolean, isSVG?: boolean): () => Element;
132
+ export function template(html: string, isImportNode?: boolean, isSVG?: boolean, isMathML?: boolean): () => Element;
131
133
  /** @deprecated not supported on the server side */
132
134
  export function setProperty(node: Element, name: string, value: any): void;
133
135
  /** @deprecated not supported on the server side */
@@ -143,8 +145,10 @@ export function hydrate(
143
145
  ): () => void;
144
146
 
145
147
  /** @deprecated not supported on the server side */
146
- export function getNextElement(template?: HTMLTemplateElement): Element;
148
+ export function getNextElement(template?: () => Element): Element;
147
149
  /** @deprecated not supported on the server side */
148
150
  export function getNextMatch(start: Node, elementName: string): Element;
149
151
  /** @deprecated not supported on the server side */
150
152
  export function getNextMarker(start: Node): [Node, Array<Node>];
153
+ /** @deprecated not supported on the server side */
154
+ export function runHydrationEvents(): void;