@solidjs/web 2.0.0-experimental.1 → 2.0.0-experimental.2
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/LICENSE +1 -1
- package/dist/dev.cjs +9 -5
- package/dist/dev.js +629 -81
- package/dist/server.cjs +9 -5
- package/dist/server.js +625 -102
- package/dist/web.cjs +9 -5
- package/dist/web.js +617 -79
- package/package.json +3 -3
- package/storage/dist/storage.js +3 -3
- package/types/client.d.ts +11 -2
- package/types/core.d.ts +11 -1
- package/types/index.d.ts +20 -4
- package/types/server-mock.d.ts +33 -26
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/web",
|
|
3
3
|
"description": "Solid's web runtime for the browser and the server",
|
|
4
|
-
"version": "2.0.0-experimental.
|
|
4
|
+
"version": "2.0.0-experimental.2",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
"seroval-plugins": "^1.1.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"solid-js": "^2.0.0-experimental.
|
|
78
|
+
"solid-js": "^2.0.0-experimental.2"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"solid-js": "2.0.0-experimental.
|
|
81
|
+
"solid-js": "2.0.0-experimental.2"
|
|
82
82
|
},
|
|
83
83
|
"scripts": {
|
|
84
84
|
"build": "npm-run-all -nl build:*",
|
package/storage/dist/storage.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AsyncLocalStorage } from
|
|
2
|
-
import { isServer, RequestContext } from
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { isServer, RequestContext } from "@solidjs/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
|
|
package/types/client.d.ts
CHANGED
|
@@ -10,7 +10,11 @@ export function getPropAlias(prop: string, tagName: string): string | undefined;
|
|
|
10
10
|
type MountableElement = Element | Document | ShadowRoot | DocumentFragment | Node;
|
|
11
11
|
export function render(code: () => JSX.Element, element: MountableElement): () => void;
|
|
12
12
|
export function template(html: string, isCE?: boolean, isSVG?: boolean): () => Element;
|
|
13
|
-
export function effect<T>(
|
|
13
|
+
export function effect<T>(
|
|
14
|
+
fn: (prev?: T) => T,
|
|
15
|
+
effect: (value: T, prev?: T) => void,
|
|
16
|
+
init?: T
|
|
17
|
+
): void;
|
|
14
18
|
export function memo<T>(fn: () => T, equal: boolean): () => T;
|
|
15
19
|
export function untrack<T>(fn: () => T): T;
|
|
16
20
|
export function insert<T>(
|
|
@@ -35,7 +39,12 @@ export function setBoolAttribute(node: Element, name: string, value: any): void;
|
|
|
35
39
|
type ClassList =
|
|
36
40
|
| Record<string, boolean>
|
|
37
41
|
| Array<string | number | boolean | null | undefined | Record<string, boolean>>;
|
|
38
|
-
export function className(
|
|
42
|
+
export function className(
|
|
43
|
+
node: Element,
|
|
44
|
+
value: string | ClassList,
|
|
45
|
+
isSvg?: boolean,
|
|
46
|
+
prev?: string | ClassList
|
|
47
|
+
): void;
|
|
39
48
|
export function setProperty(node: Element, name: string, value: any): void;
|
|
40
49
|
export function addEventListener(
|
|
41
50
|
node: Element,
|
package/types/core.d.ts
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {
|
|
2
|
+
getOwner,
|
|
3
|
+
createComponent,
|
|
4
|
+
createRoot as root,
|
|
5
|
+
createRenderEffect as effect,
|
|
6
|
+
createMemo as memo,
|
|
7
|
+
sharedConfig,
|
|
8
|
+
untrack,
|
|
9
|
+
merge as mergeProps,
|
|
10
|
+
flatten
|
|
11
|
+
} from "solid-js";
|
package/types/index.d.ts
CHANGED
|
@@ -14,14 +14,30 @@ export declare const hydrate: typeof hydrateCore;
|
|
|
14
14
|
* @description https://docs.solidjs.com/reference/components/portal
|
|
15
15
|
*/
|
|
16
16
|
export declare function Portal<T extends boolean = false, S extends boolean = false>(props: {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
mount?: Element;
|
|
18
|
+
children: JSX.Element;
|
|
19
19
|
}): Text;
|
|
20
20
|
export type DynamicProps<T extends ValidComponent, P = ComponentProps<T>> = {
|
|
21
|
-
|
|
21
|
+
[K in keyof P]: P[K];
|
|
22
22
|
} & {
|
|
23
|
-
|
|
23
|
+
component: T | undefined;
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Renders an arbitrary component or element with the given props
|
|
27
|
+
*
|
|
28
|
+
* This is a lower level version of the `Dynamic` component, useful for
|
|
29
|
+
* performance optimizations in libraries. Do not use this unless you know
|
|
30
|
+
* what you are doing.
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const element = () => multiline() ? 'textarea' : 'input';
|
|
33
|
+
* createDynamic(element, { value: value() });
|
|
34
|
+
* ```
|
|
35
|
+
* @description https://docs.solidjs.com/reference/components/dynamic
|
|
36
|
+
*/
|
|
37
|
+
export declare function createDynamic<T extends ValidComponent>(
|
|
38
|
+
component: () => T | undefined,
|
|
39
|
+
props: ComponentProps<T>
|
|
40
|
+
): JSX.Element;
|
|
25
41
|
/**
|
|
26
42
|
* Renders an arbitrary custom or native component and passes the other props
|
|
27
43
|
* ```typescript
|
package/types/server-mock.d.ts
CHANGED
|
@@ -1,39 +1,46 @@
|
|
|
1
|
-
export declare function renderToString<T>(
|
|
1
|
+
export declare function renderToString<T>(
|
|
2
|
+
fn: () => T,
|
|
3
|
+
options?: {
|
|
2
4
|
nonce?: string;
|
|
3
5
|
renderId?: string;
|
|
4
|
-
}
|
|
5
|
-
|
|
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
|
-
}
|
|
10
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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(
|
|
26
|
-
|
|
28
|
+
export declare function ssr(
|
|
29
|
+
template: string[] | string,
|
|
30
|
+
...nodes: any[]
|
|
31
|
+
): {
|
|
32
|
+
t: string;
|
|
27
33
|
};
|
|
28
|
-
export declare function ssrElement(
|
|
29
|
-
|
|
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
|
-
|
|
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;
|