solid-js 1.9.11 → 2.0.0-beta.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 (82) hide show
  1. package/dist/dev.cjs +733 -1678
  2. package/dist/dev.js +598 -1643
  3. package/dist/server.cjs +769 -703
  4. package/dist/server.js +682 -670
  5. package/dist/solid.cjs +699 -1618
  6. package/dist/solid.js +563 -1582
  7. package/package.json +7 -151
  8. package/types/{render → client}/component.d.ts +1 -38
  9. package/types/client/core.d.ts +65 -0
  10. package/types/client/flow.d.ts +100 -0
  11. package/types/client/hydration.d.ts +76 -0
  12. package/types/index.d.ts +11 -14
  13. package/types/jsx.d.ts +1508 -1633
  14. package/types/server/component.d.ts +66 -0
  15. package/types/server/core.d.ts +44 -0
  16. package/types/server/flow.d.ts +60 -0
  17. package/types/server/hydration.d.ts +21 -0
  18. package/types/server/index.d.ts +12 -3
  19. package/types/server/shared.d.ts +45 -0
  20. package/types/server/signals.d.ts +60 -0
  21. package/h/dist/h.cjs +0 -115
  22. package/h/dist/h.js +0 -113
  23. package/h/jsx-dev-runtime/package.json +0 -8
  24. package/h/jsx-runtime/dist/jsx.cjs +0 -15
  25. package/h/jsx-runtime/dist/jsx.js +0 -10
  26. package/h/jsx-runtime/package.json +0 -8
  27. package/h/jsx-runtime/types/index.d.ts +0 -11
  28. package/h/jsx-runtime/types/jsx.d.ts +0 -4242
  29. package/h/package.json +0 -8
  30. package/h/types/hyperscript.d.ts +0 -20
  31. package/h/types/index.d.ts +0 -3
  32. package/html/dist/html.cjs +0 -583
  33. package/html/dist/html.js +0 -581
  34. package/html/package.json +0 -8
  35. package/html/types/index.d.ts +0 -3
  36. package/html/types/lit.d.ts +0 -41
  37. package/store/dist/dev.cjs +0 -458
  38. package/store/dist/dev.js +0 -449
  39. package/store/dist/server.cjs +0 -126
  40. package/store/dist/server.js +0 -114
  41. package/store/dist/store.cjs +0 -438
  42. package/store/dist/store.js +0 -429
  43. package/store/package.json +0 -46
  44. package/store/types/index.d.ts +0 -12
  45. package/store/types/modifiers.d.ts +0 -6
  46. package/store/types/mutable.d.ts +0 -5
  47. package/store/types/server.d.ts +0 -17
  48. package/store/types/store.d.ts +0 -107
  49. package/types/reactive/array.d.ts +0 -44
  50. package/types/reactive/observable.d.ts +0 -36
  51. package/types/reactive/scheduler.d.ts +0 -10
  52. package/types/reactive/signal.d.ts +0 -577
  53. package/types/render/Suspense.d.ts +0 -26
  54. package/types/render/flow.d.ts +0 -118
  55. package/types/render/hydration.d.ts +0 -24
  56. package/types/render/index.d.ts +0 -4
  57. package/types/server/reactive.d.ts +0 -98
  58. package/types/server/rendering.d.ts +0 -159
  59. package/universal/dist/dev.cjs +0 -245
  60. package/universal/dist/dev.js +0 -243
  61. package/universal/dist/universal.cjs +0 -245
  62. package/universal/dist/universal.js +0 -243
  63. package/universal/package.json +0 -20
  64. package/universal/types/index.d.ts +0 -3
  65. package/universal/types/universal.d.ts +0 -30
  66. package/web/dist/dev.cjs +0 -894
  67. package/web/dist/dev.js +0 -782
  68. package/web/dist/server.cjs +0 -892
  69. package/web/dist/server.js +0 -782
  70. package/web/dist/web.cjs +0 -883
  71. package/web/dist/web.js +0 -771
  72. package/web/package.json +0 -46
  73. package/web/storage/dist/storage.cjs +0 -12
  74. package/web/storage/dist/storage.js +0 -10
  75. package/web/storage/package.json +0 -15
  76. package/web/storage/types/index.d.ts +0 -2
  77. package/web/types/client.d.ts +0 -79
  78. package/web/types/core.d.ts +0 -2
  79. package/web/types/index.d.ts +0 -50
  80. package/web/types/jsx.d.ts +0 -1
  81. package/web/types/server-mock.d.ts +0 -65
  82. package/web/types/server.d.ts +0 -177
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "solid-js",
3
3
  "description": "A declarative JavaScript library for building user interfaces.",
4
- "version": "1.9.11",
4
+ "version": "2.0.0-beta.0",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -17,30 +17,9 @@
17
17
  "type": "module",
18
18
  "files": [
19
19
  "dist",
20
- "store/dist",
21
- "store/types",
22
- "store/package.json",
23
- "web/dist",
24
- "web/types",
25
- "web/package.json",
26
- "web/storage/dist",
27
- "web/storage/types",
28
- "web/storage/package.json",
29
- "h/dist",
30
- "h/types",
31
- "h/package.json",
32
- "h/jsx-runtime/dist",
33
- "h/jsx-runtime/types",
34
- "h/jsx-runtime/package.json",
35
- "h/jsx-dev-runtime/package.json",
36
- "html/dist",
37
- "html/types",
38
- "html/package.json",
39
- "universal/dist",
40
- "universal/types",
41
- "universal/package.json",
42
20
  "types",
43
- "jsx-runtime.d.ts"
21
+ "jsx-runtime.d.ts",
22
+ "package.json"
44
23
  ],
45
24
  "exports": {
46
25
  ".": {
@@ -88,120 +67,6 @@
88
67
  "types": "./types/jsx.d.ts",
89
68
  "default": "./dist/solid.js"
90
69
  },
91
- "./store": {
92
- "worker": {
93
- "types": "./store/types/index.d.ts",
94
- "import": "./store/dist/server.js",
95
- "require": "./store/dist/server.cjs"
96
- },
97
- "browser": {
98
- "development": {
99
- "types": "./store/types/index.d.ts",
100
- "import": "./store/dist/dev.js",
101
- "require": "./store/dist/dev.cjs"
102
- },
103
- "types": "./store/types/index.d.ts",
104
- "import": "./store/dist/store.js",
105
- "require": "./store/dist/store.cjs"
106
- },
107
- "deno": {
108
- "types": "./store/types/index.d.ts",
109
- "import": "./store/dist/server.js",
110
- "require": "./store/dist/server.cjs"
111
- },
112
- "node": {
113
- "types": "./store/types/index.d.ts",
114
- "import": "./store/dist/server.js",
115
- "require": "./store/dist/server.cjs"
116
- },
117
- "development": {
118
- "types": "./store/types/index.d.ts",
119
- "import": "./store/dist/dev.js",
120
- "require": "./store/dist/dev.cjs"
121
- },
122
- "types": "./store/types/index.d.ts",
123
- "import": "./store/dist/store.js",
124
- "require": "./store/dist/store.cjs"
125
- },
126
- "./store/dist/*": "./store/dist/*",
127
- "./store/types/*": "./store/types/*",
128
- "./web": {
129
- "worker": {
130
- "types": "./web/types/index.d.ts",
131
- "import": "./web/dist/server.js",
132
- "require": "./web/dist/server.cjs"
133
- },
134
- "browser": {
135
- "development": {
136
- "types": "./web/types/index.d.ts",
137
- "import": "./web/dist/dev.js",
138
- "require": "./web/dist/dev.cjs"
139
- },
140
- "types": "./web/types/index.d.ts",
141
- "import": "./web/dist/web.js",
142
- "require": "./web/dist/web.cjs"
143
- },
144
- "deno": {
145
- "types": "./web/types/index.d.ts",
146
- "import": "./web/dist/server.js",
147
- "require": "./web/dist/server.cjs"
148
- },
149
- "node": {
150
- "types": "./web/types/index.d.ts",
151
- "import": "./web/dist/server.js",
152
- "require": "./web/dist/server.cjs"
153
- },
154
- "development": {
155
- "types": "./web/types/index.d.ts",
156
- "import": "./web/dist/dev.js",
157
- "require": "./web/dist/dev.cjs"
158
- },
159
- "types": "./web/types/index.d.ts",
160
- "import": "./web/dist/web.js",
161
- "require": "./web/dist/web.cjs"
162
- },
163
- "./web/storage": {
164
- "types": "./web/storage/types/index.d.ts",
165
- "import": "./web/storage/dist/storage.js",
166
- "require": "./web/storage/dist/storage.cjs"
167
- },
168
- "./web/dist/*": "./web/dist/*",
169
- "./web/types/*": "./web/types/*",
170
- "./universal": {
171
- "development": {
172
- "types": "./universal/types/index.d.ts",
173
- "import": "./universal/dist/dev.js",
174
- "require": "./universal/dist/dev.cjs"
175
- },
176
- "types": "./universal/types/index.d.ts",
177
- "import": "./universal/dist/universal.js",
178
- "require": "./universal/dist/universal.cjs"
179
- },
180
- "./universal/dist/*": "./universal/dist/*",
181
- "./universal/types/*": "./universal/types/*",
182
- "./h": {
183
- "types": "./h/types/index.d.ts",
184
- "import": "./h/dist/h.js",
185
- "require": "./h/dist/h.cjs"
186
- },
187
- "./h/jsx-runtime": {
188
- "types": "./h/jsx-runtime/types/index.d.ts",
189
- "import": "./h/jsx-runtime/dist/jsx.js",
190
- "require": "./h/jsx-runtime/dist/jsx.cjs"
191
- },
192
- "./h/jsx-dev-runtime": {
193
- "types": "./h/jsx-runtime/types/index.d.ts",
194
- "import": "./h/jsx-runtime/dist/jsx.js",
195
- "require": "./h/jsx-runtime/dist/jsx.cjs"
196
- },
197
- "./h/dist/*": "./h/dist/*",
198
- "./h/types/*": "./h/types/*",
199
- "./html": {
200
- "types": "./html/types/index.d.ts",
201
- "import": "./html/dist/html.js",
202
- "require": "./html/dist/html.cjs"
203
- },
204
- "./html/dist/*": "./html/dist/*",
205
70
  "./package.json": "./package.json"
206
71
  },
207
72
  "keywords": [
@@ -214,28 +79,19 @@
214
79
  "performance"
215
80
  ],
216
81
  "dependencies": {
82
+ "@solidjs/signals": "^0.11.1",
217
83
  "csstype": "^3.1.0",
218
84
  "seroval": "~1.5.0",
219
85
  "seroval-plugins": "~1.5.0"
220
86
  },
221
87
  "scripts": {
222
88
  "build": "npm-run-all -nl build:*",
223
- "build:clean": "rimraf dist/ coverage/ store/dist/ web/dist/ web/storage/dist h/dist/ h/jsx-runtime/dist html/dist/ universal/dist/",
89
+ "build:clean": "rimraf dist/ coverage/",
224
90
  "build:js": "rollup -c",
225
91
  "types": "npm-run-all -nl types:*",
226
- "types:clean": "rimraf types/ store/types/ web/types/ web/storage/types/ h/types/ h/jsx-runtime/types html/types/ universal/types/ src/jsx.d.ts h/jsx-runtime/src/jsx.d.ts",
227
- "types:copy": "ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./src/jsx.d.ts && ncp ../../node_modules/dom-expressions/src/jsx-h.d.ts ./h/jsx-runtime/src/jsx.d.ts",
92
+ "types:clean": "rimraf types/",
93
+ "types:copy": "ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./src/jsx.d.ts",
228
94
  "types:src": "tsc --project ./tsconfig.build.json && ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./types/jsx.d.ts",
229
- "types:web": "tsc --project ./web/tsconfig.build.json",
230
- "types:web-storage": "tsc --project ./web/storage/tsconfig.build.json",
231
- "types:copy-web": "ncp ../../node_modules/dom-expressions/src/client.d.ts ./web/types/client.d.ts && ncp ../../node_modules/dom-expressions/src/server.d.ts ./web/types/server.d.ts",
232
- "types:store": "tsc --project ./store/tsconfig.build.json",
233
- "types:html": "tsc --project ./html/tsconfig.json && ncp ../../node_modules/lit-dom-expressions/types/index.d.ts ./html/types/lit.d.ts",
234
- "types:h": "tsc --project ./h/tsconfig.json && ncp ../../node_modules/hyper-dom-expressions/types/index.d.ts ./h/types/hyperscript.d.ts",
235
- "types:jsx": "rimraf ./h/jsx-runtime/types && tsc --project ./h/jsx-runtime/tsconfig.json && ncp ../../node_modules/dom-expressions/src/jsx-h.d.ts ./h/jsx-runtime/types/jsx.d.ts",
236
- "types:universal": "tsc --project ./universal/tsconfig.json && ncp ../../node_modules/dom-expressions/src/universal.d.ts ./universal/types/universal.d.ts",
237
- "bench": "node --allow-natives-syntax bench/bench.cjs",
238
- "link": "symlink-dir . node_modules/solid-js",
239
95
  "test": "vitest run",
240
96
  "coverage": "vitest run --coverage",
241
97
  "test-types": "tsc --project tsconfig.test.json"
@@ -1,5 +1,4 @@
1
1
  import type { JSX } from "../jsx.js";
2
- export declare function enableHydration(): void;
3
2
  /**
4
3
  * A general `Component` has no implicit `children` prop. If desired, you can
5
4
  * specify one as in `Component<{name: String, children: JSX.Element}>`.
@@ -49,8 +48,6 @@ export type FlowProps<P extends Record<string, any> = {}, C = JSX.Element> = P &
49
48
  * Note that all JSX <Elements> are of the type `JSX.Element`.
50
49
  */
51
50
  export type FlowComponent<P extends Record<string, any> = {}, C = JSX.Element> = Component<FlowProps<P, C>>;
52
- /** @deprecated: use `ParentProps` instead */
53
- export type PropsWithChildren<P extends Record<string, any> = {}> = ParentProps<P>;
54
51
  export type ValidComponent = keyof JSX.IntrinsicElements | Component<any> | (string & {});
55
52
  /**
56
53
  * Takes the props of the passed component and returns its type
@@ -67,45 +64,11 @@ export type ComponentProps<T extends ValidComponent> = T extends Component<infer
67
64
  */
68
65
  export type Ref<T> = T | ((val: T) => void);
69
66
  export declare function createComponent<T extends Record<string, any>>(Comp: Component<T>, props: T): JSX.Element;
70
- type DistributeOverride<T, F> = T extends undefined ? F : T;
71
- type Override<T, U> = T extends any ? U extends any ? {
72
- [K in keyof T]: K extends keyof U ? DistributeOverride<U[K], T[K]> : T[K];
73
- } & {
74
- [K in keyof U]: K extends keyof T ? DistributeOverride<U[K], T[K]> : U[K];
75
- } : T & U : T & U;
76
- type OverrideSpread<T, U> = T extends any ? {
77
- [K in keyof ({
78
- [K in keyof T]: any;
79
- } & {
80
- [K in keyof U]?: any;
81
- } & {
82
- [K in U extends any ? keyof U : keyof U]?: any;
83
- })]: K extends keyof T ? Exclude<U extends any ? U[K & keyof U] : never, undefined> | T[K] : U extends any ? U[K & keyof U] : never;
84
- } : T & U;
85
- type Simplify<T> = T extends any ? {
86
- [K in keyof T]: T[K];
87
- } : T;
88
- type _MergeProps<T extends unknown[], Curr = {}> = T extends [
89
- infer Next | (() => infer Next),
90
- ...infer Rest
91
- ] ? _MergeProps<Rest, Override<Curr, Next>> : T extends [...infer Rest, infer Next | (() => infer Next)] ? Override<_MergeProps<Rest, Curr>, Next> : T extends [] ? Curr : T extends (infer I | (() => infer I))[] ? OverrideSpread<Curr, I> : Curr;
92
- export type MergeProps<T extends unknown[]> = Simplify<_MergeProps<T>>;
93
- export declare function mergeProps<T extends unknown[]>(...sources: T): MergeProps<T>;
94
- export type SplitProps<T, K extends (readonly (keyof T)[])[]> = [
95
- ...{
96
- [P in keyof K]: P extends `${number}` ? Pick<T, Extract<K[P], readonly (keyof T)[]>[number]> : never;
97
- },
98
- {
99
- [P in keyof T as Exclude<P, K[number][number]>]: T[P];
100
- }
101
- ];
102
- export declare function splitProps<T extends Record<any, any>, K extends [readonly (keyof T)[], ...(readonly (keyof T)[])[]]>(props: T, ...keys: K): SplitProps<T, K>;
103
67
  export declare function lazy<T extends Component<any>>(fn: () => Promise<{
104
68
  default: T;
105
- }>): T & {
69
+ }>, moduleUrl?: string): T & {
106
70
  preload: () => Promise<{
107
71
  default: T;
108
72
  }>;
109
73
  };
110
74
  export declare function createUniqueId(): string;
111
- export {};
@@ -0,0 +1,65 @@
1
+ import type { Accessor, Owner, EffectOptions } from "@solidjs/signals";
2
+ import type { JSX } from "../jsx.js";
3
+ import { FlowComponent } from "./component.js";
4
+ export declare const IS_DEV: string | boolean;
5
+ export declare const $DEVCOMP: unique symbol;
6
+ export type NoInfer<T extends any> = [T][T extends any ? 0 : never];
7
+ export type ContextProviderComponent<T> = FlowComponent<{
8
+ value: T;
9
+ }>;
10
+ export interface Context<T> extends ContextProviderComponent<T> {
11
+ id: symbol;
12
+ defaultValue: T;
13
+ }
14
+ /**
15
+ * Creates a Context to handle a state scoped for the children of a component
16
+ * ```typescript
17
+ * interface Context<T> {
18
+ * id: symbol;
19
+ * Provider: FlowComponent<{ value: T }>;
20
+ * defaultValue: T;
21
+ * }
22
+ * export function createContext<T>(
23
+ * defaultValue?: T,
24
+ * options?: { name?: string }
25
+ * ): Context<T | undefined>;
26
+ * ```
27
+ * @param defaultValue optional default to inject into context
28
+ * @param options allows to set a name in dev mode for debugging purposes
29
+ * @returns The context that contains the Provider Component and that can be used with `useContext`
30
+ *
31
+ * @description https://docs.solidjs.com/reference/component-apis/create-context
32
+ */
33
+ export declare function createContext<T>(defaultValue?: undefined, options?: EffectOptions): Context<T | undefined>;
34
+ export declare function createContext<T>(defaultValue: T, options?: EffectOptions): Context<T>;
35
+ /**
36
+ * Uses a context to receive a scoped state from a parent's Context.Provider
37
+ *
38
+ * @param context Context object made by `createContext`
39
+ * @returns the current or `defaultValue`, if present
40
+ *
41
+ * @description https://docs.solidjs.com/reference/component-apis/use-context
42
+ */
43
+ export declare function useContext<T>(context: Context<T>): T;
44
+ export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement>;
45
+ export type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[];
46
+ export type ChildrenReturn = Accessor<ResolvedChildren> & {
47
+ toArray: () => ResolvedJSXElement[];
48
+ };
49
+ /**
50
+ * Resolves child elements to help interact with children
51
+ *
52
+ * @param fn an accessor for the children
53
+ * @returns a accessor of the same children, but resolved
54
+ *
55
+ * @description https://docs.solidjs.com/reference/component-apis/children
56
+ */
57
+ export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn;
58
+ export declare function devComponent<P, V>(Comp: (props: P) => V, props: P): V;
59
+ interface SourceMapValue {
60
+ value: unknown;
61
+ name?: string;
62
+ graph?: Owner;
63
+ }
64
+ export declare function registerGraph(value: SourceMapValue): void;
65
+ export {};
@@ -0,0 +1,100 @@
1
+ import type { Accessor } from "@solidjs/signals";
2
+ import type { JSX } from "../jsx.js";
3
+ /**
4
+ * Creates a list of elements from a list
5
+ *
6
+ * it receives a map function as its child that receives list element and index accessors and returns a JSX-Element; if the list is empty, an optional fallback is returned:
7
+ * ```typescript
8
+ * <For each={items} fallback={<div>No items</div>}>
9
+ * {(item, index) => <div data-index={index()}>{item()}</div>}
10
+ * </For>
11
+ * ```
12
+ *
13
+ * @description https://docs.solidjs.com/reference/components/for
14
+ */
15
+ export declare function For<T extends readonly any[], U extends JSX.Element>(props: {
16
+ each: T | undefined | null | false;
17
+ fallback?: JSX.Element;
18
+ keyed?: boolean | ((item: T[number]) => any);
19
+ children: (item: Accessor<T[number]>, index: Accessor<number>) => U;
20
+ }): JSX.Element;
21
+ /**
22
+ * Creates a list elements from a count
23
+ *
24
+ * it receives a map function as its child that receives the index and returns a JSX-Element; if the list is empty, an optional fallback is returned:
25
+ * ```typescript
26
+ * <Repeat count={items.length} fallback={<div>No items</div>}>
27
+ * {(index) => <div data-index={index}>{items[index]}</div>}
28
+ * </Repeat>
29
+ * ```
30
+ *
31
+ * @description https://docs.solidjs.com/reference/components/repeat
32
+ */
33
+ export declare function Repeat<T extends JSX.Element>(props: {
34
+ count: number;
35
+ from?: number | undefined;
36
+ fallback?: JSX.Element;
37
+ children: ((index: number) => T) | T;
38
+ }): JSX.Element;
39
+ /**
40
+ * Conditionally render its children or an optional fallback component
41
+ * @description https://docs.solidjs.com/reference/components/show
42
+ */
43
+ export declare function Show<T>(props: {
44
+ when: T | undefined | null | false;
45
+ keyed?: boolean;
46
+ fallback?: JSX.Element;
47
+ children: JSX.Element | ((item: Accessor<NonNullable<T>>) => JSX.Element);
48
+ }): JSX.Element;
49
+ /**
50
+ * Switches between content based on mutually exclusive conditions
51
+ * ```typescript
52
+ * <Switch fallback={<FourOhFour />}>
53
+ * <Match when={state.route === 'home'}>
54
+ * <Home />
55
+ * </Match>
56
+ * <Match when={state.route === 'settings'}>
57
+ * <Settings />
58
+ * </Match>
59
+ * </Switch>
60
+ * ```
61
+ * @description https://docs.solidjs.com/reference/components/switch-and-match
62
+ */
63
+ export declare function Switch(props: {
64
+ fallback?: JSX.Element;
65
+ children: JSX.Element;
66
+ }): JSX.Element;
67
+ export type MatchProps<T> = {
68
+ when: T | undefined | null | false;
69
+ keyed?: boolean;
70
+ children: JSX.Element | ((item: Accessor<NonNullable<T>>) => JSX.Element);
71
+ };
72
+ /**
73
+ * Selects a content based on condition when inside a `<Switch>` control flow
74
+ * ```typescript
75
+ * <Match when={condition()}>
76
+ * <Content/>
77
+ * </Match>
78
+ * ```
79
+ * @description https://docs.solidjs.com/reference/components/switch-and-match
80
+ */
81
+ export declare function Match<T>(props: MatchProps<T>): JSX.Element;
82
+ /**
83
+ * Catches uncaught errors inside components and renders a fallback content
84
+ *
85
+ * Also supports a callback form that passes the error and a reset function:
86
+ * ```typescript
87
+ * <Errored fallback={
88
+ * (err, reset) => <div onClick={reset}>Error: {err.toString()}</div>
89
+ * }>
90
+ * <MyComp />
91
+ * </Errored>
92
+ * ```
93
+ * Errors thrown from the fallback can be caught by a parent Errored
94
+ *
95
+ * @description https://docs.solidjs.com/reference/components/error-boundary
96
+ */
97
+ export declare function Errored(props: {
98
+ fallback: JSX.Element | ((err: any, reset: () => void) => JSX.Element);
99
+ children: JSX.Element;
100
+ }): JSX.Element;
@@ -0,0 +1,76 @@
1
+ import { createErrorBoundary as coreErrorBoundary, createMemo as coreMemo, createSignal as coreSignal, createOptimistic as coreOptimistic, createRenderEffect as coreRenderEffect, createEffect as coreEffect, type ProjectionOptions, type Store, type StoreSetter } from "@solidjs/signals";
2
+ import { JSX } from "../jsx.js";
3
+ declare module "@solidjs/signals" {
4
+ interface MemoOptions<T> {
5
+ deferStream?: boolean;
6
+ ssrSource?: "server" | "hybrid" | "initial" | "client";
7
+ }
8
+ interface SignalOptions<T> {
9
+ deferStream?: boolean;
10
+ ssrSource?: "server" | "hybrid" | "initial" | "client";
11
+ }
12
+ interface EffectOptions {
13
+ deferStream?: boolean;
14
+ ssrSource?: "server" | "hybrid" | "initial" | "client";
15
+ }
16
+ }
17
+ export type HydrationProjectionOptions = ProjectionOptions & {
18
+ ssrSource?: "server" | "hybrid" | "initial" | "client";
19
+ };
20
+ export type HydrationContext = {};
21
+ type SharedConfig = {
22
+ hydrating: boolean;
23
+ resources?: {
24
+ [key: string]: any;
25
+ };
26
+ load?: (id: string) => Promise<any> | any;
27
+ has?: (id: string) => boolean;
28
+ gather?: (key: string) => void;
29
+ cleanupFragment?: (id: string) => void;
30
+ registry?: Map<string, Element>;
31
+ completed?: WeakSet<Element> | null;
32
+ events?: any[] | null;
33
+ verifyHydration?: () => void;
34
+ done: boolean;
35
+ getNextContextId(): string;
36
+ };
37
+ export declare const sharedConfig: SharedConfig;
38
+ /**
39
+ * Registers a callback to run once when all hydration completes
40
+ * (all boundaries hydrated or cancelled). If hydration is already
41
+ * complete (or not hydrating), fires via queueMicrotask.
42
+ */
43
+ export declare function onHydrationEnd(callback: () => void): void;
44
+ export declare function enableHydration(): void;
45
+ export declare const createMemo: typeof coreMemo;
46
+ export declare const createSignal: typeof coreSignal;
47
+ export declare const createErrorBoundary: typeof coreErrorBoundary;
48
+ export declare const createOptimistic: typeof coreOptimistic;
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>;
50
+ type NoFn<T> = T extends Function ? never : T;
51
+ export declare const createStore: {
52
+ <T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): [get: Store<T>, set: StoreSetter<T>];
53
+ <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>, set: StoreSetter<T>];
54
+ };
55
+ export declare const createOptimisticStore: {
56
+ <T extends object = {}>(store: NoFn<T> | Store<NoFn<T>>): [get: Store<T>, set: StoreSetter<T>];
57
+ <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>, set: StoreSetter<T>];
58
+ };
59
+ export declare const createRenderEffect: typeof coreRenderEffect;
60
+ export declare const createEffect: typeof coreEffect;
61
+ /**
62
+ * Tracks all resources inside a component and renders a fallback until they are all resolved
63
+ * ```typescript
64
+ * const AsyncComponent = lazy(() => import('./component'));
65
+ *
66
+ * <Loading fallback={<LoadingIndicator />}>
67
+ * <AsyncComponent />
68
+ * </Loading>
69
+ * ```
70
+ * @description https://docs.solidjs.com/reference/components/suspense
71
+ */
72
+ export declare function Loading(props: {
73
+ fallback?: JSX.Element;
74
+ children: JSX.Element;
75
+ }): JSX.Element;
76
+ export {};
package/types/index.d.ts CHANGED
@@ -1,21 +1,18 @@
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, Transition } from "./reactive/signal.js";
3
- export * from "./reactive/observable.js";
4
- export * from "./reactive/scheduler.js";
5
- export * from "./reactive/array.js";
6
- export * from "./render/index.js";
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
+ export { $DEVCOMP, children, createContext, useContext } from "./client/core.js";
4
+ export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedJSXElement } from "./client/core.js";
5
+ export * from "./client/component.js";
6
+ export * from "./client/flow.js";
7
+ export { sharedConfig, Loading, enableHydration, createMemo, createSignal, createStore, createProjection, createOptimistic, createOptimisticStore, createRenderEffect, createEffect } from "./client/hydration.js";
8
+ export declare function ssrHandleError(): void;
9
+ export declare function ssrRunInScope(): void;
7
10
  import type { JSX } from "./jsx.js";
8
11
  type JSXElement = JSX.Element;
9
12
  export type { JSXElement, JSX };
10
- import { registerGraph, writeSignal } from "./reactive/signal.js";
13
+ import { registerGraph } from "./client/core.js";
11
14
  export declare const DEV: {
12
- readonly hooks: {
13
- afterUpdate: (() => void) | null;
14
- afterCreateOwner: ((owner: import("./reactive/signal.js").Owner) => void) | null;
15
- afterCreateSignal: ((signal: import("./reactive/signal.js").SignalState<any>) => void) | null;
16
- afterRegisterGraph: ((sourceMapValue: import("./reactive/signal.js").SourceMapValue) => void) | null;
17
- };
18
- readonly writeSignal: typeof writeSignal;
15
+ readonly hooks: {};
19
16
  readonly registerGraph: typeof registerGraph;
20
17
  } | undefined;
21
18
  declare global {