solid-js 2.0.0-beta.6 → 2.0.0-beta.8
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/dist/dev.cjs +66 -104
- package/dist/dev.js +66 -104
- package/dist/server.cjs +331 -132
- package/dist/server.js +331 -132
- package/dist/solid.cjs +66 -104
- package/dist/solid.js +66 -104
- package/package.json +78 -30
- package/types/client/flow.d.ts +34 -13
- package/types/client/hydration.d.ts +35 -9
- package/types/jsx-properties.d.ts +92 -0
- package/types/jsx.d.ts +390 -314
- package/types/server/flow.d.ts +40 -7
- package/types/server/hydration.d.ts +18 -1
- package/types/server/signals.d.ts +33 -15
- package/types-cjs/client/component.d.cts +75 -0
- package/types-cjs/client/core.d.cts +58 -0
- package/types-cjs/client/flow.d.cts +163 -0
- package/types-cjs/client/hydration.d.cts +121 -0
- package/types-cjs/index.d.cts +17 -0
- package/types-cjs/jsx-properties.d.cts +92 -0
- package/types-cjs/jsx.d.cts +4294 -0
- package/types-cjs/package.json +3 -0
- package/types-cjs/server/component.d.cts +67 -0
- package/types-cjs/server/core.d.cts +44 -0
- package/types-cjs/server/flow.d.cts +115 -0
- package/types-cjs/server/hydration.d.cts +63 -0
- package/types-cjs/server/index.d.cts +12 -0
- package/types-cjs/server/shared.d.cts +50 -0
- package/types-cjs/server/signals.d.cts +87 -0
package/types/server/flow.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { Accessor } from "./signals.js";
|
|
1
|
+
import type { Accessor, RevealOrder } from "./signals.js";
|
|
2
2
|
import type { JSX } from "../jsx.js";
|
|
3
|
+
export type { RevealOrder };
|
|
3
4
|
type NonZeroParams<T extends (...args: any[]) => any> = Parameters<T>["length"] extends 0 ? never : T;
|
|
4
5
|
type ConditionalRenderCallback<T> = (item: Accessor<NonNullable<T>>) => JSX.Element;
|
|
5
6
|
type ConditionalRenderChildren<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = JSX.Element | NonZeroParams<F>;
|
|
@@ -70,13 +71,45 @@ export declare function Loading(props: {
|
|
|
70
71
|
on?: any;
|
|
71
72
|
children: JSX.Element;
|
|
72
73
|
}): JSX.Element;
|
|
74
|
+
export type RevealProps = {
|
|
75
|
+
order?: RevealOrder;
|
|
76
|
+
collapsed?: boolean;
|
|
77
|
+
children: JSX.Element;
|
|
78
|
+
};
|
|
73
79
|
/**
|
|
74
80
|
* Coordinates the reveal timing of sibling `<Loading>` boundaries during SSR.
|
|
81
|
+
*
|
|
82
|
+
* The `order` prop picks the reveal policy:
|
|
83
|
+
* - `"sequential"` (default) — boundaries reveal in streamed order; out-of-order
|
|
84
|
+
* resolutions have their fragment HTML streamed into templates as data arrives,
|
|
85
|
+
* but the swap from fallback to content waits until the frontier reaches them.
|
|
86
|
+
* - `"together"` — every direct slot holds its fallback until the whole group is
|
|
87
|
+
* "minimally ready" (every direct slot has its own first visible content
|
|
88
|
+
* available), then the whole group releases in a single activation.
|
|
89
|
+
* - `"natural"` — each boundary's swap is triggered as its own data resolves. At
|
|
90
|
+
* the top level this is equivalent to omitting `<Reveal>`; the mode exists for
|
|
91
|
+
* nesting, where the group registers as a single composite slot in an enclosing
|
|
92
|
+
* `<Reveal>`.
|
|
93
|
+
*
|
|
94
|
+
* The `collapsed` prop is only consulted when `order="sequential"` (the default);
|
|
95
|
+
* it is ignored under `"together"` and `"natural"`.
|
|
96
|
+
*
|
|
97
|
+
* Nesting: a nested `<Reveal>` is held on its fallbacks until its parent releases
|
|
98
|
+
* the slot it occupies. HTML for resolved fragments still streams through normally;
|
|
99
|
+
* only the `revealFragments` swap calls are deferred. Once released, the inner
|
|
100
|
+
* group runs its own `order` locally over whatever is still pending. There is no
|
|
101
|
+
* escape hatch.
|
|
102
|
+
*
|
|
103
|
+
* Engine support:
|
|
104
|
+
* - `renderToString` fully supports `order="sequential"` (without `collapsed`) and
|
|
105
|
+
* `order="natural"` because neither requires streamed activation.
|
|
106
|
+
* - `order="together"` and `collapsed` rely on streamed activation and require
|
|
107
|
+
* `renderToStream` / `renderToStringAsync`. Using them inside a nested `<Reveal>`
|
|
108
|
+
* under `renderToString` logs a warning.
|
|
109
|
+
*
|
|
110
|
+
* See `documentation/solid-2.0/03-control-flow.md` for the full outer/inner
|
|
111
|
+
* nesting matrix and the "minimally ready" definition per order.
|
|
112
|
+
*
|
|
75
113
|
* @description https://docs.solidjs.com/reference/components/reveal
|
|
76
114
|
*/
|
|
77
|
-
export declare function Reveal(props:
|
|
78
|
-
together?: boolean;
|
|
79
|
-
collapsed?: boolean;
|
|
80
|
-
children: JSX.Element;
|
|
81
|
-
}): JSX.Element;
|
|
82
|
-
export {};
|
|
115
|
+
export declare function Reveal(props: RevealProps): JSX.Element;
|
|
@@ -4,10 +4,27 @@ export { sharedConfig, NoHydrateContext } from "./shared.js";
|
|
|
4
4
|
export type { HydrationContext, SSRTemplateObject } from "./shared.js";
|
|
5
5
|
export type ServerRevealGroup = {
|
|
6
6
|
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* Register a child fragment (Loading) or composite child (inner Reveal).
|
|
9
|
+
* Returns `collapseFallback` (hide fallback visually, used for collapsed-sequential
|
|
10
|
+
* tail) and `held` (stash `revealFragments` swaps until the parent releases us).
|
|
11
|
+
* `held` only applies when the caller is a nested Reveal — Loadings ignore it.
|
|
12
|
+
*/
|
|
7
13
|
register(key: string, options?: {
|
|
8
14
|
onActivate?: () => void;
|
|
9
|
-
}):
|
|
15
|
+
}): {
|
|
16
|
+
collapseFallback: boolean;
|
|
17
|
+
held: boolean;
|
|
18
|
+
};
|
|
19
|
+
/** Called by a child when its subtree is fully resolved. */
|
|
10
20
|
onResolved(key: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Called by a nested Reveal when it becomes "minimally resolved" under its own
|
|
23
|
+
* order (together: fully resolved; sequential: first registered fragment resolved;
|
|
24
|
+
* natural: any fragment resolved). Loadings don't fire this — their `onResolved`
|
|
25
|
+
* implies minimal readiness at the same time.
|
|
26
|
+
*/
|
|
27
|
+
onMinimallyResolved?(key: string): void;
|
|
11
28
|
};
|
|
12
29
|
export declare const RevealGroupContext: Context<ServerRevealGroup | null>;
|
|
13
30
|
/**
|
|
@@ -12,29 +12,46 @@ interface ServerComputation<T = any> {
|
|
|
12
12
|
computed: boolean;
|
|
13
13
|
disposed: boolean;
|
|
14
14
|
}
|
|
15
|
+
type SsrSourceMode = "server" | "hybrid" | "client";
|
|
16
|
+
type ServerSsrOptions = {
|
|
17
|
+
deferStream?: boolean;
|
|
18
|
+
ssrSource?: SsrSourceMode;
|
|
19
|
+
};
|
|
20
|
+
type ServerClientMemoOptions<T> = Omit<MemoOptions<T>, "ssrSource"> & {
|
|
21
|
+
ssrSource: "client";
|
|
22
|
+
};
|
|
23
|
+
type ServerMemoOptions<T> = Omit<MemoOptions<T>, "ssrSource"> & {
|
|
24
|
+
ssrSource?: "server" | "hybrid";
|
|
25
|
+
};
|
|
26
|
+
type ServerClientSignalOptions<T> = Omit<SignalOptions<T>, "ssrSource"> & {
|
|
27
|
+
ssrSource: "client";
|
|
28
|
+
};
|
|
29
|
+
type ServerSignalOptions<T> = Omit<SignalOptions<T>, "ssrSource"> & {
|
|
30
|
+
ssrSource?: "server" | "hybrid";
|
|
31
|
+
};
|
|
15
32
|
export declare function getObserver(): ServerComputation<any> | null;
|
|
16
33
|
export declare function createSignal<T>(): Signal<T | undefined>;
|
|
17
34
|
export declare function createSignal<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>;
|
|
18
|
-
export declare function createSignal<T>(fn: ComputeFunction<T>,
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function createMemo<
|
|
35
|
+
export declare function createSignal<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options: ServerClientSignalOptions<T>): Signal<T | undefined>;
|
|
36
|
+
export declare function createSignal<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options?: ServerSignalOptions<T>): Signal<T>;
|
|
37
|
+
export declare function createMemo<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options: ServerClientMemoOptions<T>): Accessor<T | undefined>;
|
|
38
|
+
export declare function createMemo<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options?: ServerMemoOptions<T>): Accessor<T>;
|
|
21
39
|
export type PatchOp = [path: PropertyKey[]] | [path: PropertyKey[], value: any] | [path: PropertyKey[], value: any, insert: 1];
|
|
22
40
|
export declare function createDeepProxy<T extends object>(target: T, patches: PatchOp[], basePath?: PropertyKey[]): T;
|
|
23
|
-
export declare function createEffect<
|
|
24
|
-
export declare function
|
|
25
|
-
export declare function
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
export declare function createEffect<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, effect: EffectFunction<NoInfer<T>, T> | EffectBundle<NoInfer<T>, T>, options?: EffectOptions): void;
|
|
42
|
+
export declare function createRenderEffect<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, effectFn: EffectFunction<NoInfer<T>, T>, options?: EffectOptions): void;
|
|
43
|
+
export declare function createTrackedEffect(compute: () => void | (() => void), options?: {
|
|
44
|
+
name?: string;
|
|
45
|
+
}): void;
|
|
28
46
|
export declare function createReaction(effectFn: EffectFunction<undefined> | EffectBundle<undefined>, options?: EffectOptions): (tracking: () => void) => void;
|
|
29
47
|
export declare function createOptimistic<T>(): Signal<T | undefined>;
|
|
30
48
|
export declare function createOptimistic<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>;
|
|
31
|
-
export declare function createOptimistic<T>(fn: ComputeFunction<T>,
|
|
32
|
-
export declare function
|
|
49
|
+
export declare function createOptimistic<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options: ServerClientSignalOptions<T>): Signal<T | undefined>;
|
|
50
|
+
export declare function createOptimistic<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options?: ServerSignalOptions<T>): Signal<T>;
|
|
51
|
+
export declare function createStore<T extends object>(store: T | Store<T>): [get: Store<T>, set: StoreSetter<T>];
|
|
52
|
+
export declare function createStore<T extends object>(fn: (store: T) => void | T | Promise<void | T>, store: Partial<T> | Store<T>): [get: Store<T>, set: StoreSetter<T>];
|
|
33
53
|
export declare const createOptimisticStore: typeof createStore;
|
|
34
|
-
export declare function createProjection<T extends object>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue
|
|
35
|
-
deferStream?: boolean;
|
|
36
|
-
ssrSource?: string;
|
|
37
|
-
}): Store<T>;
|
|
54
|
+
export declare function createProjection<T extends object>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue: Partial<T>, options?: ServerSsrOptions): Store<T>;
|
|
38
55
|
export declare function reconcile<T extends U, U extends object>(value: T): (state: U) => T;
|
|
39
56
|
export declare function deep<T extends object>(store: Store<T>): Store<T>;
|
|
40
57
|
export declare function mapArray<T, U>(list: Accessor<readonly T[] | undefined | null | false>, mapFn: (v: Accessor<T>, i: Accessor<number>) => U, options?: {
|
|
@@ -53,8 +70,9 @@ export declare function createErrorBoundary<U>(fn: () => any, fallback: (error:
|
|
|
53
70
|
export declare function createLoadingBoundary(fn: () => any, fallback: () => any, options?: {
|
|
54
71
|
on?: () => any;
|
|
55
72
|
}): () => unknown;
|
|
73
|
+
export type RevealOrder = "sequential" | "together" | "natural";
|
|
56
74
|
export declare function createRevealOrder<T>(fn: () => T, _options?: {
|
|
57
|
-
|
|
75
|
+
order?: () => RevealOrder;
|
|
58
76
|
collapsed?: () => boolean;
|
|
59
77
|
}): T;
|
|
60
78
|
export declare function untrack<T>(fn: () => T): T;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { JSX } from "../jsx.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* A general `Component` has no implicit `children` prop. If desired, you can
|
|
4
|
+
* specify one as in `Component<{name: String, children: JSX.Element}>`.
|
|
5
|
+
*/
|
|
6
|
+
export type Component<P extends Record<string, any> = {}> = (props: P) => JSX.Element;
|
|
7
|
+
/**
|
|
8
|
+
* Extend props to forbid the `children` prop.
|
|
9
|
+
* Use this to prevent accidentally passing `children` to components that
|
|
10
|
+
* would silently throw them away.
|
|
11
|
+
*/
|
|
12
|
+
export type VoidProps<P extends Record<string, any> = {}> = P & {
|
|
13
|
+
children?: never;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* `VoidComponent` forbids the `children` prop.
|
|
17
|
+
* Use this to prevent accidentally passing `children` to components that
|
|
18
|
+
* would silently throw them away.
|
|
19
|
+
*/
|
|
20
|
+
export type VoidComponent<P extends Record<string, any> = {}> = Component<VoidProps<P>>;
|
|
21
|
+
/**
|
|
22
|
+
* Extend props to allow an optional `children` prop with the usual
|
|
23
|
+
* type in JSX, `JSX.Element` (which allows elements, arrays, strings, etc.).
|
|
24
|
+
* Use this for components that you want to accept children.
|
|
25
|
+
*/
|
|
26
|
+
export type ParentProps<P extends Record<string, any> = {}> = P & {
|
|
27
|
+
children?: JSX.Element;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* `ParentComponent` allows an optional `children` prop with the usual
|
|
31
|
+
* type in JSX, `JSX.Element` (which allows elements, arrays, strings, etc.).
|
|
32
|
+
* Use this for components that you want to accept children.
|
|
33
|
+
*/
|
|
34
|
+
export type ParentComponent<P extends Record<string, any> = {}> = Component<ParentProps<P>>;
|
|
35
|
+
/**
|
|
36
|
+
* Extend props to require a `children` prop with the specified type.
|
|
37
|
+
* Use this for components where you need a specific child type,
|
|
38
|
+
* typically a function that receives specific argument types.
|
|
39
|
+
* Note that all JSX <Elements> are of the type `JSX.Element`.
|
|
40
|
+
*/
|
|
41
|
+
export type FlowProps<P extends Record<string, any> = {}, C = JSX.Element> = P & {
|
|
42
|
+
children: C;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* `FlowComponent` requires a `children` prop with the specified type.
|
|
46
|
+
* Use this for components where you need a specific child type,
|
|
47
|
+
* typically a function that receives specific argument types.
|
|
48
|
+
* Note that all JSX <Elements> are of the type `JSX.Element`.
|
|
49
|
+
*/
|
|
50
|
+
export type FlowComponent<P extends Record<string, any> = {}, C = JSX.Element> = Component<FlowProps<P, C>>;
|
|
51
|
+
export type ValidComponent = keyof JSX.IntrinsicElements | Component<any> | (string & {});
|
|
52
|
+
/**
|
|
53
|
+
* Takes the props of the passed component and returns its type
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ComponentProps<typeof Portal> // { mount?: Node; useShadow?: boolean; children: JSX.Element }
|
|
57
|
+
* ComponentProps<'div'> // JSX.HTMLAttributes<HTMLDivElement>
|
|
58
|
+
*/
|
|
59
|
+
export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
|
|
60
|
+
/**
|
|
61
|
+
* Type of `props.ref`, for use in `Component` or `props` typing.
|
|
62
|
+
*
|
|
63
|
+
* @example Component<{ref: Ref<Element>}>
|
|
64
|
+
*/
|
|
65
|
+
export type Ref<T> = T | ((val: T) => void);
|
|
66
|
+
export declare function createComponent<T extends Record<string, any>>(Comp: Component<T>, props: T): JSX.Element;
|
|
67
|
+
export declare function lazy<T extends Component<any>>(fn: () => Promise<{
|
|
68
|
+
default: T;
|
|
69
|
+
}>, moduleUrl?: string): T & {
|
|
70
|
+
preload: () => Promise<{
|
|
71
|
+
default: T;
|
|
72
|
+
}>;
|
|
73
|
+
moduleUrl?: string;
|
|
74
|
+
};
|
|
75
|
+
export declare function createUniqueId(): string;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Accessor, EffectOptions } from "@solidjs/signals";
|
|
2
|
+
import type { JSX } from "../jsx.cjs";
|
|
3
|
+
import { FlowComponent } from "./component.cjs";
|
|
4
|
+
export declare const IS_DEV: string | boolean;
|
|
5
|
+
export declare const $DEVCOMP: unique symbol;
|
|
6
|
+
export type NoInfer<T extends any> = [T][T extends any ? 0 : never];
|
|
7
|
+
export type ContextProviderComponent<T> = FlowComponent<{
|
|
8
|
+
value: T;
|
|
9
|
+
}>;
|
|
10
|
+
export interface Context<T> extends ContextProviderComponent<T> {
|
|
11
|
+
id: symbol;
|
|
12
|
+
defaultValue: T;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Creates a Context to handle a state scoped for the children of a component
|
|
16
|
+
* ```typescript
|
|
17
|
+
* interface Context<T> {
|
|
18
|
+
* id: symbol;
|
|
19
|
+
* Provider: FlowComponent<{ value: T }>;
|
|
20
|
+
* defaultValue: T;
|
|
21
|
+
* }
|
|
22
|
+
* export function createContext<T>(
|
|
23
|
+
* defaultValue?: T,
|
|
24
|
+
* options?: { name?: string }
|
|
25
|
+
* ): Context<T | undefined>;
|
|
26
|
+
* ```
|
|
27
|
+
* @param defaultValue optional default to inject into context
|
|
28
|
+
* @param options allows to set a name in dev mode for debugging purposes
|
|
29
|
+
* @returns The context that contains the Provider Component and that can be used with `useContext`
|
|
30
|
+
*
|
|
31
|
+
* @description https://docs.solidjs.com/reference/component-apis/create-context
|
|
32
|
+
*/
|
|
33
|
+
export declare function createContext<T>(defaultValue?: undefined, options?: EffectOptions): Context<T | undefined>;
|
|
34
|
+
export declare function createContext<T>(defaultValue: T, options?: EffectOptions): Context<T>;
|
|
35
|
+
/**
|
|
36
|
+
* Uses a context to receive a scoped state from a parent's Context.Provider
|
|
37
|
+
*
|
|
38
|
+
* @param context Context object made by `createContext`
|
|
39
|
+
* @returns the current or `defaultValue`, if present
|
|
40
|
+
*
|
|
41
|
+
* @description https://docs.solidjs.com/reference/component-apis/use-context
|
|
42
|
+
*/
|
|
43
|
+
export declare function useContext<T>(context: Context<T>): T;
|
|
44
|
+
export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement>;
|
|
45
|
+
export type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[];
|
|
46
|
+
export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
47
|
+
toArray: () => ResolvedJSXElement[];
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Resolves child elements to help interact with children
|
|
51
|
+
*
|
|
52
|
+
* @param fn an accessor for the children
|
|
53
|
+
* @returns a accessor of the same children, but resolved
|
|
54
|
+
*
|
|
55
|
+
* @description https://docs.solidjs.com/reference/component-apis/children
|
|
56
|
+
*/
|
|
57
|
+
export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn;
|
|
58
|
+
export declare function devComponent<P, V>(Comp: (props: P) => V, props: P): V;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import type { Accessor, RevealOrder } from "@solidjs/signals";
|
|
2
|
+
export type { RevealOrder };
|
|
3
|
+
import type { JSX } from "../jsx.cjs";
|
|
4
|
+
type NonZeroParams<T extends (...args: any[]) => any> = Parameters<T>["length"] extends 0 ? never : T;
|
|
5
|
+
type ConditionalRenderCallback<T> = (item: Accessor<NonNullable<T>>) => JSX.Element;
|
|
6
|
+
type ConditionalRenderChildren<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = JSX.Element | NonZeroParams<F>;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a list of elements from a list
|
|
9
|
+
*
|
|
10
|
+
* it receives a map function as its child that receives list element and index accessors and returns a JSX-Element; if the list is empty, an optional fallback is returned:
|
|
11
|
+
* ```typescript
|
|
12
|
+
* <For each={items} fallback={<div>No items</div>}>
|
|
13
|
+
* {(item, index) => <div data-index={index()}>{item()}</div>}
|
|
14
|
+
* </For>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @description https://docs.solidjs.com/reference/components/for
|
|
18
|
+
*/
|
|
19
|
+
export declare function For<T extends readonly any[], U extends JSX.Element>(props: {
|
|
20
|
+
each: T | undefined | null | false;
|
|
21
|
+
fallback?: JSX.Element;
|
|
22
|
+
keyed?: boolean | ((item: T[number]) => any);
|
|
23
|
+
children: (item: Accessor<T[number]>, index: Accessor<number>) => U;
|
|
24
|
+
}): JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a list elements from a count
|
|
27
|
+
*
|
|
28
|
+
* it receives a map function as its child that receives the index and returns a JSX-Element; if the list is empty, an optional fallback is returned:
|
|
29
|
+
* ```typescript
|
|
30
|
+
* <Repeat count={items.length} fallback={<div>No items</div>}>
|
|
31
|
+
* {(index) => <div data-index={index}>{items[index]}</div>}
|
|
32
|
+
* </Repeat>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @description https://docs.solidjs.com/reference/components/repeat
|
|
36
|
+
*/
|
|
37
|
+
export declare function Repeat<T extends JSX.Element>(props: {
|
|
38
|
+
count: number;
|
|
39
|
+
from?: number | undefined;
|
|
40
|
+
fallback?: JSX.Element;
|
|
41
|
+
children: ((index: number) => T) | T;
|
|
42
|
+
}): JSX.Element;
|
|
43
|
+
/**
|
|
44
|
+
* Conditionally render its children or an optional fallback component
|
|
45
|
+
* @description https://docs.solidjs.com/reference/components/show
|
|
46
|
+
*/
|
|
47
|
+
export declare function Show<T, F extends ConditionalRenderCallback<T>>(props: {
|
|
48
|
+
when: T | undefined | null | false;
|
|
49
|
+
keyed?: boolean;
|
|
50
|
+
fallback?: JSX.Element;
|
|
51
|
+
children: ConditionalRenderChildren<T, F>;
|
|
52
|
+
}): JSX.Element;
|
|
53
|
+
/**
|
|
54
|
+
* Switches between content based on mutually exclusive conditions
|
|
55
|
+
* ```typescript
|
|
56
|
+
* <Switch fallback={<FourOhFour />}>
|
|
57
|
+
* <Match when={state.route === 'home'}>
|
|
58
|
+
* <Home />
|
|
59
|
+
* </Match>
|
|
60
|
+
* <Match when={state.route === 'settings'}>
|
|
61
|
+
* <Settings />
|
|
62
|
+
* </Match>
|
|
63
|
+
* </Switch>
|
|
64
|
+
* ```
|
|
65
|
+
* @description https://docs.solidjs.com/reference/components/switch-and-match
|
|
66
|
+
*/
|
|
67
|
+
export declare function Switch(props: {
|
|
68
|
+
fallback?: JSX.Element;
|
|
69
|
+
children: JSX.Element;
|
|
70
|
+
}): JSX.Element;
|
|
71
|
+
export type MatchProps<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = {
|
|
72
|
+
when: T | undefined | null | false;
|
|
73
|
+
keyed?: boolean;
|
|
74
|
+
children: ConditionalRenderChildren<T, F>;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Selects a content based on condition when inside a `<Switch>` control flow
|
|
78
|
+
* ```typescript
|
|
79
|
+
* <Match when={condition()}>
|
|
80
|
+
* <Content/>
|
|
81
|
+
* </Match>
|
|
82
|
+
* ```
|
|
83
|
+
* @description https://docs.solidjs.com/reference/components/switch-and-match
|
|
84
|
+
*/
|
|
85
|
+
export declare function Match<T, F extends ConditionalRenderCallback<T>>(props: MatchProps<T, F>): JSX.Element;
|
|
86
|
+
/**
|
|
87
|
+
* Catches uncaught errors inside components and renders a fallback content
|
|
88
|
+
*
|
|
89
|
+
* Also supports a callback form that passes the error and a reset function:
|
|
90
|
+
* ```typescript
|
|
91
|
+
* <Errored fallback={
|
|
92
|
+
* (err, reset) => <div onClick={reset}>Error: {err.toString()}</div>
|
|
93
|
+
* }>
|
|
94
|
+
* <MyComp />
|
|
95
|
+
* </Errored>
|
|
96
|
+
* ```
|
|
97
|
+
* Errors thrown from the fallback can be caught by a parent Errored
|
|
98
|
+
*
|
|
99
|
+
* @description https://docs.solidjs.com/reference/components/error-boundary
|
|
100
|
+
*/
|
|
101
|
+
export declare function Errored(props: {
|
|
102
|
+
fallback: JSX.Element | ((err: any, reset: () => void) => JSX.Element);
|
|
103
|
+
children: JSX.Element;
|
|
104
|
+
}): JSX.Element;
|
|
105
|
+
/**
|
|
106
|
+
* Tracks all resources inside a component and renders a fallback until they are all resolved
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const AsyncComponent = lazy(() => import('./component'));
|
|
109
|
+
*
|
|
110
|
+
* <Loading fallback={<LoadingIndicator />}>
|
|
111
|
+
* <AsyncComponent />
|
|
112
|
+
* </Loading>
|
|
113
|
+
* ```
|
|
114
|
+
* @description https://docs.solidjs.com/reference/components/suspense
|
|
115
|
+
*/
|
|
116
|
+
export declare function Loading(props: {
|
|
117
|
+
fallback?: JSX.Element;
|
|
118
|
+
on?: any;
|
|
119
|
+
children: JSX.Element;
|
|
120
|
+
}): JSX.Element;
|
|
121
|
+
export type RevealProps = {
|
|
122
|
+
order?: RevealOrder;
|
|
123
|
+
collapsed?: boolean;
|
|
124
|
+
children: JSX.Element;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Coordinates the reveal timing of sibling `<Loading>` boundaries.
|
|
128
|
+
*
|
|
129
|
+
* The `order` prop picks the reveal policy:
|
|
130
|
+
* - `"sequential"` (default) — boundaries reveal in registration order; later boundaries
|
|
131
|
+
* stay on their fallback until earlier ones resolve.
|
|
132
|
+
* - `"together"` — every direct slot stays on its fallback until the whole group is
|
|
133
|
+
* "minimally ready" (every direct slot has its own first visible content available),
|
|
134
|
+
* then the group releases in one cohesive reveal.
|
|
135
|
+
* - `"natural"` — each boundary reveals as its own data resolves. At the top level
|
|
136
|
+
* this is equivalent to omitting `<Reveal>`; the mode exists for nesting, where
|
|
137
|
+
* the group registers as a single composite slot in an enclosing `<Reveal>`.
|
|
138
|
+
*
|
|
139
|
+
* The `collapsed` prop is only consulted when `order="sequential"` (the default);
|
|
140
|
+
* it is ignored under `"together"` and `"natural"`. When set, tail boundaries past
|
|
141
|
+
* the frontier suppress their own fallback output.
|
|
142
|
+
*
|
|
143
|
+
* Nested `<Reveal>` groups compose: the inner group is one slot in the outer order
|
|
144
|
+
* and is held on its fallbacks until the outer releases the slot. Once released, the
|
|
145
|
+
* inner group runs its own `order` locally over whatever is still pending. There is
|
|
146
|
+
* no escape hatch — nesting under an outer group means participating in its ordering.
|
|
147
|
+
* See `documentation/solid-2.0/03-control-flow.md` for the full nesting matrix and the
|
|
148
|
+
* "minimally ready" definition per order.
|
|
149
|
+
*
|
|
150
|
+
* ```typescript
|
|
151
|
+
* <Reveal order="sequential">
|
|
152
|
+
* <Loading fallback={<Skeleton />}><ProfileHeader /></Loading>
|
|
153
|
+
* <Reveal order="natural">
|
|
154
|
+
* <Loading fallback={<Skeleton />}><PostA /></Loading>
|
|
155
|
+
* <Loading fallback={<Skeleton />}><PostB /></Loading>
|
|
156
|
+
* </Reveal>
|
|
157
|
+
* <Loading fallback={<Skeleton />}><Comments /></Loading>
|
|
158
|
+
* </Reveal>
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* @description https://docs.solidjs.com/reference/components/reveal
|
|
162
|
+
*/
|
|
163
|
+
export declare function Reveal(props: RevealProps): JSX.Element;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { createErrorBoundary as coreErrorBoundary, createRenderEffect as coreRenderEffect, createEffect as coreEffect, $REFRESH, type Accessor, type ComputeFunction, type MemoOptions, type NoInfer, type ProjectionOptions, type Signal, type SignalOptions, type Store, type StoreSetter, type Context } from "@solidjs/signals";
|
|
2
|
+
import { JSX } from "../jsx.cjs";
|
|
3
|
+
type HydrationSsrFields = {
|
|
4
|
+
deferStream?: boolean;
|
|
5
|
+
ssrSource?: "server" | "hybrid" | "client";
|
|
6
|
+
};
|
|
7
|
+
declare module "@solidjs/signals" {
|
|
8
|
+
interface MemoOptions<T> extends HydrationSsrFields {
|
|
9
|
+
}
|
|
10
|
+
interface SignalOptions<T> extends HydrationSsrFields {
|
|
11
|
+
}
|
|
12
|
+
interface EffectOptions extends HydrationSsrFields {
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export type HydrationProjectionOptions = ProjectionOptions & {
|
|
16
|
+
ssrSource?: "server" | "hybrid" | "client";
|
|
17
|
+
};
|
|
18
|
+
type HydrationClientMemoOptions<T> = Omit<MemoOptions<T>, "ssrSource"> & {
|
|
19
|
+
ssrSource: "client";
|
|
20
|
+
};
|
|
21
|
+
type HydrationMemoOptions<T> = Omit<MemoOptions<T>, "ssrSource"> & {
|
|
22
|
+
ssrSource?: "server" | "hybrid";
|
|
23
|
+
};
|
|
24
|
+
type HydrationClientSignalOptions<T> = Omit<SignalOptions<T> & MemoOptions<T>, "ssrSource"> & {
|
|
25
|
+
ssrSource: "client";
|
|
26
|
+
};
|
|
27
|
+
type HydrationSignalOptions<T> = Omit<SignalOptions<T> & MemoOptions<T>, "ssrSource"> & {
|
|
28
|
+
ssrSource?: "server" | "hybrid";
|
|
29
|
+
};
|
|
30
|
+
export type HydrationContext = {};
|
|
31
|
+
export declare const NoHydrateContext: Context<boolean>;
|
|
32
|
+
type SharedConfig = {
|
|
33
|
+
hydrating: boolean;
|
|
34
|
+
resources?: {
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
};
|
|
37
|
+
load?: (id: string) => Promise<any> | any;
|
|
38
|
+
has?: (id: string) => boolean;
|
|
39
|
+
gather?: (key: string) => void;
|
|
40
|
+
cleanupFragment?: (id: string) => void;
|
|
41
|
+
loadModuleAssets?: (mapping: Record<string, string>) => Promise<void> | undefined;
|
|
42
|
+
registry?: Map<string, Element>;
|
|
43
|
+
completed?: WeakSet<Element> | null;
|
|
44
|
+
events?: any[] | null;
|
|
45
|
+
verifyHydration?: () => void;
|
|
46
|
+
done: boolean;
|
|
47
|
+
getNextContextId(): string;
|
|
48
|
+
};
|
|
49
|
+
export declare const sharedConfig: SharedConfig;
|
|
50
|
+
/**
|
|
51
|
+
* Registers a callback to run once when all hydration completes
|
|
52
|
+
* (all boundaries hydrated or cancelled). If hydration is already
|
|
53
|
+
* complete (or not hydrating), fires via queueMicrotask.
|
|
54
|
+
*/
|
|
55
|
+
export declare function onHydrationEnd(callback: () => void): void;
|
|
56
|
+
export declare function enableHydration(): void;
|
|
57
|
+
export declare const createMemo: {
|
|
58
|
+
<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options: HydrationClientMemoOptions<T>): Accessor<T | undefined>;
|
|
59
|
+
<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options?: HydrationMemoOptions<T>): Accessor<T>;
|
|
60
|
+
};
|
|
61
|
+
export declare const createSignal: {
|
|
62
|
+
<T>(): Signal<T | undefined>;
|
|
63
|
+
<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>;
|
|
64
|
+
<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options: HydrationClientSignalOptions<T>): Signal<T | undefined>;
|
|
65
|
+
<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options?: HydrationSignalOptions<T>): Signal<T>;
|
|
66
|
+
};
|
|
67
|
+
export declare const createErrorBoundary: typeof coreErrorBoundary;
|
|
68
|
+
export declare const createOptimistic: {
|
|
69
|
+
<T>(): Signal<T | undefined>;
|
|
70
|
+
<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>;
|
|
71
|
+
<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options: HydrationClientSignalOptions<T>): Signal<T | undefined>;
|
|
72
|
+
<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options?: HydrationSignalOptions<T>): Signal<T>;
|
|
73
|
+
};
|
|
74
|
+
export declare const createProjection: <T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue: T, options?: HydrationProjectionOptions) => Store<T> & {
|
|
75
|
+
[$REFRESH]: any;
|
|
76
|
+
};
|
|
77
|
+
type NoFn<T> = T extends Function ? never : T;
|
|
78
|
+
export declare const createStore: {
|
|
79
|
+
<T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): [get: Store<T>, set: StoreSetter<T>];
|
|
80
|
+
<T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store: NoFn<T> | Store<NoFn<T>>, options?: HydrationProjectionOptions): [get: Store<T> & {
|
|
81
|
+
[$REFRESH]: any;
|
|
82
|
+
}, set: StoreSetter<T>];
|
|
83
|
+
};
|
|
84
|
+
export declare const createOptimisticStore: {
|
|
85
|
+
<T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): [get: Store<T>, set: StoreSetter<T>];
|
|
86
|
+
<T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store: NoFn<T> | Store<NoFn<T>>, options?: HydrationProjectionOptions): [get: Store<T> & {
|
|
87
|
+
[$REFRESH]: any;
|
|
88
|
+
}, set: StoreSetter<T>];
|
|
89
|
+
};
|
|
90
|
+
export declare const createRenderEffect: typeof coreRenderEffect;
|
|
91
|
+
export declare const createEffect: typeof coreEffect;
|
|
92
|
+
/**
|
|
93
|
+
* Tracks all resources inside a component and renders a fallback until they are all resolved
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const AsyncComponent = lazy(() => import('./component'));
|
|
96
|
+
*
|
|
97
|
+
* <Loading fallback={<LoadingIndicator />}>
|
|
98
|
+
* <AsyncComponent />
|
|
99
|
+
* </Loading>
|
|
100
|
+
* ```
|
|
101
|
+
* @description https://docs.solidjs.com/reference/components/suspense
|
|
102
|
+
*/
|
|
103
|
+
export declare function createLoadingBoundary(fn: () => any, fallback: () => any, options?: {
|
|
104
|
+
on?: () => any;
|
|
105
|
+
}): () => unknown;
|
|
106
|
+
/**
|
|
107
|
+
* Disables hydration for its children on the client.
|
|
108
|
+
* During hydration, skips the subtree entirely (returns undefined so DOM is left untouched).
|
|
109
|
+
* After hydration, renders children fresh.
|
|
110
|
+
*/
|
|
111
|
+
export declare function NoHydration(props: {
|
|
112
|
+
children: JSX.Element;
|
|
113
|
+
}): JSX.Element;
|
|
114
|
+
/**
|
|
115
|
+
* Re-enables hydration within a NoHydration zone (passthrough on client).
|
|
116
|
+
*/
|
|
117
|
+
export declare function Hydration(props: {
|
|
118
|
+
id?: string;
|
|
119
|
+
children: JSX.Element;
|
|
120
|
+
}): JSX.Element;
|
|
121
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { $PROXY, $REFRESH, $TRACK, action, createOwner, createReaction, createRevealOrder, createRoot, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isDisposed, isEqual, isRefreshing, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, latest, reconcile, refresh, repeat, resolve, NotReadyError, runWithOwner, enableExternalSource, enforceLoadingBoundary, snapshot, storePath, untrack } from "@solidjs/signals";
|
|
2
|
+
export type { Accessor, ComputeFunction, EffectFunction, EffectOptions, ExternalSource, ExternalSourceConfig, ExternalSourceFactory, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter } from "@solidjs/signals";
|
|
3
|
+
export { $DEVCOMP, children, createContext, useContext } from "./client/core.cjs";
|
|
4
|
+
export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedJSXElement } from "./client/core.cjs";
|
|
5
|
+
export * from "./client/component.cjs";
|
|
6
|
+
export * from "./client/flow.cjs";
|
|
7
|
+
export { sharedConfig, enableHydration, createErrorBoundary, createLoadingBoundary, createMemo, createSignal, createStore, createProjection, createOptimistic, createOptimisticStore, createRenderEffect, createEffect, NoHydration, Hydration, NoHydrateContext } from "./client/hydration.cjs";
|
|
8
|
+
export declare function ssrHandleError(): void;
|
|
9
|
+
export declare function ssrRunInScope(): void;
|
|
10
|
+
import type { JSX } from "./jsx.cjs";
|
|
11
|
+
type JSXElement = JSX.Element;
|
|
12
|
+
export type { JSXElement, JSX };
|
|
13
|
+
import { type Dev } from "@solidjs/signals";
|
|
14
|
+
export declare const DEV: Dev | undefined;
|
|
15
|
+
declare global {
|
|
16
|
+
var Solid$$: boolean;
|
|
17
|
+
}
|