solid-js 2.0.0-experimental.0 → 2.0.0-experimental.10
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 +191 -103
- package/dist/dev.js +212 -272
- package/dist/server.cjs +434 -664
- package/dist/server.js +382 -741
- package/dist/solid.cjs +185 -101
- package/dist/solid.js +189 -241
- package/package.json +5 -3
- package/types/client/component.d.ts +13 -24
- package/types/client/core.d.ts +8 -11
- package/types/client/flow.d.ts +23 -33
- package/types/client/hydration.d.ts +46 -18
- package/types/client/observable.d.ts +19 -25
- package/types/index.d.ts +12 -66
- package/types/jsx.d.ts +1626 -1637
- package/types/server/index.d.ts +9 -58
- package/types/server/reactive.d.ts +23 -122
- package/types/server/rendering.d.ts +53 -206
- package/types/server/signals.d.ts +41 -0
- package/types/server/store.d.ts +6 -1
- package/types/utilities.d.ts +36 -0
package/types/client/flow.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Accessor } from "@solidjs/signals";
|
|
1
|
+
import type { Accessor, BoundaryMode } from "@solidjs/signals";
|
|
2
2
|
import type { JSX } from "../jsx.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a list of elements from a list
|
|
@@ -13,10 +13,10 @@ import type { JSX } from "../jsx.js";
|
|
|
13
13
|
* @description https://docs.solidjs.com/reference/components/for
|
|
14
14
|
*/
|
|
15
15
|
export declare function For<T extends readonly any[], U extends JSX.Element>(props: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
each: T | undefined | null | false;
|
|
17
|
+
fallback?: JSX.Element;
|
|
18
|
+
keyed?: boolean | ((item: T[number]) => any);
|
|
19
|
+
children: (item: Accessor<T[number]>, index: Accessor<number>) => U;
|
|
20
20
|
}): JSX.Element;
|
|
21
21
|
/**
|
|
22
22
|
* Creates a list elements from a count
|
|
@@ -31,19 +31,20 @@ export declare function For<T extends readonly any[], U extends JSX.Element>(pro
|
|
|
31
31
|
* @description https://docs.solidjs.com/reference/components/repeat
|
|
32
32
|
*/
|
|
33
33
|
export declare function Repeat<T extends JSX.Element>(props: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
count: number;
|
|
35
|
+
from?: number | undefined;
|
|
36
|
+
fallback?: JSX.Element;
|
|
37
|
+
children: ((index: number) => T) | T;
|
|
37
38
|
}): JSX.Element;
|
|
38
39
|
/**
|
|
39
40
|
* Conditionally render its children or an optional fallback component
|
|
40
41
|
* @description https://docs.solidjs.com/reference/components/show
|
|
41
42
|
*/
|
|
42
43
|
export declare function Show<T>(props: {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
when: T | undefined | null | false;
|
|
45
|
+
keyed?: boolean;
|
|
46
|
+
fallback?: JSX.Element;
|
|
47
|
+
children: JSX.Element | ((item: Accessor<NonNullable<T>>) => JSX.Element);
|
|
47
48
|
}): JSX.Element;
|
|
48
49
|
/**
|
|
49
50
|
* Switches between content based on mutually exclusive conditions
|
|
@@ -60,13 +61,13 @@ export declare function Show<T>(props: {
|
|
|
60
61
|
* @description https://docs.solidjs.com/reference/components/switch-and-match
|
|
61
62
|
*/
|
|
62
63
|
export declare function Switch(props: {
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
fallback?: JSX.Element;
|
|
65
|
+
children: JSX.Element;
|
|
65
66
|
}): JSX.Element;
|
|
66
67
|
export type MatchProps<T> = {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
when: T | undefined | null | false;
|
|
69
|
+
keyed?: boolean;
|
|
70
|
+
children: JSX.Element | ((item: Accessor<NonNullable<T>>) => JSX.Element);
|
|
70
71
|
};
|
|
71
72
|
/**
|
|
72
73
|
* Selects a content based on condition when inside a `<Switch>` control flow
|
|
@@ -94,21 +95,10 @@ export declare function Match<T>(props: MatchProps<T>): JSX.Element;
|
|
|
94
95
|
* @description https://docs.solidjs.com/reference/components/error-boundary
|
|
95
96
|
*/
|
|
96
97
|
export declare function ErrorBoundary(props: {
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
fallback: JSX.Element | ((err: any, reset: () => void) => JSX.Element);
|
|
99
|
+
children: JSX.Element;
|
|
99
100
|
}): JSX.Element;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
* const AsyncComponent = lazy(() => import('./component'));
|
|
104
|
-
*
|
|
105
|
-
* <Suspense fallback={<LoadingIndicator />}>
|
|
106
|
-
* <AsyncComponent />
|
|
107
|
-
* </Suspense>
|
|
108
|
-
* ```
|
|
109
|
-
* @description https://docs.solidjs.com/reference/components/suspense
|
|
110
|
-
*/
|
|
111
|
-
export declare function Suspense(props: {
|
|
112
|
-
fallback?: JSX.Element;
|
|
113
|
-
children: JSX.Element;
|
|
101
|
+
export declare function Boundary(props: {
|
|
102
|
+
mode: BoundaryMode;
|
|
103
|
+
children: JSX.Element;
|
|
114
104
|
}): JSX.Element;
|
|
@@ -1,22 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
1
|
+
import { MemoOptions } from "@solidjs/signals";
|
|
2
|
+
import { JSX } from "../jsx.js";
|
|
3
|
+
export type HydrationContext = {};
|
|
5
4
|
type SharedConfig = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
getContextId(): string;
|
|
17
|
-
getNextContextId(): string;
|
|
5
|
+
hydrating: boolean;
|
|
6
|
+
resources?: {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
};
|
|
9
|
+
load?: (id: string) => Promise<any> | any;
|
|
10
|
+
has?: (id: string) => boolean;
|
|
11
|
+
gather?: (key: string) => void;
|
|
12
|
+
registry?: Map<string, Element>;
|
|
13
|
+
done: boolean;
|
|
14
|
+
getNextContextId(): string;
|
|
18
15
|
};
|
|
19
16
|
export declare const sharedConfig: SharedConfig;
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Tracks all resources inside a component and renders a fallback until they are all resolved
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const AsyncComponent = lazy(() => import('./component'));
|
|
21
|
+
*
|
|
22
|
+
* <Suspense fallback={<LoadingIndicator />}>
|
|
23
|
+
* <AsyncComponent />
|
|
24
|
+
* </Suspense>
|
|
25
|
+
* ```
|
|
26
|
+
* @description https://docs.solidjs.com/reference/components/suspense
|
|
27
|
+
*/
|
|
28
|
+
export declare function Suspense(props: {
|
|
29
|
+
fallback?: JSX.Element;
|
|
30
|
+
children: JSX.Element;
|
|
31
|
+
}): JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a readonly derived async reactive memoized signal
|
|
34
|
+
* ```typescript
|
|
35
|
+
* export function createAsync<T>(
|
|
36
|
+
* compute: (v: T) => Promise<T> | T,
|
|
37
|
+
* value?: T,
|
|
38
|
+
* options?: { name?: string, equals?: false | ((prev: T, next: T) => boolean) }
|
|
39
|
+
* ): () => T & { refresh: () => void };
|
|
40
|
+
* ```
|
|
41
|
+
* @param compute a function that receives its previous or the initial value, if set, and returns a new value used to react on a computation
|
|
42
|
+
* @param value an optional initial value for the computation; if set, fn will never receive undefined as first argument
|
|
43
|
+
* @param options allows to set a name in dev mode for debugging purposes and use a custom comparison function in equals
|
|
44
|
+
*
|
|
45
|
+
* @description https://docs.solidjs.com/reference/basic-reactivity/create-async
|
|
46
|
+
*/
|
|
47
|
+
export declare function createAsync<T>(compute: (prev?: T) => Promise<T> | AsyncIterable<T> | T, value?: T, options?: MemoOptions<T>): import("@solidjs/signals").Accessor<T> & {
|
|
48
|
+
refresh: () => void;
|
|
49
|
+
};
|
|
22
50
|
export {};
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { Accessor, Setter } from "@solidjs/signals";
|
|
2
2
|
declare global {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
interface SymbolConstructor {
|
|
4
|
+
readonly observable: symbol;
|
|
5
|
+
}
|
|
6
6
|
}
|
|
7
7
|
interface Observable<T> {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
[Symbol.observable](): Observable<T>;
|
|
12
|
-
}
|
|
13
|
-
export type ObservableObserver<T> =
|
|
14
|
-
| ((v: T) => void)
|
|
15
|
-
| {
|
|
16
|
-
next?: (v: T) => void;
|
|
17
|
-
error?: (v: any) => void;
|
|
18
|
-
complete?: (v: boolean) => void;
|
|
8
|
+
subscribe(observer: ObservableObserver<T>): {
|
|
9
|
+
unsubscribe(): void;
|
|
19
10
|
};
|
|
11
|
+
[Symbol.observable](): Observable<T>;
|
|
12
|
+
}
|
|
13
|
+
export type ObservableObserver<T> = ((v: T) => void) | {
|
|
14
|
+
next?: (v: T) => void;
|
|
15
|
+
error?: (v: any) => void;
|
|
16
|
+
complete?: (v: boolean) => void;
|
|
17
|
+
};
|
|
20
18
|
/**
|
|
21
19
|
* Creates a simple observable from a signal's accessor to be used with the `from` operator of observable libraries like e.g. rxjs
|
|
22
20
|
* ```typescript
|
|
@@ -28,15 +26,11 @@ export type ObservableObserver<T> =
|
|
|
28
26
|
* description https://docs.solidjs.com/reference/reactive-utilities/observable
|
|
29
27
|
*/
|
|
30
28
|
export declare function observable<T>(input: Accessor<T>): Observable<T>;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
unsubscribe: () => void;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
): Accessor<T | undefined>;
|
|
29
|
+
type Producer<T> = ((setter: Setter<T>) => () => void) | {
|
|
30
|
+
subscribe: (fn: (v: T) => void) => (() => void) | {
|
|
31
|
+
unsubscribe: () => void;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare function from<T>(producer: Producer<T>, initalValue: T): Accessor<T>;
|
|
35
|
+
export declare function from<T>(producer: Producer<T | undefined>): Accessor<T | undefined>;
|
|
42
36
|
export {};
|
package/types/index.d.ts
CHANGED
|
@@ -1,76 +1,22 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
$TRACK,
|
|
4
|
-
$RAW,
|
|
5
|
-
catchError,
|
|
6
|
-
createAsync,
|
|
7
|
-
createEffect,
|
|
8
|
-
createMemo,
|
|
9
|
-
createProjection,
|
|
10
|
-
createReaction,
|
|
11
|
-
createRenderEffect,
|
|
12
|
-
createRoot,
|
|
13
|
-
createSignal,
|
|
14
|
-
createStore,
|
|
15
|
-
flatten,
|
|
16
|
-
flushSync,
|
|
17
|
-
getObserver,
|
|
18
|
-
getOwner,
|
|
19
|
-
isEqual,
|
|
20
|
-
isStale,
|
|
21
|
-
isWrappable,
|
|
22
|
-
latest,
|
|
23
|
-
mapArray,
|
|
24
|
-
merge,
|
|
25
|
-
omit,
|
|
26
|
-
onCleanup,
|
|
27
|
-
reconcile,
|
|
28
|
-
repeat,
|
|
29
|
-
resolve,
|
|
30
|
-
runWithOwner,
|
|
31
|
-
untrack,
|
|
32
|
-
unwrap
|
|
33
|
-
} from "@solidjs/signals";
|
|
34
|
-
export type {
|
|
35
|
-
Accessor,
|
|
36
|
-
ComputeFunction,
|
|
37
|
-
EffectFunction,
|
|
38
|
-
EffectOptions,
|
|
39
|
-
Merge,
|
|
40
|
-
NoInfer,
|
|
41
|
-
NotWrappable,
|
|
42
|
-
Omit,
|
|
43
|
-
Owner,
|
|
44
|
-
Signal,
|
|
45
|
-
SignalOptions,
|
|
46
|
-
Setter,
|
|
47
|
-
Store,
|
|
48
|
-
SolidStore,
|
|
49
|
-
StoreNode,
|
|
50
|
-
StoreSetter
|
|
51
|
-
} from "@solidjs/signals";
|
|
1
|
+
export { $PROXY, $TRACK, createEffect, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createTrackedEffect, deep, flatten, flush, getObserver, getOwner, isEqual, isPending, isWrappable, latest, mapArray, merge, omit, onCleanup, reconcile, repeat, resolve, runWithOwner, snapshot, transition, untrack, useTransition } from "@solidjs/signals";
|
|
2
|
+
export type { Accessor, BoundaryMode, ComputeFunction, EffectFunction, EffectOptions, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter } from "@solidjs/signals";
|
|
52
3
|
export { $DEVCOMP, children, createContext, onMount, useContext } from "./client/core.js";
|
|
53
|
-
export type {
|
|
54
|
-
|
|
55
|
-
Context,
|
|
56
|
-
ContextProviderComponent,
|
|
57
|
-
ResolvedChildren,
|
|
58
|
-
ResolvedJSXElement
|
|
59
|
-
} from "./client/core.js";
|
|
4
|
+
export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedJSXElement } from "./client/core.js";
|
|
5
|
+
export * from "./utilities.js";
|
|
60
6
|
export * from "./client/observable.js";
|
|
61
7
|
export * from "./client/component.js";
|
|
62
8
|
export * from "./client/flow.js";
|
|
63
|
-
export { sharedConfig } from "./client/hydration.js";
|
|
9
|
+
export { sharedConfig, createAsync, Suspense } from "./client/hydration.js";
|
|
10
|
+
export declare function ssrHandleError(): void;
|
|
11
|
+
export declare function ssrRunInScope(): void;
|
|
64
12
|
import type { JSX } from "./jsx.js";
|
|
65
13
|
type JSXElement = JSX.Element;
|
|
66
14
|
export type { JSXElement, JSX };
|
|
67
15
|
import { registerGraph } from "./client/core.js";
|
|
68
|
-
export declare const DEV:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
| undefined;
|
|
16
|
+
export declare const DEV: {
|
|
17
|
+
readonly hooks: {};
|
|
18
|
+
readonly registerGraph: typeof registerGraph;
|
|
19
|
+
} | undefined;
|
|
74
20
|
declare global {
|
|
75
|
-
|
|
21
|
+
var Solid$$: boolean;
|
|
76
22
|
}
|