solid-js 1.3.1 → 1.3.5
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 +26 -17
- package/dist/dev.js +26 -18
- package/dist/server.cjs +10 -4
- package/dist/server.js +9 -5
- package/dist/solid.cjs +23 -17
- package/dist/solid.js +23 -18
- package/package.json +2 -2
- package/store/package.json +23 -1
- package/types/index.d.ts +1 -1
- 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/rendering.d.ts +3 -0
- package/universal/package.json +11 -1
- package/web/dist/dev.cjs +17 -17
- package/web/dist/dev.js +18 -18
- package/web/dist/server.cjs +16 -13
- package/web/dist/server.js +16 -13
- package/web/dist/web.cjs +14 -17
- package/web/dist/web.js +14 -17
- package/web/package.json +23 -1
package/dist/dev.cjs
CHANGED
|
@@ -249,7 +249,7 @@ function createResource(source, fetcher, options) {
|
|
|
249
249
|
fetcher = source;
|
|
250
250
|
source = true;
|
|
251
251
|
}
|
|
252
|
-
options
|
|
252
|
+
options || (options = {});
|
|
253
253
|
if (options.globalRefetch !== false) {
|
|
254
254
|
Resources || (Resources = new Set());
|
|
255
255
|
Resources.add(load);
|
|
@@ -506,7 +506,7 @@ function startTransition(fn) {
|
|
|
506
506
|
queue: new Set(),
|
|
507
507
|
running: true
|
|
508
508
|
});
|
|
509
|
-
t.done
|
|
509
|
+
t.done || (t.done = new Promise(res => t.resolve = res));
|
|
510
510
|
t.running = true;
|
|
511
511
|
}
|
|
512
512
|
batch(fn);
|
|
@@ -1313,7 +1313,6 @@ function lazy(fn) {
|
|
|
1313
1313
|
const wrap = props => {
|
|
1314
1314
|
const ctx = sharedConfig.context;
|
|
1315
1315
|
if (ctx) {
|
|
1316
|
-
ctx.count++;
|
|
1317
1316
|
const [s, set] = createSignal();
|
|
1318
1317
|
(p || (p = fn())).then(mod => {
|
|
1319
1318
|
setHydrateContext(ctx);
|
|
@@ -1332,6 +1331,9 @@ function lazy(fn) {
|
|
|
1332
1331
|
}
|
|
1333
1332
|
let Comp;
|
|
1334
1333
|
return createMemo(() => (Comp = comp()) && untrack(() => {
|
|
1334
|
+
Object.assign(Comp, {
|
|
1335
|
+
[$DEVCOMP]: true
|
|
1336
|
+
});
|
|
1335
1337
|
if (!ctx) return Comp(props);
|
|
1336
1338
|
const c = sharedConfig.context;
|
|
1337
1339
|
setHydrateContext(ctx);
|
|
@@ -1399,12 +1401,19 @@ function Switch(props) {
|
|
|
1399
1401
|
function Match(props) {
|
|
1400
1402
|
return props;
|
|
1401
1403
|
}
|
|
1404
|
+
let Errors;
|
|
1405
|
+
function resetErrorBoundaries() {
|
|
1406
|
+
Errors && [...Errors].forEach(fn => fn());
|
|
1407
|
+
}
|
|
1402
1408
|
function ErrorBoundary(props) {
|
|
1403
1409
|
let err = undefined;
|
|
1404
1410
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1405
1411
|
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1406
1412
|
}
|
|
1407
1413
|
const [errored, setErrored] = createSignal(err);
|
|
1414
|
+
Errors || (Errors = new Set());
|
|
1415
|
+
Errors.add(setErrored);
|
|
1416
|
+
onCleanup(() => Errors.delete(setErrored));
|
|
1408
1417
|
let e;
|
|
1409
1418
|
return createMemo(() => {
|
|
1410
1419
|
if ((e = errored()) != null) {
|
|
@@ -1508,20 +1517,18 @@ function Suspense(props) {
|
|
|
1508
1517
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1509
1518
|
p = sharedConfig.load(key);
|
|
1510
1519
|
if (p) {
|
|
1511
|
-
if (typeof p !== "object" || !("then" in p))
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
});
|
|
1524
|
-
}
|
|
1520
|
+
if (typeof p !== "object" || !("then" in p)) p = Promise.resolve(p);
|
|
1521
|
+
const [s, set] = createSignal(undefined, {
|
|
1522
|
+
equals: false
|
|
1523
|
+
});
|
|
1524
|
+
flicker = s;
|
|
1525
|
+
p.then(err => {
|
|
1526
|
+
if (error = err) return set();
|
|
1527
|
+
sharedConfig.gather(key);
|
|
1528
|
+
setHydrateContext(ctx);
|
|
1529
|
+
set();
|
|
1530
|
+
setHydrateContext();
|
|
1531
|
+
});
|
|
1525
1532
|
}
|
|
1526
1533
|
}
|
|
1527
1534
|
const listContext = useContext(SuspenseListContext);
|
|
@@ -1547,6 +1554,7 @@ function Suspense(props) {
|
|
|
1547
1554
|
dispose && dispose();
|
|
1548
1555
|
if ((!inFallback || p !== undefined) && visibleContent) {
|
|
1549
1556
|
store.resolved = true;
|
|
1557
|
+
ctx = p = undefined;
|
|
1550
1558
|
resumeEffects(store.effects);
|
|
1551
1559
|
return rendered;
|
|
1552
1560
|
}
|
|
@@ -1625,6 +1633,7 @@ exports.onError = onError;
|
|
|
1625
1633
|
exports.onMount = onMount;
|
|
1626
1634
|
exports.refetchResources = refetchResources;
|
|
1627
1635
|
exports.requestCallback = requestCallback;
|
|
1636
|
+
exports.resetErrorBoundaries = resetErrorBoundaries;
|
|
1628
1637
|
exports.runWithOwner = runWithOwner;
|
|
1629
1638
|
exports.sharedConfig = sharedConfig;
|
|
1630
1639
|
exports.splitProps = splitProps;
|
package/dist/dev.js
CHANGED
|
@@ -245,7 +245,7 @@ function createResource(source, fetcher, options) {
|
|
|
245
245
|
fetcher = source;
|
|
246
246
|
source = true;
|
|
247
247
|
}
|
|
248
|
-
options
|
|
248
|
+
options || (options = {});
|
|
249
249
|
if (options.globalRefetch !== false) {
|
|
250
250
|
Resources || (Resources = new Set());
|
|
251
251
|
Resources.add(load);
|
|
@@ -502,7 +502,7 @@ function startTransition(fn) {
|
|
|
502
502
|
queue: new Set(),
|
|
503
503
|
running: true
|
|
504
504
|
});
|
|
505
|
-
t.done
|
|
505
|
+
t.done || (t.done = new Promise(res => t.resolve = res));
|
|
506
506
|
t.running = true;
|
|
507
507
|
}
|
|
508
508
|
batch(fn);
|
|
@@ -1309,7 +1309,6 @@ function lazy(fn) {
|
|
|
1309
1309
|
const wrap = props => {
|
|
1310
1310
|
const ctx = sharedConfig.context;
|
|
1311
1311
|
if (ctx) {
|
|
1312
|
-
ctx.count++;
|
|
1313
1312
|
const [s, set] = createSignal();
|
|
1314
1313
|
(p || (p = fn())).then(mod => {
|
|
1315
1314
|
setHydrateContext(ctx);
|
|
@@ -1328,6 +1327,9 @@ function lazy(fn) {
|
|
|
1328
1327
|
}
|
|
1329
1328
|
let Comp;
|
|
1330
1329
|
return createMemo(() => (Comp = comp()) && untrack(() => {
|
|
1330
|
+
Object.assign(Comp, {
|
|
1331
|
+
[$DEVCOMP]: true
|
|
1332
|
+
});
|
|
1331
1333
|
if (!ctx) return Comp(props);
|
|
1332
1334
|
const c = sharedConfig.context;
|
|
1333
1335
|
setHydrateContext(ctx);
|
|
@@ -1395,12 +1397,19 @@ function Switch(props) {
|
|
|
1395
1397
|
function Match(props) {
|
|
1396
1398
|
return props;
|
|
1397
1399
|
}
|
|
1400
|
+
let Errors;
|
|
1401
|
+
function resetErrorBoundaries() {
|
|
1402
|
+
Errors && [...Errors].forEach(fn => fn());
|
|
1403
|
+
}
|
|
1398
1404
|
function ErrorBoundary(props) {
|
|
1399
1405
|
let err = undefined;
|
|
1400
1406
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1401
1407
|
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1402
1408
|
}
|
|
1403
1409
|
const [errored, setErrored] = createSignal(err);
|
|
1410
|
+
Errors || (Errors = new Set());
|
|
1411
|
+
Errors.add(setErrored);
|
|
1412
|
+
onCleanup(() => Errors.delete(setErrored));
|
|
1404
1413
|
let e;
|
|
1405
1414
|
return createMemo(() => {
|
|
1406
1415
|
if ((e = errored()) != null) {
|
|
@@ -1504,20 +1513,18 @@ function Suspense(props) {
|
|
|
1504
1513
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1505
1514
|
p = sharedConfig.load(key);
|
|
1506
1515
|
if (p) {
|
|
1507
|
-
if (typeof p !== "object" || !("then" in p))
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
});
|
|
1520
|
-
}
|
|
1516
|
+
if (typeof p !== "object" || !("then" in p)) p = Promise.resolve(p);
|
|
1517
|
+
const [s, set] = createSignal(undefined, {
|
|
1518
|
+
equals: false
|
|
1519
|
+
});
|
|
1520
|
+
flicker = s;
|
|
1521
|
+
p.then(err => {
|
|
1522
|
+
if (error = err) return set();
|
|
1523
|
+
sharedConfig.gather(key);
|
|
1524
|
+
setHydrateContext(ctx);
|
|
1525
|
+
set();
|
|
1526
|
+
setHydrateContext();
|
|
1527
|
+
});
|
|
1521
1528
|
}
|
|
1522
1529
|
}
|
|
1523
1530
|
const listContext = useContext(SuspenseListContext);
|
|
@@ -1543,6 +1550,7 @@ function Suspense(props) {
|
|
|
1543
1550
|
dispose && dispose();
|
|
1544
1551
|
if ((!inFallback || p !== undefined) && visibleContent) {
|
|
1545
1552
|
store.resolved = true;
|
|
1553
|
+
ctx = p = undefined;
|
|
1546
1554
|
resumeEffects(store.effects);
|
|
1547
1555
|
return rendered;
|
|
1548
1556
|
}
|
|
@@ -1577,4 +1585,4 @@ if (globalThis) {
|
|
|
1577
1585
|
if (!globalThis.Solid$$) globalThis.Solid$$ = true;else console.warn("You appear to have multiple instances of Solid. This can lead to unexpected behavior.");
|
|
1578
1586
|
}
|
|
1579
1587
|
|
|
1580
|
-
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 };
|
|
1588
|
+
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
|
@@ -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
|
@@ -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
|
@@ -246,7 +246,7 @@ function createResource(source, fetcher, options) {
|
|
|
246
246
|
fetcher = source;
|
|
247
247
|
source = true;
|
|
248
248
|
}
|
|
249
|
-
options
|
|
249
|
+
options || (options = {});
|
|
250
250
|
if (options.globalRefetch !== false) {
|
|
251
251
|
Resources || (Resources = new Set());
|
|
252
252
|
Resources.add(load);
|
|
@@ -503,7 +503,7 @@ function startTransition(fn) {
|
|
|
503
503
|
queue: new Set(),
|
|
504
504
|
running: true
|
|
505
505
|
});
|
|
506
|
-
t.done
|
|
506
|
+
t.done || (t.done = new Promise(res => t.resolve = res));
|
|
507
507
|
t.running = true;
|
|
508
508
|
}
|
|
509
509
|
batch(fn);
|
|
@@ -1232,7 +1232,6 @@ function lazy(fn) {
|
|
|
1232
1232
|
const wrap = props => {
|
|
1233
1233
|
const ctx = sharedConfig.context;
|
|
1234
1234
|
if (ctx) {
|
|
1235
|
-
ctx.count++;
|
|
1236
1235
|
const [s, set] = createSignal();
|
|
1237
1236
|
(p || (p = fn())).then(mod => {
|
|
1238
1237
|
setHydrateContext(ctx);
|
|
@@ -1318,12 +1317,19 @@ function Switch(props) {
|
|
|
1318
1317
|
function Match(props) {
|
|
1319
1318
|
return props;
|
|
1320
1319
|
}
|
|
1320
|
+
let Errors;
|
|
1321
|
+
function resetErrorBoundaries() {
|
|
1322
|
+
Errors && [...Errors].forEach(fn => fn());
|
|
1323
|
+
}
|
|
1321
1324
|
function ErrorBoundary(props) {
|
|
1322
1325
|
let err = undefined;
|
|
1323
1326
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1324
1327
|
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1325
1328
|
}
|
|
1326
1329
|
const [errored, setErrored] = createSignal(err);
|
|
1330
|
+
Errors || (Errors = new Set());
|
|
1331
|
+
Errors.add(setErrored);
|
|
1332
|
+
onCleanup(() => Errors.delete(setErrored));
|
|
1327
1333
|
let e;
|
|
1328
1334
|
return createMemo(() => {
|
|
1329
1335
|
if ((e = errored()) != null) {
|
|
@@ -1427,20 +1433,18 @@ function Suspense(props) {
|
|
|
1427
1433
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1428
1434
|
p = sharedConfig.load(key);
|
|
1429
1435
|
if (p) {
|
|
1430
|
-
if (typeof p !== "object" || !("then" in p))
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
});
|
|
1443
|
-
}
|
|
1436
|
+
if (typeof p !== "object" || !("then" in p)) p = Promise.resolve(p);
|
|
1437
|
+
const [s, set] = createSignal(undefined, {
|
|
1438
|
+
equals: false
|
|
1439
|
+
});
|
|
1440
|
+
flicker = s;
|
|
1441
|
+
p.then(err => {
|
|
1442
|
+
if (error = err) return set();
|
|
1443
|
+
sharedConfig.gather(key);
|
|
1444
|
+
setHydrateContext(ctx);
|
|
1445
|
+
set();
|
|
1446
|
+
setHydrateContext();
|
|
1447
|
+
});
|
|
1444
1448
|
}
|
|
1445
1449
|
}
|
|
1446
1450
|
const listContext = useContext(SuspenseListContext);
|
|
@@ -1466,6 +1470,7 @@ function Suspense(props) {
|
|
|
1466
1470
|
dispose && dispose();
|
|
1467
1471
|
if ((!inFallback || p !== undefined) && visibleContent) {
|
|
1468
1472
|
store.resolved = true;
|
|
1473
|
+
ctx = p = undefined;
|
|
1469
1474
|
resumeEffects(store.effects);
|
|
1470
1475
|
return rendered;
|
|
1471
1476
|
}
|
|
@@ -1534,6 +1539,7 @@ exports.onError = onError;
|
|
|
1534
1539
|
exports.onMount = onMount;
|
|
1535
1540
|
exports.refetchResources = refetchResources;
|
|
1536
1541
|
exports.requestCallback = requestCallback;
|
|
1542
|
+
exports.resetErrorBoundaries = resetErrorBoundaries;
|
|
1537
1543
|
exports.runWithOwner = runWithOwner;
|
|
1538
1544
|
exports.sharedConfig = sharedConfig;
|
|
1539
1545
|
exports.splitProps = splitProps;
|
package/dist/solid.js
CHANGED
|
@@ -242,7 +242,7 @@ function createResource(source, fetcher, options) {
|
|
|
242
242
|
fetcher = source;
|
|
243
243
|
source = true;
|
|
244
244
|
}
|
|
245
|
-
options
|
|
245
|
+
options || (options = {});
|
|
246
246
|
if (options.globalRefetch !== false) {
|
|
247
247
|
Resources || (Resources = new Set());
|
|
248
248
|
Resources.add(load);
|
|
@@ -499,7 +499,7 @@ function startTransition(fn) {
|
|
|
499
499
|
queue: new Set(),
|
|
500
500
|
running: true
|
|
501
501
|
});
|
|
502
|
-
t.done
|
|
502
|
+
t.done || (t.done = new Promise(res => t.resolve = res));
|
|
503
503
|
t.running = true;
|
|
504
504
|
}
|
|
505
505
|
batch(fn);
|
|
@@ -1228,7 +1228,6 @@ function lazy(fn) {
|
|
|
1228
1228
|
const wrap = props => {
|
|
1229
1229
|
const ctx = sharedConfig.context;
|
|
1230
1230
|
if (ctx) {
|
|
1231
|
-
ctx.count++;
|
|
1232
1231
|
const [s, set] = createSignal();
|
|
1233
1232
|
(p || (p = fn())).then(mod => {
|
|
1234
1233
|
setHydrateContext(ctx);
|
|
@@ -1314,12 +1313,19 @@ function Switch(props) {
|
|
|
1314
1313
|
function Match(props) {
|
|
1315
1314
|
return props;
|
|
1316
1315
|
}
|
|
1316
|
+
let Errors;
|
|
1317
|
+
function resetErrorBoundaries() {
|
|
1318
|
+
Errors && [...Errors].forEach(fn => fn());
|
|
1319
|
+
}
|
|
1317
1320
|
function ErrorBoundary(props) {
|
|
1318
1321
|
let err = undefined;
|
|
1319
1322
|
if (sharedConfig.context && sharedConfig.load) {
|
|
1320
1323
|
err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
|
|
1321
1324
|
}
|
|
1322
1325
|
const [errored, setErrored] = createSignal(err);
|
|
1326
|
+
Errors || (Errors = new Set());
|
|
1327
|
+
Errors.add(setErrored);
|
|
1328
|
+
onCleanup(() => Errors.delete(setErrored));
|
|
1323
1329
|
let e;
|
|
1324
1330
|
return createMemo(() => {
|
|
1325
1331
|
if ((e = errored()) != null) {
|
|
@@ -1423,20 +1429,18 @@ function Suspense(props) {
|
|
|
1423
1429
|
const key = sharedConfig.context.id + sharedConfig.context.count;
|
|
1424
1430
|
p = sharedConfig.load(key);
|
|
1425
1431
|
if (p) {
|
|
1426
|
-
if (typeof p !== "object" || !("then" in p))
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
});
|
|
1439
|
-
}
|
|
1432
|
+
if (typeof p !== "object" || !("then" in p)) p = Promise.resolve(p);
|
|
1433
|
+
const [s, set] = createSignal(undefined, {
|
|
1434
|
+
equals: false
|
|
1435
|
+
});
|
|
1436
|
+
flicker = s;
|
|
1437
|
+
p.then(err => {
|
|
1438
|
+
if (error = err) return set();
|
|
1439
|
+
sharedConfig.gather(key);
|
|
1440
|
+
setHydrateContext(ctx);
|
|
1441
|
+
set();
|
|
1442
|
+
setHydrateContext();
|
|
1443
|
+
});
|
|
1440
1444
|
}
|
|
1441
1445
|
}
|
|
1442
1446
|
const listContext = useContext(SuspenseListContext);
|
|
@@ -1462,6 +1466,7 @@ function Suspense(props) {
|
|
|
1462
1466
|
dispose && dispose();
|
|
1463
1467
|
if ((!inFallback || p !== undefined) && visibleContent) {
|
|
1464
1468
|
store.resolved = true;
|
|
1469
|
+
ctx = p = undefined;
|
|
1465
1470
|
resumeEffects(store.effects);
|
|
1466
1471
|
return rendered;
|
|
1467
1472
|
}
|
|
@@ -1485,4 +1490,4 @@ function Suspense(props) {
|
|
|
1485
1490
|
|
|
1486
1491
|
let DEV;
|
|
1487
1492
|
|
|
1488
|
-
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 };
|
|
1493
|
+
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.5",
|
|
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": "cc19f07cfd675bd5579891dcae3145fa0d171c66"
|
|
148
148
|
}
|
package/store/package.json
CHANGED
|
@@ -9,5 +9,27 @@
|
|
|
9
9
|
"unpkg": "./dist/store.cjs",
|
|
10
10
|
"types": "./types/index.d.ts",
|
|
11
11
|
"type": "module",
|
|
12
|
-
"sideEffects": false
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"browser": {
|
|
16
|
+
"development": {
|
|
17
|
+
"import": "./dist/dev.js",
|
|
18
|
+
"require": "./dist/dev.cjs"
|
|
19
|
+
},
|
|
20
|
+
"import": "./dist/store.js",
|
|
21
|
+
"require": "./dist/store.cjs"
|
|
22
|
+
},
|
|
23
|
+
"node": {
|
|
24
|
+
"import": "./dist/server.js",
|
|
25
|
+
"require": "./dist/server.cjs"
|
|
26
|
+
},
|
|
27
|
+
"development": {
|
|
28
|
+
"import": "./dist/dev.js",
|
|
29
|
+
"require": "./dist/dev.cjs"
|
|
30
|
+
},
|
|
31
|
+
"import": "./dist/store.js",
|
|
32
|
+
"require": "./dist/store.cjs"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
13
35
|
}
|
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";
|
|
@@ -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";
|
|
@@ -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/universal/package.json
CHANGED
|
@@ -4,5 +4,15 @@
|
|
|
4
4
|
"module": "./dist/universal.js",
|
|
5
5
|
"types": "./types/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"sideEffects": false
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"development": {
|
|
11
|
+
"import": "./dist/dev.js",
|
|
12
|
+
"require": "./dist/dev.cjs"
|
|
13
|
+
},
|
|
14
|
+
"import": "./dist/universal.js",
|
|
15
|
+
"require": "./dist/universal.cjs"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
8
18
|
}
|
package/web/dist/dev.cjs
CHANGED
|
@@ -59,7 +59,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
59
59
|
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
60
60
|
} else if (bEnd === bStart) {
|
|
61
61
|
while (aStart < aEnd) {
|
|
62
|
-
if (!map || !map.has(a[aStart]))
|
|
62
|
+
if (!map || !map.has(a[aStart])) a[aStart].remove();
|
|
63
63
|
aStart++;
|
|
64
64
|
}
|
|
65
65
|
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
@@ -88,7 +88,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
88
88
|
while (bStart < index) parentNode.insertBefore(b[bStart++], node);
|
|
89
89
|
} else parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
90
90
|
} else aStart++;
|
|
91
|
-
} else
|
|
91
|
+
} else a[aStart++].remove();
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -347,6 +347,7 @@ function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
|
347
347
|
return prevProps;
|
|
348
348
|
}
|
|
349
349
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
350
|
+
if (solidJs.sharedConfig.context && !current) current = [...parent.childNodes];
|
|
350
351
|
while (typeof current === "function") current = current();
|
|
351
352
|
if (value === current) return current;
|
|
352
353
|
const t = typeof value,
|
|
@@ -388,28 +389,24 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
388
389
|
return current;
|
|
389
390
|
}
|
|
390
391
|
if (array.length === 0) {
|
|
391
|
-
|
|
392
|
-
|
|
392
|
+
cleanChildren(parent, current, marker);
|
|
393
|
+
} else if (Array.isArray(current)) {
|
|
394
|
+
if (current.length === 0) {
|
|
395
|
+
appendNodes(parent, array, marker);
|
|
396
|
+
} else reconcileArrays(parent, current, array);
|
|
393
397
|
} 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
|
-
}
|
|
398
|
+
current && cleanChildren(parent, current);
|
|
399
|
+
appendNodes(parent, array);
|
|
403
400
|
}
|
|
404
401
|
current = array;
|
|
405
402
|
} else if (value instanceof Node) {
|
|
406
|
-
if (solidJs.sharedConfig.context) return current = value.parentNode ? value : current;
|
|
403
|
+
if (solidJs.sharedConfig.context) return current = value.parentNode ? multi ? [value] : value : current;
|
|
407
404
|
if (Array.isArray(current)) {
|
|
408
405
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
409
406
|
cleanChildren(parent, current, null, value);
|
|
410
407
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
411
408
|
parent.appendChild(value);
|
|
412
|
-
} else parent.replaceChild(value,
|
|
409
|
+
} else parent.replaceChild(value, parent.firstChild);
|
|
413
410
|
current = value;
|
|
414
411
|
} else console.warn(`Unrecognized value. Skipped inserting`, value);
|
|
415
412
|
return current;
|
|
@@ -449,10 +446,10 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
449
446
|
const el = current[i];
|
|
450
447
|
if (node !== el) {
|
|
451
448
|
const isParent = el.parentNode === parent;
|
|
452
|
-
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent &&
|
|
449
|
+
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent && el.remove();
|
|
453
450
|
} else inserted = true;
|
|
454
451
|
}
|
|
455
|
-
} else
|
|
452
|
+
} else parent.insertBefore(node, marker);
|
|
456
453
|
return [node];
|
|
457
454
|
}
|
|
458
455
|
function gatherHydratable(element, root) {
|
|
@@ -539,6 +536,9 @@ function Dynamic(props) {
|
|
|
539
536
|
const component = p.component;
|
|
540
537
|
switch (typeof component) {
|
|
541
538
|
case "function":
|
|
539
|
+
Object.assign(component, {
|
|
540
|
+
[solidJs.$DEVCOMP]: true
|
|
541
|
+
});
|
|
542
542
|
return solidJs.untrack(() => component(others));
|
|
543
543
|
case "string":
|
|
544
544
|
const isSvg = SVGElements.has(component);
|
package/web/dist/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createMemo, createRoot, createRenderEffect, sharedConfig, enableHydration, createSignal, onCleanup, splitProps, untrack } from 'solid-js';
|
|
1
|
+
import { createMemo, createRoot, createRenderEffect, sharedConfig, enableHydration, createSignal, onCleanup, splitProps, $DEVCOMP, untrack } from 'solid-js';
|
|
2
2
|
export { ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, createComponent, createRenderEffect as effect, getOwner, mergeProps } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
|
|
@@ -56,7 +56,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
56
56
|
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
57
57
|
} else if (bEnd === bStart) {
|
|
58
58
|
while (aStart < aEnd) {
|
|
59
|
-
if (!map || !map.has(a[aStart]))
|
|
59
|
+
if (!map || !map.has(a[aStart])) a[aStart].remove();
|
|
60
60
|
aStart++;
|
|
61
61
|
}
|
|
62
62
|
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
@@ -85,7 +85,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
85
85
|
while (bStart < index) parentNode.insertBefore(b[bStart++], node);
|
|
86
86
|
} else parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
87
87
|
} else aStart++;
|
|
88
|
-
} else
|
|
88
|
+
} else a[aStart++].remove();
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -344,6 +344,7 @@ function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
|
344
344
|
return prevProps;
|
|
345
345
|
}
|
|
346
346
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
347
|
+
if (sharedConfig.context && !current) current = [...parent.childNodes];
|
|
347
348
|
while (typeof current === "function") current = current();
|
|
348
349
|
if (value === current) return current;
|
|
349
350
|
const t = typeof value,
|
|
@@ -385,28 +386,24 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
385
386
|
return current;
|
|
386
387
|
}
|
|
387
388
|
if (array.length === 0) {
|
|
388
|
-
|
|
389
|
-
|
|
389
|
+
cleanChildren(parent, current, marker);
|
|
390
|
+
} else if (Array.isArray(current)) {
|
|
391
|
+
if (current.length === 0) {
|
|
392
|
+
appendNodes(parent, array, marker);
|
|
393
|
+
} else reconcileArrays(parent, current, array);
|
|
390
394
|
} 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
|
-
}
|
|
395
|
+
current && cleanChildren(parent, current);
|
|
396
|
+
appendNodes(parent, array);
|
|
400
397
|
}
|
|
401
398
|
current = array;
|
|
402
399
|
} else if (value instanceof Node) {
|
|
403
|
-
if (sharedConfig.context) return current = value.parentNode ? value : current;
|
|
400
|
+
if (sharedConfig.context) return current = value.parentNode ? multi ? [value] : value : current;
|
|
404
401
|
if (Array.isArray(current)) {
|
|
405
402
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
406
403
|
cleanChildren(parent, current, null, value);
|
|
407
404
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
408
405
|
parent.appendChild(value);
|
|
409
|
-
} else parent.replaceChild(value,
|
|
406
|
+
} else parent.replaceChild(value, parent.firstChild);
|
|
410
407
|
current = value;
|
|
411
408
|
} else console.warn(`Unrecognized value. Skipped inserting`, value);
|
|
412
409
|
return current;
|
|
@@ -446,10 +443,10 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
446
443
|
const el = current[i];
|
|
447
444
|
if (node !== el) {
|
|
448
445
|
const isParent = el.parentNode === parent;
|
|
449
|
-
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent &&
|
|
446
|
+
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent && el.remove();
|
|
450
447
|
} else inserted = true;
|
|
451
448
|
}
|
|
452
|
-
} else
|
|
449
|
+
} else parent.insertBefore(node, marker);
|
|
453
450
|
return [node];
|
|
454
451
|
}
|
|
455
452
|
function gatherHydratable(element, root) {
|
|
@@ -536,6 +533,9 @@ function Dynamic(props) {
|
|
|
536
533
|
const component = p.component;
|
|
537
534
|
switch (typeof component) {
|
|
538
535
|
case "function":
|
|
536
|
+
Object.assign(component, {
|
|
537
|
+
[$DEVCOMP]: true
|
|
538
|
+
});
|
|
539
539
|
return untrack(() => component(others));
|
|
540
540
|
case "string":
|
|
541
541
|
const isSvg = SVGElements.has(component);
|
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,13 @@ function renderToStream(code, options = {}) {
|
|
|
322
322
|
const dedupe = new WeakMap();
|
|
323
323
|
const checkEnd = () => {
|
|
324
324
|
if (!registry.size && !completed) {
|
|
325
|
+
writeTasks();
|
|
325
326
|
onCompleteAll && onCompleteAll(result);
|
|
326
327
|
writable && writable.end();
|
|
327
328
|
completed = true;
|
|
328
329
|
}
|
|
329
330
|
};
|
|
330
|
-
const
|
|
331
|
+
const writeTasks = () => {
|
|
331
332
|
if (tasks.length && !completed) {
|
|
332
333
|
buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>${tasks.join(";")}</script>`);
|
|
333
334
|
tasks.length = 0;
|
|
@@ -354,7 +355,7 @@ function renderToStream(code, options = {}) {
|
|
|
354
355
|
nonce,
|
|
355
356
|
writeResource(id, p, error) {
|
|
356
357
|
if (!scheduled) {
|
|
357
|
-
Promise.resolve().then(
|
|
358
|
+
Promise.resolve().then(writeTasks);
|
|
358
359
|
scheduled = true;
|
|
359
360
|
}
|
|
360
361
|
if (error) return tasks.push(`_$HY.set("${id}", ${serializeError(p)})`);
|
|
@@ -369,17 +370,19 @@ function renderToStream(code, options = {}) {
|
|
|
369
370
|
registerFragment(key) {
|
|
370
371
|
registry.set(key, []);
|
|
371
372
|
if (!scheduled) {
|
|
372
|
-
Promise.resolve().then(
|
|
373
|
+
Promise.resolve().then(writeTasks);
|
|
373
374
|
scheduled = true;
|
|
374
375
|
}
|
|
375
376
|
tasks.push(`_$HY.init("${key}")`);
|
|
376
377
|
return (value, error) => {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
378
|
+
if (registry.has(key)) {
|
|
379
|
+
const keys = registry.get(key);
|
|
380
|
+
registry.delete(key);
|
|
381
|
+
if (waitForFragments(registry, key)) return;
|
|
382
|
+
if ((value !== undefined || error) && !completed) {
|
|
383
|
+
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>`);
|
|
384
|
+
scriptFlushed = true;
|
|
385
|
+
}
|
|
383
386
|
}
|
|
384
387
|
checkEnd();
|
|
385
388
|
return true;
|
|
@@ -575,8 +578,8 @@ function getHydrationKey() {
|
|
|
575
578
|
function generateHydrationScript({
|
|
576
579
|
eventNames = ["click", "input"],
|
|
577
580
|
nonce
|
|
578
|
-
}) {
|
|
579
|
-
return `<script${nonce ? ` nonce="${nonce}"` : ""}>var e,t;e=window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=(t,o)=>{if(o=e.r[t])return o[0]};</script
|
|
581
|
+
} = {}) {
|
|
582
|
+
return `<script${nonce ? ` nonce="${nonce}"` : ""}>var e,t;e=window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=(t,o)=>{if(o=e.r[t])return o[0]};</script><!--xs-->`;
|
|
580
583
|
}
|
|
581
584
|
function injectAssets(assets, html) {
|
|
582
585
|
for (let i = 0; i < assets.length; i++) {
|
|
@@ -586,7 +589,7 @@ function injectAssets(assets, html) {
|
|
|
586
589
|
}
|
|
587
590
|
function injectScripts(html, scripts, nonce) {
|
|
588
591
|
const tag = `<script${nonce ? ` nonce="${nonce}"` : ""}>${scripts}</script>`;
|
|
589
|
-
const index = html.indexOf("
|
|
592
|
+
const index = html.indexOf("<!--xs-->");
|
|
590
593
|
if (index > -1) {
|
|
591
594
|
return html.slice(0, index) + tag + html.slice(index);
|
|
592
595
|
}
|
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,13 @@ function renderToStream(code, options = {}) {
|
|
|
319
319
|
const dedupe = new WeakMap();
|
|
320
320
|
const checkEnd = () => {
|
|
321
321
|
if (!registry.size && !completed) {
|
|
322
|
+
writeTasks();
|
|
322
323
|
onCompleteAll && onCompleteAll(result);
|
|
323
324
|
writable && writable.end();
|
|
324
325
|
completed = true;
|
|
325
326
|
}
|
|
326
327
|
};
|
|
327
|
-
const
|
|
328
|
+
const writeTasks = () => {
|
|
328
329
|
if (tasks.length && !completed) {
|
|
329
330
|
buffer.write(`<script${nonce ? ` nonce="${nonce}"` : ""}>${tasks.join(";")}</script>`);
|
|
330
331
|
tasks.length = 0;
|
|
@@ -351,7 +352,7 @@ function renderToStream(code, options = {}) {
|
|
|
351
352
|
nonce,
|
|
352
353
|
writeResource(id, p, error) {
|
|
353
354
|
if (!scheduled) {
|
|
354
|
-
Promise.resolve().then(
|
|
355
|
+
Promise.resolve().then(writeTasks);
|
|
355
356
|
scheduled = true;
|
|
356
357
|
}
|
|
357
358
|
if (error) return tasks.push(`_$HY.set("${id}", ${serializeError(p)})`);
|
|
@@ -366,17 +367,19 @@ function renderToStream(code, options = {}) {
|
|
|
366
367
|
registerFragment(key) {
|
|
367
368
|
registry.set(key, []);
|
|
368
369
|
if (!scheduled) {
|
|
369
|
-
Promise.resolve().then(
|
|
370
|
+
Promise.resolve().then(writeTasks);
|
|
370
371
|
scheduled = true;
|
|
371
372
|
}
|
|
372
373
|
tasks.push(`_$HY.init("${key}")`);
|
|
373
374
|
return (value, error) => {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
375
|
+
if (registry.has(key)) {
|
|
376
|
+
const keys = registry.get(key);
|
|
377
|
+
registry.delete(key);
|
|
378
|
+
if (waitForFragments(registry, key)) return;
|
|
379
|
+
if ((value !== undefined || error) && !completed) {
|
|
380
|
+
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>`);
|
|
381
|
+
scriptFlushed = true;
|
|
382
|
+
}
|
|
380
383
|
}
|
|
381
384
|
checkEnd();
|
|
382
385
|
return true;
|
|
@@ -572,8 +575,8 @@ function getHydrationKey() {
|
|
|
572
575
|
function generateHydrationScript({
|
|
573
576
|
eventNames = ["click", "input"],
|
|
574
577
|
nonce
|
|
575
|
-
}) {
|
|
576
|
-
return `<script${nonce ? ` nonce="${nonce}"` : ""}>var e,t;e=window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=(t,o)=>{if(o=e.r[t])return o[0]};</script
|
|
578
|
+
} = {}) {
|
|
579
|
+
return `<script${nonce ? ` nonce="${nonce}"` : ""}>var e,t;e=window._$HY||(_$HY={events:[],completed:new WeakSet,r:{}}),t=e=>e&&e.hasAttribute&&(e.hasAttribute("data-hk")?e:t(e.host&&e.host instanceof Node?e.host:e.parentNode)),["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{let s=o.composedPath&&o.composedPath()[0]||o.target,a=t(s);a&&!e.completed.has(a)&&e.events.push([a,o])})))),e.init=(t,o)=>{e.r[t]=[new Promise(((e,t)=>o=e)),o]},e.set=(t,o,s)=>{(s=e.r[t])&&s[1](o),e.r[t]=[o]},e.unset=t=>{delete e.r[t]},e.load=(t,o)=>{if(o=e.r[t])return o[0]};</script><!--xs-->`;
|
|
577
580
|
}
|
|
578
581
|
function injectAssets(assets, html) {
|
|
579
582
|
for (let i = 0; i < assets.length; i++) {
|
|
@@ -583,7 +586,7 @@ function injectAssets(assets, html) {
|
|
|
583
586
|
}
|
|
584
587
|
function injectScripts(html, scripts, nonce) {
|
|
585
588
|
const tag = `<script${nonce ? ` nonce="${nonce}"` : ""}>${scripts}</script>`;
|
|
586
|
-
const index = html.indexOf("
|
|
589
|
+
const index = html.indexOf("<!--xs-->");
|
|
587
590
|
if (index > -1) {
|
|
588
591
|
return html.slice(0, index) + tag + html.slice(index);
|
|
589
592
|
}
|
package/web/dist/web.cjs
CHANGED
|
@@ -59,7 +59,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
59
59
|
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
60
60
|
} else if (bEnd === bStart) {
|
|
61
61
|
while (aStart < aEnd) {
|
|
62
|
-
if (!map || !map.has(a[aStart]))
|
|
62
|
+
if (!map || !map.has(a[aStart])) a[aStart].remove();
|
|
63
63
|
aStart++;
|
|
64
64
|
}
|
|
65
65
|
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
@@ -88,7 +88,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
88
88
|
while (bStart < index) parentNode.insertBefore(b[bStart++], node);
|
|
89
89
|
} else parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
90
90
|
} else aStart++;
|
|
91
|
-
} else
|
|
91
|
+
} else a[aStart++].remove();
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -346,6 +346,7 @@ function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
|
346
346
|
return prevProps;
|
|
347
347
|
}
|
|
348
348
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
349
|
+
if (solidJs.sharedConfig.context && !current) current = [...parent.childNodes];
|
|
349
350
|
while (typeof current === "function") current = current();
|
|
350
351
|
if (value === current) return current;
|
|
351
352
|
const t = typeof value,
|
|
@@ -387,28 +388,24 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
387
388
|
return current;
|
|
388
389
|
}
|
|
389
390
|
if (array.length === 0) {
|
|
390
|
-
|
|
391
|
-
|
|
391
|
+
cleanChildren(parent, current, marker);
|
|
392
|
+
} else if (Array.isArray(current)) {
|
|
393
|
+
if (current.length === 0) {
|
|
394
|
+
appendNodes(parent, array, marker);
|
|
395
|
+
} else reconcileArrays(parent, current, array);
|
|
392
396
|
} else {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
appendNodes(parent, array, marker);
|
|
396
|
-
} else reconcileArrays(parent, current, array);
|
|
397
|
-
} else if (current == null || current === "") {
|
|
398
|
-
appendNodes(parent, array);
|
|
399
|
-
} else {
|
|
400
|
-
reconcileArrays(parent, multi && current || [parent.firstChild], array);
|
|
401
|
-
}
|
|
397
|
+
current && cleanChildren(parent, current);
|
|
398
|
+
appendNodes(parent, array);
|
|
402
399
|
}
|
|
403
400
|
current = array;
|
|
404
401
|
} else if (value instanceof Node) {
|
|
405
|
-
if (solidJs.sharedConfig.context) return current = value.parentNode ? value : current;
|
|
402
|
+
if (solidJs.sharedConfig.context) return current = value.parentNode ? multi ? [value] : value : current;
|
|
406
403
|
if (Array.isArray(current)) {
|
|
407
404
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
408
405
|
cleanChildren(parent, current, null, value);
|
|
409
406
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
410
407
|
parent.appendChild(value);
|
|
411
|
-
} else parent.replaceChild(value,
|
|
408
|
+
} else parent.replaceChild(value, parent.firstChild);
|
|
412
409
|
current = value;
|
|
413
410
|
} else ;
|
|
414
411
|
return current;
|
|
@@ -448,10 +445,10 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
448
445
|
const el = current[i];
|
|
449
446
|
if (node !== el) {
|
|
450
447
|
const isParent = el.parentNode === parent;
|
|
451
|
-
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent &&
|
|
448
|
+
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent && el.remove();
|
|
452
449
|
} else inserted = true;
|
|
453
450
|
}
|
|
454
|
-
} else
|
|
451
|
+
} else parent.insertBefore(node, marker);
|
|
455
452
|
return [node];
|
|
456
453
|
}
|
|
457
454
|
function gatherHydratable(element, root) {
|
package/web/dist/web.js
CHANGED
|
@@ -56,7 +56,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
56
56
|
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
57
57
|
} else if (bEnd === bStart) {
|
|
58
58
|
while (aStart < aEnd) {
|
|
59
|
-
if (!map || !map.has(a[aStart]))
|
|
59
|
+
if (!map || !map.has(a[aStart])) a[aStart].remove();
|
|
60
60
|
aStart++;
|
|
61
61
|
}
|
|
62
62
|
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
@@ -85,7 +85,7 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
85
85
|
while (bStart < index) parentNode.insertBefore(b[bStart++], node);
|
|
86
86
|
} else parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
87
87
|
} else aStart++;
|
|
88
|
-
} else
|
|
88
|
+
} else a[aStart++].remove();
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -343,6 +343,7 @@ function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
|
343
343
|
return prevProps;
|
|
344
344
|
}
|
|
345
345
|
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
346
|
+
if (sharedConfig.context && !current) current = [...parent.childNodes];
|
|
346
347
|
while (typeof current === "function") current = current();
|
|
347
348
|
if (value === current) return current;
|
|
348
349
|
const t = typeof value,
|
|
@@ -384,28 +385,24 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
384
385
|
return current;
|
|
385
386
|
}
|
|
386
387
|
if (array.length === 0) {
|
|
387
|
-
|
|
388
|
-
|
|
388
|
+
cleanChildren(parent, current, marker);
|
|
389
|
+
} else if (Array.isArray(current)) {
|
|
390
|
+
if (current.length === 0) {
|
|
391
|
+
appendNodes(parent, array, marker);
|
|
392
|
+
} else reconcileArrays(parent, current, array);
|
|
389
393
|
} else {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
appendNodes(parent, array, marker);
|
|
393
|
-
} else reconcileArrays(parent, current, array);
|
|
394
|
-
} else if (current == null || current === "") {
|
|
395
|
-
appendNodes(parent, array);
|
|
396
|
-
} else {
|
|
397
|
-
reconcileArrays(parent, multi && current || [parent.firstChild], array);
|
|
398
|
-
}
|
|
394
|
+
current && cleanChildren(parent, current);
|
|
395
|
+
appendNodes(parent, array);
|
|
399
396
|
}
|
|
400
397
|
current = array;
|
|
401
398
|
} else if (value instanceof Node) {
|
|
402
|
-
if (sharedConfig.context) return current = value.parentNode ? value : current;
|
|
399
|
+
if (sharedConfig.context) return current = value.parentNode ? multi ? [value] : value : current;
|
|
403
400
|
if (Array.isArray(current)) {
|
|
404
401
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
405
402
|
cleanChildren(parent, current, null, value);
|
|
406
403
|
} else if (current == null || current === "" || !parent.firstChild) {
|
|
407
404
|
parent.appendChild(value);
|
|
408
|
-
} else parent.replaceChild(value,
|
|
405
|
+
} else parent.replaceChild(value, parent.firstChild);
|
|
409
406
|
current = value;
|
|
410
407
|
} else ;
|
|
411
408
|
return current;
|
|
@@ -445,10 +442,10 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
445
442
|
const el = current[i];
|
|
446
443
|
if (node !== el) {
|
|
447
444
|
const isParent = el.parentNode === parent;
|
|
448
|
-
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent &&
|
|
445
|
+
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent && el.remove();
|
|
449
446
|
} else inserted = true;
|
|
450
447
|
}
|
|
451
|
-
} else
|
|
448
|
+
} else parent.insertBefore(node, marker);
|
|
452
449
|
return [node];
|
|
453
450
|
}
|
|
454
451
|
function gatherHydratable(element, root) {
|
package/web/package.json
CHANGED
|
@@ -9,5 +9,27 @@
|
|
|
9
9
|
"unpkg": "./dist/web.cjs",
|
|
10
10
|
"types": "./types/index.d.ts",
|
|
11
11
|
"type": "module",
|
|
12
|
-
"sideEffects": false
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"browser": {
|
|
16
|
+
"development": {
|
|
17
|
+
"import": "./dist/dev.js",
|
|
18
|
+
"require": "./dist/dev.cjs"
|
|
19
|
+
},
|
|
20
|
+
"import": "./dist/web.js",
|
|
21
|
+
"require": "./dist/web.cjs"
|
|
22
|
+
},
|
|
23
|
+
"node": {
|
|
24
|
+
"import": "./dist/server.js",
|
|
25
|
+
"require": "./dist/server.cjs"
|
|
26
|
+
},
|
|
27
|
+
"development": {
|
|
28
|
+
"import": "./dist/dev.js",
|
|
29
|
+
"require": "./dist/dev.cjs"
|
|
30
|
+
},
|
|
31
|
+
"import": "./dist/web.js",
|
|
32
|
+
"require": "./dist/web.cjs"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
13
35
|
}
|