circuit-to-svg 0.0.229 → 0.0.230

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 applyToPoint20,
4
+ applyToPoint as applyToPoint21,
5
5
  compose as compose5,
6
6
  scale as scale2,
7
7
  translate as translate5
@@ -265,8 +265,171 @@ function annotateTraceErrorSvgObjects(objects) {
265
265
  }));
266
266
  }
267
267
 
268
- // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-fabrication-note-path.ts
268
+ // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-footprint-overlap-error.ts
269
269
  import { applyToPoint as applyToPoint2 } from "transformation-matrix";
270
+ function annotateFootprintErrorSvgObjects(objects) {
271
+ return objects.map((object) => ({
272
+ ...object,
273
+ attributes: {
274
+ ...object.attributes ?? {},
275
+ "data-type": object.attributes?.["data-type"] ?? "pcb_footprint_overlap_error",
276
+ "data-pcb-layer": object.attributes?.["data-pcb-layer"] ?? "overlay"
277
+ },
278
+ children: (object.children ?? []).map((child) => {
279
+ if (child?.type === "element") {
280
+ return {
281
+ ...child,
282
+ attributes: {
283
+ ...child.attributes ?? {},
284
+ "data-type": child.attributes?.["data-type"] ?? "pcb_footprint_overlap_error",
285
+ "data-pcb-layer": child.attributes?.["data-pcb-layer"] ?? "overlay"
286
+ }
287
+ };
288
+ }
289
+ return child;
290
+ })
291
+ }));
292
+ }
293
+ function createSvgObjectsFromPcbFootprintOverlapError(error, circuitJson, ctx) {
294
+ const { transform, shouldDrawErrors } = ctx;
295
+ if (!shouldDrawErrors) return [];
296
+ const svgObjects = [];
297
+ const referencedElements = [];
298
+ let padPortIds = [];
299
+ if (error.pcb_smtpad_ids) {
300
+ for (const padId of error.pcb_smtpad_ids) {
301
+ const pad = circuitJson.find(
302
+ (el) => el.type === "pcb_smtpad" && el.pcb_smtpad_id === padId
303
+ );
304
+ if (pad) {
305
+ referencedElements.push({
306
+ x: pad.x,
307
+ y: pad.y,
308
+ type: "pcb_smtpad",
309
+ id: padId,
310
+ pcb_port_id: pad.pcb_port_id
311
+ });
312
+ if (pad.pcb_port_id) padPortIds.push(pad.pcb_port_id);
313
+ }
314
+ }
315
+ }
316
+ const allPadsSamePort = padPortIds.length > 1 && padPortIds.every((id) => id === padPortIds[0]);
317
+ let filteredReferencedElements = referencedElements;
318
+ if (allPadsSamePort) {
319
+ filteredReferencedElements = referencedElements.filter(
320
+ (e) => e.type !== "pcb_smtpad"
321
+ );
322
+ }
323
+ if (error.pcb_plated_hole_ids) {
324
+ for (const holeId of error.pcb_plated_hole_ids) {
325
+ const hole = circuitJson.find(
326
+ (el) => el.type === "pcb_plated_hole" && el.pcb_plated_hole_id === holeId
327
+ );
328
+ if (hole) {
329
+ filteredReferencedElements.push({
330
+ x: hole.x,
331
+ y: hole.y,
332
+ type: "pcb_plated_hole",
333
+ id: holeId
334
+ });
335
+ }
336
+ }
337
+ }
338
+ if (error.pcb_hole_ids) {
339
+ for (const holeId of error.pcb_hole_ids) {
340
+ const hole = circuitJson.find(
341
+ (el) => el.type === "pcb_hole" && el.pcb_hole_id === holeId
342
+ );
343
+ if (hole) {
344
+ filteredReferencedElements.push({
345
+ x: hole.x,
346
+ y: hole.y,
347
+ type: "pcb_hole",
348
+ id: holeId
349
+ });
350
+ }
351
+ }
352
+ }
353
+ if (filteredReferencedElements.length > 0) {
354
+ const centerX = filteredReferencedElements.reduce((sum, el) => sum + el.x, 0) / filteredReferencedElements.length;
355
+ const centerY = filteredReferencedElements.reduce((sum, el) => sum + el.y, 0) / filteredReferencedElements.length;
356
+ const screenCenter = applyToPoint2(transform, { x: centerX, y: centerY });
357
+ svgObjects.push({
358
+ name: "rect",
359
+ type: "element",
360
+ attributes: {
361
+ x: (screenCenter.x - 5).toString(),
362
+ y: (screenCenter.y - 5).toString(),
363
+ width: "10",
364
+ height: "10",
365
+ fill: "red",
366
+ transform: `rotate(45 ${screenCenter.x} ${screenCenter.y})`
367
+ },
368
+ children: [],
369
+ value: ""
370
+ });
371
+ svgObjects.push({
372
+ name: "text",
373
+ type: "element",
374
+ attributes: {
375
+ x: screenCenter.x.toString(),
376
+ y: (screenCenter.y - 15).toString(),
377
+ fill: "red",
378
+ "font-family": "sans-serif",
379
+ "font-size": "12",
380
+ "text-anchor": "middle"
381
+ },
382
+ children: [
383
+ {
384
+ type: "text",
385
+ value: error.message || "PCB Footprint Overlap Error",
386
+ name: "",
387
+ attributes: {},
388
+ children: []
389
+ }
390
+ ],
391
+ value: ""
392
+ });
393
+ for (const element of filteredReferencedElements) {
394
+ const screenPos = applyToPoint2(transform, { x: element.x, y: element.y });
395
+ svgObjects.push({
396
+ name: "rect",
397
+ type: "element",
398
+ attributes: {
399
+ x: (screenPos.x - 5).toString(),
400
+ y: (screenPos.y - 5).toString(),
401
+ width: "10",
402
+ height: "10",
403
+ fill: "red",
404
+ transform: `rotate(45 ${screenPos.x} ${screenPos.y})`
405
+ },
406
+ children: [],
407
+ value: ""
408
+ });
409
+ if (filteredReferencedElements.length > 1) {
410
+ svgObjects.push({
411
+ name: "line",
412
+ type: "element",
413
+ attributes: {
414
+ x1: screenCenter.x.toString(),
415
+ y1: screenCenter.y.toString(),
416
+ x2: screenPos.x.toString(),
417
+ y2: screenPos.y.toString(),
418
+ stroke: "red",
419
+ "stroke-width": "1.5",
420
+ "stroke-dasharray": "2,2"
421
+ },
422
+ children: [],
423
+ value: ""
424
+ });
425
+ }
426
+ }
427
+ }
428
+ return annotateFootprintErrorSvgObjects(svgObjects);
429
+ }
430
+
431
+ // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-fabrication-note-path.ts
432
+ import { applyToPoint as applyToPoint3 } from "transformation-matrix";
270
433
  function createSvgObjectsFromPcbFabricationNotePath(fabNotePath, ctx) {
271
434
  const { transform, layer: layerFilter } = ctx;
272
435
  if (!fabNotePath.route || !Array.isArray(fabNotePath.route)) return [];
@@ -274,7 +437,7 @@ function createSvgObjectsFromPcbFabricationNotePath(fabNotePath, ctx) {
274
437
  const lastPoint = fabNotePath.route[fabNotePath.route.length - 1];
275
438
  const isClosed = firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y;
276
439
  const path = fabNotePath.route.slice(0, isClosed ? -1 : void 0).map((point, index) => {
277
- const [x, y] = applyToPoint2(transform, [point.x, point.y]);
440
+ const [x, y] = applyToPoint3(transform, [point.x, point.y]);
278
441
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
279
442
  }).join(" ") + (isClosed ? " Z" : "");
280
443
  return [
@@ -300,7 +463,7 @@ function createSvgObjectsFromPcbFabricationNotePath(fabNotePath, ctx) {
300
463
 
301
464
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-fabrication-note-text.ts
302
465
  import { toString as matrixToString } from "transformation-matrix";
303
- import { applyToPoint as applyToPoint3, compose, rotate, translate } from "transformation-matrix";
466
+ import { applyToPoint as applyToPoint4, compose, rotate, translate } from "transformation-matrix";
304
467
  function createSvgObjectsFromPcbFabricationNoteText(pcbFabNoteText, ctx) {
305
468
  const { transform, layer: layerFilter } = ctx;
306
469
  const {
@@ -316,7 +479,7 @@ function createSvgObjectsFromPcbFabricationNoteText(pcbFabNoteText, ctx) {
316
479
  console.error("Invalid anchor_position:", anchor_position);
317
480
  return [];
318
481
  }
319
- const [transformedX, transformedY] = applyToPoint3(transform, [
482
+ const [transformedX, transformedY] = applyToPoint4(transform, [
320
483
  anchor_position.x,
321
484
  anchor_position.y
322
485
  ]);
@@ -358,10 +521,10 @@ function createSvgObjectsFromPcbFabricationNoteText(pcbFabNoteText, ctx) {
358
521
  }
359
522
 
360
523
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-plated-hole.ts
361
- import { applyToPoint as applyToPoint4 } from "transformation-matrix";
524
+ import { applyToPoint as applyToPoint5 } from "transformation-matrix";
362
525
  function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
363
526
  const { transform, colorMap: colorMap2 } = ctx;
364
- const [x, y] = applyToPoint4(transform, [hole.x, hole.y]);
527
+ const [x, y] = applyToPoint5(transform, [hole.x, hole.y]);
365
528
  const copperLayer = Array.isArray(hole.layers) && hole.layers[0] || hole.layer || "top";
366
529
  if (hole.shape === "pill") {
367
530
  const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
@@ -478,7 +641,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
478
641
  const scaledRectPadHeight = hole.rect_pad_height * Math.abs(transform.a);
479
642
  const scaledRectBorderRadius = (hole.rect_border_radius ?? 0) * Math.abs(transform.a);
480
643
  const holeRadius = scaledHoleDiameter / 2;
481
- const [holeCx, holeCy] = applyToPoint4(transform, [
644
+ const [holeCx, holeCy] = applyToPoint5(transform, [
482
645
  h.x + (h.hole_offset_x ?? 0),
483
646
  h.y + (h.hole_offset_y ?? 0)
484
647
  ]);
@@ -543,7 +706,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
543
706
  const pillHoleWithOffsets = pillHole;
544
707
  const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
545
708
  const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
546
- const [holeCenterX, holeCenterY] = applyToPoint4(transform, [
709
+ const [holeCenterX, holeCenterY] = applyToPoint5(transform, [
547
710
  pillHole.x + holeOffsetX,
548
711
  pillHole.y + holeOffsetY
549
712
  ]);
@@ -612,7 +775,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
612
775
  const rotatedHoleWithOffsets = rotatedHole;
613
776
  const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
614
777
  const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
615
- const [holeCenterX, holeCenterY] = applyToPoint4(transform, [
778
+ const [holeCenterX, holeCenterY] = applyToPoint5(transform, [
616
779
  rotatedHole.x + holeOffsetX,
617
780
  rotatedHole.y + holeOffsetY
618
781
  ]);
@@ -675,12 +838,12 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
675
838
  }
676
839
 
677
840
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-path.ts
678
- import { applyToPoint as applyToPoint5 } from "transformation-matrix";
841
+ import { applyToPoint as applyToPoint6 } from "transformation-matrix";
679
842
  function createSvgObjectsFromPcbSilkscreenPath(silkscreenPath, ctx) {
680
843
  const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
681
844
  if (!silkscreenPath.route || !Array.isArray(silkscreenPath.route)) return [];
682
845
  let path = silkscreenPath.route.map((point, index) => {
683
- const [x, y] = applyToPoint5(transform, [point.x, point.y]);
846
+ const [x, y] = applyToPoint6(transform, [point.x, point.y]);
684
847
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
685
848
  }).join(" ");
686
849
  const firstPoint = silkscreenPath.route[0];
@@ -716,7 +879,7 @@ function createSvgObjectsFromPcbSilkscreenPath(silkscreenPath, ctx) {
716
879
 
717
880
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-text.ts
718
881
  import {
719
- applyToPoint as applyToPoint6,
882
+ applyToPoint as applyToPoint7,
720
883
  compose as compose2,
721
884
  rotate as rotate2,
722
885
  translate as translate2,
@@ -738,7 +901,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
738
901
  console.error("Invalid anchor_position:", anchor_position);
739
902
  return [];
740
903
  }
741
- const [transformedX, transformedY] = applyToPoint6(transform, [
904
+ const [transformedX, transformedY] = applyToPoint7(transform, [
742
905
  anchor_position.x,
743
906
  anchor_position.y
744
907
  ]);
@@ -846,7 +1009,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
846
1009
  }
847
1010
 
848
1011
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-rect.ts
849
- import { applyToPoint as applyToPoint7 } from "transformation-matrix";
1012
+ import { applyToPoint as applyToPoint8 } from "transformation-matrix";
850
1013
  function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
851
1014
  const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
852
1015
  const {
@@ -865,7 +1028,7 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
865
1028
  console.error("Invalid rectangle data:", { center, width, height });
866
1029
  return [];
867
1030
  }
868
- const [transformedX, transformedY] = applyToPoint7(transform, [
1031
+ const [transformedX, transformedY] = applyToPoint8(transform, [
869
1032
  center.x,
870
1033
  center.y
871
1034
  ]);
@@ -912,7 +1075,7 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
912
1075
  }
913
1076
 
914
1077
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-circle.ts
915
- import { applyToPoint as applyToPoint8 } from "transformation-matrix";
1078
+ import { applyToPoint as applyToPoint9 } from "transformation-matrix";
916
1079
  function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
917
1080
  const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
918
1081
  const {
@@ -927,7 +1090,7 @@ function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
927
1090
  console.error("Invalid PCB Silkscreen Circle data:", { center, radius });
928
1091
  return [];
929
1092
  }
930
- const [transformedX, transformedY] = applyToPoint8(transform, [
1093
+ const [transformedX, transformedY] = applyToPoint9(transform, [
931
1094
  center.x,
932
1095
  center.y
933
1096
  ]);
@@ -955,7 +1118,7 @@ function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
955
1118
  }
956
1119
 
957
1120
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-line.ts
958
- import { applyToPoint as applyToPoint9 } from "transformation-matrix";
1121
+ import { applyToPoint as applyToPoint10 } from "transformation-matrix";
959
1122
  function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, ctx) {
960
1123
  const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
961
1124
  const {
@@ -972,8 +1135,8 @@ function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, ctx) {
972
1135
  console.error("Invalid coordinates:", { x1, y1, x2, y2 });
973
1136
  return [];
974
1137
  }
975
- const [transformedX1, transformedY1] = applyToPoint9(transform, [x1, y1]);
976
- const [transformedX2, transformedY2] = applyToPoint9(transform, [x2, y2]);
1138
+ const [transformedX1, transformedY1] = applyToPoint10(transform, [x1, y1]);
1139
+ const [transformedX2, transformedY2] = applyToPoint10(transform, [x2, y2]);
977
1140
  const transformedStrokeWidth = stroke_width * Math.abs(transform.a);
978
1141
  const color = layer === "bottom" ? colorMap2.silkscreen.bottom : colorMap2.silkscreen.top;
979
1142
  return [
@@ -1008,7 +1171,7 @@ function pairs(arr) {
1008
1171
  }
1009
1172
 
1010
1173
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-trace.ts
1011
- import { applyToPoint as applyToPoint10 } from "transformation-matrix";
1174
+ import { applyToPoint as applyToPoint11 } from "transformation-matrix";
1012
1175
 
1013
1176
  // lib/pcb/colors.ts
1014
1177
  var DEFAULT_PCB_COLOR_MAP = {
@@ -1064,8 +1227,8 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
1064
1227
  const segments = pairs(trace.route);
1065
1228
  const svgObjects = [];
1066
1229
  for (const [start, end] of segments) {
1067
- const startPoint = applyToPoint10(transform, [start.x, start.y]);
1068
- const endPoint = applyToPoint10(transform, [end.x, end.y]);
1230
+ const startPoint = applyToPoint11(transform, [start.x, start.y]);
1231
+ const endPoint = applyToPoint11(transform, [end.x, end.y]);
1069
1232
  const layer = "layer" in start ? start.layer : "layer" in end ? end.layer : null;
1070
1233
  if (!layer) continue;
1071
1234
  if (layerFilter && layer !== layerFilter) continue;
@@ -1137,7 +1300,7 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
1137
1300
  }
1138
1301
 
1139
1302
  // lib/pcb/svg-object-fns/create-svg-objects-from-smt-pads.ts
1140
- import { applyToPoint as applyToPoint11 } from "transformation-matrix";
1303
+ import { applyToPoint as applyToPoint12 } from "transformation-matrix";
1141
1304
  function createSvgObjectsFromSmtPad(pad, ctx) {
1142
1305
  const { transform, layer: layerFilter, colorMap: colorMap2, renderSolderMask } = ctx;
1143
1306
  if (layerFilter && pad.layer !== layerFilter) return [];
@@ -1147,7 +1310,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
1147
1310
  if (pad.shape === "rect" || pad.shape === "rotated_rect") {
1148
1311
  const width = pad.width * Math.abs(transform.a);
1149
1312
  const height = pad.height * Math.abs(transform.d);
1150
- const [x, y] = applyToPoint11(transform, [pad.x, pad.y]);
1313
+ const [x, y] = applyToPoint12(transform, [pad.x, pad.y]);
1151
1314
  const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
1152
1315
  if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
1153
1316
  const padElement2 = {
@@ -1229,7 +1392,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
1229
1392
  const width = pad.width * Math.abs(transform.a);
1230
1393
  const height = pad.height * Math.abs(transform.d);
1231
1394
  const radius = pad.radius * Math.abs(transform.a);
1232
- const [x, y] = applyToPoint11(transform, [pad.x, pad.y]);
1395
+ const [x, y] = applyToPoint12(transform, [pad.x, pad.y]);
1233
1396
  const padElement = {
1234
1397
  name: "rect",
1235
1398
  type: "element",
@@ -1267,7 +1430,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
1267
1430
  }
1268
1431
  if (pad.shape === "circle") {
1269
1432
  const radius = pad.radius * Math.abs(transform.a);
1270
- const [x, y] = applyToPoint11(transform, [pad.x, pad.y]);
1433
+ const [x, y] = applyToPoint12(transform, [pad.x, pad.y]);
1271
1434
  const padElement = {
1272
1435
  name: "circle",
1273
1436
  type: "element",
@@ -1302,7 +1465,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
1302
1465
  }
1303
1466
  if (pad.shape === "polygon") {
1304
1467
  const points = (pad.points ?? []).map(
1305
- (point) => applyToPoint11(transform, [point.x, point.y])
1468
+ (point) => applyToPoint12(transform, [point.x, point.y])
1306
1469
  );
1307
1470
  const padElement = {
1308
1471
  name: "polygon",
@@ -1338,32 +1501,32 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
1338
1501
  }
1339
1502
 
1340
1503
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-board.ts
1341
- import { applyToPoint as applyToPoint12 } from "transformation-matrix";
1504
+ import { applyToPoint as applyToPoint13 } from "transformation-matrix";
1342
1505
  function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
1343
1506
  const { transform, colorMap: colorMap2 } = ctx;
1344
1507
  const { width, height, center, outline } = pcbBoard;
1345
1508
  let path;
1346
1509
  if (outline && Array.isArray(outline) && outline.length >= 3) {
1347
1510
  path = outline.map((point, index) => {
1348
- const [x, y] = applyToPoint12(transform, [point.x, point.y]);
1511
+ const [x, y] = applyToPoint13(transform, [point.x, point.y]);
1349
1512
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
1350
1513
  }).join(" ");
1351
1514
  } else {
1352
1515
  const halfWidth = width / 2;
1353
1516
  const halfHeight = height / 2;
1354
- const topLeft = applyToPoint12(transform, [
1517
+ const topLeft = applyToPoint13(transform, [
1355
1518
  center.x - halfWidth,
1356
1519
  center.y - halfHeight
1357
1520
  ]);
1358
- const topRight = applyToPoint12(transform, [
1521
+ const topRight = applyToPoint13(transform, [
1359
1522
  center.x + halfWidth,
1360
1523
  center.y - halfHeight
1361
1524
  ]);
1362
- const bottomRight = applyToPoint12(transform, [
1525
+ const bottomRight = applyToPoint13(transform, [
1363
1526
  center.x + halfWidth,
1364
1527
  center.y + halfHeight
1365
1528
  ]);
1366
- const bottomLeft = applyToPoint12(transform, [
1529
+ const bottomLeft = applyToPoint13(transform, [
1367
1530
  center.x - halfWidth,
1368
1531
  center.y + halfHeight
1369
1532
  ]);
@@ -1390,10 +1553,10 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
1390
1553
  }
1391
1554
 
1392
1555
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-via.ts
1393
- import { applyToPoint as applyToPoint13 } from "transformation-matrix";
1556
+ import { applyToPoint as applyToPoint14 } from "transformation-matrix";
1394
1557
  function createSvgObjectsFromPcbVia(hole, ctx) {
1395
1558
  const { transform, colorMap: colorMap2 } = ctx;
1396
- const [x, y] = applyToPoint13(transform, [hole.x, hole.y]);
1559
+ const [x, y] = applyToPoint14(transform, [hole.x, hole.y]);
1397
1560
  const scaledOuterWidth = hole.outer_diameter * Math.abs(transform.a);
1398
1561
  const scaledOuterHeight = hole.outer_diameter * Math.abs(transform.a);
1399
1562
  const scaledHoleWidth = hole.hole_diameter * Math.abs(transform.a);
@@ -1439,10 +1602,10 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
1439
1602
  }
1440
1603
 
1441
1604
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-hole.ts
1442
- import { applyToPoint as applyToPoint14 } from "transformation-matrix";
1605
+ import { applyToPoint as applyToPoint15 } from "transformation-matrix";
1443
1606
  function createSvgObjectsFromPcbHole(hole, ctx) {
1444
1607
  const { transform, colorMap: colorMap2 } = ctx;
1445
- const [x, y] = applyToPoint14(transform, [hole.x, hole.y]);
1608
+ const [x, y] = applyToPoint15(transform, [hole.x, hole.y]);
1446
1609
  if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
1447
1610
  const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
1448
1611
  const radius = scaledDiameter / 2;
@@ -1516,7 +1679,7 @@ import {
1516
1679
  getFullConnectivityMapFromCircuitJson
1517
1680
  } from "circuit-json-to-connectivity-map";
1518
1681
  import "svgson";
1519
- import { applyToPoint as applyToPoint15 } from "transformation-matrix";
1682
+ import { applyToPoint as applyToPoint16 } from "transformation-matrix";
1520
1683
 
1521
1684
  // lib/pcb/create-svg-objects-from-pcb-rats-nest/get-element-position.ts
1522
1685
  import { su } from "@tscircuit/circuit-json-util";
@@ -1596,11 +1759,11 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
1596
1759
  });
1597
1760
  const svgObjects = [];
1598
1761
  for (const line of ratsNestLines) {
1599
- const transformedStart = applyToPoint15(transform, [
1762
+ const transformedStart = applyToPoint16(transform, [
1600
1763
  line.startPoint.x,
1601
1764
  line.startPoint.y
1602
1765
  ]);
1603
- const transformedEnd = applyToPoint15(transform, [
1766
+ const transformedEnd = applyToPoint16(transform, [
1604
1767
  line.endPoint.x,
1605
1768
  line.endPoint.y
1606
1769
  ]);
@@ -1628,7 +1791,7 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
1628
1791
 
1629
1792
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout.ts
1630
1793
  import {
1631
- applyToPoint as applyToPoint16,
1794
+ applyToPoint as applyToPoint17,
1632
1795
  compose as compose3,
1633
1796
  rotate as rotate3,
1634
1797
  translate as translate3,
@@ -1638,7 +1801,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
1638
1801
  const { transform, colorMap: colorMap2 } = ctx;
1639
1802
  if (cutout.shape === "rect") {
1640
1803
  const rectCutout = cutout;
1641
- const [cx, cy] = applyToPoint16(transform, [
1804
+ const [cx, cy] = applyToPoint17(transform, [
1642
1805
  rectCutout.center.x,
1643
1806
  rectCutout.center.y
1644
1807
  ]);
@@ -1669,7 +1832,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
1669
1832
  }
1670
1833
  if (cutout.shape === "circle") {
1671
1834
  const circleCutout = cutout;
1672
- const [cx, cy] = applyToPoint16(transform, [
1835
+ const [cx, cy] = applyToPoint17(transform, [
1673
1836
  circleCutout.center.x,
1674
1837
  circleCutout.center.y
1675
1838
  ]);
@@ -1696,7 +1859,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
1696
1859
  const polygonCutout = cutout;
1697
1860
  if (!polygonCutout.points || polygonCutout.points.length === 0) return [];
1698
1861
  const transformedPoints = polygonCutout.points.map(
1699
- (p) => applyToPoint16(transform, [p.x, p.y])
1862
+ (p) => applyToPoint17(transform, [p.x, p.y])
1700
1863
  );
1701
1864
  const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
1702
1865
  return [
@@ -1720,7 +1883,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
1720
1883
 
1721
1884
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
1722
1885
  import {
1723
- applyToPoint as applyToPoint18,
1886
+ applyToPoint as applyToPoint19,
1724
1887
  compose as compose4,
1725
1888
  rotate as rotate4,
1726
1889
  toString as matrixToString7,
@@ -1728,11 +1891,11 @@ import {
1728
1891
  } from "transformation-matrix";
1729
1892
 
1730
1893
  // lib/utils/ring-to-path-d.ts
1731
- import { applyToPoint as applyToPoint17 } from "transformation-matrix";
1894
+ import { applyToPoint as applyToPoint18 } from "transformation-matrix";
1732
1895
  function ringToPathD(vertices, transform) {
1733
1896
  if (vertices.length === 0) return "";
1734
1897
  const transformedVertices = vertices.map((v) => {
1735
- const [x, y] = applyToPoint17(transform, [v.x, v.y]);
1898
+ const [x, y] = applyToPoint18(transform, [v.x, v.y]);
1736
1899
  return { ...v, x, y };
1737
1900
  });
1738
1901
  let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
@@ -1765,7 +1928,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
1765
1928
  const color = layerNameToColor(layer, colorMap2);
1766
1929
  const opacity = "0.5";
1767
1930
  if (pour.shape === "rect") {
1768
- const [cx, cy] = applyToPoint18(transform, [pour.center.x, pour.center.y]);
1931
+ const [cx, cy] = applyToPoint19(transform, [pour.center.x, pour.center.y]);
1769
1932
  const scaledWidth = pour.width * Math.abs(transform.a);
1770
1933
  const scaledHeight = pour.height * Math.abs(transform.d);
1771
1934
  const svgRotation = -(pour.rotation ?? 0);
@@ -1795,7 +1958,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
1795
1958
  if (pour.shape === "polygon") {
1796
1959
  if (!pour.points || pour.points.length === 0) return [];
1797
1960
  const transformedPoints = pour.points.map(
1798
- (p) => applyToPoint18(transform, [p.x, p.y])
1961
+ (p) => applyToPoint19(transform, [p.x, p.y])
1799
1962
  );
1800
1963
  const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
1801
1964
  return [
@@ -1980,11 +2143,11 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
1980
2143
  }
1981
2144
 
1982
2145
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
1983
- import { applyToPoint as applyToPoint19 } from "transformation-matrix";
2146
+ import { applyToPoint as applyToPoint20 } from "transformation-matrix";
1984
2147
  function createSvgObjectsFromPcbComponent(component, ctx) {
1985
2148
  const { transform } = ctx;
1986
2149
  const { center, width, height, rotation = 0 } = component;
1987
- const [x, y] = applyToPoint19(transform, [center.x, center.y]);
2150
+ const [x, y] = applyToPoint20(transform, [center.x, center.y]);
1988
2151
  const scaledWidth = width * Math.abs(transform.a);
1989
2152
  const scaledHeight = height * Math.abs(transform.d);
1990
2153
  const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
@@ -2034,7 +2197,7 @@ function getSoftwareUsedString(circuitJson) {
2034
2197
  var package_default = {
2035
2198
  name: "circuit-to-svg",
2036
2199
  type: "module",
2037
- version: "0.0.228",
2200
+ version: "0.0.229",
2038
2201
  description: "Convert Circuit JSON to SVG",
2039
2202
  main: "dist/index.js",
2040
2203
  files: [
@@ -2447,6 +2610,12 @@ function createSvgObjects({
2447
2610
  return createSvgObjectsFromPcbTraceError(elm, circuitJson, ctx).filter(
2448
2611
  Boolean
2449
2612
  );
2613
+ case "pcb_footprint_overlap_error":
2614
+ return createSvgObjectsFromPcbFootprintOverlapError(
2615
+ elm,
2616
+ circuitJson,
2617
+ ctx
2618
+ ).filter(Boolean);
2450
2619
  case "pcb_component":
2451
2620
  return createSvgObjectsFromPcbComponent(elm, ctx).filter(Boolean);
2452
2621
  case "pcb_trace":
@@ -2484,8 +2653,8 @@ function createSvgObjects({
2484
2653
  }
2485
2654
  }
2486
2655
  function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
2487
- const [x1, y1] = applyToPoint20(transform, [minX, minY]);
2488
- const [x2, y2] = applyToPoint20(transform, [maxX, maxY]);
2656
+ const [x1, y1] = applyToPoint21(transform, [minX, minY]);
2657
+ const [x2, y2] = applyToPoint21(transform, [maxX, maxY]);
2489
2658
  const width = Math.abs(x2 - x1);
2490
2659
  const height = Math.abs(y2 - y1);
2491
2660
  const x = Math.min(x1, x2);
@@ -2515,14 +2684,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
2515
2684
  import { stringify as stringify2 } from "svgson";
2516
2685
  import { su as su3 } from "@tscircuit/circuit-json-util";
2517
2686
  import {
2518
- applyToPoint as applyToPoint27,
2687
+ applyToPoint as applyToPoint28,
2519
2688
  compose as compose6,
2520
2689
  scale as scale3,
2521
2690
  translate as translate6
2522
2691
  } from "transformation-matrix";
2523
2692
 
2524
2693
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
2525
- import { applyToPoint as applyToPoint21 } from "transformation-matrix";
2694
+ import { applyToPoint as applyToPoint22 } from "transformation-matrix";
2526
2695
  var DEFAULT_BOARD_STYLE = {
2527
2696
  fill: "none",
2528
2697
  stroke: "rgb(0,0,0)",
@@ -2534,25 +2703,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
2534
2703
  let path;
2535
2704
  if (outline && Array.isArray(outline) && outline.length >= 3) {
2536
2705
  path = outline.map((point, index) => {
2537
- const [x, y] = applyToPoint21(transform, [point.x, point.y]);
2706
+ const [x, y] = applyToPoint22(transform, [point.x, point.y]);
2538
2707
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
2539
2708
  }).join(" ");
2540
2709
  } else {
2541
2710
  const halfWidth = width / 2;
2542
2711
  const halfHeight = height / 2;
2543
- const topLeft = applyToPoint21(transform, [
2712
+ const topLeft = applyToPoint22(transform, [
2544
2713
  center.x - halfWidth,
2545
2714
  center.y - halfHeight
2546
2715
  ]);
2547
- const topRight = applyToPoint21(transform, [
2716
+ const topRight = applyToPoint22(transform, [
2548
2717
  center.x + halfWidth,
2549
2718
  center.y - halfHeight
2550
2719
  ]);
2551
- const bottomRight = applyToPoint21(transform, [
2720
+ const bottomRight = applyToPoint22(transform, [
2552
2721
  center.x + halfWidth,
2553
2722
  center.y + halfHeight
2554
2723
  ]);
2555
- const bottomLeft = applyToPoint21(transform, [
2724
+ const bottomLeft = applyToPoint22(transform, [
2556
2725
  center.x - halfWidth,
2557
2726
  center.y + halfHeight
2558
2727
  ]);
@@ -2578,7 +2747,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
2578
2747
  }
2579
2748
 
2580
2749
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
2581
- import { applyToPoint as applyToPoint23 } from "transformation-matrix";
2750
+ import { applyToPoint as applyToPoint24 } from "transformation-matrix";
2582
2751
 
2583
2752
  // lib/utils/get-sch-font-size.ts
2584
2753
  import "transformation-matrix";
@@ -2604,8 +2773,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
2604
2773
  const { center, width, height, rotation = 0, layer = "top" } = elm;
2605
2774
  if (!center || typeof width !== "number" || typeof height !== "number")
2606
2775
  return null;
2607
- const [x, y] = applyToPoint23(transform, [center.x, center.y]);
2608
- const [pinX, pinY] = applyToPoint23(transform, [portPosition.x, portPosition.y]);
2776
+ const [x, y] = applyToPoint24(transform, [center.x, center.y]);
2777
+ const [pinX, pinY] = applyToPoint24(transform, [portPosition.x, portPosition.y]);
2609
2778
  const scaledWidth = width * Math.abs(transform.a);
2610
2779
  const scaledHeight = height * Math.abs(transform.d);
2611
2780
  const isTopLayer = layer === "top";
@@ -2767,11 +2936,11 @@ function getRectPathData(w, h, rotation) {
2767
2936
  }
2768
2937
 
2769
2938
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
2770
- import { applyToPoint as applyToPoint24 } from "transformation-matrix";
2939
+ import { applyToPoint as applyToPoint25 } from "transformation-matrix";
2771
2940
  var HOLE_COLOR2 = "rgb(190, 190, 190)";
2772
2941
  function createSvgObjectsFromAssemblyHole(hole, ctx) {
2773
2942
  const { transform } = ctx;
2774
- const [x, y] = applyToPoint24(transform, [hole.x, hole.y]);
2943
+ const [x, y] = applyToPoint25(transform, [hole.x, hole.y]);
2775
2944
  if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
2776
2945
  const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
2777
2946
  const radius = scaledDiameter / 2;
@@ -2835,12 +3004,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
2835
3004
  }
2836
3005
 
2837
3006
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
2838
- import { applyToPoint as applyToPoint25 } from "transformation-matrix";
3007
+ import { applyToPoint as applyToPoint26 } from "transformation-matrix";
2839
3008
  var PAD_COLOR = "rgb(210, 210, 210)";
2840
3009
  var HOLE_COLOR3 = "rgb(190, 190, 190)";
2841
3010
  function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
2842
3011
  const { transform } = ctx;
2843
- const [x, y] = applyToPoint25(transform, [hole.x, hole.y]);
3012
+ const [x, y] = applyToPoint26(transform, [hole.x, hole.y]);
2844
3013
  if (hole.shape === "pill") {
2845
3014
  const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
2846
3015
  const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
@@ -2935,7 +3104,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
2935
3104
  const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
2936
3105
  const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
2937
3106
  const holeRadius = scaledHoleDiameter / 2;
2938
- const [holeCx, holeCy] = applyToPoint25(transform, [
3107
+ const [holeCx, holeCy] = applyToPoint26(transform, [
2939
3108
  circularHole.x + circularHole.hole_offset_x,
2940
3109
  circularHole.y + circularHole.hole_offset_y
2941
3110
  ]);
@@ -2993,7 +3162,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
2993
3162
  const pillHoleWithOffsets = pillHole;
2994
3163
  const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
2995
3164
  const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
2996
- const [holeCenterX, holeCenterY] = applyToPoint25(transform, [
3165
+ const [holeCenterX, holeCenterY] = applyToPoint26(transform, [
2997
3166
  pillHole.x + holeOffsetX,
2998
3167
  pillHole.y + holeOffsetY
2999
3168
  ]);
@@ -3055,7 +3224,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
3055
3224
  const rotatedHoleWithOffsets = rotatedHole;
3056
3225
  const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
3057
3226
  const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
3058
- const [holeCenterX, holeCenterY] = applyToPoint25(transform, [
3227
+ const [holeCenterX, holeCenterY] = applyToPoint26(transform, [
3059
3228
  rotatedHole.x + holeOffsetX,
3060
3229
  rotatedHole.y + holeOffsetY
3061
3230
  ]);
@@ -3111,14 +3280,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
3111
3280
  }
3112
3281
 
3113
3282
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
3114
- import { applyToPoint as applyToPoint26 } from "transformation-matrix";
3283
+ import { applyToPoint as applyToPoint27 } from "transformation-matrix";
3115
3284
  var PAD_COLOR2 = "rgb(210, 210, 210)";
3116
3285
  function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
3117
3286
  const { transform } = ctx;
3118
3287
  if (pad.shape === "rect" || pad.shape === "rotated_rect") {
3119
3288
  const width = pad.width * Math.abs(transform.a);
3120
3289
  const height = pad.height * Math.abs(transform.d);
3121
- const [x, y] = applyToPoint26(transform, [pad.x, pad.y]);
3290
+ const [x, y] = applyToPoint27(transform, [pad.x, pad.y]);
3122
3291
  const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
3123
3292
  if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
3124
3293
  return [
@@ -3170,7 +3339,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
3170
3339
  const width = pad.width * Math.abs(transform.a);
3171
3340
  const height = pad.height * Math.abs(transform.d);
3172
3341
  const radius = pad.radius * Math.abs(transform.a);
3173
- const [x, y] = applyToPoint26(transform, [pad.x, pad.y]);
3342
+ const [x, y] = applyToPoint27(transform, [pad.x, pad.y]);
3174
3343
  return [
3175
3344
  {
3176
3345
  name: "rect",
@@ -3193,7 +3362,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
3193
3362
  }
3194
3363
  if (pad.shape === "circle") {
3195
3364
  const radius = pad.radius * Math.abs(transform.a);
3196
- const [x, y] = applyToPoint26(transform, [pad.x, pad.y]);
3365
+ const [x, y] = applyToPoint27(transform, [pad.x, pad.y]);
3197
3366
  return [
3198
3367
  {
3199
3368
  name: "circle",
@@ -3213,7 +3382,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
3213
3382
  }
3214
3383
  if (pad.shape === "polygon") {
3215
3384
  const points = (pad.points ?? []).map(
3216
- (point) => applyToPoint26(transform, [point.x, point.y])
3385
+ (point) => applyToPoint27(transform, [point.x, point.y])
3217
3386
  );
3218
3387
  return [
3219
3388
  {
@@ -3390,8 +3559,8 @@ function createSvgObjects2(elm, ctx, soup) {
3390
3559
  }
3391
3560
  }
3392
3561
  function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
3393
- const [x1, y1] = applyToPoint27(transform, [minX, minY]);
3394
- const [x2, y2] = applyToPoint27(transform, [maxX, maxY]);
3562
+ const [x1, y1] = applyToPoint28(transform, [minX, minY]);
3563
+ const [x2, y2] = applyToPoint28(transform, [maxX, maxY]);
3395
3564
  const width = Math.abs(x2 - x1);
3396
3565
  const height = Math.abs(y2 - y1);
3397
3566
  const x = Math.min(x1, x2);
@@ -3420,7 +3589,7 @@ import {
3420
3589
  } from "transformation-matrix";
3421
3590
 
3422
3591
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
3423
- import { applyToPoint as applyToPoint28 } from "transformation-matrix";
3592
+ import { applyToPoint as applyToPoint29 } from "transformation-matrix";
3424
3593
  import { su as su4 } from "@tscircuit/circuit-json-util";
3425
3594
  var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
3426
3595
  var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
@@ -3430,25 +3599,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
3430
3599
  let path;
3431
3600
  if (outline && Array.isArray(outline) && outline.length >= 3) {
3432
3601
  path = outline.map((point, index) => {
3433
- const [x, y] = applyToPoint28(transform, [point.x, point.y]);
3602
+ const [x, y] = applyToPoint29(transform, [point.x, point.y]);
3434
3603
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
3435
3604
  }).join(" ");
3436
3605
  } else {
3437
3606
  const halfWidth = width / 2;
3438
3607
  const halfHeight = height / 2;
3439
- const topLeft = applyToPoint28(transform, [
3608
+ const topLeft = applyToPoint29(transform, [
3440
3609
  center.x - halfWidth,
3441
3610
  center.y - halfHeight
3442
3611
  ]);
3443
- const topRight = applyToPoint28(transform, [
3612
+ const topRight = applyToPoint29(transform, [
3444
3613
  center.x + halfWidth,
3445
3614
  center.y - halfHeight
3446
3615
  ]);
3447
- const bottomRight = applyToPoint28(transform, [
3616
+ const bottomRight = applyToPoint29(transform, [
3448
3617
  center.x + halfWidth,
3449
3618
  center.y + halfHeight
3450
3619
  ]);
3451
- const bottomLeft = applyToPoint28(transform, [
3620
+ const bottomLeft = applyToPoint29(transform, [
3452
3621
  center.x - halfWidth,
3453
3622
  center.y + halfHeight
3454
3623
  ]);
@@ -3466,10 +3635,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
3466
3635
  const halfWidth = width2 / 2;
3467
3636
  const halfHeight = height2 / 2;
3468
3637
  const [tl, tr, br, bl] = [
3469
- applyToPoint28(transform, [x - halfWidth, y - halfHeight]),
3470
- applyToPoint28(transform, [x + halfWidth, y - halfHeight]),
3471
- applyToPoint28(transform, [x + halfWidth, y + halfHeight]),
3472
- applyToPoint28(transform, [x - halfWidth, y + halfHeight])
3638
+ applyToPoint29(transform, [x - halfWidth, y - halfHeight]),
3639
+ applyToPoint29(transform, [x + halfWidth, y - halfHeight]),
3640
+ applyToPoint29(transform, [x + halfWidth, y + halfHeight]),
3641
+ applyToPoint29(transform, [x - halfWidth, y + halfHeight])
3473
3642
  ];
3474
3643
  path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
3475
3644
  } else if (cutout.shape === "circle") {
@@ -3496,7 +3665,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
3496
3665
 
3497
3666
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
3498
3667
  import { su as su5 } from "@tscircuit/circuit-json-util";
3499
- import { applyToPoint as applyToPoint29 } from "transformation-matrix";
3668
+ import { applyToPoint as applyToPoint30 } from "transformation-matrix";
3500
3669
  var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
3501
3670
  var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
3502
3671
  function createSvgObjectsFromPinoutComponent(elm, ctx) {
@@ -3506,7 +3675,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
3506
3675
  if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
3507
3676
  return [];
3508
3677
  }
3509
- const [x, y] = applyToPoint29(transform, [center.x, center.y]);
3678
+ const [x, y] = applyToPoint30(transform, [center.x, center.y]);
3510
3679
  const scaledWidth = width * Math.abs(transform.a);
3511
3680
  const scaledHeight = height * Math.abs(transform.d);
3512
3681
  const transformStr = `translate(${x}, ${y})`;
@@ -3567,11 +3736,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
3567
3736
  }
3568
3737
 
3569
3738
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
3570
- import { applyToPoint as applyToPoint30 } from "transformation-matrix";
3739
+ import { applyToPoint as applyToPoint31 } from "transformation-matrix";
3571
3740
  var HOLE_COLOR4 = "rgb(50, 50, 50)";
3572
3741
  function createSvgObjectsFromPinoutHole(hole, ctx) {
3573
3742
  const { transform } = ctx;
3574
- const [x, y] = applyToPoint30(transform, [hole.x, hole.y]);
3743
+ const [x, y] = applyToPoint31(transform, [hole.x, hole.y]);
3575
3744
  if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
3576
3745
  const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
3577
3746
  const radius = scaledDiameter / 2;
@@ -3635,12 +3804,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
3635
3804
  }
3636
3805
 
3637
3806
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
3638
- import { applyToPoint as applyToPoint31 } from "transformation-matrix";
3807
+ import { applyToPoint as applyToPoint32 } from "transformation-matrix";
3639
3808
  var PAD_COLOR3 = "rgb(218, 165, 32)";
3640
3809
  var HOLE_COLOR5 = "rgb(40, 40, 40)";
3641
3810
  function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
3642
3811
  const { transform } = ctx;
3643
- const [x, y] = applyToPoint31(transform, [hole.x, hole.y]);
3812
+ const [x, y] = applyToPoint32(transform, [hole.x, hole.y]);
3644
3813
  if (hole.shape === "pill") {
3645
3814
  const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
3646
3815
  const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
@@ -3875,14 +4044,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
3875
4044
  }
3876
4045
 
3877
4046
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
3878
- import { applyToPoint as applyToPoint32 } from "transformation-matrix";
4047
+ import { applyToPoint as applyToPoint33 } from "transformation-matrix";
3879
4048
  var PAD_COLOR4 = "rgb(218, 165, 32)";
3880
4049
  function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
3881
4050
  const { transform } = ctx;
3882
4051
  if (pad.shape === "rect" || pad.shape === "rotated_rect") {
3883
4052
  const width = pad.width * Math.abs(transform.a);
3884
4053
  const height = pad.height * Math.abs(transform.d);
3885
- const [x, y] = applyToPoint32(transform, [pad.x, pad.y]);
4054
+ const [x, y] = applyToPoint33(transform, [pad.x, pad.y]);
3886
4055
  if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
3887
4056
  return [
3888
4057
  {
@@ -3925,7 +4094,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
3925
4094
  const width = pad.width * Math.abs(transform.a);
3926
4095
  const height = pad.height * Math.abs(transform.d);
3927
4096
  const radius = pad.radius * Math.abs(transform.a);
3928
- const [x, y] = applyToPoint32(transform, [pad.x, pad.y]);
4097
+ const [x, y] = applyToPoint33(transform, [pad.x, pad.y]);
3929
4098
  return [
3930
4099
  {
3931
4100
  name: "rect",
@@ -3948,7 +4117,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
3948
4117
  }
3949
4118
  if (pad.shape === "circle") {
3950
4119
  const radius = pad.radius * Math.abs(transform.a);
3951
- const [x, y] = applyToPoint32(transform, [pad.x, pad.y]);
4120
+ const [x, y] = applyToPoint33(transform, [pad.x, pad.y]);
3952
4121
  return [
3953
4122
  {
3954
4123
  name: "circle",
@@ -3968,7 +4137,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
3968
4137
  }
3969
4138
  if (pad.shape === "polygon") {
3970
4139
  const points = (pad.points ?? []).map(
3971
- (point) => applyToPoint32(transform, [point.x, point.y])
4140
+ (point) => applyToPoint33(transform, [point.x, point.y])
3972
4141
  );
3973
4142
  return [
3974
4143
  {
@@ -3989,7 +4158,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
3989
4158
  }
3990
4159
 
3991
4160
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
3992
- import { applyToPoint as applyToPoint33 } from "transformation-matrix";
4161
+ import { applyToPoint as applyToPoint34 } from "transformation-matrix";
3993
4162
  import { calculateElbow } from "calculate-elbow";
3994
4163
 
3995
4164
  // lib/pinout/svg-object-fns/pinout-label-box.ts
@@ -4066,7 +4235,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
4066
4235
  const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
4067
4236
  if (!label_info) return [];
4068
4237
  const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
4069
- const [port_x, port_y] = applyToPoint33(ctx.transform, [pcb_port.x, pcb_port.y]);
4238
+ const [port_x, port_y] = applyToPoint34(ctx.transform, [pcb_port.x, pcb_port.y]);
4070
4239
  const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
4071
4240
  const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
4072
4241
  const elbow_path = calculateElbow(
@@ -4207,7 +4376,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
4207
4376
  }
4208
4377
 
4209
4378
  // lib/pinout/calculate-label-positions.ts
4210
- import { applyToPoint as applyToPoint34 } from "transformation-matrix";
4379
+ import { applyToPoint as applyToPoint35 } from "transformation-matrix";
4211
4380
 
4212
4381
  // lib/pinout/constants.ts
4213
4382
  var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
@@ -4245,7 +4414,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
4245
4414
  );
4246
4415
  const mapToEdgePort = (pinout_label) => ({
4247
4416
  pcb_port: pinout_label.pcb_port,
4248
- y: applyToPoint34(transform, [
4417
+ y: applyToPoint35(transform, [
4249
4418
  pinout_label.pcb_port.x,
4250
4419
  pinout_label.pcb_port.y
4251
4420
  ])[1],
@@ -4260,7 +4429,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
4260
4429
  } else {
4261
4430
  edge_ports = pinout_labels.map((pinout_label) => ({
4262
4431
  pcb_port: pinout_label.pcb_port,
4263
- y: applyToPoint34(transform, [
4432
+ y: applyToPoint35(transform, [
4264
4433
  pinout_label.pcb_port.x,
4265
4434
  pinout_label.pcb_port.y
4266
4435
  ])[1],
@@ -4268,7 +4437,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
4268
4437
  })).sort((a, b) => a.y - b.y);
4269
4438
  }
4270
4439
  if (edge_ports.length === 0) return;
4271
- const board_edge_x = applyToPoint34(transform, [
4440
+ const board_edge_x = applyToPoint35(transform, [
4272
4441
  edge === "left" ? board_bounds.minX : board_bounds.maxX,
4273
4442
  0
4274
4443
  ])[0];
@@ -4917,14 +5086,14 @@ import {
4917
5086
  } from "transformation-matrix";
4918
5087
 
4919
5088
  // lib/sch/draw-schematic-grid.ts
4920
- import { applyToPoint as applyToPoint35 } from "transformation-matrix";
5089
+ import { applyToPoint as applyToPoint36 } from "transformation-matrix";
4921
5090
  function drawSchematicGrid(params) {
4922
5091
  const { minX, minY, maxX, maxY } = params.bounds;
4923
5092
  const cellSize = params.cellSize ?? 1;
4924
5093
  const labelCells = params.labelCells ?? false;
4925
5094
  const gridLines = [];
4926
5095
  const transformPoint = (x, y) => {
4927
- const [transformedX, transformedY] = applyToPoint35(params.transform, [x, y]);
5096
+ const [transformedX, transformedY] = applyToPoint36(params.transform, [x, y]);
4928
5097
  return { x: transformedX, y: transformedY };
4929
5098
  };
4930
5099
  for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
@@ -5005,15 +5174,15 @@ function drawSchematicGrid(params) {
5005
5174
  }
5006
5175
 
5007
5176
  // lib/sch/draw-schematic-labeled-points.ts
5008
- import { applyToPoint as applyToPoint36 } from "transformation-matrix";
5177
+ import { applyToPoint as applyToPoint37 } from "transformation-matrix";
5009
5178
  function drawSchematicLabeledPoints(params) {
5010
5179
  const { points, transform } = params;
5011
5180
  const labeledPointsGroup = [];
5012
5181
  for (const point of points) {
5013
- const [x1, y1] = applyToPoint36(transform, [point.x - 0.1, point.y - 0.1]);
5014
- const [x2, y2] = applyToPoint36(transform, [point.x + 0.1, point.y + 0.1]);
5015
- const [x3, y3] = applyToPoint36(transform, [point.x - 0.1, point.y + 0.1]);
5016
- const [x4, y4] = applyToPoint36(transform, [point.x + 0.1, point.y - 0.1]);
5182
+ const [x1, y1] = applyToPoint37(transform, [point.x - 0.1, point.y - 0.1]);
5183
+ const [x2, y2] = applyToPoint37(transform, [point.x + 0.1, point.y + 0.1]);
5184
+ const [x3, y3] = applyToPoint37(transform, [point.x - 0.1, point.y + 0.1]);
5185
+ const [x4, y4] = applyToPoint37(transform, [point.x + 0.1, point.y - 0.1]);
5017
5186
  labeledPointsGroup.push({
5018
5187
  name: "path",
5019
5188
  type: "element",
@@ -5024,7 +5193,7 @@ function drawSchematicLabeledPoints(params) {
5024
5193
  "stroke-opacity": "0.7"
5025
5194
  }
5026
5195
  });
5027
- const [labelX, labelY] = applyToPoint36(transform, [
5196
+ const [labelX, labelY] = applyToPoint37(transform, [
5028
5197
  point.x + 0.15,
5029
5198
  point.y - 0.15
5030
5199
  ]);
@@ -6118,7 +6287,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
6118
6287
  import { symbols } from "schematic-symbols";
6119
6288
  import "svgson";
6120
6289
  import {
6121
- applyToPoint as applyToPoint38,
6290
+ applyToPoint as applyToPoint39,
6122
6291
  compose as compose9
6123
6292
  } from "transformation-matrix";
6124
6293
 
@@ -6202,13 +6371,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
6202
6371
  }
6203
6372
 
6204
6373
  // lib/sch/svg-object-fns/create-svg-error-text.ts
6205
- import { applyToPoint as applyToPoint37 } from "transformation-matrix";
6374
+ import { applyToPoint as applyToPoint38 } from "transformation-matrix";
6206
6375
  var createSvgSchErrorText = ({
6207
6376
  text,
6208
6377
  realCenter,
6209
6378
  realToScreenTransform
6210
6379
  }) => {
6211
- const screenCenter = applyToPoint37(realToScreenTransform, realCenter);
6380
+ const screenCenter = applyToPoint38(realToScreenTransform, realCenter);
6212
6381
  return {
6213
6382
  type: "element",
6214
6383
  name: "text",
@@ -6317,11 +6486,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
6317
6486
  minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
6318
6487
  maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
6319
6488
  };
6320
- const [screenMinX, screenMinY] = applyToPoint38(
6489
+ const [screenMinX, screenMinY] = applyToPoint39(
6321
6490
  compose9(realToScreenTransform, transformFromSymbolToReal),
6322
6491
  [bounds.minX, bounds.minY]
6323
6492
  );
6324
- const [screenMaxX, screenMaxY] = applyToPoint38(
6493
+ const [screenMaxX, screenMaxY] = applyToPoint39(
6325
6494
  compose9(realToScreenTransform, transformFromSymbolToReal),
6326
6495
  [bounds.maxX, bounds.maxY]
6327
6496
  );
@@ -6350,7 +6519,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
6350
6519
  name: "path",
6351
6520
  attributes: {
6352
6521
  d: points.map((p, i) => {
6353
- const [x, y] = applyToPoint38(
6522
+ const [x, y] = applyToPoint39(
6354
6523
  compose9(realToScreenTransform, transformFromSymbolToReal),
6355
6524
  [p.x, p.y]
6356
6525
  );
@@ -6366,7 +6535,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
6366
6535
  });
6367
6536
  }
6368
6537
  for (const text of texts) {
6369
- const screenTextPos = applyToPoint38(
6538
+ const screenTextPos = applyToPoint39(
6370
6539
  compose9(realToScreenTransform, transformFromSymbolToReal),
6371
6540
  text
6372
6541
  );
@@ -6418,7 +6587,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
6418
6587
  });
6419
6588
  }
6420
6589
  for (const box of boxes) {
6421
- const screenBoxPos = applyToPoint38(
6590
+ const screenBoxPos = applyToPoint39(
6422
6591
  compose9(realToScreenTransform, transformFromSymbolToReal),
6423
6592
  box
6424
6593
  );
@@ -6442,7 +6611,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
6442
6611
  }
6443
6612
  for (const port of symbol.ports) {
6444
6613
  if (connectedSymbolPorts.has(port)) continue;
6445
- const screenPortPos = applyToPoint38(
6614
+ const screenPortPos = applyToPoint39(
6446
6615
  compose9(realToScreenTransform, transformFromSymbolToReal),
6447
6616
  port
6448
6617
  );
@@ -6462,7 +6631,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
6462
6631
  });
6463
6632
  }
6464
6633
  for (const circle of circles) {
6465
- const screenCirclePos = applyToPoint38(
6634
+ const screenCirclePos = applyToPoint39(
6466
6635
  compose9(realToScreenTransform, transformFromSymbolToReal),
6467
6636
  circle
6468
6637
  );
@@ -6489,14 +6658,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
6489
6658
  import { su as su10 } from "@tscircuit/circuit-json-util";
6490
6659
  import "schematic-symbols";
6491
6660
  import "svgson";
6492
- import { applyToPoint as applyToPoint44 } from "transformation-matrix";
6661
+ import { applyToPoint as applyToPoint45 } from "transformation-matrix";
6493
6662
 
6494
6663
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
6495
6664
  import "transformation-matrix";
6496
6665
  import "@tscircuit/circuit-json-util";
6497
6666
 
6498
6667
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
6499
- import { applyToPoint as applyToPoint39 } from "transformation-matrix";
6668
+ import { applyToPoint as applyToPoint40 } from "transformation-matrix";
6500
6669
  import { su as su8 } from "@tscircuit/circuit-json-util";
6501
6670
  var PIN_CIRCLE_RADIUS_MM = 0.02;
6502
6671
  var createArrow = (tip, angle, size, color, strokeWidth) => {
@@ -6549,8 +6718,8 @@ var createSvgObjectsForSchPortBoxLine = ({
6549
6718
  realEdgePos.y += realPinLineLength;
6550
6719
  break;
6551
6720
  }
6552
- const screenSchPortPos = applyToPoint39(transform, schPort.center);
6553
- const screenRealEdgePos = applyToPoint39(transform, realEdgePos);
6721
+ const screenSchPortPos = applyToPoint40(transform, schPort.center);
6722
+ const screenRealEdgePos = applyToPoint40(transform, realEdgePos);
6554
6723
  const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
6555
6724
  const realLineEnd = { ...schPort.center };
6556
6725
  if (!isConnected) {
@@ -6569,7 +6738,7 @@ var createSvgObjectsForSchPortBoxLine = ({
6569
6738
  break;
6570
6739
  }
6571
6740
  }
6572
- const screenLineEnd = applyToPoint39(transform, realLineEnd);
6741
+ const screenLineEnd = applyToPoint40(transform, realLineEnd);
6573
6742
  svgObjects.push({
6574
6743
  name: "line",
6575
6744
  type: "element",
@@ -6690,7 +6859,7 @@ var createSvgObjectsForSchPortBoxLine = ({
6690
6859
  };
6691
6860
 
6692
6861
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
6693
- import { applyToPoint as applyToPoint40 } from "transformation-matrix";
6862
+ import { applyToPoint as applyToPoint41 } from "transformation-matrix";
6694
6863
  var createSvgObjectsForSchPortPinNumberText = (params) => {
6695
6864
  const svgObjects = [];
6696
6865
  const { schPort, schComponent, transform, circuitJson } = params;
@@ -6708,7 +6877,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
6708
6877
  } else {
6709
6878
  realPinNumberPos.y += 0.02;
6710
6879
  }
6711
- const screenPinNumberTextPos = applyToPoint40(transform, realPinNumberPos);
6880
+ const screenPinNumberTextPos = applyToPoint41(transform, realPinNumberPos);
6712
6881
  svgObjects.push({
6713
6882
  name: "text",
6714
6883
  type: "element",
@@ -6738,7 +6907,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
6738
6907
  };
6739
6908
 
6740
6909
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
6741
- import { applyToPoint as applyToPoint41 } from "transformation-matrix";
6910
+ import { applyToPoint as applyToPoint42 } from "transformation-matrix";
6742
6911
  var LABEL_DIST_FROM_EDGE_MM = 0.1;
6743
6912
  var createSvgObjectsForSchPortPinLabel = (params) => {
6744
6913
  const svgObjects = [];
@@ -6752,7 +6921,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
6752
6921
  const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
6753
6922
  realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
6754
6923
  realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
6755
- const screenPinNumberTextPos = applyToPoint41(transform, realPinNumberPos);
6924
+ const screenPinNumberTextPos = applyToPoint42(transform, realPinNumberPos);
6756
6925
  const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
6757
6926
  if (!label) return [];
6758
6927
  const isNegated = label.startsWith("N_");
@@ -6800,13 +6969,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
6800
6969
  };
6801
6970
 
6802
6971
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
6803
- import { applyToPoint as applyToPoint43 } from "transformation-matrix";
6972
+ import { applyToPoint as applyToPoint44 } from "transformation-matrix";
6804
6973
  var createSvgSchText = ({
6805
6974
  elm,
6806
6975
  transform,
6807
6976
  colorMap: colorMap2
6808
6977
  }) => {
6809
- const center = applyToPoint43(transform, elm.position);
6978
+ const center = applyToPoint44(transform, elm.position);
6810
6979
  const textAnchorMap = {
6811
6980
  center: "middle",
6812
6981
  center_right: "end",
@@ -6890,11 +7059,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
6890
7059
  colorMap: colorMap2
6891
7060
  }) => {
6892
7061
  const svgObjects = [];
6893
- const componentScreenTopLeft = applyToPoint44(transform, {
7062
+ const componentScreenTopLeft = applyToPoint45(transform, {
6894
7063
  x: schComponent.center.x - schComponent.size.width / 2,
6895
7064
  y: schComponent.center.y + schComponent.size.height / 2
6896
7065
  });
6897
- const componentScreenBottomRight = applyToPoint44(transform, {
7066
+ const componentScreenBottomRight = applyToPoint45(transform, {
6898
7067
  x: schComponent.center.x + schComponent.size.width / 2,
6899
7068
  y: schComponent.center.y - schComponent.size.height / 2
6900
7069
  });
@@ -6980,13 +7149,13 @@ function createSvgObjectsFromSchematicComponent(params) {
6980
7149
  }
6981
7150
 
6982
7151
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
6983
- import { applyToPoint as applyToPoint45 } from "transformation-matrix";
7152
+ import { applyToPoint as applyToPoint46 } from "transformation-matrix";
6984
7153
  function createSvgObjectsFromSchVoltageProbe({
6985
7154
  probe,
6986
7155
  transform,
6987
7156
  colorMap: colorMap2
6988
7157
  }) {
6989
- const [screenX, screenY] = applyToPoint45(transform, [
7158
+ const [screenX, screenY] = applyToPoint46(transform, [
6990
7159
  probe.position.x,
6991
7160
  probe.position.y
6992
7161
  ]);
@@ -7046,17 +7215,17 @@ function createSvgObjectsFromSchVoltageProbe({
7046
7215
  }
7047
7216
 
7048
7217
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
7049
- import { applyToPoint as applyToPoint46 } from "transformation-matrix";
7218
+ import { applyToPoint as applyToPoint47 } from "transformation-matrix";
7050
7219
  function createSvgObjectsFromSchDebugObject({
7051
7220
  debugObject,
7052
7221
  transform
7053
7222
  }) {
7054
7223
  if (debugObject.shape === "rect") {
7055
- let [screenLeft, screenTop] = applyToPoint46(transform, [
7224
+ let [screenLeft, screenTop] = applyToPoint47(transform, [
7056
7225
  debugObject.center.x - debugObject.size.width / 2,
7057
7226
  debugObject.center.y - debugObject.size.height / 2
7058
7227
  ]);
7059
- let [screenRight, screenBottom] = applyToPoint46(transform, [
7228
+ let [screenRight, screenBottom] = applyToPoint47(transform, [
7060
7229
  debugObject.center.x + debugObject.size.width / 2,
7061
7230
  debugObject.center.y + debugObject.size.height / 2
7062
7231
  ]);
@@ -7066,7 +7235,7 @@ function createSvgObjectsFromSchDebugObject({
7066
7235
  ];
7067
7236
  const width = Math.abs(screenRight - screenLeft);
7068
7237
  const height = Math.abs(screenBottom - screenTop);
7069
- const [screenCenterX, screenCenterY] = applyToPoint46(transform, [
7238
+ const [screenCenterX, screenCenterY] = applyToPoint47(transform, [
7070
7239
  debugObject.center.x,
7071
7240
  debugObject.center.y
7072
7241
  ]);
@@ -7112,11 +7281,11 @@ function createSvgObjectsFromSchDebugObject({
7112
7281
  ];
7113
7282
  }
7114
7283
  if (debugObject.shape === "line") {
7115
- const [screenStartX, screenStartY] = applyToPoint46(transform, [
7284
+ const [screenStartX, screenStartY] = applyToPoint47(transform, [
7116
7285
  debugObject.start.x,
7117
7286
  debugObject.start.y
7118
7287
  ]);
7119
- const [screenEndX, screenEndY] = applyToPoint46(transform, [
7288
+ const [screenEndX, screenEndY] = applyToPoint47(transform, [
7120
7289
  debugObject.end.x,
7121
7290
  debugObject.end.y
7122
7291
  ]);
@@ -7166,7 +7335,7 @@ function createSvgObjectsFromSchDebugObject({
7166
7335
  }
7167
7336
 
7168
7337
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
7169
- import { applyToPoint as applyToPoint47 } from "transformation-matrix";
7338
+ import { applyToPoint as applyToPoint48 } from "transformation-matrix";
7170
7339
  function createSchematicTrace({
7171
7340
  trace,
7172
7341
  transform,
@@ -7180,11 +7349,11 @@ function createSchematicTrace({
7180
7349
  for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
7181
7350
  const edge = edges[edgeIndex];
7182
7351
  if (edge.is_crossing) continue;
7183
- const [screenFromX, screenFromY] = applyToPoint47(transform, [
7352
+ const [screenFromX, screenFromY] = applyToPoint48(transform, [
7184
7353
  edge.from.x,
7185
7354
  edge.from.y
7186
7355
  ]);
7187
- const [screenToX, screenToY] = applyToPoint47(transform, [
7356
+ const [screenToX, screenToY] = applyToPoint48(transform, [
7188
7357
  edge.to.x,
7189
7358
  edge.to.y
7190
7359
  ]);
@@ -7228,11 +7397,11 @@ function createSchematicTrace({
7228
7397
  }
7229
7398
  for (const edge of edges) {
7230
7399
  if (!edge.is_crossing) continue;
7231
- const [screenFromX, screenFromY] = applyToPoint47(transform, [
7400
+ const [screenFromX, screenFromY] = applyToPoint48(transform, [
7232
7401
  edge.from.x,
7233
7402
  edge.from.y
7234
7403
  ]);
7235
- const [screenToX, screenToY] = applyToPoint47(transform, [
7404
+ const [screenToX, screenToY] = applyToPoint48(transform, [
7236
7405
  edge.to.x,
7237
7406
  edge.to.y
7238
7407
  ]);
@@ -7276,7 +7445,7 @@ function createSchematicTrace({
7276
7445
  }
7277
7446
  if (trace.junctions) {
7278
7447
  for (const junction of trace.junctions) {
7279
- const [screenX, screenY] = applyToPoint47(transform, [
7448
+ const [screenX, screenY] = applyToPoint48(transform, [
7280
7449
  junction.x,
7281
7450
  junction.y
7282
7451
  ]);
@@ -7331,7 +7500,7 @@ function createSchematicTrace({
7331
7500
 
7332
7501
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
7333
7502
  import {
7334
- applyToPoint as applyToPoint49,
7503
+ applyToPoint as applyToPoint50,
7335
7504
  compose as compose11,
7336
7505
  rotate as rotate6,
7337
7506
  scale as scale6,
@@ -7340,7 +7509,7 @@ import {
7340
7509
 
7341
7510
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
7342
7511
  import {
7343
- applyToPoint as applyToPoint48,
7512
+ applyToPoint as applyToPoint49,
7344
7513
  compose as compose10,
7345
7514
  rotate as rotate5,
7346
7515
  scale as scale5,
@@ -7415,7 +7584,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
7415
7584
  x: symbolBounds.minX,
7416
7585
  y: (symbolBounds.minY + symbolBounds.maxY) / 2
7417
7586
  };
7418
- const rotatedSymbolEnd = applyToPoint48(rotationMatrix, symbolEndPoint);
7587
+ const rotatedSymbolEnd = applyToPoint49(rotationMatrix, symbolEndPoint);
7419
7588
  const symbolToRealTransform = compose10(
7420
7589
  translate10(
7421
7590
  realAnchorPosition.x - rotatedSymbolEnd.x,
@@ -7425,11 +7594,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
7425
7594
  scale5(1)
7426
7595
  // Use full symbol size
7427
7596
  );
7428
- const [screenMinX, screenMinY] = applyToPoint48(
7597
+ const [screenMinX, screenMinY] = applyToPoint49(
7429
7598
  compose10(realToScreenTransform, symbolToRealTransform),
7430
7599
  [bounds.minX, bounds.minY]
7431
7600
  );
7432
- const [screenMaxX, screenMaxY] = applyToPoint48(
7601
+ const [screenMaxX, screenMaxY] = applyToPoint49(
7433
7602
  compose10(realToScreenTransform, symbolToRealTransform),
7434
7603
  [bounds.maxX, bounds.maxY]
7435
7604
  );
@@ -7453,7 +7622,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
7453
7622
  });
7454
7623
  for (const path of symbolPaths) {
7455
7624
  const symbolPath = path.points.map((p, i) => {
7456
- const [x, y] = applyToPoint48(
7625
+ const [x, y] = applyToPoint49(
7457
7626
  compose10(realToScreenTransform, symbolToRealTransform),
7458
7627
  [p.x, p.y]
7459
7628
  );
@@ -7474,7 +7643,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
7474
7643
  });
7475
7644
  }
7476
7645
  for (const text of symbolTexts) {
7477
- const screenTextPos = applyToPoint48(
7646
+ const screenTextPos = applyToPoint49(
7478
7647
  compose10(realToScreenTransform, symbolToRealTransform),
7479
7648
  text
7480
7649
  );
@@ -7516,7 +7685,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
7516
7685
  });
7517
7686
  }
7518
7687
  for (const box of symbolBoxes) {
7519
- const screenBoxPos = applyToPoint48(
7688
+ const screenBoxPos = applyToPoint49(
7520
7689
  compose10(realToScreenTransform, symbolToRealTransform),
7521
7690
  box
7522
7691
  );
@@ -7539,7 +7708,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
7539
7708
  });
7540
7709
  }
7541
7710
  for (const circle of symbolCircles) {
7542
- const screenCirclePos = applyToPoint48(
7711
+ const screenCirclePos = applyToPoint49(
7543
7712
  compose10(realToScreenTransform, symbolToRealTransform),
7544
7713
  circle
7545
7714
  );
@@ -7584,14 +7753,14 @@ var createSvgObjectsForSchNetLabel = ({
7584
7753
  const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
7585
7754
  const fontSizeMm = getSchMmFontSize("net_label");
7586
7755
  const textWidthFSR = estimateTextWidth(labelText || "");
7587
- const screenCenter = applyToPoint49(realToScreenTransform, schNetLabel.center);
7756
+ const screenCenter = applyToPoint50(realToScreenTransform, schNetLabel.center);
7588
7757
  const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
7589
7758
  schNetLabel.anchor_side
7590
7759
  );
7591
7760
  const screenTextGrowthVec = { ...realTextGrowthVec };
7592
7761
  screenTextGrowthVec.y *= -1;
7593
7762
  const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
7594
- const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint49(realToScreenTransform, schNetLabel.anchor_position) : {
7763
+ const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint50(realToScreenTransform, schNetLabel.anchor_position) : {
7595
7764
  x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
7596
7765
  y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
7597
7766
  };
@@ -7632,7 +7801,7 @@ var createSvgObjectsForSchNetLabel = ({
7632
7801
  y: -0.6
7633
7802
  }
7634
7803
  ].map(
7635
- (fontRelativePoint) => applyToPoint49(
7804
+ (fontRelativePoint) => applyToPoint50(
7636
7805
  compose11(
7637
7806
  realToScreenTransform,
7638
7807
  translate11(realAnchorPosition.x, realAnchorPosition.y),
@@ -7709,17 +7878,17 @@ var createSvgObjectsForSchNetLabel = ({
7709
7878
  };
7710
7879
 
7711
7880
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
7712
- import { applyToPoint as applyToPoint50 } from "transformation-matrix";
7881
+ import { applyToPoint as applyToPoint51 } from "transformation-matrix";
7713
7882
  var createSvgObjectsFromSchematicBox = ({
7714
7883
  schematicBox,
7715
7884
  transform,
7716
7885
  colorMap: colorMap2
7717
7886
  }) => {
7718
- const topLeft = applyToPoint50(transform, {
7887
+ const topLeft = applyToPoint51(transform, {
7719
7888
  x: schematicBox.x,
7720
7889
  y: schematicBox.y
7721
7890
  });
7722
- const bottomRight = applyToPoint50(transform, {
7891
+ const bottomRight = applyToPoint51(transform, {
7723
7892
  x: schematicBox.x + schematicBox.width,
7724
7893
  y: schematicBox.y + schematicBox.height
7725
7894
  });
@@ -7755,7 +7924,7 @@ var createSvgObjectsFromSchematicBox = ({
7755
7924
  };
7756
7925
 
7757
7926
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
7758
- import { applyToPoint as applyToPoint51 } from "transformation-matrix";
7927
+ import { applyToPoint as applyToPoint52 } from "transformation-matrix";
7759
7928
  var createSvgObjectsFromSchematicTable = ({
7760
7929
  schematicTable,
7761
7930
  transform,
@@ -7788,11 +7957,11 @@ var createSvgObjectsFromSchematicTable = ({
7788
7957
  const svgObjects = [];
7789
7958
  const borderStrokeWidth = border_width * Math.abs(transform.a);
7790
7959
  const gridStrokeWidth = getSchStrokeSize(transform);
7791
- const [screenTopLeftX, screenTopLeftY] = applyToPoint51(transform, [
7960
+ const [screenTopLeftX, screenTopLeftY] = applyToPoint52(transform, [
7792
7961
  topLeftX,
7793
7962
  topLeftY
7794
7963
  ]);
7795
- const [screenBottomRightX, screenBottomRightY] = applyToPoint51(transform, [
7964
+ const [screenBottomRightX, screenBottomRightY] = applyToPoint52(transform, [
7796
7965
  topLeftX + totalWidth,
7797
7966
  topLeftY - totalHeight
7798
7967
  ]);
@@ -7824,8 +7993,8 @@ var createSvgObjectsFromSchematicTable = ({
7824
7993
  (cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
7825
7994
  );
7826
7995
  if (!isMerged) {
7827
- const start = applyToPoint51(transform, { x: currentX, y: segmentStartY });
7828
- const end = applyToPoint51(transform, { x: currentX, y: segmentEndY });
7996
+ const start = applyToPoint52(transform, { x: currentX, y: segmentStartY });
7997
+ const end = applyToPoint52(transform, { x: currentX, y: segmentEndY });
7829
7998
  svgObjects.push({
7830
7999
  name: "line",
7831
8000
  type: "element",
@@ -7854,11 +8023,11 @@ var createSvgObjectsFromSchematicTable = ({
7854
8023
  (cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
7855
8024
  );
7856
8025
  if (!isMerged) {
7857
- const start = applyToPoint51(transform, {
8026
+ const start = applyToPoint52(transform, {
7858
8027
  x: segmentStartX,
7859
8028
  y: currentY
7860
8029
  });
7861
- const end = applyToPoint51(transform, { x: segmentEndX, y: currentY });
8030
+ const end = applyToPoint52(transform, { x: segmentEndX, y: currentY });
7862
8031
  svgObjects.push({
7863
8032
  name: "line",
7864
8033
  type: "element",
@@ -7900,7 +8069,7 @@ var createSvgObjectsFromSchematicTable = ({
7900
8069
  } else if (vertical_align === "bottom") {
7901
8070
  realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
7902
8071
  }
7903
- const screenTextAnchorPos = applyToPoint51(transform, realTextAnchorPos);
8072
+ const screenTextAnchorPos = applyToPoint52(transform, realTextAnchorPos);
7904
8073
  const fontSize = getSchScreenFontSize(
7905
8074
  transform,
7906
8075
  "reference_designator",
@@ -7956,13 +8125,13 @@ var createSvgObjectsFromSchematicTable = ({
7956
8125
 
7957
8126
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
7958
8127
  import { su as su11 } from "@tscircuit/circuit-json-util";
7959
- import { applyToPoint as applyToPoint52 } from "transformation-matrix";
8128
+ import { applyToPoint as applyToPoint53 } from "transformation-matrix";
7960
8129
  var PIN_CIRCLE_RADIUS_MM2 = 0.02;
7961
8130
  var createSvgObjectsForSchPortHover = ({
7962
8131
  schPort,
7963
8132
  transform
7964
8133
  }) => {
7965
- const screenSchPortPos = applyToPoint52(transform, schPort.center);
8134
+ const screenSchPortPos = applyToPoint53(transform, schPort.center);
7966
8135
  const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
7967
8136
  return [
7968
8137
  {
@@ -8007,14 +8176,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
8007
8176
  };
8008
8177
 
8009
8178
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
8010
- import { applyToPoint as applyToPoint53 } from "transformation-matrix";
8179
+ import { applyToPoint as applyToPoint54 } from "transformation-matrix";
8011
8180
  function createSvgObjectsFromSchematicLine({
8012
8181
  schLine,
8013
8182
  transform,
8014
8183
  colorMap: colorMap2
8015
8184
  }) {
8016
- const p1 = applyToPoint53(transform, { x: schLine.x1, y: schLine.y1 });
8017
- const p2 = applyToPoint53(transform, { x: schLine.x2, y: schLine.y2 });
8185
+ const p1 = applyToPoint54(transform, { x: schLine.x1, y: schLine.y1 });
8186
+ const p2 = applyToPoint54(transform, { x: schLine.x2, y: schLine.y2 });
8018
8187
  const strokeWidth = schLine.stroke_width ?? 0.02;
8019
8188
  const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
8020
8189
  return [
@@ -8043,13 +8212,13 @@ function createSvgObjectsFromSchematicLine({
8043
8212
  }
8044
8213
 
8045
8214
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
8046
- import { applyToPoint as applyToPoint54 } from "transformation-matrix";
8215
+ import { applyToPoint as applyToPoint55 } from "transformation-matrix";
8047
8216
  function createSvgObjectsFromSchematicCircle({
8048
8217
  schCircle,
8049
8218
  transform,
8050
8219
  colorMap: colorMap2
8051
8220
  }) {
8052
- const center = applyToPoint54(transform, schCircle.center);
8221
+ const center = applyToPoint55(transform, schCircle.center);
8053
8222
  const transformedRadius = Math.abs(transform.a) * schCircle.radius;
8054
8223
  const strokeWidth = schCircle.stroke_width ?? 0.02;
8055
8224
  const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
@@ -8079,13 +8248,13 @@ function createSvgObjectsFromSchematicCircle({
8079
8248
  }
8080
8249
 
8081
8250
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
8082
- import { applyToPoint as applyToPoint55 } from "transformation-matrix";
8251
+ import { applyToPoint as applyToPoint56 } from "transformation-matrix";
8083
8252
  function createSvgObjectsFromSchematicRect({
8084
8253
  schRect,
8085
8254
  transform,
8086
8255
  colorMap: colorMap2
8087
8256
  }) {
8088
- const center = applyToPoint55(transform, schRect.center);
8257
+ const center = applyToPoint56(transform, schRect.center);
8089
8258
  const transformedWidth = Math.abs(transform.a) * schRect.width;
8090
8259
  const transformedHeight = Math.abs(transform.d) * schRect.height;
8091
8260
  const strokeWidth = schRect.stroke_width ?? 0.02;
@@ -8121,13 +8290,13 @@ function createSvgObjectsFromSchematicRect({
8121
8290
  }
8122
8291
 
8123
8292
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
8124
- import { applyToPoint as applyToPoint56 } from "transformation-matrix";
8293
+ import { applyToPoint as applyToPoint57 } from "transformation-matrix";
8125
8294
  function createSvgObjectsFromSchematicArc({
8126
8295
  schArc,
8127
8296
  transform,
8128
8297
  colorMap: colorMap2
8129
8298
  }) {
8130
- const center = applyToPoint56(transform, schArc.center);
8299
+ const center = applyToPoint57(transform, schArc.center);
8131
8300
  const transformedRadius = Math.abs(transform.a) * schArc.radius;
8132
8301
  const strokeWidth = schArc.stroke_width ?? 0.02;
8133
8302
  const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
@@ -9159,18 +9328,18 @@ function formatNumber2(value) {
9159
9328
  // lib/pcb/convert-circuit-json-to-solder-paste-mask.ts
9160
9329
  import { stringify as stringify7 } from "svgson";
9161
9330
  import {
9162
- applyToPoint as applyToPoint59,
9331
+ applyToPoint as applyToPoint60,
9163
9332
  compose as compose14,
9164
9333
  scale as scale8,
9165
9334
  translate as translate14
9166
9335
  } from "transformation-matrix";
9167
9336
 
9168
9337
  // lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
9169
- import { applyToPoint as applyToPoint58 } from "transformation-matrix";
9338
+ import { applyToPoint as applyToPoint59 } from "transformation-matrix";
9170
9339
  function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
9171
9340
  const { transform, layer: layerFilter } = ctx;
9172
9341
  if (layerFilter && solderPaste.layer !== layerFilter) return [];
9173
- const [x, y] = applyToPoint58(transform, [solderPaste.x, solderPaste.y]);
9342
+ const [x, y] = applyToPoint59(transform, [solderPaste.x, solderPaste.y]);
9174
9343
  if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
9175
9344
  const width = solderPaste.width * Math.abs(transform.a);
9176
9345
  const height = solderPaste.height * Math.abs(transform.d);
@@ -9381,8 +9550,8 @@ function createSvgObjects4({ elm, ctx }) {
9381
9550
  }
9382
9551
  }
9383
9552
  function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
9384
- const [x1, y1] = applyToPoint59(transform, [minX, minY]);
9385
- const [x2, y2] = applyToPoint59(transform, [maxX, maxY]);
9553
+ const [x1, y1] = applyToPoint60(transform, [minX, minY]);
9554
+ const [x2, y2] = applyToPoint60(transform, [maxX, maxY]);
9386
9555
  const width = Math.abs(x2 - x1);
9387
9556
  const height = Math.abs(y2 - y1);
9388
9557
  const x = Math.min(x1, x2);