solid-js 1.8.21 → 1.8.22
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 +3 -3
- package/dist/dev.cjs +6 -4
- package/dist/dev.js +325 -564
- package/dist/server.js +74 -168
- package/dist/solid.cjs +6 -4
- package/dist/solid.js +283 -491
- package/h/dist/h.cjs +1 -1
- package/h/dist/h.js +9 -38
- 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 +2 -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 +1 -1
- 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 +61 -218
- package/types/index.d.ts +10 -75
- package/types/jsx.d.ts +8 -18
- package/types/reactive/array.d.ts +4 -12
- package/types/reactive/observable.d.ts +17 -25
- package/types/reactive/scheduler.d.ts +6 -9
- package/types/reactive/signal.d.ts +142 -233
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +33 -64
- package/types/render/flow.d.ts +31 -43
- package/types/render/hydration.d.ts +15 -15
- package/types/server/index.d.ts +2 -57
- package/types/server/reactive.d.ts +42 -73
- package/types/server/rendering.d.ts +98 -169
- 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.js +83 -625
- package/web/dist/server.js +96 -210
- package/web/dist/web.js +81 -616
- 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 +10 -27
- package/web/types/server-mock.d.ts +32 -47
|
@@ -2,229 +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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
context?: HydrationContext;
|
|
21
|
+
getContextId(): string;
|
|
22
|
+
getNextContextId(): string;
|
|
27
23
|
};
|
|
28
24
|
export declare const sharedConfig: SharedConfig;
|
|
29
25
|
export declare function createUniqueId(): string;
|
|
30
26
|
export declare function createComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element;
|
|
31
27
|
export declare function mergeProps<T, U>(source: T, source1: U): T & U;
|
|
32
28
|
export declare function mergeProps<T, U, V>(source: T, source1: U, source2: V): T & U & V;
|
|
33
|
-
export declare function mergeProps<T, U, V, W>(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
...keys: [K1[], K2[]]
|
|
46
|
-
): [Pick<T, K1>, Pick<T, K2>, Omit<T, K1 | K2>];
|
|
47
|
-
export declare function splitProps<
|
|
48
|
-
T extends object,
|
|
49
|
-
K1 extends keyof T,
|
|
50
|
-
K2 extends keyof T,
|
|
51
|
-
K3 extends keyof T
|
|
52
|
-
>(
|
|
53
|
-
props: T,
|
|
54
|
-
...keys: [K1[], K2[], K3[]]
|
|
55
|
-
): [Pick<T, K1>, Pick<T, K2>, Pick<T, K3>, Omit<T, K1 | K2 | K3>];
|
|
56
|
-
export declare function splitProps<
|
|
57
|
-
T extends object,
|
|
58
|
-
K1 extends keyof T,
|
|
59
|
-
K2 extends keyof T,
|
|
60
|
-
K3 extends keyof T,
|
|
61
|
-
K4 extends keyof T
|
|
62
|
-
>(
|
|
63
|
-
props: T,
|
|
64
|
-
...keys: [K1[], K2[], K3[], K4[]]
|
|
65
|
-
): [Pick<T, K1>, Pick<T, K2>, Pick<T, K3>, Pick<T, K4>, Omit<T, K1 | K2 | K3 | K4>];
|
|
66
|
-
export declare function splitProps<
|
|
67
|
-
T extends object,
|
|
68
|
-
K1 extends keyof T,
|
|
69
|
-
K2 extends keyof T,
|
|
70
|
-
K3 extends keyof T,
|
|
71
|
-
K4 extends keyof T,
|
|
72
|
-
K5 extends keyof T
|
|
73
|
-
>(
|
|
74
|
-
props: T,
|
|
75
|
-
...keys: [K1[], K2[], K3[], K4[], K5[]]
|
|
76
|
-
): [
|
|
77
|
-
Pick<T, K1>,
|
|
78
|
-
Pick<T, K2>,
|
|
79
|
-
Pick<T, K3>,
|
|
80
|
-
Pick<T, K4>,
|
|
81
|
-
Pick<T, K5>,
|
|
82
|
-
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>
|
|
83
41
|
];
|
|
84
42
|
export declare function For<T>(props: {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
43
|
+
each: T[];
|
|
44
|
+
fallback?: string;
|
|
45
|
+
children: (item: T, index: () => number) => string;
|
|
88
46
|
}): string | any[] | undefined;
|
|
89
47
|
export declare function Index<T>(props: {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
48
|
+
each: T[];
|
|
49
|
+
fallback?: string;
|
|
50
|
+
children: (item: () => T, index: number) => string;
|
|
93
51
|
}): string | any[] | undefined;
|
|
94
52
|
/**
|
|
95
53
|
* Conditionally render its children or an optional fallback component
|
|
96
54
|
* @description https://docs.solidjs.com/reference/components/show
|
|
97
55
|
*/
|
|
98
56
|
export declare function Show<T>(props: {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
57
|
+
when: T | undefined | null | false;
|
|
58
|
+
keyed?: boolean;
|
|
59
|
+
fallback?: string;
|
|
60
|
+
children: string | ((item: NonNullable<T> | Accessor<NonNullable<T>>) => string);
|
|
103
61
|
}): string;
|
|
104
62
|
export declare function Switch(props: {
|
|
105
|
-
|
|
106
|
-
|
|
63
|
+
fallback?: string;
|
|
64
|
+
children: MatchProps<unknown> | MatchProps<unknown>[];
|
|
107
65
|
}): string;
|
|
108
66
|
type MatchProps<T> = {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
67
|
+
when: T | false;
|
|
68
|
+
keyed?: boolean;
|
|
69
|
+
children: string | ((item: NonNullable<T> | Accessor<NonNullable<T>>) => string);
|
|
112
70
|
};
|
|
113
71
|
export declare function Match<T>(props: MatchProps<T>): MatchProps<T>;
|
|
114
72
|
export declare function resetErrorBoundaries(): void;
|
|
115
73
|
export declare function ErrorBoundary(props: {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}):
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
| {
|
|
122
|
-
t: string;
|
|
123
|
-
};
|
|
74
|
+
fallback: string | ((err: any, reset: () => void) => string);
|
|
75
|
+
children: string;
|
|
76
|
+
}): string | ((err: any, reset: () => void) => string) | {
|
|
77
|
+
t: string;
|
|
78
|
+
};
|
|
124
79
|
export interface Resource<T> {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
80
|
+
(): T | undefined;
|
|
81
|
+
state: "unresolved" | "pending" | "ready" | "refreshing" | "errored";
|
|
82
|
+
loading: boolean;
|
|
83
|
+
error: any;
|
|
84
|
+
latest: T | undefined;
|
|
130
85
|
}
|
|
131
86
|
type SuspenseContextType = {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
>;
|
|
139
|
-
completed: () => void;
|
|
87
|
+
resources: Map<string, {
|
|
88
|
+
loading: boolean;
|
|
89
|
+
error: any;
|
|
90
|
+
}>;
|
|
91
|
+
completed: () => void;
|
|
140
92
|
};
|
|
141
93
|
export type ResourceActions<T> = {
|
|
142
|
-
|
|
143
|
-
|
|
94
|
+
mutate: Setter<T>;
|
|
95
|
+
refetch: (info?: unknown) => void;
|
|
144
96
|
};
|
|
145
97
|
export type ResourceReturn<T> = [Resource<T>, ResourceActions<T>];
|
|
146
98
|
export type ResourceSource<S> = S | false | null | undefined | (() => S | false | null | undefined);
|
|
147
99
|
export type ResourceFetcher<S, T> = (k: S, info: ResourceFetcherInfo<T>) => T | Promise<T>;
|
|
148
100
|
export type ResourceFetcherInfo<T> = {
|
|
149
|
-
|
|
150
|
-
|
|
101
|
+
value: T | undefined;
|
|
102
|
+
refetching?: unknown;
|
|
151
103
|
};
|
|
152
|
-
export type ResourceOptions<T> = undefined extends T
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
export declare function createResource<T, S
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
): ResourceReturn<T | undefined>;
|
|
173
|
-
export declare function createResource<T, S = true>(
|
|
174
|
-
fetcher: ResourceFetcher<S, T>,
|
|
175
|
-
options: ResourceOptions<T>
|
|
176
|
-
): ResourceReturn<T>;
|
|
177
|
-
export declare function createResource<T, S>(
|
|
178
|
-
source: ResourceSource<S>,
|
|
179
|
-
fetcher: ResourceFetcher<S, T>,
|
|
180
|
-
options?: ResourceOptions<undefined>
|
|
181
|
-
): ResourceReturn<T | undefined>;
|
|
182
|
-
export declare function createResource<T, S>(
|
|
183
|
-
source: ResourceSource<S>,
|
|
184
|
-
fetcher: ResourceFetcher<S, T>,
|
|
185
|
-
options: ResourceOptions<T>
|
|
186
|
-
): ResourceReturn<T>;
|
|
187
|
-
export declare function lazy<T extends Component<any>>(
|
|
188
|
-
fn: () => Promise<{
|
|
189
|
-
default: T;
|
|
190
|
-
}>
|
|
191
|
-
): T & {
|
|
192
|
-
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<{
|
|
193
124
|
default: T;
|
|
194
|
-
|
|
125
|
+
}>): T & {
|
|
126
|
+
preload: () => Promise<{
|
|
127
|
+
default: T;
|
|
128
|
+
}>;
|
|
195
129
|
};
|
|
196
130
|
export declare function enableScheduling(): void;
|
|
197
131
|
export declare function enableHydration(): void;
|
|
198
132
|
export declare function startTransition(fn: () => any): void;
|
|
199
133
|
export declare function useTransition(): [() => boolean, (fn: () => any) => void];
|
|
200
134
|
type HydrationContext = {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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;
|
|
213
147
|
};
|
|
214
148
|
export declare function SuspenseList(props: {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
149
|
+
children: string;
|
|
150
|
+
revealOrder: "forwards" | "backwards" | "together";
|
|
151
|
+
tail?: "collapsed" | "hidden";
|
|
218
152
|
}): string;
|
|
219
|
-
export declare function Suspense(props: {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
| {
|
|
226
|
-
t: string;
|
|
227
|
-
}
|
|
228
|
-
| null
|
|
229
|
-
| 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;
|
|
230
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>;
|