@epoch32/visage 1.1.1 → 1.1.2
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/charts/index.js +15 -9
- package/dist/devtools/index.js +15 -9
- package/dist/dom/index.js +15 -9
- package/dist/index.js +15 -9
- package/dist/jsx-runtime/index.js +15 -9
- package/dist/router/index.js +15 -9
- package/dist/style/index.js +15 -9
- package/dist/ui/index.js +15 -9
- package/dist/virtual/index.js +15 -9
- package/package.json +1 -1
- package/src/dom/control-flow.ts +19 -10
package/dist/charts/index.js
CHANGED
|
@@ -1498,11 +1498,11 @@ function Show(props) {
|
|
|
1498
1498
|
}
|
|
1499
1499
|
return props.fallback ?? null;
|
|
1500
1500
|
}
|
|
1501
|
-
const marker = document.
|
|
1501
|
+
const marker = document.createComment("visage-show");
|
|
1502
1502
|
const initialFrag = document.createDocumentFragment();
|
|
1503
|
+
initialFrag.appendChild(marker);
|
|
1503
1504
|
let currentScope = null;
|
|
1504
1505
|
let currentContent = [];
|
|
1505
|
-
let isMounted = false;
|
|
1506
1506
|
effect(() => {
|
|
1507
1507
|
const condition = resolveValue(props.when);
|
|
1508
1508
|
if (currentScope) {
|
|
@@ -1528,23 +1528,29 @@ function Show(props) {
|
|
|
1528
1528
|
currentScope = new Scope(getActiveScope());
|
|
1529
1529
|
untrack(() => {
|
|
1530
1530
|
runInScope(currentScope, () => {
|
|
1531
|
-
|
|
1531
|
+
const fallbackRes = typeof props.fallback === "function" ? props.fallback() : props.fallback;
|
|
1532
|
+
insertChild(frag, fallbackRes);
|
|
1532
1533
|
});
|
|
1533
1534
|
});
|
|
1534
1535
|
}
|
|
1535
1536
|
currentContent = Array.from(frag.childNodes);
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
initialFrag.appendChild(frag);
|
|
1537
|
+
const parent = marker.parentNode;
|
|
1538
|
+
if (parent) {
|
|
1539
|
+
parent.insertBefore(frag, marker);
|
|
1540
1540
|
}
|
|
1541
1541
|
});
|
|
1542
|
-
isMounted = true;
|
|
1543
|
-
initialFrag.appendChild(marker);
|
|
1544
1542
|
onCleanup(() => {
|
|
1545
1543
|
if (currentScope) {
|
|
1546
1544
|
currentScope.dispose();
|
|
1547
1545
|
}
|
|
1546
|
+
for (const node of currentContent) {
|
|
1547
|
+
if (node.parentNode) {
|
|
1548
|
+
node.parentNode.removeChild(node);
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
if (marker.parentNode) {
|
|
1552
|
+
marker.parentNode.removeChild(marker);
|
|
1553
|
+
}
|
|
1548
1554
|
});
|
|
1549
1555
|
return initialFrag;
|
|
1550
1556
|
}
|
package/dist/devtools/index.js
CHANGED
|
@@ -1947,11 +1947,11 @@ function Show(props) {
|
|
|
1947
1947
|
}
|
|
1948
1948
|
return props.fallback ?? null;
|
|
1949
1949
|
}
|
|
1950
|
-
const marker = document.
|
|
1950
|
+
const marker = document.createComment("visage-show");
|
|
1951
1951
|
const initialFrag = document.createDocumentFragment();
|
|
1952
|
+
initialFrag.appendChild(marker);
|
|
1952
1953
|
let currentScope = null;
|
|
1953
1954
|
let currentContent = [];
|
|
1954
|
-
let isMounted = false;
|
|
1955
1955
|
effect(() => {
|
|
1956
1956
|
const condition = resolveValue(props.when);
|
|
1957
1957
|
if (currentScope) {
|
|
@@ -1977,23 +1977,29 @@ function Show(props) {
|
|
|
1977
1977
|
currentScope = new Scope(getActiveScope());
|
|
1978
1978
|
untrack(() => {
|
|
1979
1979
|
runInScope(currentScope, () => {
|
|
1980
|
-
|
|
1980
|
+
const fallbackRes = typeof props.fallback === "function" ? props.fallback() : props.fallback;
|
|
1981
|
+
insertChild(frag, fallbackRes);
|
|
1981
1982
|
});
|
|
1982
1983
|
});
|
|
1983
1984
|
}
|
|
1984
1985
|
currentContent = Array.from(frag.childNodes);
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
initialFrag.appendChild(frag);
|
|
1986
|
+
const parent = marker.parentNode;
|
|
1987
|
+
if (parent) {
|
|
1988
|
+
parent.insertBefore(frag, marker);
|
|
1989
1989
|
}
|
|
1990
1990
|
});
|
|
1991
|
-
isMounted = true;
|
|
1992
|
-
initialFrag.appendChild(marker);
|
|
1993
1991
|
onCleanup(() => {
|
|
1994
1992
|
if (currentScope) {
|
|
1995
1993
|
currentScope.dispose();
|
|
1996
1994
|
}
|
|
1995
|
+
for (const node of currentContent) {
|
|
1996
|
+
if (node.parentNode) {
|
|
1997
|
+
node.parentNode.removeChild(node);
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
if (marker.parentNode) {
|
|
2001
|
+
marker.parentNode.removeChild(marker);
|
|
2002
|
+
}
|
|
1997
2003
|
});
|
|
1998
2004
|
return initialFrag;
|
|
1999
2005
|
}
|
package/dist/dom/index.js
CHANGED
|
@@ -1385,11 +1385,11 @@ function Show(props) {
|
|
|
1385
1385
|
}
|
|
1386
1386
|
return props.fallback ?? null;
|
|
1387
1387
|
}
|
|
1388
|
-
const marker = document.
|
|
1388
|
+
const marker = document.createComment("visage-show");
|
|
1389
1389
|
const initialFrag = document.createDocumentFragment();
|
|
1390
|
+
initialFrag.appendChild(marker);
|
|
1390
1391
|
let currentScope = null;
|
|
1391
1392
|
let currentContent = [];
|
|
1392
|
-
let isMounted = false;
|
|
1393
1393
|
effect(() => {
|
|
1394
1394
|
const condition = resolveValue(props.when);
|
|
1395
1395
|
if (currentScope) {
|
|
@@ -1415,23 +1415,29 @@ function Show(props) {
|
|
|
1415
1415
|
currentScope = new Scope(getActiveScope());
|
|
1416
1416
|
untrack(() => {
|
|
1417
1417
|
runInScope(currentScope, () => {
|
|
1418
|
-
|
|
1418
|
+
const fallbackRes = typeof props.fallback === "function" ? props.fallback() : props.fallback;
|
|
1419
|
+
insertChild(frag, fallbackRes);
|
|
1419
1420
|
});
|
|
1420
1421
|
});
|
|
1421
1422
|
}
|
|
1422
1423
|
currentContent = Array.from(frag.childNodes);
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
initialFrag.appendChild(frag);
|
|
1424
|
+
const parent = marker.parentNode;
|
|
1425
|
+
if (parent) {
|
|
1426
|
+
parent.insertBefore(frag, marker);
|
|
1427
1427
|
}
|
|
1428
1428
|
});
|
|
1429
|
-
isMounted = true;
|
|
1430
|
-
initialFrag.appendChild(marker);
|
|
1431
1429
|
onCleanup(() => {
|
|
1432
1430
|
if (currentScope) {
|
|
1433
1431
|
currentScope.dispose();
|
|
1434
1432
|
}
|
|
1433
|
+
for (const node of currentContent) {
|
|
1434
|
+
if (node.parentNode) {
|
|
1435
|
+
node.parentNode.removeChild(node);
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
if (marker.parentNode) {
|
|
1439
|
+
marker.parentNode.removeChild(marker);
|
|
1440
|
+
}
|
|
1435
1441
|
});
|
|
1436
1442
|
return initialFrag;
|
|
1437
1443
|
}
|
package/dist/index.js
CHANGED
|
@@ -4220,11 +4220,11 @@ function Show(props) {
|
|
|
4220
4220
|
}
|
|
4221
4221
|
return props.fallback ?? null;
|
|
4222
4222
|
}
|
|
4223
|
-
const marker = document.
|
|
4223
|
+
const marker = document.createComment("visage-show");
|
|
4224
4224
|
const initialFrag = document.createDocumentFragment();
|
|
4225
|
+
initialFrag.appendChild(marker);
|
|
4225
4226
|
let currentScope = null;
|
|
4226
4227
|
let currentContent = [];
|
|
4227
|
-
let isMounted = false;
|
|
4228
4228
|
effect(() => {
|
|
4229
4229
|
const condition = resolveValue(props.when);
|
|
4230
4230
|
if (currentScope) {
|
|
@@ -4250,23 +4250,29 @@ function Show(props) {
|
|
|
4250
4250
|
currentScope = new Scope(getActiveScope());
|
|
4251
4251
|
untrack(() => {
|
|
4252
4252
|
runInScope(currentScope, () => {
|
|
4253
|
-
|
|
4253
|
+
const fallbackRes = typeof props.fallback === "function" ? props.fallback() : props.fallback;
|
|
4254
|
+
insertChild(frag, fallbackRes);
|
|
4254
4255
|
});
|
|
4255
4256
|
});
|
|
4256
4257
|
}
|
|
4257
4258
|
currentContent = Array.from(frag.childNodes);
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
initialFrag.appendChild(frag);
|
|
4259
|
+
const parent = marker.parentNode;
|
|
4260
|
+
if (parent) {
|
|
4261
|
+
parent.insertBefore(frag, marker);
|
|
4262
4262
|
}
|
|
4263
4263
|
});
|
|
4264
|
-
isMounted = true;
|
|
4265
|
-
initialFrag.appendChild(marker);
|
|
4266
4264
|
onCleanup(() => {
|
|
4267
4265
|
if (currentScope) {
|
|
4268
4266
|
currentScope.dispose();
|
|
4269
4267
|
}
|
|
4268
|
+
for (const node of currentContent) {
|
|
4269
|
+
if (node.parentNode) {
|
|
4270
|
+
node.parentNode.removeChild(node);
|
|
4271
|
+
}
|
|
4272
|
+
}
|
|
4273
|
+
if (marker.parentNode) {
|
|
4274
|
+
marker.parentNode.removeChild(marker);
|
|
4275
|
+
}
|
|
4270
4276
|
});
|
|
4271
4277
|
return initialFrag;
|
|
4272
4278
|
}
|
|
@@ -1385,11 +1385,11 @@ function Show(props) {
|
|
|
1385
1385
|
}
|
|
1386
1386
|
return props.fallback ?? null;
|
|
1387
1387
|
}
|
|
1388
|
-
const marker = document.
|
|
1388
|
+
const marker = document.createComment("visage-show");
|
|
1389
1389
|
const initialFrag = document.createDocumentFragment();
|
|
1390
|
+
initialFrag.appendChild(marker);
|
|
1390
1391
|
let currentScope = null;
|
|
1391
1392
|
let currentContent = [];
|
|
1392
|
-
let isMounted = false;
|
|
1393
1393
|
effect(() => {
|
|
1394
1394
|
const condition = resolveValue(props.when);
|
|
1395
1395
|
if (currentScope) {
|
|
@@ -1415,23 +1415,29 @@ function Show(props) {
|
|
|
1415
1415
|
currentScope = new Scope(getActiveScope());
|
|
1416
1416
|
untrack(() => {
|
|
1417
1417
|
runInScope(currentScope, () => {
|
|
1418
|
-
|
|
1418
|
+
const fallbackRes = typeof props.fallback === "function" ? props.fallback() : props.fallback;
|
|
1419
|
+
insertChild(frag, fallbackRes);
|
|
1419
1420
|
});
|
|
1420
1421
|
});
|
|
1421
1422
|
}
|
|
1422
1423
|
currentContent = Array.from(frag.childNodes);
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
initialFrag.appendChild(frag);
|
|
1424
|
+
const parent = marker.parentNode;
|
|
1425
|
+
if (parent) {
|
|
1426
|
+
parent.insertBefore(frag, marker);
|
|
1427
1427
|
}
|
|
1428
1428
|
});
|
|
1429
|
-
isMounted = true;
|
|
1430
|
-
initialFrag.appendChild(marker);
|
|
1431
1429
|
onCleanup(() => {
|
|
1432
1430
|
if (currentScope) {
|
|
1433
1431
|
currentScope.dispose();
|
|
1434
1432
|
}
|
|
1433
|
+
for (const node of currentContent) {
|
|
1434
|
+
if (node.parentNode) {
|
|
1435
|
+
node.parentNode.removeChild(node);
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
if (marker.parentNode) {
|
|
1439
|
+
marker.parentNode.removeChild(marker);
|
|
1440
|
+
}
|
|
1435
1441
|
});
|
|
1436
1442
|
return initialFrag;
|
|
1437
1443
|
}
|
package/dist/router/index.js
CHANGED
|
@@ -1385,11 +1385,11 @@ function Show(props) {
|
|
|
1385
1385
|
}
|
|
1386
1386
|
return props.fallback ?? null;
|
|
1387
1387
|
}
|
|
1388
|
-
const marker = document.
|
|
1388
|
+
const marker = document.createComment("visage-show");
|
|
1389
1389
|
const initialFrag = document.createDocumentFragment();
|
|
1390
|
+
initialFrag.appendChild(marker);
|
|
1390
1391
|
let currentScope = null;
|
|
1391
1392
|
let currentContent = [];
|
|
1392
|
-
let isMounted = false;
|
|
1393
1393
|
effect(() => {
|
|
1394
1394
|
const condition = resolveValue(props.when);
|
|
1395
1395
|
if (currentScope) {
|
|
@@ -1415,23 +1415,29 @@ function Show(props) {
|
|
|
1415
1415
|
currentScope = new Scope(getActiveScope());
|
|
1416
1416
|
untrack(() => {
|
|
1417
1417
|
runInScope(currentScope, () => {
|
|
1418
|
-
|
|
1418
|
+
const fallbackRes = typeof props.fallback === "function" ? props.fallback() : props.fallback;
|
|
1419
|
+
insertChild(frag, fallbackRes);
|
|
1419
1420
|
});
|
|
1420
1421
|
});
|
|
1421
1422
|
}
|
|
1422
1423
|
currentContent = Array.from(frag.childNodes);
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
initialFrag.appendChild(frag);
|
|
1424
|
+
const parent = marker.parentNode;
|
|
1425
|
+
if (parent) {
|
|
1426
|
+
parent.insertBefore(frag, marker);
|
|
1427
1427
|
}
|
|
1428
1428
|
});
|
|
1429
|
-
isMounted = true;
|
|
1430
|
-
initialFrag.appendChild(marker);
|
|
1431
1429
|
onCleanup(() => {
|
|
1432
1430
|
if (currentScope) {
|
|
1433
1431
|
currentScope.dispose();
|
|
1434
1432
|
}
|
|
1433
|
+
for (const node of currentContent) {
|
|
1434
|
+
if (node.parentNode) {
|
|
1435
|
+
node.parentNode.removeChild(node);
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
if (marker.parentNode) {
|
|
1439
|
+
marker.parentNode.removeChild(marker);
|
|
1440
|
+
}
|
|
1435
1441
|
});
|
|
1436
1442
|
return initialFrag;
|
|
1437
1443
|
}
|
package/dist/style/index.js
CHANGED
|
@@ -1818,11 +1818,11 @@ function Show(props) {
|
|
|
1818
1818
|
}
|
|
1819
1819
|
return props.fallback ?? null;
|
|
1820
1820
|
}
|
|
1821
|
-
const marker = document.
|
|
1821
|
+
const marker = document.createComment("visage-show");
|
|
1822
1822
|
const initialFrag = document.createDocumentFragment();
|
|
1823
|
+
initialFrag.appendChild(marker);
|
|
1823
1824
|
let currentScope = null;
|
|
1824
1825
|
let currentContent = [];
|
|
1825
|
-
let isMounted = false;
|
|
1826
1826
|
effect(() => {
|
|
1827
1827
|
const condition = resolveValue(props.when);
|
|
1828
1828
|
if (currentScope) {
|
|
@@ -1848,23 +1848,29 @@ function Show(props) {
|
|
|
1848
1848
|
currentScope = new Scope(getActiveScope());
|
|
1849
1849
|
untrack(() => {
|
|
1850
1850
|
runInScope(currentScope, () => {
|
|
1851
|
-
|
|
1851
|
+
const fallbackRes = typeof props.fallback === "function" ? props.fallback() : props.fallback;
|
|
1852
|
+
insertChild(frag, fallbackRes);
|
|
1852
1853
|
});
|
|
1853
1854
|
});
|
|
1854
1855
|
}
|
|
1855
1856
|
currentContent = Array.from(frag.childNodes);
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
initialFrag.appendChild(frag);
|
|
1857
|
+
const parent = marker.parentNode;
|
|
1858
|
+
if (parent) {
|
|
1859
|
+
parent.insertBefore(frag, marker);
|
|
1860
1860
|
}
|
|
1861
1861
|
});
|
|
1862
|
-
isMounted = true;
|
|
1863
|
-
initialFrag.appendChild(marker);
|
|
1864
1862
|
onCleanup(() => {
|
|
1865
1863
|
if (currentScope) {
|
|
1866
1864
|
currentScope.dispose();
|
|
1867
1865
|
}
|
|
1866
|
+
for (const node of currentContent) {
|
|
1867
|
+
if (node.parentNode) {
|
|
1868
|
+
node.parentNode.removeChild(node);
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
if (marker.parentNode) {
|
|
1872
|
+
marker.parentNode.removeChild(marker);
|
|
1873
|
+
}
|
|
1868
1874
|
});
|
|
1869
1875
|
return initialFrag;
|
|
1870
1876
|
}
|
package/dist/ui/index.js
CHANGED
|
@@ -1142,11 +1142,11 @@ function Show(props) {
|
|
|
1142
1142
|
}
|
|
1143
1143
|
return props.fallback ?? null;
|
|
1144
1144
|
}
|
|
1145
|
-
const marker = document.
|
|
1145
|
+
const marker = document.createComment("visage-show");
|
|
1146
1146
|
const initialFrag = document.createDocumentFragment();
|
|
1147
|
+
initialFrag.appendChild(marker);
|
|
1147
1148
|
let currentScope = null;
|
|
1148
1149
|
let currentContent = [];
|
|
1149
|
-
let isMounted = false;
|
|
1150
1150
|
effect(() => {
|
|
1151
1151
|
const condition = resolveValue(props.when);
|
|
1152
1152
|
if (currentScope) {
|
|
@@ -1172,23 +1172,29 @@ function Show(props) {
|
|
|
1172
1172
|
currentScope = new Scope(getActiveScope());
|
|
1173
1173
|
untrack(() => {
|
|
1174
1174
|
runInScope(currentScope, () => {
|
|
1175
|
-
|
|
1175
|
+
const fallbackRes = typeof props.fallback === "function" ? props.fallback() : props.fallback;
|
|
1176
|
+
insertChild(frag, fallbackRes);
|
|
1176
1177
|
});
|
|
1177
1178
|
});
|
|
1178
1179
|
}
|
|
1179
1180
|
currentContent = Array.from(frag.childNodes);
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
initialFrag.appendChild(frag);
|
|
1181
|
+
const parent = marker.parentNode;
|
|
1182
|
+
if (parent) {
|
|
1183
|
+
parent.insertBefore(frag, marker);
|
|
1184
1184
|
}
|
|
1185
1185
|
});
|
|
1186
|
-
isMounted = true;
|
|
1187
|
-
initialFrag.appendChild(marker);
|
|
1188
1186
|
onCleanup(() => {
|
|
1189
1187
|
if (currentScope) {
|
|
1190
1188
|
currentScope.dispose();
|
|
1191
1189
|
}
|
|
1190
|
+
for (const node of currentContent) {
|
|
1191
|
+
if (node.parentNode) {
|
|
1192
|
+
node.parentNode.removeChild(node);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
if (marker.parentNode) {
|
|
1196
|
+
marker.parentNode.removeChild(marker);
|
|
1197
|
+
}
|
|
1192
1198
|
});
|
|
1193
1199
|
return initialFrag;
|
|
1194
1200
|
}
|
package/dist/virtual/index.js
CHANGED
|
@@ -1142,11 +1142,11 @@ function Show(props) {
|
|
|
1142
1142
|
}
|
|
1143
1143
|
return props.fallback ?? null;
|
|
1144
1144
|
}
|
|
1145
|
-
const marker = document.
|
|
1145
|
+
const marker = document.createComment("visage-show");
|
|
1146
1146
|
const initialFrag = document.createDocumentFragment();
|
|
1147
|
+
initialFrag.appendChild(marker);
|
|
1147
1148
|
let currentScope = null;
|
|
1148
1149
|
let currentContent = [];
|
|
1149
|
-
let isMounted = false;
|
|
1150
1150
|
effect(() => {
|
|
1151
1151
|
const condition = resolveValue(props.when);
|
|
1152
1152
|
if (currentScope) {
|
|
@@ -1172,23 +1172,29 @@ function Show(props) {
|
|
|
1172
1172
|
currentScope = new Scope(getActiveScope());
|
|
1173
1173
|
untrack(() => {
|
|
1174
1174
|
runInScope(currentScope, () => {
|
|
1175
|
-
|
|
1175
|
+
const fallbackRes = typeof props.fallback === "function" ? props.fallback() : props.fallback;
|
|
1176
|
+
insertChild(frag, fallbackRes);
|
|
1176
1177
|
});
|
|
1177
1178
|
});
|
|
1178
1179
|
}
|
|
1179
1180
|
currentContent = Array.from(frag.childNodes);
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
initialFrag.appendChild(frag);
|
|
1181
|
+
const parent = marker.parentNode;
|
|
1182
|
+
if (parent) {
|
|
1183
|
+
parent.insertBefore(frag, marker);
|
|
1184
1184
|
}
|
|
1185
1185
|
});
|
|
1186
|
-
isMounted = true;
|
|
1187
|
-
initialFrag.appendChild(marker);
|
|
1188
1186
|
onCleanup(() => {
|
|
1189
1187
|
if (currentScope) {
|
|
1190
1188
|
currentScope.dispose();
|
|
1191
1189
|
}
|
|
1190
|
+
for (const node of currentContent) {
|
|
1191
|
+
if (node.parentNode) {
|
|
1192
|
+
node.parentNode.removeChild(node);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
if (marker.parentNode) {
|
|
1196
|
+
marker.parentNode.removeChild(marker);
|
|
1197
|
+
}
|
|
1192
1198
|
});
|
|
1193
1199
|
return initialFrag;
|
|
1194
1200
|
}
|
package/package.json
CHANGED
package/src/dom/control-flow.ts
CHANGED
|
@@ -33,11 +33,12 @@ export function Show<T>(props: ShowProps<T>): any {
|
|
|
33
33
|
return props.fallback ?? null;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const marker = document.
|
|
36
|
+
const marker = document.createComment("visage-show");
|
|
37
37
|
const initialFrag = document.createDocumentFragment();
|
|
38
|
+
initialFrag.appendChild(marker);
|
|
39
|
+
|
|
38
40
|
let currentScope: Scope | null = null;
|
|
39
41
|
let currentContent: Node[] = [];
|
|
40
|
-
let isMounted = false;
|
|
41
42
|
|
|
42
43
|
effect(() => {
|
|
43
44
|
const condition = resolveValue(props.when);
|
|
@@ -75,27 +76,35 @@ export function Show<T>(props: ShowProps<T>): any {
|
|
|
75
76
|
currentScope = new Scope(getActiveScope());
|
|
76
77
|
untrack(() => {
|
|
77
78
|
runInScope(currentScope, () => {
|
|
78
|
-
|
|
79
|
+
const fallbackRes =
|
|
80
|
+
typeof props.fallback === "function"
|
|
81
|
+
? (props.fallback as () => Child)()
|
|
82
|
+
: props.fallback;
|
|
83
|
+
insertChild(frag, fallbackRes);
|
|
79
84
|
});
|
|
80
85
|
});
|
|
81
86
|
}
|
|
82
87
|
|
|
83
88
|
currentContent = Array.from(frag.childNodes);
|
|
84
89
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
initialFrag.appendChild(frag);
|
|
90
|
+
const parent = marker.parentNode;
|
|
91
|
+
if (parent) {
|
|
92
|
+
parent.insertBefore(frag, marker);
|
|
89
93
|
}
|
|
90
94
|
});
|
|
91
95
|
|
|
92
|
-
isMounted = true;
|
|
93
|
-
initialFrag.appendChild(marker);
|
|
94
|
-
|
|
95
96
|
onCleanup(() => {
|
|
96
97
|
if (currentScope) {
|
|
97
98
|
currentScope.dispose();
|
|
98
99
|
}
|
|
100
|
+
for (const node of currentContent) {
|
|
101
|
+
if (node.parentNode) {
|
|
102
|
+
node.parentNode.removeChild(node);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (marker.parentNode) {
|
|
106
|
+
marker.parentNode.removeChild(marker);
|
|
107
|
+
}
|
|
99
108
|
});
|
|
100
109
|
|
|
101
110
|
return initialFrag;
|