@tscircuit/schematic-viewer 0.0.7 → 0.0.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.js CHANGED
@@ -1295,6 +1295,9 @@ var collectElementRefs = (elm, allElms) => {
1295
1295
  return null;
1296
1296
  };
1297
1297
 
1298
+ // src/schematic-components/MovableGrid/index.tsx
1299
+ var import_jsx_runtime = require("react/jsx-runtime");
1300
+
1298
1301
  // node_modules/zustand/esm/vanilla.mjs
1299
1302
  var createStoreImpl = (createState) => {
1300
1303
  let state;
@@ -1583,6 +1586,7 @@ function getSVGPathBounds(ds) {
1583
1586
  var get_svg_path_bounds_default = getSVGPathBounds;
1584
1587
 
1585
1588
  // src/schematic-components/SVGPathComponent.tsx
1589
+ var import_jsx_runtime2 = require("react/jsx-runtime");
1586
1590
  var SVGPathComponent = ({ size, center, rotation, paths }) => {
1587
1591
  const ct = useCameraTransform();
1588
1592
  const pathBounds = get_svg_path_bounds_default(paths.map((p) => p.d));
@@ -1599,36 +1603,60 @@ var SVGPathComponent = ({ size, center, rotation, paths }) => {
1599
1603
  width: Math.max(1, size.width * ct.a),
1600
1604
  height: Math.max(1, size.height * ct.d)
1601
1605
  };
1602
- return <svg style={{
1603
- position: "absolute",
1604
- transform: rotation === 0 ? "" : `rotate(${rotation}rad)`,
1605
- left: absoluteCenter.x - absoluteSize.width / 2,
1606
- top: absoluteCenter.y - absoluteSize.height / 2
1607
- }} overflow="visible" width={absoluteSize.width} height={absoluteSize.height} viewBox={`${pathBounds.minX} ${pathBounds.minY} ${pathBounds.width} ${pathBounds.height}`}>{paths.map((p, i) => <path key={i} fill="none" strokeWidth={2 * (p.strokeWidth || 1)} stroke={p.stroke || "red"} d={p.d} />)}</svg>;
1606
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", {
1607
+ style: {
1608
+ position: "absolute",
1609
+ transform: rotation === 0 ? "" : `rotate(${rotation}rad)`,
1610
+ left: absoluteCenter.x - absoluteSize.width / 2,
1611
+ top: absoluteCenter.y - absoluteSize.height / 2
1612
+ },
1613
+ overflow: "visible",
1614
+ width: absoluteSize.width,
1615
+ height: absoluteSize.height,
1616
+ viewBox: `${pathBounds.minX} ${pathBounds.minY} ${pathBounds.width} ${pathBounds.height}`,
1617
+ children: paths.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", {
1618
+ fill: "none",
1619
+ strokeWidth: 2 * (p.strokeWidth || 1),
1620
+ stroke: p.stroke || "red",
1621
+ d: p.d
1622
+ }, i))
1623
+ });
1608
1624
  };
1609
1625
  var SVGPathComponent_default = SVGPathComponent;
1610
1626
 
1611
1627
  // src/schematic-components/SimpleResistor.tsx
1628
+ var import_jsx_runtime3 = require("react/jsx-runtime");
1612
1629
  var SimpleResistor = ({ component: { source, schematic } }) => {
1613
- return <SVGPathComponent_default rotation={schematic.rotation} center={schematic.center} size={schematic.size} paths={[
1614
- {
1615
- stroke: "red",
1616
- strokeWidth: 1,
1617
- d: "M 0 15 l 10 0 l 0 -6 l 20 0 l 0 12 l -20 0 l 0 -6 m 20 0 l 10 0"
1618
- }
1619
- ]} />;
1630
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SVGPathComponent_default, {
1631
+ rotation: schematic.rotation,
1632
+ center: schematic.center,
1633
+ size: schematic.size,
1634
+ paths: [
1635
+ {
1636
+ stroke: "red",
1637
+ strokeWidth: 1,
1638
+ d: "M 0 15 l 10 0 l 0 -6 l 20 0 l 0 12 l -20 0 l 0 -6 m 20 0 l 10 0"
1639
+ }
1640
+ ]
1641
+ });
1620
1642
  };
1621
1643
 
1622
1644
  // src/schematic-components/SimpleCapacitor.tsx
1645
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1623
1646
  var SimpleCapacitor = ({
1624
1647
  component: { source, schematic }
1625
1648
  }) => {
1626
- return <SVGPathComponent_default rotation={schematic.rotation} center={schematic.center} size={schematic.size} paths={[
1627
- { stroke: "red", strokeWidth: 1, d: "M 0 15 l 12 0" },
1628
- { stroke: "red", strokeWidth: 2, d: "M 12 0 l 0 30" },
1629
- { stroke: "red", strokeWidth: 2, d: "M 18 0 l 0 30" },
1630
- { stroke: "red", strokeWidth: 1, d: "M 18 15 l 12 0" }
1631
- ]} />;
1649
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SVGPathComponent_default, {
1650
+ rotation: schematic.rotation,
1651
+ center: schematic.center,
1652
+ size: schematic.size,
1653
+ paths: [
1654
+ { stroke: "red", strokeWidth: 1, d: "M 0 15 l 12 0" },
1655
+ { stroke: "red", strokeWidth: 2, d: "M 12 0 l 0 30" },
1656
+ { stroke: "red", strokeWidth: 2, d: "M 18 0 l 0 30" },
1657
+ { stroke: "red", strokeWidth: 1, d: "M 18 15 l 12 0" }
1658
+ ]
1659
+ });
1632
1660
  };
1633
1661
 
1634
1662
  // src/lib/hooks/use-maybe-promise.ts
@@ -1636,6 +1664,7 @@ var import_react2 = require("react");
1636
1664
 
1637
1665
  // src/schematic-components/ProjectComponent.tsx
1638
1666
  var import_builder = require("@tscircuit/builder");
1667
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1639
1668
 
1640
1669
  // src/lib/utils/direction-to-vec.ts
1641
1670
  var directionToVec = (direction) => {
@@ -1652,19 +1681,25 @@ var directionToVec = (direction) => {
1652
1681
  };
1653
1682
 
1654
1683
  // src/schematic-components/SchematicPort.tsx
1684
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1655
1685
  var SchematicPort = ({ port: { source, schematic } }) => {
1656
- return <SVGPathComponent rotation={0} center={schematic.center} size={{ width: 0.2, height: 0.2 }} paths={[
1657
- {
1658
- stroke: "blue",
1659
- strokeWidth: 1,
1660
- d: "M 0 0 l 10 0 l 0 10 l -10 0 z"
1661
- },
1662
- schematic.facing_direction ? {
1663
- stroke: "blue",
1664
- strokeWidth: 0.5,
1665
- d: `M 5 5 l ${directionToVec(schematic.facing_direction).x * 7} ${directionToVec(schematic.facing_direction).y * 7}`
1666
- } : null
1667
- ].filter(Boolean)} />;
1686
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SVGPathComponent, {
1687
+ rotation: 0,
1688
+ center: schematic.center,
1689
+ size: { width: 0.2, height: 0.2 },
1690
+ paths: [
1691
+ {
1692
+ stroke: "blue",
1693
+ strokeWidth: 1,
1694
+ d: "M 0 0 l 10 0 l 0 10 l -10 0 z"
1695
+ },
1696
+ schematic.facing_direction ? {
1697
+ stroke: "blue",
1698
+ strokeWidth: 0.5,
1699
+ d: `M 5 5 l ${directionToVec(schematic.facing_direction).x * 7} ${directionToVec(schematic.facing_direction).y * 7}`
1700
+ } : null
1701
+ ].filter(Boolean)
1702
+ });
1668
1703
  };
1669
1704
  var SchematicPort_default = SchematicPort;
1670
1705
 
@@ -1819,6 +1854,7 @@ var keys = ["x", "y", "top", "bottom", "left", "right", "width", "height"];
1819
1854
  var areBoundsEqual = (a, b) => keys.every((key) => a[key] === b[key]);
1820
1855
 
1821
1856
  // src/schematic-components/SchematicText.tsx
1857
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1822
1858
  var SchematicText = ({ schematic_text }) => {
1823
1859
  const ct = useCameraTransform();
1824
1860
  const { text, position, anchor } = schematic_text;
@@ -1832,12 +1868,16 @@ var SchematicText = ({ schematic_text }) => {
1832
1868
  } else if (anchor === "right") {
1833
1869
  offset = [-bounds.width, -bounds.height / 2];
1834
1870
  }
1835
- return <div ref={boundsRef} style={{
1836
- fontFamily: "'IBM Plex Mono', monospace",
1837
- position: "absolute",
1838
- left: tPos.x + offset[0],
1839
- top: tPos.y + offset[1]
1840
- }}>{text}</div>;
1871
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", {
1872
+ ref: boundsRef,
1873
+ style: {
1874
+ fontFamily: "'IBM Plex Mono', monospace",
1875
+ position: "absolute",
1876
+ left: tPos.x + offset[0],
1877
+ top: tPos.y + offset[1]
1878
+ },
1879
+ children: text
1880
+ });
1841
1881
  };
1842
1882
  var SchematicText_default = SchematicText;
1843
1883
 
@@ -1845,25 +1885,32 @@ var SchematicText_default = SchematicText;
1845
1885
  var import_svg_path_generator = __toESM(require_svg_path_generator2());
1846
1886
 
1847
1887
  // src/schematic-components/RenderError.tsx
1888
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1848
1889
  var RenderError_default = ({ text }) => {
1849
- return <div style={{
1850
- position: "fixed",
1851
- backgroundColor: "red",
1852
- color: "white",
1853
- fontSize: 14,
1854
- fontFamily: "sans-serif",
1855
- padding: 5,
1856
- right: 0,
1857
- top: 0,
1858
- opacity: 0.75
1859
- }}>{text}</div>;
1890
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", {
1891
+ style: {
1892
+ position: "fixed",
1893
+ backgroundColor: "red",
1894
+ color: "white",
1895
+ fontSize: 14,
1896
+ fontFamily: "sans-serif",
1897
+ padding: 5,
1898
+ right: 0,
1899
+ top: 0,
1900
+ opacity: 0.75
1901
+ },
1902
+ children: text
1903
+ });
1860
1904
  };
1861
1905
 
1862
1906
  // src/schematic-components/SchematicTrace.tsx
1907
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1863
1908
  var SchematicTrace = ({ trace: { source, schematic } }) => {
1864
1909
  const edges = schematic.edges;
1865
1910
  if (edges.length === 0) {
1866
- return <RenderError_default text="Route with 0 edges" />;
1911
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RenderError_default, {
1912
+ text: "Route with 0 edges"
1913
+ });
1867
1914
  }
1868
1915
  const path = (0, import_svg_path_generator.default)();
1869
1916
  for (let i = 0; i < edges.length; i++) {
@@ -1878,18 +1925,24 @@ var SchematicTrace = ({ trace: { source, schematic } }) => {
1878
1925
  x: pathBounds.minX + pathBounds.width / 2,
1879
1926
  y: pathBounds.minY + pathBounds.height / 2
1880
1927
  };
1881
- return <SVGPathComponent_default rotation={0} center={center} size={pathBounds} paths={[
1882
- {
1883
- stroke: "green",
1884
- strokeWidth: 0.02,
1885
- d
1886
- }
1887
- ]} />;
1928
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SVGPathComponent_default, {
1929
+ rotation: 0,
1930
+ center,
1931
+ size: pathBounds,
1932
+ paths: [
1933
+ {
1934
+ stroke: "green",
1935
+ strokeWidth: 0.02,
1936
+ d
1937
+ }
1938
+ ]
1939
+ });
1888
1940
  };
1889
1941
  var SchematicTrace_default = SchematicTrace;
1890
1942
 
1891
1943
  // src/schematic-components/SchematicBug.tsx
1892
1944
  var import_range = __toESM(require_range());
1945
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1893
1946
  var SchematicBug = ({ component: { source, schematic } }) => {
1894
1947
  const ports_arrangement = schematic.port_arrangement;
1895
1948
  const port_labels = schematic.port_labels;
@@ -1897,126 +1950,181 @@ var SchematicBug = ({ component: { source, schematic } }) => {
1897
1950
  const rh = 15;
1898
1951
  const pd = 7.5;
1899
1952
  const bugh = Math.max(ports_arrangement.left_size, ports_arrangement.right_size) * rh;
1900
- return <SVGPathComponent_default rotation={schematic.rotation} center={schematic.center} size={schematic.size} paths={[
1901
- {
1902
- stroke: "red",
1903
- strokeWidth: 1,
1904
- d: `M 0 0 L ${bugw} 0 L ${bugw} ${bugh} L 0 ${bugh}Z`
1905
- },
1906
- ...(0, import_range.default)(
1907
- 0,
1908
- ports_arrangement.left_size + ports_arrangement.right_size
1909
- ).map((i) => {
1910
- const ls = ports_arrangement.left_size;
1911
- const left = i < ls;
1912
- const rowi = i % ls;
1913
- const p1 = [left ? 0 : bugw, rh / 2 + rowi * rh];
1914
- const rd = [left ? -pd : pd, 0];
1915
- return {
1953
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SVGPathComponent_default, {
1954
+ rotation: schematic.rotation,
1955
+ center: schematic.center,
1956
+ size: schematic.size,
1957
+ paths: [
1958
+ {
1916
1959
  stroke: "red",
1917
1960
  strokeWidth: 1,
1918
- d: `M ${p1.join(" ")} l ${rd.join(" ")}`
1919
- };
1920
- })
1921
- ]} />;
1961
+ d: `M 0 0 L ${bugw} 0 L ${bugw} ${bugh} L 0 ${bugh}Z`
1962
+ },
1963
+ ...(0, import_range.default)(
1964
+ 0,
1965
+ ports_arrangement.left_size + ports_arrangement.right_size
1966
+ ).map((i) => {
1967
+ const ls = ports_arrangement.left_size;
1968
+ const left = i < ls;
1969
+ const rowi = i % ls;
1970
+ const p1 = [left ? 0 : bugw, rh / 2 + rowi * rh];
1971
+ const rd = [left ? -pd : pd, 0];
1972
+ return {
1973
+ stroke: "red",
1974
+ strokeWidth: 1,
1975
+ d: `M ${p1.join(" ")} l ${rd.join(" ")}`
1976
+ };
1977
+ })
1978
+ ]
1979
+ });
1922
1980
  };
1923
1981
 
1924
1982
  // src/schematic-components/SimplePowerSource.tsx
1983
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1925
1984
  var SimplePowerSource = ({
1926
1985
  component: { source, schematic }
1927
1986
  }) => {
1928
- return <SVGPathComponent_default rotation={schematic.rotation} center={schematic.center} size={schematic.size} paths={[
1929
- {
1930
- stroke: "red",
1931
- strokeWidth: 1,
1932
- 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"
1933
- }
1934
- ]} />;
1987
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SVGPathComponent_default, {
1988
+ rotation: schematic.rotation,
1989
+ center: schematic.center,
1990
+ size: schematic.size,
1991
+ paths: [
1992
+ {
1993
+ stroke: "red",
1994
+ strokeWidth: 1,
1995
+ 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"
1996
+ }
1997
+ ]
1998
+ });
1935
1999
  };
1936
2000
 
1937
2001
  // src/schematic-components/SimpleGround.tsx
2002
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1938
2003
  var SimpleGround = ({ component: { source, schematic } }) => {
1939
- return <SVGPathComponent_default rotation={schematic.rotation} center={schematic.center} size={schematic.size} paths={[
1940
- {
1941
- stroke: "red",
1942
- strokeWidth: 0.7,
1943
- d: "M -3 3 L 3 3 M -6 0 L 6 0 M -9 -3 L 9 -3 M 0 -3 L 0 -12"
1944
- }
1945
- ]} />;
2004
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SVGPathComponent_default, {
2005
+ rotation: schematic.rotation,
2006
+ center: schematic.center,
2007
+ size: schematic.size,
2008
+ paths: [
2009
+ {
2010
+ stroke: "red",
2011
+ strokeWidth: 0.7,
2012
+ d: "M -3 3 L 3 3 M -6 0 L 6 0 M -9 -3 L 9 -3 M 0 -3 L 0 -12"
2013
+ }
2014
+ ]
2015
+ });
1946
2016
  };
1947
2017
 
1948
2018
  // src/schematic-components/SimpleInductor.tsx
2019
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1949
2020
  var SimpleInductor = ({ component: { source, schematic } }) => {
1950
- return <SVGPathComponent_default rotation={schematic.rotation} center={schematic.center} size={schematic.size} paths={[
1951
- {
1952
- stroke: "red",
1953
- strokeWidth: 1,
1954
- d: "m 371,710.41665 h -14 c -0.0421,-16.39898 -14.02104,-16.39898 -14,0 -0.021,-16.399 -14.04182,-16.34072 -14,0 -2.6e-4,-16.45722 -14.04236,-16.45722 -14,0 2.8e-4,-16.3407 -13.97896,-16.39898 -14,0 -0.0421,-16.39898 -13.91338,-16.39898 -13.91338,0 H 273"
1955
- }
1956
- ]} />;
2021
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SVGPathComponent_default, {
2022
+ rotation: schematic.rotation,
2023
+ center: schematic.center,
2024
+ size: schematic.size,
2025
+ paths: [
2026
+ {
2027
+ stroke: "red",
2028
+ strokeWidth: 1,
2029
+ d: "m 371,710.41665 h -14 c -0.0421,-16.39898 -14.02104,-16.39898 -14,0 -0.021,-16.399 -14.04182,-16.34072 -14,0 -2.6e-4,-16.45722 -14.04236,-16.45722 -14,0 2.8e-4,-16.3407 -13.97896,-16.39898 -14,0 -0.0421,-16.39898 -13.91338,-16.39898 -13.91338,0 H 273"
2030
+ }
2031
+ ]
2032
+ });
1957
2033
  };
1958
2034
 
1959
2035
  // src/schematic-components/SimpleDiode.tsx
2036
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1960
2037
  var SimpleDiode = ({ component: { source, schematic } }) => {
1961
- return <SVGPathComponent_default rotation={schematic.rotation} center={schematic.center} size={schematic.size} paths={[
1962
- { stroke: "red", strokeWidth: 2, d: "M 0,0 H 21" },
1963
- { stroke: "red", strokeWidth: 2, d: "M 49,0 H 59" },
1964
- { stroke: "red", strokeWidth: 2, d: "M 49,0 L 21 14 V -14 Z" },
1965
- { stroke: "red", strokeWidth: 2, d: "M 49,-14 V 14" }
1966
- ]} />;
2038
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SVGPathComponent_default, {
2039
+ rotation: schematic.rotation,
2040
+ center: schematic.center,
2041
+ size: schematic.size,
2042
+ paths: [
2043
+ { stroke: "red", strokeWidth: 2, d: "M 0,0 H 21" },
2044
+ { stroke: "red", strokeWidth: 2, d: "M 49,0 H 59" },
2045
+ { stroke: "red", strokeWidth: 2, d: "M 49,0 L 21 14 V -14 Z" },
2046
+ { stroke: "red", strokeWidth: 2, d: "M 49,-14 V 14" }
2047
+ ]
2048
+ });
1967
2049
  };
1968
2050
 
1969
2051
  // src/schematic-components/SchematicComponent.tsx
2052
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1970
2053
  var SchematicComponent = ({ component }) => {
1971
2054
  const { source, schematic } = component;
1972
2055
  switch (source.ftype) {
1973
2056
  case "simple_resistor": {
1974
- return <SimpleResistor component={{ source, schematic }} />;
2057
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SimpleResistor, {
2058
+ component: { source, schematic }
2059
+ });
1975
2060
  }
1976
2061
  case "simple_capacitor": {
1977
- return <SimpleCapacitor component={{ source, schematic }} />;
2062
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SimpleCapacitor, {
2063
+ component: { source, schematic }
2064
+ });
1978
2065
  }
1979
2066
  case "simple_power_source": {
1980
- return <SimplePowerSource component={{ source, schematic }} />;
2067
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SimplePowerSource, {
2068
+ component: { source, schematic }
2069
+ });
1981
2070
  }
1982
2071
  case "simple_ground": {
1983
- return <SimpleGround component={{ source, schematic }} />;
2072
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SimpleGround, {
2073
+ component: { source, schematic }
2074
+ });
1984
2075
  }
1985
2076
  case "simple_inductor": {
1986
- return <SimpleInductor component={{ source, schematic }} />;
2077
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SimpleInductor, {
2078
+ component: { source, schematic }
2079
+ });
1987
2080
  }
1988
2081
  case "simple_bug": {
1989
- return <SchematicBug component={{ source, schematic }} />;
2082
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SchematicBug, {
2083
+ component: { source, schematic }
2084
+ });
1990
2085
  }
1991
2086
  case "simple_diode": {
1992
- return <SimpleDiode component={{ source, schematic }} />;
2087
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SimpleDiode, {
2088
+ component: { source, schematic }
2089
+ });
1993
2090
  }
1994
2091
  default: {
1995
- return <div>
1996
- {"unknown ftype: "}
1997
- {component.source.ftype}
1998
- </div>;
2092
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", {
2093
+ children: [
2094
+ "unknown ftype: ",
2095
+ component.source.ftype
2096
+ ]
2097
+ });
1999
2098
  }
2000
2099
  }
2001
2100
  };
2002
2101
  var SchematicComponent_default = SchematicComponent;
2003
2102
 
2004
2103
  // src/schematic-components/SchematicElement.tsx
2104
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2005
2105
  var SchematicElement = ({
2006
2106
  element,
2007
2107
  allElements
2008
2108
  }) => {
2009
2109
  if (element.type === "schematic_component") {
2010
- return <SchematicComponent_default component={collectElementRefs(element, allElements)} />;
2110
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SchematicComponent_default, {
2111
+ component: collectElementRefs(element, allElements)
2112
+ });
2011
2113
  }
2012
2114
  if (element.type === "schematic_trace") {
2013
- return <SchematicTrace_default trace={collectElementRefs(element, allElements)} />;
2115
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SchematicTrace_default, {
2116
+ trace: collectElementRefs(element, allElements)
2117
+ });
2014
2118
  }
2015
2119
  if (element.type === "schematic_port") {
2016
- return <SchematicPort_default port={collectElementRefs(element, allElements)} />;
2120
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SchematicPort_default, {
2121
+ port: collectElementRefs(element, allElements)
2122
+ });
2017
2123
  }
2018
2124
  if (element.type === "schematic_text") {
2019
- return <SchematicText_default schematic_text={element} />;
2125
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SchematicText_default, {
2126
+ schematic_text: element
2127
+ });
2020
2128
  }
2021
2129
  return null;
2022
2130
  };
@@ -2024,13 +2132,17 @@ var SchematicElement = ({
2024
2132
  // src/Schematic.tsx
2025
2133
  var import_use_mouse_matrix_transform = require("use-mouse-matrix-transform");
2026
2134
  var import_react_error_boundary = require("react-error-boundary");
2135
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2027
2136
  var fallbackRender = (elm) => ({ error, resetErrorBoundary }) => {
2028
- return <div style={{ color: "red" }}>
2029
- {"error rendering "}
2030
- {elm.type}
2031
- {": "}
2032
- {error.toString()}
2033
- </div>;
2137
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", {
2138
+ style: { color: "red" },
2139
+ children: [
2140
+ "error rendering ",
2141
+ elm.type,
2142
+ ": ",
2143
+ error.toString()
2144
+ ]
2145
+ });
2034
2146
  };
2035
2147
  var Schematic = ({
2036
2148
  children,
@@ -2059,7 +2171,16 @@ var Schematic = ({
2059
2171
  }, [children]);
2060
2172
  if (elements.length === 0)
2061
2173
  return null;
2062
- return <div ref={ref}>{elements.map((elm) => <import_react_error_boundary.ErrorBoundary fallbackRender={fallbackRender(elm)}><SchematicElement element={elm} allElements={elements} key={JSON.stringify(elm)} /></import_react_error_boundary.ErrorBoundary>)}</div>;
2174
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", {
2175
+ ref,
2176
+ children: elements.map((elm) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_error_boundary.ErrorBoundary, {
2177
+ fallbackRender: fallbackRender(elm),
2178
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SchematicElement, {
2179
+ element: elm,
2180
+ allElements: elements
2181
+ }, JSON.stringify(elm))
2182
+ }))
2183
+ });
2063
2184
  };
2064
2185
  // Annotate the CommonJS export names for ESM import in node:
2065
2186
  0 && (module.exports = {