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
|
@@ -26,6 +26,7 @@ type SharedConfig = {
|
|
|
26
26
|
has?: (id: string) => boolean;
|
|
27
27
|
gather?: (key: string) => void;
|
|
28
28
|
cleanupFragment?: (id: string) => void;
|
|
29
|
+
loadModuleAssets?: (mapping: Record<string, string>) => Promise<void> | undefined;
|
|
29
30
|
registry?: Map<string, Element>;
|
|
30
31
|
completed?: WeakSet<Element> | null;
|
|
31
32
|
events?: any[] | null;
|
|
@@ -45,19 +46,19 @@ export declare const createMemo: typeof coreMemo;
|
|
|
45
46
|
export declare const createSignal: typeof coreSignal;
|
|
46
47
|
export declare const createErrorBoundary: typeof coreErrorBoundary;
|
|
47
48
|
export declare const createOptimistic: typeof coreOptimistic;
|
|
48
|
-
export declare const createProjection: <T extends object = {}>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue
|
|
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> & {
|
|
49
50
|
[$REFRESH]: any;
|
|
50
51
|
};
|
|
51
52
|
type NoFn<T> = T extends Function ? never : T;
|
|
52
53
|
export declare const createStore: {
|
|
53
54
|
<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
|
|
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> & {
|
|
55
56
|
[$REFRESH]: any;
|
|
56
57
|
}, set: StoreSetter<T>];
|
|
57
58
|
};
|
|
58
59
|
export declare const createOptimisticStore: {
|
|
59
60
|
<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
|
|
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> & {
|
|
61
62
|
[$REFRESH]: any;
|
|
62
63
|
}, set: StoreSetter<T>];
|
|
63
64
|
};
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { $PROXY, $REFRESH, $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, enableExternalSource, enforceLoadingBoundary, snapshot, storePath, untrack } from "@solidjs/signals";
|
|
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
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
3
|
export { $DEVCOMP, children, createContext, useContext } from "./client/core.js";
|
|
4
4
|
export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedJSXElement } from "./client/core.js";
|
|
@@ -10,11 +10,8 @@ export declare function ssrRunInScope(): void;
|
|
|
10
10
|
import type { JSX } from "./jsx.js";
|
|
11
11
|
type JSXElement = JSX.Element;
|
|
12
12
|
export type { JSXElement, JSX };
|
|
13
|
-
import {
|
|
14
|
-
export declare const DEV:
|
|
15
|
-
readonly hooks: {};
|
|
16
|
-
readonly registerGraph: typeof registerGraph;
|
|
17
|
-
} | undefined;
|
|
13
|
+
import { type Dev } from "@solidjs/signals";
|
|
14
|
+
export declare const DEV: Dev | undefined;
|
|
18
15
|
declare global {
|
|
19
16
|
var Solid$$: boolean;
|
|
20
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;
|