@tscircuit/schematic-viewer 1.2.7 → 1.2.9

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.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  declare const Schematic: ({ children, elements: initialElements, soup: initialSoup, style, showTable, }: {
2
2
  children?: any;
3
- /** @deprecated */
3
+ /** @deprecated use soup */
4
4
  elements?: any;
5
5
  soup?: any;
6
6
  style?: any;
package/dist/index.js CHANGED
@@ -1288,22 +1288,28 @@ var SVGPathComponent = ({
1288
1288
  const badRatio = Math.abs(pathBounds.width / pathBounds.height - size.width / size.height) > 0.01;
1289
1289
  if (badRatio) {
1290
1290
  }
1291
+ const padding = {
1292
+ x: 0,
1293
+ y: 0
1294
+ };
1291
1295
  const absoluteCenter = applyToPoint(ct, center);
1292
- const actualAbsWidth = size.width * ct.a;
1293
- const actualAbsHeight = size.height * Math.abs(ct.d);
1294
- const absoluteSize = {
1295
- width: Math.max(1, actualAbsWidth),
1296
- 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
1297
1303
  };
1298
1304
  const [hovering, setHovering] = (0, import_react2.useState)(false);
1299
- const svgLeft = absoluteCenter.x - absoluteSize.width / 2;
1300
- const svgTop = absoluteCenter.y - absoluteSize.height / 2;
1301
- 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;
1302
1308
  const svgToScreen = compose(
1303
1309
  // translate(0, 0)
1304
1310
  scale(
1305
- actualAbsWidth / pathBounds.width,
1306
- actualAbsHeight / pathBounds.height
1311
+ pathBounds.width === 0 ? preferredRatio : fullSize.width / pathBounds.width,
1312
+ pathBounds.height === 0 ? preferredRatio : fullSize.height / pathBounds.height
1307
1313
  ),
1308
1314
  translate(-pathBounds.minX, -pathBounds.minY)
1309
1315
  // translate(center.x, center.y)
@@ -1318,8 +1324,8 @@ var SVGPathComponent = ({
1318
1324
  left: svgLeft - 6,
1319
1325
  top: svgTop - 6,
1320
1326
  pointerEvents: "none",
1321
- width: actualAbsWidth + 12,
1322
- height: actualAbsHeight + 12,
1327
+ width: fullSize.width + 12,
1328
+ height: fullSize.height + 12,
1323
1329
  border: "1px red solid",
1324
1330
  mixBlendMode: "difference",
1325
1331
  zIndex: 1e3
@@ -1331,7 +1337,7 @@ var SVGPathComponent = ({
1331
1337
  {
1332
1338
  style: {
1333
1339
  position: "absolute",
1334
- left: svgLeft + actualAbsWidth + 10,
1340
+ left: svgLeft + fullSize.width + 10,
1335
1341
  pointerEvents: "none",
1336
1342
  zIndex: 1e3,
1337
1343
  color: "red",
@@ -1367,8 +1373,8 @@ var SVGPathComponent = ({
1367
1373
  // backgroundColor: "rgba(255, 0, 0, 0.1)",
1368
1374
  },
1369
1375
  overflow: "visible",
1370
- width: absoluteSize.width,
1371
- height: absoluteSize.height,
1376
+ width: fullSize.width,
1377
+ height: fullSize.height,
1372
1378
  children: paths.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1373
1379
  "path",
1374
1380
  {
@@ -1446,7 +1452,7 @@ var directionToVec = (direction) => {
1446
1452
  else if (direction === "right")
1447
1453
  return { x: 1, y: 0 };
1448
1454
  else
1449
- throw new Error("Invalid direction");
1455
+ throw new Error(`Invalid direction "${direction}"`);
1450
1456
  };
1451
1457
 
1452
1458
  // src/schematic-components/SchematicPort.tsx
@@ -1697,12 +1703,60 @@ var RenderError_default = ({ text }) => {
1697
1703
  );
1698
1704
  };
1699
1705
 
1700
- // src/schematic-components/SchematicTrace.tsx
1706
+ // src/schematic-components/SVGPathComponent2.tsx
1701
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");
1702
1756
  var SchematicTrace = ({ trace: { source, schematic } }) => {
1703
1757
  const edges = schematic.edges;
1704
1758
  if (edges.length === 0) {
1705
- 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})` });
1706
1760
  }
1707
1761
  const path = (0, import_svg_path_generator.default)();
1708
1762
  for (let i = 0; i < edges.length; i++) {
@@ -1717,8 +1771,8 @@ var SchematicTrace = ({ trace: { source, schematic } }) => {
1717
1771
  x: pathBounds.minX + pathBounds.width / 2,
1718
1772
  y: pathBounds.minY + pathBounds.height / 2
1719
1773
  };
1720
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1721
- SVGPathComponent_default,
1774
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1775
+ SVGPathComponent2_default,
1722
1776
  {
1723
1777
  rotation: 0,
1724
1778
  center,
@@ -1737,7 +1791,7 @@ var SchematicTrace_default = SchematicTrace;
1737
1791
 
1738
1792
  // src/schematic-components/SchematicBug.tsx
1739
1793
  var import_builder2 = require("@tscircuit/builder");
1740
- var import_jsx_runtime9 = require("react/jsx-runtime");
1794
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1741
1795
  var SchematicBug = ({ component: { source, schematic } }) => {
1742
1796
  const port_arrangement = {
1743
1797
  top_size: 0,
@@ -1774,7 +1828,7 @@ var SchematicBug = ({ component: { source, schematic } }) => {
1774
1828
  x: schematic.center.x + (actualSize.minX + actualSize.maxX) / 2,
1775
1829
  y: schematic.center.y + (actualSize.minY + actualSize.maxY) / 2
1776
1830
  };
1777
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1831
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1778
1832
  SVGPathComponent_default,
1779
1833
  {
1780
1834
  rotation: schematic.rotation,
@@ -1786,11 +1840,11 @@ var SchematicBug = ({ component: { source, schematic } }) => {
1786
1840
  };
1787
1841
 
1788
1842
  // src/schematic-components/SimplePowerSource.tsx
1789
- var import_jsx_runtime10 = require("react/jsx-runtime");
1843
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1790
1844
  var SimplePowerSource = ({
1791
1845
  component: { source, schematic }
1792
1846
  }) => {
1793
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1847
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1794
1848
  SVGPathComponent_default,
1795
1849
  {
1796
1850
  rotation: schematic.rotation,
@@ -1802,6 +1856,18 @@ var SimplePowerSource = ({
1802
1856
  stroke: "red",
1803
1857
  strokeWidth: 1,
1804
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"
1805
1871
  }
1806
1872
  ]
1807
1873
  }
@@ -1809,9 +1875,9 @@ var SimplePowerSource = ({
1809
1875
  };
1810
1876
 
1811
1877
  // src/schematic-components/SimpleGround.tsx
1812
- var import_jsx_runtime11 = require("react/jsx-runtime");
1878
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1813
1879
  var SimpleGround = ({ component: { source, schematic } }) => {
1814
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1880
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1815
1881
  SVGPathComponent_default,
1816
1882
  {
1817
1883
  rotation: schematic.rotation,
@@ -1831,9 +1897,9 @@ var SimpleGround = ({ component: { source, schematic } }) => {
1831
1897
  };
1832
1898
 
1833
1899
  // src/schematic-components/SimpleInductor.tsx
1834
- var import_jsx_runtime12 = require("react/jsx-runtime");
1900
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1835
1901
  var SimpleInductor = ({ component: { source, schematic } }) => {
1836
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1902
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1837
1903
  SVGPathComponent_default,
1838
1904
  {
1839
1905
  rotation: schematic.rotation,
@@ -1852,38 +1918,38 @@ var SimpleInductor = ({ component: { source, schematic } }) => {
1852
1918
  };
1853
1919
 
1854
1920
  // src/schematic-components/SimpleDiode.tsx
1855
- var import_jsx_runtime13 = require("react/jsx-runtime");
1921
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1856
1922
 
1857
1923
  // src/schematic-components/SchematicComponent.tsx
1858
- var import_jsx_runtime14 = require("react/jsx-runtime");
1924
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1859
1925
  var SchematicComponent = ({ component }) => {
1860
1926
  const { source, schematic } = component;
1861
1927
  if (!source.ftype)
1862
1928
  return null;
1863
1929
  switch (source.ftype) {
1864
1930
  case "simple_resistor": {
1865
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SimpleResistor, { component: { source, schematic } });
1931
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SimpleResistor, { component: { source, schematic } });
1866
1932
  }
1867
1933
  case "simple_capacitor": {
1868
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SimpleCapacitor, { component: { source, schematic } });
1934
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SimpleCapacitor, { component: { source, schematic } });
1869
1935
  }
1870
1936
  case "simple_power_source": {
1871
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SimplePowerSource, { component: { source, schematic } });
1937
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SimplePowerSource, { component: { source, schematic } });
1872
1938
  }
1873
1939
  case "simple_ground": {
1874
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SimpleGround, { component: { source, schematic } });
1940
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SimpleGround, { component: { source, schematic } });
1875
1941
  }
1876
1942
  case "simple_inductor": {
1877
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SimpleInductor, { component: { source, schematic } });
1943
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SimpleInductor, { component: { source, schematic } });
1878
1944
  }
1879
1945
  case "simple_bug": {
1880
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SchematicBug, { component: { source, schematic } });
1946
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SchematicBug, { component: { source, schematic } });
1881
1947
  }
1882
1948
  case "simple_diode": {
1883
1949
  return null;
1884
1950
  }
1885
1951
  default: {
1886
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
1952
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
1887
1953
  "unknown ftype: ",
1888
1954
  component.source.ftype
1889
1955
  ] });
@@ -1893,10 +1959,10 @@ var SchematicComponent = ({ component }) => {
1893
1959
  var SchematicComponent_default = SchematicComponent;
1894
1960
 
1895
1961
  // src/schematic-components/SchematicBox.tsx
1896
- var import_jsx_runtime15 = require("react/jsx-runtime");
1962
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1897
1963
  var SchematicBox = ({ box: { schematic } }) => {
1898
1964
  const { width: w, height: h } = schematic;
1899
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1965
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1900
1966
  SVGPathComponent,
1901
1967
  {
1902
1968
  rotation: 0,
@@ -1916,7 +1982,7 @@ var SchematicBox_default = SchematicBox;
1916
1982
 
1917
1983
  // src/schematic-components/SchematicLine.tsx
1918
1984
  var import_svg_path_generator2 = __toESM(require_svg_path_generator2());
1919
- var import_jsx_runtime16 = require("react/jsx-runtime");
1985
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1920
1986
  var SchematicLine = ({ line: { schematic } }) => {
1921
1987
  const { x1, x2, y1, y2 } = schematic;
1922
1988
  const dx = x2 - x1;
@@ -1926,13 +1992,11 @@ var SchematicLine = ({ line: { schematic } }) => {
1926
1992
  path.lineTo(x2, y2);
1927
1993
  const d = path.toString();
1928
1994
  const pathBounds = get_svg_path_bounds_default(d);
1929
- pathBounds.height = Math.max(pathBounds.height, 1);
1930
- pathBounds.width = Math.max(pathBounds.width, 1);
1931
1995
  const center = {
1932
1996
  x: pathBounds.minX + pathBounds.width / 2,
1933
1997
  y: pathBounds.minY + pathBounds.height / 2
1934
1998
  };
1935
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1999
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1936
2000
  SVGPathComponent,
1937
2001
  {
1938
2002
  rotation: 0,
@@ -1952,7 +2016,7 @@ var SchematicLine_default = SchematicLine;
1952
2016
 
1953
2017
  // src/schematic-components/SchematicPath.tsx
1954
2018
  var import_svg_path_generator3 = __toESM(require_svg_path_generator2());
1955
- var import_jsx_runtime17 = require("react/jsx-runtime");
2019
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1956
2020
  var SchematicPath = (props) => {
1957
2021
  const { points, is_filled, is_closed, fill_color } = props.path.schematic;
1958
2022
  if (points.length === 0)
@@ -1973,7 +2037,7 @@ var SchematicPath = (props) => {
1973
2037
  x: pathBounds.minX + pathBounds.width / 2,
1974
2038
  y: pathBounds.minY + pathBounds.height / 2
1975
2039
  };
1976
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2040
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1977
2041
  SVGPathComponent,
1978
2042
  {
1979
2043
  rotation: 0,
@@ -1992,14 +2056,60 @@ var SchematicPath = (props) => {
1992
2056
  };
1993
2057
  var SchematicPath_default = SchematicPath;
1994
2058
 
2059
+ // src/schematic-components/SchematicNetLabel.tsx
2060
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2061
+ var SchematicNetLabel = ({
2062
+ net_label
2063
+ }) => {
2064
+ console.log({ net_label });
2065
+ const text_width = net_label.text.length * 0.15;
2066
+ const path_width = 31 + net_label.text.length * 5;
2067
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
2068
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2069
+ SVGPathComponent_default,
2070
+ {
2071
+ rotation: 0,
2072
+ center: net_label.center,
2073
+ size: {
2074
+ width: 0.05 + text_width,
2075
+ height: 0.175
2076
+ },
2077
+ paths: [
2078
+ {
2079
+ stroke: "gray",
2080
+ strokeWidth: 0.75,
2081
+ d: `M 0 15 L 5 15 L 11 9 L ${path_width} 9 L ${path_width} 21 L 11 21 L 5 15`
2082
+ }
2083
+ ]
2084
+ }
2085
+ ),
2086
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2087
+ SchematicText_default,
2088
+ {
2089
+ schematic_text: {
2090
+ anchor: "left",
2091
+ position: {
2092
+ x: net_label.center.x - text_width / 4 + 0.025,
2093
+ y: net_label.center.y
2094
+ },
2095
+ schematic_component_id: "SYNTHETIC",
2096
+ schematic_text_id: "SYNTHETIC",
2097
+ text: net_label.text,
2098
+ type: "schematic_text"
2099
+ }
2100
+ }
2101
+ )
2102
+ ] });
2103
+ };
2104
+
1995
2105
  // src/schematic-components/SchematicElement.tsx
1996
- var import_jsx_runtime18 = require("react/jsx-runtime");
2106
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1997
2107
  var SchematicElement = ({
1998
2108
  element,
1999
2109
  allElements
2000
2110
  }) => {
2001
2111
  if (element.type === "schematic_component") {
2002
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2112
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2003
2113
  SchematicComponent_default,
2004
2114
  {
2005
2115
  component: collectElementRefs(element, allElements)
@@ -2007,25 +2117,28 @@ var SchematicElement = ({
2007
2117
  );
2008
2118
  }
2009
2119
  if (element.type === "schematic_trace") {
2010
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicTrace_default, { trace: collectElementRefs(element, allElements) });
2120
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SchematicTrace_default, { trace: collectElementRefs(element, allElements) });
2011
2121
  }
2012
2122
  if (element.type === "schematic_port") {
2013
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicPort_default, { port: collectElementRefs(element, allElements) });
2123
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SchematicPort_default, { port: collectElementRefs(element, allElements) });
2014
2124
  }
2015
2125
  if (element.type === "schematic_box") {
2016
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicBox_default, { box: collectElementRefs(element, allElements) });
2126
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SchematicBox_default, { box: collectElementRefs(element, allElements) });
2017
2127
  }
2018
2128
  if (element.type === "schematic_line") {
2019
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicLine_default, { line: collectElementRefs(element, allElements) });
2129
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SchematicLine_default, { line: collectElementRefs(element, allElements) });
2020
2130
  }
2021
2131
  if (element.type === "schematic_path") {
2022
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicPath_default, { path: collectElementRefs(element, allElements) });
2132
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SchematicPath_default, { path: collectElementRefs(element, allElements) });
2023
2133
  }
2024
2134
  if (element.type === "schematic_text") {
2025
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SchematicText_default, { schematic_text: element });
2135
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SchematicText_default, { schematic_text: element });
2136
+ }
2137
+ if (element.type === "schematic_net_label") {
2138
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SchematicNetLabel, { net_label: element });
2026
2139
  }
2027
2140
  if (element.type === "source_error") {
2028
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RenderError_default, { text: element.message });
2141
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RenderError_default, { text: element.message });
2029
2142
  }
2030
2143
  return null;
2031
2144
  };
@@ -2036,19 +2149,19 @@ var import_react_error_boundary = require("react-error-boundary");
2036
2149
 
2037
2150
  // src/schematic-components/TableViewer.tsx
2038
2151
  var import_react5 = require("react");
2039
- var import_jsx_runtime19 = require("react/jsx-runtime");
2152
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2040
2153
  var LazyTableViewer = (0, import_react5.lazy)(
2041
2154
  () => import("@tscircuit/table-viewer").then((m) => ({
2042
2155
  default: m.SoupTableViewer
2043
2156
  }))
2044
2157
  );
2045
- 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 }) });
2158
+ var TableViewer = (params) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react5.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { children: "Loading..." }), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(LazyTableViewer, { ...params }) });
2046
2159
 
2047
2160
  // src/Schematic.tsx
2048
- var import_jsx_runtime20 = require("react/jsx-runtime");
2161
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2049
2162
  var ErrorBoundary = import_react_error_boundary.ErrorBoundary;
2050
2163
  var fallbackRender = (elm) => ({ error, resetErrorBoundary }) => {
2051
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { color: "red" }, children: [
2164
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { color: "red" }, children: [
2052
2165
  "error rendering ",
2053
2166
  elm.type,
2054
2167
  ": ",
@@ -2114,8 +2227,8 @@ var Schematic = ({
2114
2227
  throw e;
2115
2228
  });
2116
2229
  }, [children]);
2117
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
2118
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
2230
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
2231
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2119
2232
  "div",
2120
2233
  {
2121
2234
  style: {
@@ -2133,7 +2246,7 @@ var Schematic = ({
2133
2246
  boundsRef(el);
2134
2247
  },
2135
2248
  children: [
2136
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2249
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2137
2250
  import_react_supergrid.SuperGrid,
2138
2251
  {
2139
2252
  stringifyCoord: (x, y, z) => {
@@ -2146,7 +2259,7 @@ var Schematic = ({
2146
2259
  transform: cameraTransform
2147
2260
  }
2148
2261
  ),
2149
- elements?.map((elm, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ErrorBoundary, { fallbackRender: fallbackRender(elm), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2262
+ elements?.map((elm, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ErrorBoundary, { fallbackRender: fallbackRender(elm), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2150
2263
  SchematicElement,
2151
2264
  {
2152
2265
  element: elm,
@@ -2157,7 +2270,7 @@ var Schematic = ({
2157
2270
  ]
2158
2271
  }
2159
2272
  ),
2160
- showTable !== false && elements && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TableViewer, { elements })
2273
+ showTable !== false && elements && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TableViewer, { elements })
2161
2274
  ] });
2162
2275
  };
2163
2276
  // Annotate the CommonJS export names for ESM import in node: