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
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { JSX } from "../jsx.cjs";
|
|
2
|
+
export declare function enableHydration(): void;
|
|
3
|
+
/**
|
|
4
|
+
* A general `Component` has no implicit `children` prop. If desired, you can
|
|
5
|
+
* specify one as in `Component<{name: String, children: JSX.Element}>`.
|
|
6
|
+
*/
|
|
7
|
+
export type Component<P extends Record<string, any> = {}> = (props: P) => JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* Extend props to forbid the `children` prop.
|
|
10
|
+
*/
|
|
11
|
+
export type VoidProps<P extends Record<string, any> = {}> = P & {
|
|
12
|
+
children?: never;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* `VoidComponent` forbids the `children` prop.
|
|
16
|
+
*/
|
|
17
|
+
export type VoidComponent<P extends Record<string, any> = {}> = Component<VoidProps<P>>;
|
|
18
|
+
/**
|
|
19
|
+
* Extend props to allow an optional `children` prop with the usual type in JSX.
|
|
20
|
+
*/
|
|
21
|
+
export type ParentProps<P extends Record<string, any> = {}> = P & {
|
|
22
|
+
children?: JSX.Element;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* `ParentComponent` allows an optional `children` prop with the usual type in JSX.
|
|
26
|
+
*/
|
|
27
|
+
export type ParentComponent<P extends Record<string, any> = {}> = Component<ParentProps<P>>;
|
|
28
|
+
/**
|
|
29
|
+
* Extend props to require a `children` prop with the specified type.
|
|
30
|
+
*/
|
|
31
|
+
export type FlowProps<P extends Record<string, any> = {}, C = JSX.Element> = P & {
|
|
32
|
+
children: C;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* `FlowComponent` requires a `children` prop with the specified type.
|
|
36
|
+
*/
|
|
37
|
+
export type FlowComponent<P extends Record<string, any> = {}, C = JSX.Element> = Component<FlowProps<P, C>>;
|
|
38
|
+
export type ValidComponent = keyof JSX.IntrinsicElements | Component<any> | (string & {});
|
|
39
|
+
/**
|
|
40
|
+
* Takes the props of the passed component and returns its type
|
|
41
|
+
*/
|
|
42
|
+
export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
|
|
43
|
+
/**
|
|
44
|
+
* Type of `props.ref`, for use in `Component` or `props` typing.
|
|
45
|
+
*/
|
|
46
|
+
export type Ref<T> = T | ((val: T) => void);
|
|
47
|
+
/**
|
|
48
|
+
* Creates a component. On server, just calls the function directly (no untrack needed).
|
|
49
|
+
*/
|
|
50
|
+
export declare function createComponent<T extends Record<string, any>>(Comp: Component<T>, props: T): JSX.Element;
|
|
51
|
+
/**
|
|
52
|
+
* Lazy load a function component asynchronously.
|
|
53
|
+
* On server, returns a createMemo that throws NotReadyError until the module resolves,
|
|
54
|
+
* allowing resolveSSRNode to capture it as a fine-grained hole. The memo naturally
|
|
55
|
+
* scopes the owner so hydration IDs align with the client's createMemo in lazy().
|
|
56
|
+
* Requires `moduleUrl` for SSR — the bundler plugin injects the module specifier
|
|
57
|
+
* so the server can look up client chunk URLs from the asset manifest.
|
|
58
|
+
*/
|
|
59
|
+
export declare function lazy<T extends Component<any>>(fn: () => Promise<{
|
|
60
|
+
default: T;
|
|
61
|
+
}>, moduleUrl?: string): T & {
|
|
62
|
+
preload: () => Promise<{
|
|
63
|
+
default: T;
|
|
64
|
+
}>;
|
|
65
|
+
moduleUrl?: string;
|
|
66
|
+
};
|
|
67
|
+
export declare function createUniqueId(): string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Accessor, EffectOptions } from "./signals.cjs";
|
|
2
|
+
import type { JSX } from "../jsx.cjs";
|
|
3
|
+
import type { FlowComponent } from "./component.cjs";
|
|
4
|
+
export declare const $DEVCOMP: unique symbol;
|
|
5
|
+
export type NoInfer<T extends any> = [T][T extends any ? 0 : never];
|
|
6
|
+
export type ContextProviderComponent<T> = FlowComponent<{
|
|
7
|
+
value: T;
|
|
8
|
+
}>;
|
|
9
|
+
export interface Context<T> extends ContextProviderComponent<T> {
|
|
10
|
+
id: symbol;
|
|
11
|
+
defaultValue: T;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a Context to handle a state scoped for the children of a component
|
|
15
|
+
* @param defaultValue optional default to inject into context
|
|
16
|
+
* @param options allows to set a name in dev mode for debugging purposes
|
|
17
|
+
* @returns The context that contains the Provider Component and that can be used with `useContext`
|
|
18
|
+
*/
|
|
19
|
+
export declare function createContext<T>(defaultValue?: undefined, options?: EffectOptions): Context<T | undefined>;
|
|
20
|
+
export declare function createContext<T>(defaultValue: T, options?: EffectOptions): Context<T>;
|
|
21
|
+
/**
|
|
22
|
+
* Uses a context to receive a scoped state from a parent's Context.Provider
|
|
23
|
+
* @param context Context object made by `createContext`
|
|
24
|
+
* @returns the current or `defaultValue`, if present
|
|
25
|
+
*/
|
|
26
|
+
export declare function useContext<T>(context: Context<T>): T;
|
|
27
|
+
export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement>;
|
|
28
|
+
export type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[];
|
|
29
|
+
export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
30
|
+
toArray: () => ResolvedJSXElement[];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Resolves child elements to help interact with children
|
|
34
|
+
* @param fn an accessor for the children
|
|
35
|
+
* @returns a accessor of the same children, but resolved
|
|
36
|
+
*/
|
|
37
|
+
export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn;
|
|
38
|
+
/**
|
|
39
|
+
* Pass-through for SSR dynamic expressions.
|
|
40
|
+
* On the client, insert() render effects are transparent (0 owner slots),
|
|
41
|
+
* so the server doesn't need to create owners for these either.
|
|
42
|
+
*/
|
|
43
|
+
export declare function ssrRunInScope(fn: () => any): () => any;
|
|
44
|
+
export declare function ssrRunInScope(array: (() => any)[]): (() => any)[];
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { Accessor, RevealOrder } from "./signals.cjs";
|
|
2
|
+
import type { JSX } from "../jsx.cjs";
|
|
3
|
+
export type { RevealOrder };
|
|
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
|
+
* @description https://docs.solidjs.com/reference/components/for
|
|
11
|
+
*/
|
|
12
|
+
export declare function For<T extends readonly any[], U extends JSX.Element>(props: {
|
|
13
|
+
each: T | undefined | null | false;
|
|
14
|
+
fallback?: JSX.Element;
|
|
15
|
+
keyed?: boolean | ((item: T[number]) => any);
|
|
16
|
+
children: (item: Accessor<T[number]>, index: Accessor<number>) => U;
|
|
17
|
+
}): JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a list elements from a count
|
|
20
|
+
*
|
|
21
|
+
* @description https://docs.solidjs.com/reference/components/repeat
|
|
22
|
+
*/
|
|
23
|
+
export declare function Repeat<T extends JSX.Element>(props: {
|
|
24
|
+
count: number;
|
|
25
|
+
from?: number | undefined;
|
|
26
|
+
fallback?: JSX.Element;
|
|
27
|
+
children: ((index: number) => T) | T;
|
|
28
|
+
}): JSX.Element;
|
|
29
|
+
/**
|
|
30
|
+
* Conditionally render its children or an optional fallback component
|
|
31
|
+
* @description https://docs.solidjs.com/reference/components/show
|
|
32
|
+
*/
|
|
33
|
+
export declare function Show<T, F extends ConditionalRenderCallback<T>>(props: {
|
|
34
|
+
when: T | undefined | null | false;
|
|
35
|
+
keyed?: boolean;
|
|
36
|
+
fallback?: JSX.Element;
|
|
37
|
+
children: ConditionalRenderChildren<T, F>;
|
|
38
|
+
}): JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* Switches between content based on mutually exclusive conditions
|
|
41
|
+
* @description https://docs.solidjs.com/reference/components/switch-and-match
|
|
42
|
+
*/
|
|
43
|
+
export declare function Switch(props: {
|
|
44
|
+
fallback?: JSX.Element;
|
|
45
|
+
children: JSX.Element;
|
|
46
|
+
}): JSX.Element;
|
|
47
|
+
export type MatchProps<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = {
|
|
48
|
+
when: T | undefined | null | false;
|
|
49
|
+
keyed?: boolean;
|
|
50
|
+
children: ConditionalRenderChildren<T, F>;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Selects a content based on condition when inside a `<Switch>` control flow
|
|
54
|
+
* @description https://docs.solidjs.com/reference/components/switch-and-match
|
|
55
|
+
*/
|
|
56
|
+
export declare function Match<T, F extends ConditionalRenderCallback<T>>(props: MatchProps<T, F>): JSX.Element;
|
|
57
|
+
/**
|
|
58
|
+
* Catches uncaught errors inside components and renders a fallback content
|
|
59
|
+
* @description https://docs.solidjs.com/reference/components/error-boundary
|
|
60
|
+
*/
|
|
61
|
+
export declare function Errored(props: {
|
|
62
|
+
fallback: JSX.Element | ((err: any, reset: () => void) => JSX.Element);
|
|
63
|
+
children: JSX.Element;
|
|
64
|
+
}): JSX.Element;
|
|
65
|
+
/**
|
|
66
|
+
* Tracks all resources inside a component and renders a fallback until they are all resolved
|
|
67
|
+
* @description https://docs.solidjs.com/reference/components/suspense
|
|
68
|
+
*/
|
|
69
|
+
export declare function Loading(props: {
|
|
70
|
+
fallback?: JSX.Element;
|
|
71
|
+
on?: any;
|
|
72
|
+
children: JSX.Element;
|
|
73
|
+
}): JSX.Element;
|
|
74
|
+
export type RevealProps = {
|
|
75
|
+
order?: RevealOrder;
|
|
76
|
+
collapsed?: boolean;
|
|
77
|
+
children: JSX.Element;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
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
|
+
*
|
|
113
|
+
* @description https://docs.solidjs.com/reference/components/reveal
|
|
114
|
+
*/
|
|
115
|
+
export declare function Reveal(props: RevealProps): JSX.Element;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Context } from "./signals.cjs";
|
|
2
|
+
import type { JSX } from "../jsx.cjs";
|
|
3
|
+
export { sharedConfig, NoHydrateContext } from "./shared.cjs";
|
|
4
|
+
export type { HydrationContext, SSRTemplateObject } from "./shared.cjs";
|
|
5
|
+
export type ServerRevealGroup = {
|
|
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
|
+
*/
|
|
13
|
+
register(key: string, options?: {
|
|
14
|
+
onActivate?: () => void;
|
|
15
|
+
}): {
|
|
16
|
+
collapseFallback: boolean;
|
|
17
|
+
held: boolean;
|
|
18
|
+
};
|
|
19
|
+
/** Called by a child when its subtree is fully resolved. */
|
|
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;
|
|
28
|
+
};
|
|
29
|
+
export declare const RevealGroupContext: Context<ServerRevealGroup | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Handles errors during SSR rendering.
|
|
32
|
+
* Returns the promise source for NotReadyError (for async handling),
|
|
33
|
+
* or delegates to the ErrorContext handler.
|
|
34
|
+
*/
|
|
35
|
+
export declare function ssrHandleError(err: any): Promise<any> | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Tracks all resources inside a component and renders a fallback until they are all resolved
|
|
38
|
+
*
|
|
39
|
+
* On the server, this is SSR-aware: it handles async mode (streaming) by registering
|
|
40
|
+
* fragments and resolving asynchronously, and sync mode by serializing fallback markers.
|
|
41
|
+
*
|
|
42
|
+
* @description https://docs.solidjs.com/reference/components/suspense
|
|
43
|
+
*/
|
|
44
|
+
export declare function createLoadingBoundary(fn: () => any, fallback: () => any, options?: {
|
|
45
|
+
on?: () => any;
|
|
46
|
+
}): () => unknown;
|
|
47
|
+
/**
|
|
48
|
+
* Disables hydration for its children during SSR.
|
|
49
|
+
* Elements inside will not receive hydration keys (`_hk`) and signals will not be serialized.
|
|
50
|
+
* Use `Hydration` to re-enable hydration within a `NoHydration` zone.
|
|
51
|
+
*/
|
|
52
|
+
export declare function NoHydration(props: {
|
|
53
|
+
children: JSX.Element;
|
|
54
|
+
}): JSX.Element;
|
|
55
|
+
/**
|
|
56
|
+
* Re-enables hydration within a `NoHydration` zone, establishing a new ID namespace.
|
|
57
|
+
* Pass an `id` prop matching the client's `hydrate({ renderId })` to align hydration keys.
|
|
58
|
+
* Has no effect when not inside a `NoHydration` zone (passthrough).
|
|
59
|
+
*/
|
|
60
|
+
export declare function Hydration(props: {
|
|
61
|
+
id?: string;
|
|
62
|
+
children: JSX.Element;
|
|
63
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { $PROXY, $REFRESH, $TRACK, action, createEffect, createMemo, createOptimistic, createOptimisticStore, createErrorBoundary, createOwner, createProjection, createReaction, createRenderEffect, createRevealOrder, createRoot, createSignal, createStore, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isDisposed, isEqual, isRefreshing, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, latest, reconcile, refresh, repeat, resolve, NotReadyError, runWithOwner, snapshot, storePath, createDeepProxy, enableExternalSource, enforceLoadingBoundary, untrack } from "./signals.cjs";
|
|
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, PatchOp } from "./signals.cjs";
|
|
3
|
+
export { $DEVCOMP, children, createContext, useContext, ssrRunInScope } from "./core.cjs";
|
|
4
|
+
export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedJSXElement } from "./core.cjs";
|
|
5
|
+
export * from "./component.cjs";
|
|
6
|
+
export * from "./flow.cjs";
|
|
7
|
+
export { sharedConfig, createLoadingBoundary, ssrHandleError, NoHydration, Hydration, NoHydrateContext } from "./hydration.cjs";
|
|
8
|
+
export type { HydrationContext } from "./hydration.cjs";
|
|
9
|
+
import type { JSX } from "../jsx.cjs";
|
|
10
|
+
type JSXElement = JSX.Element;
|
|
11
|
+
export type { JSXElement, JSX };
|
|
12
|
+
export declare const DEV: undefined;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Context } from "@solidjs/signals";
|
|
2
|
+
export type SSRTemplateObject = {
|
|
3
|
+
t: string[];
|
|
4
|
+
h: Function[];
|
|
5
|
+
p: Promise<any>[];
|
|
6
|
+
};
|
|
7
|
+
export type HydrationContext = {
|
|
8
|
+
id: string;
|
|
9
|
+
count: number;
|
|
10
|
+
/**
|
|
11
|
+
* Serialize a value for client hydration.
|
|
12
|
+
* In renderToStream (async: true), accepts promises and async iterables.
|
|
13
|
+
* In renderToString (async: false), only synchronous values are allowed —
|
|
14
|
+
* passing async values will throw.
|
|
15
|
+
*/
|
|
16
|
+
serialize: (id: string, v: any, deferStream?: boolean) => void;
|
|
17
|
+
resolve(value: any): SSRTemplateObject;
|
|
18
|
+
ssr(template: string[], ...values: any[]): SSRTemplateObject;
|
|
19
|
+
escape(value: any): string;
|
|
20
|
+
replace: (id: string, replacement: () => any) => void;
|
|
21
|
+
block: (p: Promise<any>) => void;
|
|
22
|
+
registerFragment: (v: string, options?: {
|
|
23
|
+
revealGroup?: string;
|
|
24
|
+
}) => (v?: string, err?: any) => boolean;
|
|
25
|
+
revealFragments?: (groupOrKeys: string | string[]) => void;
|
|
26
|
+
revealFallbacks?: (groupOrKeys: string | string[]) => void;
|
|
27
|
+
/** Register a client-side asset URL discovered during SSR (e.g. from lazy()). */
|
|
28
|
+
registerAsset?: (type: "module" | "style", url: string) => void;
|
|
29
|
+
/** Register a moduleUrl-to-entryUrl mapping for the current boundary. */
|
|
30
|
+
registerModule?: (moduleUrl: string, entryUrl: string) => void;
|
|
31
|
+
/** Resolve a module's JS and CSS assets from the asset manifest. Set by dom-expressions. */
|
|
32
|
+
resolveAssets?: (moduleUrl: string) => {
|
|
33
|
+
js: string[];
|
|
34
|
+
css: string[];
|
|
35
|
+
} | null;
|
|
36
|
+
/** Retrieve the moduleUrl-to-entryUrl map for a boundary. */
|
|
37
|
+
getBoundaryModules?: (id: string) => Record<string, string> | null;
|
|
38
|
+
/** @internal Tracks which Loading boundary is currently rendering. Set by dom-expressions via applyAssetTracking(). */
|
|
39
|
+
_currentBoundaryId?: string | null;
|
|
40
|
+
assets: any[];
|
|
41
|
+
/** True only in renderToStream — enables async data serialization and streaming. */
|
|
42
|
+
async?: boolean;
|
|
43
|
+
};
|
|
44
|
+
export declare const NoHydrateContext: Context<boolean>;
|
|
45
|
+
type SharedConfig = {
|
|
46
|
+
context?: HydrationContext;
|
|
47
|
+
getNextContextId(): string | undefined;
|
|
48
|
+
};
|
|
49
|
+
export declare const sharedConfig: SharedConfig;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export { createRoot, createOwner, runWithOwner, getOwner, isDisposed, onCleanup, getNextChildId, createContext, setContext, getContext, NotReadyError, NoOwnerError, ContextNotFoundError, isEqual, isWrappable, SUPPORTS_PROXY, enableExternalSource, enforceLoadingBoundary } from "@solidjs/signals";
|
|
2
|
+
export { flatten } from "@solidjs/signals";
|
|
3
|
+
export { snapshot, merge, omit, storePath, $PROXY, $REFRESH, $TRACK } from "@solidjs/signals";
|
|
4
|
+
export type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, ExternalSource, ExternalSourceConfig, ExternalSourceFactory, MemoOptions, NoInfer, SignalOptions, Setter, Signal, Owner, Maybe, Store, StoreSetter, StoreNode, NotWrappable, SolidStore, Merge, Omit, Context, ContextRecord, IQueue, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter } from "@solidjs/signals";
|
|
5
|
+
import type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, MemoOptions, SignalOptions, Signal, Owner, Store, StoreSetter, Context } from "@solidjs/signals";
|
|
6
|
+
import { sharedConfig, NoHydrateContext } from "./shared.cjs";
|
|
7
|
+
interface ServerComputation<T = any> {
|
|
8
|
+
owner: Owner;
|
|
9
|
+
value: T;
|
|
10
|
+
compute: ComputeFunction<any, T>;
|
|
11
|
+
error: unknown;
|
|
12
|
+
computed: boolean;
|
|
13
|
+
disposed: boolean;
|
|
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
|
+
};
|
|
32
|
+
export declare function getObserver(): ServerComputation<any> | null;
|
|
33
|
+
export declare function createSignal<T>(): Signal<T | undefined>;
|
|
34
|
+
export declare function createSignal<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>;
|
|
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>;
|
|
39
|
+
export type PatchOp = [path: PropertyKey[]] | [path: PropertyKey[], value: any] | [path: PropertyKey[], value: any, insert: 1];
|
|
40
|
+
export declare function createDeepProxy<T extends object>(target: T, patches: PatchOp[], basePath?: PropertyKey[]): T;
|
|
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;
|
|
46
|
+
export declare function createReaction(effectFn: EffectFunction<undefined> | EffectBundle<undefined>, options?: EffectOptions): (tracking: () => void) => void;
|
|
47
|
+
export declare function createOptimistic<T>(): Signal<T | undefined>;
|
|
48
|
+
export declare function createOptimistic<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>;
|
|
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>];
|
|
53
|
+
export declare const createOptimisticStore: typeof createStore;
|
|
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>;
|
|
55
|
+
export declare function reconcile<T extends U, U extends object>(value: T): (state: U) => T;
|
|
56
|
+
export declare function deep<T extends object>(store: Store<T>): Store<T>;
|
|
57
|
+
export declare function mapArray<T, U>(list: Accessor<readonly T[] | undefined | null | false>, mapFn: (v: Accessor<T>, i: Accessor<number>) => U, options?: {
|
|
58
|
+
keyed?: boolean | ((item: T) => any);
|
|
59
|
+
fallback?: Accessor<any>;
|
|
60
|
+
}): () => U[];
|
|
61
|
+
export declare function repeat<T>(count: Accessor<number>, mapFn: (i: number) => T, options?: {
|
|
62
|
+
fallback?: Accessor<any>;
|
|
63
|
+
from?: Accessor<number | undefined>;
|
|
64
|
+
}): () => T[];
|
|
65
|
+
declare const ErrorContext: Context<((err: any) => void) | null>;
|
|
66
|
+
export { ErrorContext };
|
|
67
|
+
export declare function runWithBoundaryErrorContext<T>(owner: Owner, render: () => T, onError: (err: any, parentHandler: ((err: any) => void) | null) => void, context?: NonNullable<typeof sharedConfig.context>, boundaryId?: string): T;
|
|
68
|
+
export { NoHydrateContext };
|
|
69
|
+
export declare function createErrorBoundary<U>(fn: () => any, fallback: (error: unknown, reset: () => void) => U): () => unknown;
|
|
70
|
+
export declare function createLoadingBoundary(fn: () => any, fallback: () => any, options?: {
|
|
71
|
+
on?: () => any;
|
|
72
|
+
}): () => unknown;
|
|
73
|
+
export type RevealOrder = "sequential" | "together" | "natural";
|
|
74
|
+
export declare function createRevealOrder<T>(fn: () => T, _options?: {
|
|
75
|
+
order?: () => RevealOrder;
|
|
76
|
+
collapsed?: () => boolean;
|
|
77
|
+
}): T;
|
|
78
|
+
export declare function untrack<T>(fn: () => T): T;
|
|
79
|
+
export declare function flush(): void;
|
|
80
|
+
export declare function resolve<T>(fn: () => T): Promise<T>;
|
|
81
|
+
export declare function isPending(fn: () => any, fallback?: boolean): boolean;
|
|
82
|
+
export declare function latest<T>(fn: () => T): T;
|
|
83
|
+
export declare function isRefreshing(): boolean;
|
|
84
|
+
export declare function refresh<T>(fn: () => T): T;
|
|
85
|
+
export declare function action<T extends (...args: any[]) => any>(fn: T): T;
|
|
86
|
+
export declare function onSettled(callback: () => void | (() => void)): void;
|
|
87
|
+
type NoInfer<T extends any> = [T][T extends any ? 0 : never];
|