solid-js 1.5.0-beta.2 → 1.5.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev.cjs +81 -58
- package/dist/dev.js +81 -58
- package/dist/server.cjs +3 -3
- package/dist/server.js +3 -3
- package/dist/solid.cjs +81 -58
- package/dist/solid.js +81 -58
- package/h/jsx-runtime/types/jsx.d.ts +1 -1
- package/package.json +1 -1
- package/types/jsx.d.ts +2 -2
- package/types/reactive/signal.d.ts +1 -0
- package/types/render/flow.d.ts +18 -1
- package/types/server/rendering.d.ts +6 -2
- package/universal/dist/dev.cjs +4 -1
- package/universal/dist/dev.js +5 -2
- package/universal/dist/universal.cjs +4 -1
- package/universal/dist/universal.js +5 -2
- package/web/dist/dev.cjs +5 -0
- package/web/dist/dev.js +6 -2
- package/web/dist/server.cjs +239 -209
- package/web/dist/server.js +239 -209
- package/web/dist/web.cjs +5 -0
- package/web/dist/web.js +6 -2
package/dist/solid.cjs
CHANGED
|
@@ -166,7 +166,7 @@ function createRoot(fn, detachedOwner) {
|
|
|
166
166
|
context: null,
|
|
167
167
|
owner: detachedOwner || owner
|
|
168
168
|
},
|
|
169
|
-
updateFn = unowned ? fn : () => fn(() => cleanNode(root));
|
|
169
|
+
updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
170
170
|
Owner = root;
|
|
171
171
|
Listener = null;
|
|
172
172
|
try {
|
|
@@ -264,7 +264,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
264
264
|
if (sharedConfig.context) {
|
|
265
265
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
266
266
|
let v;
|
|
267
|
-
if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
|
|
267
|
+
if (options.useInitialValue) initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
|
|
268
268
|
}
|
|
269
269
|
function loadEnd(p, v, success, key) {
|
|
270
270
|
if (pr === p) {
|
|
@@ -907,7 +907,7 @@ function resolveChildren(children) {
|
|
|
907
907
|
function createProvider(id) {
|
|
908
908
|
return function provider(props) {
|
|
909
909
|
let res;
|
|
910
|
-
|
|
910
|
+
createRenderEffect(() => res = untrack(() => {
|
|
911
911
|
Owner.context = {
|
|
912
912
|
[id]: props.value
|
|
913
913
|
};
|
|
@@ -1282,6 +1282,7 @@ function Index(props) {
|
|
|
1282
1282
|
}
|
|
1283
1283
|
function Show(props) {
|
|
1284
1284
|
let strictEqual = false;
|
|
1285
|
+
const keyed = props.keyed;
|
|
1285
1286
|
const condition = createMemo(() => props.when, undefined, {
|
|
1286
1287
|
equals: (a, b) => strictEqual ? a === b : !a === !b
|
|
1287
1288
|
});
|
|
@@ -1289,20 +1290,26 @@ function Show(props) {
|
|
|
1289
1290
|
const c = condition();
|
|
1290
1291
|
if (c) {
|
|
1291
1292
|
const child = props.children;
|
|
1292
|
-
|
|
1293
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1294
|
+
strictEqual = keyed || fn;
|
|
1295
|
+
return fn ? untrack(() => child(c)) : child;
|
|
1293
1296
|
}
|
|
1294
1297
|
return props.fallback;
|
|
1295
1298
|
});
|
|
1296
1299
|
}
|
|
1297
1300
|
function Switch(props) {
|
|
1298
1301
|
let strictEqual = false;
|
|
1302
|
+
let keyed = false;
|
|
1299
1303
|
const conditions = children(() => props.children),
|
|
1300
1304
|
evalConditions = createMemo(() => {
|
|
1301
1305
|
let conds = conditions();
|
|
1302
1306
|
if (!Array.isArray(conds)) conds = [conds];
|
|
1303
1307
|
for (let i = 0; i < conds.length; i++) {
|
|
1304
1308
|
const c = conds[i].when;
|
|
1305
|
-
if (c)
|
|
1309
|
+
if (c) {
|
|
1310
|
+
keyed = !!conds[i].keyed;
|
|
1311
|
+
return [i, c, conds[i]];
|
|
1312
|
+
}
|
|
1306
1313
|
}
|
|
1307
1314
|
return [-1];
|
|
1308
1315
|
}, undefined, {
|
|
@@ -1312,7 +1319,9 @@ function Switch(props) {
|
|
|
1312
1319
|
const [index, when, cond] = evalConditions();
|
|
1313
1320
|
if (index < 0) return props.fallback;
|
|
1314
1321
|
const c = cond.children;
|
|
1315
|
-
|
|
1322
|
+
const fn = typeof c === "function" && c.length > 0;
|
|
1323
|
+
strictEqual = keyed || fn;
|
|
1324
|
+
return fn ? untrack(() => c(when)) : c;
|
|
1316
1325
|
});
|
|
1317
1326
|
}
|
|
1318
1327
|
function Match(props) {
|
|
@@ -1343,74 +1352,85 @@ function ErrorBoundary(props) {
|
|
|
1343
1352
|
});
|
|
1344
1353
|
}
|
|
1345
1354
|
|
|
1355
|
+
const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1346
1356
|
const SuspenseListContext = createContext();
|
|
1347
1357
|
function SuspenseList(props) {
|
|
1348
|
-
let
|
|
1358
|
+
let [wrapper, setWrapper] = createSignal(() => ({
|
|
1359
|
+
inFallback: false
|
|
1360
|
+
})),
|
|
1361
|
+
show;
|
|
1349
1362
|
const listContext = useContext(SuspenseListContext);
|
|
1363
|
+
const [registry, setRegistry] = createSignal([]);
|
|
1350
1364
|
if (listContext) {
|
|
1351
|
-
|
|
1352
|
-
suspenseSetter = setFallback;
|
|
1353
|
-
[showContent, showFallback] = listContext.register(inFallback);
|
|
1365
|
+
show = listContext.register(createMemo(() => wrapper()().inFallback));
|
|
1354
1366
|
}
|
|
1355
|
-
const
|
|
1356
|
-
comp = createComponent(SuspenseListContext.Provider, {
|
|
1357
|
-
value: {
|
|
1358
|
-
register: inFallback => {
|
|
1359
|
-
const [showingContent, showContent] = createSignal(false),
|
|
1360
|
-
[showingFallback, showFallback] = createSignal(false);
|
|
1361
|
-
setRegistry(registry => [...registry, {
|
|
1362
|
-
inFallback,
|
|
1363
|
-
showContent,
|
|
1364
|
-
showFallback
|
|
1365
|
-
}]);
|
|
1366
|
-
return [showingContent, showingFallback];
|
|
1367
|
-
}
|
|
1368
|
-
},
|
|
1369
|
-
get children() {
|
|
1370
|
-
return props.children;
|
|
1371
|
-
}
|
|
1372
|
-
});
|
|
1373
|
-
createComputed(() => {
|
|
1367
|
+
const resolved = createMemo(prev => {
|
|
1374
1368
|
const reveal = props.revealOrder,
|
|
1375
1369
|
tail = props.tail,
|
|
1376
|
-
|
|
1377
|
-
|
|
1370
|
+
{
|
|
1371
|
+
showContent = true,
|
|
1372
|
+
showFallback = true
|
|
1373
|
+
} = show ? show() : {},
|
|
1378
1374
|
reg = registry(),
|
|
1379
1375
|
reverse = reveal === "backwards";
|
|
1380
1376
|
if (reveal === "together") {
|
|
1381
|
-
const all = reg.every(
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
return;
|
|
1377
|
+
const all = reg.every(inFallback => !inFallback());
|
|
1378
|
+
const res = reg.map(() => ({
|
|
1379
|
+
showContent: all && showContent,
|
|
1380
|
+
showFallback
|
|
1381
|
+
}));
|
|
1382
|
+
res.inFallback = !all;
|
|
1383
|
+
return res;
|
|
1388
1384
|
}
|
|
1389
1385
|
let stop = false;
|
|
1386
|
+
let inFallback = prev.inFallback;
|
|
1387
|
+
const res = [];
|
|
1390
1388
|
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1391
1389
|
const n = reverse ? len - i - 1 : i,
|
|
1392
|
-
s = reg[n]
|
|
1390
|
+
s = reg[n]();
|
|
1393
1391
|
if (!stop && !s) {
|
|
1394
|
-
|
|
1395
|
-
|
|
1392
|
+
res[n] = {
|
|
1393
|
+
showContent,
|
|
1394
|
+
showFallback
|
|
1395
|
+
};
|
|
1396
1396
|
} else {
|
|
1397
1397
|
const next = !stop;
|
|
1398
|
-
if (next
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1398
|
+
if (next) inFallback = true;
|
|
1399
|
+
res[n] = {
|
|
1400
|
+
showContent: next,
|
|
1401
|
+
showFallback: !tail || next && tail === "collapsed" ? showFallback : false
|
|
1402
|
+
};
|
|
1402
1403
|
stop = true;
|
|
1403
|
-
reg[n].showContent(next);
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
1406
|
-
if (!stop
|
|
1406
|
+
if (!stop) inFallback = false;
|
|
1407
|
+
res.inFallback = inFallback;
|
|
1408
|
+
return res;
|
|
1409
|
+
}, {
|
|
1410
|
+
inFallback: false
|
|
1411
|
+
});
|
|
1412
|
+
setWrapper(() => resolved);
|
|
1413
|
+
return createComponent(SuspenseListContext.Provider, {
|
|
1414
|
+
value: {
|
|
1415
|
+
register: inFallback => {
|
|
1416
|
+
let index;
|
|
1417
|
+
setRegistry(registry => {
|
|
1418
|
+
index = registry.length;
|
|
1419
|
+
return [...registry, inFallback];
|
|
1420
|
+
});
|
|
1421
|
+
return createMemo(() => resolved()[index], undefined, {
|
|
1422
|
+
equals: suspenseListEquals
|
|
1423
|
+
});
|
|
1424
|
+
}
|
|
1425
|
+
},
|
|
1426
|
+
get children() {
|
|
1427
|
+
return props.children;
|
|
1428
|
+
}
|
|
1407
1429
|
});
|
|
1408
|
-
return comp;
|
|
1409
1430
|
}
|
|
1410
1431
|
function Suspense(props) {
|
|
1411
1432
|
let counter = 0,
|
|
1412
|
-
|
|
1413
|
-
showFallback,
|
|
1433
|
+
show,
|
|
1414
1434
|
ctx,
|
|
1415
1435
|
p,
|
|
1416
1436
|
flicker,
|
|
@@ -1451,7 +1471,7 @@ function Suspense(props) {
|
|
|
1451
1471
|
}
|
|
1452
1472
|
}
|
|
1453
1473
|
const listContext = useContext(SuspenseListContext);
|
|
1454
|
-
if (listContext)
|
|
1474
|
+
if (listContext) show = listContext.register(store.inFallback);
|
|
1455
1475
|
let dispose;
|
|
1456
1476
|
onCleanup(() => dispose && dispose());
|
|
1457
1477
|
return createComponent(SuspenseContext.Provider, {
|
|
@@ -1466,18 +1486,21 @@ function Suspense(props) {
|
|
|
1466
1486
|
}
|
|
1467
1487
|
if (ctx && p === "$$f") setHydrateContext();
|
|
1468
1488
|
const rendered = createMemo(() => props.children);
|
|
1469
|
-
return createMemo(
|
|
1489
|
+
return createMemo(prev => {
|
|
1470
1490
|
const inFallback = store.inFallback(),
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1491
|
+
{
|
|
1492
|
+
showContent = true,
|
|
1493
|
+
showFallback = true
|
|
1494
|
+
} = show ? show() : {};
|
|
1495
|
+
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1475
1496
|
store.resolved = true;
|
|
1476
|
-
|
|
1497
|
+
dispose && dispose();
|
|
1498
|
+
dispose = ctx = p = undefined;
|
|
1477
1499
|
resumeEffects(store.effects);
|
|
1478
1500
|
return rendered();
|
|
1479
1501
|
}
|
|
1480
|
-
if (!
|
|
1502
|
+
if (!showFallback) return;
|
|
1503
|
+
if (dispose) return prev;
|
|
1481
1504
|
return createRoot(disposer => {
|
|
1482
1505
|
dispose = disposer;
|
|
1483
1506
|
if (ctx) {
|
package/dist/solid.js
CHANGED
|
@@ -162,7 +162,7 @@ function createRoot(fn, detachedOwner) {
|
|
|
162
162
|
context: null,
|
|
163
163
|
owner: detachedOwner || owner
|
|
164
164
|
},
|
|
165
|
-
updateFn = unowned ? fn : () => fn(() => cleanNode(root));
|
|
165
|
+
updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
166
166
|
Owner = root;
|
|
167
167
|
Listener = null;
|
|
168
168
|
try {
|
|
@@ -260,7 +260,7 @@ function createResource(pSource, pFetcher, pOptions) {
|
|
|
260
260
|
if (sharedConfig.context) {
|
|
261
261
|
id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
|
|
262
262
|
let v;
|
|
263
|
-
if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
|
|
263
|
+
if (options.useInitialValue) initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v[0];
|
|
264
264
|
}
|
|
265
265
|
function loadEnd(p, v, success, key) {
|
|
266
266
|
if (pr === p) {
|
|
@@ -903,7 +903,7 @@ function resolveChildren(children) {
|
|
|
903
903
|
function createProvider(id) {
|
|
904
904
|
return function provider(props) {
|
|
905
905
|
let res;
|
|
906
|
-
|
|
906
|
+
createRenderEffect(() => res = untrack(() => {
|
|
907
907
|
Owner.context = {
|
|
908
908
|
[id]: props.value
|
|
909
909
|
};
|
|
@@ -1278,6 +1278,7 @@ function Index(props) {
|
|
|
1278
1278
|
}
|
|
1279
1279
|
function Show(props) {
|
|
1280
1280
|
let strictEqual = false;
|
|
1281
|
+
const keyed = props.keyed;
|
|
1281
1282
|
const condition = createMemo(() => props.when, undefined, {
|
|
1282
1283
|
equals: (a, b) => strictEqual ? a === b : !a === !b
|
|
1283
1284
|
});
|
|
@@ -1285,20 +1286,26 @@ function Show(props) {
|
|
|
1285
1286
|
const c = condition();
|
|
1286
1287
|
if (c) {
|
|
1287
1288
|
const child = props.children;
|
|
1288
|
-
|
|
1289
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1290
|
+
strictEqual = keyed || fn;
|
|
1291
|
+
return fn ? untrack(() => child(c)) : child;
|
|
1289
1292
|
}
|
|
1290
1293
|
return props.fallback;
|
|
1291
1294
|
});
|
|
1292
1295
|
}
|
|
1293
1296
|
function Switch(props) {
|
|
1294
1297
|
let strictEqual = false;
|
|
1298
|
+
let keyed = false;
|
|
1295
1299
|
const conditions = children(() => props.children),
|
|
1296
1300
|
evalConditions = createMemo(() => {
|
|
1297
1301
|
let conds = conditions();
|
|
1298
1302
|
if (!Array.isArray(conds)) conds = [conds];
|
|
1299
1303
|
for (let i = 0; i < conds.length; i++) {
|
|
1300
1304
|
const c = conds[i].when;
|
|
1301
|
-
if (c)
|
|
1305
|
+
if (c) {
|
|
1306
|
+
keyed = !!conds[i].keyed;
|
|
1307
|
+
return [i, c, conds[i]];
|
|
1308
|
+
}
|
|
1302
1309
|
}
|
|
1303
1310
|
return [-1];
|
|
1304
1311
|
}, undefined, {
|
|
@@ -1308,7 +1315,9 @@ function Switch(props) {
|
|
|
1308
1315
|
const [index, when, cond] = evalConditions();
|
|
1309
1316
|
if (index < 0) return props.fallback;
|
|
1310
1317
|
const c = cond.children;
|
|
1311
|
-
|
|
1318
|
+
const fn = typeof c === "function" && c.length > 0;
|
|
1319
|
+
strictEqual = keyed || fn;
|
|
1320
|
+
return fn ? untrack(() => c(when)) : c;
|
|
1312
1321
|
});
|
|
1313
1322
|
}
|
|
1314
1323
|
function Match(props) {
|
|
@@ -1339,74 +1348,85 @@ function ErrorBoundary(props) {
|
|
|
1339
1348
|
});
|
|
1340
1349
|
}
|
|
1341
1350
|
|
|
1351
|
+
const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
|
|
1342
1352
|
const SuspenseListContext = createContext();
|
|
1343
1353
|
function SuspenseList(props) {
|
|
1344
|
-
let
|
|
1354
|
+
let [wrapper, setWrapper] = createSignal(() => ({
|
|
1355
|
+
inFallback: false
|
|
1356
|
+
})),
|
|
1357
|
+
show;
|
|
1345
1358
|
const listContext = useContext(SuspenseListContext);
|
|
1359
|
+
const [registry, setRegistry] = createSignal([]);
|
|
1346
1360
|
if (listContext) {
|
|
1347
|
-
|
|
1348
|
-
suspenseSetter = setFallback;
|
|
1349
|
-
[showContent, showFallback] = listContext.register(inFallback);
|
|
1361
|
+
show = listContext.register(createMemo(() => wrapper()().inFallback));
|
|
1350
1362
|
}
|
|
1351
|
-
const
|
|
1352
|
-
comp = createComponent(SuspenseListContext.Provider, {
|
|
1353
|
-
value: {
|
|
1354
|
-
register: inFallback => {
|
|
1355
|
-
const [showingContent, showContent] = createSignal(false),
|
|
1356
|
-
[showingFallback, showFallback] = createSignal(false);
|
|
1357
|
-
setRegistry(registry => [...registry, {
|
|
1358
|
-
inFallback,
|
|
1359
|
-
showContent,
|
|
1360
|
-
showFallback
|
|
1361
|
-
}]);
|
|
1362
|
-
return [showingContent, showingFallback];
|
|
1363
|
-
}
|
|
1364
|
-
},
|
|
1365
|
-
get children() {
|
|
1366
|
-
return props.children;
|
|
1367
|
-
}
|
|
1368
|
-
});
|
|
1369
|
-
createComputed(() => {
|
|
1363
|
+
const resolved = createMemo(prev => {
|
|
1370
1364
|
const reveal = props.revealOrder,
|
|
1371
1365
|
tail = props.tail,
|
|
1372
|
-
|
|
1373
|
-
|
|
1366
|
+
{
|
|
1367
|
+
showContent = true,
|
|
1368
|
+
showFallback = true
|
|
1369
|
+
} = show ? show() : {},
|
|
1374
1370
|
reg = registry(),
|
|
1375
1371
|
reverse = reveal === "backwards";
|
|
1376
1372
|
if (reveal === "together") {
|
|
1377
|
-
const all = reg.every(
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
return;
|
|
1373
|
+
const all = reg.every(inFallback => !inFallback());
|
|
1374
|
+
const res = reg.map(() => ({
|
|
1375
|
+
showContent: all && showContent,
|
|
1376
|
+
showFallback
|
|
1377
|
+
}));
|
|
1378
|
+
res.inFallback = !all;
|
|
1379
|
+
return res;
|
|
1384
1380
|
}
|
|
1385
1381
|
let stop = false;
|
|
1382
|
+
let inFallback = prev.inFallback;
|
|
1383
|
+
const res = [];
|
|
1386
1384
|
for (let i = 0, len = reg.length; i < len; i++) {
|
|
1387
1385
|
const n = reverse ? len - i - 1 : i,
|
|
1388
|
-
s = reg[n]
|
|
1386
|
+
s = reg[n]();
|
|
1389
1387
|
if (!stop && !s) {
|
|
1390
|
-
|
|
1391
|
-
|
|
1388
|
+
res[n] = {
|
|
1389
|
+
showContent,
|
|
1390
|
+
showFallback
|
|
1391
|
+
};
|
|
1392
1392
|
} else {
|
|
1393
1393
|
const next = !stop;
|
|
1394
|
-
if (next
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1394
|
+
if (next) inFallback = true;
|
|
1395
|
+
res[n] = {
|
|
1396
|
+
showContent: next,
|
|
1397
|
+
showFallback: !tail || next && tail === "collapsed" ? showFallback : false
|
|
1398
|
+
};
|
|
1398
1399
|
stop = true;
|
|
1399
|
-
reg[n].showContent(next);
|
|
1400
1400
|
}
|
|
1401
1401
|
}
|
|
1402
|
-
if (!stop
|
|
1402
|
+
if (!stop) inFallback = false;
|
|
1403
|
+
res.inFallback = inFallback;
|
|
1404
|
+
return res;
|
|
1405
|
+
}, {
|
|
1406
|
+
inFallback: false
|
|
1407
|
+
});
|
|
1408
|
+
setWrapper(() => resolved);
|
|
1409
|
+
return createComponent(SuspenseListContext.Provider, {
|
|
1410
|
+
value: {
|
|
1411
|
+
register: inFallback => {
|
|
1412
|
+
let index;
|
|
1413
|
+
setRegistry(registry => {
|
|
1414
|
+
index = registry.length;
|
|
1415
|
+
return [...registry, inFallback];
|
|
1416
|
+
});
|
|
1417
|
+
return createMemo(() => resolved()[index], undefined, {
|
|
1418
|
+
equals: suspenseListEquals
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
},
|
|
1422
|
+
get children() {
|
|
1423
|
+
return props.children;
|
|
1424
|
+
}
|
|
1403
1425
|
});
|
|
1404
|
-
return comp;
|
|
1405
1426
|
}
|
|
1406
1427
|
function Suspense(props) {
|
|
1407
1428
|
let counter = 0,
|
|
1408
|
-
|
|
1409
|
-
showFallback,
|
|
1429
|
+
show,
|
|
1410
1430
|
ctx,
|
|
1411
1431
|
p,
|
|
1412
1432
|
flicker,
|
|
@@ -1447,7 +1467,7 @@ function Suspense(props) {
|
|
|
1447
1467
|
}
|
|
1448
1468
|
}
|
|
1449
1469
|
const listContext = useContext(SuspenseListContext);
|
|
1450
|
-
if (listContext)
|
|
1470
|
+
if (listContext) show = listContext.register(store.inFallback);
|
|
1451
1471
|
let dispose;
|
|
1452
1472
|
onCleanup(() => dispose && dispose());
|
|
1453
1473
|
return createComponent(SuspenseContext.Provider, {
|
|
@@ -1462,18 +1482,21 @@ function Suspense(props) {
|
|
|
1462
1482
|
}
|
|
1463
1483
|
if (ctx && p === "$$f") setHydrateContext();
|
|
1464
1484
|
const rendered = createMemo(() => props.children);
|
|
1465
|
-
return createMemo(
|
|
1485
|
+
return createMemo(prev => {
|
|
1466
1486
|
const inFallback = store.inFallback(),
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1487
|
+
{
|
|
1488
|
+
showContent = true,
|
|
1489
|
+
showFallback = true
|
|
1490
|
+
} = show ? show() : {};
|
|
1491
|
+
if ((!inFallback || p && p !== "$$f") && showContent) {
|
|
1471
1492
|
store.resolved = true;
|
|
1472
|
-
|
|
1493
|
+
dispose && dispose();
|
|
1494
|
+
dispose = ctx = p = undefined;
|
|
1473
1495
|
resumeEffects(store.effects);
|
|
1474
1496
|
return rendered();
|
|
1475
1497
|
}
|
|
1476
|
-
if (!
|
|
1498
|
+
if (!showFallback) return;
|
|
1499
|
+
if (dispose) return prev;
|
|
1477
1500
|
return createRoot(disposer => {
|
|
1478
1501
|
dispose = disposer;
|
|
1479
1502
|
if (ctx) {
|
|
@@ -1854,7 +1854,7 @@ export namespace JSX {
|
|
|
1854
1854
|
del: HTMLAttributes<HTMLElement>;
|
|
1855
1855
|
details: DetailsHtmlAttributes<HTMLDetailsElement>;
|
|
1856
1856
|
dfn: HTMLAttributes<HTMLElement>;
|
|
1857
|
-
dialog: DialogHtmlAttributes<
|
|
1857
|
+
dialog: DialogHtmlAttributes<HTMLDialogElement>;
|
|
1858
1858
|
div: HTMLAttributes<HTMLDivElement>;
|
|
1859
1859
|
dl: HTMLAttributes<HTMLDListElement>;
|
|
1860
1860
|
dt: HTMLAttributes<HTMLElement>;
|
package/package.json
CHANGED
package/types/jsx.d.ts
CHANGED
|
@@ -286,7 +286,7 @@ export namespace JSX {
|
|
|
286
286
|
interface CSSProperties extends csstype.PropertiesHyphen {
|
|
287
287
|
// Override
|
|
288
288
|
}
|
|
289
|
-
|
|
289
|
+
|
|
290
290
|
type HTMLAutocapitalize = "off" | "none" | "on" | "sentences" | "words" | "characters";
|
|
291
291
|
type HTMLDir = "ltr" | "rtl" | "auto";
|
|
292
292
|
type HTMLFormEncType = "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain";
|
|
@@ -1862,7 +1862,7 @@ export namespace JSX {
|
|
|
1862
1862
|
del: HTMLAttributes<HTMLElement>;
|
|
1863
1863
|
details: DetailsHtmlAttributes<HTMLDetailsElement>;
|
|
1864
1864
|
dfn: HTMLAttributes<HTMLElement>;
|
|
1865
|
-
dialog: DialogHtmlAttributes<
|
|
1865
|
+
dialog: DialogHtmlAttributes<HTMLDialogElement>;
|
|
1866
1866
|
div: HTMLAttributes<HTMLDivElement>;
|
|
1867
1867
|
dl: HTMLAttributes<HTMLDListElement>;
|
|
1868
1868
|
dt: HTMLAttributes<HTMLElement>;
|
|
@@ -247,6 +247,7 @@ export declare type ResourceOptions<T, S = unknown> = {
|
|
|
247
247
|
initialValue?: T;
|
|
248
248
|
name?: string;
|
|
249
249
|
deferStream?: boolean;
|
|
250
|
+
useInitialValue?: boolean;
|
|
250
251
|
store?: (init: T | undefined) => [Accessor<T | undefined>, Setter<T | undefined>];
|
|
251
252
|
onHydrated?: (k: S | undefined, info: {
|
|
252
253
|
value: T | undefined;
|
package/types/render/flow.d.ts
CHANGED
|
@@ -42,9 +42,16 @@ export declare function Index<T, U extends JSX.Element>(props: {
|
|
|
42
42
|
*/
|
|
43
43
|
export declare function Show<T>(props: {
|
|
44
44
|
when: T | undefined | null | false;
|
|
45
|
+
keyed: true;
|
|
45
46
|
fallback?: JSX.Element;
|
|
46
47
|
children: JSX.Element | ((item: NonNullable<T>) => JSX.Element);
|
|
47
48
|
}): () => JSX.Element;
|
|
49
|
+
export declare function Show<T>(props: {
|
|
50
|
+
when: T | undefined | null | false;
|
|
51
|
+
keyed?: false;
|
|
52
|
+
fallback?: JSX.Element;
|
|
53
|
+
children: JSX.Element;
|
|
54
|
+
}): () => JSX.Element;
|
|
48
55
|
/**
|
|
49
56
|
* switches between content based on mutually exclusive conditions
|
|
50
57
|
* ```typescript
|
|
@@ -65,6 +72,7 @@ export declare function Switch(props: {
|
|
|
65
72
|
}): Accessor<JSX.Element>;
|
|
66
73
|
export declare type MatchProps<T> = {
|
|
67
74
|
when: T | undefined | null | false;
|
|
75
|
+
keyed?: boolean;
|
|
68
76
|
children: JSX.Element | ((item: NonNullable<T>) => JSX.Element);
|
|
69
77
|
};
|
|
70
78
|
/**
|
|
@@ -76,7 +84,16 @@ export declare type MatchProps<T> = {
|
|
|
76
84
|
* ```
|
|
77
85
|
* @description https://www.solidjs.com/docs/latest/api#%3Cswitch%3E%2F%3Cmatch%3E
|
|
78
86
|
*/
|
|
79
|
-
export declare function Match<T>(props:
|
|
87
|
+
export declare function Match<T>(props: {
|
|
88
|
+
when: T | undefined | null | false;
|
|
89
|
+
keyed: true;
|
|
90
|
+
children: JSX.Element | ((item: NonNullable<T>) => JSX.Element);
|
|
91
|
+
}): JSX.Element;
|
|
92
|
+
export declare function Match<T>(props: {
|
|
93
|
+
when: T | undefined | null | false;
|
|
94
|
+
keyed?: false;
|
|
95
|
+
children: JSX.Element;
|
|
96
|
+
}): JSX.Element;
|
|
80
97
|
export declare function resetErrorBoundaries(): void;
|
|
81
98
|
/**
|
|
82
99
|
* catches uncaught errors inside components and renders a fallback content
|
|
@@ -48,9 +48,10 @@ export declare function Index<T>(props: {
|
|
|
48
48
|
children: (item: () => T, index: number) => string;
|
|
49
49
|
}): string | any[] | undefined;
|
|
50
50
|
export declare function Show<T>(props: {
|
|
51
|
-
when: T | false;
|
|
51
|
+
when: T | undefined | null | false;
|
|
52
|
+
keyed?: boolean;
|
|
52
53
|
fallback?: string;
|
|
53
|
-
children: string | ((item: T) => string);
|
|
54
|
+
children: string | ((item: NonNullable<T>) => string);
|
|
54
55
|
}): string;
|
|
55
56
|
export declare function Switch(props: {
|
|
56
57
|
fallback?: string;
|
|
@@ -58,6 +59,7 @@ export declare function Switch(props: {
|
|
|
58
59
|
}): string;
|
|
59
60
|
declare type MatchProps<T> = {
|
|
60
61
|
when: T | false;
|
|
62
|
+
keyed?: boolean;
|
|
61
63
|
children: string | ((item: T) => string);
|
|
62
64
|
};
|
|
63
65
|
export declare function Match<T>(props: MatchProps<T>): MatchProps<T>;
|
|
@@ -98,11 +100,13 @@ export declare type ResourceOptions<T> = undefined extends T ? {
|
|
|
98
100
|
initialValue?: T;
|
|
99
101
|
name?: string;
|
|
100
102
|
deferStream?: boolean;
|
|
103
|
+
useInitialValue?: boolean;
|
|
101
104
|
onHydrated?: <S, T>(k: S, info: ResourceFetcherInfo<T>) => void;
|
|
102
105
|
} : {
|
|
103
106
|
initialValue: T;
|
|
104
107
|
name?: string;
|
|
105
108
|
deferStream?: boolean;
|
|
109
|
+
useInitialValue?: boolean;
|
|
106
110
|
onHydrated?: <S, T>(k: S, info: ResourceFetcherInfo<T>) => void;
|
|
107
111
|
};
|
|
108
112
|
export declare function createResource<T, S = true>(fetcher: ResourceFetcher<S, T>, options?: ResourceOptions<undefined>): ResourceReturn<T | undefined>;
|
package/universal/dist/dev.cjs
CHANGED
|
@@ -235,7 +235,10 @@ function createRenderer$1({
|
|
|
235
235
|
mergeProps,
|
|
236
236
|
effect: solidJs.createRenderEffect,
|
|
237
237
|
memo,
|
|
238
|
-
createComponent: solidJs.createComponent
|
|
238
|
+
createComponent: solidJs.createComponent,
|
|
239
|
+
use(fn, element, arg) {
|
|
240
|
+
return solidJs.untrack(() => fn(element, arg));
|
|
241
|
+
}
|
|
239
242
|
};
|
|
240
243
|
}
|
|
241
244
|
function mergeProps(...sources) {
|
package/universal/dist/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createMemo, createRoot, createRenderEffect, createComponent, mergeProps as mergeProps$1 } from 'solid-js';
|
|
1
|
+
import { createMemo, createRoot, createRenderEffect, createComponent, untrack, mergeProps as mergeProps$1 } from 'solid-js';
|
|
2
2
|
|
|
3
3
|
function memo(fn, equals) {
|
|
4
4
|
return createMemo(fn, undefined, !equals ? {
|
|
@@ -231,7 +231,10 @@ function createRenderer$1({
|
|
|
231
231
|
mergeProps,
|
|
232
232
|
effect: createRenderEffect,
|
|
233
233
|
memo,
|
|
234
|
-
createComponent
|
|
234
|
+
createComponent,
|
|
235
|
+
use(fn, element, arg) {
|
|
236
|
+
return untrack(() => fn(element, arg));
|
|
237
|
+
}
|
|
235
238
|
};
|
|
236
239
|
}
|
|
237
240
|
function mergeProps(...sources) {
|
|
@@ -235,7 +235,10 @@ function createRenderer$1({
|
|
|
235
235
|
mergeProps,
|
|
236
236
|
effect: solidJs.createRenderEffect,
|
|
237
237
|
memo,
|
|
238
|
-
createComponent: solidJs.createComponent
|
|
238
|
+
createComponent: solidJs.createComponent,
|
|
239
|
+
use(fn, element, arg) {
|
|
240
|
+
return solidJs.untrack(() => fn(element, arg));
|
|
241
|
+
}
|
|
239
242
|
};
|
|
240
243
|
}
|
|
241
244
|
function mergeProps(...sources) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createMemo, createRoot, createRenderEffect, createComponent, mergeProps as mergeProps$1 } from 'solid-js';
|
|
1
|
+
import { createMemo, createRoot, createRenderEffect, createComponent, untrack, mergeProps as mergeProps$1 } from 'solid-js';
|
|
2
2
|
|
|
3
3
|
function memo(fn, equals) {
|
|
4
4
|
return createMemo(fn, undefined, !equals ? {
|
|
@@ -231,7 +231,10 @@ function createRenderer$1({
|
|
|
231
231
|
mergeProps,
|
|
232
232
|
effect: createRenderEffect,
|
|
233
233
|
memo,
|
|
234
|
-
createComponent
|
|
234
|
+
createComponent,
|
|
235
|
+
use(fn, element, arg) {
|
|
236
|
+
return untrack(() => fn(element, arg));
|
|
237
|
+
}
|
|
235
238
|
};
|
|
236
239
|
}
|
|
237
240
|
function mergeProps(...sources) {
|