@tscircuit/schematic-viewer 1.2.6 → 1.2.8

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/index.js CHANGED
@@ -1113,6 +1113,14 @@ function scale(sx, sy = void 0, cx = void 0, cy = void 0) {
1113
1113
  // node_modules/transformation-matrix/src/skew.js
1114
1114
  var { tan } = Math;
1115
1115
 
1116
+ // node_modules/transformation-matrix/src/toString.js
1117
+ function toSVG(matrix) {
1118
+ return toString(matrix);
1119
+ }
1120
+ function toString(matrix) {
1121
+ return `matrix(${matrix.a},${matrix.b},${matrix.c},${matrix.d},${matrix.e},${matrix.f})`;
1122
+ }
1123
+
1116
1124
  // node_modules/transformation-matrix/src/fromTransformAttribute.autogenerated.js
1117
1125
  function peg$subclass(child, parent) {
1118
1126
  function C() {
@@ -1280,20 +1288,32 @@ var SVGPathComponent = ({
1280
1288
  const badRatio = Math.abs(pathBounds.width / pathBounds.height - size.width / size.height) > 0.01;
1281
1289
  if (badRatio) {
1282
1290
  }
1283
- pathBounds.height = Math.max(pathBounds.height, 0.01);
1284
- pathBounds.width = Math.max(pathBounds.width, 0.01);
1291
+ const padding = {
1292
+ x: 0,
1293
+ y: 0
1294
+ };
1285
1295
  const absoluteCenter = applyToPoint(ct, center);
1286
- const actualAbsWidth = size.width * ct.a;
1287
- const actualAbsHeight = size.height * Math.abs(ct.d);
1288
- const absoluteSize = {
1289
- width: Math.max(1, actualAbsWidth),
1290
- height: Math.max(1, actualAbsHeight)
1296
+ const innerSize = {
1297
+ width: size.width * ct.a,
1298
+ height: size.height * Math.abs(ct.d)
1299
+ };
1300
+ const fullSize = {
1301
+ width: innerSize.width + padding.x * 2,
1302
+ height: innerSize.height + padding.y * 2
1291
1303
  };
1292
- console.log(absoluteSize, pathBounds);
1293
1304
  const [hovering, setHovering] = (0, import_react2.useState)(false);
1294
- const svgLeft = absoluteCenter.x - absoluteSize.width / 2;
1295
- const svgTop = absoluteCenter.y - absoluteSize.height / 2;
1296
- const viewBox = `${pathBounds.minX} ${pathBounds.minY} ${pathBounds.width} ${pathBounds.height}`;
1305
+ const svgLeft = absoluteCenter.x - fullSize.width / 2;
1306
+ const svgTop = absoluteCenter.y - fullSize.height / 2;
1307
+ const preferredRatio = pathBounds.width === 0 ? innerSize.height / pathBounds.height : innerSize.width / pathBounds.width;
1308
+ const svgToScreen = compose(
1309
+ // translate(0, 0)
1310
+ scale(
1311
+ pathBounds.width === 0 ? preferredRatio : fullSize.width / pathBounds.width,
1312
+ pathBounds.height === 0 ? preferredRatio : fullSize.height / pathBounds.height
1313
+ ),
1314
+ translate(-pathBounds.minX, -pathBounds.minY)
1315
+ // translate(center.x, center.y)
1316
+ );
1297
1317
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1298
1318
  hovering && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1299
1319
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -1301,11 +1321,11 @@ var SVGPathComponent = ({
1301
1321
  {
1302
1322
  style: {
1303
1323
  position: "absolute",
1304
- left: svgLeft - 4,
1305
- top: svgTop - 4,
1324
+ left: svgLeft - 6,
1325
+ top: svgTop - 6,
1306
1326
  pointerEvents: "none",
1307
- width: actualAbsWidth + 8,
1308
- height: actualAbsHeight + 8,
1327
+ width: fullSize.width + 12,
1328
+ height: fullSize.height + 12,
1309
1329
  border: "1px red solid",
1310
1330
  mixBlendMode: "difference",
1311
1331
  zIndex: 1e3
@@ -1317,7 +1337,7 @@ var SVGPathComponent = ({
1317
1337
  {
1318
1338
  style: {
1319
1339
  position: "absolute",
1320
- left: svgLeft + actualAbsWidth + 10,
1340
+ left: svgLeft + fullSize.width + 10,
1321
1341
  pointerEvents: "none",
1322
1342
  zIndex: 1e3,
1323
1343
  color: "red",
@@ -1348,18 +1368,20 @@ var SVGPathComponent = ({
1348
1368
  ].join(" "),
1349
1369
  left: svgLeft,
1350
1370
  top: svgTop
1351
- // backgroundColor: badRatio ? "rgba(255, 0, 0, 0.5)" : "transparent",
1371
+ // overflow: "hidden",
1372
+ // backgroundColor: badRatio ? "rgba(255, 0, 0, 0.1)" : "transparent",
1373
+ // backgroundColor: "rgba(255, 0, 0, 0.1)",
1352
1374
  },
1353
1375
  overflow: "visible",
1354
- width: absoluteSize.width,
1355
- height: absoluteSize.height,
1356
- viewBox,
1376
+ width: fullSize.width,
1377
+ height: fullSize.height,
1357
1378
  children: paths.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1358
1379
  "path",
1359
1380
  {
1381
+ transform: toSVG(svgToScreen),
1360
1382
  fill: p.fill ?? "none",
1361
1383
  strokeLinecap: "round",
1362
- strokeWidth: 2 * (p.strokeWidth || 1),
1384
+ strokeWidth: 1.5 * (p.strokeWidth || 1),
1363
1385
  stroke: p.stroke || "red",
1364
1386
  d: p.d
1365
1387
  },
@@ -1404,8 +1426,8 @@ var SimpleCapacitor = ({
1404
1426
  size: schematic.size,
1405
1427
  paths: [
1406
1428
  { stroke: "red", strokeWidth: 1, d: "M 0 15 l 12 0" },
1407
- { stroke: "red", strokeWidth: 2, d: "M 12 0 l 0 30" },
1408
- { stroke: "red", strokeWidth: 2, d: "M 18 0 l 0 30" },
1429
+ { stroke: "red", strokeWidth: 1, d: "M 12 0 l 0 30" },
1430
+ { stroke: "red", strokeWidth: 1, d: "M 18 0 l 0 30" },
1409
1431
  { stroke: "red", strokeWidth: 1, d: "M 18 15 l 12 0" }
1410
1432
  ]
1411
1433
  }
@@ -1430,7 +1452,7 @@ var directionToVec = (direction) => {
1430
1452
  else if (direction === "right")
1431
1453
  return { x: 1, y: 0 };
1432
1454
  else
1433
- throw new Error("Invalid direction");
1455
+ throw new Error(`Invalid direction "${direction}"`);
1434
1456
  };
1435
1457
 
1436
1458
  // src/schematic-components/SchematicPort.tsx
@@ -1439,6 +1461,7 @@ var SchematicPort = ({
1439
1461
  port: { source_port, source_component, schematic }
1440
1462
  }) => {
1441
1463
  const hoverName = source_component?.name ? `.${source_component.name} > .${source_port?.name ?? source_port?.pin_number}` : `.${source_port?.name ?? source_port?.pin_number}`;
1464
+ const vec = directionToVec(schematic.facing_direction);
1442
1465
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1443
1466
  SVGPathComponent,
1444
1467
  {
@@ -1449,7 +1472,10 @@ var SchematicPort = ({
1449
1472
  source_port?.pin_number && `Pin ${source_port.pin_number}`
1450
1473
  ] }),
1451
1474
  center: schematic.center,
1452
- size: { width: 0.2, height: 0.2 },
1475
+ size: {
1476
+ width: 0.2 + Math.abs(vec.x) * 0.04,
1477
+ height: 0.2 + Math.abs(vec.y) * 0.04
1478
+ },
1453
1479
  zIndex: 10,
1454
1480
  paths: [
1455
1481
  {
@@ -1460,7 +1486,7 @@ var SchematicPort = ({
1460
1486
  schematic.facing_direction ? {
1461
1487
  stroke: "blue",
1462
1488
  strokeWidth: 0.5,
1463
- d: `M 5 5 l ${directionToVec(schematic.facing_direction).x * 7} ${directionToVec(schematic.facing_direction).y * 7}`
1489
+ d: `M 5 5 l ${vec.x * 7} ${vec.y * 7}`
1464
1490
  } : null
1465
1491
  ].filter(Boolean)
1466
1492
  }
@@ -1677,12 +1703,60 @@ var RenderError_default = ({ text }) => {
1677
1703
  );
1678
1704
  };
1679
1705
 
1680
- // src/schematic-components/SchematicTrace.tsx
1706
+ // src/schematic-components/SVGPathComponent2.tsx
1681
1707
  var import_jsx_runtime8 = require("react/jsx-runtime");
1708
+ var SVGPathComponent2 = ({
1709
+ size,
1710
+ center,
1711
+ rotation,
1712
+ paths,
1713
+ zIndex,
1714
+ invertY,
1715
+ shiftToBottom,
1716
+ hoverContent
1717
+ }) => {
1718
+ const ct = useCameraTransform();
1719
+ const pathBounds = get_svg_path_bounds_default(paths.map((p) => p.d));
1720
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1721
+ "svg",
1722
+ {
1723
+ style: {
1724
+ position: "absolute",
1725
+ left: 0,
1726
+ top: 0,
1727
+ right: 0,
1728
+ bottom: 0,
1729
+ // backgroundColor: hovering ? "rgba(0, 0, 255, 0.5)" : "transparent",
1730
+ pointerEvents: "none",
1731
+ zIndex
1732
+ // overflow: "hidden",
1733
+ // backgroundColor: badRatio ? "rgba(255, 0, 0, 0.1)" : "transparent",
1734
+ // backgroundColor: "rgba(255, 0, 0, 0.1)",
1735
+ },
1736
+ overflow: "visible",
1737
+ children: paths.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1738
+ "path",
1739
+ {
1740
+ transform: toSVG(ct),
1741
+ fill: p.fill ?? "none",
1742
+ strokeLinecap: "round",
1743
+ strokeWidth: 1.5 * (p.strokeWidth || 1),
1744
+ stroke: p.stroke || "red",
1745
+ d: p.d
1746
+ },
1747
+ i
1748
+ ))
1749
+ }
1750
+ );
1751
+ };
1752
+ var SVGPathComponent2_default = SVGPathComponent2;
1753
+
1754
+ // src/schematic-components/SchematicTrace.tsx
1755
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1682
1756
  var SchematicTrace = ({ trace: { source, schematic } }) => {
1683
1757
  const edges = schematic.edges;
1684
1758
  if (edges.length === 0) {
1685
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RenderError_default, { text: `Route with 0 edges (${source.source_trace_id})` });
1759
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RenderError_default, { text: `Route with 0 edges (${source.source_trace_id})` });
1686
1760
  }
1687
1761
  const path = (0, import_svg_path_generator.default)();
1688
1762
  for (let i = 0; i < edges.length; i++) {
@@ -1697,8 +1771,8 @@ var SchematicTrace = ({ trace: { source, schematic } }) => {
1697
1771
  x: pathBounds.minX + pathBounds.width / 2,
1698
1772
  y: pathBounds.minY + pathBounds.height / 2
1699
1773
  };
1700
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1701
- SVGPathComponent_default,
1774
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1775
+ SVGPathComponent2_default,
1702
1776
  {
1703
1777
  rotation: 0,
1704
1778
  center,
@@ -1717,7 +1791,7 @@ var SchematicTrace_default = SchematicTrace;
1717
1791
 
1718
1792
  // src/schematic-components/SchematicBug.tsx
1719
1793
  var import_builder2 = require("@tscircuit/builder");
1720
- var import_jsx_runtime9 = require("react/jsx-runtime");
1794
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1721
1795
  var SchematicBug = ({ component: { source, schematic } }) => {
1722
1796
  const port_arrangement = {
1723
1797
  top_size: 0,
@@ -1754,7 +1828,7 @@ var SchematicBug = ({ component: { source, schematic } }) => {
1754
1828
  x: schematic.center.x + (actualSize.minX + actualSize.maxX) / 2,
1755
1829
  y: schematic.center.y + (actualSize.minY + actualSize.maxY) / 2
1756
1830
  };
1757
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1831
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1758
1832
  SVGPathComponent_default,
1759
1833
  {
1760
1834
  rotation: schematic.rotation,
@@ -1766,11 +1840,11 @@ var SchematicBug = ({ component: { source, schematic } }) => {
1766
1840
  };
1767
1841
 
1768
1842
  // src/schematic-components/SimplePowerSource.tsx
1769
- var import_jsx_runtime10 = require("react/jsx-runtime");
1843
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1770
1844
  var SimplePowerSource = ({
1771
1845
  component: { source, schematic }
1772
1846
  }) => {
1773
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1847
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1774
1848
  SVGPathComponent_default,
1775
1849
  {
1776
1850
  rotation: schematic.rotation,
@@ -1782,6 +1856,18 @@ var SimplePowerSource = ({
1782
1856
  stroke: "red",
1783
1857
  strokeWidth: 1,
1784
1858
  d: "M 0 -17 L 0 -3 M -8 3 L 8 3 M 0 17 L 0 3 M -12 -3 L 12 -3"
1859
+ },
1860
+ // positive symbol
1861
+ {
1862
+ stroke: "red",
1863
+ strokeWidth: 0.5,
1864
+ d: "M 8 -9 L 8 -6 M 9.5 -7.5 L 6.5 -7.5"
1865
+ },
1866
+ // negative symbol
1867
+ {
1868
+ stroke: "red",
1869
+ strokeWidth: 0.5,
1870
+ d: "M 9.5 7.5 L 6.5 7.5"
1785
1871
  }
1786
1872
  ]
1787
1873
  }
@@ -1789,9 +1875,9 @@ var SimplePowerSource = ({
1789
1875
  };
1790
1876
 
1791
1877
  // src/schematic-components/SimpleGround.tsx
1792
- var import_jsx_runtime11 = require("react/jsx-runtime");
1878
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1793
1879
  var SimpleGround = ({ component: { source, schematic } }) => {
1794
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1880
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1795
1881
  SVGPathComponent_default,
1796
1882
  {
1797
1883
  rotation: schematic.rotation,
@@ -1811,9 +1897,9 @@ var SimpleGround = ({ component: { source, schematic } }) => {
1811
1897
  };
1812
1898
 
1813
1899
  // src/schematic-components/SimpleInductor.tsx
1814
- var import_jsx_runtime12 = require("react/jsx-runtime");
1900
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1815
1901
  var SimpleInductor = ({ component: { source, schematic } }) => {
1816
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1902
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1817
1903
  SVGPathComponent_default,
1818
1904
  {
1819
1905
  rotation: schematic.rotation,
@@ -1832,38 +1918,38 @@ var SimpleInductor = ({ component: { source, schematic } }) => {
1832
1918
  };
1833
1919
 
1834
1920
  // src/schematic-components/SimpleDiode.tsx
1835
- var import_jsx_runtime13 = require("react/jsx-runtime");
1921
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1836
1922
 
1837
1923
  // src/schematic-components/SchematicComponent.tsx
1838
- var import_jsx_runtime14 = require("react/jsx-runtime");
1924
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1839
1925
  var SchematicComponent = ({ component }) => {
1840
1926
  const { source, schematic } = component;
1841
1927
  if (!source.ftype)
1842
1928
  return null;
1843
1929
  switch (source.ftype) {
1844
1930
  case "simple_resistor": {
1845
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SimpleResistor, { component: { source, schematic } });
1931
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SimpleResistor, { component: { source, schematic } });
1846
1932
  }
1847
1933
  case "simple_capacitor": {
1848
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SimpleCapacitor, { component: { source, schematic } });
1934
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SimpleCapacitor, { component: { source, schematic } });
1849
1935
  }
1850
1936
  case "simple_power_source": {
1851
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SimplePowerSource, { component: { source, schematic } });
1937
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SimplePowerSource, { component: { source, schematic } });
1852
1938
  }
1853
1939
  case "simple_ground": {
1854
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SimpleGround, { component: { source, schematic } });
1940
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SimpleGround, { component: { source, schematic } });
1855
1941
  }
1856
1942
  case "simple_inductor": {
1857
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SimpleInductor, { component: { source, schematic } });
1943
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SimpleInductor, { component: { source, schematic } });
1858
1944
  }
1859
1945
  case "simple_bug": {
1860
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SchematicBug, { component: { source, schematic } });
1946
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SchematicBug, { component: { source, schematic } });
1861
1947
  }
1862
1948
  case "simple_diode": {
1863
1949
  return null;
1864
1950
  }
1865
1951
  default: {
1866
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
1952
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
1867
1953
  "unknown ftype: ",
1868
1954
  component.source.ftype
1869
1955
  ] });
@@ -1873,10 +1959,10 @@ var SchematicComponent = ({ component }) => {
1873
1959
  var SchematicComponent_default = SchematicComponent;
1874
1960
 
1875
1961
  // src/schematic-components/SchematicBox.tsx
1876
- var import_jsx_runtime15 = require("react/jsx-runtime");
1962
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1877
1963
  var SchematicBox = ({ box: { schematic } }) => {
1878
1964
  const { width: w, height: h } = schematic;
1879
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1965
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1880
1966
  SVGPathComponent,
1881
1967
  {
1882
1968
  rotation: 0,
@@ -1896,7 +1982,7 @@ var SchematicBox_default = SchematicBox;
1896
1982
 
1897
1983
  // src/schematic-components/SchematicLine.tsx
1898
1984
  var import_svg_path_generator2 = __toESM(require_svg_path_generator2());
1899
- var import_jsx_runtime16 = require("react/jsx-runtime");
1985
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1900
1986
  var SchematicLine = ({ line: { schematic } }) => {
1901
1987
  const { x1, x2, y1, y2 } = schematic;
1902
1988
  const dx = x2 - x1;
@@ -1906,13 +1992,11 @@ var SchematicLine = ({ line: { schematic } }) => {
1906
1992
  path.lineTo(x2, y2);
1907
1993
  const d = path.toString();
1908
1994
  const pathBounds = get_svg_path_bounds_default(d);
1909
- pathBounds.height = Math.max(pathBounds.height, 1);
1910
- pathBounds.width = Math.max(pathBounds.width, 1);
1911
1995
  const center = {
1912
1996
  x: pathBounds.minX + pathBounds.width / 2,
1913
1997
  y: pathBounds.minY + pathBounds.height / 2
1914
1998
  };
1915
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1999
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1916
2000
  SVGPathComponent,
1917
2001
  {
1918
2002
  rotation: 0,
@@ -1932,7 +2016,7 @@ var SchematicLine_default = SchematicLine;
1932
2016
 
1933
2017
  // src/schematic-components/SchematicPath.tsx
1934
2018
  var import_svg_path_generator3 = __toESM(require_svg_path_generator2());
1935
- var import_jsx_runtime17 = require("react/jsx-runtime");
2019
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1936
2020
  var SchematicPath = (props) => {
1937
2021
  const { points, is_filled, is_closed, fill_color } = props.path.schematic;
1938
2022
  if (points.length === 0)
@@ -1953,7 +2037,7 @@ var SchematicPath = (props) => {
1953
2037
  x: pathBounds.minX + pathBounds.width / 2,
1954
2038
  y: pathBounds.minY + pathBounds.height / 2
1955
2039
  };
1956
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2040
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1957
2041
  SVGPathComponent,
1958
2042
  {
1959
2043
  rotation: 0,
@@ -1973,13 +2057,13 @@ var SchematicPath = (props) => {
1973
2057
  var SchematicPath_default = SchematicPath;
1974
2058
 
1975
2059
  // src/schematic-components/SchematicElement.tsx
1976
- var import_jsx_runtime18 = require("react/jsx-runtime");
2060
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1977
2061
  var SchematicElement = ({
1978
2062
  element,
1979
2063
  allElements
1980
2064
  }) => {
1981
2065
  if (element.type === "schematic_component") {
1982
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2066
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1983
2067
  SchematicComponent_default,
1984
2068
  {
1985
2069
  component: collectElementRefs(element, allElements)
@@ -1987,25 +2071,25 @@ var SchematicElement = ({
1987
2071
  );
1988
2072
  }
1989
2073
  if (element.type === "schematic_trace") {
1990
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicTrace_default, { trace: collectElementRefs(element, allElements) });
2074
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SchematicTrace_default, { trace: collectElementRefs(element, allElements) });
1991
2075
  }
1992
2076
  if (element.type === "schematic_port") {
1993
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicPort_default, { port: collectElementRefs(element, allElements) });
2077
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SchematicPort_default, { port: collectElementRefs(element, allElements) });
1994
2078
  }
1995
2079
  if (element.type === "schematic_box") {
1996
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicBox_default, { box: collectElementRefs(element, allElements) });
2080
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SchematicBox_default, { box: collectElementRefs(element, allElements) });
1997
2081
  }
1998
2082
  if (element.type === "schematic_line") {
1999
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicLine_default, { line: collectElementRefs(element, allElements) });
2083
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SchematicLine_default, { line: collectElementRefs(element, allElements) });
2000
2084
  }
2001
2085
  if (element.type === "schematic_path") {
2002
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicPath_default, { path: collectElementRefs(element, allElements) });
2086
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SchematicPath_default, { path: collectElementRefs(element, allElements) });
2003
2087
  }
2004
2088
  if (element.type === "schematic_text") {
2005
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicText_default, { schematic_text: element });
2089
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SchematicText_default, { schematic_text: element });
2006
2090
  }
2007
2091
  if (element.type === "source_error") {
2008
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RenderError_default, { text: element.message });
2092
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RenderError_default, { text: element.message });
2009
2093
  }
2010
2094
  return null;
2011
2095
  };
@@ -2016,19 +2100,19 @@ var import_react_error_boundary = require("react-error-boundary");
2016
2100
 
2017
2101
  // src/schematic-components/TableViewer.tsx
2018
2102
  var import_react5 = require("react");
2019
- var import_jsx_runtime19 = require("react/jsx-runtime");
2103
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2020
2104
  var LazyTableViewer = (0, import_react5.lazy)(
2021
2105
  () => import("@tscircuit/table-viewer").then((m) => ({
2022
2106
  default: m.SoupTableViewer
2023
2107
  }))
2024
2108
  );
2025
- var TableViewer = (params) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react5.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: "Loading..." }), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LazyTableViewer, { ...params }) });
2109
+ var TableViewer = (params) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react5.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: "Loading..." }), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LazyTableViewer, { ...params }) });
2026
2110
 
2027
2111
  // src/Schematic.tsx
2028
- var import_jsx_runtime20 = require("react/jsx-runtime");
2112
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2029
2113
  var ErrorBoundary = import_react_error_boundary.ErrorBoundary;
2030
2114
  var fallbackRender = (elm) => ({ error, resetErrorBoundary }) => {
2031
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { color: "red" }, children: [
2115
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { color: "red" }, children: [
2032
2116
  "error rendering ",
2033
2117
  elm.type,
2034
2118
  ": ",
@@ -2094,8 +2178,8 @@ var Schematic = ({
2094
2178
  throw e;
2095
2179
  });
2096
2180
  }, [children]);
2097
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
2098
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2181
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
2182
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
2099
2183
  "div",
2100
2184
  {
2101
2185
  style: {
@@ -2113,7 +2197,7 @@ var Schematic = ({
2113
2197
  boundsRef(el);
2114
2198
  },
2115
2199
  children: [
2116
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2200
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2117
2201
  import_react_supergrid.SuperGrid,
2118
2202
  {
2119
2203
  stringifyCoord: (x, y, z) => {
@@ -2126,7 +2210,7 @@ var Schematic = ({
2126
2210
  transform: cameraTransform
2127
2211
  }
2128
2212
  ),
2129
- elements?.map((elm, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorBoundary, { fallbackRender: fallbackRender(elm), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2213
+ elements?.map((elm, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorBoundary, { fallbackRender: fallbackRender(elm), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2130
2214
  SchematicElement,
2131
2215
  {
2132
2216
  element: elm,
@@ -2137,7 +2221,7 @@ var Schematic = ({
2137
2221
  ]
2138
2222
  }
2139
2223
  ),
2140
- showTable !== false && elements && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TableViewer, { elements })
2224
+ showTable !== false && elements && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TableViewer, { elements })
2141
2225
  ] });
2142
2226
  };
2143
2227
  // Annotate the CommonJS export names for ESM import in node: