solid-js 1.5.0-beta.0 → 1.5.0-beta.3

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 (53) hide show
  1. package/dist/dev.cjs +143 -132
  2. package/dist/dev.js +143 -132
  3. package/dist/server.cjs +86 -35
  4. package/dist/server.js +86 -35
  5. package/dist/solid.cjs +143 -132
  6. package/dist/solid.js +143 -132
  7. package/h/jsx-runtime/types/jsx.d.ts +3 -1
  8. package/h/types/hyperscript.d.ts +17 -0
  9. package/html/types/lit.d.ts +37 -0
  10. package/package.json +103 -41
  11. package/store/dist/dev.js +1 -1
  12. package/store/types/index.d.ts +4 -4
  13. package/store/types/mutable.d.ts +1 -1
  14. package/store/types/server.d.ts +1 -1
  15. package/types/index.d.ts +8 -8
  16. package/types/jsx.d.ts +4 -2
  17. package/types/reactive/array.d.ts +1 -1
  18. package/types/reactive/observable.d.ts +1 -1
  19. package/types/reactive/signal.d.ts +40 -33
  20. package/types/render/Suspense.d.ts +1 -1
  21. package/types/render/component.d.ts +1 -1
  22. package/types/render/flow.d.ts +20 -3
  23. package/types/render/index.d.ts +4 -4
  24. package/types/server/index.d.ts +3 -3
  25. package/types/server/reactive.d.ts +7 -3
  26. package/types/server/rendering.d.ts +15 -6
  27. package/universal/dist/dev.cjs +4 -1
  28. package/universal/dist/dev.js +5 -2
  29. package/universal/dist/universal.cjs +4 -1
  30. package/universal/dist/universal.js +5 -2
  31. package/universal/types/index.d.ts +1 -1
  32. package/web/dist/dev.cjs +5 -0
  33. package/web/dist/dev.js +6 -2
  34. package/web/dist/server.cjs +275 -234
  35. package/web/dist/server.js +275 -234
  36. package/web/dist/web.cjs +5 -0
  37. package/web/dist/web.js +6 -2
  38. package/web/types/client.d.ts +1 -1
  39. package/web/types/core.d.ts +3 -3
  40. package/web/types/index.d.ts +5 -5
  41. package/web/types/jsx.d.ts +1 -1
  42. package/web/types/server.d.ts +70 -0
  43. package/h/README.md +0 -99
  44. package/h/jsx-runtime/package.json +0 -8
  45. package/h/package.json +0 -8
  46. package/html/README.md +0 -84
  47. package/html/package.json +0 -8
  48. package/store/README.md +0 -23
  49. package/store/package.json +0 -35
  50. package/universal/README.md +0 -102
  51. package/universal/package.json +0 -18
  52. package/web/README.md +0 -7
  53. package/web/package.json +0 -35
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.5.0-beta.0",
4
+ "version": "1.5.0-beta.3",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "homepage": "https://solidjs.com",
@@ -40,108 +40,150 @@
40
40
  ".": {
41
41
  "browser": {
42
42
  "development": {
43
- "import": "./dist/dev.js",
43
+ "import": {
44
+ "types": "./types/index.d.ts",
45
+ "default": "./dist/dev.js"
46
+ },
44
47
  "require": "./dist/dev.cjs"
45
48
  },
46
- "import": "./dist/solid.js",
49
+ "import": {
50
+ "types": "./types/index.d.ts",
51
+ "default": "./dist/solid.js"
52
+ },
47
53
  "require": "./dist/solid.cjs"
48
54
  },
49
55
  "node": {
50
- "import": "./dist/server.js",
56
+ "import": {
57
+ "types": "./types/index.d.ts",
58
+ "default": "./dist/server.js"
59
+ },
51
60
  "require": "./dist/server.cjs"
52
61
  },
53
62
  "development": {
54
- "import": "./dist/dev.js",
63
+ "import": {
64
+ "types": "./types/index.d.ts",
65
+ "default": "./dist/dev.js"
66
+ },
55
67
  "require": "./dist/dev.cjs"
56
68
  },
57
- "import": "./dist/solid.js",
69
+ "import": {
70
+ "types": "./types/index.d.ts",
71
+ "default": "./dist/solid.js"
72
+ },
58
73
  "require": "./dist/solid.cjs"
59
74
  },
60
75
  "./dist/*": "./dist/*",
61
76
  "./store": {
62
77
  "browser": {
63
78
  "development": {
64
- "import": "./store/dist/dev.js",
79
+ "import": {
80
+ "types": "./store/types/index.d.ts",
81
+ "default": "./store/dist/dev.js"
82
+ },
65
83
  "require": "./store/dist/dev.cjs"
66
84
  },
67
- "import": "./store/dist/store.js",
85
+ "import": {
86
+ "types": "./store/types/index.d.ts",
87
+ "default": "./store/dist/store.js"
88
+ },
68
89
  "require": "./store/dist/store.cjs"
69
90
  },
70
91
  "node": {
71
- "import": "./store/dist/server.js",
92
+ "import": {
93
+ "types": "./store/types/index.d.ts",
94
+ "default": "./store/dist/server.js"
95
+ },
72
96
  "require": "./store/dist/server.cjs"
73
97
  },
74
98
  "development": {
75
- "import": "./store/dist/dev.js",
99
+ "import": {
100
+ "types": "./store/types/index.d.ts",
101
+ "default": "./store/dist/dev.js"
102
+ },
76
103
  "require": "./store/dist/dev.cjs"
77
104
  },
78
- "import": "./store/dist/store.js",
105
+ "import": {
106
+ "types": "./store/types/index.d.ts",
107
+ "default": "./store/dist/store.js"
108
+ },
79
109
  "require": "./store/dist/store.cjs"
80
110
  },
81
111
  "./store/dist/*": "./store/dist/*",
82
112
  "./web": {
83
113
  "browser": {
84
114
  "development": {
85
- "import": "./web/dist/dev.js",
115
+ "import": {
116
+ "types": "./web/types/index.d.ts",
117
+ "default": "./web/dist/dev.js"
118
+ },
86
119
  "require": "./web/dist/dev.cjs"
87
120
  },
88
- "import": "./web/dist/web.js",
121
+ "import": {
122
+ "types": "./web/types/index.d.ts",
123
+ "default": "./web/dist/web.js"
124
+ },
89
125
  "require": "./web/dist/web.cjs"
90
126
  },
91
127
  "node": {
92
- "import": "./web/dist/server.js",
128
+ "import": {
129
+ "types": "./web/types/index.d.ts",
130
+ "default": "./web/dist/server.js"
131
+ },
93
132
  "require": "./web/dist/server.cjs"
94
133
  },
95
134
  "development": {
96
- "import": "./web/dist/dev.js",
135
+ "import": {
136
+ "types": "./web/types/index.d.ts",
137
+ "default": "./web/dist/dev.js"
138
+ },
97
139
  "require": "./web/dist/dev.cjs"
98
140
  },
99
- "import": "./web/dist/web.js",
141
+ "import": {
142
+ "types": "./web/types/index.d.ts",
143
+ "default": "./web/dist/web.js"
144
+ },
100
145
  "require": "./web/dist/web.cjs"
101
146
  },
102
147
  "./web/dist/*": "./web/dist/*",
103
148
  "./universal": {
104
149
  "development": {
105
- "import": "./universal/dist/dev.js",
150
+ "import": {
151
+ "types": "./universal/types/index.d.ts",
152
+ "default": "./universal/dist/dev.js"
153
+ },
106
154
  "require": "./universal/dist/dev.cjs"
107
155
  },
108
- "import": "./universal/dist/universal.js",
156
+ "import": {
157
+ "types": "./universal/types/index.d.ts",
158
+ "default": "./universal/dist/universal.js"
159
+ },
109
160
  "require": "./universal/dist/universal.cjs"
110
161
  },
111
162
  "./universal/dist/*": "./universal/dist/*",
112
163
  "./h": {
113
- "import": "./h/dist/h.js",
164
+ "import": {
165
+ "types": "./h/types/index.d.ts",
166
+ "default": "./h/dist/h.js"
167
+ },
114
168
  "require": "./h/dist/h.cjs"
115
169
  },
116
170
  "./h/jsx-runtime": {
117
- "import": "./h/jsx-runtime/dist/jsx.js",
171
+ "import": {
172
+ "types": "./h/jsx-runtime/types/index.d.ts",
173
+ "default": "./h/jsx-runtime/dist/jsx.js"
174
+ },
118
175
  "require": "./h/jsx-runtime/dist/jsx.cjs"
119
176
  },
120
177
  "./h/dist/*": "./h/dist/*",
121
178
  "./html": {
122
- "import": "./html/dist/html.js",
179
+ "import": {
180
+ "types": "./html/types/index.d.ts",
181
+ "default": "./html/dist/html.js"
182
+ },
123
183
  "require": "./html/dist/html.cjs"
124
184
  },
125
185
  "./html/dist/*": "./html/dist/*"
126
186
  },
127
- "scripts": {
128
- "prebuild": "npm run clean",
129
- "clean": "rimraf dist/ types/ coverage/ store/dist/ store/types/ web/dist/ web/types/ h/dist/ h/types/ h/jsx-runtime/dist h/jsx-runtime/types html/dist/ html/types/",
130
- "build": "npm-run-all -cnl build:*",
131
- "build:link": "symlink-dir . node_modules/solid-js",
132
- "build:js": "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 && rollup -c",
133
- "build:types": "tsc --project ./tsconfig.build.json",
134
- "build:types-store": "tsc --project ./store/tsconfig.build.json && tsconfig-replace-paths --project ./store/tsconfig.types.json",
135
- "build:types-web": "tsc --project ./web/tsconfig.build.json && tsconfig-replace-paths --project ./web/tsconfig.types.json",
136
- "build:types-html": "tsc --project ./html/tsconfig.json",
137
- "build:types-h": "tsc --project ./h/tsconfig.json",
138
- "build:types-jsx": "tsc --project ./h/jsx-runtime/tsconfig.json",
139
- "build:types-universal": "tsc --project ./universal/tsconfig.json",
140
- "bench": "node --allow-natives-syntax bench/bench.cjs",
141
- "test": "jest && npm run test:types",
142
- "test:coverage": "jest --coverage && npm run test:types",
143
- "test:types": "tsc --project tsconfig.test.json"
144
- },
145
187
  "keywords": [
146
188
  "solid",
147
189
  "solidjs",
@@ -151,5 +193,25 @@
151
193
  "compiler",
152
194
  "performance"
153
195
  ],
154
- "gitHead": "141a7b2c4f447d8894fa9382fca97e10b0626493"
155
- }
196
+ "scripts": {
197
+ "build": "npm-run-all -nl build:*",
198
+ "build:clean": "rimraf dist/ coverage/ store/dist/ web/dist/ h/dist/ h/jsx-runtime/dist html/dist/",
199
+ "build:js": "rollup -c",
200
+ "types": "npm-run-all -nl types:*",
201
+ "types:clean": "rimraf types/ store/types/ web/types/ h/types/ h/jsx-runtime/types html/types/",
202
+ "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",
203
+ "types:src": "tsc --project ./tsconfig.build.json && ncp ../../node_modules/dom-expressions/src/jsx.d.ts ./types/jsx.d.ts",
204
+ "types:web": "tsc --project ./web/tsconfig.build.json",
205
+ "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",
206
+ "types:store": "tsc --project ./store/tsconfig.build.json",
207
+ "types:html": "tsc --project ./html/tsconfig.json && ncp ../../node_modules/lit-dom-expressions/types/index.d.ts ./html/types/lit.d.ts",
208
+ "types:h": "tsc --project ./h/tsconfig.json && ncp ../../node_modules/hyper-dom-expressions/types/index.d.ts ./h/types/hyperscript.d.ts",
209
+ "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",
210
+ "types:universal": "tsc --project ./universal/tsconfig.json && ncp ../../node_modules/dom-expressions/src/universal.d.ts ./universal/types/universal.d.ts",
211
+ "bench": "node --allow-natives-syntax bench/bench.cjs",
212
+ "link": "symlink-dir . node_modules/solid-js",
213
+ "test": "jest",
214
+ "coverage": "jest --coverage",
215
+ "test-types": "tsc --project tsconfig.test.json"
216
+ }
217
+ }
package/store/dist/dev.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $PROXY, DEV, $TRACK, getListener, batch, createSignal } from 'solid-js';
1
+ import { DEV, $PROXY, $TRACK, getListener, batch, createSignal } from 'solid-js';
2
2
 
3
3
  const $RAW = Symbol("store-raw"),
4
4
  $NODE = Symbol("store-node"),
@@ -1,4 +1,4 @@
1
- export { createStore, unwrap, $RAW } from "./store";
2
- export type { Store, SetStoreFunction, NotWrappable, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, Part, DeepReadonly, DeepMutable } from "./store";
3
- export * from "./mutable";
4
- export * from "./modifiers";
1
+ export { createStore, unwrap, $RAW } from "./store.js";
2
+ export type { Store, SetStoreFunction, NotWrappable, SolidStore, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, Part, DeepReadonly, DeepMutable } from "./store.js";
3
+ export * from "./mutable.js";
4
+ export * from "./modifiers.js";
@@ -1,4 +1,4 @@
1
- import { StoreNode } from "./store";
1
+ import { StoreNode } from "./store.js";
2
2
  export declare function createMutable<T extends StoreNode>(state: T, options?: {
3
3
  name?: string;
4
4
  }): T;
@@ -1,4 +1,4 @@
1
- import type { SetStoreFunction, Store } from "store";
1
+ import type { SetStoreFunction, Store } from "./store.js";
2
2
  export declare const $RAW: unique symbol;
3
3
  export declare function isWrappable(obj: any): boolean;
4
4
  export declare function unwrap<T>(item: T): T;
package/types/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- export { createRoot, createSignal, createEffect, createRenderEffect, createComputed, createReaction, createDeferred, createSelector, createMemo, createResource, onMount, onCleanup, onError, untrack, batch, on, enableScheduling, enableExternalSource, startTransition, useTransition, createContext, useContext, children, getListener, getOwner, runWithOwner, equalFn, $DEVCOMP, $PROXY, $TRACK } from "./reactive/signal";
2
- export type { Accessor, Setter, Signal, Resource, ResourceOptions, ResourceReturn, ResourceFetcher, ResourceFetcherInfo, Context, ReturnTypes, Owner } from "./reactive/signal";
3
- export * from "./reactive/observable";
4
- export * from "./reactive/scheduler";
5
- export * from "./reactive/array";
6
- export * from "./render";
7
- import type { JSX } from "./jsx";
1
+ export { createRoot, createSignal, createEffect, createRenderEffect, createComputed, createReaction, createDeferred, createSelector, createMemo, createResource, onMount, onCleanup, onError, untrack, batch, on, enableScheduling, enableExternalSource, startTransition, useTransition, createContext, useContext, children, getListener, getOwner, runWithOwner, equalFn, $DEVCOMP, $PROXY, $TRACK } from "./reactive/signal.js";
2
+ export type { Accessor, Setter, Signal, Resource, ResourceOptions, ResourceReturn, ResourceFetcher, ResourceFetcherInfo, Context, ReturnTypes, Owner, InitializedResource, InitializedResourceOptions, InitializedResourceReturn } 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";
7
+ import type { JSX } from "./jsx.js";
8
8
  declare type JSXElement = JSX.Element;
9
9
  export type { JSXElement, JSX };
10
- import { writeSignal, serializeGraph, registerGraph, hashValue } from "./reactive/signal";
10
+ import { writeSignal, serializeGraph, registerGraph, hashValue } from "./reactive/signal.js";
11
11
  declare let DEV: {
12
12
  writeSignal: typeof writeSignal;
13
13
  serializeGraph: typeof serializeGraph;
package/types/jsx.d.ts CHANGED
@@ -162,6 +162,7 @@ export namespace JSX {
162
162
  onVolumeChange?: EventHandlerUnion<T, Event>;
163
163
  onWaiting?: EventHandlerUnion<T, Event>;
164
164
  onClick?: EventHandlerUnion<T, MouseEvent>;
165
+ onAuxClick?: EventHandlerUnion<T, MouseEvent>;
165
166
  onContextMenu?: EventHandlerUnion<T, MouseEvent>;
166
167
  onDblClick?: EventHandlerUnion<T, MouseEvent>;
167
168
  onDrag?: EventHandlerUnion<T, DragEvent>;
@@ -251,6 +252,7 @@ export namespace JSX {
251
252
  onvolumechange?: EventHandlerUnion<T, Event>;
252
253
  onwaiting?: EventHandlerUnion<T, Event>;
253
254
  onclick?: EventHandlerUnion<T, MouseEvent>;
255
+ onauxclick?: EventHandlerUnion<T, MouseEvent>;
254
256
  oncontextmenu?: EventHandlerUnion<T, MouseEvent>;
255
257
  ondblclick?: EventHandlerUnion<T, MouseEvent>;
256
258
  ondrag?: EventHandlerUnion<T, DragEvent>;
@@ -284,7 +286,7 @@ export namespace JSX {
284
286
  interface CSSProperties extends csstype.PropertiesHyphen {
285
287
  // Override
286
288
  }
287
-
289
+
288
290
  type HTMLAutocapitalize = "off" | "none" | "on" | "sentences" | "words" | "characters";
289
291
  type HTMLDir = "ltr" | "rtl" | "auto";
290
292
  type HTMLFormEncType = "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain";
@@ -1860,7 +1862,7 @@ export namespace JSX {
1860
1862
  del: HTMLAttributes<HTMLElement>;
1861
1863
  details: DetailsHtmlAttributes<HTMLDetailsElement>;
1862
1864
  dfn: HTMLAttributes<HTMLElement>;
1863
- dialog: DialogHtmlAttributes<HTMLElement>;
1865
+ dialog: DialogHtmlAttributes<HTMLDialogElement>;
1864
1866
  div: HTMLAttributes<HTMLDivElement>;
1865
1867
  dl: HTMLAttributes<HTMLDListElement>;
1866
1868
  dt: HTMLAttributes<HTMLElement>;
@@ -1,4 +1,4 @@
1
- import { Accessor } from "./signal";
1
+ import { Accessor } from "./signal.js";
2
2
  /**
3
3
  * reactively transforms an array with a callback function - underlying helper for the `<For>` control flow
4
4
  *
@@ -1,4 +1,4 @@
1
- import { Accessor, Setter } from "./signal";
1
+ import { Accessor, Setter } from "./signal.js";
2
2
  declare global {
3
3
  interface SymbolConstructor {
4
4
  readonly observable: symbol;
@@ -1,6 +1,6 @@
1
- import { requestCallback } from "./scheduler";
2
- import type { JSX } from "../jsx";
3
- import type { FlowComponent } from "../render";
1
+ import { requestCallback } from "./scheduler.js";
2
+ import type { JSX } from "../jsx.js";
3
+ import type { FlowComponent } from "../render/index.js";
4
4
  export declare const equalFn: <T>(a: T, b: T) => boolean;
5
5
  export declare const $PROXY: unique symbol;
6
6
  export declare const $TRACK: unique symbol;
@@ -8,7 +8,6 @@ export declare const $DEVCOMP: unique symbol;
8
8
  export declare var Owner: Owner | null;
9
9
  export declare let Transition: TransitionState | null;
10
10
  declare let ExternalSourceFactory: ExternalSourceFactory | null;
11
- declare let Pending: SignalState<any>[] | null;
12
11
  declare global {
13
12
  var _$afterUpdate: () => void;
14
13
  var _$afterCreateRoot: (root: Owner) => void;
@@ -229,48 +228,56 @@ interface Error {
229
228
  state: "error";
230
229
  loading: false;
231
230
  error: any;
232
- latest: undefined;
233
- (): undefined;
231
+ latest: never;
232
+ (): never;
234
233
  }
235
- export declare type Resource<T> = undefined extends T ? Unresolved | Pending | Ready<T> | Refreshing<T> | Error : Ready<T> | Refreshing<T> | Error;
236
- export declare type ResourceActions<T> = {
237
- mutate: Setter<T>;
238
- refetch: (info?: unknown) => T | Promise<T> | undefined | null;
234
+ export declare type Resource<T> = Unresolved | Pending | Ready<T> | Refreshing<T> | Error;
235
+ export declare type InitializedResource<T> = Ready<T> | Refreshing<T> | Error;
236
+ export declare type ResourceActions<T, R = unknown> = {
237
+ mutate: Setter<T | undefined>;
238
+ refetch: (info?: R) => T | Promise<T> | undefined | null;
239
239
  };
240
240
  export declare type ResourceSource<S> = S | false | null | undefined | (() => S | false | null | undefined);
241
- export declare type ResourceFetcher<S, T> = (k: S, info: ResourceFetcherInfo<T>) => T | Promise<T>;
242
- export declare type ResourceFetcherInfo<T> = {
241
+ export declare type ResourceFetcher<S, T, R = unknown> = (k: S, info: ResourceFetcherInfo<T, R>) => T | Promise<T>;
242
+ export declare type ResourceFetcherInfo<T, R = unknown> = {
243
243
  value: T | undefined;
244
- refetching?: unknown;
244
+ refetching: R | boolean;
245
245
  };
246
- export declare type ResourceOptions<T> = undefined extends T ? {
246
+ export declare type ResourceOptions<T, S = unknown> = {
247
247
  initialValue?: T;
248
248
  name?: string;
249
249
  deferStream?: boolean;
250
- store?: <T>(init: T) => [Accessor<T>, Setter<T>];
251
- onHydrated?: <S, T>(k: S, info: ResourceFetcherInfo<T>) => void;
252
- } : {
250
+ useInitialValue?: boolean;
251
+ store?: (init: T | undefined) => [Accessor<T | undefined>, Setter<T | undefined>];
252
+ onHydrated?: (k: S | undefined, info: {
253
+ value: T | undefined;
254
+ }) => void;
255
+ };
256
+ export declare type InitializedResourceOptions<T, S = unknown> = ResourceOptions<T, S> & {
253
257
  initialValue: T;
254
- name?: string;
255
- deferStream?: boolean;
256
- store?: <T>(init: T) => [Accessor<T>, Setter<T>];
257
- onHydrated?: <S, T>(k: S, info: ResourceFetcherInfo<T>) => void;
258
258
  };
259
- export declare type ResourceReturn<T, K = T> = [Resource<T>, ResourceActions<K>];
259
+ export declare type ResourceReturn<T, R = unknown> = [Resource<T>, ResourceActions<T, R>];
260
+ export declare type InitializedResourceReturn<T, R = unknown> = [
261
+ InitializedResource<T>,
262
+ ResourceActions<T, R>
263
+ ];
260
264
  /**
261
265
  * Creates a resource that wraps a repeated promise in a reactive pattern:
262
266
  * ```typescript
267
+ * // Without source
268
+ * const [resource, { mutate, refetch }] = createResource(fetcher, options);
269
+ * // With source
263
270
  * const [resource, { mutate, refetch }] = createResource(source, fetcher, options);
264
271
  * ```
265
- * @param source - reactive data function to toggle the request, optional
266
- * @param fetcher - function that receives the source (or true) and an accessor for the last or initial value and returns a value or a Promise with the value:
272
+ * @param source - reactive data function which has its non-nullish and non-false values passed to the fetcher, optional
273
+ * @param fetcher - function that receives the source (true if source not provided), the last or initial value, and whether the resource is being refetched, and returns a value or a Promise:
267
274
  * ```typescript
268
- * const fetcher: ResourceFetcher<S, T, > = (
269
- * sourceOutput: ReturnValue<typeof source>,
270
- * info: ResourceFetcherInfo<T>
275
+ * const fetcher: ResourceFetcher<S, T, R> = (
276
+ * sourceOutput: S,
277
+ * info: { value: T | undefined, refetching: R | boolean }
271
278
  * ) => T | Promise<T>;
272
279
  * ```
273
- * @param options - an optional object with the initialValue and the name (for debugging purposes)
280
+ * @param options - an optional object with the initialValue and the name (for debugging purposes); see {@link ResourceOptions}
274
281
  *
275
282
  * @returns ```typescript
276
283
  * [Resource<T>, { mutate: Setter<T>, refetch: () => void }]
@@ -278,14 +285,14 @@ export declare type ResourceReturn<T, K = T> = [Resource<T>, ResourceActions<K>]
278
285
  *
279
286
  * * Setting an `initialValue` in the options will mean that both the prev() accessor and the resource should never return undefined (if that is wanted, you need to extend the type with undefined)
280
287
  * * `mutate` allows to manually overwrite the resource without calling the fetcher
281
- * * `refetch` will re-run the fetcher without changing the source
288
+ * * `refetch` will re-run the fetcher without changing the source, and if called with a value, that value will be passed to the fetcher via the `refetching` property on the fetcher's second parameter
282
289
  *
283
290
  * @description https://www.solidjs.com/docs/latest/api#createresource
284
291
  */
285
- export declare function createResource<T, S = true>(fetcher: ResourceFetcher<S, T>, options?: ResourceOptions<undefined>): ResourceReturn<T | undefined>;
286
- export declare function createResource<T, S = true>(fetcher: ResourceFetcher<S, T>, options: ResourceOptions<T>): ResourceReturn<T>;
287
- export declare function createResource<T, S>(source: ResourceSource<S>, fetcher: ResourceFetcher<S, T>, options?: ResourceOptions<undefined>): ResourceReturn<T | undefined>;
288
- export declare function createResource<T, S>(source: ResourceSource<S>, fetcher: ResourceFetcher<S, T>, options: ResourceOptions<T>): ResourceReturn<T>;
292
+ export declare function createResource<T, R = unknown>(fetcher: ResourceFetcher<true, T, R>, options: InitializedResourceOptions<NoInfer<T>, true>): InitializedResourceReturn<T, R>;
293
+ export declare function createResource<T, R = unknown>(fetcher: ResourceFetcher<true, T, R>, options?: ResourceOptions<NoInfer<T>, true>): ResourceReturn<T, R>;
294
+ export declare function createResource<T, S, R = unknown>(source: ResourceSource<S>, fetcher: ResourceFetcher<S, T, R>, options: InitializedResourceOptions<NoInfer<T>, S>): InitializedResourceReturn<T, R>;
295
+ export declare function createResource<T, S, R = unknown>(source: ResourceSource<S>, fetcher: ResourceFetcher<S, T, R>, options?: ResourceOptions<NoInfer<T>, S>): ResourceReturn<T, R>;
289
296
  export interface DeferredOptions<T> {
290
297
  equals?: false | ((prev: T, next: T) => boolean);
291
298
  name?: string;
@@ -1,4 +1,4 @@
1
- import type { JSX } from "../jsx";
1
+ import type { JSX } from "../jsx.js";
2
2
  /**
3
3
  * **[experimental]** controls the order in which suspended content is rendered
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { JSX } from "../jsx";
1
+ import type { JSX } from "../jsx.js";
2
2
  export declare function enableHydration(): void;
3
3
  /**
4
4
  * A general `Component` has no implicit `children` prop. If desired, you can
@@ -1,5 +1,5 @@
1
- import { Accessor } from "../reactive/signal";
2
- import type { JSX } from "../jsx";
1
+ import { Accessor } from "../reactive/signal.js";
2
+ import type { JSX } from "../jsx.js";
3
3
  /**
4
4
  * creates a list elements from a list
5
5
  *
@@ -42,9 +42,16 @@ export declare function Index<T, U extends JSX.Element>(props: {
42
42
  */
43
43
  export declare function Show<T>(props: {
44
44
  when: T | undefined | null | false;
45
+ keyed: true;
45
46
  fallback?: JSX.Element;
46
47
  children: JSX.Element | ((item: NonNullable<T>) => JSX.Element);
47
48
  }): () => JSX.Element;
49
+ export declare function Show<T>(props: {
50
+ when: T | undefined | null | false;
51
+ keyed?: false;
52
+ fallback?: JSX.Element;
53
+ children: JSX.Element;
54
+ }): () => JSX.Element;
48
55
  /**
49
56
  * switches between content based on mutually exclusive conditions
50
57
  * ```typescript
@@ -65,6 +72,7 @@ export declare function Switch(props: {
65
72
  }): Accessor<JSX.Element>;
66
73
  export declare type MatchProps<T> = {
67
74
  when: T | undefined | null | false;
75
+ keyed?: boolean;
68
76
  children: JSX.Element | ((item: NonNullable<T>) => JSX.Element);
69
77
  };
70
78
  /**
@@ -76,7 +84,16 @@ export declare type MatchProps<T> = {
76
84
  * ```
77
85
  * @description https://www.solidjs.com/docs/latest/api#%3Cswitch%3E%2F%3Cmatch%3E
78
86
  */
79
- export declare function Match<T>(props: MatchProps<T>): JSX.Element;
87
+ export declare function Match<T>(props: {
88
+ when: T | undefined | null | false;
89
+ keyed: true;
90
+ children: JSX.Element | ((item: NonNullable<T>) => JSX.Element);
91
+ }): JSX.Element;
92
+ export declare function Match<T>(props: {
93
+ when: T | undefined | null | false;
94
+ keyed?: false;
95
+ children: JSX.Element;
96
+ }): JSX.Element;
80
97
  export declare function resetErrorBoundaries(): void;
81
98
  /**
82
99
  * catches uncaught errors inside components and renders a fallback content
@@ -1,4 +1,4 @@
1
- export * from "./component";
2
- export * from "./flow";
3
- export * from "./Suspense";
4
- export { sharedConfig } from "./hydration";
1
+ export * from "./component.js";
2
+ export * from "./flow.js";
3
+ export * from "./Suspense.js";
4
+ export { sharedConfig } from "./hydration.js";
@@ -1,3 +1,3 @@
1
- export { createRoot, createSignal, createComputed, createRenderEffect, createEffect, createReaction, createDeferred, createSelector, createMemo, getListener, onMount, onCleanup, onError, untrack, batch, on, children, createContext, useContext, getOwner, runWithOwner, equalFn, requestCallback, mapArray, observable, from, $PROXY, $DEVCOMP, DEV, enableExternalSource } from "./reactive";
2
- export { mergeProps, splitProps, createComponent, For, Index, Show, Switch, Match, ErrorBoundary, Suspense, SuspenseList, createResource, resetErrorBoundaries, enableScheduling, enableHydration, startTransition, useTransition, createUniqueId, lazy, sharedConfig } from "./rendering";
3
- export type { Component, Resource } from "./rendering";
1
+ export { createRoot, createSignal, createComputed, createRenderEffect, createEffect, createReaction, createDeferred, createSelector, createMemo, getListener, onMount, onCleanup, onError, untrack, batch, on, children, createContext, useContext, getOwner, runWithOwner, equalFn, requestCallback, mapArray, observable, from, $PROXY, $DEVCOMP, DEV, enableExternalSource } from "./reactive.js";
2
+ export { mergeProps, splitProps, createComponent, For, Index, Show, Switch, Match, ErrorBoundary, Suspense, SuspenseList, createResource, resetErrorBoundaries, enableScheduling, enableHydration, startTransition, useTransition, createUniqueId, lazy, sharedConfig } from "./rendering.js";
3
+ export type { Component, Resource } from "./rendering.js";
@@ -4,6 +4,7 @@ export declare const $DEVCOMP: unique symbol;
4
4
  export declare const DEV: {};
5
5
  export declare type Accessor<T> = () => T;
6
6
  export declare type Setter<T> = undefined extends T ? <U extends T>(value?: (U extends Function ? never : U) | ((prev?: T) => U)) => U : <U extends T>(value: (U extends Function ? never : U) | ((prev: T) => U)) => U;
7
+ export declare const BRANCH: unique symbol;
7
8
  export declare function castError(err: any): string | Error;
8
9
  export declare let Owner: Owner | null;
9
10
  interface Owner {
@@ -28,7 +29,10 @@ export declare function on<T, U>(deps: Array<() => T> | (() => T), fn: (value: A
28
29
  defer?: boolean;
29
30
  }): (prev?: U) => U | undefined;
30
31
  export declare function onMount(fn: () => void): void;
31
- export declare function onCleanup(fn: () => void): void;
32
+ export declare function onCleanup(fn: () => void): () => void;
33
+ export declare function cleanNode(node: {
34
+ cleanups?: Function[] | null;
35
+ }): void;
32
36
  export declare function onError(fn: (err: any) => void): void;
33
37
  export declare function getListener(): null;
34
38
  export interface Context<T> {
@@ -43,7 +47,7 @@ export declare function createContext<T>(defaultValue?: T): Context<T>;
43
47
  export declare function useContext<T>(context: Context<T>): T;
44
48
  export declare function getOwner(): Owner | null;
45
49
  export declare function children(fn: () => any): () => unknown;
46
- export declare function runWithOwner<T>(o: Owner, fn: () => T): T;
50
+ export declare function runWithOwner<T>(o: Owner, fn: () => T): T | undefined;
47
51
  export declare function lookup(owner: Owner | null, key: symbol | string): any;
48
52
  export interface Task {
49
53
  id: number;
@@ -64,10 +68,10 @@ export declare type ObservableObserver<T> = ((v: T) => void) | {
64
68
  complete?: (v: boolean) => void;
65
69
  };
66
70
  export declare function observable<T>(input: Accessor<T>): {
67
- [x: number]: () => any;
68
71
  subscribe(observer: ObservableObserver<T>): {
69
72
  unsubscribe(): void;
70
73
  };
74
+ [Symbol.observable](): any;
71
75
  };
72
76
  export declare function from<T>(producer: ((setter: Setter<T>) => () => void) | {
73
77
  subscribe: (fn: (v: T) => void) => (() => void) | {