solid-js 2.0.0-experimental.5 → 2.0.0-experimental.6
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 +99 -41
- package/dist/dev.js +92 -31
- package/dist/server.cjs +95 -91
- package/dist/server.js +97 -89
- package/dist/solid.cjs +99 -41
- package/dist/solid.js +92 -31
- package/package.json +5 -3
- package/types/client/component.d.ts +2 -2
- package/types/client/flow.d.ts +1 -16
- package/types/client/hydration.d.ts +35 -5
- package/types/index.d.ts +2 -2
- package/types/jsx.d.ts +643 -1007
- package/types/server/index.d.ts +2 -2
- package/types/server/reactive.d.ts +2 -1
- package/types/server/rendering.d.ts +12 -8
- package/types/server/signals.d.ts +12 -3
package/dist/solid.cjs
CHANGED
|
@@ -76,7 +76,7 @@ function from(producer, initialValue = undefined) {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
const sharedConfig = {
|
|
79
|
-
|
|
79
|
+
hydrating: false,
|
|
80
80
|
registry: undefined,
|
|
81
81
|
done: false,
|
|
82
82
|
getNextContextId() {
|
|
@@ -85,8 +85,90 @@ const sharedConfig = {
|
|
|
85
85
|
return o.getNextChildId();
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
|
-
function
|
|
89
|
-
sharedConfig.
|
|
88
|
+
function Suspense(props) {
|
|
89
|
+
if (!sharedConfig.hydrating) return signals.createSuspense(() => props.children, () => props.fallback);
|
|
90
|
+
return signals.createMemo(() => {
|
|
91
|
+
const o = signals.getOwner();
|
|
92
|
+
const id = o.id;
|
|
93
|
+
if (sharedConfig.hydrating && sharedConfig.has(id)) {
|
|
94
|
+
let ref = sharedConfig.load(id);
|
|
95
|
+
let p;
|
|
96
|
+
if (ref) {
|
|
97
|
+
if (typeof ref !== "object" || ref.s !== "success") p = ref;else sharedConfig.gather(id);
|
|
98
|
+
}
|
|
99
|
+
if (p) {
|
|
100
|
+
const [s, set] = signals.createSignal(undefined, {
|
|
101
|
+
equals: false
|
|
102
|
+
});
|
|
103
|
+
s();
|
|
104
|
+
if (p !== "$$f") {
|
|
105
|
+
p.then(() => {
|
|
106
|
+
sharedConfig.gather(id);
|
|
107
|
+
sharedConfig.hydrating = true;
|
|
108
|
+
set();
|
|
109
|
+
signals.flush();
|
|
110
|
+
sharedConfig.hydrating = false;
|
|
111
|
+
}, err => signals.runWithObserver(o, () => {
|
|
112
|
+
throw err;
|
|
113
|
+
}));
|
|
114
|
+
} else queueMicrotask(set);
|
|
115
|
+
return props.fallback;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return signals.createSuspense(() => props.children, () => props.fallback);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function createAsync(compute, value, options) {
|
|
122
|
+
if (!sharedConfig.hydrating) return signals.createAsync(compute, value, options);
|
|
123
|
+
return signals.createAsync(prev => {
|
|
124
|
+
if (!sharedConfig.hydrating) return compute(prev);
|
|
125
|
+
const o = signals.getOwner();
|
|
126
|
+
let initP;
|
|
127
|
+
if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
|
|
128
|
+
const init = initP?.value || initP;
|
|
129
|
+
return init ? (subFetch(compute, prev), init) : compute(prev);
|
|
130
|
+
}, value, options);
|
|
131
|
+
}
|
|
132
|
+
class MockPromise {
|
|
133
|
+
static all() {
|
|
134
|
+
return new MockPromise();
|
|
135
|
+
}
|
|
136
|
+
static allSettled() {
|
|
137
|
+
return new MockPromise();
|
|
138
|
+
}
|
|
139
|
+
static any() {
|
|
140
|
+
return new MockPromise();
|
|
141
|
+
}
|
|
142
|
+
static race() {
|
|
143
|
+
return new MockPromise();
|
|
144
|
+
}
|
|
145
|
+
static reject() {
|
|
146
|
+
return new MockPromise();
|
|
147
|
+
}
|
|
148
|
+
static resolve() {
|
|
149
|
+
return new MockPromise();
|
|
150
|
+
}
|
|
151
|
+
catch() {
|
|
152
|
+
return new MockPromise();
|
|
153
|
+
}
|
|
154
|
+
then() {
|
|
155
|
+
return new MockPromise();
|
|
156
|
+
}
|
|
157
|
+
finally() {
|
|
158
|
+
return new MockPromise();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function subFetch(fn, prev) {
|
|
162
|
+
const ogFetch = fetch;
|
|
163
|
+
const ogPromise = Promise;
|
|
164
|
+
try {
|
|
165
|
+
window.fetch = () => new MockPromise();
|
|
166
|
+
Promise = MockPromise;
|
|
167
|
+
return fn(prev);
|
|
168
|
+
} finally {
|
|
169
|
+
window.fetch = ogFetch;
|
|
170
|
+
Promise = ogPromise;
|
|
171
|
+
}
|
|
90
172
|
}
|
|
91
173
|
|
|
92
174
|
function enableHydration() {
|
|
@@ -98,30 +180,13 @@ function lazy(fn) {
|
|
|
98
180
|
let comp;
|
|
99
181
|
let p;
|
|
100
182
|
const wrap = props => {
|
|
101
|
-
|
|
102
|
-
if (ctx) {
|
|
103
|
-
const [s, set] = signals.createSignal();
|
|
104
|
-
sharedConfig.count || (sharedConfig.count = 0);
|
|
105
|
-
sharedConfig.count++;
|
|
106
|
-
(p || (p = fn())).then(mod => {
|
|
107
|
-
!sharedConfig.done && setHydrateContext(ctx);
|
|
108
|
-
sharedConfig.count--;
|
|
109
|
-
set(() => mod.default);
|
|
110
|
-
setHydrateContext();
|
|
111
|
-
});
|
|
112
|
-
comp = s;
|
|
113
|
-
} else if (!comp) {
|
|
183
|
+
if (!comp) {
|
|
114
184
|
const s = signals.createAsync(() => (p || (p = fn())).then(mod => mod.default));
|
|
115
185
|
comp = s;
|
|
116
186
|
}
|
|
117
187
|
let Comp;
|
|
118
188
|
return signals.createMemo(() => (Comp = comp()) ? signals.untrack(() => {
|
|
119
|
-
|
|
120
|
-
const c = sharedConfig.context;
|
|
121
|
-
setHydrateContext(ctx);
|
|
122
|
-
const r = Comp(props);
|
|
123
|
-
setHydrateContext(c);
|
|
124
|
-
return r;
|
|
189
|
+
return Comp(props);
|
|
125
190
|
}) : "");
|
|
126
191
|
};
|
|
127
192
|
wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
|
|
@@ -129,8 +194,7 @@ function lazy(fn) {
|
|
|
129
194
|
}
|
|
130
195
|
let counter = 0;
|
|
131
196
|
function createUniqueId() {
|
|
132
|
-
|
|
133
|
-
return ctx ? sharedConfig.getNextContextId() : `cl-${counter++}`;
|
|
197
|
+
return sharedConfig.hydrating ? sharedConfig.getNextContextId() : `cl-${counter++}`;
|
|
134
198
|
}
|
|
135
199
|
|
|
136
200
|
const narrowedError = name => `Stale read from <${name}>.`;
|
|
@@ -208,9 +272,6 @@ function ErrorBoundary(props) {
|
|
|
208
272
|
return typeof f === "function" && f.length ? f(err, reset) : f;
|
|
209
273
|
});
|
|
210
274
|
}
|
|
211
|
-
function Suspense(props) {
|
|
212
|
-
return signals.createSuspense(() => props.children, () => props.fallback);
|
|
213
|
-
}
|
|
214
275
|
function Boundary(props) {
|
|
215
276
|
return signals.createBoundary(() => props.children, () => props.mode);
|
|
216
277
|
}
|
|
@@ -223,18 +284,10 @@ Object.defineProperty(exports, "$PROXY", {
|
|
|
223
284
|
enumerable: true,
|
|
224
285
|
get: function () { return signals.$PROXY; }
|
|
225
286
|
});
|
|
226
|
-
Object.defineProperty(exports, "$RAW", {
|
|
227
|
-
enumerable: true,
|
|
228
|
-
get: function () { return signals.$RAW; }
|
|
229
|
-
});
|
|
230
287
|
Object.defineProperty(exports, "$TRACK", {
|
|
231
288
|
enumerable: true,
|
|
232
289
|
get: function () { return signals.$TRACK; }
|
|
233
290
|
});
|
|
234
|
-
Object.defineProperty(exports, "createAsync", {
|
|
235
|
-
enumerable: true,
|
|
236
|
-
get: function () { return signals.createAsync; }
|
|
237
|
-
});
|
|
238
291
|
Object.defineProperty(exports, "createEffect", {
|
|
239
292
|
enumerable: true,
|
|
240
293
|
get: function () { return signals.createEffect; }
|
|
@@ -263,13 +316,17 @@ Object.defineProperty(exports, "createStore", {
|
|
|
263
316
|
enumerable: true,
|
|
264
317
|
get: function () { return signals.createStore; }
|
|
265
318
|
});
|
|
319
|
+
Object.defineProperty(exports, "deep", {
|
|
320
|
+
enumerable: true,
|
|
321
|
+
get: function () { return signals.deep; }
|
|
322
|
+
});
|
|
266
323
|
Object.defineProperty(exports, "flatten", {
|
|
267
324
|
enumerable: true,
|
|
268
325
|
get: function () { return signals.flatten; }
|
|
269
326
|
});
|
|
270
|
-
Object.defineProperty(exports, "
|
|
327
|
+
Object.defineProperty(exports, "flush", {
|
|
271
328
|
enumerable: true,
|
|
272
|
-
get: function () { return signals.
|
|
329
|
+
get: function () { return signals.flush; }
|
|
273
330
|
});
|
|
274
331
|
Object.defineProperty(exports, "getObserver", {
|
|
275
332
|
enumerable: true,
|
|
@@ -331,6 +388,10 @@ Object.defineProperty(exports, "runWithOwner", {
|
|
|
331
388
|
enumerable: true,
|
|
332
389
|
get: function () { return signals.runWithOwner; }
|
|
333
390
|
});
|
|
391
|
+
Object.defineProperty(exports, "snapshot", {
|
|
392
|
+
enumerable: true,
|
|
393
|
+
get: function () { return signals.snapshot; }
|
|
394
|
+
});
|
|
334
395
|
Object.defineProperty(exports, "tryCatch", {
|
|
335
396
|
enumerable: true,
|
|
336
397
|
get: function () { return signals.tryCatch; }
|
|
@@ -339,10 +400,6 @@ Object.defineProperty(exports, "untrack", {
|
|
|
339
400
|
enumerable: true,
|
|
340
401
|
get: function () { return signals.untrack; }
|
|
341
402
|
});
|
|
342
|
-
Object.defineProperty(exports, "unwrap", {
|
|
343
|
-
enumerable: true,
|
|
344
|
-
get: function () { return signals.unwrap; }
|
|
345
|
-
});
|
|
346
403
|
exports.$DEVCOMP = $DEVCOMP;
|
|
347
404
|
exports.Boundary = Boundary;
|
|
348
405
|
exports.DEV = DEV;
|
|
@@ -354,6 +411,7 @@ exports.Show = Show;
|
|
|
354
411
|
exports.Suspense = Suspense;
|
|
355
412
|
exports.Switch = Switch;
|
|
356
413
|
exports.children = children;
|
|
414
|
+
exports.createAsync = createAsync;
|
|
357
415
|
exports.createComponent = createComponent;
|
|
358
416
|
exports.createContext = createContext;
|
|
359
417
|
exports.createUniqueId = createUniqueId;
|
package/dist/solid.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createEffect, getContext, createMemo, flatten, createRoot, setContext, getOwner, onCleanup, createSignal,
|
|
2
|
-
export { $PROXY, $
|
|
1
|
+
import { createEffect, getContext, createMemo, flatten, createRoot, setContext, getOwner, onCleanup, createSignal, createSuspense, flush, runWithObserver, createAsync as createAsync$1, untrack, mapArray, repeat, createErrorBoundary, createBoundary } from '@solidjs/signals';
|
|
2
|
+
export { $PROXY, $TRACK, createEffect, createMemo, createProjection, createRenderEffect, createRoot, createSignal, createStore, deep, flatten, flush, getObserver, getOwner, isEqual, isPending, isWrappable, latest, mapArray, merge, omit, onCleanup, reconcile, repeat, resolve, runWithObserver, runWithOwner, snapshot, tryCatch, untrack } from '@solidjs/signals';
|
|
3
3
|
|
|
4
4
|
const $DEVCOMP = Symbol(0);
|
|
5
5
|
function onMount(fn) {
|
|
@@ -75,7 +75,7 @@ function from(producer, initialValue = undefined) {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
const sharedConfig = {
|
|
78
|
-
|
|
78
|
+
hydrating: false,
|
|
79
79
|
registry: undefined,
|
|
80
80
|
done: false,
|
|
81
81
|
getNextContextId() {
|
|
@@ -84,8 +84,90 @@ const sharedConfig = {
|
|
|
84
84
|
return o.getNextChildId();
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
-
function
|
|
88
|
-
sharedConfig.
|
|
87
|
+
function Suspense(props) {
|
|
88
|
+
if (!sharedConfig.hydrating) return createSuspense(() => props.children, () => props.fallback);
|
|
89
|
+
return createMemo(() => {
|
|
90
|
+
const o = getOwner();
|
|
91
|
+
const id = o.id;
|
|
92
|
+
if (sharedConfig.hydrating && sharedConfig.has(id)) {
|
|
93
|
+
let ref = sharedConfig.load(id);
|
|
94
|
+
let p;
|
|
95
|
+
if (ref) {
|
|
96
|
+
if (typeof ref !== "object" || ref.s !== "success") p = ref;else sharedConfig.gather(id);
|
|
97
|
+
}
|
|
98
|
+
if (p) {
|
|
99
|
+
const [s, set] = createSignal(undefined, {
|
|
100
|
+
equals: false
|
|
101
|
+
});
|
|
102
|
+
s();
|
|
103
|
+
if (p !== "$$f") {
|
|
104
|
+
p.then(() => {
|
|
105
|
+
sharedConfig.gather(id);
|
|
106
|
+
sharedConfig.hydrating = true;
|
|
107
|
+
set();
|
|
108
|
+
flush();
|
|
109
|
+
sharedConfig.hydrating = false;
|
|
110
|
+
}, err => runWithObserver(o, () => {
|
|
111
|
+
throw err;
|
|
112
|
+
}));
|
|
113
|
+
} else queueMicrotask(set);
|
|
114
|
+
return props.fallback;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return createSuspense(() => props.children, () => props.fallback);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function createAsync(compute, value, options) {
|
|
121
|
+
if (!sharedConfig.hydrating) return createAsync$1(compute, value, options);
|
|
122
|
+
return createAsync$1(prev => {
|
|
123
|
+
if (!sharedConfig.hydrating) return compute(prev);
|
|
124
|
+
const o = getOwner();
|
|
125
|
+
let initP;
|
|
126
|
+
if (sharedConfig.has(o.id)) initP = sharedConfig.load(o.id);
|
|
127
|
+
const init = initP?.value || initP;
|
|
128
|
+
return init ? (subFetch(compute, prev), init) : compute(prev);
|
|
129
|
+
}, value, options);
|
|
130
|
+
}
|
|
131
|
+
class MockPromise {
|
|
132
|
+
static all() {
|
|
133
|
+
return new MockPromise();
|
|
134
|
+
}
|
|
135
|
+
static allSettled() {
|
|
136
|
+
return new MockPromise();
|
|
137
|
+
}
|
|
138
|
+
static any() {
|
|
139
|
+
return new MockPromise();
|
|
140
|
+
}
|
|
141
|
+
static race() {
|
|
142
|
+
return new MockPromise();
|
|
143
|
+
}
|
|
144
|
+
static reject() {
|
|
145
|
+
return new MockPromise();
|
|
146
|
+
}
|
|
147
|
+
static resolve() {
|
|
148
|
+
return new MockPromise();
|
|
149
|
+
}
|
|
150
|
+
catch() {
|
|
151
|
+
return new MockPromise();
|
|
152
|
+
}
|
|
153
|
+
then() {
|
|
154
|
+
return new MockPromise();
|
|
155
|
+
}
|
|
156
|
+
finally() {
|
|
157
|
+
return new MockPromise();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function subFetch(fn, prev) {
|
|
161
|
+
const ogFetch = fetch;
|
|
162
|
+
const ogPromise = Promise;
|
|
163
|
+
try {
|
|
164
|
+
window.fetch = () => new MockPromise();
|
|
165
|
+
Promise = MockPromise;
|
|
166
|
+
return fn(prev);
|
|
167
|
+
} finally {
|
|
168
|
+
window.fetch = ogFetch;
|
|
169
|
+
Promise = ogPromise;
|
|
170
|
+
}
|
|
89
171
|
}
|
|
90
172
|
|
|
91
173
|
function enableHydration() {
|
|
@@ -97,30 +179,13 @@ function lazy(fn) {
|
|
|
97
179
|
let comp;
|
|
98
180
|
let p;
|
|
99
181
|
const wrap = props => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const [s, set] = createSignal();
|
|
103
|
-
sharedConfig.count || (sharedConfig.count = 0);
|
|
104
|
-
sharedConfig.count++;
|
|
105
|
-
(p || (p = fn())).then(mod => {
|
|
106
|
-
!sharedConfig.done && setHydrateContext(ctx);
|
|
107
|
-
sharedConfig.count--;
|
|
108
|
-
set(() => mod.default);
|
|
109
|
-
setHydrateContext();
|
|
110
|
-
});
|
|
111
|
-
comp = s;
|
|
112
|
-
} else if (!comp) {
|
|
113
|
-
const s = createAsync(() => (p || (p = fn())).then(mod => mod.default));
|
|
182
|
+
if (!comp) {
|
|
183
|
+
const s = createAsync$1(() => (p || (p = fn())).then(mod => mod.default));
|
|
114
184
|
comp = s;
|
|
115
185
|
}
|
|
116
186
|
let Comp;
|
|
117
187
|
return createMemo(() => (Comp = comp()) ? untrack(() => {
|
|
118
|
-
|
|
119
|
-
const c = sharedConfig.context;
|
|
120
|
-
setHydrateContext(ctx);
|
|
121
|
-
const r = Comp(props);
|
|
122
|
-
setHydrateContext(c);
|
|
123
|
-
return r;
|
|
188
|
+
return Comp(props);
|
|
124
189
|
}) : "");
|
|
125
190
|
};
|
|
126
191
|
wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p);
|
|
@@ -128,8 +193,7 @@ function lazy(fn) {
|
|
|
128
193
|
}
|
|
129
194
|
let counter = 0;
|
|
130
195
|
function createUniqueId() {
|
|
131
|
-
|
|
132
|
-
return ctx ? sharedConfig.getNextContextId() : `cl-${counter++}`;
|
|
196
|
+
return sharedConfig.hydrating ? sharedConfig.getNextContextId() : `cl-${counter++}`;
|
|
133
197
|
}
|
|
134
198
|
|
|
135
199
|
const narrowedError = name => `Stale read from <${name}>.`;
|
|
@@ -207,9 +271,6 @@ function ErrorBoundary(props) {
|
|
|
207
271
|
return typeof f === "function" && f.length ? f(err, reset) : f;
|
|
208
272
|
});
|
|
209
273
|
}
|
|
210
|
-
function Suspense(props) {
|
|
211
|
-
return createSuspense(() => props.children, () => props.fallback);
|
|
212
|
-
}
|
|
213
274
|
function Boundary(props) {
|
|
214
275
|
return createBoundary(() => props.children, () => props.mode);
|
|
215
276
|
}
|
|
@@ -218,4 +279,4 @@ function ssrHandleError() {}
|
|
|
218
279
|
function ssrRunInScope() {}
|
|
219
280
|
const DEV = undefined;
|
|
220
281
|
|
|
221
|
-
export { $DEVCOMP, Boundary, DEV, ErrorBoundary, For, Match, Repeat, Show, Suspense, Switch, children, createComponent, createContext, createUniqueId, enableHydration, from, lazy, observable, onMount, sharedConfig, ssrHandleError, ssrRunInScope, useContext };
|
|
282
|
+
export { $DEVCOMP, Boundary, DEV, ErrorBoundary, For, Match, Repeat, Show, Suspense, Switch, children, createAsync, createComponent, createContext, createUniqueId, enableHydration, from, lazy, observable, onMount, sharedConfig, ssrHandleError, ssrRunInScope, useContext };
|
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": "2.0.0-experimental.
|
|
4
|
+
"version": "2.0.0-experimental.6",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -79,8 +79,10 @@
|
|
|
79
79
|
"performance"
|
|
80
80
|
],
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@solidjs/signals": "^0.
|
|
83
|
-
"csstype": "^3.1.0"
|
|
82
|
+
"@solidjs/signals": "^0.4.1",
|
|
83
|
+
"csstype": "^3.1.0",
|
|
84
|
+
"seroval": "~1.3.0",
|
|
85
|
+
"seroval-plugins": "~1.3.0"
|
|
84
86
|
},
|
|
85
87
|
"scripts": {
|
|
86
88
|
"build": "npm-run-all -nl build:*",
|
|
@@ -21,7 +21,7 @@ export type VoidProps<P extends Record<string, any> = {}> = P & {
|
|
|
21
21
|
export type VoidComponent<P extends Record<string, any> = {}> = Component<VoidProps<P>>;
|
|
22
22
|
/**
|
|
23
23
|
* Extend props to allow an optional `children` prop with the usual
|
|
24
|
-
* type in JSX, `JSX.Element` (which allows elements, arrays,
|
|
24
|
+
* type in JSX, `JSX.Element` (which allows elements, arrays, strings, etc.).
|
|
25
25
|
* Use this for components that you want to accept children.
|
|
26
26
|
*/
|
|
27
27
|
export type ParentProps<P extends Record<string, any> = {}> = P & {
|
|
@@ -29,7 +29,7 @@ export type ParentProps<P extends Record<string, any> = {}> = P & {
|
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* `ParentComponent` allows an optional `children` prop with the usual
|
|
32
|
-
* type in JSX, `JSX.Element` (which allows elements, arrays,
|
|
32
|
+
* type in JSX, `JSX.Element` (which allows elements, arrays, strings, etc.).
|
|
33
33
|
* Use this for components that you want to accept children.
|
|
34
34
|
*/
|
|
35
35
|
export type ParentComponent<P extends Record<string, any> = {}> = Component<ParentProps<P>>;
|
package/types/client/flow.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import type { JSX } from "../jsx.js";
|
|
|
15
15
|
export declare function For<T extends readonly any[], U extends JSX.Element>(props: {
|
|
16
16
|
each: T | undefined | null | false;
|
|
17
17
|
fallback?: JSX.Element;
|
|
18
|
-
keyed?: boolean | ((item: T) => any);
|
|
18
|
+
keyed?: boolean | ((item: T[number]) => any);
|
|
19
19
|
children: (item: Accessor<T[number]>, index: Accessor<number>) => U;
|
|
20
20
|
}): JSX.Element;
|
|
21
21
|
/**
|
|
@@ -98,21 +98,6 @@ export declare function ErrorBoundary(props: {
|
|
|
98
98
|
fallback: JSX.Element | ((err: any, reset: () => void) => JSX.Element);
|
|
99
99
|
children: JSX.Element;
|
|
100
100
|
}): JSX.Element;
|
|
101
|
-
/**
|
|
102
|
-
* Tracks all resources inside a component and renders a fallback until they are all resolved
|
|
103
|
-
* ```typescript
|
|
104
|
-
* const AsyncComponent = lazy(() => import('./component'));
|
|
105
|
-
*
|
|
106
|
-
* <Suspense fallback={<LoadingIndicator />}>
|
|
107
|
-
* <AsyncComponent />
|
|
108
|
-
* </Suspense>
|
|
109
|
-
* ```
|
|
110
|
-
* @description https://docs.solidjs.com/reference/components/suspense
|
|
111
|
-
*/
|
|
112
|
-
export declare function Suspense(props: {
|
|
113
|
-
fallback?: JSX.Element;
|
|
114
|
-
children: JSX.Element;
|
|
115
|
-
}): JSX.Element;
|
|
116
101
|
export declare function Boundary(props: {
|
|
117
102
|
mode: BoundaryMode;
|
|
118
103
|
children: JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { MemoOptions, Accessor } from "@solidjs/signals";
|
|
2
|
+
import { JSX } from "../jsx.js";
|
|
1
3
|
export type HydrationContext = {};
|
|
2
4
|
type SharedConfig = {
|
|
3
|
-
|
|
5
|
+
hydrating: boolean;
|
|
4
6
|
resources?: {
|
|
5
7
|
[key: string]: any;
|
|
6
8
|
};
|
|
@@ -8,11 +10,39 @@ type SharedConfig = {
|
|
|
8
10
|
has?: (id: string) => boolean;
|
|
9
11
|
gather?: (key: string) => void;
|
|
10
12
|
registry?: Map<string, Element>;
|
|
11
|
-
done
|
|
12
|
-
count?: number;
|
|
13
|
+
done: boolean;
|
|
13
14
|
getNextContextId(): string;
|
|
14
15
|
};
|
|
15
16
|
export declare const sharedConfig: SharedConfig;
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Tracks all resources inside a component and renders a fallback until they are all resolved
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const AsyncComponent = lazy(() => import('./component'));
|
|
21
|
+
*
|
|
22
|
+
* <Suspense fallback={<LoadingIndicator />}>
|
|
23
|
+
* <AsyncComponent />
|
|
24
|
+
* </Suspense>
|
|
25
|
+
* ```
|
|
26
|
+
* @description https://docs.solidjs.com/reference/components/suspense
|
|
27
|
+
*/
|
|
28
|
+
export declare function Suspense(props: {
|
|
29
|
+
fallback?: JSX.Element;
|
|
30
|
+
children: JSX.Element;
|
|
31
|
+
}): JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a readonly derived async reactive memoized signal
|
|
34
|
+
* ```typescript
|
|
35
|
+
* export function createAsync<T>(
|
|
36
|
+
* compute: (v: T) => Promise<T> | T,
|
|
37
|
+
* value?: T,
|
|
38
|
+
* options?: { name?: string, equals?: false | ((prev: T, next: T) => boolean) }
|
|
39
|
+
* ): () => T;
|
|
40
|
+
* ```
|
|
41
|
+
* @param compute a function that receives its previous or the initial value, if set, and returns a new value used to react on a computation
|
|
42
|
+
* @param value an optional initial value for the computation; if set, fn will never receive undefined as first argument
|
|
43
|
+
* @param options allows to set a name in dev mode for debugging purposes and use a custom comparison function in equals
|
|
44
|
+
*
|
|
45
|
+
* @description https://docs.solidjs.com/reference/basic-reactivity/create-async
|
|
46
|
+
*/
|
|
47
|
+
export declare function createAsync<T>(compute: (prev?: T) => Promise<T> | AsyncIterable<T> | T, value?: T, options?: MemoOptions<T>): Accessor<T>;
|
|
18
48
|
export {};
|
package/types/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { $PROXY, $TRACK,
|
|
1
|
+
export { $PROXY, $TRACK, createEffect, createMemo, createProjection, createRenderEffect, createRoot, createSignal, createStore, flatten, flush, getObserver, getOwner, isEqual, isPending, isWrappable, latest, mapArray, merge, omit, onCleanup, reconcile, repeat, resolve, runWithObserver, runWithOwner, snapshot, tryCatch, untrack, deep } from "@solidjs/signals";
|
|
2
2
|
export type { Accessor, BoundaryMode, ComputeFunction, EffectFunction, EffectOptions, Merge, NoInfer, NotWrappable, Omit, Owner, Signal, SignalOptions, Setter, Store, SolidStore, StoreNode, StoreSetter, TryCatchResult } from "@solidjs/signals";
|
|
3
3
|
export { $DEVCOMP, children, createContext, onMount, useContext } from "./client/core.js";
|
|
4
4
|
export type { ChildrenReturn, Context, ContextProviderComponent, ResolvedChildren, ResolvedJSXElement } from "./client/core.js";
|
|
5
5
|
export * from "./client/observable.js";
|
|
6
6
|
export * from "./client/component.js";
|
|
7
7
|
export * from "./client/flow.js";
|
|
8
|
-
export { sharedConfig } from "./client/hydration.js";
|
|
8
|
+
export { sharedConfig, createAsync, Suspense } from "./client/hydration.js";
|
|
9
9
|
export declare function ssrHandleError(): void;
|
|
10
10
|
export declare function ssrRunInScope(): void;
|
|
11
11
|
import type { JSX } from "./jsx.js";
|