circuit-to-svg 0.0.102 → 0.0.103

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 applyToPoint13,
4
+ applyToPoint as applyToPoint16,
5
5
  compose as compose3,
6
6
  scale,
7
7
  translate as translate3
@@ -374,6 +374,129 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, transform) {
374
374
  return [svgObject];
375
375
  }
376
376
 
377
+ // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-rect.ts
378
+ import {
379
+ applyToPoint as applyToPoint7
380
+ } from "transformation-matrix";
381
+ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, transform) {
382
+ const {
383
+ center,
384
+ width,
385
+ height,
386
+ layer = "top",
387
+ pcb_silkscreen_rect_id
388
+ } = pcbSilkscreenRect;
389
+ if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof width !== "number" || typeof height !== "number") {
390
+ console.error("Invalid rectangle data:", { center, width, height });
391
+ return [];
392
+ }
393
+ const [transformedX, transformedY] = applyToPoint7(transform, [
394
+ center.x,
395
+ center.y
396
+ ]);
397
+ const transformedWidth = width * Math.abs(transform.a);
398
+ const transformedHeight = height * Math.abs(transform.d);
399
+ const svgObject = {
400
+ name: "rect",
401
+ type: "element",
402
+ attributes: {
403
+ x: (transformedX - transformedWidth / 2).toString(),
404
+ y: (transformedY - transformedHeight / 2).toString(),
405
+ width: transformedWidth.toString(),
406
+ height: transformedHeight.toString(),
407
+ class: `pcb-silkscreen-rect pcb-silkscreen-${layer}`,
408
+ stroke: "red",
409
+ "stroke-width": "1",
410
+ "data-pcb-silkscreen-rect-id": pcb_silkscreen_rect_id
411
+ },
412
+ value: "",
413
+ children: []
414
+ };
415
+ return [svgObject];
416
+ }
417
+
418
+ // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-circle.ts
419
+ import {
420
+ applyToPoint as applyToPoint8
421
+ } from "transformation-matrix";
422
+ function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, transform) {
423
+ const {
424
+ center,
425
+ radius,
426
+ layer = "top",
427
+ pcb_silkscreen_circle_id
428
+ } = pcbSilkscreenCircle;
429
+ if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof radius !== "number") {
430
+ console.error("Invalid PCB Silkscreen Circle data:", { center, radius });
431
+ return [];
432
+ }
433
+ const [transformedX, transformedY] = applyToPoint8(transform, [
434
+ center.x,
435
+ center.y
436
+ ]);
437
+ const transformedRadius = radius * Math.abs(transform.a);
438
+ console.debug(
439
+ `Transformed Circle - X: ${transformedX}, Y: ${transformedY}, Radius: ${transformedRadius}`
440
+ );
441
+ const svgObject = {
442
+ name: "circle",
443
+ type: "element",
444
+ attributes: {
445
+ cx: transformedX.toString(),
446
+ cy: transformedY.toString(),
447
+ r: transformedRadius.toString(),
448
+ class: `pcb-silkscreen-circle pcb-silkscreen-${layer}`,
449
+ stroke: "red",
450
+ "stroke-width": "3",
451
+ "data-pcb-silkscreen-circle-id": pcb_silkscreen_circle_id
452
+ },
453
+ value: "",
454
+ children: []
455
+ };
456
+ console.log(svgObject);
457
+ return [svgObject];
458
+ }
459
+
460
+ // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-line.ts
461
+ import {
462
+ applyToPoint as applyToPoint9
463
+ } from "transformation-matrix";
464
+ function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, transform) {
465
+ const {
466
+ x1,
467
+ y1,
468
+ x2,
469
+ y2,
470
+ stroke_width,
471
+ layer = "top",
472
+ pcb_silkscreen_line_id
473
+ } = pcbSilkscreenLine;
474
+ if (typeof x1 !== "number" || typeof y1 !== "number" || typeof x2 !== "number" || typeof y2 !== "number") {
475
+ console.error("Invalid coordinates:", { x1, y1, x2, y2 });
476
+ return [];
477
+ }
478
+ const [transformedX1, transformedY1] = applyToPoint9(transform, [x1, y1]);
479
+ const [transformedX2, transformedY2] = applyToPoint9(transform, [x2, y2]);
480
+ const transformedStrokeWidth = stroke_width * Math.abs(transform.a);
481
+ return [
482
+ {
483
+ name: "line",
484
+ type: "element",
485
+ attributes: {
486
+ x1: transformedX1.toString(),
487
+ y1: transformedY1.toString(),
488
+ x2: transformedX2.toString(),
489
+ y2: transformedY2.toString(),
490
+ "stroke-width": transformedStrokeWidth.toString(),
491
+ class: `pcb-silkscreen-line pcb-silkscreen-${layer}`,
492
+ "data-pcb-silkscreen-line-id": pcb_silkscreen_line_id
493
+ },
494
+ value: "",
495
+ children: []
496
+ }
497
+ ];
498
+ }
499
+
377
500
  // lib/utils/pairs.ts
378
501
  function pairs(arr) {
379
502
  const result = [];
@@ -384,7 +507,7 @@ function pairs(arr) {
384
507
  }
385
508
 
386
509
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-trace.ts
387
- import { applyToPoint as applyToPoint7 } from "transformation-matrix";
510
+ import { applyToPoint as applyToPoint10 } from "transformation-matrix";
388
511
 
389
512
  // lib/pcb/layer-name-to-color.ts
390
513
  var LAYER_NAME_TO_COLOR = {
@@ -402,8 +525,8 @@ function createSvgObjectsFromPcbTrace(trace, transform) {
402
525
  const segments = pairs(trace.route);
403
526
  const svgObjects = [];
404
527
  for (const [start, end] of segments) {
405
- const startPoint = applyToPoint7(transform, [start.x, start.y]);
406
- const endPoint = applyToPoint7(transform, [end.x, end.y]);
528
+ const startPoint = applyToPoint10(transform, [start.x, start.y]);
529
+ const endPoint = applyToPoint10(transform, [end.x, end.y]);
407
530
  const layer = "layer" in start ? start.layer : "layer" in end ? end.layer : null;
408
531
  if (!layer) continue;
409
532
  const layerColor = LAYER_NAME_TO_COLOR[layer] ?? "white";
@@ -428,9 +551,9 @@ function createSvgObjectsFromPcbTrace(trace, transform) {
428
551
  }
429
552
 
430
553
  // lib/pcb/svg-object-fns/create-svg-objects-from-smt-pads.ts
431
- import { applyToPoint as applyToPoint8 } from "transformation-matrix";
554
+ import { applyToPoint as applyToPoint11 } from "transformation-matrix";
432
555
  function createSvgObjectsFromSmtPad(pad, transform) {
433
- const [x, y] = applyToPoint8(transform, [pad.x, pad.y]);
556
+ const [x, y] = applyToPoint11(transform, [pad.x, pad.y]);
434
557
  if (pad.shape === "rect" || pad.shape === "rotated_rect") {
435
558
  const width = pad.width * Math.abs(transform.a);
436
559
  const height = pad.height * Math.abs(transform.d);
@@ -491,31 +614,31 @@ function createSvgObjectsFromSmtPad(pad, transform) {
491
614
  }
492
615
 
493
616
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-board.ts
494
- import { applyToPoint as applyToPoint9 } from "transformation-matrix";
617
+ import { applyToPoint as applyToPoint12 } from "transformation-matrix";
495
618
  function createSvgObjectsFromPcbBoard(pcbBoard, transform) {
496
619
  const { width, height, center, outline } = pcbBoard;
497
620
  let path;
498
621
  if (outline && Array.isArray(outline) && outline.length >= 3) {
499
622
  path = outline.map((point, index) => {
500
- const [x, y] = applyToPoint9(transform, [point.x, point.y]);
623
+ const [x, y] = applyToPoint12(transform, [point.x, point.y]);
501
624
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
502
625
  }).join(" ");
503
626
  } else {
504
627
  const halfWidth = width / 2;
505
628
  const halfHeight = height / 2;
506
- const topLeft = applyToPoint9(transform, [
629
+ const topLeft = applyToPoint12(transform, [
507
630
  center.x - halfWidth,
508
631
  center.y - halfHeight
509
632
  ]);
510
- const topRight = applyToPoint9(transform, [
633
+ const topRight = applyToPoint12(transform, [
511
634
  center.x + halfWidth,
512
635
  center.y - halfHeight
513
636
  ]);
514
- const bottomRight = applyToPoint9(transform, [
637
+ const bottomRight = applyToPoint12(transform, [
515
638
  center.x + halfWidth,
516
639
  center.y + halfHeight
517
640
  ]);
518
- const bottomLeft = applyToPoint9(transform, [
641
+ const bottomLeft = applyToPoint12(transform, [
519
642
  center.x - halfWidth,
520
643
  center.y + halfHeight
521
644
  ]);
@@ -539,9 +662,9 @@ function createSvgObjectsFromPcbBoard(pcbBoard, transform) {
539
662
  }
540
663
 
541
664
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-via.ts
542
- import { applyToPoint as applyToPoint10 } from "transformation-matrix";
665
+ import { applyToPoint as applyToPoint13 } from "transformation-matrix";
543
666
  function createSvgObjectsFromPcbVia(hole, transform) {
544
- const [x, y] = applyToPoint10(transform, [hole.x, hole.y]);
667
+ const [x, y] = applyToPoint13(transform, [hole.x, hole.y]);
545
668
  const scaledOuterWidth = hole.outer_diameter * Math.abs(transform.a);
546
669
  const scaledOuterHeight = hole.outer_diameter * Math.abs(transform.a);
547
670
  const scaledHoleWidth = hole.hole_diameter * Math.abs(transform.a);
@@ -577,14 +700,14 @@ function createSvgObjectsFromPcbVia(hole, transform) {
577
700
  }
578
701
 
579
702
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-hole.ts
580
- import { applyToPoint as applyToPoint11 } from "transformation-matrix";
703
+ import { applyToPoint as applyToPoint14 } from "transformation-matrix";
581
704
 
582
705
  // lib/pcb/colors.ts
583
706
  var HOLE_COLOR = "#FF26E2";
584
707
 
585
708
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-hole.ts
586
709
  function createSvgObjectsFromPcbHole(hole, transform) {
587
- const [x, y] = applyToPoint11(transform, [hole.x, hole.y]);
710
+ const [x, y] = applyToPoint14(transform, [hole.x, hole.y]);
588
711
  if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
589
712
  const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
590
713
  const radius = scaledDiameter / 2;
@@ -652,7 +775,7 @@ import {
652
775
  getFullConnectivityMapFromCircuitJson
653
776
  } from "circuit-json-to-connectivity-map";
654
777
  import "svgson";
655
- import { applyToPoint as applyToPoint12 } from "transformation-matrix";
778
+ import { applyToPoint as applyToPoint15 } from "transformation-matrix";
656
779
 
657
780
  // lib/pcb/create-svg-objects-from-pcb-rats-nest/get-element-position.ts
658
781
  import { su } from "@tscircuit/soup-util";
@@ -731,11 +854,11 @@ function createSvgObjectsForRatsNest(circuitJson, transform) {
731
854
  });
732
855
  const svgObjects = [];
733
856
  for (const line of ratsNestLines) {
734
- const transformedStart = applyToPoint12(transform, [
857
+ const transformedStart = applyToPoint15(transform, [
735
858
  line.startPoint.x,
736
859
  line.startPoint.y
737
860
  ]);
738
- const transformedEnd = applyToPoint12(transform, [
861
+ const transformedEnd = applyToPoint15(transform, [
739
862
  line.endPoint.x,
740
863
  line.endPoint.y
741
864
  ]);
@@ -929,6 +1052,12 @@ function createSvgObjects(elm, transform, soup, shouldDrawErrors) {
929
1052
  return createSvgObjectsFromSmtPad(elm, transform);
930
1053
  case "pcb_silkscreen_text":
931
1054
  return createSvgObjectsFromPcbSilkscreenText(elm, transform);
1055
+ case "pcb_silkscreen_rect":
1056
+ return createSvgObjectsFromPcbSilkscreenRect(elm, transform);
1057
+ case "pcb_silkscreen_circle":
1058
+ return createSvgObjectsFromPcbSilkscreenCircle(elm, transform);
1059
+ case "pcb_silkscreen_line":
1060
+ return createSvgObjectsFromPcbSilkscreenLine(elm, transform);
932
1061
  case "pcb_fabrication_note_path":
933
1062
  return createSvgObjectsFromPcbFabricationNotePath(elm, transform);
934
1063
  case "pcb_fabrication_note_text":
@@ -945,7 +1074,7 @@ function createSvgObjects(elm, transform, soup, shouldDrawErrors) {
945
1074
  }
946
1075
  function createSvgObjectsFromPcbComponent(component, transform) {
947
1076
  const { center, width, height, rotation = 0 } = component;
948
- const [x, y] = applyToPoint13(transform, [center.x, center.y]);
1077
+ const [x, y] = applyToPoint16(transform, [center.x, center.y]);
949
1078
  const scaledWidth = width * Math.abs(transform.a);
950
1079
  const scaledHeight = height * Math.abs(transform.d);
951
1080
  const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
@@ -980,8 +1109,8 @@ function createSvgObjectsFromPcbComponent(component, transform) {
980
1109
  };
981
1110
  }
982
1111
  function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
983
- const [x1, y1] = applyToPoint13(transform, [minX, minY]);
984
- const [x2, y2] = applyToPoint13(transform, [maxX, maxY]);
1112
+ const [x1, y1] = applyToPoint16(transform, [minX, minY]);
1113
+ const [x2, y2] = applyToPoint16(transform, [maxX, maxY]);
985
1114
  const width = Math.abs(x2 - x1);
986
1115
  const height = Math.abs(y2 - y1);
987
1116
  const x = Math.min(x1, x2);
@@ -1006,14 +1135,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
1006
1135
  import { stringify as stringify2 } from "svgson";
1007
1136
  import { su as su3 } from "@tscircuit/soup-util";
1008
1137
  import {
1009
- applyToPoint as applyToPoint17,
1138
+ applyToPoint as applyToPoint20,
1010
1139
  compose as compose4,
1011
1140
  scale as scale2,
1012
1141
  translate as translate4
1013
1142
  } from "transformation-matrix";
1014
1143
 
1015
1144
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
1016
- import { applyToPoint as applyToPoint14 } from "transformation-matrix";
1145
+ import { applyToPoint as applyToPoint17 } from "transformation-matrix";
1017
1146
  var DEFAULT_BOARD_STYLE = {
1018
1147
  fill: "none",
1019
1148
  stroke: "rgb(0,0,0)",
@@ -1025,25 +1154,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
1025
1154
  let path;
1026
1155
  if (outline && Array.isArray(outline) && outline.length >= 3) {
1027
1156
  path = outline.map((point, index) => {
1028
- const [x, y] = applyToPoint14(transform, [point.x, point.y]);
1157
+ const [x, y] = applyToPoint17(transform, [point.x, point.y]);
1029
1158
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
1030
1159
  }).join(" ");
1031
1160
  } else {
1032
1161
  const halfWidth = width / 2;
1033
1162
  const halfHeight = height / 2;
1034
- const topLeft = applyToPoint14(transform, [
1163
+ const topLeft = applyToPoint17(transform, [
1035
1164
  center.x - halfWidth,
1036
1165
  center.y - halfHeight
1037
1166
  ]);
1038
- const topRight = applyToPoint14(transform, [
1167
+ const topRight = applyToPoint17(transform, [
1039
1168
  center.x + halfWidth,
1040
1169
  center.y - halfHeight
1041
1170
  ]);
1042
- const bottomRight = applyToPoint14(transform, [
1171
+ const bottomRight = applyToPoint17(transform, [
1043
1172
  center.x + halfWidth,
1044
1173
  center.y + halfHeight
1045
1174
  ]);
1046
- const bottomLeft = applyToPoint14(transform, [
1175
+ const bottomLeft = applyToPoint17(transform, [
1047
1176
  center.x - halfWidth,
1048
1177
  center.y + halfHeight
1049
1178
  ]);
@@ -1069,7 +1198,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
1069
1198
  }
1070
1199
 
1071
1200
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
1072
- import { applyToPoint as applyToPoint16 } from "transformation-matrix";
1201
+ import { applyToPoint as applyToPoint19 } from "transformation-matrix";
1073
1202
 
1074
1203
  // lib/utils/get-sch-font-size.ts
1075
1204
  import "transformation-matrix";
@@ -1083,8 +1212,8 @@ var getSchScreenFontSize = (transform, textType) => {
1083
1212
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
1084
1213
  function createSvgObjectsFromAssemblyComponent(component, transform, firstPin, name) {
1085
1214
  const { center, width, height, rotation = 0 } = component;
1086
- const [x, y] = applyToPoint16(transform, [center.x, center.y]);
1087
- const [pinX, pinY] = applyToPoint16(transform, [firstPin.x, firstPin.y]);
1215
+ const [x, y] = applyToPoint19(transform, [center.x, center.y]);
1216
+ const [pinX, pinY] = applyToPoint19(transform, [firstPin.x, firstPin.y]);
1088
1217
  const scaledWidth = width * Math.abs(transform.a);
1089
1218
  const scaledHeight = height * Math.abs(transform.d);
1090
1219
  return {
@@ -1320,8 +1449,8 @@ function createSvgObjects2(elm, transform, soup) {
1320
1449
  }
1321
1450
  }
1322
1451
  function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
1323
- const [x1, y1] = applyToPoint17(transform, [minX, minY]);
1324
- const [x2, y2] = applyToPoint17(transform, [maxX, maxY]);
1452
+ const [x1, y1] = applyToPoint20(transform, [minX, minY]);
1453
+ const [x2, y2] = applyToPoint20(transform, [maxX, maxY]);
1325
1454
  const width = Math.abs(x2 - x1);
1326
1455
  const height = Math.abs(y2 - y1);
1327
1456
  const x = Math.min(x1, x2);
@@ -1586,14 +1715,14 @@ import {
1586
1715
  } from "transformation-matrix";
1587
1716
 
1588
1717
  // lib/sch/draw-schematic-grid.ts
1589
- import { applyToPoint as applyToPoint18 } from "transformation-matrix";
1718
+ import { applyToPoint as applyToPoint21 } from "transformation-matrix";
1590
1719
  function drawSchematicGrid(params) {
1591
1720
  const { minX, minY, maxX, maxY } = params.bounds;
1592
1721
  const cellSize = params.cellSize ?? 1;
1593
1722
  const labelCells = params.labelCells ?? false;
1594
1723
  const gridLines = [];
1595
1724
  const transformPoint = (x, y) => {
1596
- const [transformedX, transformedY] = applyToPoint18(params.transform, [x, y]);
1725
+ const [transformedX, transformedY] = applyToPoint21(params.transform, [x, y]);
1597
1726
  return { x: transformedX, y: transformedY };
1598
1727
  };
1599
1728
  for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
@@ -1674,15 +1803,15 @@ function drawSchematicGrid(params) {
1674
1803
  }
1675
1804
 
1676
1805
  // lib/sch/draw-schematic-labeled-points.ts
1677
- import { applyToPoint as applyToPoint19 } from "transformation-matrix";
1806
+ import { applyToPoint as applyToPoint22 } from "transformation-matrix";
1678
1807
  function drawSchematicLabeledPoints(params) {
1679
1808
  const { points, transform } = params;
1680
1809
  const labeledPointsGroup = [];
1681
1810
  for (const point of points) {
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]);
1811
+ const [x1, y1] = applyToPoint22(transform, [point.x - 0.1, point.y - 0.1]);
1812
+ const [x2, y2] = applyToPoint22(transform, [point.x + 0.1, point.y + 0.1]);
1813
+ const [x3, y3] = applyToPoint22(transform, [point.x - 0.1, point.y + 0.1]);
1814
+ const [x4, y4] = applyToPoint22(transform, [point.x + 0.1, point.y - 0.1]);
1686
1815
  labeledPointsGroup.push({
1687
1816
  name: "path",
1688
1817
  type: "element",
@@ -1693,7 +1822,7 @@ function drawSchematicLabeledPoints(params) {
1693
1822
  "stroke-opacity": "0.7"
1694
1823
  }
1695
1824
  });
1696
- const [labelX, labelY] = applyToPoint19(transform, [
1825
+ const [labelX, labelY] = applyToPoint22(transform, [
1697
1826
  point.x + 0.15,
1698
1827
  point.y - 0.15
1699
1828
  ]);
@@ -1796,7 +1925,7 @@ import { su as su4 } from "@tscircuit/soup-util";
1796
1925
  import { symbols } from "schematic-symbols";
1797
1926
  import "svgson";
1798
1927
  import {
1799
- applyToPoint as applyToPoint21,
1928
+ applyToPoint as applyToPoint24,
1800
1929
  compose as compose6
1801
1930
  } from "transformation-matrix";
1802
1931
 
@@ -1880,13 +2009,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
1880
2009
  }
1881
2010
 
1882
2011
  // lib/sch/svg-object-fns/create-svg-error-text.ts
1883
- import { applyToPoint as applyToPoint20 } from "transformation-matrix";
2012
+ import { applyToPoint as applyToPoint23 } from "transformation-matrix";
1884
2013
  var createSvgSchErrorText = ({
1885
2014
  text,
1886
2015
  realCenter,
1887
2016
  realToScreenTransform
1888
2017
  }) => {
1889
- const screenCenter = applyToPoint20(realToScreenTransform, realCenter);
2018
+ const screenCenter = applyToPoint23(realToScreenTransform, realCenter);
1890
2019
  return {
1891
2020
  type: "element",
1892
2021
  name: "text",
@@ -1976,11 +2105,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
1976
2105
  minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
1977
2106
  maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
1978
2107
  };
1979
- const [screenMinX, screenMinY] = applyToPoint21(
2108
+ const [screenMinX, screenMinY] = applyToPoint24(
1980
2109
  compose6(realToScreenTransform, transformFromSymbolToReal),
1981
2110
  [bounds.minX, bounds.minY]
1982
2111
  );
1983
- const [screenMaxX, screenMaxY] = applyToPoint21(
2112
+ const [screenMaxX, screenMaxY] = applyToPoint24(
1984
2113
  compose6(realToScreenTransform, transformFromSymbolToReal),
1985
2114
  [bounds.maxX, bounds.maxY]
1986
2115
  );
@@ -2009,7 +2138,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
2009
2138
  name: "path",
2010
2139
  attributes: {
2011
2140
  d: points.map((p, i) => {
2012
- const [x, y] = applyToPoint21(
2141
+ const [x, y] = applyToPoint24(
2013
2142
  compose6(realToScreenTransform, transformFromSymbolToReal),
2014
2143
  [p.x, p.y]
2015
2144
  );
@@ -2024,7 +2153,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
2024
2153
  });
2025
2154
  }
2026
2155
  for (const text of texts) {
2027
- const screenTextPos = applyToPoint21(
2156
+ const screenTextPos = applyToPoint24(
2028
2157
  compose6(realToScreenTransform, transformFromSymbolToReal),
2029
2158
  text
2030
2159
  );
@@ -2070,7 +2199,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
2070
2199
  });
2071
2200
  }
2072
2201
  for (const box of boxes) {
2073
- const screenBoxPos = applyToPoint21(
2202
+ const screenBoxPos = applyToPoint24(
2074
2203
  compose6(realToScreenTransform, transformFromSymbolToReal),
2075
2204
  box
2076
2205
  );
@@ -2093,7 +2222,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
2093
2222
  });
2094
2223
  }
2095
2224
  for (const port of symbol.ports) {
2096
- const screenPortPos = applyToPoint21(
2225
+ const screenPortPos = applyToPoint24(
2097
2226
  compose6(realToScreenTransform, transformFromSymbolToReal),
2098
2227
  port
2099
2228
  );
@@ -2119,14 +2248,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
2119
2248
  import { su as su7 } from "@tscircuit/soup-util";
2120
2249
  import "schematic-symbols";
2121
2250
  import "svgson";
2122
- import { applyToPoint as applyToPoint27 } from "transformation-matrix";
2251
+ import { applyToPoint as applyToPoint30 } from "transformation-matrix";
2123
2252
 
2124
2253
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
2125
2254
  import "transformation-matrix";
2126
2255
  import "@tscircuit/soup-util";
2127
2256
 
2128
2257
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
2129
- import { applyToPoint as applyToPoint22 } from "transformation-matrix";
2258
+ import { applyToPoint as applyToPoint25 } from "transformation-matrix";
2130
2259
  import { su as su5 } from "@tscircuit/soup-util";
2131
2260
  var PIN_CIRCLE_RADIUS_MM = 0.02;
2132
2261
  var createSvgObjectsForSchPortBoxLine = ({
@@ -2156,8 +2285,8 @@ var createSvgObjectsForSchPortBoxLine = ({
2156
2285
  realEdgePos.y += realPinLineLength;
2157
2286
  break;
2158
2287
  }
2159
- const screenSchPortPos = applyToPoint22(transform, schPort.center);
2160
- const screenRealEdgePos = applyToPoint22(transform, realEdgePos);
2288
+ const screenSchPortPos = applyToPoint25(transform, schPort.center);
2289
+ const screenRealEdgePos = applyToPoint25(transform, realEdgePos);
2161
2290
  const realLineEnd = { ...schPort.center };
2162
2291
  switch (schPort.side_of_component) {
2163
2292
  case "left":
@@ -2173,7 +2302,7 @@ var createSvgObjectsForSchPortBoxLine = ({
2173
2302
  realLineEnd.y += PIN_CIRCLE_RADIUS_MM;
2174
2303
  break;
2175
2304
  }
2176
- const screenLineEnd = applyToPoint22(transform, realLineEnd);
2305
+ const screenLineEnd = applyToPoint25(transform, realLineEnd);
2177
2306
  svgObjects.push({
2178
2307
  name: "line",
2179
2308
  type: "element",
@@ -2220,7 +2349,7 @@ var getUnitVectorFromOutsideToEdge = (side) => {
2220
2349
  };
2221
2350
 
2222
2351
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
2223
- import { applyToPoint as applyToPoint23 } from "transformation-matrix";
2352
+ import { applyToPoint as applyToPoint26 } from "transformation-matrix";
2224
2353
  var createSvgObjectsForSchPortPinNumberText = (params) => {
2225
2354
  const svgObjects = [];
2226
2355
  const { schPort, schComponent, transform, circuitJson } = params;
@@ -2238,7 +2367,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
2238
2367
  } else {
2239
2368
  realPinNumberPos.y += 0.02;
2240
2369
  }
2241
- const screenPinNumberTextPos = applyToPoint23(transform, realPinNumberPos);
2370
+ const screenPinNumberTextPos = applyToPoint26(transform, realPinNumberPos);
2242
2371
  svgObjects.push({
2243
2372
  name: "text",
2244
2373
  type: "element",
@@ -2268,7 +2397,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
2268
2397
  };
2269
2398
 
2270
2399
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
2271
- import { applyToPoint as applyToPoint24 } from "transformation-matrix";
2400
+ import { applyToPoint as applyToPoint27 } from "transformation-matrix";
2272
2401
  var LABEL_DIST_FROM_EDGE_MM = 0.1;
2273
2402
  var createSvgObjectsForSchPortPinLabel = (params) => {
2274
2403
  const svgObjects = [];
@@ -2282,7 +2411,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
2282
2411
  const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
2283
2412
  realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
2284
2413
  realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
2285
- const screenPinNumberTextPos = applyToPoint24(transform, realPinNumberPos);
2414
+ const screenPinNumberTextPos = applyToPoint27(transform, realPinNumberPos);
2286
2415
  const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
2287
2416
  if (!label) return [];
2288
2417
  svgObjects.push({
@@ -2324,9 +2453,9 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
2324
2453
  };
2325
2454
 
2326
2455
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
2327
- import { applyToPoint as applyToPoint26 } from "transformation-matrix";
2456
+ import { applyToPoint as applyToPoint29 } from "transformation-matrix";
2328
2457
  var createSvgSchText = (elm, transform) => {
2329
- const center = applyToPoint26(transform, elm.position);
2458
+ const center = applyToPoint29(transform, elm.position);
2330
2459
  const textAnchorMap = {
2331
2460
  center: "middle",
2332
2461
  left: "start",
@@ -2374,11 +2503,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
2374
2503
  circuitJson
2375
2504
  }) => {
2376
2505
  const svgObjects = [];
2377
- const componentScreenTopLeft = applyToPoint27(transform, {
2506
+ const componentScreenTopLeft = applyToPoint30(transform, {
2378
2507
  x: schComponent.center.x - schComponent.size.width / 2,
2379
2508
  y: schComponent.center.y + schComponent.size.height / 2
2380
2509
  });
2381
- const componentScreenBottomRight = applyToPoint27(transform, {
2510
+ const componentScreenBottomRight = applyToPoint30(transform, {
2382
2511
  x: schComponent.center.x + schComponent.size.width / 2,
2383
2512
  y: schComponent.center.y - schComponent.size.height / 2
2384
2513
  });
@@ -2455,9 +2584,9 @@ function createSvgObjectsFromSchematicComponent(params) {
2455
2584
  }
2456
2585
 
2457
2586
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
2458
- import { applyToPoint as applyToPoint28 } from "transformation-matrix";
2587
+ import { applyToPoint as applyToPoint31 } from "transformation-matrix";
2459
2588
  function createSvgObjectsFromSchVoltageProbe(probe, transform) {
2460
- const [screenX, screenY] = applyToPoint28(transform, [
2589
+ const [screenX, screenY] = applyToPoint31(transform, [
2461
2590
  probe.position.x,
2462
2591
  probe.position.y
2463
2592
  ]);
@@ -2517,14 +2646,14 @@ function createSvgObjectsFromSchVoltageProbe(probe, transform) {
2517
2646
  }
2518
2647
 
2519
2648
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
2520
- import { applyToPoint as applyToPoint29 } from "transformation-matrix";
2649
+ import { applyToPoint as applyToPoint32 } from "transformation-matrix";
2521
2650
  function createSvgObjectsFromSchDebugObject(debugObject, transform) {
2522
2651
  if (debugObject.shape === "rect") {
2523
- let [screenLeft, screenTop] = applyToPoint29(transform, [
2652
+ let [screenLeft, screenTop] = applyToPoint32(transform, [
2524
2653
  debugObject.center.x - debugObject.size.width / 2,
2525
2654
  debugObject.center.y - debugObject.size.height / 2
2526
2655
  ]);
2527
- let [screenRight, screenBottom] = applyToPoint29(transform, [
2656
+ let [screenRight, screenBottom] = applyToPoint32(transform, [
2528
2657
  debugObject.center.x + debugObject.size.width / 2,
2529
2658
  debugObject.center.y + debugObject.size.height / 2
2530
2659
  ]);
@@ -2534,7 +2663,7 @@ function createSvgObjectsFromSchDebugObject(debugObject, transform) {
2534
2663
  ];
2535
2664
  const width = Math.abs(screenRight - screenLeft);
2536
2665
  const height = Math.abs(screenBottom - screenTop);
2537
- const [screenCenterX, screenCenterY] = applyToPoint29(transform, [
2666
+ const [screenCenterX, screenCenterY] = applyToPoint32(transform, [
2538
2667
  debugObject.center.x,
2539
2668
  debugObject.center.y
2540
2669
  ]);
@@ -2580,11 +2709,11 @@ function createSvgObjectsFromSchDebugObject(debugObject, transform) {
2580
2709
  ];
2581
2710
  }
2582
2711
  if (debugObject.shape === "line") {
2583
- const [screenStartX, screenStartY] = applyToPoint29(transform, [
2712
+ const [screenStartX, screenStartY] = applyToPoint32(transform, [
2584
2713
  debugObject.start.x,
2585
2714
  debugObject.start.y
2586
2715
  ]);
2587
- const [screenEndX, screenEndY] = applyToPoint29(transform, [
2716
+ const [screenEndX, screenEndY] = applyToPoint32(transform, [
2588
2717
  debugObject.end.x,
2589
2718
  debugObject.end.y
2590
2719
  ]);
@@ -2634,7 +2763,7 @@ function createSvgObjectsFromSchDebugObject(debugObject, transform) {
2634
2763
  }
2635
2764
 
2636
2765
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
2637
- import { applyToPoint as applyToPoint30 } from "transformation-matrix";
2766
+ import { applyToPoint as applyToPoint33 } from "transformation-matrix";
2638
2767
  function createSchematicTrace(trace, transform) {
2639
2768
  const edges = trace.edges;
2640
2769
  if (edges.length === 0) return [];
@@ -2643,11 +2772,11 @@ function createSchematicTrace(trace, transform) {
2643
2772
  for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
2644
2773
  const edge = edges[edgeIndex];
2645
2774
  if (edge.is_crossing) continue;
2646
- const [screenFromX, screenFromY] = applyToPoint30(transform, [
2775
+ const [screenFromX, screenFromY] = applyToPoint33(transform, [
2647
2776
  edge.from.x,
2648
2777
  edge.from.y
2649
2778
  ]);
2650
- const [screenToX, screenToY] = applyToPoint30(transform, [
2779
+ const [screenToX, screenToY] = applyToPoint33(transform, [
2651
2780
  edge.to.x,
2652
2781
  edge.to.y
2653
2782
  ]);
@@ -2659,11 +2788,11 @@ function createSchematicTrace(trace, transform) {
2659
2788
  }
2660
2789
  for (const edge of edges) {
2661
2790
  if (!edge.is_crossing) continue;
2662
- const [screenFromX, screenFromY] = applyToPoint30(transform, [
2791
+ const [screenFromX, screenFromY] = applyToPoint33(transform, [
2663
2792
  edge.from.x,
2664
2793
  edge.from.y
2665
2794
  ]);
2666
- const [screenToX, screenToY] = applyToPoint30(transform, [
2795
+ const [screenToX, screenToY] = applyToPoint33(transform, [
2667
2796
  edge.to.x,
2668
2797
  edge.to.y
2669
2798
  ]);
@@ -2739,7 +2868,7 @@ function createSchematicTrace(trace, transform) {
2739
2868
  }
2740
2869
  if (trace.junctions) {
2741
2870
  for (const junction of trace.junctions) {
2742
- const [screenX, screenY] = applyToPoint30(transform, [
2871
+ const [screenX, screenY] = applyToPoint33(transform, [
2743
2872
  junction.x,
2744
2873
  junction.y
2745
2874
  ]);
@@ -2774,7 +2903,7 @@ function createSchematicTrace(trace, transform) {
2774
2903
 
2775
2904
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
2776
2905
  import {
2777
- applyToPoint as applyToPoint32,
2906
+ applyToPoint as applyToPoint35,
2778
2907
  compose as compose8,
2779
2908
  rotate as rotate4,
2780
2909
  scale as scale5,
@@ -3562,7 +3691,7 @@ var estimateTextWidth = (text) => {
3562
3691
 
3563
3692
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
3564
3693
  import {
3565
- applyToPoint as applyToPoint31,
3694
+ applyToPoint as applyToPoint34,
3566
3695
  compose as compose7,
3567
3696
  rotate as rotate3,
3568
3697
  scale as scale4,
@@ -3682,7 +3811,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = (schNetLabel, realToScreenTransfo
3682
3811
  x: symbolBounds.minX,
3683
3812
  y: (symbolBounds.minY + symbolBounds.maxY) / 2
3684
3813
  };
3685
- const rotatedSymbolEnd = applyToPoint31(rotationMatrix, symbolEndPoint);
3814
+ const rotatedSymbolEnd = applyToPoint34(rotationMatrix, symbolEndPoint);
3686
3815
  const symbolToRealTransform = compose7(
3687
3816
  translate7(
3688
3817
  realAnchorPosition.x - rotatedSymbolEnd.x,
@@ -3692,11 +3821,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = (schNetLabel, realToScreenTransfo
3692
3821
  scale4(1)
3693
3822
  // Use full symbol size
3694
3823
  );
3695
- const [screenMinX, screenMinY] = applyToPoint31(
3824
+ const [screenMinX, screenMinY] = applyToPoint34(
3696
3825
  compose7(realToScreenTransform, symbolToRealTransform),
3697
3826
  [bounds.minX, bounds.minY]
3698
3827
  );
3699
- const [screenMaxX, screenMaxY] = applyToPoint31(
3828
+ const [screenMaxX, screenMaxY] = applyToPoint34(
3700
3829
  compose7(realToScreenTransform, symbolToRealTransform),
3701
3830
  [bounds.maxX, bounds.maxY]
3702
3831
  );
@@ -3720,7 +3849,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = (schNetLabel, realToScreenTransfo
3720
3849
  });
3721
3850
  for (const path of symbolPaths) {
3722
3851
  const symbolPath = path.points.map((p, i) => {
3723
- const [x, y] = applyToPoint31(
3852
+ const [x, y] = applyToPoint34(
3724
3853
  compose7(realToScreenTransform, symbolToRealTransform),
3725
3854
  [p.x, p.y]
3726
3855
  );
@@ -3740,7 +3869,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = (schNetLabel, realToScreenTransfo
3740
3869
  });
3741
3870
  }
3742
3871
  for (const text of symbolTexts) {
3743
- const screenTextPos = applyToPoint31(
3872
+ const screenTextPos = applyToPoint34(
3744
3873
  compose7(realToScreenTransform, symbolToRealTransform),
3745
3874
  text
3746
3875
  );
@@ -3782,7 +3911,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = (schNetLabel, realToScreenTransfo
3782
3911
  });
3783
3912
  }
3784
3913
  for (const box of symbolBoxes) {
3785
- const screenBoxPos = applyToPoint31(
3914
+ const screenBoxPos = applyToPoint34(
3786
3915
  compose7(realToScreenTransform, symbolToRealTransform),
3787
3916
  box
3788
3917
  );
@@ -3805,7 +3934,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = (schNetLabel, realToScreenTransfo
3805
3934
  });
3806
3935
  }
3807
3936
  for (const circle of symbolCircles) {
3808
- const screenCirclePos = applyToPoint31(
3937
+ const screenCirclePos = applyToPoint34(
3809
3938
  compose7(realToScreenTransform, symbolToRealTransform),
3810
3939
  circle
3811
3940
  );
@@ -3844,14 +3973,14 @@ var createSvgObjectsForSchNetLabel = (schNetLabel, realToScreenTransform) => {
3844
3973
  const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
3845
3974
  const fontSizeMm = getSchMmFontSize("net_label");
3846
3975
  const textWidthFSR = estimateTextWidth(schNetLabel.text || "");
3847
- const screenCenter = applyToPoint32(realToScreenTransform, schNetLabel.center);
3976
+ const screenCenter = applyToPoint35(realToScreenTransform, schNetLabel.center);
3848
3977
  const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
3849
3978
  schNetLabel.anchor_side
3850
3979
  );
3851
3980
  const screenTextGrowthVec = { ...realTextGrowthVec };
3852
3981
  screenTextGrowthVec.y *= -1;
3853
3982
  const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * schNetLabel.text.length + END_PADDING_FSR;
3854
- const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint32(realToScreenTransform, schNetLabel.anchor_position) : {
3983
+ const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint35(realToScreenTransform, schNetLabel.anchor_position) : {
3855
3984
  x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
3856
3985
  y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
3857
3986
  };
@@ -3892,7 +4021,7 @@ var createSvgObjectsForSchNetLabel = (schNetLabel, realToScreenTransform) => {
3892
4021
  y: -0.6
3893
4022
  }
3894
4023
  ].map(
3895
- (fontRelativePoint) => applyToPoint32(
4024
+ (fontRelativePoint) => applyToPoint35(
3896
4025
  compose8(
3897
4026
  realToScreenTransform,
3898
4027
  translate8(realAnchorPosition.x, realAnchorPosition.y),