solid-js 2.0.0-beta.6 → 2.0.0-beta.8
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 +66 -104
- package/dist/dev.js +66 -104
- package/dist/server.cjs +331 -132
- package/dist/server.js +331 -132
- package/dist/solid.cjs +66 -104
- package/dist/solid.js +66 -104
- package/package.json +78 -30
- package/types/client/flow.d.ts +34 -13
- package/types/client/hydration.d.ts +35 -9
- package/types/jsx-properties.d.ts +92 -0
- package/types/jsx.d.ts +390 -314
- package/types/server/flow.d.ts +40 -7
- package/types/server/hydration.d.ts +18 -1
- package/types/server/signals.d.ts +33 -15
- 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 +163 -0
- package/types-cjs/client/hydration.d.cts +121 -0
- package/types-cjs/index.d.cts +17 -0
- package/types-cjs/jsx-properties.d.cts +92 -0
- package/types-cjs/jsx.d.cts +4294 -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 +115 -0
- package/types-cjs/server/hydration.d.cts +63 -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 +87 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createErrorBoundary as coreErrorBoundary,
|
|
1
|
+
import { createErrorBoundary as coreErrorBoundary, createRenderEffect as coreRenderEffect, createEffect as coreEffect, $REFRESH, type Accessor, type ComputeFunction, type MemoOptions, type NoInfer, type ProjectionOptions, type Signal, type SignalOptions, type Store, type StoreSetter, type Context } from "@solidjs/signals";
|
|
2
2
|
import { JSX } from "../jsx.js";
|
|
3
3
|
type HydrationSsrFields = {
|
|
4
4
|
deferStream?: boolean;
|
|
5
|
-
ssrSource?: "server" | "hybrid" | "
|
|
5
|
+
ssrSource?: "server" | "hybrid" | "client";
|
|
6
6
|
};
|
|
7
7
|
declare module "@solidjs/signals" {
|
|
8
8
|
interface MemoOptions<T> extends HydrationSsrFields {
|
|
@@ -13,7 +13,19 @@ declare module "@solidjs/signals" {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
export type HydrationProjectionOptions = ProjectionOptions & {
|
|
16
|
-
ssrSource?: "server" | "hybrid" | "
|
|
16
|
+
ssrSource?: "server" | "hybrid" | "client";
|
|
17
|
+
};
|
|
18
|
+
type HydrationClientMemoOptions<T> = Omit<MemoOptions<T>, "ssrSource"> & {
|
|
19
|
+
ssrSource: "client";
|
|
20
|
+
};
|
|
21
|
+
type HydrationMemoOptions<T> = Omit<MemoOptions<T>, "ssrSource"> & {
|
|
22
|
+
ssrSource?: "server" | "hybrid";
|
|
23
|
+
};
|
|
24
|
+
type HydrationClientSignalOptions<T> = Omit<SignalOptions<T> & MemoOptions<T>, "ssrSource"> & {
|
|
25
|
+
ssrSource: "client";
|
|
26
|
+
};
|
|
27
|
+
type HydrationSignalOptions<T> = Omit<SignalOptions<T> & MemoOptions<T>, "ssrSource"> & {
|
|
28
|
+
ssrSource?: "server" | "hybrid";
|
|
17
29
|
};
|
|
18
30
|
export type HydrationContext = {};
|
|
19
31
|
export declare const NoHydrateContext: Context<boolean>;
|
|
@@ -26,6 +38,7 @@ type SharedConfig = {
|
|
|
26
38
|
has?: (id: string) => boolean;
|
|
27
39
|
gather?: (key: string) => void;
|
|
28
40
|
cleanupFragment?: (id: string) => void;
|
|
41
|
+
loadModuleAssets?: (mapping: Record<string, string>) => Promise<void> | undefined;
|
|
29
42
|
registry?: Map<string, Element>;
|
|
30
43
|
completed?: WeakSet<Element> | null;
|
|
31
44
|
events?: any[] | null;
|
|
@@ -41,23 +54,36 @@ export declare const sharedConfig: SharedConfig;
|
|
|
41
54
|
*/
|
|
42
55
|
export declare function onHydrationEnd(callback: () => void): void;
|
|
43
56
|
export declare function enableHydration(): void;
|
|
44
|
-
export declare const createMemo:
|
|
45
|
-
|
|
57
|
+
export declare const createMemo: {
|
|
58
|
+
<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options: HydrationClientMemoOptions<T>): Accessor<T | undefined>;
|
|
59
|
+
<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>, options?: HydrationMemoOptions<T>): Accessor<T>;
|
|
60
|
+
};
|
|
61
|
+
export declare const createSignal: {
|
|
62
|
+
<T>(): Signal<T | undefined>;
|
|
63
|
+
<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>;
|
|
64
|
+
<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options: HydrationClientSignalOptions<T>): Signal<T | undefined>;
|
|
65
|
+
<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options?: HydrationSignalOptions<T>): Signal<T>;
|
|
66
|
+
};
|
|
46
67
|
export declare const createErrorBoundary: typeof coreErrorBoundary;
|
|
47
|
-
export declare const createOptimistic:
|
|
48
|
-
|
|
68
|
+
export declare const createOptimistic: {
|
|
69
|
+
<T>(): Signal<T | undefined>;
|
|
70
|
+
<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>;
|
|
71
|
+
<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options: HydrationClientSignalOptions<T>): Signal<T | undefined>;
|
|
72
|
+
<T>(fn: ComputeFunction<undefined | NoInfer<T>, T>, options?: HydrationSignalOptions<T>): Signal<T>;
|
|
73
|
+
};
|
|
74
|
+
export declare const createProjection: <T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue: T, options?: HydrationProjectionOptions) => Store<T> & {
|
|
49
75
|
[$REFRESH]: any;
|
|
50
76
|
};
|
|
51
77
|
type NoFn<T> = T extends Function ? never : T;
|
|
52
78
|
export declare const createStore: {
|
|
53
79
|
<T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): [get: Store<T>, set: StoreSetter<T>];
|
|
54
|
-
<T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store
|
|
80
|
+
<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> & {
|
|
55
81
|
[$REFRESH]: any;
|
|
56
82
|
}, set: StoreSetter<T>];
|
|
57
83
|
};
|
|
58
84
|
export declare const createOptimisticStore: {
|
|
59
85
|
<T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): [get: Store<T>, set: StoreSetter<T>];
|
|
60
|
-
<T extends object = {}>(fn: (store: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, store
|
|
86
|
+
<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> & {
|
|
61
87
|
[$REFRESH]: any;
|
|
62
88
|
}, set: StoreSetter<T>];
|
|
63
89
|
};
|
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
type WidenString<V> = string extends V ? string | number : V;
|
|
45
|
+
export type WidenPropValue<V> = [V] extends [string] ? WidenString<V> : V;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Structurally identical → `Y`; distinct → `N`. Used by `IsReadonlyKey` to detect
|
|
49
|
+
* readonly keys by comparing `Pick<T, K>` with `Readonly<Pick<T, K>>`.
|
|
50
|
+
*/
|
|
51
|
+
export type IfEquals<A, B, Y = unknown, N = never> =
|
|
52
|
+
(<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? Y : N;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* True when `K` is readonly on `T`. Singleton-constant properties (e.g.
|
|
56
|
+
* `tagName: "INPUT"`, `nodeType: 1`) are always `readonly` in `lib.dom.d.ts`, so this
|
|
57
|
+
* single check covers both readonly and singleton-literal cases.
|
|
58
|
+
*/
|
|
59
|
+
export type IsReadonlyKey<T, K extends keyof T> = IfEquals<
|
|
60
|
+
Pick<T, K>,
|
|
61
|
+
Readonly<Pick<T, K>>,
|
|
62
|
+
true,
|
|
63
|
+
false
|
|
64
|
+
>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Resolves to the `prop:K` string literal when `K` is a writable, element-specific
|
|
68
|
+
* property suitable for a `prop:*` attribute; otherwise resolves to `never` so the
|
|
69
|
+
* key is filtered out of the resulting mapped type.
|
|
70
|
+
*
|
|
71
|
+
* Filters out:
|
|
72
|
+
*
|
|
73
|
+
* - base-class keys (via `SkipPropsFrom`)
|
|
74
|
+
* - aria-* keys (already typed via `AriaAttributes`)
|
|
75
|
+
* - readonly keys
|
|
76
|
+
* - keys whose value types fall outside `PropValue`
|
|
77
|
+
* - the generic `string` index signature (e.g. `HTMLFormElement[name: string]: any`),
|
|
78
|
+
* which would otherwise shadow every key with an `any`-typed `prop:*`
|
|
79
|
+
*/
|
|
80
|
+
export type PropKey<T, K extends keyof T> = K extends keyof SkipPropsFrom
|
|
81
|
+
? never
|
|
82
|
+
: K extends string
|
|
83
|
+
? string extends K
|
|
84
|
+
? never
|
|
85
|
+
: K extends `aria${string}`
|
|
86
|
+
? never
|
|
87
|
+
: T[K] extends PropValue
|
|
88
|
+
? IsReadonlyKey<T, K> extends true
|
|
89
|
+
? never
|
|
90
|
+
: `prop:${K}`
|
|
91
|
+
: never
|
|
92
|
+
: never;
|