solid-js 2.0.0-beta.1 → 2.0.0-beta.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/CHEATSHEET.md +640 -0
- package/README.md +42 -188
- package/dist/dev.cjs +431 -283
- package/dist/dev.js +411 -286
- package/dist/server.cjs +701 -281
- package/dist/server.js +684 -284
- package/dist/solid.cjs +423 -255
- package/dist/solid.js +403 -258
- package/package.json +67 -39
- package/types/client/component.d.ts +64 -19
- package/types/client/core.d.ts +110 -34
- package/types/client/flow.d.ts +176 -42
- package/types/client/hydration.d.ts +514 -36
- package/types/index.d.ts +9 -12
- package/types/server/component.d.ts +11 -11
- package/types/server/core.d.ts +19 -14
- package/types/server/flow.d.ts +76 -21
- package/types/server/hydration.d.ts +34 -9
- package/types/server/index.d.ts +5 -7
- package/types/server/shared.d.ts +5 -1
- package/types/server/signals.d.ts +44 -19
- package/types/types.d.ts +15 -0
- package/types-cjs/client/component.d.cts +120 -0
- package/types-cjs/client/core.d.cts +141 -0
- package/types-cjs/client/flow.d.cts +234 -0
- package/types-cjs/client/hydration.d.cts +570 -0
- package/types-cjs/index.d.cts +17 -0
- package/types-cjs/package.json +3 -0
- package/types-cjs/server/component.d.cts +67 -0
- package/types-cjs/server/core.d.cts +49 -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 +10 -0
- package/types-cjs/server/shared.d.cts +50 -0
- package/types-cjs/server/signals.d.cts +87 -0
- package/types-cjs/types.d.cts +15 -0
- package/jsx-runtime.d.ts +0 -1
- package/types/jsx.d.ts +0 -4129
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Accessor, EffectOptions } from "./signals.cjs";
|
|
2
|
+
import type { ArrayElement, Element as SolidElement } from "../types.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 | undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a Context to share state with descendants of a Provider.
|
|
15
|
+
*
|
|
16
|
+
* - `createContext<T>()` — default-less. `useContext` throws
|
|
17
|
+
* `ContextNotFoundError` outside any Provider. Use this for any context
|
|
18
|
+
* carrying reactive state.
|
|
19
|
+
* - `createContext<T>(defaultValue)` — default form. `useContext` falls back
|
|
20
|
+
* to `defaultValue` outside a Provider. Reserved for primitive fallbacks
|
|
21
|
+
* (theme, locale, frozen config).
|
|
22
|
+
*
|
|
23
|
+
* @param defaultValue optional default; only meaningful for primitive fallbacks
|
|
24
|
+
* @param options allows to set a name in dev mode for debugging purposes
|
|
25
|
+
*/
|
|
26
|
+
export declare function createContext<T>(defaultValue?: T, options?: EffectOptions): Context<T>;
|
|
27
|
+
/**
|
|
28
|
+
* Reads the current value of a context. Throws `ContextNotFoundError` if no
|
|
29
|
+
* Provider is mounted and the context was created without a default.
|
|
30
|
+
*/
|
|
31
|
+
export declare function useContext<T>(context: Context<T>): T;
|
|
32
|
+
export type ResolvedElement = Exclude<SolidElement, ArrayElement>;
|
|
33
|
+
export type ResolvedChildren = ResolvedElement | ResolvedElement[];
|
|
34
|
+
export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
35
|
+
toArray: () => ResolvedElement[];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Resolves child elements to help interact with children
|
|
39
|
+
* @param fn an accessor for the children
|
|
40
|
+
* @returns a accessor of the same children, but resolved
|
|
41
|
+
*/
|
|
42
|
+
export declare function children(fn: Accessor<SolidElement>): ChildrenReturn;
|
|
43
|
+
/**
|
|
44
|
+
* Pass-through for SSR dynamic expressions.
|
|
45
|
+
* On the client, insert() render effects are transparent (0 owner slots),
|
|
46
|
+
* so the server doesn't need to create owners for these either.
|
|
47
|
+
*/
|
|
48
|
+
export declare function ssrRunInScope(fn: () => any): () => any;
|
|
49
|
+
export declare function ssrRunInScope(array: (() => any)[]): (() => any)[];
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { Accessor, RevealOrder } from "./signals.cjs";
|
|
2
|
+
import type { Element as SolidElement } from "../types.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>>) => SolidElement;
|
|
6
|
+
type ConditionalRenderChildren<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = SolidElement | 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 SolidElement>(props: {
|
|
13
|
+
each: T | undefined | null | false;
|
|
14
|
+
fallback?: SolidElement;
|
|
15
|
+
keyed?: boolean | ((item: T[number]) => any);
|
|
16
|
+
children: (item: Accessor<T[number]>, index: Accessor<number>) => U;
|
|
17
|
+
}): SolidElement;
|
|
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 SolidElement>(props: {
|
|
24
|
+
count: number;
|
|
25
|
+
from?: number | undefined;
|
|
26
|
+
fallback?: SolidElement;
|
|
27
|
+
children: ((index: number) => T) | T;
|
|
28
|
+
}): SolidElement;
|
|
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?: SolidElement;
|
|
37
|
+
children: ConditionalRenderChildren<T, F>;
|
|
38
|
+
}): SolidElement;
|
|
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?: SolidElement;
|
|
45
|
+
children: SolidElement;
|
|
46
|
+
}): SolidElement;
|
|
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>): SolidElement;
|
|
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: SolidElement | ((err: any, reset: () => void) => SolidElement);
|
|
63
|
+
children: SolidElement;
|
|
64
|
+
}): SolidElement;
|
|
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?: SolidElement;
|
|
71
|
+
on?: any;
|
|
72
|
+
children: SolidElement;
|
|
73
|
+
}): SolidElement;
|
|
74
|
+
export type RevealProps = {
|
|
75
|
+
order?: RevealOrder;
|
|
76
|
+
collapsed?: boolean;
|
|
77
|
+
children: SolidElement;
|
|
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): SolidElement;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Context } from "./signals.cjs";
|
|
2
|
+
import type { Element as SolidElement } from "../types.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: SolidElement;
|
|
54
|
+
}): SolidElement;
|
|
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: SolidElement;
|
|
63
|
+
}): SolidElement;
|
|
@@ -0,0 +1,10 @@
|
|
|
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, Refreshable, 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, ResolvedElement } from "./core.cjs";
|
|
5
|
+
export * from "./component.cjs";
|
|
6
|
+
export * from "./flow.cjs";
|
|
7
|
+
export type { ArrayElement, Element } from "../types.cjs";
|
|
8
|
+
export { sharedConfig, createLoadingBoundary, ssrHandleError, NoHydration, Hydration, NoHydrateContext } from "./hydration.cjs";
|
|
9
|
+
export type { HydrationContext } from "./hydration.cjs";
|
|
10
|
+
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, Refreshable, 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];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renderer-owned object value returned from Solid component trees.
|
|
3
|
+
*
|
|
4
|
+
* The concrete rendered value belongs to the active renderer or JSX factory
|
|
5
|
+
* (`@solidjs/web`, `@solidjs/h`, custom renderers, etc.), so core does not
|
|
6
|
+
* model DOM nodes or any other platform object here.
|
|
7
|
+
*/
|
|
8
|
+
export type RenderedElement = object & {
|
|
9
|
+
readonly call?: never;
|
|
10
|
+
readonly apply?: never;
|
|
11
|
+
readonly bind?: never;
|
|
12
|
+
};
|
|
13
|
+
export type Element = RenderedElement | ArrayElement | (string & {}) | number | boolean | null | undefined;
|
|
14
|
+
export interface ArrayElement extends Array<Element> {
|
|
15
|
+
}
|
package/jsx-runtime.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./types/jsx";
|