solid-js 2.0.0-beta.10 → 2.0.0-beta.11
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 +15 -8
- package/dist/dev.js +16 -8
- package/dist/server.cjs +310 -134
- package/dist/server.js +237 -39
- package/dist/solid.cjs +17 -8
- package/dist/solid.js +18 -8
- package/package.json +2 -2
- package/types/client/hydration.d.ts +14 -16
- package/types/index.d.ts +1 -3
- package/types/server/core.d.ts +0 -7
- package/types/server/index.d.ts +1 -1
- package/types/server/shared.d.ts +5 -1
- package/types/server/signals.d.ts +41 -5
- package/types-cjs/client/hydration.d.cts +14 -16
- package/types-cjs/index.d.cts +1 -3
- package/types-cjs/server/core.d.cts +0 -7
- package/types-cjs/server/index.d.cts +1 -1
- package/types-cjs/server/shared.d.cts +5 -1
- package/types-cjs/server/signals.d.cts +41 -5
package/types/server/core.d.ts
CHANGED
|
@@ -40,10 +40,3 @@ export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
|
40
40
|
* @returns a accessor of the same children, but resolved
|
|
41
41
|
*/
|
|
42
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)[];
|
package/types/server/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
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, Refreshable, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter, PatchOp } from "./signals.js";
|
|
3
|
-
export { $DEVCOMP, children, createContext, useContext
|
|
3
|
+
export { $DEVCOMP, children, createContext, useContext } from "./core.js";
|
|
4
4
|
export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedElement } from "./core.js";
|
|
5
5
|
export * from "./component.js";
|
|
6
6
|
export * from "./flow.js";
|
package/types/server/shared.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import type { Context } from "
|
|
1
|
+
import type { Context } from "./signals.js";
|
|
2
2
|
export type SSRTemplateObject = {
|
|
3
3
|
t: string[];
|
|
4
4
|
h: Function[];
|
|
5
5
|
p: Promise<any>[];
|
|
6
|
+
} | {
|
|
7
|
+
t: string;
|
|
8
|
+
h?: undefined;
|
|
9
|
+
p?: undefined;
|
|
6
10
|
};
|
|
7
11
|
export type HydrationContext = {
|
|
8
12
|
id: string;
|
|
@@ -1,9 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
import { $REFRESH } from "@solidjs/signals";
|
|
2
|
+
export { $REFRESH };
|
|
3
|
+
export { NotReadyError, NoOwnerError, ContextNotFoundError, isEqual, isWrappable, SUPPORTS_PROXY, enableExternalSource, enforceLoadingBoundary } from "@solidjs/signals";
|
|
2
4
|
export { flatten } from "@solidjs/signals";
|
|
3
|
-
export { snapshot, merge, omit, storePath, $PROXY, $
|
|
5
|
+
export { snapshot, merge, omit, storePath, $PROXY, $TRACK } from "@solidjs/signals";
|
|
6
|
+
import type { Accessor as SignalAccessor, Refreshable } from "@solidjs/signals";
|
|
7
|
+
export type SourceAccessor<T> = Refreshable<SignalAccessor<T>>;
|
|
4
8
|
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
9
|
import type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, MemoOptions, SignalOptions, Signal, Owner, Store, StoreSetter, Context } from "@solidjs/signals";
|
|
6
10
|
import { sharedConfig, NoHydrateContext } from "./shared.js";
|
|
11
|
+
type Disposable = () => void;
|
|
12
|
+
export declare function getNextChildId(owner: Owner): string;
|
|
13
|
+
export declare function createOwner(options?: {
|
|
14
|
+
id?: string;
|
|
15
|
+
transparent?: boolean;
|
|
16
|
+
}): Owner;
|
|
17
|
+
export declare function runWithOwner<T>(owner: Owner | null, fn: () => T): T;
|
|
18
|
+
export declare function getOwner(): Owner | null;
|
|
19
|
+
export declare function isDisposed(owner: Owner): boolean;
|
|
20
|
+
export declare function onCleanup(fn: Disposable): Disposable;
|
|
21
|
+
export declare function createContext<T>(defaultValue?: T, description?: string): Context<T>;
|
|
22
|
+
export declare function getContext<T>(context: Context<T>, owner?: Owner | null): T;
|
|
23
|
+
export declare function setContext<T>(context: Context<T>, value?: T, owner?: Owner | null): void;
|
|
24
|
+
/**
|
|
25
|
+
* Tears down `owner` (optionally) and all of its descendants. Walks the
|
|
26
|
+
* forward-only `_firstChild` -> `_nextSibling` chain, recursively disposing
|
|
27
|
+
* each child with `self=true`, then runs the owner's own `_disposal` queue
|
|
28
|
+
* and resets `_firstChild` / `_childCount`.
|
|
29
|
+
*
|
|
30
|
+
* `self=false` keeps `owner` itself alive (its `_disposed` flag stays clear,
|
|
31
|
+
* future `runWithOwner(owner, ...)` keeps working) but tears down its
|
|
32
|
+
* subtree. This is what `createErrorBoundary` and `createLoadingBoundary`
|
|
33
|
+
* use on retry — wipe the children, keep the boundary owner around for the
|
|
34
|
+
* re-run.
|
|
35
|
+
*
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export declare function disposeOwner(owner: Owner, self?: boolean): void;
|
|
39
|
+
export declare function createRoot<T>(init: ((dispose: () => void) => T) | (() => T), options?: {
|
|
40
|
+
id?: string;
|
|
41
|
+
transparent?: boolean;
|
|
42
|
+
}): T;
|
|
7
43
|
interface ServerComputation<T = any> {
|
|
8
44
|
owner: Owner;
|
|
9
45
|
value: T;
|
|
@@ -34,8 +70,8 @@ export declare function createSignal<T>(): Signal<T | undefined>;
|
|
|
34
70
|
export declare function createSignal<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>;
|
|
35
71
|
export declare function createSignal<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options: ServerClientSignalOptions<T>): Signal<T | undefined>;
|
|
36
72
|
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>):
|
|
38
|
-
export declare function createMemo<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options?: ServerMemoOptions<T>):
|
|
73
|
+
export declare function createMemo<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options: ServerClientMemoOptions<T>): SourceAccessor<T | undefined>;
|
|
74
|
+
export declare function createMemo<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options?: ServerMemoOptions<T>): SourceAccessor<T>;
|
|
39
75
|
export type PatchOp = [path: PropertyKey[]] | [path: PropertyKey[], value: any] | [path: PropertyKey[], value: any, insert: 1];
|
|
40
76
|
export declare function createDeepProxy<T extends object>(target: T, patches: PatchOp[], basePath?: PropertyKey[]): T;
|
|
41
77
|
export declare function createEffect<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, effect: EffectFunction<NoInfer<T>, T> | EffectBundle<NoInfer<T>, T>, options?: EffectOptions): void;
|
|
@@ -81,7 +117,7 @@ export declare function resolve<T>(fn: () => T): Promise<T>;
|
|
|
81
117
|
export declare function isPending(fn: () => any, fallback?: boolean): boolean;
|
|
82
118
|
export declare function latest<T>(fn: () => T): T;
|
|
83
119
|
export declare function isRefreshing(): boolean;
|
|
84
|
-
export declare function refresh<T>(
|
|
120
|
+
export declare function refresh<T>(_target: Refreshable<T>): void;
|
|
85
121
|
export declare function action<T extends (...args: any[]) => any>(fn: T): T;
|
|
86
122
|
export declare function onSettled(callback: () => void | (() => void)): void;
|
|
87
123
|
type NoInfer<T extends any> = [T][T extends any ? 0 : never];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createErrorBoundary as coreErrorBoundary, createRenderEffect as coreRenderEffect, createEffect as coreEffect, type
|
|
1
|
+
import { createErrorBoundary as coreErrorBoundary, createRenderEffect as coreRenderEffect, createEffect as coreEffect, type ComputeFunction, type MemoOptions, type NoInfer, type ProjectionOptions, type Refreshable, type Signal, type SignalOptions, type SourceAccessor, type Store, type StoreSetter, type Context } from "@solidjs/signals";
|
|
2
2
|
import type { Element as SolidElement } from "../types.cjs";
|
|
3
3
|
type HydrationSsrFields = {
|
|
4
4
|
/**
|
|
@@ -34,11 +34,12 @@ declare module "@solidjs/signals" {
|
|
|
34
34
|
}
|
|
35
35
|
interface EffectOptions extends HydrationSsrFields {
|
|
36
36
|
}
|
|
37
|
+
interface ProjectionOptions extends HydrationSsrFields {
|
|
38
|
+
}
|
|
37
39
|
}
|
|
38
40
|
/**
|
|
39
41
|
* Options for `createProjection`, `createStore(fn, ...)`, and
|
|
40
|
-
* `createOptimisticStore(fn, ...)
|
|
41
|
-
* hydration-aware `ssrSource` field.
|
|
42
|
+
* `createOptimisticStore(fn, ...)`.
|
|
42
43
|
*
|
|
43
44
|
* `ssrSource` controls what initial value the client uses and whether
|
|
44
45
|
* the projection's compute re-runs:
|
|
@@ -52,9 +53,6 @@ declare module "@solidjs/signals" {
|
|
|
52
53
|
*
|
|
53
54
|
* See {@link HydrationSsrFields} for the fuller explanation.
|
|
54
55
|
*/
|
|
55
|
-
export type HydrationProjectionOptions = ProjectionOptions & {
|
|
56
|
-
ssrSource?: "server" | "hybrid" | "client";
|
|
57
|
-
};
|
|
58
56
|
type HydrationClientMemoOptions<T> = Omit<MemoOptions<T>, "ssrSource"> & {
|
|
59
57
|
ssrSource: "client";
|
|
60
58
|
};
|
|
@@ -157,8 +155,8 @@ export declare function enableHydration(): void;
|
|
|
157
155
|
* @description https://docs.solidjs.com/reference/basic-reactivity/create-memo
|
|
158
156
|
*/
|
|
159
157
|
export declare const createMemo: {
|
|
160
|
-
<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options: HydrationClientMemoOptions<T>):
|
|
161
|
-
<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options?: HydrationMemoOptions<T>):
|
|
158
|
+
<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options: HydrationClientMemoOptions<T>): SourceAccessor<T | undefined>;
|
|
159
|
+
<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options?: HydrationMemoOptions<T>): SourceAccessor<T>;
|
|
162
160
|
};
|
|
163
161
|
/**
|
|
164
162
|
* Creates a simple reactive state with a getter and setter.
|
|
@@ -302,11 +300,11 @@ export declare const createOptimistic: {
|
|
|
302
300
|
* );
|
|
303
301
|
* ```
|
|
304
302
|
*
|
|
305
|
-
* **Hydration:**
|
|
303
|
+
* **Hydration:** `ProjectionOptions` accepts an `ssrSource` field
|
|
306
304
|
* (`"server"` | `"hybrid"` | `"client"`) for the same client-vs-server
|
|
307
305
|
* tradeoffs as the other primitives. See {@link HydrationSsrFields}.
|
|
308
306
|
*/
|
|
309
|
-
export declare const createProjection: <T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue: T, options?:
|
|
307
|
+
export declare const createProjection: <T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue: T, options?: ProjectionOptions) => Refreshable<Store<T>>;
|
|
310
308
|
type NoFn<T> = T extends Function ? never : T;
|
|
311
309
|
/**
|
|
312
310
|
* Creates a deeply-reactive store backed by a Proxy. Reads track each
|
|
@@ -362,15 +360,15 @@ type NoFn<T> = T extends Function ? never : T;
|
|
|
362
360
|
* );
|
|
363
361
|
* ```
|
|
364
362
|
*
|
|
365
|
-
* **Hydration:** the derived form accepts
|
|
366
|
-
*
|
|
363
|
+
* **Hydration:** the derived form accepts `ProjectionOptions`, including
|
|
364
|
+
* an `ssrSource` field
|
|
367
365
|
* (`"server"` | `"hybrid"` | `"client"`). See {@link HydrationSsrFields}.
|
|
368
366
|
*
|
|
369
367
|
* @returns `[store: Store<T>, setStore: StoreSetter<T>]`
|
|
370
368
|
*/
|
|
371
369
|
export declare const createStore: {
|
|
372
370
|
<T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): [get: Store<T>, set: StoreSetter<T>];
|
|
373
|
-
<T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store: NoFn<T> | Store<NoFn<T>>, options?:
|
|
371
|
+
<T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store: NoFn<T> | Store<NoFn<T>>, options?: ProjectionOptions): [get: Refreshable<Store<T>>, set: StoreSetter<T>];
|
|
374
372
|
};
|
|
375
373
|
/**
|
|
376
374
|
* The store equivalent of `createOptimistic`. Writes inside an
|
|
@@ -412,15 +410,15 @@ export declare const createStore: {
|
|
|
412
410
|
* });
|
|
413
411
|
* ```
|
|
414
412
|
*
|
|
415
|
-
* **Hydration:** the derived form accepts
|
|
416
|
-
*
|
|
413
|
+
* **Hydration:** the derived form accepts `ProjectionOptions`, including
|
|
414
|
+
* an `ssrSource` field
|
|
417
415
|
* (`"server"` | `"hybrid"` | `"client"`). See {@link HydrationSsrFields}.
|
|
418
416
|
*
|
|
419
417
|
* @returns `[store: Store<T>, setStore: StoreSetter<T>]`
|
|
420
418
|
*/
|
|
421
419
|
export declare const createOptimisticStore: {
|
|
422
420
|
<T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): [get: Store<T>, set: StoreSetter<T>];
|
|
423
|
-
<T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store: NoFn<T> | Store<NoFn<T>>, options?:
|
|
421
|
+
<T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store: NoFn<T> | Store<NoFn<T>>, options?: ProjectionOptions): [get: Refreshable<Store<T>>, set: StoreSetter<T>];
|
|
424
422
|
};
|
|
425
423
|
/**
|
|
426
424
|
* Creates a reactive computation that runs during the render phase as
|
package/types-cjs/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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, Refreshable, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter } from "@solidjs/signals";
|
|
2
|
+
export type { Accessor, ComputeFunction, EffectBundle, EffectFunction, EffectOptions, ExternalSource, ExternalSourceConfig, ExternalSourceFactory, Merge, MemoOptions, NoInfer, NotWrappable, Omit, Owner, ProjectionOptions, Refreshable, Signal, SignalOptions, SourceAccessor, Setter, Store, StoreOptions, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter } from "@solidjs/signals";
|
|
3
3
|
export { $DEVCOMP, children, createContext, useContext } from "./client/core.cjs";
|
|
4
4
|
export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedElement } from "./client/core.cjs";
|
|
5
5
|
export * from "./client/component.cjs";
|
|
@@ -8,8 +8,6 @@ export type { ArrayElement, Element } from "./types.cjs";
|
|
|
8
8
|
export { sharedConfig, enableHydration, createErrorBoundary, createLoadingBoundary, createMemo, createSignal, createStore, createProjection, createOptimistic, createOptimisticStore, createRenderEffect, createEffect, NoHydration, Hydration, NoHydrateContext } from "./client/hydration.cjs";
|
|
9
9
|
/** @internal */
|
|
10
10
|
export declare function ssrHandleError(): void;
|
|
11
|
-
/** @internal */
|
|
12
|
-
export declare function ssrRunInScope(): void;
|
|
13
11
|
import { type Dev } from "@solidjs/signals";
|
|
14
12
|
export declare const DEV: Dev | undefined;
|
|
15
13
|
declare global {
|
|
@@ -40,10 +40,3 @@ export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
|
40
40
|
* @returns a accessor of the same children, but resolved
|
|
41
41
|
*/
|
|
42
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)[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
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
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
|
|
3
|
+
export { $DEVCOMP, children, createContext, useContext } from "./core.cjs";
|
|
4
4
|
export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedElement } from "./core.cjs";
|
|
5
5
|
export * from "./component.cjs";
|
|
6
6
|
export * from "./flow.cjs";
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import type { Context } from "
|
|
1
|
+
import type { Context } from "./signals.cjs";
|
|
2
2
|
export type SSRTemplateObject = {
|
|
3
3
|
t: string[];
|
|
4
4
|
h: Function[];
|
|
5
5
|
p: Promise<any>[];
|
|
6
|
+
} | {
|
|
7
|
+
t: string;
|
|
8
|
+
h?: undefined;
|
|
9
|
+
p?: undefined;
|
|
6
10
|
};
|
|
7
11
|
export type HydrationContext = {
|
|
8
12
|
id: string;
|
|
@@ -1,9 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
import { $REFRESH } from "@solidjs/signals";
|
|
2
|
+
export { $REFRESH };
|
|
3
|
+
export { NotReadyError, NoOwnerError, ContextNotFoundError, isEqual, isWrappable, SUPPORTS_PROXY, enableExternalSource, enforceLoadingBoundary } from "@solidjs/signals";
|
|
2
4
|
export { flatten } from "@solidjs/signals";
|
|
3
|
-
export { snapshot, merge, omit, storePath, $PROXY, $
|
|
5
|
+
export { snapshot, merge, omit, storePath, $PROXY, $TRACK } from "@solidjs/signals";
|
|
6
|
+
import type { Accessor as SignalAccessor, Refreshable } from "@solidjs/signals";
|
|
7
|
+
export type SourceAccessor<T> = Refreshable<SignalAccessor<T>>;
|
|
4
8
|
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
9
|
import type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, MemoOptions, SignalOptions, Signal, Owner, Store, StoreSetter, Context } from "@solidjs/signals";
|
|
6
10
|
import { sharedConfig, NoHydrateContext } from "./shared.cjs";
|
|
11
|
+
type Disposable = () => void;
|
|
12
|
+
export declare function getNextChildId(owner: Owner): string;
|
|
13
|
+
export declare function createOwner(options?: {
|
|
14
|
+
id?: string;
|
|
15
|
+
transparent?: boolean;
|
|
16
|
+
}): Owner;
|
|
17
|
+
export declare function runWithOwner<T>(owner: Owner | null, fn: () => T): T;
|
|
18
|
+
export declare function getOwner(): Owner | null;
|
|
19
|
+
export declare function isDisposed(owner: Owner): boolean;
|
|
20
|
+
export declare function onCleanup(fn: Disposable): Disposable;
|
|
21
|
+
export declare function createContext<T>(defaultValue?: T, description?: string): Context<T>;
|
|
22
|
+
export declare function getContext<T>(context: Context<T>, owner?: Owner | null): T;
|
|
23
|
+
export declare function setContext<T>(context: Context<T>, value?: T, owner?: Owner | null): void;
|
|
24
|
+
/**
|
|
25
|
+
* Tears down `owner` (optionally) and all of its descendants. Walks the
|
|
26
|
+
* forward-only `_firstChild` -> `_nextSibling` chain, recursively disposing
|
|
27
|
+
* each child with `self=true`, then runs the owner's own `_disposal` queue
|
|
28
|
+
* and resets `_firstChild` / `_childCount`.
|
|
29
|
+
*
|
|
30
|
+
* `self=false` keeps `owner` itself alive (its `_disposed` flag stays clear,
|
|
31
|
+
* future `runWithOwner(owner, ...)` keeps working) but tears down its
|
|
32
|
+
* subtree. This is what `createErrorBoundary` and `createLoadingBoundary`
|
|
33
|
+
* use on retry — wipe the children, keep the boundary owner around for the
|
|
34
|
+
* re-run.
|
|
35
|
+
*
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export declare function disposeOwner(owner: Owner, self?: boolean): void;
|
|
39
|
+
export declare function createRoot<T>(init: ((dispose: () => void) => T) | (() => T), options?: {
|
|
40
|
+
id?: string;
|
|
41
|
+
transparent?: boolean;
|
|
42
|
+
}): T;
|
|
7
43
|
interface ServerComputation<T = any> {
|
|
8
44
|
owner: Owner;
|
|
9
45
|
value: T;
|
|
@@ -34,8 +70,8 @@ export declare function createSignal<T>(): Signal<T | undefined>;
|
|
|
34
70
|
export declare function createSignal<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>;
|
|
35
71
|
export declare function createSignal<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options: ServerClientSignalOptions<T>): Signal<T | undefined>;
|
|
36
72
|
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>):
|
|
38
|
-
export declare function createMemo<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options?: ServerMemoOptions<T>):
|
|
73
|
+
export declare function createMemo<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options: ServerClientMemoOptions<T>): SourceAccessor<T | undefined>;
|
|
74
|
+
export declare function createMemo<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options?: ServerMemoOptions<T>): SourceAccessor<T>;
|
|
39
75
|
export type PatchOp = [path: PropertyKey[]] | [path: PropertyKey[], value: any] | [path: PropertyKey[], value: any, insert: 1];
|
|
40
76
|
export declare function createDeepProxy<T extends object>(target: T, patches: PatchOp[], basePath?: PropertyKey[]): T;
|
|
41
77
|
export declare function createEffect<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, effect: EffectFunction<NoInfer<T>, T> | EffectBundle<NoInfer<T>, T>, options?: EffectOptions): void;
|
|
@@ -81,7 +117,7 @@ export declare function resolve<T>(fn: () => T): Promise<T>;
|
|
|
81
117
|
export declare function isPending(fn: () => any, fallback?: boolean): boolean;
|
|
82
118
|
export declare function latest<T>(fn: () => T): T;
|
|
83
119
|
export declare function isRefreshing(): boolean;
|
|
84
|
-
export declare function refresh<T>(
|
|
120
|
+
export declare function refresh<T>(_target: Refreshable<T>): void;
|
|
85
121
|
export declare function action<T extends (...args: any[]) => any>(fn: T): T;
|
|
86
122
|
export declare function onSettled(callback: () => void | (() => void)): void;
|
|
87
123
|
type NoInfer<T extends any> = [T][T extends any ? 0 : never];
|