circuit-to-svg 0.0.100 → 0.0.102

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
@@ -1,7 +1,7 @@
1
1
  // lib/pcb/convert-circuit-json-to-pcb-svg.ts
2
2
  import { stringify } from "svgson";
3
3
  import {
4
- applyToPoint as applyToPoint12,
4
+ applyToPoint as applyToPoint13,
5
5
  compose as compose3,
6
6
  scale,
7
7
  translate as translate3
@@ -647,6 +647,118 @@ function createSvgObjectsFromPcbHole(hole, transform) {
647
647
  return [];
648
648
  }
649
649
 
650
+ // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-rats-nests.ts
651
+ import {
652
+ getFullConnectivityMapFromCircuitJson
653
+ } from "circuit-json-to-connectivity-map";
654
+ import "svgson";
655
+ import { applyToPoint as applyToPoint12 } from "transformation-matrix";
656
+
657
+ // lib/pcb/create-svg-objects-from-pcb-rats-nest/get-element-position.ts
658
+ import { su } from "@tscircuit/soup-util";
659
+ var getElementPosition = (id, circuitJson) => {
660
+ const pcbSmtpad = su(circuitJson).pcb_smtpad.get(id);
661
+ if (pcbSmtpad && "x" in pcbSmtpad && "y" in pcbSmtpad) {
662
+ return { x: pcbSmtpad.x, y: pcbSmtpad.y };
663
+ }
664
+ const pcbPlatedHole = su(circuitJson).pcb_plated_hole.get(id);
665
+ if (pcbPlatedHole && "x" in pcbPlatedHole && "y" in pcbPlatedHole) {
666
+ return { x: pcbPlatedHole.x, y: pcbPlatedHole.y };
667
+ }
668
+ return null;
669
+ };
670
+
671
+ // lib/pcb/create-svg-objects-from-pcb-rats-nest/find-nearest-point-in-nest.ts
672
+ import "circuit-json-to-connectivity-map";
673
+ var findNearestPointInNet = (sourcePoint, netId, connectivity, circuitJson) => {
674
+ const connectedIds = connectivity.getIdsConnectedToNet(netId);
675
+ let nearestPoint = null;
676
+ let minDistance = Infinity;
677
+ for (const id of connectedIds) {
678
+ const pos = getElementPosition(id, circuitJson);
679
+ if (pos) {
680
+ const dx = sourcePoint.x - pos.x;
681
+ const dy = sourcePoint.y - pos.y;
682
+ const distance = Math.sqrt(dx * dx + dy * dy);
683
+ if (distance > 0 && distance < minDistance) {
684
+ minDistance = distance;
685
+ nearestPoint = pos;
686
+ }
687
+ }
688
+ }
689
+ return nearestPoint;
690
+ };
691
+
692
+ // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-rats-nests.ts
693
+ import { su as su2 } from "@tscircuit/soup-util";
694
+ function createSvgObjectsForRatsNest(circuitJson, transform) {
695
+ const connectivity = getFullConnectivityMapFromCircuitJson(circuitJson);
696
+ const pcbPorts = circuitJson.filter((elm) => elm.type === "pcb_port");
697
+ const sourceTraces = circuitJson.filter((elm) => elm.type === "source_trace");
698
+ const ratsNestLines = [];
699
+ pcbPorts.forEach((port, index) => {
700
+ const portId = port.pcb_port_id;
701
+ if (!portId) return;
702
+ const netId = connectivity.getNetConnectedToId(portId);
703
+ if (!netId) return;
704
+ let isInNet = false;
705
+ const sourcePort = su2(circuitJson).source_port.getWhere({
706
+ pcb_port_id: portId
707
+ });
708
+ if (sourcePort && sourcePort.source_port_id) {
709
+ const sourcePortId = sourcePort.source_port_id;
710
+ for (const trace of sourceTraces) {
711
+ if (Array.isArray(trace.connected_source_port_ids) && trace.connected_source_port_ids.includes(sourcePortId) && Array.isArray(trace.connected_source_net_ids) && trace.connected_source_net_ids.length > 0) {
712
+ isInNet = true;
713
+ break;
714
+ }
715
+ }
716
+ }
717
+ const startPoint = { x: port.x, y: port.y };
718
+ const nearestPoint = findNearestPointInNet(
719
+ startPoint,
720
+ netId,
721
+ connectivity,
722
+ circuitJson
723
+ );
724
+ if (!nearestPoint) return;
725
+ ratsNestLines.push({
726
+ key: `${portId}-${index}`,
727
+ startPoint,
728
+ endPoint: nearestPoint,
729
+ isInNet
730
+ });
731
+ });
732
+ const svgObjects = [];
733
+ for (const line of ratsNestLines) {
734
+ const transformedStart = applyToPoint12(transform, [
735
+ line.startPoint.x,
736
+ line.startPoint.y
737
+ ]);
738
+ const transformedEnd = applyToPoint12(transform, [
739
+ line.endPoint.x,
740
+ line.endPoint.y
741
+ ]);
742
+ const attributes = {
743
+ x1: transformedStart[0].toString(),
744
+ y1: transformedStart[1].toString(),
745
+ x2: transformedEnd[0].toString(),
746
+ y2: transformedEnd[1].toString(),
747
+ stroke: "white",
748
+ "stroke-width": "1",
749
+ "stroke-dasharray": "6,6"
750
+ };
751
+ svgObjects.push({
752
+ name: "line",
753
+ type: "element",
754
+ attributes,
755
+ value: "",
756
+ children: []
757
+ });
758
+ }
759
+ return svgObjects;
760
+ }
761
+
650
762
  // lib/pcb/convert-circuit-json-to-pcb-svg.ts
651
763
  var OBJECT_ORDER = [
652
764
  "pcb_trace_error",
@@ -702,7 +814,7 @@ function convertCircuitJsonToPcbSvg(soup, options) {
702
814
  scale(scaleFactor, -scaleFactor)
703
815
  // Flip in y-direction
704
816
  );
705
- const svgObjects = soup.sort(
817
+ let svgObjects = soup.sort(
706
818
  (a, b) => (OBJECT_ORDER.indexOf(b.type) ?? 9999) - (OBJECT_ORDER.indexOf(a.type) ?? 9999)
707
819
  ).flatMap(
708
820
  (item) => createSvgObjects(item, transform, soup, options?.shouldDrawErrors)
@@ -714,6 +826,10 @@ function convertCircuitJsonToPcbSvg(soup, options) {
714
826
  break;
715
827
  }
716
828
  }
829
+ if (options?.shouldDrawRatsNest) {
830
+ const ratsNestObjects = createSvgObjectsForRatsNest(soup, transform);
831
+ svgObjects = svgObjects.concat(ratsNestObjects);
832
+ }
717
833
  const svgObject = {
718
834
  name: "svg",
719
835
  type: "element",
@@ -829,7 +945,7 @@ function createSvgObjects(elm, transform, soup, shouldDrawErrors) {
829
945
  }
830
946
  function createSvgObjectsFromPcbComponent(component, transform) {
831
947
  const { center, width, height, rotation = 0 } = component;
832
- const [x, y] = applyToPoint12(transform, [center.x, center.y]);
948
+ const [x, y] = applyToPoint13(transform, [center.x, center.y]);
833
949
  const scaledWidth = width * Math.abs(transform.a);
834
950
  const scaledHeight = height * Math.abs(transform.d);
835
951
  const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
@@ -864,8 +980,8 @@ function createSvgObjectsFromPcbComponent(component, transform) {
864
980
  };
865
981
  }
866
982
  function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
867
- const [x1, y1] = applyToPoint12(transform, [minX, minY]);
868
- const [x2, y2] = applyToPoint12(transform, [maxX, maxY]);
983
+ const [x1, y1] = applyToPoint13(transform, [minX, minY]);
984
+ const [x2, y2] = applyToPoint13(transform, [maxX, maxY]);
869
985
  const width = Math.abs(x2 - x1);
870
986
  const height = Math.abs(y2 - y1);
871
987
  const x = Math.min(x1, x2);
@@ -888,16 +1004,16 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
888
1004
 
889
1005
  // lib/assembly/convert-circuit-json-to-assembly-svg.ts
890
1006
  import { stringify as stringify2 } from "svgson";
891
- import { su } from "@tscircuit/soup-util";
1007
+ import { su as su3 } from "@tscircuit/soup-util";
892
1008
  import {
893
- applyToPoint as applyToPoint16,
1009
+ applyToPoint as applyToPoint17,
894
1010
  compose as compose4,
895
1011
  scale as scale2,
896
1012
  translate as translate4
897
1013
  } from "transformation-matrix";
898
1014
 
899
1015
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
900
- import { applyToPoint as applyToPoint13 } from "transformation-matrix";
1016
+ import { applyToPoint as applyToPoint14 } from "transformation-matrix";
901
1017
  var DEFAULT_BOARD_STYLE = {
902
1018
  fill: "none",
903
1019
  stroke: "rgb(0,0,0)",
@@ -909,25 +1025,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
909
1025
  let path;
910
1026
  if (outline && Array.isArray(outline) && outline.length >= 3) {
911
1027
  path = outline.map((point, index) => {
912
- const [x, y] = applyToPoint13(transform, [point.x, point.y]);
1028
+ const [x, y] = applyToPoint14(transform, [point.x, point.y]);
913
1029
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
914
1030
  }).join(" ");
915
1031
  } else {
916
1032
  const halfWidth = width / 2;
917
1033
  const halfHeight = height / 2;
918
- const topLeft = applyToPoint13(transform, [
1034
+ const topLeft = applyToPoint14(transform, [
919
1035
  center.x - halfWidth,
920
1036
  center.y - halfHeight
921
1037
  ]);
922
- const topRight = applyToPoint13(transform, [
1038
+ const topRight = applyToPoint14(transform, [
923
1039
  center.x + halfWidth,
924
1040
  center.y - halfHeight
925
1041
  ]);
926
- const bottomRight = applyToPoint13(transform, [
1042
+ const bottomRight = applyToPoint14(transform, [
927
1043
  center.x + halfWidth,
928
1044
  center.y + halfHeight
929
1045
  ]);
930
- const bottomLeft = applyToPoint13(transform, [
1046
+ const bottomLeft = applyToPoint14(transform, [
931
1047
  center.x - halfWidth,
932
1048
  center.y + halfHeight
933
1049
  ]);
@@ -953,7 +1069,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
953
1069
  }
954
1070
 
955
1071
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
956
- import { applyToPoint as applyToPoint15 } from "transformation-matrix";
1072
+ import { applyToPoint as applyToPoint16 } from "transformation-matrix";
957
1073
 
958
1074
  // lib/utils/get-sch-font-size.ts
959
1075
  import "transformation-matrix";
@@ -967,8 +1083,8 @@ var getSchScreenFontSize = (transform, textType) => {
967
1083
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
968
1084
  function createSvgObjectsFromAssemblyComponent(component, transform, firstPin, name) {
969
1085
  const { center, width, height, rotation = 0 } = component;
970
- const [x, y] = applyToPoint15(transform, [center.x, center.y]);
971
- const [pinX, pinY] = applyToPoint15(transform, [firstPin.x, firstPin.y]);
1086
+ const [x, y] = applyToPoint16(transform, [center.x, center.y]);
1087
+ const [pinX, pinY] = applyToPoint16(transform, [firstPin.x, firstPin.y]);
972
1088
  const scaledWidth = width * Math.abs(transform.a);
973
1089
  const scaledHeight = height * Math.abs(transform.d);
974
1090
  return {
@@ -1177,7 +1293,7 @@ function convertCircuitJsonToAssemblySvg(soup, options) {
1177
1293
  return stringify2(svgObject);
1178
1294
  }
1179
1295
  function createSvgObjects2(elm, transform, soup) {
1180
- const sourceComponents = su(soup).source_component.list();
1296
+ const sourceComponents = su3(soup).source_component.list();
1181
1297
  switch (elm.type) {
1182
1298
  case "pcb_board":
1183
1299
  return createSvgObjectsFromAssemblyBoard(elm, transform);
@@ -1185,7 +1301,7 @@ function createSvgObjects2(elm, transform, soup) {
1185
1301
  const sourceComponent = sourceComponents.find(
1186
1302
  (item) => item.source_component_id === elm.source_component_id
1187
1303
  );
1188
- const ports = su(soup).pcb_port.list().filter((port) => port.pcb_component_id === elm.pcb_component_id);
1304
+ const ports = su3(soup).pcb_port.list().filter((port) => port.pcb_component_id === elm.pcb_component_id);
1189
1305
  const firstPort = ports[0];
1190
1306
  if (sourceComponent && firstPort) {
1191
1307
  return [
@@ -1204,8 +1320,8 @@ function createSvgObjects2(elm, transform, soup) {
1204
1320
  }
1205
1321
  }
1206
1322
  function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
1207
- const [x1, y1] = applyToPoint16(transform, [minX, minY]);
1208
- const [x2, y2] = applyToPoint16(transform, [maxX, maxY]);
1323
+ const [x1, y1] = applyToPoint17(transform, [minX, minY]);
1324
+ const [x2, y2] = applyToPoint17(transform, [maxX, maxY]);
1209
1325
  const width = Math.abs(x2 - x1);
1210
1326
  const height = Math.abs(y2 - y1);
1211
1327
  const x = Math.min(x1, x2);
@@ -1470,14 +1586,14 @@ import {
1470
1586
  } from "transformation-matrix";
1471
1587
 
1472
1588
  // lib/sch/draw-schematic-grid.ts
1473
- import { applyToPoint as applyToPoint17 } from "transformation-matrix";
1589
+ import { applyToPoint as applyToPoint18 } from "transformation-matrix";
1474
1590
  function drawSchematicGrid(params) {
1475
1591
  const { minX, minY, maxX, maxY } = params.bounds;
1476
1592
  const cellSize = params.cellSize ?? 1;
1477
1593
  const labelCells = params.labelCells ?? false;
1478
1594
  const gridLines = [];
1479
1595
  const transformPoint = (x, y) => {
1480
- const [transformedX, transformedY] = applyToPoint17(params.transform, [x, y]);
1596
+ const [transformedX, transformedY] = applyToPoint18(params.transform, [x, y]);
1481
1597
  return { x: transformedX, y: transformedY };
1482
1598
  };
1483
1599
  for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
@@ -1558,15 +1674,15 @@ function drawSchematicGrid(params) {
1558
1674
  }
1559
1675
 
1560
1676
  // lib/sch/draw-schematic-labeled-points.ts
1561
- import { applyToPoint as applyToPoint18 } from "transformation-matrix";
1677
+ import { applyToPoint as applyToPoint19 } from "transformation-matrix";
1562
1678
  function drawSchematicLabeledPoints(params) {
1563
1679
  const { points, transform } = params;
1564
1680
  const labeledPointsGroup = [];
1565
1681
  for (const point of points) {
1566
- const [x1, y1] = applyToPoint18(transform, [point.x - 0.1, point.y - 0.1]);
1567
- const [x2, y2] = applyToPoint18(transform, [point.x + 0.1, point.y + 0.1]);
1568
- const [x3, y3] = applyToPoint18(transform, [point.x - 0.1, point.y + 0.1]);
1569
- const [x4, y4] = applyToPoint18(transform, [point.x + 0.1, point.y - 0.1]);
1682
+ const [x1, y1] = applyToPoint19(transform, [point.x - 0.1, point.y - 0.1]);
1683
+ const [x2, y2] = applyToPoint19(transform, [point.x + 0.1, point.y + 0.1]);
1684
+ const [x3, y3] = applyToPoint19(transform, [point.x - 0.1, point.y + 0.1]);
1685
+ const [x4, y4] = applyToPoint19(transform, [point.x + 0.1, point.y - 0.1]);
1570
1686
  labeledPointsGroup.push({
1571
1687
  name: "path",
1572
1688
  type: "element",
@@ -1577,7 +1693,7 @@ function drawSchematicLabeledPoints(params) {
1577
1693
  "stroke-opacity": "0.7"
1578
1694
  }
1579
1695
  });
1580
- const [labelX, labelY] = applyToPoint18(transform, [
1696
+ const [labelX, labelY] = applyToPoint19(transform, [
1581
1697
  point.x + 0.15,
1582
1698
  point.y - 0.15
1583
1699
  ]);
@@ -1676,11 +1792,11 @@ function getSchematicBoundsFromCircuitJson(soup, padding = 0.5) {
1676
1792
  }
1677
1793
 
1678
1794
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-component-with-symbol.ts
1679
- import { su as su2 } from "@tscircuit/soup-util";
1795
+ import { su as su4 } from "@tscircuit/soup-util";
1680
1796
  import { symbols } from "schematic-symbols";
1681
1797
  import "svgson";
1682
1798
  import {
1683
- applyToPoint as applyToPoint20,
1799
+ applyToPoint as applyToPoint21,
1684
1800
  compose as compose6
1685
1801
  } from "transformation-matrix";
1686
1802
 
@@ -1764,13 +1880,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
1764
1880
  }
1765
1881
 
1766
1882
  // lib/sch/svg-object-fns/create-svg-error-text.ts
1767
- import { applyToPoint as applyToPoint19 } from "transformation-matrix";
1883
+ import { applyToPoint as applyToPoint20 } from "transformation-matrix";
1768
1884
  var createSvgSchErrorText = ({
1769
1885
  text,
1770
1886
  realCenter,
1771
1887
  realToScreenTransform
1772
1888
  }) => {
1773
- const screenCenter = applyToPoint19(realToScreenTransform, realCenter);
1889
+ const screenCenter = applyToPoint20(realToScreenTransform, realCenter);
1774
1890
  return {
1775
1891
  type: "element",
1776
1892
  name: "text",
@@ -1824,10 +1940,10 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
1824
1940
  })
1825
1941
  ];
1826
1942
  }
1827
- const schPorts = su2(circuitJson).schematic_port.list({
1943
+ const schPorts = su4(circuitJson).schematic_port.list({
1828
1944
  schematic_component_id: schComponent.schematic_component_id
1829
1945
  });
1830
- const srcComponent = su2(circuitJson).source_component.get(
1946
+ const srcComponent = su4(circuitJson).source_component.get(
1831
1947
  schComponent.source_component_id
1832
1948
  );
1833
1949
  const schPortsWithSymbolPorts = matchSchPortsToSymbolPorts({
@@ -1860,11 +1976,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
1860
1976
  minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
1861
1977
  maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
1862
1978
  };
1863
- const [screenMinX, screenMinY] = applyToPoint20(
1979
+ const [screenMinX, screenMinY] = applyToPoint21(
1864
1980
  compose6(realToScreenTransform, transformFromSymbolToReal),
1865
1981
  [bounds.minX, bounds.minY]
1866
1982
  );
1867
- const [screenMaxX, screenMaxY] = applyToPoint20(
1983
+ const [screenMaxX, screenMaxY] = applyToPoint21(
1868
1984
  compose6(realToScreenTransform, transformFromSymbolToReal),
1869
1985
  [bounds.maxX, bounds.maxY]
1870
1986
  );
@@ -1893,7 +2009,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
1893
2009
  name: "path",
1894
2010
  attributes: {
1895
2011
  d: points.map((p, i) => {
1896
- const [x, y] = applyToPoint20(
2012
+ const [x, y] = applyToPoint21(
1897
2013
  compose6(realToScreenTransform, transformFromSymbolToReal),
1898
2014
  [p.x, p.y]
1899
2015
  );
@@ -1908,7 +2024,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
1908
2024
  });
1909
2025
  }
1910
2026
  for (const text of texts) {
1911
- const screenTextPos = applyToPoint20(
2027
+ const screenTextPos = applyToPoint21(
1912
2028
  compose6(realToScreenTransform, transformFromSymbolToReal),
1913
2029
  text
1914
2030
  );
@@ -1954,7 +2070,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
1954
2070
  });
1955
2071
  }
1956
2072
  for (const box of boxes) {
1957
- const screenBoxPos = applyToPoint20(
2073
+ const screenBoxPos = applyToPoint21(
1958
2074
  compose6(realToScreenTransform, transformFromSymbolToReal),
1959
2075
  box
1960
2076
  );
@@ -1977,7 +2093,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
1977
2093
  });
1978
2094
  }
1979
2095
  for (const port of symbol.ports) {
1980
- const screenPortPos = applyToPoint20(
2096
+ const screenPortPos = applyToPoint21(
1981
2097
  compose6(realToScreenTransform, transformFromSymbolToReal),
1982
2098
  port
1983
2099
  );
@@ -2000,18 +2116,18 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
2000
2116
  };
2001
2117
 
2002
2118
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-component-with-box.ts
2003
- import { su as su5 } from "@tscircuit/soup-util";
2119
+ import { su as su7 } from "@tscircuit/soup-util";
2004
2120
  import "schematic-symbols";
2005
2121
  import "svgson";
2006
- import { applyToPoint as applyToPoint26 } from "transformation-matrix";
2122
+ import { applyToPoint as applyToPoint27 } from "transformation-matrix";
2007
2123
 
2008
2124
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
2009
2125
  import "transformation-matrix";
2010
2126
  import "@tscircuit/soup-util";
2011
2127
 
2012
2128
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
2013
- import { applyToPoint as applyToPoint21 } from "transformation-matrix";
2014
- import { su as su3 } from "@tscircuit/soup-util";
2129
+ import { applyToPoint as applyToPoint22 } from "transformation-matrix";
2130
+ import { su as su5 } from "@tscircuit/soup-util";
2015
2131
  var PIN_CIRCLE_RADIUS_MM = 0.02;
2016
2132
  var createSvgObjectsForSchPortBoxLine = ({
2017
2133
  schPort,
@@ -2020,7 +2136,7 @@ var createSvgObjectsForSchPortBoxLine = ({
2020
2136
  circuitJson
2021
2137
  }) => {
2022
2138
  const svgObjects = [];
2023
- const srcPort = su3(circuitJson).source_port.get(schPort.source_port_id);
2139
+ const srcPort = su5(circuitJson).source_port.get(schPort.source_port_id);
2024
2140
  const realEdgePos = {
2025
2141
  x: schPort.center.x,
2026
2142
  y: schPort.center.y
@@ -2040,8 +2156,8 @@ var createSvgObjectsForSchPortBoxLine = ({
2040
2156
  realEdgePos.y += realPinLineLength;
2041
2157
  break;
2042
2158
  }
2043
- const screenSchPortPos = applyToPoint21(transform, schPort.center);
2044
- const screenRealEdgePos = applyToPoint21(transform, realEdgePos);
2159
+ const screenSchPortPos = applyToPoint22(transform, schPort.center);
2160
+ const screenRealEdgePos = applyToPoint22(transform, realEdgePos);
2045
2161
  const realLineEnd = { ...schPort.center };
2046
2162
  switch (schPort.side_of_component) {
2047
2163
  case "left":
@@ -2057,7 +2173,7 @@ var createSvgObjectsForSchPortBoxLine = ({
2057
2173
  realLineEnd.y += PIN_CIRCLE_RADIUS_MM;
2058
2174
  break;
2059
2175
  }
2060
- const screenLineEnd = applyToPoint21(transform, realLineEnd);
2176
+ const screenLineEnd = applyToPoint22(transform, realLineEnd);
2061
2177
  svgObjects.push({
2062
2178
  name: "line",
2063
2179
  type: "element",
@@ -2104,7 +2220,7 @@ var getUnitVectorFromOutsideToEdge = (side) => {
2104
2220
  };
2105
2221
 
2106
2222
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
2107
- import { applyToPoint as applyToPoint22 } from "transformation-matrix";
2223
+ import { applyToPoint as applyToPoint23 } from "transformation-matrix";
2108
2224
  var createSvgObjectsForSchPortPinNumberText = (params) => {
2109
2225
  const svgObjects = [];
2110
2226
  const { schPort, schComponent, transform, circuitJson } = params;
@@ -2122,7 +2238,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
2122
2238
  } else {
2123
2239
  realPinNumberPos.y += 0.02;
2124
2240
  }
2125
- const screenPinNumberTextPos = applyToPoint22(transform, realPinNumberPos);
2241
+ const screenPinNumberTextPos = applyToPoint23(transform, realPinNumberPos);
2126
2242
  svgObjects.push({
2127
2243
  name: "text",
2128
2244
  type: "element",
@@ -2152,7 +2268,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
2152
2268
  };
2153
2269
 
2154
2270
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
2155
- import { applyToPoint as applyToPoint23 } from "transformation-matrix";
2271
+ import { applyToPoint as applyToPoint24 } from "transformation-matrix";
2156
2272
  var LABEL_DIST_FROM_EDGE_MM = 0.1;
2157
2273
  var createSvgObjectsForSchPortPinLabel = (params) => {
2158
2274
  const svgObjects = [];
@@ -2166,7 +2282,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
2166
2282
  const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
2167
2283
  realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
2168
2284
  realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
2169
- const screenPinNumberTextPos = applyToPoint23(transform, realPinNumberPos);
2285
+ const screenPinNumberTextPos = applyToPoint24(transform, realPinNumberPos);
2170
2286
  const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
2171
2287
  if (!label) return [];
2172
2288
  svgObjects.push({
@@ -2208,9 +2324,9 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
2208
2324
  };
2209
2325
 
2210
2326
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
2211
- import { applyToPoint as applyToPoint25 } from "transformation-matrix";
2327
+ import { applyToPoint as applyToPoint26 } from "transformation-matrix";
2212
2328
  var createSvgSchText = (elm, transform) => {
2213
- const center = applyToPoint25(transform, elm.position);
2329
+ const center = applyToPoint26(transform, elm.position);
2214
2330
  const textAnchorMap = {
2215
2331
  center: "middle",
2216
2332
  left: "start",
@@ -2258,11 +2374,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
2258
2374
  circuitJson
2259
2375
  }) => {
2260
2376
  const svgObjects = [];
2261
- const componentScreenTopLeft = applyToPoint26(transform, {
2377
+ const componentScreenTopLeft = applyToPoint27(transform, {
2262
2378
  x: schComponent.center.x - schComponent.size.width / 2,
2263
2379
  y: schComponent.center.y + schComponent.size.height / 2
2264
2380
  });
2265
- const componentScreenBottomRight = applyToPoint26(transform, {
2381
+ const componentScreenBottomRight = applyToPoint27(transform, {
2266
2382
  x: schComponent.center.x + schComponent.size.width / 2,
2267
2383
  y: schComponent.center.y - schComponent.size.height / 2
2268
2384
  });
@@ -2298,13 +2414,13 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
2298
2414
  },
2299
2415
  children: []
2300
2416
  });
2301
- const schTexts = su5(circuitJson).schematic_text.list();
2417
+ const schTexts = su7(circuitJson).schematic_text.list();
2302
2418
  for (const schText of schTexts) {
2303
2419
  if (schText.schematic_component_id === schComponent.schematic_component_id) {
2304
2420
  svgObjects.push(createSvgSchText(schText, transform));
2305
2421
  }
2306
2422
  }
2307
- const schematicPorts = su5(circuitJson).schematic_port.list({
2423
+ const schematicPorts = su7(circuitJson).schematic_port.list({
2308
2424
  schematic_component_id: schComponent.schematic_component_id
2309
2425
  });
2310
2426
  for (const schPort of schematicPorts) {
@@ -2339,9 +2455,9 @@ function createSvgObjectsFromSchematicComponent(params) {
2339
2455
  }
2340
2456
 
2341
2457
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
2342
- import { applyToPoint as applyToPoint27 } from "transformation-matrix";
2458
+ import { applyToPoint as applyToPoint28 } from "transformation-matrix";
2343
2459
  function createSvgObjectsFromSchVoltageProbe(probe, transform) {
2344
- const [screenX, screenY] = applyToPoint27(transform, [
2460
+ const [screenX, screenY] = applyToPoint28(transform, [
2345
2461
  probe.position.x,
2346
2462
  probe.position.y
2347
2463
  ]);
@@ -2401,14 +2517,14 @@ function createSvgObjectsFromSchVoltageProbe(probe, transform) {
2401
2517
  }
2402
2518
 
2403
2519
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
2404
- import { applyToPoint as applyToPoint28 } from "transformation-matrix";
2520
+ import { applyToPoint as applyToPoint29 } from "transformation-matrix";
2405
2521
  function createSvgObjectsFromSchDebugObject(debugObject, transform) {
2406
2522
  if (debugObject.shape === "rect") {
2407
- let [screenLeft, screenTop] = applyToPoint28(transform, [
2523
+ let [screenLeft, screenTop] = applyToPoint29(transform, [
2408
2524
  debugObject.center.x - debugObject.size.width / 2,
2409
2525
  debugObject.center.y - debugObject.size.height / 2
2410
2526
  ]);
2411
- let [screenRight, screenBottom] = applyToPoint28(transform, [
2527
+ let [screenRight, screenBottom] = applyToPoint29(transform, [
2412
2528
  debugObject.center.x + debugObject.size.width / 2,
2413
2529
  debugObject.center.y + debugObject.size.height / 2
2414
2530
  ]);
@@ -2418,7 +2534,7 @@ function createSvgObjectsFromSchDebugObject(debugObject, transform) {
2418
2534
  ];
2419
2535
  const width = Math.abs(screenRight - screenLeft);
2420
2536
  const height = Math.abs(screenBottom - screenTop);
2421
- const [screenCenterX, screenCenterY] = applyToPoint28(transform, [
2537
+ const [screenCenterX, screenCenterY] = applyToPoint29(transform, [
2422
2538
  debugObject.center.x,
2423
2539
  debugObject.center.y
2424
2540
  ]);
@@ -2464,11 +2580,11 @@ function createSvgObjectsFromSchDebugObject(debugObject, transform) {
2464
2580
  ];
2465
2581
  }
2466
2582
  if (debugObject.shape === "line") {
2467
- const [screenStartX, screenStartY] = applyToPoint28(transform, [
2583
+ const [screenStartX, screenStartY] = applyToPoint29(transform, [
2468
2584
  debugObject.start.x,
2469
2585
  debugObject.start.y
2470
2586
  ]);
2471
- const [screenEndX, screenEndY] = applyToPoint28(transform, [
2587
+ const [screenEndX, screenEndY] = applyToPoint29(transform, [
2472
2588
  debugObject.end.x,
2473
2589
  debugObject.end.y
2474
2590
  ]);
@@ -2518,7 +2634,7 @@ function createSvgObjectsFromSchDebugObject(debugObject, transform) {
2518
2634
  }
2519
2635
 
2520
2636
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
2521
- import { applyToPoint as applyToPoint29 } from "transformation-matrix";
2637
+ import { applyToPoint as applyToPoint30 } from "transformation-matrix";
2522
2638
  function createSchematicTrace(trace, transform) {
2523
2639
  const edges = trace.edges;
2524
2640
  if (edges.length === 0) return [];
@@ -2527,11 +2643,11 @@ function createSchematicTrace(trace, transform) {
2527
2643
  for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
2528
2644
  const edge = edges[edgeIndex];
2529
2645
  if (edge.is_crossing) continue;
2530
- const [screenFromX, screenFromY] = applyToPoint29(transform, [
2646
+ const [screenFromX, screenFromY] = applyToPoint30(transform, [
2531
2647
  edge.from.x,
2532
2648
  edge.from.y
2533
2649
  ]);
2534
- const [screenToX, screenToY] = applyToPoint29(transform, [
2650
+ const [screenToX, screenToY] = applyToPoint30(transform, [
2535
2651
  edge.to.x,
2536
2652
  edge.to.y
2537
2653
  ]);
@@ -2543,11 +2659,11 @@ function createSchematicTrace(trace, transform) {
2543
2659
  }
2544
2660
  for (const edge of edges) {
2545
2661
  if (!edge.is_crossing) continue;
2546
- const [screenFromX, screenFromY] = applyToPoint29(transform, [
2662
+ const [screenFromX, screenFromY] = applyToPoint30(transform, [
2547
2663
  edge.from.x,
2548
2664
  edge.from.y
2549
2665
  ]);
2550
- const [screenToX, screenToY] = applyToPoint29(transform, [
2666
+ const [screenToX, screenToY] = applyToPoint30(transform, [
2551
2667
  edge.to.x,
2552
2668
  edge.to.y
2553
2669
  ]);
@@ -2623,7 +2739,7 @@ function createSchematicTrace(trace, transform) {
2623
2739
  }
2624
2740
  if (trace.junctions) {
2625
2741
  for (const junction of trace.junctions) {
2626
- const [screenX, screenY] = applyToPoint29(transform, [
2742
+ const [screenX, screenY] = applyToPoint30(transform, [
2627
2743
  junction.x,
2628
2744
  junction.y
2629
2745
  ]);
@@ -2658,7 +2774,7 @@ function createSchematicTrace(trace, transform) {
2658
2774
 
2659
2775
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
2660
2776
  import {
2661
- applyToPoint as applyToPoint31,
2777
+ applyToPoint as applyToPoint32,
2662
2778
  compose as compose8,
2663
2779
  rotate as rotate4,
2664
2780
  scale as scale5,
@@ -3446,7 +3562,7 @@ var estimateTextWidth = (text) => {
3446
3562
 
3447
3563
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
3448
3564
  import {
3449
- applyToPoint as applyToPoint30,
3565
+ applyToPoint as applyToPoint31,
3450
3566
  compose as compose7,
3451
3567
  rotate as rotate3,
3452
3568
  scale as scale4,
@@ -3566,7 +3682,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = (schNetLabel, realToScreenTransfo
3566
3682
  x: symbolBounds.minX,
3567
3683
  y: (symbolBounds.minY + symbolBounds.maxY) / 2
3568
3684
  };
3569
- const rotatedSymbolEnd = applyToPoint30(rotationMatrix, symbolEndPoint);
3685
+ const rotatedSymbolEnd = applyToPoint31(rotationMatrix, symbolEndPoint);
3570
3686
  const symbolToRealTransform = compose7(
3571
3687
  translate7(
3572
3688
  realAnchorPosition.x - rotatedSymbolEnd.x,
@@ -3576,11 +3692,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = (schNetLabel, realToScreenTransfo
3576
3692
  scale4(1)
3577
3693
  // Use full symbol size
3578
3694
  );
3579
- const [screenMinX, screenMinY] = applyToPoint30(
3695
+ const [screenMinX, screenMinY] = applyToPoint31(
3580
3696
  compose7(realToScreenTransform, symbolToRealTransform),
3581
3697
  [bounds.minX, bounds.minY]
3582
3698
  );
3583
- const [screenMaxX, screenMaxY] = applyToPoint30(
3699
+ const [screenMaxX, screenMaxY] = applyToPoint31(
3584
3700
  compose7(realToScreenTransform, symbolToRealTransform),
3585
3701
  [bounds.maxX, bounds.maxY]
3586
3702
  );
@@ -3604,7 +3720,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = (schNetLabel, realToScreenTransfo
3604
3720
  });
3605
3721
  for (const path of symbolPaths) {
3606
3722
  const symbolPath = path.points.map((p, i) => {
3607
- const [x, y] = applyToPoint30(
3723
+ const [x, y] = applyToPoint31(
3608
3724
  compose7(realToScreenTransform, symbolToRealTransform),
3609
3725
  [p.x, p.y]
3610
3726
  );
@@ -3624,7 +3740,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = (schNetLabel, realToScreenTransfo
3624
3740
  });
3625
3741
  }
3626
3742
  for (const text of symbolTexts) {
3627
- const screenTextPos = applyToPoint30(
3743
+ const screenTextPos = applyToPoint31(
3628
3744
  compose7(realToScreenTransform, symbolToRealTransform),
3629
3745
  text
3630
3746
  );
@@ -3666,7 +3782,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = (schNetLabel, realToScreenTransfo
3666
3782
  });
3667
3783
  }
3668
3784
  for (const box of symbolBoxes) {
3669
- const screenBoxPos = applyToPoint30(
3785
+ const screenBoxPos = applyToPoint31(
3670
3786
  compose7(realToScreenTransform, symbolToRealTransform),
3671
3787
  box
3672
3788
  );
@@ -3689,7 +3805,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = (schNetLabel, realToScreenTransfo
3689
3805
  });
3690
3806
  }
3691
3807
  for (const circle of symbolCircles) {
3692
- const screenCirclePos = applyToPoint30(
3808
+ const screenCirclePos = applyToPoint31(
3693
3809
  compose7(realToScreenTransform, symbolToRealTransform),
3694
3810
  circle
3695
3811
  );
@@ -3728,14 +3844,14 @@ var createSvgObjectsForSchNetLabel = (schNetLabel, realToScreenTransform) => {
3728
3844
  const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
3729
3845
  const fontSizeMm = getSchMmFontSize("net_label");
3730
3846
  const textWidthFSR = estimateTextWidth(schNetLabel.text || "");
3731
- const screenCenter = applyToPoint31(realToScreenTransform, schNetLabel.center);
3847
+ const screenCenter = applyToPoint32(realToScreenTransform, schNetLabel.center);
3732
3848
  const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
3733
3849
  schNetLabel.anchor_side
3734
3850
  );
3735
3851
  const screenTextGrowthVec = { ...realTextGrowthVec };
3736
3852
  screenTextGrowthVec.y *= -1;
3737
3853
  const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * schNetLabel.text.length + END_PADDING_FSR;
3738
- const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint31(realToScreenTransform, schNetLabel.anchor_position) : {
3854
+ const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint32(realToScreenTransform, schNetLabel.anchor_position) : {
3739
3855
  x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
3740
3856
  y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
3741
3857
  };
@@ -3776,7 +3892,7 @@ var createSvgObjectsForSchNetLabel = (schNetLabel, realToScreenTransform) => {
3776
3892
  y: -0.6
3777
3893
  }
3778
3894
  ].map(
3779
- (fontRelativePoint) => applyToPoint31(
3895
+ (fontRelativePoint) => applyToPoint32(
3780
3896
  compose8(
3781
3897
  realToScreenTransform,
3782
3898
  translate8(realAnchorPosition.x, realAnchorPosition.y),
@@ -3800,7 +3916,7 @@ var createSvgObjectsForSchNetLabel = (schNetLabel, realToScreenTransform) => {
3800
3916
  attributes: {
3801
3917
  class: "net-label",
3802
3918
  d: pathD,
3803
- fill: "white",
3919
+ fill: "#FFFFFF99",
3804
3920
  stroke: colorMap.schematic.label_global,
3805
3921
  "stroke-width": `${getSchStrokeSize(realToScreenTransform)}px`
3806
3922
  },