solid-js 2.0.0-beta.4 → 2.0.0-beta.6
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 +136 -113
- package/dist/dev.js +128 -108
- package/dist/server.cjs +350 -131
- package/dist/server.js +347 -134
- package/dist/solid.cjs +130 -99
- package/dist/solid.js +122 -94
- package/package.json +2 -2
- package/types/client/core.d.ts +1 -8
- package/types/client/flow.d.ts +47 -5
- package/types/client/hydration.d.ts +9 -13
- package/types/index.d.ts +4 -7
- package/types/jsx.d.ts +160 -115
- package/types/server/flow.d.ts +27 -5
- package/types/server/hydration.d.ts +11 -4
- package/types/server/index.d.ts +2 -2
- package/types/server/shared.d.ts +5 -1
- package/types/server/signals.d.ts +7 -2
package/types/server/flow.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { Accessor } from "./signals.js";
|
|
2
2
|
import type { JSX } from "../jsx.js";
|
|
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>;
|
|
3
6
|
/**
|
|
4
7
|
* Creates a list of elements from a list
|
|
5
8
|
*
|
|
@@ -26,11 +29,11 @@ export declare function Repeat<T extends JSX.Element>(props: {
|
|
|
26
29
|
* Conditionally render its children or an optional fallback component
|
|
27
30
|
* @description https://docs.solidjs.com/reference/components/show
|
|
28
31
|
*/
|
|
29
|
-
export declare function Show<T
|
|
32
|
+
export declare function Show<T, F extends ConditionalRenderCallback<T>>(props: {
|
|
30
33
|
when: T | undefined | null | false;
|
|
31
34
|
keyed?: boolean;
|
|
32
35
|
fallback?: JSX.Element;
|
|
33
|
-
children:
|
|
36
|
+
children: ConditionalRenderChildren<T, F>;
|
|
34
37
|
}): JSX.Element;
|
|
35
38
|
/**
|
|
36
39
|
* Switches between content based on mutually exclusive conditions
|
|
@@ -40,16 +43,16 @@ export declare function Switch(props: {
|
|
|
40
43
|
fallback?: JSX.Element;
|
|
41
44
|
children: JSX.Element;
|
|
42
45
|
}): JSX.Element;
|
|
43
|
-
export type MatchProps<T> = {
|
|
46
|
+
export type MatchProps<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = {
|
|
44
47
|
when: T | undefined | null | false;
|
|
45
48
|
keyed?: boolean;
|
|
46
|
-
children:
|
|
49
|
+
children: ConditionalRenderChildren<T, F>;
|
|
47
50
|
};
|
|
48
51
|
/**
|
|
49
52
|
* Selects a content based on condition when inside a `<Switch>` control flow
|
|
50
53
|
* @description https://docs.solidjs.com/reference/components/switch-and-match
|
|
51
54
|
*/
|
|
52
|
-
export declare function Match<T
|
|
55
|
+
export declare function Match<T, F extends ConditionalRenderCallback<T>>(props: MatchProps<T, F>): JSX.Element;
|
|
53
56
|
/**
|
|
54
57
|
* Catches uncaught errors inside components and renders a fallback content
|
|
55
58
|
* @description https://docs.solidjs.com/reference/components/error-boundary
|
|
@@ -58,3 +61,22 @@ export declare function Errored(props: {
|
|
|
58
61
|
fallback: JSX.Element | ((err: any, reset: () => void) => JSX.Element);
|
|
59
62
|
children: JSX.Element;
|
|
60
63
|
}): JSX.Element;
|
|
64
|
+
/**
|
|
65
|
+
* Tracks all resources inside a component and renders a fallback until they are all resolved
|
|
66
|
+
* @description https://docs.solidjs.com/reference/components/suspense
|
|
67
|
+
*/
|
|
68
|
+
export declare function Loading(props: {
|
|
69
|
+
fallback?: JSX.Element;
|
|
70
|
+
on?: any;
|
|
71
|
+
children: JSX.Element;
|
|
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;
|
|
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),
|
|
@@ -15,11 +24,9 @@ export declare function ssrHandleError(err: any): Promise<any> | undefined;
|
|
|
15
24
|
*
|
|
16
25
|
* @description https://docs.solidjs.com/reference/components/suspense
|
|
17
26
|
*/
|
|
18
|
-
export declare function
|
|
19
|
-
fallback?: JSX.Element;
|
|
27
|
+
export declare function createLoadingBoundary(fn: () => any, fallback: () => any, options?: {
|
|
20
28
|
on?: () => any;
|
|
21
|
-
|
|
22
|
-
}): JSX.Element;
|
|
29
|
+
}): () => unknown;
|
|
23
30
|
/**
|
|
24
31
|
* Disables hydration for its children during SSR.
|
|
25
32
|
* Elements inside will not receive hydration keys (`_hk`) and signals will not be serialized.
|
package/types/server/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { $PROXY, $REFRESH, $TRACK, action, createEffect, createMemo, createOptimistic, createOptimisticStore, createErrorBoundary,
|
|
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";
|
|
5
5
|
export * from "./component.js";
|
|
6
6
|
export * from "./flow.js";
|
|
7
|
-
export { sharedConfig,
|
|
7
|
+
export { sharedConfig, createLoadingBoundary, ssrHandleError, NoHydration, Hydration, NoHydrateContext } from "./hydration.js";
|
|
8
8
|
export type { HydrationContext } from "./hydration.js";
|
|
9
9
|
import type { JSX } from "../jsx.js";
|
|
10
10
|
type JSXElement = JSX.Element;
|
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,9 +1,9 @@
|
|
|
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";
|
|
5
5
|
import type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, MemoOptions, SignalOptions, Signal, Owner, Store, StoreSetter, Context } from "@solidjs/signals";
|
|
6
|
-
import { NoHydrateContext } from "./shared.js";
|
|
6
|
+
import { sharedConfig, NoHydrateContext } from "./shared.js";
|
|
7
7
|
interface ServerComputation<T = any> {
|
|
8
8
|
owner: Owner;
|
|
9
9
|
value: T;
|
|
@@ -47,11 +47,16 @@ export declare function repeat<T>(count: Accessor<number>, mapFn: (i: number) =>
|
|
|
47
47
|
}): () => T[];
|
|
48
48
|
declare const ErrorContext: Context<((err: any) => void) | null>;
|
|
49
49
|
export { ErrorContext };
|
|
50
|
+
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;
|
|
50
51
|
export { NoHydrateContext };
|
|
51
52
|
export declare function createErrorBoundary<U>(fn: () => any, fallback: (error: unknown, reset: () => void) => U): () => unknown;
|
|
52
53
|
export declare function createLoadingBoundary(fn: () => any, fallback: () => any, options?: {
|
|
53
54
|
on?: () => any;
|
|
54
55
|
}): () => unknown;
|
|
56
|
+
export declare function createRevealOrder<T>(fn: () => T, _options?: {
|
|
57
|
+
together?: () => boolean;
|
|
58
|
+
collapsed?: () => boolean;
|
|
59
|
+
}): T;
|
|
55
60
|
export declare function untrack<T>(fn: () => T): T;
|
|
56
61
|
export declare function flush(): void;
|
|
57
62
|
export declare function resolve<T>(fn: () => T): Promise<T>;
|