solid-js 2.0.0-experimental.14 → 2.0.0-experimental.16
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 +502 -57
- package/dist/dev.js +484 -33
- package/dist/server.cjs +419 -77
- package/dist/server.js +408 -79
- package/dist/solid.cjs +486 -54
- package/dist/solid.js +468 -30
- package/package.json +2 -2
- package/types/client/component.d.ts +1 -1
- package/types/client/hydration.d.ts +43 -2
- package/types/index.d.ts +3 -3
- package/types/jsx.d.ts +5 -28
- package/types/server/component.d.ts +6 -2
- package/types/server/core.d.ts +3 -2
- package/types/server/index.d.ts +2 -2
- package/types/server/shared.d.ts +22 -1
- package/types/server/signals.d.ts +11 -5
package/types/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { $PROXY, $TRACK, action,
|
|
2
|
-
export type { Accessor, ComputeFunction, EffectFunction, EffectOptions, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter } from "@solidjs/signals";
|
|
1
|
+
export { $PROXY, $TRACK, action, createOwner, createReaction, createRoot, 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, untrack } from "@solidjs/signals";
|
|
2
|
+
export type { Accessor, ComputeFunction, EffectFunction, EffectOptions, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter } from "@solidjs/signals";
|
|
3
3
|
export { $DEVCOMP, children, createContext, useContext } from "./client/core.js";
|
|
4
4
|
export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedJSXElement } from "./client/core.js";
|
|
5
5
|
export * from "./client/component.js";
|
|
6
6
|
export * from "./client/flow.js";
|
|
7
|
-
export { sharedConfig, Loading, enableHydration, createMemo, createSignal, createStore, createProjection, createOptimistic, createOptimisticStore } from "./client/hydration.js";
|
|
7
|
+
export { sharedConfig, Loading, enableHydration, createMemo, createSignal, createStore, createProjection, createOptimistic, createOptimisticStore, createRenderEffect, createEffect } from "./client/hydration.js";
|
|
8
8
|
export declare function ssrHandleError(): void;
|
|
9
9
|
export declare function ssrRunInScope(): void;
|
|
10
10
|
import type { JSX } from "./jsx.js";
|
package/types/jsx.d.ts
CHANGED
|
@@ -232,40 +232,19 @@ export namespace JSX {
|
|
|
232
232
|
[SERIALIZABLE]: never;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
+
type RefCallback<T> = (el: T) => void;
|
|
236
|
+
type Ref<T> = T | RefCallback<T> | (RefCallback<T> | Ref<T>)[];
|
|
237
|
+
|
|
235
238
|
interface IntrinsicAttributes {
|
|
236
|
-
ref?: unknown |
|
|
239
|
+
ref?: Ref<unknown> | undefined;
|
|
237
240
|
}
|
|
238
241
|
interface CustomAttributes<T> {
|
|
239
|
-
ref?: T |
|
|
242
|
+
ref?: Ref<T> | undefined;
|
|
240
243
|
children?: Element | undefined;
|
|
241
244
|
$ServerOnly?: boolean | undefined;
|
|
242
245
|
}
|
|
243
|
-
type Accessor<T> = () => T;
|
|
244
|
-
interface Directives {}
|
|
245
|
-
interface DirectiveFunctions {
|
|
246
|
-
[x: string]: (el: DOMElement, accessor: Accessor<any>) => void;
|
|
247
|
-
}
|
|
248
246
|
interface ExplicitProperties {}
|
|
249
247
|
interface CustomEvents {}
|
|
250
|
-
type DirectiveAttributes = {
|
|
251
|
-
[Key in keyof Directives as `use:${Key}`]?: Directives[Key];
|
|
252
|
-
};
|
|
253
|
-
type DirectiveFunctionAttributes<T> = {
|
|
254
|
-
[K in keyof DirectiveFunctions as string extends K
|
|
255
|
-
? never
|
|
256
|
-
: `use:${K}`]?: DirectiveFunctions[K] extends (
|
|
257
|
-
el: infer E, // will be unknown if not provided
|
|
258
|
-
...rest: infer R // use rest so that we can check whether it's provided or not
|
|
259
|
-
) => void
|
|
260
|
-
? T extends E // everything extends unknown if E is unknown
|
|
261
|
-
? R extends [infer A] // check if has accessor provided
|
|
262
|
-
? A extends Accessor<infer V>
|
|
263
|
-
? V // it's an accessor
|
|
264
|
-
: never // it isn't, type error
|
|
265
|
-
: true // no accessor provided
|
|
266
|
-
: never // T is the wrong element
|
|
267
|
-
: never; // it isn't a function
|
|
268
|
-
};
|
|
269
248
|
type PropAttributes = {
|
|
270
249
|
[Key in keyof ExplicitProperties as `prop:${Key}`]?: ExplicitProperties[Key];
|
|
271
250
|
};
|
|
@@ -1033,8 +1012,6 @@ export namespace JSX {
|
|
|
1033
1012
|
*/
|
|
1034
1013
|
interface ElementAttributes<T>
|
|
1035
1014
|
extends CustomAttributes<T>,
|
|
1036
|
-
DirectiveAttributes,
|
|
1037
|
-
DirectiveFunctionAttributes<T>,
|
|
1038
1015
|
PropAttributes,
|
|
1039
1016
|
OnAttributes<T>,
|
|
1040
1017
|
EventHandlersElement<T>,
|
|
@@ -50,11 +50,15 @@ export type Ref<T> = T | ((val: T) => void);
|
|
|
50
50
|
export declare function createComponent<T extends Record<string, any>>(Comp: Component<T>, props: T): JSX.Element;
|
|
51
51
|
/**
|
|
52
52
|
* Lazy load a function component asynchronously.
|
|
53
|
-
* On server,
|
|
53
|
+
* On server, returns a createMemo that throws NotReadyError until the module resolves,
|
|
54
|
+
* allowing resolveSSRNode to capture it as a fine-grained hole. The memo naturally
|
|
55
|
+
* scopes the owner so hydration IDs align with the client's createMemo in lazy().
|
|
56
|
+
* Requires `moduleUrl` for SSR — the bundler plugin injects the module specifier
|
|
57
|
+
* so the server can look up client chunk URLs from the asset manifest.
|
|
54
58
|
*/
|
|
55
59
|
export declare function lazy<T extends Component<any>>(fn: () => Promise<{
|
|
56
60
|
default: T;
|
|
57
|
-
}
|
|
61
|
+
}>, moduleUrl?: string): T & {
|
|
58
62
|
preload: () => Promise<{
|
|
59
63
|
default: T;
|
|
60
64
|
}>;
|
package/types/server/core.d.ts
CHANGED
|
@@ -36,8 +36,9 @@ export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
|
36
36
|
*/
|
|
37
37
|
export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
39
|
+
* Pass-through for SSR dynamic expressions.
|
|
40
|
+
* On the client, insert() render effects are transparent (0 owner slots),
|
|
41
|
+
* so the server doesn't need to create owners for these either.
|
|
41
42
|
*/
|
|
42
43
|
export declare function ssrRunInScope(fn: () => any): () => any;
|
|
43
44
|
export declare function ssrRunInScope(array: (() => any)[]): (() => any)[];
|
package/types/server/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { $PROXY, $TRACK, action, createEffect, createMemo, createOptimistic, createOptimisticStore, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createTrackedEffect, deep, flatten, flush, getObserver, getOwner, isEqual, isRefreshing, isPending, isWrappable, mapArray, merge, omit, onCleanup, onSettled,
|
|
2
|
-
export type { Accessor, ComputeFunction, EffectFunction, EffectOptions, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter } from "./signals.js";
|
|
1
|
+
export { $PROXY, $TRACK, action, createEffect, createMemo, createOptimistic, createOptimisticStore, 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, untrack } from "./signals.js";
|
|
2
|
+
export type { Accessor, ComputeFunction, EffectFunction, EffectOptions, 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";
|
package/types/server/shared.d.ts
CHANGED
|
@@ -6,13 +6,34 @@ type SSRTemplateObject = {
|
|
|
6
6
|
export type HydrationContext = {
|
|
7
7
|
id: string;
|
|
8
8
|
count: number;
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Serialize a value for client hydration.
|
|
11
|
+
* In renderToStream (async: true), accepts promises and async iterables.
|
|
12
|
+
* In renderToString (async: false), only synchronous values are allowed —
|
|
13
|
+
* passing async values will throw.
|
|
14
|
+
*/
|
|
15
|
+
serialize: (id: string, v: any, deferStream?: boolean) => void;
|
|
10
16
|
resolve(value: any): SSRTemplateObject;
|
|
11
17
|
ssr(template: string[], ...values: any[]): SSRTemplateObject;
|
|
12
18
|
escape(value: any): string;
|
|
13
19
|
replace: (id: string, replacement: () => any) => void;
|
|
14
20
|
block: (p: Promise<any>) => void;
|
|
15
21
|
registerFragment: (v: string) => (v?: string, err?: any) => boolean;
|
|
22
|
+
/** Register a client-side asset URL discovered during SSR (e.g. from lazy()). */
|
|
23
|
+
registerAsset?: (type: "module" | "style", url: string) => void;
|
|
24
|
+
/** Register a moduleUrl-to-entryUrl mapping for the current boundary. */
|
|
25
|
+
registerModule?: (moduleUrl: string, entryUrl: string) => void;
|
|
26
|
+
/** Resolve a module's JS and CSS assets from the asset manifest. Set by dom-expressions. */
|
|
27
|
+
resolveAssets?: (moduleUrl: string) => {
|
|
28
|
+
js: string[];
|
|
29
|
+
css: string[];
|
|
30
|
+
} | null;
|
|
31
|
+
/** Retrieve the moduleUrl-to-entryUrl map for a boundary. */
|
|
32
|
+
getBoundaryModules?: (id: string) => Record<string, string> | null;
|
|
33
|
+
/** @internal Tracks which Loading boundary is currently rendering. Set by dom-expressions via applyAssetTracking(). */
|
|
34
|
+
_currentBoundaryId?: string | null;
|
|
35
|
+
assets: any[];
|
|
36
|
+
/** True only in renderToStream — enables async data serialization and streaming. */
|
|
16
37
|
async?: boolean;
|
|
17
38
|
noHydrate: boolean;
|
|
18
39
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createRoot, createOwner, runWithOwner, getOwner, onCleanup, getNextChildId, createContext, setContext, getContext, NotReadyError, NoOwnerError, ContextNotFoundError, isEqual, isWrappable, SUPPORTS_PROXY } from "@solidjs/signals";
|
|
2
2
|
export { flatten } from "@solidjs/signals";
|
|
3
|
-
export { snapshot, merge, omit, $PROXY, $TRACK } from "@solidjs/signals";
|
|
4
|
-
export type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, MemoOptions, NoInfer, SignalOptions, Setter, Signal, Owner, Maybe, Store, StoreSetter, StoreNode, NotWrappable, SolidStore, Merge, Omit, Context, ContextRecord, IQueue } from "@solidjs/signals";
|
|
3
|
+
export { snapshot, merge, omit, storePath, $PROXY, $TRACK } from "@solidjs/signals";
|
|
4
|
+
export type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, 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
6
|
interface ServerComputation<T = any> {
|
|
7
7
|
owner: Owner;
|
|
@@ -9,6 +9,7 @@ interface ServerComputation<T = any> {
|
|
|
9
9
|
compute: ComputeFunction<any, T>;
|
|
10
10
|
error: unknown;
|
|
11
11
|
computed: boolean;
|
|
12
|
+
disposed: boolean;
|
|
12
13
|
}
|
|
13
14
|
export declare function getObserver(): ServerComputation<any> | null;
|
|
14
15
|
export declare function createSignal<T>(): Signal<T | undefined>;
|
|
@@ -16,6 +17,8 @@ export declare function createSignal<T>(value: Exclude<T, Function>, options?: S
|
|
|
16
17
|
export declare function createSignal<T>(fn: ComputeFunction<T>, initialValue?: T, options?: SignalOptions<T>): Signal<T>;
|
|
17
18
|
export declare function createMemo<Next extends Prev, Prev = Next>(compute: ComputeFunction<undefined | NoInfer<Prev>, Next>): Accessor<Next>;
|
|
18
19
|
export declare function createMemo<Next extends Prev, Init = Next, Prev = Next>(compute: ComputeFunction<Init | Prev, Next>, value: Init, options?: MemoOptions<Next>): Accessor<Next>;
|
|
20
|
+
export type PatchOp = [path: PropertyKey[]] | [path: PropertyKey[], value: any] | [path: PropertyKey[], value: any, insert: 1];
|
|
21
|
+
export declare function createDeepProxy<T extends object>(target: T, patches: PatchOp[], basePath?: PropertyKey[]): T;
|
|
19
22
|
export declare function createEffect<Next>(compute: ComputeFunction<undefined | NoInfer<Next>, Next>, effectFn: EffectFunction<NoInfer<Next>, Next> | EffectBundle<NoInfer<Next>, Next>): void;
|
|
20
23
|
export declare function createEffect<Next, Init = Next>(compute: ComputeFunction<Init | Next, Next>, effect: EffectFunction<Next, Next> | EffectBundle<Next, Next>, value: Init, options?: EffectOptions): void;
|
|
21
24
|
export declare function createRenderEffect<Next>(compute: ComputeFunction<undefined | NoInfer<Next>, Next>, effectFn: EffectFunction<NoInfer<Next>, Next>): void;
|
|
@@ -25,9 +28,12 @@ export declare function createReaction(effectFn: EffectFunction<undefined> | Eff
|
|
|
25
28
|
export declare function createOptimistic<T>(): Signal<T | undefined>;
|
|
26
29
|
export declare function createOptimistic<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>;
|
|
27
30
|
export declare function createOptimistic<T>(fn: ComputeFunction<T>, initialValue?: T, options?: SignalOptions<T>): Signal<T>;
|
|
28
|
-
export declare function createStore<T extends object>(
|
|
31
|
+
export declare function createStore<T extends object>(first: T | Store<T> | ((store: T) => void | T | Promise<void | T>), second?: T | Store<T>): [get: Store<T>, set: StoreSetter<T>];
|
|
29
32
|
export declare const createOptimisticStore: typeof createStore;
|
|
30
|
-
export declare function createProjection<T extends object>(fn: (draft: T) => void
|
|
33
|
+
export declare function createProjection<T extends object>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue?: T, options?: {
|
|
34
|
+
deferStream?: boolean;
|
|
35
|
+
ssrSource?: string;
|
|
36
|
+
}): Store<T>;
|
|
31
37
|
export declare function reconcile<T extends U, U extends object>(value: T): (state: U) => T;
|
|
32
38
|
export declare function deep<T extends object>(store: Store<T>): Store<T>;
|
|
33
39
|
export declare function mapArray<T, U>(list: Accessor<readonly T[] | undefined | null | false>, mapFn: (v: Accessor<T>, i: Accessor<number>) => U, options?: {
|
|
@@ -46,7 +52,7 @@ export declare function untrack<T>(fn: () => T): T;
|
|
|
46
52
|
export declare function flush(): void;
|
|
47
53
|
export declare function resolve<T>(fn: () => T): Promise<T>;
|
|
48
54
|
export declare function isPending(fn: () => any, fallback?: boolean): boolean;
|
|
49
|
-
export declare function
|
|
55
|
+
export declare function latest<T>(fn: () => T): T;
|
|
50
56
|
export declare function isRefreshing(): boolean;
|
|
51
57
|
export declare function refresh<T>(fn: () => T): T;
|
|
52
58
|
export declare function action<T extends (...args: any[]) => any>(fn: T): T;
|