circuit-to-svg 0.0.143 → 0.0.144

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 applyToPoint17,
4
+ applyToPoint as applyToPoint18,
5
5
  compose as compose4,
6
6
  scale as scale2,
7
7
  translate as translate4
@@ -834,12 +834,20 @@ var DEFAULT_PCB_COLOR_MAP = {
834
834
  top: "rgb(200, 52, 52)",
835
835
  bottom: "rgb(77, 127, 196)"
836
836
  },
837
+ soldermask: {
838
+ top: "rgb(200, 52, 52)",
839
+ bottom: "rgb(77, 127, 196)"
840
+ },
837
841
  drill: "#FF26E2",
838
842
  silkscreen: {
839
843
  top: "#f2eda1",
840
844
  bottom: "#5da9e9"
841
845
  },
842
- boardOutline: "rgba(255, 255, 255, 0.5)"
846
+ boardOutline: "rgba(255, 255, 255, 0.5)",
847
+ debugComponent: {
848
+ fill: null,
849
+ stroke: null
850
+ }
843
851
  };
844
852
  var HOLE_COLOR = DEFAULT_PCB_COLOR_MAP.drill;
845
853
  var SILKSCREEN_TOP_COLOR = DEFAULT_PCB_COLOR_MAP.silkscreen.top;
@@ -1348,6 +1356,43 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
1348
1356
  return [];
1349
1357
  }
1350
1358
 
1359
+ // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
1360
+ import { applyToPoint as applyToPoint17 } from "transformation-matrix";
1361
+ function createSvgObjectsFromPcbComponent(component, ctx) {
1362
+ const { transform } = ctx;
1363
+ const { center, width, height, rotation = 0 } = component;
1364
+ const [x, y] = applyToPoint17(transform, [center.x, center.y]);
1365
+ const scaledWidth = width * Math.abs(transform.a);
1366
+ const scaledHeight = height * Math.abs(transform.d);
1367
+ const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
1368
+ if (!ctx.colorMap.debugComponent?.fill && !ctx.colorMap.debugComponent?.stroke) {
1369
+ return [];
1370
+ }
1371
+ return [
1372
+ {
1373
+ name: "g",
1374
+ type: "element",
1375
+ attributes: { transform: transformStr },
1376
+ children: [
1377
+ {
1378
+ name: "rect",
1379
+ type: "element",
1380
+ attributes: {
1381
+ class: "pcb-component",
1382
+ x: (-scaledWidth / 2).toString(),
1383
+ y: (-scaledHeight / 2).toString(),
1384
+ width: scaledWidth.toString(),
1385
+ height: scaledHeight.toString(),
1386
+ fill: ctx.colorMap.debugComponent.fill ?? "transparent",
1387
+ stroke: ctx.colorMap.debugComponent.stroke ?? "transparent"
1388
+ }
1389
+ }
1390
+ ],
1391
+ value: ""
1392
+ }
1393
+ ];
1394
+ }
1395
+
1351
1396
  // lib/pcb/convert-circuit-json-to-pcb-svg.ts
1352
1397
  var OBJECT_ORDER = [
1353
1398
  "pcb_trace_error",
@@ -1377,7 +1422,15 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
1377
1422
  top: colorOverrides?.silkscreen?.top ?? DEFAULT_PCB_COLOR_MAP.silkscreen.top,
1378
1423
  bottom: colorOverrides?.silkscreen?.bottom ?? DEFAULT_PCB_COLOR_MAP.silkscreen.bottom
1379
1424
  },
1380
- boardOutline: colorOverrides?.boardOutline ?? DEFAULT_PCB_COLOR_MAP.boardOutline
1425
+ boardOutline: colorOverrides?.boardOutline ?? DEFAULT_PCB_COLOR_MAP.boardOutline,
1426
+ soldermask: {
1427
+ top: colorOverrides?.soldermask?.top ?? DEFAULT_PCB_COLOR_MAP.soldermask.top,
1428
+ bottom: colorOverrides?.soldermask?.bottom ?? DEFAULT_PCB_COLOR_MAP.soldermask.bottom
1429
+ },
1430
+ debugComponent: {
1431
+ fill: colorOverrides?.debugComponent?.fill ?? DEFAULT_PCB_COLOR_MAP.debugComponent.fill,
1432
+ stroke: colorOverrides?.debugComponent?.stroke ?? DEFAULT_PCB_COLOR_MAP.debugComponent.stroke
1433
+ }
1381
1434
  };
1382
1435
  let minX = Number.POSITIVE_INFINITY;
1383
1436
  let minY = Number.POSITIVE_INFINITY;
@@ -1594,14 +1647,13 @@ function createSvgObjects({
1594
1647
  circuitJson,
1595
1648
  ctx
1596
1649
  }) {
1597
- const { transform, layer: layerFilter, shouldDrawErrors } = ctx;
1598
1650
  switch (elm.type) {
1599
1651
  case "pcb_trace_error":
1600
1652
  return createSvgObjectsFromPcbTraceError(elm, circuitJson, ctx).filter(
1601
1653
  Boolean
1602
1654
  );
1603
1655
  case "pcb_component":
1604
- return [createSvgObjectsFromPcbComponent(elm, ctx)].filter(Boolean);
1656
+ return createSvgObjectsFromPcbComponent(elm, ctx).filter(Boolean);
1605
1657
  case "pcb_trace":
1606
1658
  return createSvgObjectsFromPcbTrace(elm, ctx);
1607
1659
  case "pcb_plated_hole":
@@ -1634,46 +1686,9 @@ function createSvgObjects({
1634
1686
  return [];
1635
1687
  }
1636
1688
  }
1637
- function createSvgObjectsFromPcbComponent(component, ctx) {
1638
- const { transform } = ctx;
1639
- const { center, width, height, rotation = 0 } = component;
1640
- const [x, y] = applyToPoint17(transform, [center.x, center.y]);
1641
- const scaledWidth = width * Math.abs(transform.a);
1642
- const scaledHeight = height * Math.abs(transform.d);
1643
- const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
1644
- return {
1645
- name: "g",
1646
- type: "element",
1647
- attributes: { transform: transformStr },
1648
- children: [
1649
- {
1650
- name: "rect",
1651
- type: "element",
1652
- attributes: {
1653
- class: "pcb-component",
1654
- x: (-scaledWidth / 2).toString(),
1655
- y: (-scaledHeight / 2).toString(),
1656
- width: scaledWidth.toString(),
1657
- height: scaledHeight.toString()
1658
- }
1659
- },
1660
- {
1661
- name: "rect",
1662
- type: "element",
1663
- attributes: {
1664
- class: "pcb-component-outline",
1665
- x: (-scaledWidth / 2).toString(),
1666
- y: (-scaledHeight / 2).toString(),
1667
- width: scaledWidth.toString(),
1668
- height: scaledHeight.toString()
1669
- }
1670
- }
1671
- ]
1672
- };
1673
- }
1674
1689
  function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
1675
- const [x1, y1] = applyToPoint17(transform, [minX, minY]);
1676
- const [x2, y2] = applyToPoint17(transform, [maxX, maxY]);
1690
+ const [x1, y1] = applyToPoint18(transform, [minX, minY]);
1691
+ const [x2, y2] = applyToPoint18(transform, [maxX, maxY]);
1677
1692
  const width = Math.abs(x2 - x1);
1678
1693
  const height = Math.abs(y2 - y1);
1679
1694
  const x = Math.min(x1, x2);
@@ -1701,14 +1716,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
1701
1716
  import { stringify as stringify2 } from "svgson";
1702
1717
  import { su as su3 } from "@tscircuit/circuit-json-util";
1703
1718
  import {
1704
- applyToPoint as applyToPoint21,
1719
+ applyToPoint as applyToPoint22,
1705
1720
  compose as compose5,
1706
1721
  scale as scale3,
1707
1722
  translate as translate5
1708
1723
  } from "transformation-matrix";
1709
1724
 
1710
1725
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
1711
- import { applyToPoint as applyToPoint18 } from "transformation-matrix";
1726
+ import { applyToPoint as applyToPoint19 } from "transformation-matrix";
1712
1727
  var DEFAULT_BOARD_STYLE = {
1713
1728
  fill: "none",
1714
1729
  stroke: "rgb(0,0,0)",
@@ -1720,25 +1735,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
1720
1735
  let path;
1721
1736
  if (outline && Array.isArray(outline) && outline.length >= 3) {
1722
1737
  path = outline.map((point, index) => {
1723
- const [x, y] = applyToPoint18(transform, [point.x, point.y]);
1738
+ const [x, y] = applyToPoint19(transform, [point.x, point.y]);
1724
1739
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
1725
1740
  }).join(" ");
1726
1741
  } else {
1727
1742
  const halfWidth = width / 2;
1728
1743
  const halfHeight = height / 2;
1729
- const topLeft = applyToPoint18(transform, [
1744
+ const topLeft = applyToPoint19(transform, [
1730
1745
  center.x - halfWidth,
1731
1746
  center.y - halfHeight
1732
1747
  ]);
1733
- const topRight = applyToPoint18(transform, [
1748
+ const topRight = applyToPoint19(transform, [
1734
1749
  center.x + halfWidth,
1735
1750
  center.y - halfHeight
1736
1751
  ]);
1737
- const bottomRight = applyToPoint18(transform, [
1752
+ const bottomRight = applyToPoint19(transform, [
1738
1753
  center.x + halfWidth,
1739
1754
  center.y + halfHeight
1740
1755
  ]);
1741
- const bottomLeft = applyToPoint18(transform, [
1756
+ const bottomLeft = applyToPoint19(transform, [
1742
1757
  center.x - halfWidth,
1743
1758
  center.y + halfHeight
1744
1759
  ]);
@@ -1764,7 +1779,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
1764
1779
  }
1765
1780
 
1766
1781
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
1767
- import { applyToPoint as applyToPoint20 } from "transformation-matrix";
1782
+ import { applyToPoint as applyToPoint21 } from "transformation-matrix";
1768
1783
 
1769
1784
  // lib/utils/get-sch-font-size.ts
1770
1785
  import "transformation-matrix";
@@ -1782,8 +1797,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
1782
1797
  const { center, width, height, rotation = 0, layer = "top" } = elm;
1783
1798
  if (!center || typeof width !== "number" || typeof height !== "number")
1784
1799
  return null;
1785
- const [x, y] = applyToPoint20(transform, [center.x, center.y]);
1786
- const [pinX, pinY] = applyToPoint20(transform, [portPosition.x, portPosition.y]);
1800
+ const [x, y] = applyToPoint21(transform, [center.x, center.y]);
1801
+ const [pinX, pinY] = applyToPoint21(transform, [portPosition.x, portPosition.y]);
1787
1802
  const scaledWidth = width * Math.abs(transform.a);
1788
1803
  const scaledHeight = height * Math.abs(transform.d);
1789
1804
  const isTopLayer = layer === "top";
@@ -2080,8 +2095,8 @@ function createSvgObjects2(elm, transform, soup) {
2080
2095
  }
2081
2096
  }
2082
2097
  function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
2083
- const [x1, y1] = applyToPoint21(transform, [minX, minY]);
2084
- const [x2, y2] = applyToPoint21(transform, [maxX, maxY]);
2098
+ const [x1, y1] = applyToPoint22(transform, [minX, minY]);
2099
+ const [x2, y2] = applyToPoint22(transform, [maxX, maxY]);
2085
2100
  const width = Math.abs(x2 - x1);
2086
2101
  const height = Math.abs(y2 - y1);
2087
2102
  const x = Math.min(x1, x2);
@@ -2347,14 +2362,14 @@ import {
2347
2362
  } from "transformation-matrix";
2348
2363
 
2349
2364
  // lib/sch/draw-schematic-grid.ts
2350
- import { applyToPoint as applyToPoint22 } from "transformation-matrix";
2365
+ import { applyToPoint as applyToPoint23 } from "transformation-matrix";
2351
2366
  function drawSchematicGrid(params) {
2352
2367
  const { minX, minY, maxX, maxY } = params.bounds;
2353
2368
  const cellSize = params.cellSize ?? 1;
2354
2369
  const labelCells = params.labelCells ?? false;
2355
2370
  const gridLines = [];
2356
2371
  const transformPoint = (x, y) => {
2357
- const [transformedX, transformedY] = applyToPoint22(params.transform, [x, y]);
2372
+ const [transformedX, transformedY] = applyToPoint23(params.transform, [x, y]);
2358
2373
  return { x: transformedX, y: transformedY };
2359
2374
  };
2360
2375
  for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
@@ -2435,15 +2450,15 @@ function drawSchematicGrid(params) {
2435
2450
  }
2436
2451
 
2437
2452
  // lib/sch/draw-schematic-labeled-points.ts
2438
- import { applyToPoint as applyToPoint23 } from "transformation-matrix";
2453
+ import { applyToPoint as applyToPoint24 } from "transformation-matrix";
2439
2454
  function drawSchematicLabeledPoints(params) {
2440
2455
  const { points, transform } = params;
2441
2456
  const labeledPointsGroup = [];
2442
2457
  for (const point of points) {
2443
- const [x1, y1] = applyToPoint23(transform, [point.x - 0.1, point.y - 0.1]);
2444
- const [x2, y2] = applyToPoint23(transform, [point.x + 0.1, point.y + 0.1]);
2445
- const [x3, y3] = applyToPoint23(transform, [point.x - 0.1, point.y + 0.1]);
2446
- const [x4, y4] = applyToPoint23(transform, [point.x + 0.1, point.y - 0.1]);
2458
+ const [x1, y1] = applyToPoint24(transform, [point.x - 0.1, point.y - 0.1]);
2459
+ const [x2, y2] = applyToPoint24(transform, [point.x + 0.1, point.y + 0.1]);
2460
+ const [x3, y3] = applyToPoint24(transform, [point.x - 0.1, point.y + 0.1]);
2461
+ const [x4, y4] = applyToPoint24(transform, [point.x + 0.1, point.y - 0.1]);
2447
2462
  labeledPointsGroup.push({
2448
2463
  name: "path",
2449
2464
  type: "element",
@@ -2454,7 +2469,7 @@ function drawSchematicLabeledPoints(params) {
2454
2469
  "stroke-opacity": "0.7"
2455
2470
  }
2456
2471
  });
2457
- const [labelX, labelY] = applyToPoint23(transform, [
2472
+ const [labelX, labelY] = applyToPoint24(transform, [
2458
2473
  point.x + 0.15,
2459
2474
  point.y - 0.15
2460
2475
  ]);
@@ -2565,7 +2580,7 @@ import { su as su4 } from "@tscircuit/circuit-json-util";
2565
2580
  import { symbols } from "schematic-symbols";
2566
2581
  import "svgson";
2567
2582
  import {
2568
- applyToPoint as applyToPoint25,
2583
+ applyToPoint as applyToPoint26,
2569
2584
  compose as compose7
2570
2585
  } from "transformation-matrix";
2571
2586
 
@@ -2649,13 +2664,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
2649
2664
  }
2650
2665
 
2651
2666
  // lib/sch/svg-object-fns/create-svg-error-text.ts
2652
- import { applyToPoint as applyToPoint24 } from "transformation-matrix";
2667
+ import { applyToPoint as applyToPoint25 } from "transformation-matrix";
2653
2668
  var createSvgSchErrorText = ({
2654
2669
  text,
2655
2670
  realCenter,
2656
2671
  realToScreenTransform
2657
2672
  }) => {
2658
- const screenCenter = applyToPoint24(realToScreenTransform, realCenter);
2673
+ const screenCenter = applyToPoint25(realToScreenTransform, realCenter);
2659
2674
  return {
2660
2675
  type: "element",
2661
2676
  name: "text",
@@ -2746,11 +2761,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
2746
2761
  minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
2747
2762
  maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
2748
2763
  };
2749
- const [screenMinX, screenMinY] = applyToPoint25(
2764
+ const [screenMinX, screenMinY] = applyToPoint26(
2750
2765
  compose7(realToScreenTransform, transformFromSymbolToReal),
2751
2766
  [bounds.minX, bounds.minY]
2752
2767
  );
2753
- const [screenMaxX, screenMaxY] = applyToPoint25(
2768
+ const [screenMaxX, screenMaxY] = applyToPoint26(
2754
2769
  compose7(realToScreenTransform, transformFromSymbolToReal),
2755
2770
  [bounds.maxX, bounds.maxY]
2756
2771
  );
@@ -2779,7 +2794,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
2779
2794
  name: "path",
2780
2795
  attributes: {
2781
2796
  d: points.map((p, i) => {
2782
- const [x, y] = applyToPoint25(
2797
+ const [x, y] = applyToPoint26(
2783
2798
  compose7(realToScreenTransform, transformFromSymbolToReal),
2784
2799
  [p.x, p.y]
2785
2800
  );
@@ -2794,7 +2809,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
2794
2809
  });
2795
2810
  }
2796
2811
  for (const text of texts) {
2797
- const screenTextPos = applyToPoint25(
2812
+ const screenTextPos = applyToPoint26(
2798
2813
  compose7(realToScreenTransform, transformFromSymbolToReal),
2799
2814
  text
2800
2815
  );
@@ -2840,7 +2855,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
2840
2855
  });
2841
2856
  }
2842
2857
  for (const box of boxes) {
2843
- const screenBoxPos = applyToPoint25(
2858
+ const screenBoxPos = applyToPoint26(
2844
2859
  compose7(realToScreenTransform, transformFromSymbolToReal),
2845
2860
  box
2846
2861
  );
@@ -2863,7 +2878,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
2863
2878
  });
2864
2879
  }
2865
2880
  for (const port of symbol.ports) {
2866
- const screenPortPos = applyToPoint25(
2881
+ const screenPortPos = applyToPoint26(
2867
2882
  compose7(realToScreenTransform, transformFromSymbolToReal),
2868
2883
  port
2869
2884
  );
@@ -2883,7 +2898,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
2883
2898
  });
2884
2899
  }
2885
2900
  for (const circle of circles) {
2886
- const screenCirclePos = applyToPoint25(
2901
+ const screenCirclePos = applyToPoint26(
2887
2902
  compose7(realToScreenTransform, transformFromSymbolToReal),
2888
2903
  circle
2889
2904
  );
@@ -2910,14 +2925,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
2910
2925
  import { su as su7 } from "@tscircuit/circuit-json-util";
2911
2926
  import "schematic-symbols";
2912
2927
  import "svgson";
2913
- import { applyToPoint as applyToPoint31 } from "transformation-matrix";
2928
+ import { applyToPoint as applyToPoint32 } from "transformation-matrix";
2914
2929
 
2915
2930
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
2916
2931
  import "transformation-matrix";
2917
2932
  import "@tscircuit/circuit-json-util";
2918
2933
 
2919
2934
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
2920
- import { applyToPoint as applyToPoint26 } from "transformation-matrix";
2935
+ import { applyToPoint as applyToPoint27 } from "transformation-matrix";
2921
2936
  import { su as su5 } from "@tscircuit/circuit-json-util";
2922
2937
  var PIN_CIRCLE_RADIUS_MM = 0.02;
2923
2938
  var createSvgObjectsForSchPortBoxLine = ({
@@ -2947,8 +2962,8 @@ var createSvgObjectsForSchPortBoxLine = ({
2947
2962
  realEdgePos.y += realPinLineLength;
2948
2963
  break;
2949
2964
  }
2950
- const screenSchPortPos = applyToPoint26(transform, schPort.center);
2951
- const screenRealEdgePos = applyToPoint26(transform, realEdgePos);
2965
+ const screenSchPortPos = applyToPoint27(transform, schPort.center);
2966
+ const screenRealEdgePos = applyToPoint27(transform, realEdgePos);
2952
2967
  const realLineEnd = { ...schPort.center };
2953
2968
  switch (schPort.side_of_component) {
2954
2969
  case "left":
@@ -2964,7 +2979,7 @@ var createSvgObjectsForSchPortBoxLine = ({
2964
2979
  realLineEnd.y += PIN_CIRCLE_RADIUS_MM;
2965
2980
  break;
2966
2981
  }
2967
- const screenLineEnd = applyToPoint26(transform, realLineEnd);
2982
+ const screenLineEnd = applyToPoint27(transform, realLineEnd);
2968
2983
  svgObjects.push({
2969
2984
  name: "line",
2970
2985
  type: "element",
@@ -3011,7 +3026,7 @@ var getUnitVectorFromOutsideToEdge = (side) => {
3011
3026
  };
3012
3027
 
3013
3028
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
3014
- import { applyToPoint as applyToPoint27 } from "transformation-matrix";
3029
+ import { applyToPoint as applyToPoint28 } from "transformation-matrix";
3015
3030
  var createSvgObjectsForSchPortPinNumberText = (params) => {
3016
3031
  const svgObjects = [];
3017
3032
  const { schPort, schComponent, transform, circuitJson } = params;
@@ -3029,7 +3044,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
3029
3044
  } else {
3030
3045
  realPinNumberPos.y += 0.02;
3031
3046
  }
3032
- const screenPinNumberTextPos = applyToPoint27(transform, realPinNumberPos);
3047
+ const screenPinNumberTextPos = applyToPoint28(transform, realPinNumberPos);
3033
3048
  svgObjects.push({
3034
3049
  name: "text",
3035
3050
  type: "element",
@@ -3059,7 +3074,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
3059
3074
  };
3060
3075
 
3061
3076
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
3062
- import { applyToPoint as applyToPoint28 } from "transformation-matrix";
3077
+ import { applyToPoint as applyToPoint29 } from "transformation-matrix";
3063
3078
  var LABEL_DIST_FROM_EDGE_MM = 0.1;
3064
3079
  var createSvgObjectsForSchPortPinLabel = (params) => {
3065
3080
  const svgObjects = [];
@@ -3073,7 +3088,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
3073
3088
  const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
3074
3089
  realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
3075
3090
  realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
3076
- const screenPinNumberTextPos = applyToPoint28(transform, realPinNumberPos);
3091
+ const screenPinNumberTextPos = applyToPoint29(transform, realPinNumberPos);
3077
3092
  const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
3078
3093
  if (!label) return [];
3079
3094
  svgObjects.push({
@@ -3115,13 +3130,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
3115
3130
  };
3116
3131
 
3117
3132
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
3118
- import { applyToPoint as applyToPoint30 } from "transformation-matrix";
3133
+ import { applyToPoint as applyToPoint31 } from "transformation-matrix";
3119
3134
  var createSvgSchText = ({
3120
3135
  elm,
3121
3136
  transform,
3122
3137
  colorMap: colorMap2
3123
3138
  }) => {
3124
- const center = applyToPoint30(transform, elm.position);
3139
+ const center = applyToPoint31(transform, elm.position);
3125
3140
  const textAnchorMap = {
3126
3141
  center: "middle",
3127
3142
  center_right: "end",
@@ -3186,11 +3201,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
3186
3201
  colorMap: colorMap2
3187
3202
  }) => {
3188
3203
  const svgObjects = [];
3189
- const componentScreenTopLeft = applyToPoint31(transform, {
3204
+ const componentScreenTopLeft = applyToPoint32(transform, {
3190
3205
  x: schComponent.center.x - schComponent.size.width / 2,
3191
3206
  y: schComponent.center.y + schComponent.size.height / 2
3192
3207
  });
3193
- const componentScreenBottomRight = applyToPoint31(transform, {
3208
+ const componentScreenBottomRight = applyToPoint32(transform, {
3194
3209
  x: schComponent.center.x + schComponent.size.width / 2,
3195
3210
  y: schComponent.center.y - schComponent.size.height / 2
3196
3211
  });
@@ -3273,13 +3288,13 @@ function createSvgObjectsFromSchematicComponent(params) {
3273
3288
  }
3274
3289
 
3275
3290
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
3276
- import { applyToPoint as applyToPoint32 } from "transformation-matrix";
3291
+ import { applyToPoint as applyToPoint33 } from "transformation-matrix";
3277
3292
  function createSvgObjectsFromSchVoltageProbe({
3278
3293
  probe,
3279
3294
  transform,
3280
3295
  colorMap: colorMap2
3281
3296
  }) {
3282
- const [screenX, screenY] = applyToPoint32(transform, [
3297
+ const [screenX, screenY] = applyToPoint33(transform, [
3283
3298
  probe.position.x,
3284
3299
  probe.position.y
3285
3300
  ]);
@@ -3339,17 +3354,17 @@ function createSvgObjectsFromSchVoltageProbe({
3339
3354
  }
3340
3355
 
3341
3356
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
3342
- import { applyToPoint as applyToPoint33 } from "transformation-matrix";
3357
+ import { applyToPoint as applyToPoint34 } from "transformation-matrix";
3343
3358
  function createSvgObjectsFromSchDebugObject({
3344
3359
  debugObject,
3345
3360
  transform
3346
3361
  }) {
3347
3362
  if (debugObject.shape === "rect") {
3348
- let [screenLeft, screenTop] = applyToPoint33(transform, [
3363
+ let [screenLeft, screenTop] = applyToPoint34(transform, [
3349
3364
  debugObject.center.x - debugObject.size.width / 2,
3350
3365
  debugObject.center.y - debugObject.size.height / 2
3351
3366
  ]);
3352
- let [screenRight, screenBottom] = applyToPoint33(transform, [
3367
+ let [screenRight, screenBottom] = applyToPoint34(transform, [
3353
3368
  debugObject.center.x + debugObject.size.width / 2,
3354
3369
  debugObject.center.y + debugObject.size.height / 2
3355
3370
  ]);
@@ -3359,7 +3374,7 @@ function createSvgObjectsFromSchDebugObject({
3359
3374
  ];
3360
3375
  const width = Math.abs(screenRight - screenLeft);
3361
3376
  const height = Math.abs(screenBottom - screenTop);
3362
- const [screenCenterX, screenCenterY] = applyToPoint33(transform, [
3377
+ const [screenCenterX, screenCenterY] = applyToPoint34(transform, [
3363
3378
  debugObject.center.x,
3364
3379
  debugObject.center.y
3365
3380
  ]);
@@ -3405,11 +3420,11 @@ function createSvgObjectsFromSchDebugObject({
3405
3420
  ];
3406
3421
  }
3407
3422
  if (debugObject.shape === "line") {
3408
- const [screenStartX, screenStartY] = applyToPoint33(transform, [
3423
+ const [screenStartX, screenStartY] = applyToPoint34(transform, [
3409
3424
  debugObject.start.x,
3410
3425
  debugObject.start.y
3411
3426
  ]);
3412
- const [screenEndX, screenEndY] = applyToPoint33(transform, [
3427
+ const [screenEndX, screenEndY] = applyToPoint34(transform, [
3413
3428
  debugObject.end.x,
3414
3429
  debugObject.end.y
3415
3430
  ]);
@@ -3459,7 +3474,7 @@ function createSvgObjectsFromSchDebugObject({
3459
3474
  }
3460
3475
 
3461
3476
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
3462
- import { applyToPoint as applyToPoint34 } from "transformation-matrix";
3477
+ import { applyToPoint as applyToPoint35 } from "transformation-matrix";
3463
3478
  function createSchematicTrace({
3464
3479
  trace,
3465
3480
  transform,
@@ -3472,11 +3487,11 @@ function createSchematicTrace({
3472
3487
  for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
3473
3488
  const edge = edges[edgeIndex];
3474
3489
  if (edge.is_crossing) continue;
3475
- const [screenFromX, screenFromY] = applyToPoint34(transform, [
3490
+ const [screenFromX, screenFromY] = applyToPoint35(transform, [
3476
3491
  edge.from.x,
3477
3492
  edge.from.y
3478
3493
  ]);
3479
- const [screenToX, screenToY] = applyToPoint34(transform, [
3494
+ const [screenToX, screenToY] = applyToPoint35(transform, [
3480
3495
  edge.to.x,
3481
3496
  edge.to.y
3482
3497
  ]);
@@ -3488,11 +3503,11 @@ function createSchematicTrace({
3488
3503
  }
3489
3504
  for (const edge of edges) {
3490
3505
  if (!edge.is_crossing) continue;
3491
- const [screenFromX, screenFromY] = applyToPoint34(transform, [
3506
+ const [screenFromX, screenFromY] = applyToPoint35(transform, [
3492
3507
  edge.from.x,
3493
3508
  edge.from.y
3494
3509
  ]);
3495
- const [screenToX, screenToY] = applyToPoint34(transform, [
3510
+ const [screenToX, screenToY] = applyToPoint35(transform, [
3496
3511
  edge.to.x,
3497
3512
  edge.to.y
3498
3513
  ]);
@@ -3568,7 +3583,7 @@ function createSchematicTrace({
3568
3583
  }
3569
3584
  if (trace.junctions) {
3570
3585
  for (const junction of trace.junctions) {
3571
- const [screenX, screenY] = applyToPoint34(transform, [
3586
+ const [screenX, screenY] = applyToPoint35(transform, [
3572
3587
  junction.x,
3573
3588
  junction.y
3574
3589
  ]);
@@ -3603,7 +3618,7 @@ function createSchematicTrace({
3603
3618
 
3604
3619
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
3605
3620
  import {
3606
- applyToPoint as applyToPoint36,
3621
+ applyToPoint as applyToPoint37,
3607
3622
  compose as compose9,
3608
3623
  rotate as rotate5,
3609
3624
  scale as scale6,
@@ -4391,7 +4406,7 @@ var estimateTextWidth = (text) => {
4391
4406
 
4392
4407
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
4393
4408
  import {
4394
- applyToPoint as applyToPoint35,
4409
+ applyToPoint as applyToPoint36,
4395
4410
  compose as compose8,
4396
4411
  rotate as rotate4,
4397
4412
  scale as scale5,
@@ -4515,7 +4530,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
4515
4530
  x: symbolBounds.minX,
4516
4531
  y: (symbolBounds.minY + symbolBounds.maxY) / 2
4517
4532
  };
4518
- const rotatedSymbolEnd = applyToPoint35(rotationMatrix, symbolEndPoint);
4533
+ const rotatedSymbolEnd = applyToPoint36(rotationMatrix, symbolEndPoint);
4519
4534
  const symbolToRealTransform = compose8(
4520
4535
  translate8(
4521
4536
  realAnchorPosition.x - rotatedSymbolEnd.x,
@@ -4525,11 +4540,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
4525
4540
  scale5(1)
4526
4541
  // Use full symbol size
4527
4542
  );
4528
- const [screenMinX, screenMinY] = applyToPoint35(
4543
+ const [screenMinX, screenMinY] = applyToPoint36(
4529
4544
  compose8(realToScreenTransform, symbolToRealTransform),
4530
4545
  [bounds.minX, bounds.minY]
4531
4546
  );
4532
- const [screenMaxX, screenMaxY] = applyToPoint35(
4547
+ const [screenMaxX, screenMaxY] = applyToPoint36(
4533
4548
  compose8(realToScreenTransform, symbolToRealTransform),
4534
4549
  [bounds.maxX, bounds.maxY]
4535
4550
  );
@@ -4553,7 +4568,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
4553
4568
  });
4554
4569
  for (const path of symbolPaths) {
4555
4570
  const symbolPath = path.points.map((p, i) => {
4556
- const [x, y] = applyToPoint35(
4571
+ const [x, y] = applyToPoint36(
4557
4572
  compose8(realToScreenTransform, symbolToRealTransform),
4558
4573
  [p.x, p.y]
4559
4574
  );
@@ -4573,7 +4588,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
4573
4588
  });
4574
4589
  }
4575
4590
  for (const text of symbolTexts) {
4576
- const screenTextPos = applyToPoint35(
4591
+ const screenTextPos = applyToPoint36(
4577
4592
  compose8(realToScreenTransform, symbolToRealTransform),
4578
4593
  text
4579
4594
  );
@@ -4615,7 +4630,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
4615
4630
  });
4616
4631
  }
4617
4632
  for (const box of symbolBoxes) {
4618
- const screenBoxPos = applyToPoint35(
4633
+ const screenBoxPos = applyToPoint36(
4619
4634
  compose8(realToScreenTransform, symbolToRealTransform),
4620
4635
  box
4621
4636
  );
@@ -4638,7 +4653,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
4638
4653
  });
4639
4654
  }
4640
4655
  for (const circle of symbolCircles) {
4641
- const screenCirclePos = applyToPoint35(
4656
+ const screenCirclePos = applyToPoint36(
4642
4657
  compose8(realToScreenTransform, symbolToRealTransform),
4643
4658
  circle
4644
4659
  );
@@ -4682,14 +4697,14 @@ var createSvgObjectsForSchNetLabel = ({
4682
4697
  const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
4683
4698
  const fontSizeMm = getSchMmFontSize("net_label");
4684
4699
  const textWidthFSR = estimateTextWidth(schNetLabel.text || "");
4685
- const screenCenter = applyToPoint36(realToScreenTransform, schNetLabel.center);
4700
+ const screenCenter = applyToPoint37(realToScreenTransform, schNetLabel.center);
4686
4701
  const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
4687
4702
  schNetLabel.anchor_side
4688
4703
  );
4689
4704
  const screenTextGrowthVec = { ...realTextGrowthVec };
4690
4705
  screenTextGrowthVec.y *= -1;
4691
4706
  const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * schNetLabel.text.length + END_PADDING_FSR;
4692
- const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint36(realToScreenTransform, schNetLabel.anchor_position) : {
4707
+ const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint37(realToScreenTransform, schNetLabel.anchor_position) : {
4693
4708
  x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
4694
4709
  y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
4695
4710
  };
@@ -4730,7 +4745,7 @@ var createSvgObjectsForSchNetLabel = ({
4730
4745
  y: -0.6
4731
4746
  }
4732
4747
  ].map(
4733
- (fontRelativePoint) => applyToPoint36(
4748
+ (fontRelativePoint) => applyToPoint37(
4734
4749
  compose9(
4735
4750
  realToScreenTransform,
4736
4751
  translate9(realAnchorPosition.x, realAnchorPosition.y),
@@ -4807,17 +4822,17 @@ var createSvgObjectsForSchNetLabel = ({
4807
4822
  };
4808
4823
 
4809
4824
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
4810
- import { applyToPoint as applyToPoint37 } from "transformation-matrix";
4825
+ import { applyToPoint as applyToPoint38 } from "transformation-matrix";
4811
4826
  var createSvgObjectsFromSchematicBox = ({
4812
4827
  schematicBox,
4813
4828
  transform,
4814
4829
  colorMap: colorMap2
4815
4830
  }) => {
4816
- const topLeft = applyToPoint37(transform, {
4831
+ const topLeft = applyToPoint38(transform, {
4817
4832
  x: schematicBox.x,
4818
4833
  y: schematicBox.y
4819
4834
  });
4820
- const bottomRight = applyToPoint37(transform, {
4835
+ const bottomRight = applyToPoint38(transform, {
4821
4836
  x: schematicBox.x + schematicBox.width,
4822
4837
  y: schematicBox.y + schematicBox.height
4823
4838
  });
@@ -5051,18 +5066,18 @@ var circuitJsonToSchematicSvg = convertCircuitJsonToSchematicSvg;
5051
5066
  // lib/pcb/convert-circuit-json-to-solder-paste-mask.ts
5052
5067
  import { stringify as stringify4 } from "svgson";
5053
5068
  import {
5054
- applyToPoint as applyToPoint40,
5069
+ applyToPoint as applyToPoint41,
5055
5070
  compose as compose11,
5056
5071
  scale as scale8,
5057
5072
  translate as translate11
5058
5073
  } from "transformation-matrix";
5059
5074
 
5060
5075
  // lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
5061
- import { applyToPoint as applyToPoint39 } from "transformation-matrix";
5076
+ import { applyToPoint as applyToPoint40 } from "transformation-matrix";
5062
5077
  function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
5063
5078
  const { transform, layer: layerFilter } = ctx;
5064
5079
  if (layerFilter && solderPaste.layer !== layerFilter) return [];
5065
- const [x, y] = applyToPoint39(transform, [solderPaste.x, solderPaste.y]);
5080
+ const [x, y] = applyToPoint40(transform, [solderPaste.x, solderPaste.y]);
5066
5081
  if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
5067
5082
  const width = solderPaste.width * Math.abs(transform.a);
5068
5083
  const height = solderPaste.height * Math.abs(transform.d);
@@ -5257,8 +5272,8 @@ function createSvgObjects3({ elm, ctx }) {
5257
5272
  }
5258
5273
  }
5259
5274
  function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
5260
- const [x1, y1] = applyToPoint40(transform, [minX, minY]);
5261
- const [x2, y2] = applyToPoint40(transform, [maxX, maxY]);
5275
+ const [x1, y1] = applyToPoint41(transform, [minX, minY]);
5276
+ const [x2, y2] = applyToPoint41(transform, [maxX, maxY]);
5262
5277
  const width = Math.abs(x2 - x1);
5263
5278
  const height = Math.abs(y2 - y1);
5264
5279
  const x = Math.min(x1, x2);