solid-js 2.0.0-beta.5 → 2.0.0-beta.7
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 +126 -122
- package/dist/dev.js +120 -125
- package/dist/server.cjs +332 -97
- package/dist/server.js +328 -99
- package/dist/solid.cjs +120 -108
- package/dist/solid.js +114 -111
- package/package.json +78 -30
- package/types/client/core.d.ts +1 -8
- package/types/client/flow.d.ts +22 -0
- package/types/client/hydration.d.ts +4 -3
- package/types/index.d.ts +3 -6
- package/types/jsx-properties.d.ts +95 -0
- package/types/jsx.d.ts +438 -359
- package/types/server/flow.d.ts +9 -0
- package/types/server/hydration.d.ts +9 -0
- package/types/server/index.d.ts +1 -1
- package/types/server/shared.d.ts +5 -1
- package/types/server/signals.d.ts +13 -11
- 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 +142 -0
- package/types-cjs/client/hydration.d.cts +96 -0
- package/types-cjs/index.d.cts +17 -0
- package/types-cjs/jsx-properties.d.cts +95 -0
- package/types-cjs/jsx.d.cts +4263 -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 +82 -0
- package/types-cjs/server/hydration.d.cts +46 -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 +67 -0
package/types/server/flow.d.ts
CHANGED
|
@@ -70,4 +70,13 @@ export declare function Loading(props: {
|
|
|
70
70
|
on?: any;
|
|
71
71
|
children: JSX.Element;
|
|
72
72
|
}): JSX.Element;
|
|
73
|
+
/**
|
|
74
|
+
* Coordinates the reveal timing of sibling `<Loading>` boundaries during SSR.
|
|
75
|
+
* @description https://docs.solidjs.com/reference/components/reveal
|
|
76
|
+
*/
|
|
77
|
+
export declare function Reveal(props: {
|
|
78
|
+
together?: boolean;
|
|
79
|
+
collapsed?: boolean;
|
|
80
|
+
children: JSX.Element;
|
|
81
|
+
}): JSX.Element;
|
|
73
82
|
export {};
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
import type { Context } from "./signals.js";
|
|
1
2
|
import type { JSX } from "../jsx.js";
|
|
2
3
|
export { sharedConfig, NoHydrateContext } from "./shared.js";
|
|
3
4
|
export type { HydrationContext, SSRTemplateObject } from "./shared.js";
|
|
5
|
+
export type ServerRevealGroup = {
|
|
6
|
+
id: string;
|
|
7
|
+
register(key: string, options?: {
|
|
8
|
+
onActivate?: () => void;
|
|
9
|
+
}): boolean;
|
|
10
|
+
onResolved(key: string): void;
|
|
11
|
+
};
|
|
12
|
+
export declare const RevealGroupContext: Context<ServerRevealGroup | null>;
|
|
4
13
|
/**
|
|
5
14
|
* Handles errors during SSR rendering.
|
|
6
15
|
* Returns the promise source for NotReadyError (for async handling),
|
package/types/server/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { $PROXY, $REFRESH, $TRACK, action, createEffect, createMemo, createOptimistic, createOptimisticStore, createErrorBoundary, createOwner, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createTrackedEffect, deep, flatten, flush, getNextChildId, getObserver, getOwner, isEqual, isRefreshing, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled, latest, reconcile, refresh, repeat, resolve, NotReadyError, runWithOwner, snapshot, storePath, createDeepProxy, enableExternalSource, enforceLoadingBoundary, untrack } from "./signals.js";
|
|
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.js";
|
|
2
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.js";
|
|
3
3
|
export { $DEVCOMP, children, createContext, useContext, ssrRunInScope } from "./core.js";
|
|
4
4
|
export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedJSXElement } from "./core.js";
|
package/types/server/shared.d.ts
CHANGED
|
@@ -19,7 +19,11 @@ export type HydrationContext = {
|
|
|
19
19
|
escape(value: any): string;
|
|
20
20
|
replace: (id: string, replacement: () => any) => void;
|
|
21
21
|
block: (p: Promise<any>) => void;
|
|
22
|
-
registerFragment: (v: string
|
|
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;
|
|
23
27
|
/** Register a client-side asset URL discovered during SSR (e.g. from lazy()). */
|
|
24
28
|
registerAsset?: (type: "module" | "style", url: string) => void;
|
|
25
29
|
/** Register a moduleUrl-to-entryUrl mapping for the current boundary. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createRoot, createOwner, runWithOwner, getOwner, onCleanup, getNextChildId, createContext, setContext, getContext, NotReadyError, NoOwnerError, ContextNotFoundError, isEqual, isWrappable, SUPPORTS_PROXY, enableExternalSource, enforceLoadingBoundary } from "@solidjs/signals";
|
|
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
2
|
export { flatten } from "@solidjs/signals";
|
|
3
3
|
export { snapshot, merge, omit, storePath, $PROXY, $REFRESH, $TRACK } from "@solidjs/signals";
|
|
4
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";
|
|
@@ -15,23 +15,21 @@ interface ServerComputation<T = any> {
|
|
|
15
15
|
export declare function getObserver(): ServerComputation<any> | null;
|
|
16
16
|
export declare function createSignal<T>(): Signal<T | undefined>;
|
|
17
17
|
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 createMemo<
|
|
20
|
-
export declare function createMemo<Next extends Prev, Init = Next, Prev = Next>(compute: ComputeFunction<Init | Prev, Next>, value: Init, options?: MemoOptions<Next>): Accessor<Next>;
|
|
18
|
+
export declare function createSignal<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options?: SignalOptions<T>): Signal<T>;
|
|
19
|
+
export declare function createMemo<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options?: MemoOptions<T>): Accessor<T>;
|
|
21
20
|
export type PatchOp = [path: PropertyKey[]] | [path: PropertyKey[], value: any] | [path: PropertyKey[], value: any, insert: 1];
|
|
22
21
|
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 createRenderEffect<Next>(compute: ComputeFunction<undefined | NoInfer<Next>, Next>, effectFn: EffectFunction<NoInfer<Next>, Next>): void;
|
|
26
|
-
export declare function createRenderEffect<Next, Init = Next>(compute: ComputeFunction<Init | Next, Next>, effectFn: EffectFunction<Next, Next>, value: Init, options?: EffectOptions): void;
|
|
22
|
+
export declare function createEffect<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, effect: EffectFunction<NoInfer<T>, T> | EffectBundle<NoInfer<T>, T>, options?: EffectOptions): void;
|
|
23
|
+
export declare function createRenderEffect<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, effectFn: EffectFunction<NoInfer<T>, T>, options?: EffectOptions): void;
|
|
27
24
|
export declare function createTrackedEffect(compute: () => void | (() => void), options?: EffectOptions): void;
|
|
28
25
|
export declare function createReaction(effectFn: EffectFunction<undefined> | EffectBundle<undefined>, options?: EffectOptions): (tracking: () => void) => void;
|
|
29
26
|
export declare function createOptimistic<T>(): Signal<T | undefined>;
|
|
30
27
|
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 createStore<T extends object>(
|
|
28
|
+
export declare function createOptimistic<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options?: SignalOptions<T>): Signal<T>;
|
|
29
|
+
export declare function createStore<T extends object>(store: T | Store<T>): [get: Store<T>, set: StoreSetter<T>];
|
|
30
|
+
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
31
|
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
|
|
32
|
+
export declare function createProjection<T extends object>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue: Partial<T>, options?: {
|
|
35
33
|
deferStream?: boolean;
|
|
36
34
|
ssrSource?: string;
|
|
37
35
|
}): Store<T>;
|
|
@@ -53,6 +51,10 @@ export declare function createErrorBoundary<U>(fn: () => any, fallback: (error:
|
|
|
53
51
|
export declare function createLoadingBoundary(fn: () => any, fallback: () => any, options?: {
|
|
54
52
|
on?: () => any;
|
|
55
53
|
}): () => unknown;
|
|
54
|
+
export declare function createRevealOrder<T>(fn: () => T, _options?: {
|
|
55
|
+
together?: () => boolean;
|
|
56
|
+
collapsed?: () => boolean;
|
|
57
|
+
}): T;
|
|
56
58
|
export declare function untrack<T>(fn: () => T): T;
|
|
57
59
|
export declare function flush(): void;
|
|
58
60
|
export declare function resolve<T>(fn: () => T): Promise<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,142 @@
|
|
|
1
|
+
import type { Accessor } from "@solidjs/signals";
|
|
2
|
+
import type { JSX } from "../jsx.cjs";
|
|
3
|
+
type NonZeroParams<T extends (...args: any[]) => any> = Parameters<T>["length"] extends 0 ? never : T;
|
|
4
|
+
type ConditionalRenderCallback<T> = (item: Accessor<NonNullable<T>>) => JSX.Element;
|
|
5
|
+
type ConditionalRenderChildren<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = JSX.Element | NonZeroParams<F>;
|
|
6
|
+
/**
|
|
7
|
+
* Creates a list of elements from a list
|
|
8
|
+
*
|
|
9
|
+
* 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:
|
|
10
|
+
* ```typescript
|
|
11
|
+
* <For each={items} fallback={<div>No items</div>}>
|
|
12
|
+
* {(item, index) => <div data-index={index()}>{item()}</div>}
|
|
13
|
+
* </For>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @description https://docs.solidjs.com/reference/components/for
|
|
17
|
+
*/
|
|
18
|
+
export declare function For<T extends readonly any[], U extends JSX.Element>(props: {
|
|
19
|
+
each: T | undefined | null | false;
|
|
20
|
+
fallback?: JSX.Element;
|
|
21
|
+
keyed?: boolean | ((item: T[number]) => any);
|
|
22
|
+
children: (item: Accessor<T[number]>, index: Accessor<number>) => U;
|
|
23
|
+
}): JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a list elements from a count
|
|
26
|
+
*
|
|
27
|
+
* 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:
|
|
28
|
+
* ```typescript
|
|
29
|
+
* <Repeat count={items.length} fallback={<div>No items</div>}>
|
|
30
|
+
* {(index) => <div data-index={index}>{items[index]}</div>}
|
|
31
|
+
* </Repeat>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @description https://docs.solidjs.com/reference/components/repeat
|
|
35
|
+
*/
|
|
36
|
+
export declare function Repeat<T extends JSX.Element>(props: {
|
|
37
|
+
count: number;
|
|
38
|
+
from?: number | undefined;
|
|
39
|
+
fallback?: JSX.Element;
|
|
40
|
+
children: ((index: number) => T) | T;
|
|
41
|
+
}): JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* Conditionally render its children or an optional fallback component
|
|
44
|
+
* @description https://docs.solidjs.com/reference/components/show
|
|
45
|
+
*/
|
|
46
|
+
export declare function Show<T, F extends ConditionalRenderCallback<T>>(props: {
|
|
47
|
+
when: T | undefined | null | false;
|
|
48
|
+
keyed?: boolean;
|
|
49
|
+
fallback?: JSX.Element;
|
|
50
|
+
children: ConditionalRenderChildren<T, F>;
|
|
51
|
+
}): JSX.Element;
|
|
52
|
+
/**
|
|
53
|
+
* Switches between content based on mutually exclusive conditions
|
|
54
|
+
* ```typescript
|
|
55
|
+
* <Switch fallback={<FourOhFour />}>
|
|
56
|
+
* <Match when={state.route === 'home'}>
|
|
57
|
+
* <Home />
|
|
58
|
+
* </Match>
|
|
59
|
+
* <Match when={state.route === 'settings'}>
|
|
60
|
+
* <Settings />
|
|
61
|
+
* </Match>
|
|
62
|
+
* </Switch>
|
|
63
|
+
* ```
|
|
64
|
+
* @description https://docs.solidjs.com/reference/components/switch-and-match
|
|
65
|
+
*/
|
|
66
|
+
export declare function Switch(props: {
|
|
67
|
+
fallback?: JSX.Element;
|
|
68
|
+
children: JSX.Element;
|
|
69
|
+
}): JSX.Element;
|
|
70
|
+
export type MatchProps<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = {
|
|
71
|
+
when: T | undefined | null | false;
|
|
72
|
+
keyed?: boolean;
|
|
73
|
+
children: ConditionalRenderChildren<T, F>;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Selects a content based on condition when inside a `<Switch>` control flow
|
|
77
|
+
* ```typescript
|
|
78
|
+
* <Match when={condition()}>
|
|
79
|
+
* <Content/>
|
|
80
|
+
* </Match>
|
|
81
|
+
* ```
|
|
82
|
+
* @description https://docs.solidjs.com/reference/components/switch-and-match
|
|
83
|
+
*/
|
|
84
|
+
export declare function Match<T, F extends ConditionalRenderCallback<T>>(props: MatchProps<T, F>): JSX.Element;
|
|
85
|
+
/**
|
|
86
|
+
* Catches uncaught errors inside components and renders a fallback content
|
|
87
|
+
*
|
|
88
|
+
* Also supports a callback form that passes the error and a reset function:
|
|
89
|
+
* ```typescript
|
|
90
|
+
* <Errored fallback={
|
|
91
|
+
* (err, reset) => <div onClick={reset}>Error: {err.toString()}</div>
|
|
92
|
+
* }>
|
|
93
|
+
* <MyComp />
|
|
94
|
+
* </Errored>
|
|
95
|
+
* ```
|
|
96
|
+
* Errors thrown from the fallback can be caught by a parent Errored
|
|
97
|
+
*
|
|
98
|
+
* @description https://docs.solidjs.com/reference/components/error-boundary
|
|
99
|
+
*/
|
|
100
|
+
export declare function Errored(props: {
|
|
101
|
+
fallback: JSX.Element | ((err: any, reset: () => void) => JSX.Element);
|
|
102
|
+
children: JSX.Element;
|
|
103
|
+
}): JSX.Element;
|
|
104
|
+
/**
|
|
105
|
+
* Tracks all resources inside a component and renders a fallback until they are all resolved
|
|
106
|
+
* ```typescript
|
|
107
|
+
* const AsyncComponent = lazy(() => import('./component'));
|
|
108
|
+
*
|
|
109
|
+
* <Loading fallback={<LoadingIndicator />}>
|
|
110
|
+
* <AsyncComponent />
|
|
111
|
+
* </Loading>
|
|
112
|
+
* ```
|
|
113
|
+
* @description https://docs.solidjs.com/reference/components/suspense
|
|
114
|
+
*/
|
|
115
|
+
export declare function Loading(props: {
|
|
116
|
+
fallback?: JSX.Element;
|
|
117
|
+
on?: any;
|
|
118
|
+
children: JSX.Element;
|
|
119
|
+
}): JSX.Element;
|
|
120
|
+
/**
|
|
121
|
+
* Coordinates the reveal timing of sibling `<Loading>` boundaries.
|
|
122
|
+
*
|
|
123
|
+
* - **Sequential** (default): boundaries reveal in DOM order as each resolves.
|
|
124
|
+
* - **Together** (`together`): all boundaries wait until the group is ready, then reveal at once.
|
|
125
|
+
* - **Collapsed** (`collapsed`, sequential only): only the frontier boundary shows its fallback;
|
|
126
|
+
* later boundaries produce nothing until their turn.
|
|
127
|
+
*
|
|
128
|
+
* ```typescript
|
|
129
|
+
* <Reveal>
|
|
130
|
+
* <Loading fallback={<Skeleton />}><ProfileHeader /></Loading>
|
|
131
|
+
* <Loading fallback={<Skeleton />}><Posts /></Loading>
|
|
132
|
+
* </Reveal>
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @description https://docs.solidjs.com/reference/components/reveal
|
|
136
|
+
*/
|
|
137
|
+
export declare function Reveal(props: {
|
|
138
|
+
together?: boolean;
|
|
139
|
+
collapsed?: boolean;
|
|
140
|
+
children: JSX.Element;
|
|
141
|
+
}): JSX.Element;
|
|
142
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { createErrorBoundary as coreErrorBoundary, createMemo as coreMemo, createSignal as coreSignal, createOptimistic as coreOptimistic, createRenderEffect as coreRenderEffect, createEffect as coreEffect, $REFRESH, type ProjectionOptions, 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" | "initial" | "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" | "initial" | "client";
|
|
17
|
+
};
|
|
18
|
+
export type HydrationContext = {};
|
|
19
|
+
export declare const NoHydrateContext: Context<boolean>;
|
|
20
|
+
type SharedConfig = {
|
|
21
|
+
hydrating: boolean;
|
|
22
|
+
resources?: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
};
|
|
25
|
+
load?: (id: string) => Promise<any> | any;
|
|
26
|
+
has?: (id: string) => boolean;
|
|
27
|
+
gather?: (key: string) => void;
|
|
28
|
+
cleanupFragment?: (id: string) => void;
|
|
29
|
+
loadModuleAssets?: (mapping: Record<string, string>) => Promise<void> | undefined;
|
|
30
|
+
registry?: Map<string, Element>;
|
|
31
|
+
completed?: WeakSet<Element> | null;
|
|
32
|
+
events?: any[] | null;
|
|
33
|
+
verifyHydration?: () => void;
|
|
34
|
+
done: boolean;
|
|
35
|
+
getNextContextId(): string;
|
|
36
|
+
};
|
|
37
|
+
export declare const sharedConfig: SharedConfig;
|
|
38
|
+
/**
|
|
39
|
+
* Registers a callback to run once when all hydration completes
|
|
40
|
+
* (all boundaries hydrated or cancelled). If hydration is already
|
|
41
|
+
* complete (or not hydrating), fires via queueMicrotask.
|
|
42
|
+
*/
|
|
43
|
+
export declare function onHydrationEnd(callback: () => void): void;
|
|
44
|
+
export declare function enableHydration(): void;
|
|
45
|
+
export declare const createMemo: typeof coreMemo;
|
|
46
|
+
export declare const createSignal: typeof coreSignal;
|
|
47
|
+
export declare const createErrorBoundary: typeof coreErrorBoundary;
|
|
48
|
+
export declare const createOptimistic: typeof coreOptimistic;
|
|
49
|
+
export declare const createProjection: <T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue: T, options?: HydrationProjectionOptions) => Store<T> & {
|
|
50
|
+
[$REFRESH]: any;
|
|
51
|
+
};
|
|
52
|
+
type NoFn<T> = T extends Function ? never : T;
|
|
53
|
+
export declare const createStore: {
|
|
54
|
+
<T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): [get: Store<T>, set: StoreSetter<T>];
|
|
55
|
+
<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> & {
|
|
56
|
+
[$REFRESH]: any;
|
|
57
|
+
}, set: StoreSetter<T>];
|
|
58
|
+
};
|
|
59
|
+
export declare const createOptimisticStore: {
|
|
60
|
+
<T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): [get: Store<T>, set: StoreSetter<T>];
|
|
61
|
+
<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> & {
|
|
62
|
+
[$REFRESH]: any;
|
|
63
|
+
}, set: StoreSetter<T>];
|
|
64
|
+
};
|
|
65
|
+
export declare const createRenderEffect: typeof coreRenderEffect;
|
|
66
|
+
export declare const createEffect: typeof coreEffect;
|
|
67
|
+
/**
|
|
68
|
+
* Tracks all resources inside a component and renders a fallback until they are all resolved
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const AsyncComponent = lazy(() => import('./component'));
|
|
71
|
+
*
|
|
72
|
+
* <Loading fallback={<LoadingIndicator />}>
|
|
73
|
+
* <AsyncComponent />
|
|
74
|
+
* </Loading>
|
|
75
|
+
* ```
|
|
76
|
+
* @description https://docs.solidjs.com/reference/components/suspense
|
|
77
|
+
*/
|
|
78
|
+
export declare function createLoadingBoundary(fn: () => any, fallback: () => any, options?: {
|
|
79
|
+
on?: () => any;
|
|
80
|
+
}): () => unknown;
|
|
81
|
+
/**
|
|
82
|
+
* Disables hydration for its children on the client.
|
|
83
|
+
* During hydration, skips the subtree entirely (returns undefined so DOM is left untouched).
|
|
84
|
+
* After hydration, renders children fresh.
|
|
85
|
+
*/
|
|
86
|
+
export declare function NoHydration(props: {
|
|
87
|
+
children: JSX.Element;
|
|
88
|
+
}): JSX.Element;
|
|
89
|
+
/**
|
|
90
|
+
* Re-enables hydration within a NoHydration zone (passthrough on client).
|
|
91
|
+
*/
|
|
92
|
+
export declare function Hydration(props: {
|
|
93
|
+
id?: string;
|
|
94
|
+
children: JSX.Element;
|
|
95
|
+
}): JSX.Element;
|
|
96
|
+
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
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared type-level helpers used to derive `prop:*` attribute typings from
|
|
3
|
+
* DOM element interfaces (e.g. `HTMLInputElement`, `HTMLButtonElement`).
|
|
4
|
+
*
|
|
5
|
+
* The wrapping of each value (`FunctionMaybe<T>` in `jsx-h.d.ts` vs. the
|
|
6
|
+
* raw value in `jsx.d.ts`) is applied by each consumer when composing its
|
|
7
|
+
* own `Properties<T>` mapped type. That way this file stays identical in
|
|
8
|
+
* both reactive and non-reactive contexts and only needs to exist once.
|
|
9
|
+
*
|
|
10
|
+
* originally from
|
|
11
|
+
* @url https://github.com/potahtml/pota
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Base-class properties shared by all elements — skipped from `prop:*`. */
|
|
15
|
+
export type SkipPropsFrom = HTMLUnknownElement & HTMLElement & Element & Node;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Value types allowed on a `prop:*`. Primitives plus the writable
|
|
19
|
+
* non-primitive DOM-object props worth exposing:
|
|
20
|
+
*
|
|
21
|
+
* - `HTMLMediaElement.srcObject`
|
|
22
|
+
* - `HTMLButtonElement.popoverTargetElement` / `commandForElement` (and the same via
|
|
23
|
+
* `PopoverTargetAttributes` mixin on `HTMLInputElement`)
|
|
24
|
+
*/
|
|
25
|
+
export type PropValue =
|
|
26
|
+
| string
|
|
27
|
+
| number
|
|
28
|
+
| boolean
|
|
29
|
+
| null
|
|
30
|
+
| MediaStream
|
|
31
|
+
| MediaSource
|
|
32
|
+
| Blob
|
|
33
|
+
| File
|
|
34
|
+
| Element;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Ergonomics widening for emitted `prop:*` value types:
|
|
38
|
+
*
|
|
39
|
+
* - general `string` → `string | number` (HTML coerces numbers)
|
|
40
|
+
* - string literal unions (`'on' | 'off'`) stay exact, so users still get autocomplete /
|
|
41
|
+
* narrowing
|
|
42
|
+
* - other types pass through unchanged
|
|
43
|
+
*/
|
|
44
|
+
export type WidenPropValue<V> = [V] extends [string]
|
|
45
|
+
? string extends V
|
|
46
|
+
? string | number
|
|
47
|
+
: V
|
|
48
|
+
: V;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Structurally identical → `Y`; distinct → `N`. Used by `IsReadonlyKey` to detect
|
|
52
|
+
* readonly keys by comparing `Pick<T, K>` with `Readonly<Pick<T, K>>`.
|
|
53
|
+
*/
|
|
54
|
+
export type IfEquals<A, B, Y = unknown, N = never> =
|
|
55
|
+
(<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? Y : N;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* True when `K` is readonly on `T`. Singleton-constant properties (e.g.
|
|
59
|
+
* `tagName: "INPUT"`, `nodeType: 1`) are always `readonly` in `lib.dom.d.ts`, so this
|
|
60
|
+
* single check covers both readonly and singleton-literal cases.
|
|
61
|
+
*/
|
|
62
|
+
export type IsReadonlyKey<T, K extends keyof T> = IfEquals<
|
|
63
|
+
Pick<T, K>,
|
|
64
|
+
Readonly<Pick<T, K>>,
|
|
65
|
+
true,
|
|
66
|
+
false
|
|
67
|
+
>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Resolves to the `prop:K` string literal when `K` is a writable, element-specific
|
|
71
|
+
* property suitable for a `prop:*` attribute; otherwise resolves to `never` so the
|
|
72
|
+
* key is filtered out of the resulting mapped type.
|
|
73
|
+
*
|
|
74
|
+
* Filters out:
|
|
75
|
+
*
|
|
76
|
+
* - base-class keys (via `SkipPropsFrom`)
|
|
77
|
+
* - aria-* keys (already typed via `AriaAttributes`)
|
|
78
|
+
* - readonly keys
|
|
79
|
+
* - keys whose value types fall outside `PropValue`
|
|
80
|
+
* - the generic `string` index signature (e.g. `HTMLFormElement[name: string]: any`),
|
|
81
|
+
* which would otherwise shadow every key with an `any`-typed `prop:*`
|
|
82
|
+
*/
|
|
83
|
+
export type PropKey<T, K extends keyof T> = K extends keyof SkipPropsFrom
|
|
84
|
+
? never
|
|
85
|
+
: K extends string
|
|
86
|
+
? string extends K
|
|
87
|
+
? never
|
|
88
|
+
: K extends `aria${string}`
|
|
89
|
+
? never
|
|
90
|
+
: T[K] extends PropValue
|
|
91
|
+
? IsReadonlyKey<T, K> extends true
|
|
92
|
+
? never
|
|
93
|
+
: `prop:${K}`
|
|
94
|
+
: never
|
|
95
|
+
: never;
|