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.
- package/README.md +223 -223
- package/dist/dev.cjs +29 -24
- package/dist/dev.js +344 -580
- package/dist/server.cjs +31 -18
- package/dist/server.js +103 -185
- package/dist/solid.cjs +29 -24
- package/dist/solid.js +302 -507
- package/h/dist/h.cjs +12 -1
- package/h/dist/h.js +19 -34
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +8 -11
- package/h/jsx-runtime/types/jsx.d.ts +5 -0
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +94 -216
- package/html/types/lit.d.ts +33 -47
- package/package.json +3 -3
- package/store/dist/dev.js +43 -122
- package/store/dist/server.js +8 -19
- package/store/dist/store.js +40 -113
- package/store/types/index.d.ts +7 -21
- package/store/types/modifiers.d.ts +3 -6
- package/store/types/mutable.d.ts +2 -5
- package/store/types/server.d.ts +4 -12
- package/store/types/store.d.ts +62 -219
- package/types/index.d.ts +10 -75
- package/types/jsx.d.ts +5 -0
- package/types/reactive/array.d.ts +6 -14
- package/types/reactive/observable.d.ts +18 -26
- package/types/reactive/scheduler.d.ts +6 -9
- package/types/reactive/signal.d.ts +164 -255
- package/types/render/Suspense.d.ts +7 -7
- package/types/render/component.d.ts +33 -64
- package/types/render/flow.d.ts +37 -49
- package/types/render/hydration.d.ts +15 -13
- package/types/server/index.d.ts +2 -57
- package/types/server/reactive.d.ts +42 -73
- package/types/server/rendering.d.ts +99 -168
- package/universal/dist/dev.js +12 -28
- package/universal/dist/universal.js +12 -28
- package/universal/types/index.d.ts +1 -3
- package/universal/types/universal.d.ts +1 -0
- package/web/dist/dev.cjs +6 -4
- package/web/dist/dev.js +88 -630
- package/web/dist/server.cjs +6 -6
- package/web/dist/server.js +102 -216
- package/web/dist/web.cjs +6 -4
- package/web/dist/web.js +86 -621
- package/web/storage/dist/storage.js +3 -3
- package/web/types/client.d.ts +2 -2
- package/web/types/core.d.ts +1 -10
- package/web/types/index.d.ts +12 -29
- package/web/types/server-mock.d.ts +32 -47
|
@@ -2,227 +2,158 @@ import { Accessor, Setter, Signal } from "./reactive.js";
|
|
|
2
2
|
import type { JSX } from "../jsx.js";
|
|
3
3
|
export type Component<P = {}> = (props: P) => JSX.Element;
|
|
4
4
|
export type VoidProps<P = {}> = P & {
|
|
5
|
-
|
|
5
|
+
children?: never;
|
|
6
6
|
};
|
|
7
7
|
export type VoidComponent<P = {}> = Component<VoidProps<P>>;
|
|
8
8
|
export type ParentProps<P = {}> = P & {
|
|
9
|
-
|
|
9
|
+
children?: JSX.Element;
|
|
10
10
|
};
|
|
11
11
|
export type ParentComponent<P = {}> = Component<ParentProps<P>>;
|
|
12
12
|
export type FlowProps<P = {}, C = JSX.Element> = P & {
|
|
13
|
-
|
|
13
|
+
children: C;
|
|
14
14
|
};
|
|
15
15
|
export type FlowComponent<P = {}, C = JSX.Element> = Component<FlowProps<P, C>>;
|
|
16
16
|
export type Ref<T> = T | ((val: T) => void);
|
|
17
17
|
export type ValidComponent = keyof JSX.IntrinsicElements | Component<any> | (string & {});
|
|
18
|
-
export type ComponentProps<T extends ValidComponent> = T extends Component<infer P>
|
|
19
|
-
? P
|
|
20
|
-
: T extends keyof JSX.IntrinsicElements
|
|
21
|
-
? JSX.IntrinsicElements[T]
|
|
22
|
-
: Record<string, unknown>;
|
|
18
|
+
export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
|
|
23
19
|
type SharedConfig = {
|
|
24
|
-
|
|
20
|
+
context?: HydrationContext;
|
|
21
|
+
getContextId(): string;
|
|
22
|
+
getNextContextId(): string;
|
|
25
23
|
};
|
|
26
24
|
export declare const sharedConfig: SharedConfig;
|
|
27
25
|
export declare function createUniqueId(): string;
|
|
28
26
|
export declare function createComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element;
|
|
29
27
|
export declare function mergeProps<T, U>(source: T, source1: U): T & U;
|
|
30
28
|
export declare function mergeProps<T, U, V>(source: T, source1: U, source2: V): T & U & V;
|
|
31
|
-
export declare function mergeProps<T, U, V, W>(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
...keys: [K1[], K2[]]
|
|
44
|
-
): [Pick<T, K1>, Pick<T, K2>, Omit<T, K1 | K2>];
|
|
45
|
-
export declare function splitProps<
|
|
46
|
-
T extends object,
|
|
47
|
-
K1 extends keyof T,
|
|
48
|
-
K2 extends keyof T,
|
|
49
|
-
K3 extends keyof T
|
|
50
|
-
>(
|
|
51
|
-
props: T,
|
|
52
|
-
...keys: [K1[], K2[], K3[]]
|
|
53
|
-
): [Pick<T, K1>, Pick<T, K2>, Pick<T, K3>, Omit<T, K1 | K2 | K3>];
|
|
54
|
-
export declare function splitProps<
|
|
55
|
-
T extends object,
|
|
56
|
-
K1 extends keyof T,
|
|
57
|
-
K2 extends keyof T,
|
|
58
|
-
K3 extends keyof T,
|
|
59
|
-
K4 extends keyof T
|
|
60
|
-
>(
|
|
61
|
-
props: T,
|
|
62
|
-
...keys: [K1[], K2[], K3[], K4[]]
|
|
63
|
-
): [Pick<T, K1>, Pick<T, K2>, Pick<T, K3>, Pick<T, K4>, Omit<T, K1 | K2 | K3 | K4>];
|
|
64
|
-
export declare function splitProps<
|
|
65
|
-
T extends object,
|
|
66
|
-
K1 extends keyof T,
|
|
67
|
-
K2 extends keyof T,
|
|
68
|
-
K3 extends keyof T,
|
|
69
|
-
K4 extends keyof T,
|
|
70
|
-
K5 extends keyof T
|
|
71
|
-
>(
|
|
72
|
-
props: T,
|
|
73
|
-
...keys: [K1[], K2[], K3[], K4[], K5[]]
|
|
74
|
-
): [
|
|
75
|
-
Pick<T, K1>,
|
|
76
|
-
Pick<T, K2>,
|
|
77
|
-
Pick<T, K3>,
|
|
78
|
-
Pick<T, K4>,
|
|
79
|
-
Pick<T, K5>,
|
|
80
|
-
Omit<T, K1 | K2 | K3 | K4 | K5>
|
|
29
|
+
export declare function mergeProps<T, U, V, W>(source: T, source1: U, source2: V, source3: W): T & U & V & W;
|
|
30
|
+
export declare function splitProps<T extends object, K1 extends keyof T>(props: T, ...keys: [K1[]]): [Pick<T, K1>, Omit<T, K1>];
|
|
31
|
+
export declare function splitProps<T extends object, K1 extends keyof T, K2 extends keyof T>(props: T, ...keys: [K1[], K2[]]): [Pick<T, K1>, Pick<T, K2>, Omit<T, K1 | K2>];
|
|
32
|
+
export declare function splitProps<T extends object, K1 extends keyof T, K2 extends keyof T, K3 extends keyof T>(props: T, ...keys: [K1[], K2[], K3[]]): [Pick<T, K1>, Pick<T, K2>, Pick<T, K3>, Omit<T, K1 | K2 | K3>];
|
|
33
|
+
export declare function splitProps<T extends object, K1 extends keyof T, K2 extends keyof T, K3 extends keyof T, K4 extends keyof T>(props: T, ...keys: [K1[], K2[], K3[], K4[]]): [Pick<T, K1>, Pick<T, K2>, Pick<T, K3>, Pick<T, K4>, Omit<T, K1 | K2 | K3 | K4>];
|
|
34
|
+
export declare function splitProps<T extends object, K1 extends keyof T, K2 extends keyof T, K3 extends keyof T, K4 extends keyof T, K5 extends keyof T>(props: T, ...keys: [K1[], K2[], K3[], K4[], K5[]]): [
|
|
35
|
+
Pick<T, K1>,
|
|
36
|
+
Pick<T, K2>,
|
|
37
|
+
Pick<T, K3>,
|
|
38
|
+
Pick<T, K4>,
|
|
39
|
+
Pick<T, K5>,
|
|
40
|
+
Omit<T, K1 | K2 | K3 | K4 | K5>
|
|
81
41
|
];
|
|
82
42
|
export declare function For<T>(props: {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
43
|
+
each: T[];
|
|
44
|
+
fallback?: string;
|
|
45
|
+
children: (item: T, index: () => number) => string;
|
|
86
46
|
}): string | any[] | undefined;
|
|
87
47
|
export declare function Index<T>(props: {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
48
|
+
each: T[];
|
|
49
|
+
fallback?: string;
|
|
50
|
+
children: (item: () => T, index: number) => string;
|
|
91
51
|
}): string | any[] | undefined;
|
|
92
52
|
/**
|
|
93
53
|
* Conditionally render its children or an optional fallback component
|
|
94
|
-
* @description https://
|
|
54
|
+
* @description https://docs.solidjs.com/reference/components/show
|
|
95
55
|
*/
|
|
96
56
|
export declare function Show<T>(props: {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
57
|
+
when: T | undefined | null | false;
|
|
58
|
+
keyed?: boolean;
|
|
59
|
+
fallback?: string;
|
|
60
|
+
children: string | ((item: NonNullable<T> | Accessor<NonNullable<T>>) => string);
|
|
101
61
|
}): string;
|
|
102
62
|
export declare function Switch(props: {
|
|
103
|
-
|
|
104
|
-
|
|
63
|
+
fallback?: string;
|
|
64
|
+
children: MatchProps<unknown> | MatchProps<unknown>[];
|
|
105
65
|
}): string;
|
|
106
66
|
type MatchProps<T> = {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
67
|
+
when: T | false;
|
|
68
|
+
keyed?: boolean;
|
|
69
|
+
children: string | ((item: NonNullable<T> | Accessor<NonNullable<T>>) => string);
|
|
110
70
|
};
|
|
111
71
|
export declare function Match<T>(props: MatchProps<T>): MatchProps<T>;
|
|
112
72
|
export declare function resetErrorBoundaries(): void;
|
|
113
73
|
export declare function ErrorBoundary(props: {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}):
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
| {
|
|
120
|
-
t: string;
|
|
121
|
-
};
|
|
74
|
+
fallback: string | ((err: any, reset: () => void) => string);
|
|
75
|
+
children: string;
|
|
76
|
+
}): string | ((err: any, reset: () => void) => string) | {
|
|
77
|
+
t: string;
|
|
78
|
+
};
|
|
122
79
|
export interface Resource<T> {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
80
|
+
(): T | undefined;
|
|
81
|
+
state: "unresolved" | "pending" | "ready" | "refreshing" | "errored";
|
|
82
|
+
loading: boolean;
|
|
83
|
+
error: any;
|
|
84
|
+
latest: T | undefined;
|
|
128
85
|
}
|
|
129
86
|
type SuspenseContextType = {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
>;
|
|
137
|
-
completed: () => void;
|
|
87
|
+
resources: Map<string, {
|
|
88
|
+
loading: boolean;
|
|
89
|
+
error: any;
|
|
90
|
+
}>;
|
|
91
|
+
completed: () => void;
|
|
138
92
|
};
|
|
139
93
|
export type ResourceActions<T> = {
|
|
140
|
-
|
|
141
|
-
|
|
94
|
+
mutate: Setter<T>;
|
|
95
|
+
refetch: (info?: unknown) => void;
|
|
142
96
|
};
|
|
143
97
|
export type ResourceReturn<T> = [Resource<T>, ResourceActions<T>];
|
|
144
98
|
export type ResourceSource<S> = S | false | null | undefined | (() => S | false | null | undefined);
|
|
145
99
|
export type ResourceFetcher<S, T> = (k: S, info: ResourceFetcherInfo<T>) => T | Promise<T>;
|
|
146
100
|
export type ResourceFetcherInfo<T> = {
|
|
147
|
-
|
|
148
|
-
|
|
101
|
+
value: T | undefined;
|
|
102
|
+
refetching?: unknown;
|
|
149
103
|
};
|
|
150
|
-
export type ResourceOptions<T> = undefined extends T
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
export declare function createResource<T, S
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
): ResourceReturn<T | undefined>;
|
|
171
|
-
export declare function createResource<T, S = true>(
|
|
172
|
-
fetcher: ResourceFetcher<S, T>,
|
|
173
|
-
options: ResourceOptions<T>
|
|
174
|
-
): ResourceReturn<T>;
|
|
175
|
-
export declare function createResource<T, S>(
|
|
176
|
-
source: ResourceSource<S>,
|
|
177
|
-
fetcher: ResourceFetcher<S, T>,
|
|
178
|
-
options?: ResourceOptions<undefined>
|
|
179
|
-
): ResourceReturn<T | undefined>;
|
|
180
|
-
export declare function createResource<T, S>(
|
|
181
|
-
source: ResourceSource<S>,
|
|
182
|
-
fetcher: ResourceFetcher<S, T>,
|
|
183
|
-
options: ResourceOptions<T>
|
|
184
|
-
): ResourceReturn<T>;
|
|
185
|
-
export declare function lazy<T extends Component<any>>(
|
|
186
|
-
fn: () => Promise<{
|
|
187
|
-
default: T;
|
|
188
|
-
}>
|
|
189
|
-
): T & {
|
|
190
|
-
preload: () => Promise<{
|
|
104
|
+
export type ResourceOptions<T> = undefined extends T ? {
|
|
105
|
+
initialValue?: T;
|
|
106
|
+
name?: string;
|
|
107
|
+
deferStream?: boolean;
|
|
108
|
+
ssrLoadFrom?: "initial" | "server";
|
|
109
|
+
storage?: () => Signal<T | undefined>;
|
|
110
|
+
onHydrated?: <S, T>(k: S, info: ResourceFetcherInfo<T>) => void;
|
|
111
|
+
} : {
|
|
112
|
+
initialValue: T;
|
|
113
|
+
name?: string;
|
|
114
|
+
deferStream?: boolean;
|
|
115
|
+
ssrLoadFrom?: "initial" | "server";
|
|
116
|
+
storage?: (v?: T) => Signal<T | undefined>;
|
|
117
|
+
onHydrated?: <S, T>(k: S, info: ResourceFetcherInfo<T>) => void;
|
|
118
|
+
};
|
|
119
|
+
export declare function createResource<T, S = true>(fetcher: ResourceFetcher<S, T>, options?: ResourceOptions<undefined>): ResourceReturn<T | undefined>;
|
|
120
|
+
export declare function createResource<T, S = true>(fetcher: ResourceFetcher<S, T>, options: ResourceOptions<T>): ResourceReturn<T>;
|
|
121
|
+
export declare function createResource<T, S>(source: ResourceSource<S>, fetcher: ResourceFetcher<S, T>, options?: ResourceOptions<undefined>): ResourceReturn<T | undefined>;
|
|
122
|
+
export declare function createResource<T, S>(source: ResourceSource<S>, fetcher: ResourceFetcher<S, T>, options: ResourceOptions<T>): ResourceReturn<T>;
|
|
123
|
+
export declare function lazy<T extends Component<any>>(fn: () => Promise<{
|
|
191
124
|
default: T;
|
|
192
|
-
|
|
125
|
+
}>): T & {
|
|
126
|
+
preload: () => Promise<{
|
|
127
|
+
default: T;
|
|
128
|
+
}>;
|
|
193
129
|
};
|
|
194
130
|
export declare function enableScheduling(): void;
|
|
195
131
|
export declare function enableHydration(): void;
|
|
196
132
|
export declare function startTransition(fn: () => any): void;
|
|
197
133
|
export declare function useTransition(): [() => boolean, (fn: () => any) => void];
|
|
198
134
|
type HydrationContext = {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
135
|
+
id: string;
|
|
136
|
+
count: number;
|
|
137
|
+
serialize: (id: string, v: Promise<any> | any, deferStream?: boolean) => void;
|
|
138
|
+
nextRoot: (v: any) => string;
|
|
139
|
+
replace: (id: string, replacement: () => any) => void;
|
|
140
|
+
block: (p: Promise<any>) => void;
|
|
141
|
+
resources: Record<string, any>;
|
|
142
|
+
suspense: Record<string, SuspenseContextType>;
|
|
143
|
+
registerFragment: (v: string) => (v?: string, err?: any) => boolean;
|
|
144
|
+
lazy: Record<string, Promise<any>>;
|
|
145
|
+
async?: boolean;
|
|
146
|
+
noHydrate: boolean;
|
|
211
147
|
};
|
|
212
148
|
export declare function SuspenseList(props: {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
149
|
+
children: string;
|
|
150
|
+
revealOrder: "forwards" | "backwards" | "together";
|
|
151
|
+
tail?: "collapsed" | "hidden";
|
|
216
152
|
}): string;
|
|
217
|
-
export declare function Suspense(props: {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
| {
|
|
224
|
-
t: string;
|
|
225
|
-
}
|
|
226
|
-
| null
|
|
227
|
-
| undefined;
|
|
153
|
+
export declare function Suspense(props: {
|
|
154
|
+
fallback?: string;
|
|
155
|
+
children: string;
|
|
156
|
+
}): string | number | boolean | Node | JSX.ArrayElement | {
|
|
157
|
+
t: string;
|
|
158
|
+
} | null | undefined;
|
|
228
159
|
export {};
|
package/universal/dist/dev.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createRoot,
|
|
3
|
-
createRenderEffect,
|
|
4
|
-
mergeProps,
|
|
5
|
-
createMemo,
|
|
6
|
-
createComponent,
|
|
7
|
-
untrack
|
|
8
|
-
} from "solid-js";
|
|
1
|
+
import { createRoot, createRenderEffect, mergeProps, createMemo, createComponent, untrack } from 'solid-js';
|
|
9
2
|
|
|
10
3
|
function createRenderer$1({
|
|
11
4
|
createElement,
|
|
@@ -39,7 +32,7 @@ function createRenderer$1({
|
|
|
39
32
|
current = cleanChildren(parent, current, marker, node);
|
|
40
33
|
} else {
|
|
41
34
|
if (current !== "" && typeof current === "string") {
|
|
42
|
-
replaceText(getFirstChild(parent),
|
|
35
|
+
replaceText(getFirstChild(parent), current = value);
|
|
43
36
|
} else {
|
|
44
37
|
cleanChildren(parent, current, marker, createTextNode(value));
|
|
45
38
|
current = value;
|
|
@@ -57,14 +50,12 @@ function createRenderer$1({
|
|
|
57
50
|
} else if (Array.isArray(value)) {
|
|
58
51
|
const array = [];
|
|
59
52
|
if (normalizeIncomingArray(array, value, unwrapArray)) {
|
|
60
|
-
createRenderEffect(
|
|
61
|
-
() => (current = insertExpression(parent, array, current, marker, true))
|
|
62
|
-
);
|
|
53
|
+
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
63
54
|
return () => current;
|
|
64
55
|
}
|
|
65
56
|
if (array.length === 0) {
|
|
66
57
|
const replacement = cleanChildren(parent, current, marker);
|
|
67
|
-
if (multi) return
|
|
58
|
+
if (multi) return current = replacement;
|
|
68
59
|
} else {
|
|
69
60
|
if (Array.isArray(current)) {
|
|
70
61
|
if (current.length === 0) {
|
|
@@ -73,13 +64,13 @@ function createRenderer$1({
|
|
|
73
64
|
} else if (current == null || current === "") {
|
|
74
65
|
appendNodes(parent, array);
|
|
75
66
|
} else {
|
|
76
|
-
reconcileArrays(parent,
|
|
67
|
+
reconcileArrays(parent, multi && current || [getFirstChild(parent)], array);
|
|
77
68
|
}
|
|
78
69
|
}
|
|
79
70
|
current = array;
|
|
80
71
|
} else {
|
|
81
72
|
if (Array.isArray(current)) {
|
|
82
|
-
if (multi) return
|
|
73
|
+
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
83
74
|
cleanChildren(parent, current, null, value);
|
|
84
75
|
} else if (current == null || current === "" || !getFirstChild(parent)) {
|
|
85
76
|
insertNode(parent, value);
|
|
@@ -93,16 +84,14 @@ function createRenderer$1({
|
|
|
93
84
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
94
85
|
let item = array[i],
|
|
95
86
|
t;
|
|
96
|
-
if (item == null || item === true || item === false);
|
|
97
|
-
else if (Array.isArray(item)) {
|
|
87
|
+
if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
|
|
98
88
|
dynamic = normalizeIncomingArray(normalized, item) || dynamic;
|
|
99
89
|
} else if ((t = typeof item) === "string" || t === "number") {
|
|
100
90
|
normalized.push(createTextNode(item));
|
|
101
91
|
} else if (t === "function") {
|
|
102
92
|
if (unwrap) {
|
|
103
93
|
while (typeof item === "function") item = item();
|
|
104
|
-
dynamic =
|
|
105
|
-
normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
|
|
94
|
+
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
|
|
106
95
|
} else {
|
|
107
96
|
normalized.push(item);
|
|
108
97
|
dynamic = true;
|
|
@@ -130,8 +119,7 @@ function createRenderer$1({
|
|
|
130
119
|
bEnd--;
|
|
131
120
|
}
|
|
132
121
|
if (aEnd === aStart) {
|
|
133
|
-
const node =
|
|
134
|
-
bEnd < bLength ? (bStart ? getNextSibling(b[bStart - 1]) : b[bEnd - bStart]) : after;
|
|
122
|
+
const node = bEnd < bLength ? bStart ? getNextSibling(b[bStart - 1]) : b[bEnd - bStart] : after;
|
|
135
123
|
while (bStart < bEnd) insertNode(parentNode, b[bStart++], node);
|
|
136
124
|
} else if (bEnd === bStart) {
|
|
137
125
|
while (aStart < aEnd) {
|
|
@@ -171,7 +159,7 @@ function createRenderer$1({
|
|
|
171
159
|
function cleanChildren(parent, current, marker, replacement) {
|
|
172
160
|
if (marker === undefined) {
|
|
173
161
|
let removed;
|
|
174
|
-
while (
|
|
162
|
+
while (removed = getFirstChild(parent)) removeNode(parent, removed);
|
|
175
163
|
replacement && insertNode(parent, replacement);
|
|
176
164
|
return "";
|
|
177
165
|
}
|
|
@@ -182,9 +170,7 @@ function createRenderer$1({
|
|
|
182
170
|
const el = current[i];
|
|
183
171
|
if (node !== el) {
|
|
184
172
|
const isParent = getParentNode(el) === parent;
|
|
185
|
-
if (!inserted && !i)
|
|
186
|
-
isParent ? replaceNode(parent, node, el) : insertNode(parent, node, marker);
|
|
187
|
-
else isParent && removeNode(parent, el);
|
|
173
|
+
if (!inserted && !i) isParent ? replaceNode(parent, node, el) : insertNode(parent, node, marker);else isParent && removeNode(parent, el);
|
|
188
174
|
} else inserted = true;
|
|
189
175
|
}
|
|
190
176
|
} else insertNode(parent, node, marker);
|
|
@@ -200,9 +186,7 @@ function createRenderer$1({
|
|
|
200
186
|
function spreadExpression(node, props, prevProps = {}, skipChildren) {
|
|
201
187
|
props || (props = {});
|
|
202
188
|
if (!skipChildren) {
|
|
203
|
-
createRenderEffect(
|
|
204
|
-
() => (prevProps.children = insertExpression(node, props.children, prevProps.children))
|
|
205
|
-
);
|
|
189
|
+
createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
206
190
|
}
|
|
207
191
|
createRenderEffect(() => props.ref && props.ref(node));
|
|
208
192
|
createRenderEffect(() => {
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createRoot,
|
|
3
|
-
createRenderEffect,
|
|
4
|
-
mergeProps,
|
|
5
|
-
createMemo,
|
|
6
|
-
createComponent,
|
|
7
|
-
untrack
|
|
8
|
-
} from "solid-js";
|
|
1
|
+
import { createRoot, createRenderEffect, mergeProps, createMemo, createComponent, untrack } from 'solid-js';
|
|
9
2
|
|
|
10
3
|
function createRenderer$1({
|
|
11
4
|
createElement,
|
|
@@ -39,7 +32,7 @@ function createRenderer$1({
|
|
|
39
32
|
current = cleanChildren(parent, current, marker, node);
|
|
40
33
|
} else {
|
|
41
34
|
if (current !== "" && typeof current === "string") {
|
|
42
|
-
replaceText(getFirstChild(parent),
|
|
35
|
+
replaceText(getFirstChild(parent), current = value);
|
|
43
36
|
} else {
|
|
44
37
|
cleanChildren(parent, current, marker, createTextNode(value));
|
|
45
38
|
current = value;
|
|
@@ -57,14 +50,12 @@ function createRenderer$1({
|
|
|
57
50
|
} else if (Array.isArray(value)) {
|
|
58
51
|
const array = [];
|
|
59
52
|
if (normalizeIncomingArray(array, value, unwrapArray)) {
|
|
60
|
-
createRenderEffect(
|
|
61
|
-
() => (current = insertExpression(parent, array, current, marker, true))
|
|
62
|
-
);
|
|
53
|
+
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
63
54
|
return () => current;
|
|
64
55
|
}
|
|
65
56
|
if (array.length === 0) {
|
|
66
57
|
const replacement = cleanChildren(parent, current, marker);
|
|
67
|
-
if (multi) return
|
|
58
|
+
if (multi) return current = replacement;
|
|
68
59
|
} else {
|
|
69
60
|
if (Array.isArray(current)) {
|
|
70
61
|
if (current.length === 0) {
|
|
@@ -73,13 +64,13 @@ function createRenderer$1({
|
|
|
73
64
|
} else if (current == null || current === "") {
|
|
74
65
|
appendNodes(parent, array);
|
|
75
66
|
} else {
|
|
76
|
-
reconcileArrays(parent,
|
|
67
|
+
reconcileArrays(parent, multi && current || [getFirstChild(parent)], array);
|
|
77
68
|
}
|
|
78
69
|
}
|
|
79
70
|
current = array;
|
|
80
71
|
} else {
|
|
81
72
|
if (Array.isArray(current)) {
|
|
82
|
-
if (multi) return
|
|
73
|
+
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
83
74
|
cleanChildren(parent, current, null, value);
|
|
84
75
|
} else if (current == null || current === "" || !getFirstChild(parent)) {
|
|
85
76
|
insertNode(parent, value);
|
|
@@ -93,16 +84,14 @@ function createRenderer$1({
|
|
|
93
84
|
for (let i = 0, len = array.length; i < len; i++) {
|
|
94
85
|
let item = array[i],
|
|
95
86
|
t;
|
|
96
|
-
if (item == null || item === true || item === false);
|
|
97
|
-
else if (Array.isArray(item)) {
|
|
87
|
+
if (item == null || item === true || item === false) ; else if (Array.isArray(item)) {
|
|
98
88
|
dynamic = normalizeIncomingArray(normalized, item) || dynamic;
|
|
99
89
|
} else if ((t = typeof item) === "string" || t === "number") {
|
|
100
90
|
normalized.push(createTextNode(item));
|
|
101
91
|
} else if (t === "function") {
|
|
102
92
|
if (unwrap) {
|
|
103
93
|
while (typeof item === "function") item = item();
|
|
104
|
-
dynamic =
|
|
105
|
-
normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
|
|
94
|
+
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
|
|
106
95
|
} else {
|
|
107
96
|
normalized.push(item);
|
|
108
97
|
dynamic = true;
|
|
@@ -130,8 +119,7 @@ function createRenderer$1({
|
|
|
130
119
|
bEnd--;
|
|
131
120
|
}
|
|
132
121
|
if (aEnd === aStart) {
|
|
133
|
-
const node =
|
|
134
|
-
bEnd < bLength ? (bStart ? getNextSibling(b[bStart - 1]) : b[bEnd - bStart]) : after;
|
|
122
|
+
const node = bEnd < bLength ? bStart ? getNextSibling(b[bStart - 1]) : b[bEnd - bStart] : after;
|
|
135
123
|
while (bStart < bEnd) insertNode(parentNode, b[bStart++], node);
|
|
136
124
|
} else if (bEnd === bStart) {
|
|
137
125
|
while (aStart < aEnd) {
|
|
@@ -171,7 +159,7 @@ function createRenderer$1({
|
|
|
171
159
|
function cleanChildren(parent, current, marker, replacement) {
|
|
172
160
|
if (marker === undefined) {
|
|
173
161
|
let removed;
|
|
174
|
-
while (
|
|
162
|
+
while (removed = getFirstChild(parent)) removeNode(parent, removed);
|
|
175
163
|
replacement && insertNode(parent, replacement);
|
|
176
164
|
return "";
|
|
177
165
|
}
|
|
@@ -182,9 +170,7 @@ function createRenderer$1({
|
|
|
182
170
|
const el = current[i];
|
|
183
171
|
if (node !== el) {
|
|
184
172
|
const isParent = getParentNode(el) === parent;
|
|
185
|
-
if (!inserted && !i)
|
|
186
|
-
isParent ? replaceNode(parent, node, el) : insertNode(parent, node, marker);
|
|
187
|
-
else isParent && removeNode(parent, el);
|
|
173
|
+
if (!inserted && !i) isParent ? replaceNode(parent, node, el) : insertNode(parent, node, marker);else isParent && removeNode(parent, el);
|
|
188
174
|
} else inserted = true;
|
|
189
175
|
}
|
|
190
176
|
} else insertNode(parent, node, marker);
|
|
@@ -200,9 +186,7 @@ function createRenderer$1({
|
|
|
200
186
|
function spreadExpression(node, props, prevProps = {}, skipChildren) {
|
|
201
187
|
props || (props = {});
|
|
202
188
|
if (!skipChildren) {
|
|
203
|
-
createRenderEffect(
|
|
204
|
-
() => (prevProps.children = insertExpression(node, props.children, prevProps.children))
|
|
205
|
-
);
|
|
189
|
+
createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
206
190
|
}
|
|
207
191
|
createRenderEffect(() => props.ref && props.ref(node));
|
|
208
192
|
createRenderEffect(() => {
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import type { RendererOptions, Renderer } from "./universal.js";
|
|
2
|
-
export declare function createRenderer<NodeType>(
|
|
3
|
-
options: RendererOptions<NodeType>
|
|
4
|
-
): Renderer<NodeType>;
|
|
2
|
+
export declare function createRenderer<NodeType>(options: RendererOptions<NodeType>): Renderer<NodeType>;
|
package/web/dist/dev.cjs
CHANGED
|
@@ -222,7 +222,7 @@ function spread(node, props = {}, isSVG, skipChildren) {
|
|
|
222
222
|
if (!skipChildren) {
|
|
223
223
|
solidJs.createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
224
224
|
}
|
|
225
|
-
solidJs.createRenderEffect(() => typeof props.ref === "function"
|
|
225
|
+
solidJs.createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node));
|
|
226
226
|
solidJs.createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
227
227
|
return prevProps;
|
|
228
228
|
}
|
|
@@ -419,7 +419,10 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
419
419
|
parent = multi && current[0] && current[0].parentNode || parent;
|
|
420
420
|
if (t === "string" || t === "number") {
|
|
421
421
|
if (hydrating) return current;
|
|
422
|
-
if (t === "number")
|
|
422
|
+
if (t === "number") {
|
|
423
|
+
value = value.toString();
|
|
424
|
+
if (value === current) return current;
|
|
425
|
+
}
|
|
423
426
|
if (multi) {
|
|
424
427
|
let node = current[0];
|
|
425
428
|
if (node && node.nodeType === 3) {
|
|
@@ -532,8 +535,7 @@ function gatherHydratable(element, root) {
|
|
|
532
535
|
}
|
|
533
536
|
}
|
|
534
537
|
function getHydrationKey() {
|
|
535
|
-
|
|
536
|
-
return `${hydrate.id}${hydrate.count++}`;
|
|
538
|
+
return solidJs.sharedConfig.getNextContextId();
|
|
537
539
|
}
|
|
538
540
|
function NoHydration(props) {
|
|
539
541
|
return solidJs.sharedConfig.context ? undefined : props.children;
|