@epoch32/visage 1.1.1 → 1.1.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/api/index.js CHANGED
@@ -988,7 +988,7 @@ function createContext(defaultValue) {
988
988
  }
989
989
  scope.context.set(id, props.value);
990
990
  return runInScope(scope, () => {
991
- const content = typeof props.children === "function" ? untrack(() => props.children()) : props.children;
991
+ const content = typeof props.children === "function" ? props.children() : props.children;
992
992
  if (typeof document !== "undefined") {
993
993
  const frag = document.createDocumentFragment();
994
994
  insertChild(frag, content);
@@ -724,7 +724,7 @@ function createContext(defaultValue) {
724
724
  }
725
725
  scope.context.set(id, props.value);
726
726
  return runInScope(scope, () => {
727
- const content = typeof props.children === "function" ? untrack(() => props.children()) : props.children;
727
+ const content = typeof props.children === "function" ? props.children() : props.children;
728
728
  if (typeof document !== "undefined") {
729
729
  const frag = document.createDocumentFragment();
730
730
  insertChild(frag, content);
@@ -1498,11 +1498,11 @@ function Show(props) {
1498
1498
  }
1499
1499
  return props.fallback ?? null;
1500
1500
  }
1501
- const marker = document.createTextNode("");
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
- insertChild(frag, props.fallback);
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
- if (marker.parentNode) {
1537
- marker.parentNode.insertBefore(frag, marker);
1538
- } else if (!isMounted) {
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
  }
@@ -724,7 +724,7 @@ function createContext(defaultValue) {
724
724
  }
725
725
  scope.context.set(id, props.value);
726
726
  return runInScope(scope, () => {
727
- const content = typeof props.children === "function" ? untrack(() => props.children()) : props.children;
727
+ const content = typeof props.children === "function" ? props.children() : props.children;
728
728
  if (typeof document !== "undefined") {
729
729
  const frag = document.createDocumentFragment();
730
730
  insertChild(frag, content);
@@ -1947,11 +1947,11 @@ function Show(props) {
1947
1947
  }
1948
1948
  return props.fallback ?? null;
1949
1949
  }
1950
- const marker = document.createTextNode("");
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
- insertChild(frag, props.fallback);
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
- if (marker.parentNode) {
1986
- marker.parentNode.insertBefore(frag, marker);
1987
- } else if (!isMounted) {
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
  }
@@ -2503,7 +2509,12 @@ function TabsTrigger(props) {
2503
2509
  "data-value": value,
2504
2510
  tabIndex: () => isSelected() ? 0 : -1,
2505
2511
  disabled,
2506
- class: className,
2512
+ class: [
2513
+ className,
2514
+ {
2515
+ active: isSelected
2516
+ }
2517
+ ],
2507
2518
  style,
2508
2519
  onClick: handleClick,
2509
2520
  ...rest,
package/dist/dom/index.js CHANGED
@@ -724,7 +724,7 @@ function createContext(defaultValue) {
724
724
  }
725
725
  scope.context.set(id, props.value);
726
726
  return runInScope(scope, () => {
727
- const content = typeof props.children === "function" ? untrack(() => props.children()) : props.children;
727
+ const content = typeof props.children === "function" ? props.children() : props.children;
728
728
  if (typeof document !== "undefined") {
729
729
  const frag = document.createDocumentFragment();
730
730
  insertChild(frag, content);
@@ -1385,11 +1385,11 @@ function Show(props) {
1385
1385
  }
1386
1386
  return props.fallback ?? null;
1387
1387
  }
1388
- const marker = document.createTextNode("");
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
- insertChild(frag, props.fallback);
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
- if (marker.parentNode) {
1424
- marker.parentNode.insertBefore(frag, marker);
1425
- } else if (!isMounted) {
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
  }
@@ -724,7 +724,7 @@ function createContext(defaultValue) {
724
724
  }
725
725
  scope.context.set(id, props.value);
726
726
  return runInScope(scope, () => {
727
- const content = typeof props.children === "function" ? untrack(() => props.children()) : props.children;
727
+ const content = typeof props.children === "function" ? props.children() : props.children;
728
728
  if (typeof document !== "undefined") {
729
729
  const frag = document.createDocumentFragment();
730
730
  insertChild(frag, content);
package/dist/index.js CHANGED
@@ -988,7 +988,7 @@ function createContext(defaultValue) {
988
988
  }
989
989
  scope.context.set(id, props.value);
990
990
  return runInScope(scope, () => {
991
- const content = typeof props.children === "function" ? untrack(() => props.children()) : props.children;
991
+ const content = typeof props.children === "function" ? props.children() : props.children;
992
992
  if (typeof document !== "undefined") {
993
993
  const frag = document.createDocumentFragment();
994
994
  insertChild(frag, content);
@@ -4220,11 +4220,11 @@ function Show(props) {
4220
4220
  }
4221
4221
  return props.fallback ?? null;
4222
4222
  }
4223
- const marker = document.createTextNode("");
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
- insertChild(frag, props.fallback);
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
- if (marker.parentNode) {
4259
- marker.parentNode.insertBefore(frag, marker);
4260
- } else if (!isMounted) {
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
  }
@@ -6550,7 +6556,12 @@ function TabsTrigger(props) {
6550
6556
  "data-value": value,
6551
6557
  tabIndex: () => isSelected() ? 0 : -1,
6552
6558
  disabled,
6553
- class: className,
6559
+ class: [
6560
+ className,
6561
+ {
6562
+ active: isSelected
6563
+ }
6564
+ ],
6554
6565
  style,
6555
6566
  onClick: handleClick,
6556
6567
  ...rest,
@@ -724,7 +724,7 @@ function createContext(defaultValue) {
724
724
  }
725
725
  scope.context.set(id, props.value);
726
726
  return runInScope(scope, () => {
727
- const content = typeof props.children === "function" ? untrack(() => props.children()) : props.children;
727
+ const content = typeof props.children === "function" ? props.children() : props.children;
728
728
  if (typeof document !== "undefined") {
729
729
  const frag = document.createDocumentFragment();
730
730
  insertChild(frag, content);
@@ -1385,11 +1385,11 @@ function Show(props) {
1385
1385
  }
1386
1386
  return props.fallback ?? null;
1387
1387
  }
1388
- const marker = document.createTextNode("");
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
- insertChild(frag, props.fallback);
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
- if (marker.parentNode) {
1424
- marker.parentNode.insertBefore(frag, marker);
1425
- } else if (!isMounted) {
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
  }
@@ -724,7 +724,7 @@ function createContext(defaultValue) {
724
724
  }
725
725
  scope.context.set(id, props.value);
726
726
  return runInScope(scope, () => {
727
- const content = typeof props.children === "function" ? untrack(() => props.children()) : props.children;
727
+ const content = typeof props.children === "function" ? props.children() : props.children;
728
728
  if (typeof document !== "undefined") {
729
729
  const frag = document.createDocumentFragment();
730
730
  insertChild(frag, content);
@@ -724,7 +724,7 @@ function createContext(defaultValue) {
724
724
  }
725
725
  scope.context.set(id, props.value);
726
726
  return runInScope(scope, () => {
727
- const content = typeof props.children === "function" ? untrack(() => props.children()) : props.children;
727
+ const content = typeof props.children === "function" ? props.children() : props.children;
728
728
  if (typeof document !== "undefined") {
729
729
  const frag = document.createDocumentFragment();
730
730
  insertChild(frag, content);
@@ -1385,11 +1385,11 @@ function Show(props) {
1385
1385
  }
1386
1386
  return props.fallback ?? null;
1387
1387
  }
1388
- const marker = document.createTextNode("");
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
- insertChild(frag, props.fallback);
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
- if (marker.parentNode) {
1424
- marker.parentNode.insertBefore(frag, marker);
1425
- } else if (!isMounted) {
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/rpc/index.js CHANGED
@@ -934,7 +934,7 @@ function createContext(defaultValue) {
934
934
  }
935
935
  scope.context.set(id, props.value);
936
936
  return runInScope(scope, () => {
937
- const content = typeof props.children === "function" ? untrack(() => props.children()) : props.children;
937
+ const content = typeof props.children === "function" ? props.children() : props.children;
938
938
  if (typeof document !== "undefined") {
939
939
  const frag = document.createDocumentFragment();
940
940
  insertChild(frag, content);
@@ -307,7 +307,7 @@ function createContext(defaultValue) {
307
307
  }
308
308
  scope.context.set(id, props.value);
309
309
  return runInScope(scope, () => {
310
- const content = typeof props.children === "function" ? untrack(() => props.children()) : props.children;
310
+ const content = typeof props.children === "function" ? props.children() : props.children;
311
311
  if (typeof document !== "undefined") {
312
312
  const frag = document.createDocumentFragment();
313
313
  insertChild(frag, content);
@@ -724,7 +724,7 @@ function createContext(defaultValue) {
724
724
  }
725
725
  scope.context.set(id, props.value);
726
726
  return runInScope(scope, () => {
727
- const content = typeof props.children === "function" ? untrack(() => props.children()) : props.children;
727
+ const content = typeof props.children === "function" ? props.children() : props.children;
728
728
  if (typeof document !== "undefined") {
729
729
  const frag = document.createDocumentFragment();
730
730
  insertChild(frag, content);
@@ -724,7 +724,7 @@ function createContext(defaultValue) {
724
724
  }
725
725
  scope.context.set(id, props.value);
726
726
  return runInScope(scope, () => {
727
- const content = typeof props.children === "function" ? untrack(() => props.children()) : props.children;
727
+ const content = typeof props.children === "function" ? props.children() : props.children;
728
728
  if (typeof document !== "undefined") {
729
729
  const frag = document.createDocumentFragment();
730
730
  insertChild(frag, content);
@@ -1818,11 +1818,11 @@ function Show(props) {
1818
1818
  }
1819
1819
  return props.fallback ?? null;
1820
1820
  }
1821
- const marker = document.createTextNode("");
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
- insertChild(frag, props.fallback);
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
- if (marker.parentNode) {
1857
- marker.parentNode.insertBefore(frag, marker);
1858
- } else if (!isMounted) {
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
  }
@@ -307,7 +307,7 @@ function createContext(defaultValue) {
307
307
  }
308
308
  scope.context.set(id, props.value);
309
309
  return runInScope(scope, () => {
310
- const content = typeof props.children === "function" ? untrack(() => props.children()) : props.children;
310
+ const content = typeof props.children === "function" ? props.children() : props.children;
311
311
  if (typeof document !== "undefined") {
312
312
  const frag = document.createDocumentFragment();
313
313
  insertChild(frag, content);
package/dist/ui/index.js CHANGED
@@ -724,7 +724,7 @@ function createContext(defaultValue) {
724
724
  }
725
725
  scope.context.set(id, props.value);
726
726
  return runInScope(scope, () => {
727
- const content = typeof props.children === "function" ? untrack(() => props.children()) : props.children;
727
+ const content = typeof props.children === "function" ? props.children() : props.children;
728
728
  if (typeof document !== "undefined") {
729
729
  const frag = document.createDocumentFragment();
730
730
  insertChild(frag, content);
@@ -1142,11 +1142,11 @@ function Show(props) {
1142
1142
  }
1143
1143
  return props.fallback ?? null;
1144
1144
  }
1145
- const marker = document.createTextNode("");
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
- insertChild(frag, props.fallback);
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
- if (marker.parentNode) {
1181
- marker.parentNode.insertBefore(frag, marker);
1182
- } else if (!isMounted) {
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
  }
@@ -3768,7 +3774,12 @@ function TabsTrigger(props) {
3768
3774
  "data-value": value,
3769
3775
  tabIndex: () => isSelected() ? 0 : -1,
3770
3776
  disabled,
3771
- class: className,
3777
+ class: [
3778
+ className,
3779
+ {
3780
+ active: isSelected
3781
+ }
3782
+ ],
3772
3783
  style,
3773
3784
  onClick: handleClick,
3774
3785
  ...rest,
@@ -724,7 +724,7 @@ function createContext(defaultValue) {
724
724
  }
725
725
  scope.context.set(id, props.value);
726
726
  return runInScope(scope, () => {
727
- const content = typeof props.children === "function" ? untrack(() => props.children()) : props.children;
727
+ const content = typeof props.children === "function" ? props.children() : props.children;
728
728
  if (typeof document !== "undefined") {
729
729
  const frag = document.createDocumentFragment();
730
730
  insertChild(frag, content);
@@ -1142,11 +1142,11 @@ function Show(props) {
1142
1142
  }
1143
1143
  return props.fallback ?? null;
1144
1144
  }
1145
- const marker = document.createTextNode("");
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
- insertChild(frag, props.fallback);
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
- if (marker.parentNode) {
1181
- marker.parentNode.insertBefore(frag, marker);
1182
- } else if (!isMounted) {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epoch32/visage",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Lightning-fast, zero-VDOM, fine-grained reactive UI library with full TypeScript support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -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.createTextNode("");
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
- insertChild(frag, props.fallback);
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
- if (marker.parentNode) {
86
- marker.parentNode.insertBefore(frag, marker);
87
- } else if (!isMounted) {
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;
@@ -1,6 +1,5 @@
1
1
  import { type Child, insertChild } from "../dom/render";
2
2
  import { getActiveScope, runInScope, Scope } from "./scope";
3
- import { untrack } from "./system";
4
3
 
5
4
  export interface Context<T> {
6
5
  id: symbol;
@@ -54,7 +53,7 @@ export function createContext<T>(defaultValue?: T): Context<T | undefined> {
54
53
  return runInScope(scope, () => {
55
54
  const content =
56
55
  typeof props.children === "function"
57
- ? untrack(() => (props.children as (...args: any[]) => any)())
56
+ ? (props.children as (...args: any[]) => any)()
58
57
  : props.children;
59
58
  if (typeof document !== "undefined") {
60
59
  const frag = document.createDocumentFragment();
package/src/ui/tabs.tsx CHANGED
@@ -227,7 +227,12 @@ export function TabsTrigger(props: TabsTriggerProps): Child {
227
227
  data-value={value}
228
228
  tabIndex={() => (isSelected() ? 0 : -1)}
229
229
  disabled={disabled}
230
- class={className}
230
+ class={[
231
+ className,
232
+ {
233
+ active: isSelected
234
+ }
235
+ ]}
231
236
  style={style}
232
237
  onClick={handleClick}
233
238
  {...rest}