@tscircuit/schematic-viewer 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/biome.json +45 -0
  2. package/dist/index.css +7 -0
  3. package/dist/index.css.map +1 -0
  4. package/dist/index.js +158 -106
  5. package/dist/index.js.map +1 -1
  6. package/package.json +6 -4
  7. package/src/Schematic.tsx +9 -6
  8. package/src/lib/render-context/index.ts +1 -1
  9. package/src/lib/types/source-component.ts +1 -1
  10. package/src/lib/utils/collect-element-refs.ts +4 -4
  11. package/src/lib/utils/colors.ts +215 -216
  12. package/src/lib/utils/direction-to-vec.ts +3 -3
  13. package/src/pages/style.css +5 -0
  14. package/src/schematic-components/SVGPathComponent.tsx +121 -63
  15. package/src/schematic-components/SchematicChip.tsx +128 -109
  16. package/src/schematic-components/SchematicComponent.tsx +17 -8
  17. package/src/schematic-components/SchematicComponentFromSymbol.tsx +3 -1
  18. package/src/schematic-components/SchematicNetLabel.tsx +3 -0
  19. package/src/schematic-components/SchematicText.tsx +4 -6
  20. package/src/schematic-components/SchematicTrace.tsx +5 -6
  21. package/src/schematic-components/TableViewer.tsx +1 -1
  22. package/src/schematic-components/index.tsx +0 -1
  23. package/src/stories/basics/schematic-net-label.stories.tsx +2 -0
  24. package/src/stories/bug-connections.stories.tsx +18 -16
  25. package/src/stories/bug-high-port-numbers.stories.tsx +22 -9
  26. package/src/stories/bug-one-sided.stories.tsx +17 -15
  27. package/src/stories/bug-pin-spacing.stories.tsx +19 -17
  28. package/src/stories/bugs/bug1-y-flip.stories.tsx +7 -5
  29. package/src/stories/bugs/bug5-diode.stories.tsx +3 -1
  30. package/src/stories/bugs/bug6-trace-scaling.stories.tsx +5 -41
  31. package/src/stories/led-circuit-react.stories.tsx +3 -8
  32. package/src/stories/rotated-resistor.stories.tsx +10 -8
  33. package/src/stories/three-sided-bug.stories.tsx +17 -15
package/biome.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
3
+ "organizeImports": {
4
+ "enabled": true
5
+ },
6
+ "formatter": {
7
+ "enabled": true,
8
+ "indentStyle": "space"
9
+ },
10
+ "files": {
11
+ "ignore": ["cosmos-export", "dist", "package.json"]
12
+ },
13
+ "javascript": {
14
+ "formatter": {
15
+ "jsxQuoteStyle": "double",
16
+ "quoteProperties": "asNeeded",
17
+ "trailingCommas": "all",
18
+ "semicolons": "asNeeded",
19
+ "arrowParentheses": "always",
20
+ "bracketSpacing": true,
21
+ "bracketSameLine": false
22
+ }
23
+ },
24
+ "linter": {
25
+ "enabled": true,
26
+ "rules": {
27
+ "recommended": true,
28
+ "suspicious": {
29
+ "noExplicitAny": "off"
30
+ },
31
+ "style": {
32
+ "noNonNullAssertion": "off",
33
+ "useNumberNamespace": "off",
34
+ "useFilenamingConvention": {
35
+ "level": "error",
36
+ "options": {
37
+ "strictCase": true,
38
+ "requireAscii": true,
39
+ "filenameCases": ["kebab-case", "export"]
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
package/dist/index.css ADDED
@@ -0,0 +1,7 @@
1
+ @import "https://fonts.googleapis.com/css2?family=IBM+Plex+Mono&display=swap";
2
+
3
+ /* src/pages/style.css */
4
+ .schematic-text {
5
+ font-family: "IBM Plex Mono", monospace;
6
+ }
7
+ /*# sourceMappingURL=index.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/pages/style.css"],"sourcesContent":["@import url(\"https://fonts.googleapis.com/css2?family=IBM+Plex+Mono&display=swap\");\n\n.schematic-text {\n font-family: \"IBM Plex Mono\", monospace;\n}\n"],"mappings":";;;AAEA;AACE;AAAA;","names":[]}
package/dist/index.js CHANGED
@@ -89,8 +89,8 @@ var require_use_sync_external_store_shim_development = __commonJS({
89
89
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
90
90
  __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
91
91
  }
92
- var React2 = require("react");
93
- var ReactSharedInternals = React2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
92
+ var React = require("react");
93
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
94
94
  function error(format) {
95
95
  {
96
96
  {
@@ -120,13 +120,13 @@ var require_use_sync_external_store_shim_development = __commonJS({
120
120
  return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
121
121
  }
122
122
  var objectIs = typeof Object.is === "function" ? Object.is : is;
123
- var useState4 = React2.useState, useEffect3 = React2.useEffect, useLayoutEffect = React2.useLayoutEffect, useDebugValue2 = React2.useDebugValue;
123
+ var useState4 = React.useState, useEffect3 = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue2 = React.useDebugValue;
124
124
  var didWarnOld18Alpha = false;
125
125
  var didWarnUncachedGetSnapshot = false;
126
126
  function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
127
127
  {
128
128
  if (!didWarnOld18Alpha) {
129
- if (React2.startTransition !== void 0) {
129
+ if (React.startTransition !== void 0) {
130
130
  didWarnOld18Alpha = true;
131
131
  error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release.");
132
132
  }
@@ -191,7 +191,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
191
191
  var canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
192
192
  var isServerEnvironment = !canUseDOM;
193
193
  var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
194
- var useSyncExternalStore$2 = React2.useSyncExternalStore !== void 0 ? React2.useSyncExternalStore : shim;
194
+ var useSyncExternalStore$2 = React.useSyncExternalStore !== void 0 ? React.useSyncExternalStore : shim;
195
195
  exports.useSyncExternalStore = useSyncExternalStore$2;
196
196
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
197
197
  __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
@@ -285,14 +285,14 @@ var require_with_selector_development = __commonJS({
285
285
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
286
286
  __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
287
287
  }
288
- var React2 = require("react");
288
+ var React = require("react");
289
289
  var shim = require_shim();
290
290
  function is(x, y) {
291
291
  return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
292
292
  }
293
293
  var objectIs = typeof Object.is === "function" ? Object.is : is;
294
294
  var useSyncExternalStore = shim.useSyncExternalStore;
295
- var useRef3 = React2.useRef, useEffect3 = React2.useEffect, useMemo3 = React2.useMemo, useDebugValue2 = React2.useDebugValue;
295
+ var useRef3 = React.useRef, useEffect3 = React.useEffect, useMemo3 = React.useMemo, useDebugValue2 = React.useDebugValue;
296
296
  function useSyncExternalStoreWithSelector2(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
297
297
  var instRef = useRef3(null);
298
298
  var inst;
@@ -1537,7 +1537,9 @@ var SVGPathComponent = ({
1537
1537
  hoverContent
1538
1538
  }) => {
1539
1539
  const ct = useGlobalStore((s) => s.camera_transform);
1540
- const pathBounds = get_svg_path_bounds_default(paths.filter((p) => p.type !== "circle").map((p) => p.d));
1540
+ const pathBounds = get_svg_path_bounds_default(
1541
+ paths.filter((p) => p.type !== "circle" && p.type !== "text").map((p) => p.d)
1542
+ );
1541
1543
  const padding = { x: 0, y: 0 };
1542
1544
  const absoluteCenter = applyToPoint(ct, center);
1543
1545
  const innerSize = {
@@ -1559,52 +1561,85 @@ var SVGPathComponent = ({
1559
1561
  ),
1560
1562
  translate(-pathBounds.minX, -pathBounds.minY)
1561
1563
  );
1562
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1563
- "svg",
1564
- {
1565
- onMouseOver: () => setHovering(Boolean(hoverContent)),
1566
- onMouseOut: () => setHovering(false),
1567
- style: {
1568
- position: "absolute",
1569
- cursor: hovering ? "pointer" : void 0,
1570
- zIndex,
1571
- transform: [
1572
- invertY ? "scale(1, 1)" : "scale(1, -1)",
1573
- shiftToBottom ? "translate(0, 100%)" : "",
1574
- rotation === 0 ? "" : `rotate(${rotation}deg)`
1575
- ].join(" "),
1576
- left: svgLeft,
1577
- top: svgTop
1578
- },
1579
- overflow: "visible",
1580
- width: fullSize.width,
1581
- height: fullSize.height,
1582
- children: paths.map(
1583
- (p, i) => p.type === "circle" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1584
- "circle",
1585
- {
1586
- cx: p.cx,
1587
- cy: p.cy,
1588
- r: p.r,
1589
- fill: p.fill ?? "none",
1590
- strokeWidth: 1.5 * (p.strokeWidth || 1),
1591
- stroke: p.stroke || "red"
1592
- },
1593
- i
1594
- ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1595
- "path",
1596
- {
1597
- transform: toSVG(svgToScreen),
1598
- fill: p.fill ?? "none",
1599
- strokeLinecap: "round",
1600
- strokeWidth: 1.5 * (p.strokeWidth || 1),
1601
- stroke: p.stroke || "red",
1602
- d: p.d || ""
1603
- },
1604
- i
1605
- )
1606
- )
1607
- }
1564
+ const baseFontSize = 0.15;
1565
+ return (
1566
+ // biome-ignore lint/a11y/noSvgWithoutTitle: <explanation>
1567
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1568
+ "svg",
1569
+ {
1570
+ onMouseOver: () => setHovering(Boolean(hoverContent)),
1571
+ onFocus: () => setHovering(Boolean(hoverContent)),
1572
+ onMouseOut: () => setHovering(false),
1573
+ onBlur: () => setHovering(false),
1574
+ style: {
1575
+ position: "absolute",
1576
+ cursor: hovering ? "pointer" : void 0,
1577
+ zIndex,
1578
+ transform: [
1579
+ invertY ? "scale(1, 1)" : "scale(1, -1)",
1580
+ shiftToBottom ? "translate(0, 100%)" : "",
1581
+ rotation === 0 ? "" : `rotate(${rotation}deg)`
1582
+ ].join(" "),
1583
+ left: svgLeft,
1584
+ top: svgTop
1585
+ },
1586
+ overflow: "visible",
1587
+ width: fullSize.width,
1588
+ height: fullSize.height,
1589
+ children: paths.map((p, i) => {
1590
+ if (p.type === "circle") {
1591
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1592
+ "circle",
1593
+ {
1594
+ transform: toSVG(compose(scale(1, 1), svgToScreen)),
1595
+ cx: p.cx,
1596
+ cy: p.cy,
1597
+ r: p.r,
1598
+ fill: "none",
1599
+ strokeWidth: 2.25 * (p.strokeWidth || 1),
1600
+ stroke: p.stroke || "red"
1601
+ },
1602
+ `${p.type}-${i}`
1603
+ );
1604
+ }
1605
+ if (p.type === "text") {
1606
+ const transformedPos = applyToPoint(svgToScreen, { x: p.cx, y: p.cy });
1607
+ const scaleFactor = fullSize.width / pathBounds.width || 1;
1608
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1609
+ "text",
1610
+ {
1611
+ className: "schematic-text",
1612
+ x: transformedPos.x,
1613
+ y: transformedPos.y,
1614
+ fill: p.fill,
1615
+ fontSize: baseFontSize * scaleFactor,
1616
+ textAnchor: p.anchor || "middle",
1617
+ dominantBaseline: "middle",
1618
+ transform: `scale(1,-1) rotate(${p.rotation || 0})`,
1619
+ style: {
1620
+ transformBox: "fill-box",
1621
+ transformOrigin: "center"
1622
+ },
1623
+ stroke: p.stroke,
1624
+ children: p.text
1625
+ }
1626
+ ) }, `${p.type}-${i}`);
1627
+ }
1628
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1629
+ "path",
1630
+ {
1631
+ transform: toSVG(svgToScreen),
1632
+ fill: p.fill ?? "none",
1633
+ strokeLinecap: "round",
1634
+ strokeWidth: 1.5 * (p.strokeWidth || 1),
1635
+ stroke: p.stroke || "red",
1636
+ d: p.d || ""
1637
+ },
1638
+ `${p.type}-${i}`
1639
+ );
1640
+ })
1641
+ }
1642
+ )
1608
1643
  );
1609
1644
  };
1610
1645
  var SVGPathComponent_default = SVGPathComponent;
@@ -1785,7 +1820,8 @@ var SchematicText = ({ schematic_text }) => {
1785
1820
  position: "absolute",
1786
1821
  fontSize: projectedTextSize,
1787
1822
  left: tPos.x + offset[0],
1788
- top: tPos.y + offset[1]
1823
+ top: tPos.y + offset[1],
1824
+ color: schematic_text.color
1789
1825
  },
1790
1826
  children: text
1791
1827
  }
@@ -1795,7 +1831,9 @@ var SchematicText_default = SchematicText;
1795
1831
 
1796
1832
  // src/schematic-components/SchematicChip.tsx
1797
1833
  var import_jsx_runtime5 = require("react/jsx-runtime");
1798
- var SchematicChip = ({ component: { source, schematic, allElements } }) => {
1834
+ var SchematicChip = ({
1835
+ component: { source, schematic, allElements }
1836
+ }) => {
1799
1837
  const { center, size, rotation, schematic_component_id } = schematic;
1800
1838
  const { manufacturerPartNumber, name } = source;
1801
1839
  const chipWidth = size.width;
@@ -1811,32 +1849,39 @@ var SchematicChip = ({ component: { source, schematic, allElements } }) => {
1811
1849
  const schematicPorts = allElements.filter(
1812
1850
  (item) => item.type === "schematic_port" && item.schematic_component_id === schematic_component_id
1813
1851
  );
1814
- const portLength = 0.2;
1815
- const circleRadius = 0.05;
1852
+ const portLength = 0.5;
1853
+ const circleRadius = 0.04;
1816
1854
  const labelOffset = 0.1;
1817
- const pinLabels = [];
1818
- schematicPorts.forEach((port) => {
1855
+ for (const port of schematicPorts) {
1819
1856
  const { side, pinNumber, distanceFromEdge } = port.center;
1820
- let x = 0, y = 0, endX = 0, endY = 0;
1821
- let labelX = 0, labelY = 0;
1857
+ let x = 0;
1858
+ let y = 0;
1859
+ let endX = 0;
1860
+ let endY = 0;
1861
+ let pinX = 0;
1862
+ let pinY = 0;
1822
1863
  let textAnchor = "middle";
1864
+ let rotation2 = 0;
1865
+ if (side === "center") {
1866
+ continue;
1867
+ }
1823
1868
  switch (side) {
1824
1869
  case "left":
1825
1870
  x = -chipWidth / 2;
1826
1871
  y = -chipHeight / 2 + distanceFromEdge;
1827
1872
  endX = x - portLength;
1828
1873
  endY = y;
1829
- labelX = endX;
1830
- labelY = y + labelOffset;
1831
- textAnchor = "end";
1874
+ pinX = x - portLength / 2;
1875
+ pinY = y + labelOffset;
1876
+ textAnchor = "middle";
1832
1877
  break;
1833
1878
  case "right":
1834
1879
  x = chipWidth / 2;
1835
1880
  y = chipHeight / 2 - distanceFromEdge;
1836
1881
  endX = x + portLength;
1837
1882
  endY = y;
1838
- labelX = endX - labelOffset;
1839
- labelY = y + labelOffset;
1883
+ pinX = x + portLength / 2 - labelOffset;
1884
+ pinY = y + labelOffset;
1840
1885
  textAnchor = "start";
1841
1886
  break;
1842
1887
  case "bottom":
@@ -1844,21 +1889,23 @@ var SchematicChip = ({ component: { source, schematic, allElements } }) => {
1844
1889
  y = -chipHeight / 2;
1845
1890
  endX = x;
1846
1891
  endY = y - portLength;
1847
- labelX = x;
1848
- labelY = endY + labelOffset;
1892
+ pinX = x - labelOffset;
1893
+ pinY = y - portLength / 2;
1894
+ rotation2 = -90;
1849
1895
  break;
1850
1896
  case "top":
1851
1897
  x = chipWidth / 2 - distanceFromEdge;
1852
1898
  y = chipHeight / 2;
1853
1899
  endX = x;
1854
1900
  endY = y + portLength;
1855
- labelX = x;
1856
- labelY = endY + labelOffset;
1901
+ pinX = x - labelOffset;
1902
+ pinY = y + portLength / 2;
1903
+ rotation2 = -90;
1857
1904
  break;
1858
1905
  }
1859
1906
  paths.push({
1860
1907
  type: "path",
1861
- strokeWidth: 0.02,
1908
+ strokeWidth: 0.015,
1862
1909
  stroke: colorMap.schematic.component_outline,
1863
1910
  d: `M ${x},${y} L ${endX},${endY}`
1864
1911
  });
@@ -1867,19 +1914,23 @@ var SchematicChip = ({ component: { source, schematic, allElements } }) => {
1867
1914
  cx: endX,
1868
1915
  cy: endY,
1869
1916
  r: circleRadius,
1870
- strokeWidth: 0.01,
1917
+ strokeWidth: 5e-3,
1871
1918
  stroke: colorMap.schematic.component_outline,
1872
1919
  fill: colorMap.schematic.component_outline
1873
1920
  });
1874
1921
  if (pinNumber !== void 0) {
1875
- pinLabels.push({
1876
- x: labelX,
1877
- y: labelY,
1922
+ paths.push({
1923
+ type: "text",
1924
+ cx: pinX,
1925
+ cy: pinY,
1878
1926
  text: `${pinNumber}`,
1879
- anchor: textAnchor
1927
+ anchor: textAnchor,
1928
+ rotation: rotation2,
1929
+ strokeWidth: 5e-3,
1930
+ stroke: colorMap.schematic.pin_number
1880
1931
  });
1881
1932
  }
1882
- });
1933
+ }
1883
1934
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1884
1935
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1885
1936
  SVGPathComponent_default,
@@ -1890,28 +1941,12 @@ var SchematicChip = ({ component: { source, schematic, allElements } }) => {
1890
1941
  paths
1891
1942
  }
1892
1943
  ),
1893
- pinLabels.map((label, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1894
- SchematicText_default,
1895
- {
1896
- schematic_text: {
1897
- anchor: label.anchor,
1898
- position: {
1899
- x: center.x + label.x,
1900
- y: center.y + label.y
1901
- },
1902
- schematic_component_id: "SYNTHETIC",
1903
- schematic_text_id: `PIN_LABEL_${index}`,
1904
- text: label.text,
1905
- type: "schematic_text"
1906
- }
1907
- },
1908
- index
1909
- )),
1910
1944
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1911
1945
  SchematicText_default,
1912
1946
  {
1913
1947
  schematic_text: {
1914
- anchor: "center",
1948
+ anchor: "right",
1949
+ rotation: 0,
1915
1950
  position: {
1916
1951
  x: center.x,
1917
1952
  y: center.y - chipHeight / 2 - 0.2
@@ -1919,7 +1954,8 @@ var SchematicChip = ({ component: { source, schematic, allElements } }) => {
1919
1954
  schematic_component_id: "SYNTHETIC",
1920
1955
  schematic_text_id: "SYNTHETIC_MPN",
1921
1956
  text: manufacturerPartNumber,
1922
- type: "schematic_text"
1957
+ type: "schematic_text",
1958
+ color: colorMap.schematic.reference
1923
1959
  }
1924
1960
  }
1925
1961
  ),
@@ -1927,7 +1963,8 @@ var SchematicChip = ({ component: { source, schematic, allElements } }) => {
1927
1963
  SchematicText_default,
1928
1964
  {
1929
1965
  schematic_text: {
1930
- anchor: "center",
1966
+ anchor: "right",
1967
+ rotation: 0,
1931
1968
  position: {
1932
1969
  x: center.x,
1933
1970
  y: center.y + chipHeight / 2 + 0.2
@@ -1935,7 +1972,8 @@ var SchematicChip = ({ component: { source, schematic, allElements } }) => {
1935
1972
  schematic_component_id: "SYNTHETIC",
1936
1973
  schematic_text_id: "SYNTHETIC_NAME",
1937
1974
  text: name,
1938
- type: "schematic_text"
1975
+ type: "schematic_text",
1976
+ color: colorMap.schematic.reference
1939
1977
  }
1940
1978
  }
1941
1979
  )
@@ -1955,11 +1993,21 @@ var SchematicComponent = ({ component }) => {
1955
1993
  case "simple_ground":
1956
1994
  case "simple_inductor":
1957
1995
  case "simple_diode": {
1958
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SchematicComponentFromSymbol, { component: { source, schematic } });
1996
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1997
+ SchematicComponentFromSymbol,
1998
+ {
1999
+ component: { source, schematic }
2000
+ }
2001
+ );
1959
2002
  }
1960
2003
  case "simple_chip":
1961
2004
  case "simple_bug": {
1962
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SchematicChip, { component: { source, schematic, allElements } });
2005
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2006
+ SchematicChip,
2007
+ {
2008
+ component: { source, schematic, allElements }
2009
+ }
2010
+ );
1963
2011
  }
1964
2012
  default: {
1965
2013
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
@@ -1974,7 +2022,9 @@ var SchematicComponent_default = SchematicComponent;
1974
2022
  // src/schematic-components/SchematicComponentFromSymbol.tsx
1975
2023
  var import_schematic_symbols = require("schematic-symbols");
1976
2024
  var import_jsx_runtime7 = require("react/jsx-runtime");
1977
- var SchematicComponentFromSymbol = ({ component: { source, schematic } }) => {
2025
+ var SchematicComponentFromSymbol = ({
2026
+ component: { source, schematic }
2027
+ }) => {
1978
2028
  const { center, rotation } = schematic;
1979
2029
  const symbol = import_schematic_symbols.symbols[schematic.symbol_name];
1980
2030
  const paths = symbol.primitives.filter((p) => p.type === "path").map((p) => ({
@@ -2151,6 +2201,7 @@ var SchematicNetLabel = ({
2151
2201
  SchematicText_default,
2152
2202
  {
2153
2203
  schematic_text: {
2204
+ rotation: is_vertical ? 0 : getRotationFromAnchorSide(anchor_side),
2154
2205
  anchor: is_vertical ? "center" : anchor_side,
2155
2206
  position: {
2156
2207
  x: net_label.center.x + anchor_vec.x,
@@ -2159,7 +2210,8 @@ var SchematicNetLabel = ({
2159
2210
  schematic_component_id: "SYNTHETIC",
2160
2211
  schematic_text_id: "SYNTHETIC",
2161
2212
  text: net_label.text,
2162
- type: "schematic_text"
2213
+ type: "schematic_text",
2214
+ color: colorMap.schematic.net_name
2163
2215
  }
2164
2216
  }
2165
2217
  )
@@ -2279,7 +2331,7 @@ var SchematicWithoutContext = ({
2279
2331
  );
2280
2332
  updateTransform(newTransform);
2281
2333
  }
2282
- }, [elements, bounds.width, bounds.height, updateTransform]);
2334
+ }, [elements, updateTransform]);
2283
2335
  const handleMouseDown = (0, import_react8.useCallback)((e) => {
2284
2336
  isDraggingRef.current = true;
2285
2337
  lastMousePosRef.current = { x: e.clientX, y: e.clientY };
@@ -2307,7 +2359,7 @@ var SchematicWithoutContext = ({
2307
2359
  const handleWheel = (0, import_react8.useCallback)(
2308
2360
  (e) => {
2309
2361
  e.preventDefault();
2310
- const scaleMultiplier = Math.pow(0.999, e.deltaY);
2362
+ const scaleMultiplier = 0.999 ** e.deltaY;
2311
2363
  if (containerRef.current) {
2312
2364
  const rect = containerRef.current.getBoundingClientRect();
2313
2365
  const mouseX = e.clientX - rect.left;
@@ -2386,7 +2438,7 @@ var SchematicWithoutContext = ({
2386
2438
  allElements: elements
2387
2439
  },
2388
2440
  JSON.stringify(elm)
2389
- ) }, i))
2441
+ ) }, `${elm}`))
2390
2442
  ]
2391
2443
  }
2392
2444
  ),