solid-js 1.3.3 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.cjs +13 -1
- package/dist/dev.js +13 -2
- package/dist/server.cjs +12 -6
- package/dist/server.js +11 -7
- package/dist/solid.cjs +13 -1
- package/dist/solid.js +13 -2
- package/package.json +2 -2
- package/store/dist/dev.cjs +3 -3
- package/store/dist/dev.js +3 -3
- package/store/dist/server.cjs +3 -3
- package/store/dist/server.js +3 -3
- package/store/dist/store.cjs +3 -3
- package/store/dist/store.js +3 -3
- package/types/index.d.ts +1 -1
- package/types/jsx.d.ts +2 -0
- package/types/reactive/signal.d.ts +2 -2
- package/types/render/component.d.ts +2 -1
- package/types/render/flow.d.ts +1 -0
- package/types/server/index.d.ts +1 -1
- package/types/server/reactive.d.ts +1 -1
- package/types/server/rendering.d.ts +3 -0
- package/web/dist/dev.cjs +10 -9
- package/web/dist/dev.js +10 -10
- package/web/dist/server.cjs +31 -14
- package/web/dist/server.js +31 -14
- package/web/dist/web.cjs +10 -9
- package/web/dist/web.js +10 -10
- package/web/types/client.d.ts +1 -0
package/dist/dev.cjs
CHANGED
|
@@ -267,6 +267,7 @@ function createResource(source, fetcher, options) {
|
|
|
267
267
|
initP = null,
|
|
268
268
|
id = null,
|
|
269
269
|
loadedUnderTransition = false,
|
|
270
|
+
scheduled = false,
|
|
270
271
|
dynamic = typeof source === "function";
|
|
271
272
|
if (sharedConfig.context) {
|
|
272
273
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
@@ -321,6 +322,8 @@ function createResource(source, fetcher, options) {
|
|
|
321
322
|
return v;
|
|
322
323
|
}
|
|
323
324
|
function load(refetching = true) {
|
|
325
|
+
if (refetching && scheduled) return;
|
|
326
|
+
scheduled = false;
|
|
324
327
|
setError(err = undefined);
|
|
325
328
|
const lookup = dynamic ? source() : source;
|
|
326
329
|
loadedUnderTransition = Transition && Transition.running;
|
|
@@ -338,6 +341,8 @@ function createResource(source, fetcher, options) {
|
|
|
338
341
|
return p;
|
|
339
342
|
}
|
|
340
343
|
pr = p;
|
|
344
|
+
scheduled = true;
|
|
345
|
+
queueMicrotask(() => scheduled = false);
|
|
341
346
|
batch(() => {
|
|
342
347
|
setLoading(true);
|
|
343
348
|
trigger();
|
|
@@ -1313,7 +1318,6 @@ function lazy(fn) {
|
|
|
1313
1318
|
const wrap = props => {
|
|
1314
1319
|
const ctx = sharedConfig.context;
|
|
1315
1320
|
if (ctx) {
|
|
1316
|
-
ctx.count++;
|
|
1317
1321
|
const [s, set] = createSignal();
|
|
1318
1322
|
(p || (p = fn())).then(mod => {
|
|
1319
1323
|
setHydrateContext(ctx);
|
|
@@ -1402,12 +1406,19 @@ function Switch(props) {
|
|
|
1402
1406
|
function Match(props) {
|
|
1403
1407
|
return props;
|
|
1404
1408
|
}
|
|
1409
|
+
let Errors;
|
|
1410
|
+
function resetErrorBoundaries() {
|
|
1411
|
+
Errors && [...Errors].forEach(fn => fn());
|
|
1412
|
+
}
|
|
1405
1413
|
function ErrorBoundary(props) {
|
|
1406
1414
|
let err = undefined;
|
|
1407
1415
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1408
1416
|
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1409
1417
|
}
|
|
1410
1418
|
const [errored, setErrored] = createSignal(err);
|
|
1419
|
+
Errors || (Errors = new Set());
|
|
1420
|
+
Errors.add(setErrored);
|
|
1421
|
+
onCleanup(() => Errors.delete(setErrored));
|
|
1411
1422
|
let e;
|
|
1412
1423
|
return createMemo(() => {
|
|
1413
1424
|
if ((e = errored()) != null) {
|
|
@@ -1627,6 +1638,7 @@ exports.onError = onError;
|
|
|
1627
1638
|
exports.onMount = onMount;
|
|
1628
1639
|
exports.refetchResources = refetchResources;
|
|
1629
1640
|
exports.requestCallback = requestCallback;
|
|
1641
|
+
exports.resetErrorBoundaries = resetErrorBoundaries;
|
|
1630
1642
|
exports.runWithOwner = runWithOwner;
|
|
1631
1643
|
exports.sharedConfig = sharedConfig;
|
|
1632
1644
|
exports.splitProps = splitProps;
|
package/dist/dev.js
CHANGED
|
@@ -263,6 +263,7 @@ function createResource(source, fetcher, options) {
|
|
|
263
263
|
initP = null,
|
|
264
264
|
id = null,
|
|
265
265
|
loadedUnderTransition = false,
|
|
266
|
+
scheduled = false,
|
|
266
267
|
dynamic = typeof source === "function";
|
|
267
268
|
if (sharedConfig.context) {
|
|
268
269
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
@@ -317,6 +318,8 @@ function createResource(source, fetcher, options) {
|
|
|
317
318
|
return v;
|
|
318
319
|
}
|
|
319
320
|
function load(refetching = true) {
|
|
321
|
+
if (refetching && scheduled) return;
|
|
322
|
+
scheduled = false;
|
|
320
323
|
setError(err = undefined);
|
|
321
324
|
const lookup = dynamic ? source() : source;
|
|
322
325
|
loadedUnderTransition = Transition && Transition.running;
|
|
@@ -334,6 +337,8 @@ function createResource(source, fetcher, options) {
|
|
|
334
337
|
return p;
|
|
335
338
|
}
|
|
336
339
|
pr = p;
|
|
340
|
+
scheduled = true;
|
|
341
|
+
queueMicrotask(() => scheduled = false);
|
|
337
342
|
batch(() => {
|
|
338
343
|
setLoading(true);
|
|
339
344
|
trigger();
|
|
@@ -1309,7 +1314,6 @@ function lazy(fn) {
|
|
|
1309
1314
|
const wrap = props => {
|
|
1310
1315
|
const ctx = sharedConfig.context;
|
|
1311
1316
|
if (ctx) {
|
|
1312
|
-
ctx.count++;
|
|
1313
1317
|
const [s, set] = createSignal();
|
|
1314
1318
|
(p || (p = fn())).then(mod => {
|
|
1315
1319
|
setHydrateContext(ctx);
|
|
@@ -1398,12 +1402,19 @@ function Switch(props) {
|
|
|
1398
1402
|
function Match(props) {
|
|
1399
1403
|
return props;
|
|
1400
1404
|
}
|
|
1405
|
+
let Errors;
|
|
1406
|
+
function resetErrorBoundaries() {
|
|
1407
|
+
Errors && [...Errors].forEach(fn => fn());
|
|
1408
|
+
}
|
|
1401
1409
|
function ErrorBoundary(props) {
|
|
1402
1410
|
let err = undefined;
|
|
1403
1411
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1404
1412
|
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1405
1413
|
}
|
|
1406
1414
|
const [errored, setErrored] = createSignal(err);
|
|
1415
|
+
Errors || (Errors = new Set());
|
|
1416
|
+
Errors.add(setErrored);
|
|
1417
|
+
onCleanup(() => Errors.delete(setErrored));
|
|
1407
1418
|
let e;
|
|
1408
1419
|
return createMemo(() => {
|
|
1409
1420
|
if ((e = errored()) != null) {
|
|
@@ -1579,4 +1590,4 @@ if (globalThis) {
|
|
|
1579
1590
|
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
1580
1591
|
}
|
|
1581
1592
|
|
|
1582
|
-
export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
|
1593
|
+
export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, resetErrorBoundaries, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
package/dist/server.cjs
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const equalFn = (a, b) => a === b;
|
|
6
6
|
const $PROXY = Symbol("solid-proxy");
|
|
7
|
-
const $DEVCOMP = Symbol(
|
|
7
|
+
const $DEVCOMP = Symbol("solid-dev-component");
|
|
8
8
|
const DEV = {};
|
|
9
9
|
const ERROR = Symbol("error");
|
|
10
10
|
const UNOWNED = {
|
|
@@ -79,7 +79,7 @@ function createMemo(fn, value) {
|
|
|
79
79
|
function createDeferred(source) {
|
|
80
80
|
return source;
|
|
81
81
|
}
|
|
82
|
-
function createSelector(source, fn) {
|
|
82
|
+
function createSelector(source, fn = equalFn) {
|
|
83
83
|
return k => fn(k, source());
|
|
84
84
|
}
|
|
85
85
|
function batch(fn) {
|
|
@@ -311,6 +311,7 @@ function Switch(props) {
|
|
|
311
311
|
function Match(props) {
|
|
312
312
|
return props;
|
|
313
313
|
}
|
|
314
|
+
function resetErrorBoundaries() {}
|
|
314
315
|
function ErrorBoundary(props) {
|
|
315
316
|
let error, res;
|
|
316
317
|
const ctx = sharedConfig.context;
|
|
@@ -349,7 +350,7 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
349
350
|
if (sharedConfig.context.async) {
|
|
350
351
|
resource = sharedConfig.context.resources[id] || (sharedConfig.context.resources[id] = {});
|
|
351
352
|
if (resource.ref) {
|
|
352
|
-
if (!resource.data && !resource.ref[0].loading) resource.ref[1].refetch();
|
|
353
|
+
if (!resource.data && !resource.ref[0].loading && !resource.ref[0].error) resource.ref[1].refetch();
|
|
353
354
|
return resource.ref;
|
|
354
355
|
}
|
|
355
356
|
}
|
|
@@ -367,6 +368,7 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
367
368
|
return resolved ? sharedConfig.context.resources[id].data : value;
|
|
368
369
|
};
|
|
369
370
|
read.loading = false;
|
|
371
|
+
read.error = undefined;
|
|
370
372
|
function load() {
|
|
371
373
|
const ctx = sharedConfig.context;
|
|
372
374
|
if (!ctx.async) return read.loading = !!(typeof fn === "function" ? fn() : fn);
|
|
@@ -395,7 +397,7 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
395
397
|
return res;
|
|
396
398
|
}).catch(err => {
|
|
397
399
|
read.loading = false;
|
|
398
|
-
error = err;
|
|
400
|
+
read.error = error = err;
|
|
399
401
|
p = null;
|
|
400
402
|
notifySuspense(contexts);
|
|
401
403
|
});
|
|
@@ -410,17 +412,19 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
410
412
|
mutate: v => value = v
|
|
411
413
|
}];
|
|
412
414
|
}
|
|
415
|
+
function refetchResources(info) {}
|
|
413
416
|
function lazy(fn) {
|
|
414
417
|
let resolved;
|
|
415
418
|
const p = fn();
|
|
416
419
|
const contexts = new Set();
|
|
417
420
|
p.then(mod => resolved = mod.default);
|
|
418
421
|
const wrap = props => {
|
|
419
|
-
const id = sharedConfig.context.id
|
|
422
|
+
const id = sharedConfig.context.id.slice(0, -1);
|
|
420
423
|
if (resolved) return resolved(props);
|
|
421
424
|
const ctx = useContext(SuspenseContext);
|
|
422
425
|
const track = {
|
|
423
|
-
loading: true
|
|
426
|
+
loading: true,
|
|
427
|
+
error: undefined
|
|
424
428
|
};
|
|
425
429
|
if (ctx) {
|
|
426
430
|
ctx.resources.set(id, track);
|
|
@@ -556,7 +560,9 @@ exports.on = on;
|
|
|
556
560
|
exports.onCleanup = onCleanup;
|
|
557
561
|
exports.onError = onError;
|
|
558
562
|
exports.onMount = onMount;
|
|
563
|
+
exports.refetchResources = refetchResources;
|
|
559
564
|
exports.requestCallback = requestCallback;
|
|
565
|
+
exports.resetErrorBoundaries = resetErrorBoundaries;
|
|
560
566
|
exports.runWithOwner = runWithOwner;
|
|
561
567
|
exports.sharedConfig = sharedConfig;
|
|
562
568
|
exports.splitProps = splitProps;
|
package/dist/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const equalFn = (a, b) => a === b;
|
|
2
2
|
const $PROXY = Symbol("solid-proxy");
|
|
3
|
-
const $DEVCOMP = Symbol(
|
|
3
|
+
const $DEVCOMP = Symbol("solid-dev-component");
|
|
4
4
|
const DEV = {};
|
|
5
5
|
const ERROR = Symbol("error");
|
|
6
6
|
const UNOWNED = {
|
|
@@ -75,7 +75,7 @@ function createMemo(fn, value) {
|
|
|
75
75
|
function createDeferred(source) {
|
|
76
76
|
return source;
|
|
77
77
|
}
|
|
78
|
-
function createSelector(source, fn) {
|
|
78
|
+
function createSelector(source, fn = equalFn) {
|
|
79
79
|
return k => fn(k, source());
|
|
80
80
|
}
|
|
81
81
|
function batch(fn) {
|
|
@@ -307,6 +307,7 @@ function Switch(props) {
|
|
|
307
307
|
function Match(props) {
|
|
308
308
|
return props;
|
|
309
309
|
}
|
|
310
|
+
function resetErrorBoundaries() {}
|
|
310
311
|
function ErrorBoundary(props) {
|
|
311
312
|
let error, res;
|
|
312
313
|
const ctx = sharedConfig.context;
|
|
@@ -345,7 +346,7 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
345
346
|
if (sharedConfig.context.async) {
|
|
346
347
|
resource = sharedConfig.context.resources[id] || (sharedConfig.context.resources[id] = {});
|
|
347
348
|
if (resource.ref) {
|
|
348
|
-
if (!resource.data && !resource.ref[0].loading) resource.ref[1].refetch();
|
|
349
|
+
if (!resource.data && !resource.ref[0].loading && !resource.ref[0].error) resource.ref[1].refetch();
|
|
349
350
|
return resource.ref;
|
|
350
351
|
}
|
|
351
352
|
}
|
|
@@ -363,6 +364,7 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
363
364
|
return resolved ? sharedConfig.context.resources[id].data : value;
|
|
364
365
|
};
|
|
365
366
|
read.loading = false;
|
|
367
|
+
read.error = undefined;
|
|
366
368
|
function load() {
|
|
367
369
|
const ctx = sharedConfig.context;
|
|
368
370
|
if (!ctx.async) return read.loading = !!(typeof fn === "function" ? fn() : fn);
|
|
@@ -391,7 +393,7 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
391
393
|
return res;
|
|
392
394
|
}).catch(err => {
|
|
393
395
|
read.loading = false;
|
|
394
|
-
error = err;
|
|
396
|
+
read.error = error = err;
|
|
395
397
|
p = null;
|
|
396
398
|
notifySuspense(contexts);
|
|
397
399
|
});
|
|
@@ -406,17 +408,19 @@ function createResource(fn, fetcher, options = {}) {
|
|
|
406
408
|
mutate: v => value = v
|
|
407
409
|
}];
|
|
408
410
|
}
|
|
411
|
+
function refetchResources(info) {}
|
|
409
412
|
function lazy(fn) {
|
|
410
413
|
let resolved;
|
|
411
414
|
const p = fn();
|
|
412
415
|
const contexts = new Set();
|
|
413
416
|
p.then(mod => resolved = mod.default);
|
|
414
417
|
const wrap = props => {
|
|
415
|
-
const id = sharedConfig.context.id
|
|
418
|
+
const id = sharedConfig.context.id.slice(0, -1);
|
|
416
419
|
if (resolved) return resolved(props);
|
|
417
420
|
const ctx = useContext(SuspenseContext);
|
|
418
421
|
const track = {
|
|
419
|
-
loading: true
|
|
422
|
+
loading: true,
|
|
423
|
+
error: undefined
|
|
420
424
|
};
|
|
421
425
|
if (ctx) {
|
|
422
426
|
ctx.resources.set(id, track);
|
|
@@ -511,4 +515,4 @@ function Suspense(props) {
|
|
|
511
515
|
return props.fallback;
|
|
512
516
|
}
|
|
513
517
|
|
|
514
|
-
export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
|
518
|
+
export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, resetErrorBoundaries, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
package/dist/solid.cjs
CHANGED
|
@@ -264,6 +264,7 @@ function createResource(source, fetcher, options) {
|
|
|
264
264
|
initP = null,
|
|
265
265
|
id = null,
|
|
266
266
|
loadedUnderTransition = false,
|
|
267
|
+
scheduled = false,
|
|
267
268
|
dynamic = typeof source === "function";
|
|
268
269
|
if (sharedConfig.context) {
|
|
269
270
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
@@ -318,6 +319,8 @@ function createResource(source, fetcher, options) {
|
|
|
318
319
|
return v;
|
|
319
320
|
}
|
|
320
321
|
function load(refetching = true) {
|
|
322
|
+
if (refetching && scheduled) return;
|
|
323
|
+
scheduled = false;
|
|
321
324
|
setError(err = undefined);
|
|
322
325
|
const lookup = dynamic ? source() : source;
|
|
323
326
|
loadedUnderTransition = Transition && Transition.running;
|
|
@@ -335,6 +338,8 @@ function createResource(source, fetcher, options) {
|
|
|
335
338
|
return p;
|
|
336
339
|
}
|
|
337
340
|
pr = p;
|
|
341
|
+
scheduled = true;
|
|
342
|
+
queueMicrotask(() => scheduled = false);
|
|
338
343
|
batch(() => {
|
|
339
344
|
setLoading(true);
|
|
340
345
|
trigger();
|
|
@@ -1232,7 +1237,6 @@ function lazy(fn) {
|
|
|
1232
1237
|
const wrap = props => {
|
|
1233
1238
|
const ctx = sharedConfig.context;
|
|
1234
1239
|
if (ctx) {
|
|
1235
|
-
ctx.count++;
|
|
1236
1240
|
const [s, set] = createSignal();
|
|
1237
1241
|
(p || (p = fn())).then(mod => {
|
|
1238
1242
|
setHydrateContext(ctx);
|
|
@@ -1318,12 +1322,19 @@ function Switch(props) {
|
|
|
1318
1322
|
function Match(props) {
|
|
1319
1323
|
return props;
|
|
1320
1324
|
}
|
|
1325
|
+
let Errors;
|
|
1326
|
+
function resetErrorBoundaries() {
|
|
1327
|
+
Errors && [...Errors].forEach(fn => fn());
|
|
1328
|
+
}
|
|
1321
1329
|
function ErrorBoundary(props) {
|
|
1322
1330
|
let err = undefined;
|
|
1323
1331
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1324
1332
|
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1325
1333
|
}
|
|
1326
1334
|
const [errored, setErrored] = createSignal(err);
|
|
1335
|
+
Errors || (Errors = new Set());
|
|
1336
|
+
Errors.add(setErrored);
|
|
1337
|
+
onCleanup(() => Errors.delete(setErrored));
|
|
1327
1338
|
let e;
|
|
1328
1339
|
return createMemo(() => {
|
|
1329
1340
|
if ((e = errored()) != null) {
|
|
@@ -1533,6 +1544,7 @@ exports.onError = onError;
|
|
|
1533
1544
|
exports.onMount = onMount;
|
|
1534
1545
|
exports.refetchResources = refetchResources;
|
|
1535
1546
|
exports.requestCallback = requestCallback;
|
|
1547
|
+
exports.resetErrorBoundaries = resetErrorBoundaries;
|
|
1536
1548
|
exports.runWithOwner = runWithOwner;
|
|
1537
1549
|
exports.sharedConfig = sharedConfig;
|
|
1538
1550
|
exports.splitProps = splitProps;
|
package/dist/solid.js
CHANGED
|
@@ -260,6 +260,7 @@ function createResource(source, fetcher, options) {
|
|
|
260
260
|
initP = null,
|
|
261
261
|
id = null,
|
|
262
262
|
loadedUnderTransition = false,
|
|
263
|
+
scheduled = false,
|
|
263
264
|
dynamic = typeof source === "function";
|
|
264
265
|
if (sharedConfig.context) {
|
|
265
266
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
@@ -314,6 +315,8 @@ function createResource(source, fetcher, options) {
|
|
|
314
315
|
return v;
|
|
315
316
|
}
|
|
316
317
|
function load(refetching = true) {
|
|
318
|
+
if (refetching && scheduled) return;
|
|
319
|
+
scheduled = false;
|
|
317
320
|
setError(err = undefined);
|
|
318
321
|
const lookup = dynamic ? source() : source;
|
|
319
322
|
loadedUnderTransition = Transition && Transition.running;
|
|
@@ -331,6 +334,8 @@ function createResource(source, fetcher, options) {
|
|
|
331
334
|
return p;
|
|
332
335
|
}
|
|
333
336
|
pr = p;
|
|
337
|
+
scheduled = true;
|
|
338
|
+
queueMicrotask(() => scheduled = false);
|
|
334
339
|
batch(() => {
|
|
335
340
|
setLoading(true);
|
|
336
341
|
trigger();
|
|
@@ -1228,7 +1233,6 @@ function lazy(fn) {
|
|
|
1228
1233
|
const wrap = props => {
|
|
1229
1234
|
const ctx = sharedConfig.context;
|
|
1230
1235
|
if (ctx) {
|
|
1231
|
-
ctx.count++;
|
|
1232
1236
|
const [s, set] = createSignal();
|
|
1233
1237
|
(p || (p = fn())).then(mod => {
|
|
1234
1238
|
setHydrateContext(ctx);
|
|
@@ -1314,12 +1318,19 @@ function Switch(props) {
|
|
|
1314
1318
|
function Match(props) {
|
|
1315
1319
|
return props;
|
|
1316
1320
|
}
|
|
1321
|
+
let Errors;
|
|
1322
|
+
function resetErrorBoundaries() {
|
|
1323
|
+
Errors && [...Errors].forEach(fn => fn());
|
|
1324
|
+
}
|
|
1317
1325
|
function ErrorBoundary(props) {
|
|
1318
1326
|
let err = undefined;
|
|
1319
1327
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1320
1328
|
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1321
1329
|
}
|
|
1322
1330
|
const [errored, setErrored] = createSignal(err);
|
|
1331
|
+
Errors || (Errors = new Set());
|
|
1332
|
+
Errors.add(setErrored);
|
|
1333
|
+
onCleanup(() => Errors.delete(setErrored));
|
|
1323
1334
|
let e;
|
|
1324
1335
|
return createMemo(() => {
|
|
1325
1336
|
if ((e = errored()) != null) {
|
|
@@ -1484,4 +1495,4 @@ function Suspense(props) {
|
|
|
1484
1495
|
|
|
1485
1496
|
let DEV;
|
|
1486
1497
|
|
|
1487
|
-
export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
|
1498
|
+
export { $DEVCOMP, $PROXY, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, refetchResources, requestCallback, resetErrorBoundaries, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition };
|
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.3.
|
|
4
|
+
"version": "1.3.7",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -144,5 +144,5 @@
|
|
|
144
144
|
"compiler",
|
|
145
145
|
"performance"
|
|
146
146
|
],
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "9e72454dafafeca50b6151ae4932ccd3aa3851f3"
|
|
148
148
|
}
|
package/store/dist/dev.cjs
CHANGED
|
@@ -147,12 +147,12 @@ function updatePath(current, path, traversed = []) {
|
|
|
147
147
|
isArray = Array.isArray(current);
|
|
148
148
|
if (Array.isArray(part)) {
|
|
149
149
|
for (let i = 0; i < part.length; i++) {
|
|
150
|
-
updatePath(current, [part[i]].concat(path),
|
|
150
|
+
updatePath(current, [part[i]].concat(path), traversed);
|
|
151
151
|
}
|
|
152
152
|
return;
|
|
153
153
|
} else if (isArray && partType === "function") {
|
|
154
154
|
for (let i = 0; i < current.length; i++) {
|
|
155
|
-
if (part(current[i], i)) updatePath(current, [i].concat(path),
|
|
155
|
+
if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
|
|
156
156
|
}
|
|
157
157
|
return;
|
|
158
158
|
} else if (isArray && partType === "object") {
|
|
@@ -162,7 +162,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
162
162
|
by = 1
|
|
163
163
|
} = part;
|
|
164
164
|
for (let i = from; i <= to; i += by) {
|
|
165
|
-
updatePath(current, [i].concat(path),
|
|
165
|
+
updatePath(current, [i].concat(path), traversed);
|
|
166
166
|
}
|
|
167
167
|
return;
|
|
168
168
|
} else if (path.length > 1) {
|
package/store/dist/dev.js
CHANGED
|
@@ -143,12 +143,12 @@ function updatePath(current, path, traversed = []) {
|
|
|
143
143
|
isArray = Array.isArray(current);
|
|
144
144
|
if (Array.isArray(part)) {
|
|
145
145
|
for (let i = 0; i < part.length; i++) {
|
|
146
|
-
updatePath(current, [part[i]].concat(path),
|
|
146
|
+
updatePath(current, [part[i]].concat(path), traversed);
|
|
147
147
|
}
|
|
148
148
|
return;
|
|
149
149
|
} else if (isArray && partType === "function") {
|
|
150
150
|
for (let i = 0; i < current.length; i++) {
|
|
151
|
-
if (part(current[i], i)) updatePath(current, [i].concat(path),
|
|
151
|
+
if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
|
|
152
152
|
}
|
|
153
153
|
return;
|
|
154
154
|
} else if (isArray && partType === "object") {
|
|
@@ -158,7 +158,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
158
158
|
by = 1
|
|
159
159
|
} = part;
|
|
160
160
|
for (let i = from; i <= to; i += by) {
|
|
161
|
-
updatePath(current, [i].concat(path),
|
|
161
|
+
updatePath(current, [i].concat(path), traversed);
|
|
162
162
|
}
|
|
163
163
|
return;
|
|
164
164
|
} else if (path.length > 1) {
|
package/store/dist/server.cjs
CHANGED
|
@@ -31,12 +31,12 @@ function updatePath(current, path, traversed = []) {
|
|
|
31
31
|
isArray = Array.isArray(current);
|
|
32
32
|
if (Array.isArray(part)) {
|
|
33
33
|
for (let i = 0; i < part.length; i++) {
|
|
34
|
-
updatePath(current, [part[i]].concat(path),
|
|
34
|
+
updatePath(current, [part[i]].concat(path), traversed);
|
|
35
35
|
}
|
|
36
36
|
return;
|
|
37
37
|
} else if (isArray && partType === "function") {
|
|
38
38
|
for (let i = 0; i < current.length; i++) {
|
|
39
|
-
if (part(current[i], i)) updatePath(current, [i].concat(path),
|
|
39
|
+
if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
|
|
40
40
|
}
|
|
41
41
|
return;
|
|
42
42
|
} else if (isArray && partType === "object") {
|
|
@@ -46,7 +46,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
46
46
|
by = 1
|
|
47
47
|
} = part;
|
|
48
48
|
for (let i = from; i <= to; i += by) {
|
|
49
|
-
updatePath(current, [i].concat(path),
|
|
49
|
+
updatePath(current, [i].concat(path), traversed);
|
|
50
50
|
}
|
|
51
51
|
return;
|
|
52
52
|
} else if (path.length > 1) {
|
package/store/dist/server.js
CHANGED
|
@@ -27,12 +27,12 @@ function updatePath(current, path, traversed = []) {
|
|
|
27
27
|
isArray = Array.isArray(current);
|
|
28
28
|
if (Array.isArray(part)) {
|
|
29
29
|
for (let i = 0; i < part.length; i++) {
|
|
30
|
-
updatePath(current, [part[i]].concat(path),
|
|
30
|
+
updatePath(current, [part[i]].concat(path), traversed);
|
|
31
31
|
}
|
|
32
32
|
return;
|
|
33
33
|
} else if (isArray && partType === "function") {
|
|
34
34
|
for (let i = 0; i < current.length; i++) {
|
|
35
|
-
if (part(current[i], i)) updatePath(current, [i].concat(path),
|
|
35
|
+
if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
|
|
36
36
|
}
|
|
37
37
|
return;
|
|
38
38
|
} else if (isArray && partType === "object") {
|
|
@@ -42,7 +42,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
42
42
|
by = 1
|
|
43
43
|
} = part;
|
|
44
44
|
for (let i = from; i <= to; i += by) {
|
|
45
|
-
updatePath(current, [i].concat(path),
|
|
45
|
+
updatePath(current, [i].concat(path), traversed);
|
|
46
46
|
}
|
|
47
47
|
return;
|
|
48
48
|
} else if (path.length > 1) {
|
package/store/dist/store.cjs
CHANGED
|
@@ -142,12 +142,12 @@ function updatePath(current, path, traversed = []) {
|
|
|
142
142
|
isArray = Array.isArray(current);
|
|
143
143
|
if (Array.isArray(part)) {
|
|
144
144
|
for (let i = 0; i < part.length; i++) {
|
|
145
|
-
updatePath(current, [part[i]].concat(path),
|
|
145
|
+
updatePath(current, [part[i]].concat(path), traversed);
|
|
146
146
|
}
|
|
147
147
|
return;
|
|
148
148
|
} else if (isArray && partType === "function") {
|
|
149
149
|
for (let i = 0; i < current.length; i++) {
|
|
150
|
-
if (part(current[i], i)) updatePath(current, [i].concat(path),
|
|
150
|
+
if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
|
|
151
151
|
}
|
|
152
152
|
return;
|
|
153
153
|
} else if (isArray && partType === "object") {
|
|
@@ -157,7 +157,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
157
157
|
by = 1
|
|
158
158
|
} = part;
|
|
159
159
|
for (let i = from; i <= to; i += by) {
|
|
160
|
-
updatePath(current, [i].concat(path),
|
|
160
|
+
updatePath(current, [i].concat(path), traversed);
|
|
161
161
|
}
|
|
162
162
|
return;
|
|
163
163
|
} else if (path.length > 1) {
|
package/store/dist/store.js
CHANGED
|
@@ -138,12 +138,12 @@ function updatePath(current, path, traversed = []) {
|
|
|
138
138
|
isArray = Array.isArray(current);
|
|
139
139
|
if (Array.isArray(part)) {
|
|
140
140
|
for (let i = 0; i < part.length; i++) {
|
|
141
|
-
updatePath(current, [part[i]].concat(path),
|
|
141
|
+
updatePath(current, [part[i]].concat(path), traversed);
|
|
142
142
|
}
|
|
143
143
|
return;
|
|
144
144
|
} else if (isArray && partType === "function") {
|
|
145
145
|
for (let i = 0; i < current.length; i++) {
|
|
146
|
-
if (part(current[i], i)) updatePath(current, [i].concat(path),
|
|
146
|
+
if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
|
|
147
147
|
}
|
|
148
148
|
return;
|
|
149
149
|
} else if (isArray && partType === "object") {
|
|
@@ -153,7 +153,7 @@ function updatePath(current, path, traversed = []) {
|
|
|
153
153
|
by = 1
|
|
154
154
|
} = part;
|
|
155
155
|
for (let i = from; i <= to; i += by) {
|
|
156
|
-
updatePath(current, [i].concat(path),
|
|
156
|
+
updatePath(current, [i].concat(path), traversed);
|
|
157
157
|
}
|
|
158
158
|
return;
|
|
159
159
|
} else if (path.length > 1) {
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createRoot, createSignal, createEffect, createRenderEffect, createComputed, createReaction, createDeferred, createSelector, createMemo, createResource, onMount, onCleanup, onError, untrack, batch, on, enableScheduling, enableExternalSource, startTransition, useTransition, refetchResources, createContext, useContext, children, getListener, getOwner, runWithOwner, equalFn, $DEVCOMP, $PROXY } from "./reactive/signal";
|
|
2
|
-
export type { Accessor, Setter, Resource, ResourceReturn, ResourceFetcher, ResourceFetcherInfo, Context, ReturnTypes } from "./reactive/signal";
|
|
2
|
+
export type { Accessor, Setter, Signal, Resource, ResourceReturn, ResourceFetcher, ResourceFetcherInfo, Context, ReturnTypes } from "./reactive/signal";
|
|
3
3
|
export * from "./reactive/observable";
|
|
4
4
|
export * from "./reactive/scheduler";
|
|
5
5
|
export * from "./reactive/array";
|
package/types/jsx.d.ts
CHANGED
|
@@ -2085,6 +2085,8 @@ export namespace JSX {
|
|
|
2085
2085
|
}
|
|
2086
2086
|
interface DetailsHtmlAttributes<T> extends HTMLAttributes<T> {
|
|
2087
2087
|
open?: boolean;
|
|
2088
|
+
onToggle?: EventHandlerUnion<T, Event>;
|
|
2089
|
+
ontoggle?: EventHandlerUnion<T, Event>;
|
|
2088
2090
|
}
|
|
2089
2091
|
interface DialogHtmlAttributes<T> extends HTMLAttributes<T> {
|
|
2090
2092
|
open?: boolean;
|
|
@@ -204,13 +204,13 @@ export declare type ResourceActions<T> = {
|
|
|
204
204
|
refetch: (info?: unknown) => void;
|
|
205
205
|
};
|
|
206
206
|
export declare type ResourceReturn<T> = [Resource<T>, ResourceActions<T>];
|
|
207
|
-
export declare type ResourceSource<S> = S | false | null | (() => S | false | null);
|
|
207
|
+
export declare type ResourceSource<S> = S | false | null | undefined | (() => S | false | null | undefined);
|
|
208
208
|
export declare type ResourceFetcher<S, T> = (k: S, info: ResourceFetcherInfo<T>) => T | Promise<T>;
|
|
209
209
|
export declare type ResourceFetcherInfo<T> = {
|
|
210
210
|
value: T | undefined;
|
|
211
211
|
refetching?: unknown;
|
|
212
212
|
};
|
|
213
|
-
export declare type ResourceOptions<T> =
|
|
213
|
+
export declare type ResourceOptions<T> = undefined extends T ? {
|
|
214
214
|
initialValue?: T;
|
|
215
215
|
name?: string;
|
|
216
216
|
globalRefetch?: boolean;
|
|
@@ -13,8 +13,9 @@ export declare type Component<P = {}> = (props: PropsWithChildren<P>) => JSX.Ele
|
|
|
13
13
|
*/
|
|
14
14
|
export declare type ComponentProps<T extends keyof JSX.IntrinsicElements | Component<any>> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : {};
|
|
15
15
|
export declare function createComponent<T>(Comp: (props: T) => JSX.Element, props: T): JSX.Element;
|
|
16
|
+
declare type UnboxLazy<T> = T extends () => infer U ? U : T;
|
|
16
17
|
declare type BoxedTupleTypes<T extends any[]> = {
|
|
17
|
-
[P in keyof T]: [T[P]];
|
|
18
|
+
[P in keyof T]: [UnboxLazy<T[P]>];
|
|
18
19
|
}[Exclude<keyof T, keyof any[]>];
|
|
19
20
|
declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
20
21
|
declare type UnboxIntersection<T> = T extends {
|
package/types/render/flow.d.ts
CHANGED
|
@@ -77,6 +77,7 @@ export declare type MatchProps<T> = {
|
|
|
77
77
|
* @description https://www.solidjs.com/docs/latest/api#%3Cswitch%3E%2F%3Cmatch%3E
|
|
78
78
|
*/
|
|
79
79
|
export declare function Match<T>(props: MatchProps<T>): JSX.Element;
|
|
80
|
+
export declare function resetErrorBoundaries(): void;
|
|
80
81
|
/**
|
|
81
82
|
* catches uncaught errors inside components and renders a fallback content
|
|
82
83
|
*
|
package/types/server/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
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, enableScheduling, enableHydration, startTransition, useTransition, createUniqueId, lazy, sharedConfig } from "./rendering";
|
|
2
|
+
export { mergeProps, splitProps, createComponent, For, Index, Show, Switch, Match, ErrorBoundary, Suspense, SuspenseList, createResource, refetchResources, resetErrorBoundaries, enableScheduling, enableHydration, startTransition, useTransition, createUniqueId, lazy, sharedConfig } from "./rendering";
|
|
3
3
|
export type { Component, Resource } from "./rendering";
|
|
@@ -19,7 +19,7 @@ export declare function createEffect<T>(fn: (v?: T) => T, value?: T): void;
|
|
|
19
19
|
export declare function createReaction(fn: () => void): (fn: () => void) => void;
|
|
20
20
|
export declare function createMemo<T>(fn: (v?: T) => T, value?: T): () => T;
|
|
21
21
|
export declare function createDeferred<T>(source: () => T): () => T;
|
|
22
|
-
export declare function createSelector<T>(source: () => T, fn
|
|
22
|
+
export declare function createSelector<T>(source: () => T, fn?: (k: T, value: T) => boolean): (k: T) => boolean;
|
|
23
23
|
export declare function batch<T>(fn: () => T): T;
|
|
24
24
|
export declare const untrack: typeof batch;
|
|
25
25
|
export declare function on<T, U>(deps: Array<() => T> | (() => T), fn: (value: Array<T> | T, prev?: Array<T> | T, prevResults?: U) => U, options?: {
|
|
@@ -55,6 +55,7 @@ declare type MatchProps<T> = {
|
|
|
55
55
|
children: string | ((item: T) => string);
|
|
56
56
|
};
|
|
57
57
|
export declare function Match<T>(props: MatchProps<T>): MatchProps<T>;
|
|
58
|
+
export declare function resetErrorBoundaries(): void;
|
|
58
59
|
export declare function ErrorBoundary(props: {
|
|
59
60
|
fallback: string | ((err: any, reset: () => void) => string);
|
|
60
61
|
children: string;
|
|
@@ -62,10 +63,12 @@ export declare function ErrorBoundary(props: {
|
|
|
62
63
|
export interface Resource<T> {
|
|
63
64
|
(): T | undefined;
|
|
64
65
|
loading: boolean;
|
|
66
|
+
error: any;
|
|
65
67
|
}
|
|
66
68
|
declare type SuspenseContextType = {
|
|
67
69
|
resources: Map<string, {
|
|
68
70
|
loading: boolean;
|
|
71
|
+
error: any;
|
|
69
72
|
}>;
|
|
70
73
|
completed: () => void;
|
|
71
74
|
};
|
package/web/dist/dev.cjs
CHANGED
|
@@ -197,6 +197,9 @@ function dynamicProperty(props, key) {
|
|
|
197
197
|
});
|
|
198
198
|
return props;
|
|
199
199
|
}
|
|
200
|
+
function innerHTML(parent, content) {
|
|
201
|
+
!solidJs.sharedConfig.context && (parent.innerHTML = content);
|
|
202
|
+
}
|
|
200
203
|
function insert(parent, accessor, marker, initial) {
|
|
201
204
|
if (marker !== undefined && !initial) initial = [];
|
|
202
205
|
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
@@ -391,16 +394,13 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
391
394
|
if (array.length === 0) {
|
|
392
395
|
current = cleanChildren(parent, current, marker);
|
|
393
396
|
if (multi) return current;
|
|
397
|
+
} else if (Array.isArray(current)) {
|
|
398
|
+
if (current.length === 0) {
|
|
399
|
+
appendNodes(parent, array, marker);
|
|
400
|
+
} else reconcileArrays(parent, current, array);
|
|
394
401
|
} else {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
appendNodes(parent, array, marker);
|
|
398
|
-
} else reconcileArrays(parent, current, array);
|
|
399
|
-
} else if (current == null || current === "") {
|
|
400
|
-
appendNodes(parent, array);
|
|
401
|
-
} else {
|
|
402
|
-
reconcileArrays(parent, multi && current || [parent.firstChild], array);
|
|
403
|
-
}
|
|
402
|
+
current && cleanChildren(parent);
|
|
403
|
+
appendNodes(parent, array);
|
|
404
404
|
}
|
|
405
405
|
current = array;
|
|
406
406
|
} else if (value instanceof Node) {
|
|
@@ -626,6 +626,7 @@ exports.getNextElement = getNextElement;
|
|
|
626
626
|
exports.getNextMarker = getNextMarker;
|
|
627
627
|
exports.getNextMatch = getNextMatch;
|
|
628
628
|
exports.hydrate = hydrate;
|
|
629
|
+
exports.innerHTML = innerHTML;
|
|
629
630
|
exports.insert = insert;
|
|
630
631
|
exports.isServer = isServer;
|
|
631
632
|
exports.memo = memo;
|
package/web/dist/dev.js
CHANGED
|
@@ -194,6 +194,9 @@ function dynamicProperty(props, key) {
|
|
|
194
194
|
});
|
|
195
195
|
return props;
|
|
196
196
|
}
|
|
197
|
+
function innerHTML(parent, content) {
|
|
198
|
+
!sharedConfig.context && (parent.innerHTML = content);
|
|
199
|
+
}
|
|
197
200
|
function insert(parent, accessor, marker, initial) {
|
|
198
201
|
if (marker !== undefined && !initial) initial = [];
|
|
199
202
|
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
@@ -388,16 +391,13 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
388
391
|
if (array.length === 0) {
|
|
389
392
|
current = cleanChildren(parent, current, marker);
|
|
390
393
|
if (multi) return current;
|
|
394
|
+
} else if (Array.isArray(current)) {
|
|
395
|
+
if (current.length === 0) {
|
|
396
|
+
appendNodes(parent, array, marker);
|
|
397
|
+
} else reconcileArrays(parent, current, array);
|
|
391
398
|
} else {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
appendNodes(parent, array, marker);
|
|
395
|
-
} else reconcileArrays(parent, current, array);
|
|
396
|
-
} else if (current == null || current === "") {
|
|
397
|
-
appendNodes(parent, array);
|
|
398
|
-
} else {
|
|
399
|
-
reconcileArrays(parent, multi && current || [parent.firstChild], array);
|
|
400
|
-
}
|
|
399
|
+
current && cleanChildren(parent);
|
|
400
|
+
appendNodes(parent, array);
|
|
401
401
|
}
|
|
402
402
|
current = array;
|
|
403
403
|
} else if (value instanceof Node) {
|
|
@@ -550,4 +550,4 @@ function Dynamic(props) {
|
|
|
550
550
|
});
|
|
551
551
|
}
|
|
552
552
|
|
|
553
|
-
export { Aliases, Assets, ChildProperties, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
|
|
553
|
+
export { Aliases, Assets, ChildProperties, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
|
package/web/dist/server.cjs
CHANGED
|
@@ -232,7 +232,7 @@ function stringifyString(str) {
|
|
|
232
232
|
return result;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
const REPLACE_SCRIPT = `function $df(e,y,t){t=document.getElementById(e),document.getElementById("pl"+e).replaceWith(...t.childNodes),_$HY.set(e,y||null)}`;
|
|
235
|
+
const REPLACE_SCRIPT = `function $df(e,y,t,g){t=document.getElementById(e),g=document.getElementById("pl"+e),g&&g.replaceWith(...t.childNodes),_$HY.set(e,y||null)}`;
|
|
236
236
|
const FRAGMENT_REPLACE = /<!\[([\d.]+)\]>/;
|
|
237
237
|
function renderToString(code, options = {}) {
|
|
238
238
|
let scripts = "";
|
|
@@ -322,12 +322,17 @@ function renderToStream(code, options = {}) {
|
|
|
322
322
|
const dedupe = new WeakMap();
|
|
323
323
|
const checkEnd = () => {
|
|
324
324
|
if (!registry.size && !completed) {
|
|
325
|
-
|
|
325
|
+
writeTasks();
|
|
326
|
+
onCompleteAll && onCompleteAll({
|
|
327
|
+
write(v) {
|
|
328
|
+
!completed && buffer.write(v);
|
|
329
|
+
}
|
|
330
|
+
});
|
|
326
331
|
writable && writable.end();
|
|
327
332
|
completed = true;
|
|
328
333
|
}
|
|
329
334
|
};
|
|
330
|
-
const
|
|
335
|
+
const writeTasks = () => {
|
|
331
336
|
if (tasks.length && !completed) {
|
|
332
337
|
buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>${tasks.join(";")}</script>`);
|
|
333
338
|
tasks.length = 0;
|
|
@@ -354,7 +359,7 @@ function renderToStream(code, options = {}) {
|
|
|
354
359
|
nonce,
|
|
355
360
|
writeResource(id, p, error) {
|
|
356
361
|
if (!scheduled) {
|
|
357
|
-
Promise.resolve().then(
|
|
362
|
+
Promise.resolve().then(writeTasks);
|
|
358
363
|
scheduled = true;
|
|
359
364
|
}
|
|
360
365
|
if (error) return tasks.push(`_$HY.set("${id}", ${serializeError(p)})`);
|
|
@@ -369,17 +374,19 @@ function renderToStream(code, options = {}) {
|
|
|
369
374
|
registerFragment(key) {
|
|
370
375
|
registry.set(key, []);
|
|
371
376
|
if (!scheduled) {
|
|
372
|
-
Promise.resolve().then(
|
|
377
|
+
Promise.resolve().then(writeTasks);
|
|
373
378
|
scheduled = true;
|
|
374
379
|
}
|
|
375
380
|
tasks.push(`_$HY.init("${key}")`);
|
|
376
381
|
return (value, error) => {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
382
|
+
if (registry.has(key)) {
|
|
383
|
+
const keys = registry.get(key);
|
|
384
|
+
registry.delete(key);
|
|
385
|
+
if (waitForFragments(registry, key)) return;
|
|
386
|
+
if ((value !== undefined || error) && !completed) {
|
|
387
|
+
buffer.write(`<div hidden id="${key}">${value !== undefined ? value : " "}</div><script${nonce ? ` nonce="${nonce}"` : ""}>${!scriptFlushed ? REPLACE_SCRIPT : ""}${keys.length ? keys.map(k => `_$HY.unset("${k}");`) : ""}$df("${key}"${error ? "," + serializeError(error) : ""})</script>`);
|
|
388
|
+
scriptFlushed = true;
|
|
389
|
+
}
|
|
383
390
|
}
|
|
384
391
|
checkEnd();
|
|
385
392
|
return true;
|
|
@@ -393,7 +400,11 @@ function renderToStream(code, options = {}) {
|
|
|
393
400
|
buffer.write(html);
|
|
394
401
|
tasks.length = 0;
|
|
395
402
|
scheduled = false;
|
|
396
|
-
onCompleteShell && onCompleteShell(
|
|
403
|
+
onCompleteShell && onCompleteShell({
|
|
404
|
+
write(v) {
|
|
405
|
+
!completed && buffer.write(v);
|
|
406
|
+
}
|
|
407
|
+
});
|
|
397
408
|
});
|
|
398
409
|
return {
|
|
399
410
|
pipe(w) {
|
|
@@ -612,8 +623,11 @@ function serializeSet(registry, key, value) {
|
|
|
612
623
|
}
|
|
613
624
|
function pipeToNodeWritable(code, writable, options = {}) {
|
|
614
625
|
if (options.onReady) {
|
|
615
|
-
options.onCompleteShell = (
|
|
626
|
+
options.onCompleteShell = ({
|
|
627
|
+
write
|
|
628
|
+
}) => {
|
|
616
629
|
options.onReady({
|
|
630
|
+
write,
|
|
617
631
|
startWriting() {
|
|
618
632
|
stream.pipe(writable);
|
|
619
633
|
}
|
|
@@ -625,8 +639,11 @@ function pipeToNodeWritable(code, writable, options = {}) {
|
|
|
625
639
|
}
|
|
626
640
|
function pipeToWritable(code, writable, options = {}) {
|
|
627
641
|
if (options.onReady) {
|
|
628
|
-
options.onCompleteShell = (
|
|
642
|
+
options.onCompleteShell = ({
|
|
643
|
+
write
|
|
644
|
+
}) => {
|
|
629
645
|
options.onReady({
|
|
646
|
+
write,
|
|
630
647
|
startWriting() {
|
|
631
648
|
stream.pipeTo(writable);
|
|
632
649
|
}
|
package/web/dist/server.js
CHANGED
|
@@ -229,7 +229,7 @@ function stringifyString(str) {
|
|
|
229
229
|
return result;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
const REPLACE_SCRIPT = `function $df(e,y,t){t=document.getElementById(e),document.getElementById("pl"+e).replaceWith(...t.childNodes),_$HY.set(e,y||null)}`;
|
|
232
|
+
const REPLACE_SCRIPT = `function $df(e,y,t,g){t=document.getElementById(e),g=document.getElementById("pl"+e),g&&g.replaceWith(...t.childNodes),_$HY.set(e,y||null)}`;
|
|
233
233
|
const FRAGMENT_REPLACE = /<!\[([\d.]+)\]>/;
|
|
234
234
|
function renderToString(code, options = {}) {
|
|
235
235
|
let scripts = "";
|
|
@@ -319,12 +319,17 @@ function renderToStream(code, options = {}) {
|
|
|
319
319
|
const dedupe = new WeakMap();
|
|
320
320
|
const checkEnd = () => {
|
|
321
321
|
if (!registry.size && !completed) {
|
|
322
|
-
|
|
322
|
+
writeTasks();
|
|
323
|
+
onCompleteAll && onCompleteAll({
|
|
324
|
+
write(v) {
|
|
325
|
+
!completed && buffer.write(v);
|
|
326
|
+
}
|
|
327
|
+
});
|
|
323
328
|
writable && writable.end();
|
|
324
329
|
completed = true;
|
|
325
330
|
}
|
|
326
331
|
};
|
|
327
|
-
const
|
|
332
|
+
const writeTasks = () => {
|
|
328
333
|
if (tasks.length && !completed) {
|
|
329
334
|
buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>${tasks.join(";")}</script>`);
|
|
330
335
|
tasks.length = 0;
|
|
@@ -351,7 +356,7 @@ function renderToStream(code, options = {}) {
|
|
|
351
356
|
nonce,
|
|
352
357
|
writeResource(id, p, error) {
|
|
353
358
|
if (!scheduled) {
|
|
354
|
-
Promise.resolve().then(
|
|
359
|
+
Promise.resolve().then(writeTasks);
|
|
355
360
|
scheduled = true;
|
|
356
361
|
}
|
|
357
362
|
if (error) return tasks.push(`_$HY.set("${id}", ${serializeError(p)})`);
|
|
@@ -366,17 +371,19 @@ function renderToStream(code, options = {}) {
|
|
|
366
371
|
registerFragment(key) {
|
|
367
372
|
registry.set(key, []);
|
|
368
373
|
if (!scheduled) {
|
|
369
|
-
Promise.resolve().then(
|
|
374
|
+
Promise.resolve().then(writeTasks);
|
|
370
375
|
scheduled = true;
|
|
371
376
|
}
|
|
372
377
|
tasks.push(`_$HY.init("${key}")`);
|
|
373
378
|
return (value, error) => {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
379
|
+
if (registry.has(key)) {
|
|
380
|
+
const keys = registry.get(key);
|
|
381
|
+
registry.delete(key);
|
|
382
|
+
if (waitForFragments(registry, key)) return;
|
|
383
|
+
if ((value !== undefined || error) && !completed) {
|
|
384
|
+
buffer.write(`<div hidden id="${key}">${value !== undefined ? value : " "}</div><script${nonce ? ` nonce="${nonce}"` : ""}>${!scriptFlushed ? REPLACE_SCRIPT : ""}${keys.length ? keys.map(k => `_$HY.unset("${k}");`) : ""}$df("${key}"${error ? "," + serializeError(error) : ""})</script>`);
|
|
385
|
+
scriptFlushed = true;
|
|
386
|
+
}
|
|
380
387
|
}
|
|
381
388
|
checkEnd();
|
|
382
389
|
return true;
|
|
@@ -390,7 +397,11 @@ function renderToStream(code, options = {}) {
|
|
|
390
397
|
buffer.write(html);
|
|
391
398
|
tasks.length = 0;
|
|
392
399
|
scheduled = false;
|
|
393
|
-
onCompleteShell && onCompleteShell(
|
|
400
|
+
onCompleteShell && onCompleteShell({
|
|
401
|
+
write(v) {
|
|
402
|
+
!completed && buffer.write(v);
|
|
403
|
+
}
|
|
404
|
+
});
|
|
394
405
|
});
|
|
395
406
|
return {
|
|
396
407
|
pipe(w) {
|
|
@@ -609,8 +620,11 @@ function serializeSet(registry, key, value) {
|
|
|
609
620
|
}
|
|
610
621
|
function pipeToNodeWritable(code, writable, options = {}) {
|
|
611
622
|
if (options.onReady) {
|
|
612
|
-
options.onCompleteShell = (
|
|
623
|
+
options.onCompleteShell = ({
|
|
624
|
+
write
|
|
625
|
+
}) => {
|
|
613
626
|
options.onReady({
|
|
627
|
+
write,
|
|
614
628
|
startWriting() {
|
|
615
629
|
stream.pipe(writable);
|
|
616
630
|
}
|
|
@@ -622,8 +636,11 @@ function pipeToNodeWritable(code, writable, options = {}) {
|
|
|
622
636
|
}
|
|
623
637
|
function pipeToWritable(code, writable, options = {}) {
|
|
624
638
|
if (options.onReady) {
|
|
625
|
-
options.onCompleteShell = (
|
|
639
|
+
options.onCompleteShell = ({
|
|
640
|
+
write
|
|
641
|
+
}) => {
|
|
626
642
|
options.onReady({
|
|
643
|
+
write,
|
|
627
644
|
startWriting() {
|
|
628
645
|
stream.pipeTo(writable);
|
|
629
646
|
}
|
package/web/dist/web.cjs
CHANGED
|
@@ -196,6 +196,9 @@ function dynamicProperty(props, key) {
|
|
|
196
196
|
});
|
|
197
197
|
return props;
|
|
198
198
|
}
|
|
199
|
+
function innerHTML(parent, content) {
|
|
200
|
+
!solidJs.sharedConfig.context && (parent.innerHTML = content);
|
|
201
|
+
}
|
|
199
202
|
function insert(parent, accessor, marker, initial) {
|
|
200
203
|
if (marker !== undefined && !initial) initial = [];
|
|
201
204
|
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
@@ -390,16 +393,13 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
390
393
|
if (array.length === 0) {
|
|
391
394
|
current = cleanChildren(parent, current, marker);
|
|
392
395
|
if (multi) return current;
|
|
396
|
+
} else if (Array.isArray(current)) {
|
|
397
|
+
if (current.length === 0) {
|
|
398
|
+
appendNodes(parent, array, marker);
|
|
399
|
+
} else reconcileArrays(parent, current, array);
|
|
393
400
|
} else {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
appendNodes(parent, array, marker);
|
|
397
|
-
} else reconcileArrays(parent, current, array);
|
|
398
|
-
} else if (current == null || current === "") {
|
|
399
|
-
appendNodes(parent, array);
|
|
400
|
-
} else {
|
|
401
|
-
reconcileArrays(parent, multi && current || [parent.firstChild], array);
|
|
402
|
-
}
|
|
401
|
+
current && cleanChildren(parent);
|
|
402
|
+
appendNodes(parent, array);
|
|
403
403
|
}
|
|
404
404
|
current = array;
|
|
405
405
|
} else if (value instanceof Node) {
|
|
@@ -622,6 +622,7 @@ exports.getNextElement = getNextElement;
|
|
|
622
622
|
exports.getNextMarker = getNextMarker;
|
|
623
623
|
exports.getNextMatch = getNextMatch;
|
|
624
624
|
exports.hydrate = hydrate;
|
|
625
|
+
exports.innerHTML = innerHTML;
|
|
625
626
|
exports.insert = insert;
|
|
626
627
|
exports.isServer = isServer;
|
|
627
628
|
exports.memo = memo;
|
package/web/dist/web.js
CHANGED
|
@@ -193,6 +193,9 @@ function dynamicProperty(props, key) {
|
|
|
193
193
|
});
|
|
194
194
|
return props;
|
|
195
195
|
}
|
|
196
|
+
function innerHTML(parent, content) {
|
|
197
|
+
!sharedConfig.context && (parent.innerHTML = content);
|
|
198
|
+
}
|
|
196
199
|
function insert(parent, accessor, marker, initial) {
|
|
197
200
|
if (marker !== undefined && !initial) initial = [];
|
|
198
201
|
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
@@ -387,16 +390,13 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
387
390
|
if (array.length === 0) {
|
|
388
391
|
current = cleanChildren(parent, current, marker);
|
|
389
392
|
if (multi) return current;
|
|
393
|
+
} else if (Array.isArray(current)) {
|
|
394
|
+
if (current.length === 0) {
|
|
395
|
+
appendNodes(parent, array, marker);
|
|
396
|
+
} else reconcileArrays(parent, current, array);
|
|
390
397
|
} else {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
appendNodes(parent, array, marker);
|
|
394
|
-
} else reconcileArrays(parent, current, array);
|
|
395
|
-
} else if (current == null || current === "") {
|
|
396
|
-
appendNodes(parent, array);
|
|
397
|
-
} else {
|
|
398
|
-
reconcileArrays(parent, multi && current || [parent.firstChild], array);
|
|
399
|
-
}
|
|
398
|
+
current && cleanChildren(parent);
|
|
399
|
+
appendNodes(parent, array);
|
|
400
400
|
}
|
|
401
401
|
current = array;
|
|
402
402
|
} else if (value instanceof Node) {
|
|
@@ -546,4 +546,4 @@ function Dynamic(props) {
|
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
548
|
|
|
549
|
-
export { Aliases, Assets, ChildProperties, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
|
|
549
|
+
export { Aliases, Assets, ChildProperties, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrBoolean, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template };
|
package/web/types/client.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export function spread<T>(
|
|
|
30
30
|
export function assign(node: Element, props: any, isSVG?: Boolean, skipChildren?: Boolean): void;
|
|
31
31
|
export function setAttribute(node: Element, name: string, value: string): void;
|
|
32
32
|
export function setAttributeNS(node: Element, namespace: string, name: string, value: string): void;
|
|
33
|
+
export function innerHTML(node: Element, content: string): void;
|
|
33
34
|
export function addEventListener(
|
|
34
35
|
node: Element,
|
|
35
36
|
name: string,
|