solid-js 1.8.22 → 1.9.0

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.
Files changed (59) hide show
  1. package/dist/dev.cjs +7 -6
  2. package/dist/dev.js +567 -325
  3. package/dist/server.cjs +1 -1
  4. package/dist/server.js +169 -75
  5. package/dist/solid.cjs +7 -6
  6. package/dist/solid.js +494 -283
  7. package/h/dist/h.js +40 -9
  8. package/h/jsx-runtime/dist/jsx.js +1 -1
  9. package/h/jsx-runtime/types/index.d.ts +13 -10
  10. package/h/jsx-runtime/types/jsx.d.ts +22 -1
  11. package/h/types/hyperscript.d.ts +11 -11
  12. package/h/types/index.d.ts +1 -1
  13. package/html/dist/html.cjs +4 -2
  14. package/html/dist/html.js +222 -95
  15. package/html/types/index.d.ts +1 -1
  16. package/html/types/lit.d.ts +52 -33
  17. package/package.json +1 -5
  18. package/store/dist/dev.cjs +1 -1
  19. package/store/dist/dev.js +123 -43
  20. package/store/dist/server.cjs +4 -0
  21. package/store/dist/server.js +23 -8
  22. package/store/dist/store.cjs +1 -1
  23. package/store/dist/store.js +114 -40
  24. package/store/package.json +0 -4
  25. package/store/types/index.d.ts +21 -7
  26. package/store/types/modifiers.d.ts +6 -3
  27. package/store/types/mutable.d.ts +5 -2
  28. package/store/types/server.d.ts +26 -5
  29. package/store/types/store.d.ts +219 -62
  30. package/types/index.d.ts +75 -10
  31. package/types/jsx.d.ts +35 -8
  32. package/types/reactive/array.d.ts +12 -4
  33. package/types/reactive/observable.d.ts +25 -17
  34. package/types/reactive/scheduler.d.ts +9 -6
  35. package/types/reactive/signal.d.ts +236 -143
  36. package/types/render/Suspense.d.ts +5 -5
  37. package/types/render/component.d.ts +64 -33
  38. package/types/render/flow.d.ts +43 -31
  39. package/types/render/hydration.d.ts +15 -15
  40. package/types/server/index.d.ts +57 -2
  41. package/types/server/reactive.d.ts +73 -42
  42. package/types/server/rendering.d.ts +169 -98
  43. package/universal/dist/dev.js +28 -12
  44. package/universal/dist/universal.js +28 -12
  45. package/universal/types/index.d.ts +3 -1
  46. package/universal/types/universal.d.ts +0 -1
  47. package/web/dist/dev.cjs +57 -24
  48. package/web/dist/dev.js +679 -101
  49. package/web/dist/server.cjs +96 -15
  50. package/web/dist/server.js +676 -105
  51. package/web/dist/web.cjs +53 -23
  52. package/web/dist/web.js +664 -99
  53. package/web/package.json +0 -4
  54. package/web/storage/dist/storage.js +3 -3
  55. package/web/types/client.d.ts +5 -3
  56. package/web/types/core.d.ts +10 -1
  57. package/web/types/index.d.ts +27 -10
  58. package/web/types/server-mock.d.ts +47 -32
  59. package/web/types/server.d.ts +88 -0
@@ -1,22 +1,38 @@
1
- export declare const $RAW: unique symbol, $NODE: unique symbol, $HAS: unique symbol, $SELF: unique symbol;
1
+ export declare const $RAW: unique symbol,
2
+ $NODE: unique symbol,
3
+ $HAS: unique symbol,
4
+ $SELF: unique symbol;
2
5
  export declare const DevHooks: {
3
- onStoreNodeUpdate: OnStoreNodeUpdate | null;
6
+ onStoreNodeUpdate: OnStoreNodeUpdate | null;
4
7
  };
5
8
  type DataNode = {
6
- (): any;
7
- $(value?: any): void;
9
+ (): any;
10
+ $(value?: any): void;
8
11
  };
9
- type DataNodes = Record<PropertyKey, DataNode | undefined>;
10
- export type OnStoreNodeUpdate = (state: StoreNode, property: PropertyKey, value: StoreNode | NotWrappable, prev: StoreNode | NotWrappable) => void;
12
+ export type DataNodes = Record<PropertyKey, DataNode | undefined>;
13
+ export type OnStoreNodeUpdate = (
14
+ state: StoreNode,
15
+ property: PropertyKey,
16
+ value: StoreNode | NotWrappable,
17
+ prev: StoreNode | NotWrappable
18
+ ) => void;
11
19
  export interface StoreNode {
12
- [$NODE]?: DataNodes;
13
- [key: PropertyKey]: any;
20
+ [$NODE]?: DataNodes;
21
+ [key: PropertyKey]: any;
14
22
  }
15
23
  export declare namespace SolidStore {
16
- interface Unwrappable {
17
- }
24
+ interface Unwrappable {}
18
25
  }
19
- export type NotWrappable = string | number | bigint | symbol | boolean | Function | null | undefined | SolidStore.Unwrappable[keyof SolidStore.Unwrappable];
26
+ export type NotWrappable =
27
+ | string
28
+ | number
29
+ | bigint
30
+ | symbol
31
+ | boolean
32
+ | Function
33
+ | null
34
+ | undefined
35
+ | SolidStore.Unwrappable[keyof SolidStore.Unwrappable];
20
36
  export type Store<T> = T;
21
37
  export declare function isWrappable<T>(obj: T | NotWrappable): obj is T;
22
38
  /**
@@ -33,74 +49,215 @@ export declare function isWrappable<T>(obj: T | NotWrappable): obj is T;
33
49
  export declare function unwrap<T>(item: T, set?: Set<unknown>): T;
34
50
  export declare function getNodes(target: StoreNode, symbol: typeof $NODE | typeof $HAS): DataNodes;
35
51
  export declare function getNode(nodes: DataNodes, property: PropertyKey, value?: any): DataNode;
36
- export declare function proxyDescriptor(target: StoreNode, property: PropertyKey): TypedPropertyDescriptor<any> | undefined;
52
+ export declare function proxyDescriptor(
53
+ target: StoreNode,
54
+ property: PropertyKey
55
+ ): TypedPropertyDescriptor<any> | undefined;
37
56
  export declare function trackSelf(target: StoreNode): void;
38
57
  export declare function ownKeys(target: StoreNode): (string | symbol)[];
39
- export declare function setProperty(state: StoreNode, property: PropertyKey, value: any, deleting?: boolean): void;
40
- export declare function updatePath(current: StoreNode, path: any[], traversed?: PropertyKey[]): void;
58
+ export declare function setProperty(
59
+ state: StoreNode,
60
+ property: PropertyKey,
61
+ value: any,
62
+ deleting?: boolean
63
+ ): void;
64
+ export declare function updatePath(
65
+ current: StoreNode,
66
+ path: any[],
67
+ traversed?: PropertyKey[]
68
+ ): void;
41
69
  /** @deprecated */
42
- export type DeepReadonly<T> = 0 extends 1 & T ? T : T extends NotWrappable ? T : {
43
- readonly [K in keyof T]: DeepReadonly<T[K]>;
44
- };
70
+ export type DeepReadonly<T> = 0 extends 1 & T
71
+ ? T
72
+ : T extends NotWrappable
73
+ ? T
74
+ : {
75
+ readonly [K in keyof T]: DeepReadonly<T[K]>;
76
+ };
45
77
  /** @deprecated */
46
- export type DeepMutable<T> = 0 extends 1 & T ? T : T extends NotWrappable ? T : {
47
- -readonly [K in keyof T]: DeepMutable<T[K]>;
48
- };
49
- export type CustomPartial<T> = T extends readonly unknown[] ? "0" extends keyof T ? {
50
- [K in Extract<keyof T, `${number}`>]?: T[K];
51
- } : {
52
- [x: number]: T[number];
53
- } : Partial<T>;
78
+ export type DeepMutable<T> = 0 extends 1 & T
79
+ ? T
80
+ : T extends NotWrappable
81
+ ? T
82
+ : {
83
+ -readonly [K in keyof T]: DeepMutable<T[K]>;
84
+ };
85
+ export type CustomPartial<T> = T extends readonly unknown[]
86
+ ? "0" extends keyof T
87
+ ? {
88
+ [K in Extract<keyof T, `${number}`>]?: T[K];
89
+ }
90
+ : {
91
+ [x: number]: T[number];
92
+ }
93
+ : Partial<T>;
54
94
  export type PickMutable<T> = {
55
- [K in keyof T as (<U>() => U extends {
56
- [V in K]: T[V];
57
- } ? 1 : 2) extends <U>() => U extends {
58
- -readonly [V in K]: T[V];
59
- } ? 1 : 2 ? K : never]: T[K];
95
+ [K in keyof T as (<U>() => U extends {
96
+ [V in K]: T[V];
97
+ }
98
+ ? 1
99
+ : 2) extends <U>() => U extends {
100
+ -readonly [V in K]: T[V];
101
+ }
102
+ ? 1
103
+ : 2
104
+ ? K
105
+ : never]: T[K];
60
106
  };
61
107
  export type StorePathRange = {
62
- from?: number;
63
- to?: number;
64
- by?: number;
108
+ from?: number;
109
+ to?: number;
110
+ by?: number;
65
111
  };
66
112
  export type ArrayFilterFn<T> = (item: T, index: number) => boolean;
67
- export type StoreSetter<T, U extends PropertyKey[] = []> = T | CustomPartial<T> | ((prevState: T, traversed: U) => T | CustomPartial<T>);
68
- export type Part<T, K extends KeyOf<T> = KeyOf<T>> = K | ([K] extends [never] ? never : readonly K[]) | ([T] extends [readonly unknown[]] ? ArrayFilterFn<T[number]> | StorePathRange : never);
113
+ export type StoreSetter<T, U extends PropertyKey[] = []> =
114
+ | T
115
+ | CustomPartial<T>
116
+ | ((prevState: T, traversed: U) => T | CustomPartial<T>);
117
+ export type Part<T, K extends KeyOf<T> = KeyOf<T>> =
118
+ | K
119
+ | ([K] extends [never] ? never : readonly K[])
120
+ | ([T] extends [readonly unknown[]] ? ArrayFilterFn<T[number]> | StorePathRange : never);
69
121
  type W<T> = Exclude<T, NotWrappable>;
70
- type KeyOf<T> = number extends keyof T ? 0 extends 1 & T ? keyof T : [T] extends [never] ? never : [
71
- T
72
- ] extends [readonly unknown[]] ? number : keyof T : keyof T;
122
+ type KeyOf<T> = number extends keyof T
123
+ ? 0 extends 1 & T
124
+ ? keyof T
125
+ : [T] extends [never]
126
+ ? never
127
+ : [T] extends [readonly unknown[]]
128
+ ? number
129
+ : keyof T
130
+ : keyof T;
73
131
  type MutableKeyOf<T> = KeyOf<T> & keyof PickMutable<T>;
74
- type Rest<T, U extends PropertyKey[], K extends KeyOf<T> = KeyOf<T>> = [T] extends [never] ? never : K extends MutableKeyOf<T> ? [Part<T, K>, ...RestSetterOrContinue<T[K], [K, ...U]>] : K extends KeyOf<T> ? [Part<T, K>, ...RestContinue<T[K], [K, ...U]>] : never;
75
- type RestContinue<T, U extends PropertyKey[]> = 0 extends 1 & T ? [...Part<any>[], StoreSetter<any, PropertyKey[]>] : Rest<W<T>, U>;
132
+ type Rest<T, U extends PropertyKey[], K extends KeyOf<T> = KeyOf<T>> = [T] extends [never]
133
+ ? never
134
+ : K extends MutableKeyOf<T>
135
+ ? [Part<T, K>, ...RestSetterOrContinue<T[K], [K, ...U]>]
136
+ : K extends KeyOf<T>
137
+ ? [Part<T, K>, ...RestContinue<T[K], [K, ...U]>]
138
+ : never;
139
+ type RestContinue<T, U extends PropertyKey[]> = 0 extends 1 & T
140
+ ? [...Part<any>[], StoreSetter<any, PropertyKey[]>]
141
+ : Rest<W<T>, U>;
76
142
  type RestSetterOrContinue<T, U extends PropertyKey[]> = [StoreSetter<T, U>] | RestContinue<T, U>;
77
143
  export interface SetStoreFunction<T> {
78
- <K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>, K6 extends KeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>, K7 extends MutableKeyOf<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>, k7: Part<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, K7>, setter: StoreSetter<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7], [
79
- K7,
80
- K6,
81
- K5,
82
- K4,
83
- K3,
84
- K2,
85
- K1
86
- ]>): void;
87
- <K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>, K6 extends MutableKeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>, setter: StoreSetter<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6], [K6, K5, K4, K3, K2, K1]>): void;
88
- <K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends MutableKeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, setter: StoreSetter<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5], [K5, K4, K3, K2, K1]>): void;
89
- <K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends MutableKeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, setter: StoreSetter<W<W<W<W<T>[K1]>[K2]>[K3]>[K4], [K4, K3, K2, K1]>): void;
90
- <K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends MutableKeyOf<W<W<W<T>[K1]>[K2]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, setter: StoreSetter<W<W<W<T>[K1]>[K2]>[K3], [K3, K2, K1]>): void;
91
- <K1 extends KeyOf<W<T>>, K2 extends MutableKeyOf<W<W<T>[K1]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, setter: StoreSetter<W<W<T>[K1]>[K2], [K2, K1]>): void;
92
- <K1 extends MutableKeyOf<W<T>>>(k1: Part<W<T>, K1>, setter: StoreSetter<W<T>[K1], [K1]>): void;
93
- (setter: StoreSetter<T, []>): void;
94
- <K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>, K6 extends KeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>, K7 extends KeyOf<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>, k7: Part<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, K7>, ...rest: Rest<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7], [K7, K6, K5, K4, K3, K2, K1]>): void;
144
+ <
145
+ K1 extends KeyOf<W<T>>,
146
+ K2 extends KeyOf<W<W<T>[K1]>>,
147
+ K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>,
148
+ K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>,
149
+ K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>,
150
+ K6 extends KeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>,
151
+ K7 extends MutableKeyOf<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>>
152
+ >(
153
+ k1: Part<W<T>, K1>,
154
+ k2: Part<W<W<T>[K1]>, K2>,
155
+ k3: Part<W<W<W<T>[K1]>[K2]>, K3>,
156
+ k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>,
157
+ k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>,
158
+ k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>,
159
+ k7: Part<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, K7>,
160
+ setter: StoreSetter<
161
+ W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7],
162
+ [K7, K6, K5, K4, K3, K2, K1]
163
+ >
164
+ ): void;
165
+ <
166
+ K1 extends KeyOf<W<T>>,
167
+ K2 extends KeyOf<W<W<T>[K1]>>,
168
+ K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>,
169
+ K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>,
170
+ K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>,
171
+ K6 extends MutableKeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>
172
+ >(
173
+ k1: Part<W<T>, K1>,
174
+ k2: Part<W<W<T>[K1]>, K2>,
175
+ k3: Part<W<W<W<T>[K1]>[K2]>, K3>,
176
+ k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>,
177
+ k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>,
178
+ k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>,
179
+ setter: StoreSetter<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6], [K6, K5, K4, K3, K2, K1]>
180
+ ): void;
181
+ <
182
+ K1 extends KeyOf<W<T>>,
183
+ K2 extends KeyOf<W<W<T>[K1]>>,
184
+ K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>,
185
+ K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>,
186
+ K5 extends MutableKeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>
187
+ >(
188
+ k1: Part<W<T>, K1>,
189
+ k2: Part<W<W<T>[K1]>, K2>,
190
+ k3: Part<W<W<W<T>[K1]>[K2]>, K3>,
191
+ k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>,
192
+ k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>,
193
+ setter: StoreSetter<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5], [K5, K4, K3, K2, K1]>
194
+ ): void;
195
+ <
196
+ K1 extends KeyOf<W<T>>,
197
+ K2 extends KeyOf<W<W<T>[K1]>>,
198
+ K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>,
199
+ K4 extends MutableKeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>
200
+ >(
201
+ k1: Part<W<T>, K1>,
202
+ k2: Part<W<W<T>[K1]>, K2>,
203
+ k3: Part<W<W<W<T>[K1]>[K2]>, K3>,
204
+ k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>,
205
+ setter: StoreSetter<W<W<W<W<T>[K1]>[K2]>[K3]>[K4], [K4, K3, K2, K1]>
206
+ ): void;
207
+ <
208
+ K1 extends KeyOf<W<T>>,
209
+ K2 extends KeyOf<W<W<T>[K1]>>,
210
+ K3 extends MutableKeyOf<W<W<W<T>[K1]>[K2]>>
211
+ >(
212
+ k1: Part<W<T>, K1>,
213
+ k2: Part<W<W<T>[K1]>, K2>,
214
+ k3: Part<W<W<W<T>[K1]>[K2]>, K3>,
215
+ setter: StoreSetter<W<W<W<T>[K1]>[K2]>[K3], [K3, K2, K1]>
216
+ ): void;
217
+ <K1 extends KeyOf<W<T>>, K2 extends MutableKeyOf<W<W<T>[K1]>>>(
218
+ k1: Part<W<T>, K1>,
219
+ k2: Part<W<W<T>[K1]>, K2>,
220
+ setter: StoreSetter<W<W<T>[K1]>[K2], [K2, K1]>
221
+ ): void;
222
+ <K1 extends MutableKeyOf<W<T>>>(k1: Part<W<T>, K1>, setter: StoreSetter<W<T>[K1], [K1]>): void;
223
+ (setter: StoreSetter<T, []>): void;
224
+ <
225
+ K1 extends KeyOf<W<T>>,
226
+ K2 extends KeyOf<W<W<T>[K1]>>,
227
+ K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>,
228
+ K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>,
229
+ K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>,
230
+ K6 extends KeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>,
231
+ K7 extends KeyOf<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>>
232
+ >(
233
+ k1: Part<W<T>, K1>,
234
+ k2: Part<W<W<T>[K1]>, K2>,
235
+ k3: Part<W<W<W<T>[K1]>[K2]>, K3>,
236
+ k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>,
237
+ k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>,
238
+ k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>,
239
+ k7: Part<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, K7>,
240
+ ...rest: Rest<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7], [K7, K6, K5, K4, K3, K2, K1]>
241
+ ): void;
95
242
  }
96
243
  /**
97
244
  * Creates a reactive store that can be read through a proxy object and written with a setter function
98
245
  *
99
246
  * @description https://docs.solidjs.com/reference/store-utilities/create-store
100
247
  */
101
- export declare function createStore<T extends object = {}>(...[store, options]: {} extends T ? [store?: T | Store<T>, options?: {
102
- name?: string;
103
- }] : [store: T | Store<T>, options?: {
104
- name?: string;
105
- }]): [get: Store<T>, set: SetStoreFunction<T>];
248
+ export declare function createStore<T extends object = {}>(
249
+ ...[store, options]: {} extends T
250
+ ? [
251
+ store?: T | Store<T>,
252
+ options?: {
253
+ name?: string;
254
+ }
255
+ ]
256
+ : [
257
+ store: T | Store<T>,
258
+ options?: {
259
+ name?: string;
260
+ }
261
+ ]
262
+ ): [get: Store<T>, set: SetStoreFunction<T>];
106
263
  export {};
package/types/index.d.ts CHANGED
@@ -1,5 +1,66 @@
1
- export { $DEVCOMP, $PROXY, $TRACK, batch, catchError, children, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, enableExternalSource, enableScheduling, equalFn, getListener, getOwner, on, onCleanup, onError, onMount, runWithOwner, startTransition, untrack, useContext, useTransition } from "./reactive/signal.js";
2
- export type { Accessor, AccessorArray, ChildrenReturn, Context, ContextProviderComponent, EffectFunction, EffectOptions, InitializedResource, InitializedResourceOptions, InitializedResourceReturn, MemoOptions, NoInfer, OnEffectFunction, OnOptions, Owner, ResolvedChildren, ResolvedJSXElement, Resource, ResourceActions, ResourceFetcher, ResourceFetcherInfo, ResourceOptions, ResourceReturn, ResourceSource, ReturnTypes, Setter, Signal, SignalOptions } from "./reactive/signal.js";
1
+ export {
2
+ $DEVCOMP,
3
+ $PROXY,
4
+ $TRACK,
5
+ batch,
6
+ catchError,
7
+ children,
8
+ createComputed,
9
+ createContext,
10
+ createDeferred,
11
+ createEffect,
12
+ createMemo,
13
+ createReaction,
14
+ createRenderEffect,
15
+ createResource,
16
+ createRoot,
17
+ createSelector,
18
+ createSignal,
19
+ enableExternalSource,
20
+ enableScheduling,
21
+ equalFn,
22
+ getListener,
23
+ getOwner,
24
+ on,
25
+ onCleanup,
26
+ onError,
27
+ onMount,
28
+ runWithOwner,
29
+ startTransition,
30
+ untrack,
31
+ useContext,
32
+ useTransition
33
+ } from "./reactive/signal.js";
34
+ export type {
35
+ Accessor,
36
+ AccessorArray,
37
+ ChildrenReturn,
38
+ Context,
39
+ ContextProviderComponent,
40
+ EffectFunction,
41
+ EffectOptions,
42
+ InitializedResource,
43
+ InitializedResourceOptions,
44
+ InitializedResourceReturn,
45
+ MemoOptions,
46
+ NoInfer,
47
+ OnEffectFunction,
48
+ OnOptions,
49
+ Owner,
50
+ ResolvedChildren,
51
+ ResolvedJSXElement,
52
+ Resource,
53
+ ResourceActions,
54
+ ResourceFetcher,
55
+ ResourceFetcherInfo,
56
+ ResourceOptions,
57
+ ResourceReturn,
58
+ ResourceSource,
59
+ ReturnTypes,
60
+ Setter,
61
+ Signal,
62
+ SignalOptions
63
+ } from "./reactive/signal.js";
3
64
  export * from "./reactive/observable.js";
4
65
  export * from "./reactive/scheduler.js";
5
66
  export * from "./reactive/array.js";
@@ -8,15 +69,19 @@ import type { JSX } from "./jsx.js";
8
69
  type JSXElement = JSX.Element;
9
70
  export type { JSXElement, JSX };
10
71
  import { registerGraph, writeSignal } from "./reactive/signal.js";
11
- export declare const DEV: {
12
- readonly hooks: {
72
+ export declare const DEV:
73
+ | {
74
+ readonly hooks: {
13
75
  afterUpdate: (() => void) | null;
14
76
  afterCreateOwner: ((owner: import("./reactive/signal.js").Owner) => void) | null;
15
- afterCreateSignal: ((signal: import("./reactive/signal.js").SignalState<any>) => void) | null;
16
- };
17
- readonly writeSignal: typeof writeSignal;
18
- readonly registerGraph: typeof registerGraph;
19
- } | undefined;
77
+ afterCreateSignal:
78
+ | ((signal: import("./reactive/signal.js").SignalState<any>) => void)
79
+ | null;
80
+ };
81
+ readonly writeSignal: typeof writeSignal;
82
+ readonly registerGraph: typeof registerGraph;
83
+ }
84
+ | undefined;
20
85
  declare global {
21
- var Solid$$: boolean;
86
+ var Solid$$: boolean;
22
87
  }
package/types/jsx.d.ts CHANGED
@@ -28,6 +28,7 @@ export namespace JSX {
28
28
  }
29
29
  ): void;
30
30
  }
31
+
31
32
  interface BoundEventHandler<T, E extends Event> {
32
33
  0: (
33
34
  data: any,
@@ -40,6 +41,19 @@ export namespace JSX {
40
41
  }
41
42
  type EventHandlerUnion<T, E extends Event> = EventHandler<T, E> | BoundEventHandler<T, E>;
42
43
 
44
+ interface EventHandlerWithOptions<T, E extends Event> extends AddEventListenerOptions {
45
+ handleEvent: (
46
+ e: E & {
47
+ currentTarget: T;
48
+ target: Element;
49
+ }
50
+ ) => void;
51
+ }
52
+
53
+ type CustomEventHandlerUnion<T, E extends Event> =
54
+ | EventHandler<T, E>
55
+ | EventHandlerWithOptions<T, E>;
56
+
43
57
  interface InputEventHandler<T, E extends InputEvent> {
44
58
  (
45
59
  e: E & {
@@ -141,7 +155,11 @@ export namespace JSX {
141
155
  }
142
156
  interface ExplicitProperties {}
143
157
  interface ExplicitAttributes {}
158
+ interface ExplicitBoolAttributes {}
144
159
  interface CustomEvents {}
160
+ /**
161
+ * @deprecated Replaced by CustomEvents
162
+ */
145
163
  interface CustomCaptureEvents {}
146
164
  type DirectiveAttributes = {
147
165
  [Key in keyof Directives as `use:${Key}`]?: Directives[Key];
@@ -168,8 +186,11 @@ export namespace JSX {
168
186
  type AttrAttributes = {
169
187
  [Key in keyof ExplicitAttributes as `attr:${Key}`]?: ExplicitAttributes[Key];
170
188
  };
189
+ type BoolAttributes = {
190
+ [Key in keyof ExplicitBoolAttributes as `bool:${Key}`]?: ExplicitBoolAttributes[Key];
191
+ };
171
192
  type OnAttributes<T> = {
172
- [Key in keyof CustomEvents as `on:${Key}`]?: EventHandler<T, CustomEvents[Key]>;
193
+ [Key in keyof CustomEvents as `on:${Key}`]?: CustomEventHandlerUnion<T, CustomEvents[Key]>;
173
194
  };
174
195
  type OnCaptureAttributes<T> = {
175
196
  [Key in keyof CustomCaptureEvents as `oncapture:${Key}`]?: EventHandler<
@@ -600,7 +621,8 @@ export namespace JSX {
600
621
  | "removals text"
601
622
  | "text"
602
623
  | "text additions"
603
- | "text removals";
624
+ | "text removals"
625
+ | undefined;
604
626
  /** Indicates that user input is required on the element before a form may be submitted. */
605
627
  "aria-required"?: boolean | "false" | "true" | undefined;
606
628
  /** Defines a human-readable, author-localized description for the role of an element. */
@@ -713,7 +735,8 @@ export namespace JSX {
713
735
  | "tooltip"
714
736
  | "tree"
715
737
  | "treegrid"
716
- | "treeitem";
738
+ | "treeitem"
739
+ | undefined;
717
740
  }
718
741
 
719
742
  // TODO: Should we allow this?
@@ -1312,7 +1335,8 @@ export namespace JSX {
1312
1335
  | "alphabetic"
1313
1336
  | "hanging"
1314
1337
  | "mathematical"
1315
- | "inherit";
1338
+ | "inherit"
1339
+ | undefined;
1316
1340
  "baseline-shift"?: number | string | undefined;
1317
1341
  clip?: string | undefined;
1318
1342
  "clip-path"?: string | undefined;
@@ -1335,7 +1359,8 @@ export namespace JSX {
1335
1359
  | "mathematical"
1336
1360
  | "hanging"
1337
1361
  | "text-top"
1338
- | "inherit";
1362
+ | "inherit"
1363
+ | undefined;
1339
1364
  "enable-background"?: string | undefined;
1340
1365
  fill?: string | undefined;
1341
1366
  "fill-opacity"?: number | string | "inherit" | undefined;
@@ -1375,7 +1400,8 @@ export namespace JSX {
1375
1400
  | "stroke"
1376
1401
  | "all"
1377
1402
  | "none"
1378
- | "inherit";
1403
+ | "inherit"
1404
+ | undefined;
1379
1405
  "shape-rendering"?:
1380
1406
  | "auto"
1381
1407
  | "optimizeSpeed"
@@ -1407,7 +1433,8 @@ export namespace JSX {
1407
1433
  | "optimizeSpeed"
1408
1434
  | "optimizeLegibility"
1409
1435
  | "geometricPrecision"
1410
- | "inherit";
1436
+ | "inherit"
1437
+ | undefined;
1411
1438
  "unicode-bidi"?: string | undefined;
1412
1439
  visibility?: "visible" | "hidden" | "collapse" | "inherit" | undefined;
1413
1440
  "word-spacing"?: number | string | undefined;
@@ -2103,7 +2130,7 @@ export namespace JSX {
2103
2130
  main: HTMLAttributes<HTMLElement>;
2104
2131
  map: MapHTMLAttributes<HTMLMapElement>;
2105
2132
  mark: HTMLAttributes<HTMLElement>;
2106
- menu: MenuHTMLAttributes<HTMLElement>;
2133
+ menu: MenuHTMLAttributes<HTMLMenuElement>;
2107
2134
  meta: MetaHTMLAttributes<HTMLMetaElement>;
2108
2135
  meter: MeterHTMLAttributes<HTMLElement>;
2109
2136
  nav: HTMLAttributes<HTMLElement>;
@@ -29,9 +29,13 @@ SOFTWARE.
29
29
  *
30
30
  * @description https://docs.solidjs.com/reference/reactive-utilities/map-array
31
31
  */
32
- export declare function mapArray<T, U>(list: Accessor<readonly T[] | undefined | null | false>, mapFn: (v: T, i: Accessor<number>) => U, options?: {
32
+ export declare function mapArray<T, U>(
33
+ list: Accessor<readonly T[] | undefined | null | false>,
34
+ mapFn: (v: T, i: Accessor<number>) => U,
35
+ options?: {
33
36
  fallback?: Accessor<any>;
34
- }): () => U[];
37
+ }
38
+ ): () => U[];
35
39
  /**
36
40
  * Reactively maps arrays by index instead of value - underlying helper for the `<Index>` control flow
37
41
  *
@@ -39,6 +43,10 @@ export declare function mapArray<T, U>(list: Accessor<readonly T[] | undefined |
39
43
  *
40
44
  * @description https://docs.solidjs.com/reference/reactive-utilities/index-array
41
45
  */
42
- export declare function indexArray<T, U>(list: Accessor<readonly T[] | undefined | null | false>, mapFn: (v: Accessor<T>, i: number) => U, options?: {
46
+ export declare function indexArray<T, U>(
47
+ list: Accessor<readonly T[] | undefined | null | false>,
48
+ mapFn: (v: Accessor<T>, i: number) => U,
49
+ options?: {
43
50
  fallback?: Accessor<any>;
44
- }): () => U[];
51
+ }
52
+ ): () => U[];
@@ -1,20 +1,22 @@
1
1
  import { Accessor, Setter } from "./signal.js";
2
2
  declare global {
3
- interface SymbolConstructor {
4
- readonly observable: symbol;
5
- }
3
+ interface SymbolConstructor {
4
+ readonly observable: symbol;
5
+ }
6
6
  }
7
7
  interface Observable<T> {
8
- subscribe(observer: ObservableObserver<T>): {
9
- unsubscribe(): void;
10
- };
11
- [Symbol.observable](): Observable<T>;
8
+ subscribe(observer: ObservableObserver<T>): {
9
+ unsubscribe(): void;
10
+ };
11
+ [Symbol.observable](): Observable<T>;
12
12
  }
13
- export type ObservableObserver<T> = ((v: T) => void) | {
14
- next?: (v: T) => void;
15
- error?: (v: any) => void;
16
- complete?: (v: boolean) => void;
17
- };
13
+ export type ObservableObserver<T> =
14
+ | ((v: T) => void)
15
+ | {
16
+ next?: (v: T) => void;
17
+ error?: (v: any) => void;
18
+ complete?: (v: boolean) => void;
19
+ };
18
20
  /**
19
21
  * Creates a simple observable from a signal's accessor to be used with the `from` operator of observable libraries like e.g. rxjs
20
22
  * ```typescript
@@ -26,9 +28,15 @@ export type ObservableObserver<T> = ((v: T) => void) | {
26
28
  * description https://docs.solidjs.com/reference/reactive-utilities/observable
27
29
  */
28
30
  export declare function observable<T>(input: Accessor<T>): Observable<T>;
29
- export declare function from<T>(producer: ((setter: Setter<T | undefined>) => () => void) | {
30
- subscribe: (fn: (v: T) => void) => (() => void) | {
31
- unsubscribe: () => void;
32
- };
33
- }): Accessor<T | undefined>;
31
+ export declare function from<T>(
32
+ producer:
33
+ | ((setter: Setter<T | undefined>) => () => void)
34
+ | {
35
+ subscribe: (fn: (v: T) => void) =>
36
+ | (() => void)
37
+ | {
38
+ unsubscribe: () => void;
39
+ };
40
+ }
41
+ ): Accessor<T | undefined>;
34
42
  export {};
@@ -1,10 +1,13 @@
1
1
  export interface Task {
2
- id: number;
3
- fn: ((didTimeout: boolean) => void) | null;
4
- startTime: number;
5
- expirationTime: number;
2
+ id: number;
3
+ fn: ((didTimeout: boolean) => void) | null;
4
+ startTime: number;
5
+ expirationTime: number;
6
6
  }
7
- export declare function requestCallback(fn: () => void, options?: {
7
+ export declare function requestCallback(
8
+ fn: () => void,
9
+ options?: {
8
10
  timeout: number;
9
- }): Task;
11
+ }
12
+ ): Task;
10
13
  export declare function cancelCallback(task: Task): void;