circuit-to-svg 0.0.307 → 0.0.308

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
@@ -2,7 +2,7 @@
2
2
  import "circuit-json";
3
3
  import { stringify } from "svgson";
4
4
  import {
5
- applyToPoint as applyToPoint37,
5
+ applyToPoint as applyToPoint38,
6
6
  compose as compose7,
7
7
  scale as scale3,
8
8
  translate as translate7
@@ -3274,6 +3274,49 @@ function createSvgObjectsFromPcbCourtyardRect(pcbCourtyardRect, ctx) {
3274
3274
  return [svgObject];
3275
3275
  }
3276
3276
 
3277
+ // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-courtyard-polygon.ts
3278
+ import { applyToPoint as applyToPoint22 } from "transformation-matrix";
3279
+ function createSvgObjectsFromPcbCourtyardPolygon(pcbCourtyardPolygon, ctx) {
3280
+ const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
3281
+ const {
3282
+ layer = "top",
3283
+ pcb_courtyard_polygon_id,
3284
+ points,
3285
+ color
3286
+ } = pcbCourtyardPolygon;
3287
+ if (layerFilter && layer !== layerFilter) return [];
3288
+ if (!points || points.length === 0) {
3289
+ console.error("Invalid courtyard polygon data: no points", {
3290
+ pcb_courtyard_polygon_id
3291
+ });
3292
+ return [];
3293
+ }
3294
+ const transformedPoints = points.map(
3295
+ (p) => applyToPoint22(transform, [p.x, p.y])
3296
+ );
3297
+ const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
3298
+ const transformedStrokeWidth = 0.05 * Math.abs(transform.a);
3299
+ const strokeColor = color ?? colorMap2.courtyard;
3300
+ const attributes = {
3301
+ points: pointsString,
3302
+ class: `pcb-courtyard-polygon pcb-courtyard-${layer}`,
3303
+ "data-pcb-courtyard-polygon-id": pcb_courtyard_polygon_id,
3304
+ "data-type": "pcb_courtyard_polygon",
3305
+ "data-pcb-layer": layer,
3306
+ fill: "none",
3307
+ stroke: strokeColor,
3308
+ "stroke-width": transformedStrokeWidth.toString()
3309
+ };
3310
+ const svgObject = {
3311
+ name: "polygon",
3312
+ type: "element",
3313
+ attributes,
3314
+ value: "",
3315
+ children: []
3316
+ };
3317
+ return [svgObject];
3318
+ }
3319
+
3277
3320
  // lib/utils/pairs.ts
3278
3321
  function pairs(arr) {
3279
3322
  const result = [];
@@ -3284,7 +3327,7 @@ function pairs(arr) {
3284
3327
  }
3285
3328
 
3286
3329
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-trace.ts
3287
- import { applyToPoint as applyToPoint22 } from "transformation-matrix";
3330
+ import { applyToPoint as applyToPoint23 } from "transformation-matrix";
3288
3331
  function createSvgObjectsFromPcbTrace(trace, ctx) {
3289
3332
  const { transform, layer: layerFilter, colorMap: colorMap2, showSolderMask } = ctx;
3290
3333
  if (!trace.route || !Array.isArray(trace.route) || trace.route.length < 2)
@@ -3292,8 +3335,8 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
3292
3335
  const segments = pairs(trace.route);
3293
3336
  const svgObjects = [];
3294
3337
  for (const [start, end] of segments) {
3295
- const startPoint = applyToPoint22(transform, [start.x, start.y]);
3296
- const endPoint = applyToPoint22(transform, [end.x, end.y]);
3338
+ const startPoint = applyToPoint23(transform, [start.x, start.y]);
3339
+ const endPoint = applyToPoint23(transform, [end.x, end.y]);
3297
3340
  const layer = "layer" in start ? start.layer : "layer" in end ? end.layer : null;
3298
3341
  if (!layer) continue;
3299
3342
  if (layerFilter && layer !== layerFilter) continue;
@@ -3348,7 +3391,7 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
3348
3391
  }
3349
3392
 
3350
3393
  // lib/pcb/svg-object-fns/create-svg-objects-from-smt-pads.ts
3351
- import { applyToPoint as applyToPoint23 } from "transformation-matrix";
3394
+ import { applyToPoint as applyToPoint24 } from "transformation-matrix";
3352
3395
  function createSvgObjectsFromSmtPad(pad, ctx) {
3353
3396
  const { transform, layer: layerFilter, colorMap: colorMap2, showSolderMask } = ctx;
3354
3397
  if (layerFilter && pad.layer !== layerFilter) return [];
@@ -3359,7 +3402,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
3359
3402
  if (pad.shape === "rect" || pad.shape === "rotated_rect") {
3360
3403
  const width = pad.width * Math.abs(transform.a);
3361
3404
  const height = pad.height * Math.abs(transform.d);
3362
- const [x, y] = applyToPoint23(transform, [pad.x, pad.y]);
3405
+ const [x, y] = applyToPoint24(transform, [pad.x, pad.y]);
3363
3406
  const cornerRadiusValue = pad.corner_radius ?? pad.rect_border_radius ?? 0;
3364
3407
  const scaledBorderRadius = cornerRadiusValue * Math.abs(transform.a);
3365
3408
  if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
@@ -3601,7 +3644,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
3601
3644
  const width = pad.width * Math.abs(transform.a);
3602
3645
  const height = pad.height * Math.abs(transform.d);
3603
3646
  const radius = pad.radius * Math.abs(transform.a);
3604
- const [x, y] = applyToPoint23(transform, [pad.x, pad.y]);
3647
+ const [x, y] = applyToPoint24(transform, [pad.x, pad.y]);
3605
3648
  const rotationTransformAttributes = isRotated ? {
3606
3649
  transform: `translate(${x} ${y}) rotate(${-(pad.ccw_rotation ?? 0)})`
3607
3650
  } : void 0;
@@ -3719,7 +3762,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
3719
3762
  }
3720
3763
  if (pad.shape === "circle") {
3721
3764
  const radius = pad.radius * Math.abs(transform.a);
3722
- const [x, y] = applyToPoint23(transform, [pad.x, pad.y]);
3765
+ const [x, y] = applyToPoint24(transform, [pad.x, pad.y]);
3723
3766
  const padElement = {
3724
3767
  name: "circle",
3725
3768
  type: "element",
@@ -3809,7 +3852,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
3809
3852
  }
3810
3853
  if (pad.shape === "polygon") {
3811
3854
  const points = (pad.points ?? []).map(
3812
- (point) => applyToPoint23(transform, [point.x, point.y])
3855
+ (point) => applyToPoint24(transform, [point.x, point.y])
3813
3856
  );
3814
3857
  const padElement = {
3815
3858
  name: "polygon",
@@ -3908,10 +3951,10 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
3908
3951
  }
3909
3952
 
3910
3953
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-board.ts
3911
- import { applyToPoint as applyToPoint25 } from "transformation-matrix";
3954
+ import { applyToPoint as applyToPoint26 } from "transformation-matrix";
3912
3955
 
3913
3956
  // lib/utils/create-pcb-component-anchor-offset-indicators.ts
3914
- import { applyToPoint as applyToPoint24 } from "transformation-matrix";
3957
+ import { applyToPoint as applyToPoint25 } from "transformation-matrix";
3915
3958
  var OFFSET_THRESHOLD_MM = 0.05;
3916
3959
  var TICK_SIZE_PX = 4;
3917
3960
  var LABEL_GAP_PX = 8;
@@ -3938,11 +3981,11 @@ function createAnchorOffsetIndicators(params) {
3938
3981
  displayYOffset
3939
3982
  } = params;
3940
3983
  const objects = [];
3941
- const [screenGroupAnchorX, screenGroupAnchorY] = applyToPoint24(transform, [
3984
+ const [screenGroupAnchorX, screenGroupAnchorY] = applyToPoint25(transform, [
3942
3985
  groupAnchorPosition.x,
3943
3986
  groupAnchorPosition.y
3944
3987
  ]);
3945
- const [screenComponentX, screenComponentY] = applyToPoint24(transform, [
3988
+ const [screenComponentX, screenComponentY] = applyToPoint25(transform, [
3946
3989
  componentPosition.x,
3947
3990
  componentPosition.y
3948
3991
  ]);
@@ -4293,25 +4336,25 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
4293
4336
  let path;
4294
4337
  if (outline && Array.isArray(outline) && outline.length >= 3) {
4295
4338
  path = outline.map((point, index) => {
4296
- const [x, y] = applyToPoint25(transform, [point.x, point.y]);
4339
+ const [x, y] = applyToPoint26(transform, [point.x, point.y]);
4297
4340
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
4298
4341
  }).join(" ");
4299
4342
  } else {
4300
4343
  const halfWidth = width / 2;
4301
4344
  const halfHeight = height / 2;
4302
- const topLeft = applyToPoint25(transform, [
4345
+ const topLeft = applyToPoint26(transform, [
4303
4346
  center.x - halfWidth,
4304
4347
  center.y - halfHeight
4305
4348
  ]);
4306
- const topRight = applyToPoint25(transform, [
4349
+ const topRight = applyToPoint26(transform, [
4307
4350
  center.x + halfWidth,
4308
4351
  center.y - halfHeight
4309
4352
  ]);
4310
- const bottomRight = applyToPoint25(transform, [
4353
+ const bottomRight = applyToPoint26(transform, [
4311
4354
  center.x + halfWidth,
4312
4355
  center.y + halfHeight
4313
4356
  ]);
4314
- const bottomLeft = applyToPoint25(transform, [
4357
+ const bottomLeft = applyToPoint26(transform, [
4315
4358
  center.x - halfWidth,
4316
4359
  center.y + halfHeight
4317
4360
  ]);
@@ -4378,7 +4421,7 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
4378
4421
  }
4379
4422
 
4380
4423
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-panel.ts
4381
- import { applyToPoint as applyToPoint26 } from "transformation-matrix";
4424
+ import { applyToPoint as applyToPoint27 } from "transformation-matrix";
4382
4425
  function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
4383
4426
  const { transform, colorMap: colorMap2, showSolderMask } = ctx;
4384
4427
  const width = Number(pcbPanel.width);
@@ -4386,19 +4429,19 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
4386
4429
  const center = pcbPanel.center ?? { x: width / 2, y: height / 2 };
4387
4430
  const halfWidth = width / 2;
4388
4431
  const halfHeight = height / 2;
4389
- const topLeft = applyToPoint26(transform, [
4432
+ const topLeft = applyToPoint27(transform, [
4390
4433
  center.x - halfWidth,
4391
4434
  center.y - halfHeight
4392
4435
  ]);
4393
- const topRight = applyToPoint26(transform, [
4436
+ const topRight = applyToPoint27(transform, [
4394
4437
  center.x + halfWidth,
4395
4438
  center.y - halfHeight
4396
4439
  ]);
4397
- const bottomRight = applyToPoint26(transform, [
4440
+ const bottomRight = applyToPoint27(transform, [
4398
4441
  center.x + halfWidth,
4399
4442
  center.y + halfHeight
4400
4443
  ]);
4401
- const bottomLeft = applyToPoint26(transform, [
4444
+ const bottomLeft = applyToPoint27(transform, [
4402
4445
  center.x - halfWidth,
4403
4446
  center.y + halfHeight
4404
4447
  ]);
@@ -4427,10 +4470,10 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
4427
4470
  }
4428
4471
 
4429
4472
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-via.ts
4430
- import { applyToPoint as applyToPoint27 } from "transformation-matrix";
4473
+ import { applyToPoint as applyToPoint28 } from "transformation-matrix";
4431
4474
  function createSvgObjectsFromPcbVia(hole, ctx) {
4432
4475
  const { transform, colorMap: colorMap2 } = ctx;
4433
- const [x, y] = applyToPoint27(transform, [hole.x, hole.y]);
4476
+ const [x, y] = applyToPoint28(transform, [hole.x, hole.y]);
4434
4477
  const scaledOuterWidth = hole.outer_diameter * Math.abs(transform.a);
4435
4478
  const scaledOuterHeight = hole.outer_diameter * Math.abs(transform.a);
4436
4479
  const scaledHoleWidth = hole.hole_diameter * Math.abs(transform.a);
@@ -4476,11 +4519,11 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
4476
4519
  }
4477
4520
 
4478
4521
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-hole.ts
4479
- import { applyToPoint as applyToPoint28 } from "transformation-matrix";
4522
+ import { applyToPoint as applyToPoint29 } from "transformation-matrix";
4480
4523
  function createSvgObjectsFromPcbHole(hole, ctx) {
4481
4524
  const { transform, colorMap: colorMap2, showSolderMask } = ctx;
4482
4525
  const layer = ctx.layer ?? "top";
4483
- const [x, y] = applyToPoint28(transform, [hole.x, hole.y]);
4526
+ const [x, y] = applyToPoint29(transform, [hole.x, hole.y]);
4484
4527
  const isCoveredWithSolderMask = Boolean(hole.is_covered_with_solder_mask);
4485
4528
  const soldermaskMargin = (hole.soldermask_margin ?? 0) * Math.abs(transform.a);
4486
4529
  const shouldShowSolderMask = showSolderMask && isCoveredWithSolderMask && soldermaskMargin !== 0;
@@ -4977,7 +5020,7 @@ import {
4977
5020
  getFullConnectivityMapFromCircuitJson
4978
5021
  } from "circuit-json-to-connectivity-map";
4979
5022
  import "svgson";
4980
- import { applyToPoint as applyToPoint29 } from "transformation-matrix";
5023
+ import { applyToPoint as applyToPoint30 } from "transformation-matrix";
4981
5024
 
4982
5025
  // lib/pcb/create-svg-objects-from-pcb-rats-nest/get-element-position.ts
4983
5026
  import { su } from "@tscircuit/circuit-json-util";
@@ -5057,11 +5100,11 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
5057
5100
  });
5058
5101
  const svgObjects = [];
5059
5102
  for (const line of ratsNestLines) {
5060
- const transformedStart = applyToPoint29(transform, [
5103
+ const transformedStart = applyToPoint30(transform, [
5061
5104
  line.startPoint.x,
5062
5105
  line.startPoint.y
5063
5106
  ]);
5064
- const transformedEnd = applyToPoint29(transform, [
5107
+ const transformedEnd = applyToPoint30(transform, [
5065
5108
  line.endPoint.x,
5066
5109
  line.endPoint.y
5067
5110
  ]);
@@ -5089,7 +5132,7 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
5089
5132
 
5090
5133
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout.ts
5091
5134
  import {
5092
- applyToPoint as applyToPoint30,
5135
+ applyToPoint as applyToPoint31,
5093
5136
  compose as compose4,
5094
5137
  rotate as rotate4,
5095
5138
  translate as translate4,
@@ -5099,7 +5142,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
5099
5142
  const { transform, colorMap: colorMap2 } = ctx;
5100
5143
  if (cutout.shape === "rect") {
5101
5144
  const rectCutout = cutout;
5102
- const [cx, cy] = applyToPoint30(transform, [
5145
+ const [cx, cy] = applyToPoint31(transform, [
5103
5146
  rectCutout.center.x,
5104
5147
  rectCutout.center.y
5105
5148
  ]);
@@ -5141,7 +5184,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
5141
5184
  }
5142
5185
  if (cutout.shape === "circle") {
5143
5186
  const circleCutout = cutout;
5144
- const [cx, cy] = applyToPoint30(transform, [
5187
+ const [cx, cy] = applyToPoint31(transform, [
5145
5188
  circleCutout.center.x,
5146
5189
  circleCutout.center.y
5147
5190
  ]);
@@ -5168,7 +5211,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
5168
5211
  const polygonCutout = cutout;
5169
5212
  if (!polygonCutout.points || polygonCutout.points.length === 0) return [];
5170
5213
  const transformedPoints = polygonCutout.points.map(
5171
- (p) => applyToPoint30(transform, [p.x, p.y])
5214
+ (p) => applyToPoint31(transform, [p.x, p.y])
5172
5215
  );
5173
5216
  const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
5174
5217
  return [
@@ -5191,7 +5234,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
5191
5234
  }
5192
5235
 
5193
5236
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout-path.ts
5194
- import { applyToPoint as applyToPoint31 } from "transformation-matrix";
5237
+ import { applyToPoint as applyToPoint32 } from "transformation-matrix";
5195
5238
  function createSvgObjectsFromPcbCutoutPath(cutoutPath, ctx) {
5196
5239
  const { transform, colorMap: colorMap2 } = ctx;
5197
5240
  if (!cutoutPath.route || !Array.isArray(cutoutPath.route)) return [];
@@ -5199,7 +5242,7 @@ function createSvgObjectsFromPcbCutoutPath(cutoutPath, ctx) {
5199
5242
  const lastPoint = cutoutPath.route[cutoutPath.route.length - 1];
5200
5243
  const isClosed = firstPoint && lastPoint && firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y;
5201
5244
  const path = cutoutPath.route.slice(0, isClosed ? -1 : void 0).map((point, index) => {
5202
- const [x, y] = applyToPoint31(transform, [point.x, point.y]);
5245
+ const [x, y] = applyToPoint32(transform, [point.x, point.y]);
5203
5246
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
5204
5247
  }).join(" ") + (isClosed ? " Z" : "");
5205
5248
  return [
@@ -5222,7 +5265,7 @@ function createSvgObjectsFromPcbCutoutPath(cutoutPath, ctx) {
5222
5265
 
5223
5266
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-keepout.ts
5224
5267
  import {
5225
- applyToPoint as applyToPoint32,
5268
+ applyToPoint as applyToPoint33,
5226
5269
  compose as compose5,
5227
5270
  translate as translate5,
5228
5271
  toString as matrixToString8
@@ -5239,7 +5282,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
5239
5282
  }
5240
5283
  if (keepout.shape === "rect") {
5241
5284
  const rectKeepout = keepout;
5242
- const [cx, cy] = applyToPoint32(transform, [
5285
+ const [cx, cy] = applyToPoint33(transform, [
5243
5286
  rectKeepout.center.x,
5244
5287
  rectKeepout.center.y
5245
5288
  ]);
@@ -5273,7 +5316,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
5273
5316
  });
5274
5317
  } else if (keepout.shape === "circle") {
5275
5318
  const circleKeepout = keepout;
5276
- const [cx, cy] = applyToPoint32(transform, [
5319
+ const [cx, cy] = applyToPoint33(transform, [
5277
5320
  circleKeepout.center.x,
5278
5321
  circleKeepout.center.y
5279
5322
  ]);
@@ -5309,7 +5352,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
5309
5352
 
5310
5353
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
5311
5354
  import {
5312
- applyToPoint as applyToPoint34,
5355
+ applyToPoint as applyToPoint35,
5313
5356
  compose as compose6,
5314
5357
  rotate as rotate5,
5315
5358
  toString as matrixToString9,
@@ -5317,11 +5360,11 @@ import {
5317
5360
  } from "transformation-matrix";
5318
5361
 
5319
5362
  // lib/utils/ring-to-path-d.ts
5320
- import { applyToPoint as applyToPoint33 } from "transformation-matrix";
5363
+ import { applyToPoint as applyToPoint34 } from "transformation-matrix";
5321
5364
  function ringToPathD(vertices, transform) {
5322
5365
  if (vertices.length === 0) return "";
5323
5366
  const transformedVertices = vertices.map((v) => {
5324
- const [x, y] = applyToPoint33(transform, [v.x, v.y]);
5367
+ const [x, y] = applyToPoint34(transform, [v.x, v.y]);
5325
5368
  return { ...v, x, y };
5326
5369
  });
5327
5370
  let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
@@ -5410,7 +5453,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
5410
5453
  const maskOverlayColor = layer === "bottom" ? colorMap2.soldermaskOverCopper.bottom : colorMap2.soldermaskOverCopper.top;
5411
5454
  const maskOverlayOpacity = "0.9";
5412
5455
  if (pour.shape === "rect") {
5413
- const [cx, cy] = applyToPoint34(transform, [pour.center.x, pour.center.y]);
5456
+ const [cx, cy] = applyToPoint35(transform, [pour.center.x, pour.center.y]);
5414
5457
  const scaledWidth = pour.width * Math.abs(transform.a);
5415
5458
  const scaledHeight = pour.height * Math.abs(transform.d);
5416
5459
  const svgRotation = -(pour.rotation ?? 0);
@@ -5462,7 +5505,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
5462
5505
  if (pour.shape === "polygon") {
5463
5506
  if (!pour.points || pour.points.length === 0) return [];
5464
5507
  const transformedPoints = pour.points.map(
5465
- (p) => applyToPoint34(transform, [p.x, p.y])
5508
+ (p) => applyToPoint35(transform, [p.x, p.y])
5466
5509
  );
5467
5510
  const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
5468
5511
  const copperPolygon = {
@@ -5685,11 +5728,11 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
5685
5728
  }
5686
5729
 
5687
5730
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
5688
- import { applyToPoint as applyToPoint35 } from "transformation-matrix";
5731
+ import { applyToPoint as applyToPoint36 } from "transformation-matrix";
5689
5732
  function createSvgObjectsFromPcbComponent(component, ctx) {
5690
5733
  const { transform, circuitJson } = ctx;
5691
5734
  const { center, width, height, rotation = 0 } = component;
5692
- const [x, y] = applyToPoint35(transform, [center.x, center.y]);
5735
+ const [x, y] = applyToPoint36(transform, [center.x, center.y]);
5693
5736
  const scaledWidth = width * Math.abs(transform.a);
5694
5737
  const scaledHeight = height * Math.abs(transform.d);
5695
5738
  const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
@@ -5761,7 +5804,7 @@ function getParentAnchorPosition(component, circuitJson) {
5761
5804
  }
5762
5805
 
5763
5806
  // lib/pcb/svg-object-fns/create-svg-objects-from-pcb-group.ts
5764
- import { applyToPoint as applyToPoint36 } from "transformation-matrix";
5807
+ import { applyToPoint as applyToPoint37 } from "transformation-matrix";
5765
5808
  var DEFAULT_GROUP_COLOR = "rgba(100, 200, 255, 0.6)";
5766
5809
  var DEFAULT_STROKE_WIDTH = 0.1;
5767
5810
  function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
@@ -5805,7 +5848,7 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
5805
5848
  (point) => point && typeof point.x === "number" && typeof point.y === "number"
5806
5849
  )) {
5807
5850
  const path = outline.map((point, index) => {
5808
- const [x, y] = applyToPoint36(transform, [point.x, point.y]);
5851
+ const [x, y] = applyToPoint37(transform, [point.x, point.y]);
5809
5852
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
5810
5853
  }).join(" ");
5811
5854
  svgObjects.push({
@@ -5826,11 +5869,11 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
5826
5869
  }
5827
5870
  const halfWidth = width / 2;
5828
5871
  const halfHeight = height / 2;
5829
- const [topLeftX, topLeftY] = applyToPoint36(transform, [
5872
+ const [topLeftX, topLeftY] = applyToPoint37(transform, [
5830
5873
  center.x - halfWidth,
5831
5874
  center.y + halfHeight
5832
5875
  ]);
5833
- const [bottomRightX, bottomRightY] = applyToPoint36(transform, [
5876
+ const [bottomRightX, bottomRightY] = applyToPoint37(transform, [
5834
5877
  center.x + halfWidth,
5835
5878
  center.y - halfHeight
5836
5879
  ]);
@@ -5884,7 +5927,7 @@ function getSoftwareUsedString(circuitJson) {
5884
5927
  var package_default = {
5885
5928
  name: "circuit-to-svg",
5886
5929
  type: "module",
5887
- version: "0.0.306",
5930
+ version: "0.0.307",
5888
5931
  description: "Convert Circuit JSON to SVG",
5889
5932
  main: "dist/index.js",
5890
5933
  files: [
@@ -5907,7 +5950,7 @@ var package_default = {
5907
5950
  "@vitejs/plugin-react": "5.0.0",
5908
5951
  biome: "^0.3.3",
5909
5952
  "bun-match-svg": "^0.0.12",
5910
- "circuit-json": "^0.0.348",
5953
+ "circuit-json": "^0.0.351",
5911
5954
  esbuild: "^0.20.2",
5912
5955
  "performance-now": "^2.1.0",
5913
5956
  react: "19.1.0",
@@ -6711,6 +6754,9 @@ function createSvgObjects({
6711
6754
  case "pcb_courtyard_rect":
6712
6755
  if (!ctx.showCourtyards) return [];
6713
6756
  return createSvgObjectsFromPcbCourtyardRect(elm, ctx);
6757
+ case "pcb_courtyard_polygon":
6758
+ if (!ctx.showCourtyards) return [];
6759
+ return createSvgObjectsFromPcbCourtyardPolygon(elm, ctx);
6714
6760
  case "pcb_fabrication_note_path":
6715
6761
  return createSvgObjectsFromPcbFabricationNotePath(elm, ctx);
6716
6762
  case "pcb_fabrication_note_text":
@@ -6755,8 +6801,8 @@ function createSvgObjects({
6755
6801
  }
6756
6802
  }
6757
6803
  function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
6758
- const [x1, y1] = applyToPoint37(transform, [minX, minY]);
6759
- const [x2, y2] = applyToPoint37(transform, [maxX, maxY]);
6804
+ const [x1, y1] = applyToPoint38(transform, [minX, minY]);
6805
+ const [x2, y2] = applyToPoint38(transform, [maxX, maxY]);
6760
6806
  const width = Math.abs(x2 - x1);
6761
6807
  const height = Math.abs(y2 - y1);
6762
6808
  const x = Math.min(x1, x2);
@@ -6786,14 +6832,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
6786
6832
  import { stringify as stringify2 } from "svgson";
6787
6833
  import { su as su3 } from "@tscircuit/circuit-json-util";
6788
6834
  import {
6789
- applyToPoint as applyToPoint44,
6835
+ applyToPoint as applyToPoint45,
6790
6836
  compose as compose8,
6791
6837
  scale as scale4,
6792
6838
  translate as translate8
6793
6839
  } from "transformation-matrix";
6794
6840
 
6795
6841
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
6796
- import { applyToPoint as applyToPoint38 } from "transformation-matrix";
6842
+ import { applyToPoint as applyToPoint39 } from "transformation-matrix";
6797
6843
  var DEFAULT_BOARD_STYLE = {
6798
6844
  fill: "none",
6799
6845
  stroke: "rgb(0,0,0)",
@@ -6805,25 +6851,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
6805
6851
  let path;
6806
6852
  if (outline && Array.isArray(outline) && outline.length >= 3) {
6807
6853
  path = outline.map((point, index) => {
6808
- const [x, y] = applyToPoint38(transform, [point.x, point.y]);
6854
+ const [x, y] = applyToPoint39(transform, [point.x, point.y]);
6809
6855
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
6810
6856
  }).join(" ");
6811
6857
  } else {
6812
6858
  const halfWidth = width / 2;
6813
6859
  const halfHeight = height / 2;
6814
- const topLeft = applyToPoint38(transform, [
6860
+ const topLeft = applyToPoint39(transform, [
6815
6861
  center.x - halfWidth,
6816
6862
  center.y - halfHeight
6817
6863
  ]);
6818
- const topRight = applyToPoint38(transform, [
6864
+ const topRight = applyToPoint39(transform, [
6819
6865
  center.x + halfWidth,
6820
6866
  center.y - halfHeight
6821
6867
  ]);
6822
- const bottomRight = applyToPoint38(transform, [
6868
+ const bottomRight = applyToPoint39(transform, [
6823
6869
  center.x + halfWidth,
6824
6870
  center.y + halfHeight
6825
6871
  ]);
6826
- const bottomLeft = applyToPoint38(transform, [
6872
+ const bottomLeft = applyToPoint39(transform, [
6827
6873
  center.x - halfWidth,
6828
6874
  center.y + halfHeight
6829
6875
  ]);
@@ -6849,7 +6895,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
6849
6895
  }
6850
6896
 
6851
6897
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
6852
- import { applyToPoint as applyToPoint40 } from "transformation-matrix";
6898
+ import { applyToPoint as applyToPoint41 } from "transformation-matrix";
6853
6899
 
6854
6900
  // lib/utils/get-sch-font-size.ts
6855
6901
  import "transformation-matrix";
@@ -6875,8 +6921,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
6875
6921
  const { center, width, height, rotation = 0, layer = "top" } = elm;
6876
6922
  if (!center || typeof width !== "number" || typeof height !== "number")
6877
6923
  return null;
6878
- const [x, y] = applyToPoint40(transform, [center.x, center.y]);
6879
- const [pinX, pinY] = applyToPoint40(transform, [portPosition.x, portPosition.y]);
6924
+ const [x, y] = applyToPoint41(transform, [center.x, center.y]);
6925
+ const [pinX, pinY] = applyToPoint41(transform, [portPosition.x, portPosition.y]);
6880
6926
  const scaledWidth = width * Math.abs(transform.a);
6881
6927
  const scaledHeight = height * Math.abs(transform.d);
6882
6928
  const isTopLayer = layer === "top";
@@ -7038,11 +7084,11 @@ function getRectPathData(w, h, rotation) {
7038
7084
  }
7039
7085
 
7040
7086
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
7041
- import { applyToPoint as applyToPoint41 } from "transformation-matrix";
7087
+ import { applyToPoint as applyToPoint42 } from "transformation-matrix";
7042
7088
  var HOLE_COLOR2 = "rgb(190, 190, 190)";
7043
7089
  function createSvgObjectsFromAssemblyHole(hole, ctx) {
7044
7090
  const { transform } = ctx;
7045
- const [x, y] = applyToPoint41(transform, [hole.x, hole.y]);
7091
+ const [x, y] = applyToPoint42(transform, [hole.x, hole.y]);
7046
7092
  if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
7047
7093
  const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
7048
7094
  const radius = scaledDiameter / 2;
@@ -7106,12 +7152,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
7106
7152
  }
7107
7153
 
7108
7154
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
7109
- import { applyToPoint as applyToPoint42 } from "transformation-matrix";
7155
+ import { applyToPoint as applyToPoint43 } from "transformation-matrix";
7110
7156
  var PAD_COLOR = "rgb(210, 210, 210)";
7111
7157
  var HOLE_COLOR3 = "rgb(190, 190, 190)";
7112
7158
  function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
7113
7159
  const { transform } = ctx;
7114
- const [x, y] = applyToPoint42(transform, [hole.x, hole.y]);
7160
+ const [x, y] = applyToPoint43(transform, [hole.x, hole.y]);
7115
7161
  if (hole.shape === "pill") {
7116
7162
  const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
7117
7163
  const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
@@ -7206,7 +7252,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
7206
7252
  const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
7207
7253
  const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
7208
7254
  const holeRadius = scaledHoleDiameter / 2;
7209
- const [holeCx, holeCy] = applyToPoint42(transform, [
7255
+ const [holeCx, holeCy] = applyToPoint43(transform, [
7210
7256
  circularHole.x + circularHole.hole_offset_x,
7211
7257
  circularHole.y + circularHole.hole_offset_y
7212
7258
  ]);
@@ -7264,7 +7310,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
7264
7310
  const pillHoleWithOffsets = pillHole;
7265
7311
  const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
7266
7312
  const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
7267
- const [holeCenterX, holeCenterY] = applyToPoint42(transform, [
7313
+ const [holeCenterX, holeCenterY] = applyToPoint43(transform, [
7268
7314
  pillHole.x + holeOffsetX,
7269
7315
  pillHole.y + holeOffsetY
7270
7316
  ]);
@@ -7326,7 +7372,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
7326
7372
  const rotatedHoleWithOffsets = rotatedHole;
7327
7373
  const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
7328
7374
  const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
7329
- const [holeCenterX, holeCenterY] = applyToPoint42(transform, [
7375
+ const [holeCenterX, holeCenterY] = applyToPoint43(transform, [
7330
7376
  rotatedHole.x + holeOffsetX,
7331
7377
  rotatedHole.y + holeOffsetY
7332
7378
  ]);
@@ -7382,14 +7428,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
7382
7428
  }
7383
7429
 
7384
7430
  // lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
7385
- import { applyToPoint as applyToPoint43 } from "transformation-matrix";
7431
+ import { applyToPoint as applyToPoint44 } from "transformation-matrix";
7386
7432
  var PAD_COLOR2 = "rgb(210, 210, 210)";
7387
7433
  function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
7388
7434
  const { transform } = ctx;
7389
7435
  if (pad.shape === "rect" || pad.shape === "rotated_rect") {
7390
7436
  const width = pad.width * Math.abs(transform.a);
7391
7437
  const height = pad.height * Math.abs(transform.d);
7392
- const [x, y] = applyToPoint43(transform, [pad.x, pad.y]);
7438
+ const [x, y] = applyToPoint44(transform, [pad.x, pad.y]);
7393
7439
  const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
7394
7440
  if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
7395
7441
  return [
@@ -7441,7 +7487,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
7441
7487
  const width = pad.width * Math.abs(transform.a);
7442
7488
  const height = pad.height * Math.abs(transform.d);
7443
7489
  const radius = pad.radius * Math.abs(transform.a);
7444
- const [x, y] = applyToPoint43(transform, [pad.x, pad.y]);
7490
+ const [x, y] = applyToPoint44(transform, [pad.x, pad.y]);
7445
7491
  return [
7446
7492
  {
7447
7493
  name: "rect",
@@ -7464,7 +7510,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
7464
7510
  }
7465
7511
  if (pad.shape === "circle") {
7466
7512
  const radius = pad.radius * Math.abs(transform.a);
7467
- const [x, y] = applyToPoint43(transform, [pad.x, pad.y]);
7513
+ const [x, y] = applyToPoint44(transform, [pad.x, pad.y]);
7468
7514
  return [
7469
7515
  {
7470
7516
  name: "circle",
@@ -7484,7 +7530,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
7484
7530
  }
7485
7531
  if (pad.shape === "polygon") {
7486
7532
  const points = (pad.points ?? []).map(
7487
- (point) => applyToPoint43(transform, [point.x, point.y])
7533
+ (point) => applyToPoint44(transform, [point.x, point.y])
7488
7534
  );
7489
7535
  return [
7490
7536
  {
@@ -7668,8 +7714,8 @@ function createSvgObjects2(elm, ctx, soup) {
7668
7714
  }
7669
7715
  }
7670
7716
  function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
7671
- const [x1, y1] = applyToPoint44(transform, [minX, minY]);
7672
- const [x2, y2] = applyToPoint44(transform, [maxX, maxY]);
7717
+ const [x1, y1] = applyToPoint45(transform, [minX, minY]);
7718
+ const [x2, y2] = applyToPoint45(transform, [maxX, maxY]);
7673
7719
  const width = Math.abs(x2 - x1);
7674
7720
  const height = Math.abs(y2 - y1);
7675
7721
  const x = Math.min(x1, x2);
@@ -7698,7 +7744,7 @@ import {
7698
7744
  } from "transformation-matrix";
7699
7745
 
7700
7746
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
7701
- import { applyToPoint as applyToPoint45 } from "transformation-matrix";
7747
+ import { applyToPoint as applyToPoint46 } from "transformation-matrix";
7702
7748
  import { su as su4 } from "@tscircuit/circuit-json-util";
7703
7749
  var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
7704
7750
  var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
@@ -7712,25 +7758,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
7712
7758
  let path;
7713
7759
  if (outline && Array.isArray(outline) && outline.length >= 3) {
7714
7760
  path = outline.map((point, index) => {
7715
- const [x, y] = applyToPoint45(transform, [point.x, point.y]);
7761
+ const [x, y] = applyToPoint46(transform, [point.x, point.y]);
7716
7762
  return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
7717
7763
  }).join(" ");
7718
7764
  } else {
7719
7765
  const halfWidth = width / 2;
7720
7766
  const halfHeight = height / 2;
7721
- const topLeft = applyToPoint45(transform, [
7767
+ const topLeft = applyToPoint46(transform, [
7722
7768
  center.x - halfWidth,
7723
7769
  center.y - halfHeight
7724
7770
  ]);
7725
- const topRight = applyToPoint45(transform, [
7771
+ const topRight = applyToPoint46(transform, [
7726
7772
  center.x + halfWidth,
7727
7773
  center.y - halfHeight
7728
7774
  ]);
7729
- const bottomRight = applyToPoint45(transform, [
7775
+ const bottomRight = applyToPoint46(transform, [
7730
7776
  center.x + halfWidth,
7731
7777
  center.y + halfHeight
7732
7778
  ]);
7733
- const bottomLeft = applyToPoint45(transform, [
7779
+ const bottomLeft = applyToPoint46(transform, [
7734
7780
  center.x - halfWidth,
7735
7781
  center.y + halfHeight
7736
7782
  ]);
@@ -7748,10 +7794,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
7748
7794
  const halfWidth = width2 / 2;
7749
7795
  const halfHeight = height2 / 2;
7750
7796
  const [tl, tr, br, bl] = [
7751
- applyToPoint45(transform, [x - halfWidth, y - halfHeight]),
7752
- applyToPoint45(transform, [x + halfWidth, y - halfHeight]),
7753
- applyToPoint45(transform, [x + halfWidth, y + halfHeight]),
7754
- applyToPoint45(transform, [x - halfWidth, y + halfHeight])
7797
+ applyToPoint46(transform, [x - halfWidth, y - halfHeight]),
7798
+ applyToPoint46(transform, [x + halfWidth, y - halfHeight]),
7799
+ applyToPoint46(transform, [x + halfWidth, y + halfHeight]),
7800
+ applyToPoint46(transform, [x - halfWidth, y + halfHeight])
7755
7801
  ];
7756
7802
  path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
7757
7803
  } else if (cutout.shape === "circle") {
@@ -7801,7 +7847,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
7801
7847
 
7802
7848
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
7803
7849
  import { su as su5 } from "@tscircuit/circuit-json-util";
7804
- import { applyToPoint as applyToPoint46 } from "transformation-matrix";
7850
+ import { applyToPoint as applyToPoint47 } from "transformation-matrix";
7805
7851
  var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
7806
7852
  var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
7807
7853
  function createSvgObjectsFromPinoutComponent(elm, ctx) {
@@ -7811,7 +7857,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
7811
7857
  if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
7812
7858
  return [];
7813
7859
  }
7814
- const [x, y] = applyToPoint46(transform, [center.x, center.y]);
7860
+ const [x, y] = applyToPoint47(transform, [center.x, center.y]);
7815
7861
  const scaledWidth = width * Math.abs(transform.a);
7816
7862
  const scaledHeight = height * Math.abs(transform.d);
7817
7863
  const transformStr = `translate(${x}, ${y})`;
@@ -7872,11 +7918,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
7872
7918
  }
7873
7919
 
7874
7920
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
7875
- import { applyToPoint as applyToPoint47 } from "transformation-matrix";
7921
+ import { applyToPoint as applyToPoint48 } from "transformation-matrix";
7876
7922
  var HOLE_COLOR4 = "rgb(50, 50, 50)";
7877
7923
  function createSvgObjectsFromPinoutHole(hole, ctx) {
7878
7924
  const { transform } = ctx;
7879
- const [x, y] = applyToPoint47(transform, [hole.x, hole.y]);
7925
+ const [x, y] = applyToPoint48(transform, [hole.x, hole.y]);
7880
7926
  if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
7881
7927
  const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
7882
7928
  const radius = scaledDiameter / 2;
@@ -7940,12 +7986,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
7940
7986
  }
7941
7987
 
7942
7988
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
7943
- import { applyToPoint as applyToPoint48 } from "transformation-matrix";
7989
+ import { applyToPoint as applyToPoint49 } from "transformation-matrix";
7944
7990
  var PAD_COLOR3 = "rgb(218, 165, 32)";
7945
7991
  var HOLE_COLOR5 = "rgb(40, 40, 40)";
7946
7992
  function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
7947
7993
  const { transform } = ctx;
7948
- const [x, y] = applyToPoint48(transform, [hole.x, hole.y]);
7994
+ const [x, y] = applyToPoint49(transform, [hole.x, hole.y]);
7949
7995
  if (hole.shape === "pill") {
7950
7996
  const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
7951
7997
  const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
@@ -8180,14 +8226,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
8180
8226
  }
8181
8227
 
8182
8228
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
8183
- import { applyToPoint as applyToPoint49 } from "transformation-matrix";
8229
+ import { applyToPoint as applyToPoint50 } from "transformation-matrix";
8184
8230
  var PAD_COLOR4 = "rgb(218, 165, 32)";
8185
8231
  function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
8186
8232
  const { transform } = ctx;
8187
8233
  if (pad.shape === "rect" || pad.shape === "rotated_rect") {
8188
8234
  const width = pad.width * Math.abs(transform.a);
8189
8235
  const height = pad.height * Math.abs(transform.d);
8190
- const [x, y] = applyToPoint49(transform, [pad.x, pad.y]);
8236
+ const [x, y] = applyToPoint50(transform, [pad.x, pad.y]);
8191
8237
  if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
8192
8238
  return [
8193
8239
  {
@@ -8230,7 +8276,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
8230
8276
  const width = pad.width * Math.abs(transform.a);
8231
8277
  const height = pad.height * Math.abs(transform.d);
8232
8278
  const radius = pad.radius * Math.abs(transform.a);
8233
- const [x, y] = applyToPoint49(transform, [pad.x, pad.y]);
8279
+ const [x, y] = applyToPoint50(transform, [pad.x, pad.y]);
8234
8280
  return [
8235
8281
  {
8236
8282
  name: "rect",
@@ -8253,7 +8299,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
8253
8299
  }
8254
8300
  if (pad.shape === "circle") {
8255
8301
  const radius = pad.radius * Math.abs(transform.a);
8256
- const [x, y] = applyToPoint49(transform, [pad.x, pad.y]);
8302
+ const [x, y] = applyToPoint50(transform, [pad.x, pad.y]);
8257
8303
  return [
8258
8304
  {
8259
8305
  name: "circle",
@@ -8273,7 +8319,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
8273
8319
  }
8274
8320
  if (pad.shape === "polygon") {
8275
8321
  const points = (pad.points ?? []).map(
8276
- (point) => applyToPoint49(transform, [point.x, point.y])
8322
+ (point) => applyToPoint50(transform, [point.x, point.y])
8277
8323
  );
8278
8324
  return [
8279
8325
  {
@@ -8294,7 +8340,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
8294
8340
  }
8295
8341
 
8296
8342
  // lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
8297
- import { applyToPoint as applyToPoint50 } from "transformation-matrix";
8343
+ import { applyToPoint as applyToPoint51 } from "transformation-matrix";
8298
8344
  import { calculateElbow } from "calculate-elbow";
8299
8345
 
8300
8346
  // lib/pinout/svg-object-fns/pinout-label-box.ts
@@ -8371,7 +8417,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
8371
8417
  const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
8372
8418
  if (!label_info) return [];
8373
8419
  const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
8374
- const [port_x, port_y] = applyToPoint50(ctx.transform, [pcb_port.x, pcb_port.y]);
8420
+ const [port_x, port_y] = applyToPoint51(ctx.transform, [pcb_port.x, pcb_port.y]);
8375
8421
  const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
8376
8422
  const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
8377
8423
  const elbow_path = calculateElbow(
@@ -8512,7 +8558,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
8512
8558
  }
8513
8559
 
8514
8560
  // lib/pinout/calculate-label-positions.ts
8515
- import { applyToPoint as applyToPoint51 } from "transformation-matrix";
8561
+ import { applyToPoint as applyToPoint52 } from "transformation-matrix";
8516
8562
 
8517
8563
  // lib/pinout/constants.ts
8518
8564
  var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
@@ -8550,7 +8596,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
8550
8596
  );
8551
8597
  const mapToEdgePort = (pinout_label) => ({
8552
8598
  pcb_port: pinout_label.pcb_port,
8553
- y: applyToPoint51(transform, [
8599
+ y: applyToPoint52(transform, [
8554
8600
  pinout_label.pcb_port.x,
8555
8601
  pinout_label.pcb_port.y
8556
8602
  ])[1],
@@ -8565,7 +8611,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
8565
8611
  } else {
8566
8612
  edge_ports = pinout_labels.map((pinout_label) => ({
8567
8613
  pcb_port: pinout_label.pcb_port,
8568
- y: applyToPoint51(transform, [
8614
+ y: applyToPoint52(transform, [
8569
8615
  pinout_label.pcb_port.x,
8570
8616
  pinout_label.pcb_port.y
8571
8617
  ])[1],
@@ -8573,7 +8619,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
8573
8619
  })).sort((a, b) => a.y - b.y);
8574
8620
  }
8575
8621
  if (edge_ports.length === 0) return;
8576
- const board_edge_x = applyToPoint51(transform, [
8622
+ const board_edge_x = applyToPoint52(transform, [
8577
8623
  edge === "left" ? board_bounds.minX : board_bounds.maxX,
8578
8624
  0
8579
8625
  ])[0];
@@ -8995,14 +9041,14 @@ import {
8995
9041
  } from "transformation-matrix";
8996
9042
 
8997
9043
  // lib/sch/draw-schematic-grid.ts
8998
- import { applyToPoint as applyToPoint52 } from "transformation-matrix";
9044
+ import { applyToPoint as applyToPoint53 } from "transformation-matrix";
8999
9045
  function drawSchematicGrid(params) {
9000
9046
  const { minX, minY, maxX, maxY } = params.bounds;
9001
9047
  const cellSize = params.cellSize ?? 1;
9002
9048
  const labelCells = params.labelCells ?? false;
9003
9049
  const gridLines = [];
9004
9050
  const transformPoint = (x, y) => {
9005
- const [transformedX, transformedY] = applyToPoint52(params.transform, [x, y]);
9051
+ const [transformedX, transformedY] = applyToPoint53(params.transform, [x, y]);
9006
9052
  return { x: transformedX, y: transformedY };
9007
9053
  };
9008
9054
  for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
@@ -9083,15 +9129,15 @@ function drawSchematicGrid(params) {
9083
9129
  }
9084
9130
 
9085
9131
  // lib/sch/draw-schematic-labeled-points.ts
9086
- import { applyToPoint as applyToPoint53 } from "transformation-matrix";
9132
+ import { applyToPoint as applyToPoint54 } from "transformation-matrix";
9087
9133
  function drawSchematicLabeledPoints(params) {
9088
9134
  const { points, transform } = params;
9089
9135
  const labeledPointsGroup = [];
9090
9136
  for (const point of points) {
9091
- const [x1, y1] = applyToPoint53(transform, [point.x - 0.1, point.y - 0.1]);
9092
- const [x2, y2] = applyToPoint53(transform, [point.x + 0.1, point.y + 0.1]);
9093
- const [x3, y3] = applyToPoint53(transform, [point.x - 0.1, point.y + 0.1]);
9094
- const [x4, y4] = applyToPoint53(transform, [point.x + 0.1, point.y - 0.1]);
9137
+ const [x1, y1] = applyToPoint54(transform, [point.x - 0.1, point.y - 0.1]);
9138
+ const [x2, y2] = applyToPoint54(transform, [point.x + 0.1, point.y + 0.1]);
9139
+ const [x3, y3] = applyToPoint54(transform, [point.x - 0.1, point.y + 0.1]);
9140
+ const [x4, y4] = applyToPoint54(transform, [point.x + 0.1, point.y - 0.1]);
9095
9141
  labeledPointsGroup.push({
9096
9142
  name: "path",
9097
9143
  type: "element",
@@ -9102,7 +9148,7 @@ function drawSchematicLabeledPoints(params) {
9102
9148
  "stroke-opacity": "0.7"
9103
9149
  }
9104
9150
  });
9105
- const [labelX, labelY] = applyToPoint53(transform, [
9151
+ const [labelX, labelY] = applyToPoint54(transform, [
9106
9152
  point.x + 0.15,
9107
9153
  point.y - 0.15
9108
9154
  ]);
@@ -10220,7 +10266,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
10220
10266
  import { symbols } from "schematic-symbols";
10221
10267
  import "svgson";
10222
10268
  import {
10223
- applyToPoint as applyToPoint55,
10269
+ applyToPoint as applyToPoint56,
10224
10270
  compose as compose11
10225
10271
  } from "transformation-matrix";
10226
10272
 
@@ -10304,13 +10350,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
10304
10350
  }
10305
10351
 
10306
10352
  // lib/sch/svg-object-fns/create-svg-error-text.ts
10307
- import { applyToPoint as applyToPoint54 } from "transformation-matrix";
10353
+ import { applyToPoint as applyToPoint55 } from "transformation-matrix";
10308
10354
  var createSvgSchErrorText = ({
10309
10355
  text,
10310
10356
  realCenter,
10311
10357
  realToScreenTransform
10312
10358
  }) => {
10313
- const screenCenter = applyToPoint54(realToScreenTransform, realCenter);
10359
+ const screenCenter = applyToPoint55(realToScreenTransform, realCenter);
10314
10360
  return {
10315
10361
  type: "element",
10316
10362
  name: "text",
@@ -10419,11 +10465,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
10419
10465
  minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
10420
10466
  maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
10421
10467
  };
10422
- const [screenMinX, screenMinY] = applyToPoint55(
10468
+ const [screenMinX, screenMinY] = applyToPoint56(
10423
10469
  compose11(realToScreenTransform, transformFromSymbolToReal),
10424
10470
  [bounds.minX, bounds.minY]
10425
10471
  );
10426
- const [screenMaxX, screenMaxY] = applyToPoint55(
10472
+ const [screenMaxX, screenMaxY] = applyToPoint56(
10427
10473
  compose11(realToScreenTransform, transformFromSymbolToReal),
10428
10474
  [bounds.maxX, bounds.maxY]
10429
10475
  );
@@ -10452,7 +10498,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
10452
10498
  name: "path",
10453
10499
  attributes: {
10454
10500
  d: points.map((p, i) => {
10455
- const [x, y] = applyToPoint55(
10501
+ const [x, y] = applyToPoint56(
10456
10502
  compose11(realToScreenTransform, transformFromSymbolToReal),
10457
10503
  [p.x, p.y]
10458
10504
  );
@@ -10468,7 +10514,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
10468
10514
  });
10469
10515
  }
10470
10516
  for (const text of texts) {
10471
- const screenTextPos = applyToPoint55(
10517
+ const screenTextPos = applyToPoint56(
10472
10518
  compose11(realToScreenTransform, transformFromSymbolToReal),
10473
10519
  text
10474
10520
  );
@@ -10520,7 +10566,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
10520
10566
  });
10521
10567
  }
10522
10568
  for (const box of boxes) {
10523
- const screenBoxPos = applyToPoint55(
10569
+ const screenBoxPos = applyToPoint56(
10524
10570
  compose11(realToScreenTransform, transformFromSymbolToReal),
10525
10571
  box
10526
10572
  );
@@ -10544,7 +10590,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
10544
10590
  }
10545
10591
  for (const port of symbol.ports) {
10546
10592
  if (connectedSymbolPorts.has(port)) continue;
10547
- const screenPortPos = applyToPoint55(
10593
+ const screenPortPos = applyToPoint56(
10548
10594
  compose11(realToScreenTransform, transformFromSymbolToReal),
10549
10595
  port
10550
10596
  );
@@ -10564,7 +10610,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
10564
10610
  });
10565
10611
  }
10566
10612
  for (const circle of circles) {
10567
- const screenCirclePos = applyToPoint55(
10613
+ const screenCirclePos = applyToPoint56(
10568
10614
  compose11(realToScreenTransform, transformFromSymbolToReal),
10569
10615
  circle
10570
10616
  );
@@ -10591,14 +10637,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
10591
10637
  import { su as su10 } from "@tscircuit/circuit-json-util";
10592
10638
  import "schematic-symbols";
10593
10639
  import "svgson";
10594
- import { applyToPoint as applyToPoint61 } from "transformation-matrix";
10640
+ import { applyToPoint as applyToPoint62 } from "transformation-matrix";
10595
10641
 
10596
10642
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
10597
10643
  import "transformation-matrix";
10598
10644
  import "@tscircuit/circuit-json-util";
10599
10645
 
10600
10646
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
10601
- import { applyToPoint as applyToPoint56 } from "transformation-matrix";
10647
+ import { applyToPoint as applyToPoint57 } from "transformation-matrix";
10602
10648
  import { su as su8 } from "@tscircuit/circuit-json-util";
10603
10649
  var PIN_CIRCLE_RADIUS_MM = 0.02;
10604
10650
  var createArrow = (tip, angle, size, color, strokeWidth) => {
@@ -10651,8 +10697,8 @@ var createSvgObjectsForSchPortBoxLine = ({
10651
10697
  realEdgePos.y += realPinLineLength;
10652
10698
  break;
10653
10699
  }
10654
- const screenSchPortPos = applyToPoint56(transform, schPort.center);
10655
- const screenRealEdgePos = applyToPoint56(transform, realEdgePos);
10700
+ const screenSchPortPos = applyToPoint57(transform, schPort.center);
10701
+ const screenRealEdgePos = applyToPoint57(transform, realEdgePos);
10656
10702
  const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
10657
10703
  const realLineEnd = { ...schPort.center };
10658
10704
  if (!isConnected) {
@@ -10671,7 +10717,7 @@ var createSvgObjectsForSchPortBoxLine = ({
10671
10717
  break;
10672
10718
  }
10673
10719
  }
10674
- const screenLineEnd = applyToPoint56(transform, realLineEnd);
10720
+ const screenLineEnd = applyToPoint57(transform, realLineEnd);
10675
10721
  svgObjects.push({
10676
10722
  name: "line",
10677
10723
  type: "element",
@@ -10792,7 +10838,7 @@ var createSvgObjectsForSchPortBoxLine = ({
10792
10838
  };
10793
10839
 
10794
10840
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
10795
- import { applyToPoint as applyToPoint57 } from "transformation-matrix";
10841
+ import { applyToPoint as applyToPoint58 } from "transformation-matrix";
10796
10842
  var createSvgObjectsForSchPortPinNumberText = (params) => {
10797
10843
  const svgObjects = [];
10798
10844
  const { schPort, schComponent, transform, circuitJson } = params;
@@ -10810,7 +10856,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
10810
10856
  } else {
10811
10857
  realPinNumberPos.y += 0.02;
10812
10858
  }
10813
- const screenPinNumberTextPos = applyToPoint57(transform, realPinNumberPos);
10859
+ const screenPinNumberTextPos = applyToPoint58(transform, realPinNumberPos);
10814
10860
  svgObjects.push({
10815
10861
  name: "text",
10816
10862
  type: "element",
@@ -10840,7 +10886,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
10840
10886
  };
10841
10887
 
10842
10888
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
10843
- import { applyToPoint as applyToPoint58 } from "transformation-matrix";
10889
+ import { applyToPoint as applyToPoint59 } from "transformation-matrix";
10844
10890
  var LABEL_DIST_FROM_EDGE_MM = 0.1;
10845
10891
  var createSvgObjectsForSchPortPinLabel = (params) => {
10846
10892
  const svgObjects = [];
@@ -10854,7 +10900,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
10854
10900
  const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
10855
10901
  realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
10856
10902
  realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
10857
- const screenPinNumberTextPos = applyToPoint58(transform, realPinNumberPos);
10903
+ const screenPinNumberTextPos = applyToPoint59(transform, realPinNumberPos);
10858
10904
  const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
10859
10905
  if (!label) return [];
10860
10906
  const isNegated = label.startsWith("N_");
@@ -10902,13 +10948,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
10902
10948
  };
10903
10949
 
10904
10950
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
10905
- import { applyToPoint as applyToPoint60 } from "transformation-matrix";
10951
+ import { applyToPoint as applyToPoint61 } from "transformation-matrix";
10906
10952
  var createSvgSchText = ({
10907
10953
  elm,
10908
10954
  transform,
10909
10955
  colorMap: colorMap2
10910
10956
  }) => {
10911
- const center = applyToPoint60(transform, elm.position);
10957
+ const center = applyToPoint61(transform, elm.position);
10912
10958
  const textAnchorMap = {
10913
10959
  center: "middle",
10914
10960
  center_right: "end",
@@ -10992,11 +11038,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
10992
11038
  colorMap: colorMap2
10993
11039
  }) => {
10994
11040
  const svgObjects = [];
10995
- const componentScreenTopLeft = applyToPoint61(transform, {
11041
+ const componentScreenTopLeft = applyToPoint62(transform, {
10996
11042
  x: schComponent.center.x - schComponent.size.width / 2,
10997
11043
  y: schComponent.center.y + schComponent.size.height / 2
10998
11044
  });
10999
- const componentScreenBottomRight = applyToPoint61(transform, {
11045
+ const componentScreenBottomRight = applyToPoint62(transform, {
11000
11046
  x: schComponent.center.x + schComponent.size.width / 2,
11001
11047
  y: schComponent.center.y - schComponent.size.height / 2
11002
11048
  });
@@ -11082,13 +11128,13 @@ function createSvgObjectsFromSchematicComponent(params) {
11082
11128
  }
11083
11129
 
11084
11130
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
11085
- import { applyToPoint as applyToPoint62 } from "transformation-matrix";
11131
+ import { applyToPoint as applyToPoint63 } from "transformation-matrix";
11086
11132
  function createSvgObjectsFromSchVoltageProbe({
11087
11133
  probe,
11088
11134
  transform,
11089
11135
  colorMap: colorMap2
11090
11136
  }) {
11091
- const [screenX, screenY] = applyToPoint62(transform, [
11137
+ const [screenX, screenY] = applyToPoint63(transform, [
11092
11138
  probe.position.x,
11093
11139
  probe.position.y
11094
11140
  ]);
@@ -11262,17 +11308,17 @@ function createSvgObjectsFromSchVoltageProbe({
11262
11308
  }
11263
11309
 
11264
11310
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
11265
- import { applyToPoint as applyToPoint63 } from "transformation-matrix";
11311
+ import { applyToPoint as applyToPoint64 } from "transformation-matrix";
11266
11312
  function createSvgObjectsFromSchDebugObject({
11267
11313
  debugObject,
11268
11314
  transform
11269
11315
  }) {
11270
11316
  if (debugObject.shape === "rect") {
11271
- let [screenLeft, screenTop] = applyToPoint63(transform, [
11317
+ let [screenLeft, screenTop] = applyToPoint64(transform, [
11272
11318
  debugObject.center.x - debugObject.size.width / 2,
11273
11319
  debugObject.center.y - debugObject.size.height / 2
11274
11320
  ]);
11275
- let [screenRight, screenBottom] = applyToPoint63(transform, [
11321
+ let [screenRight, screenBottom] = applyToPoint64(transform, [
11276
11322
  debugObject.center.x + debugObject.size.width / 2,
11277
11323
  debugObject.center.y + debugObject.size.height / 2
11278
11324
  ]);
@@ -11282,7 +11328,7 @@ function createSvgObjectsFromSchDebugObject({
11282
11328
  ];
11283
11329
  const width = Math.abs(screenRight - screenLeft);
11284
11330
  const height = Math.abs(screenBottom - screenTop);
11285
- const [screenCenterX, screenCenterY] = applyToPoint63(transform, [
11331
+ const [screenCenterX, screenCenterY] = applyToPoint64(transform, [
11286
11332
  debugObject.center.x,
11287
11333
  debugObject.center.y
11288
11334
  ]);
@@ -11328,11 +11374,11 @@ function createSvgObjectsFromSchDebugObject({
11328
11374
  ];
11329
11375
  }
11330
11376
  if (debugObject.shape === "line") {
11331
- const [screenStartX, screenStartY] = applyToPoint63(transform, [
11377
+ const [screenStartX, screenStartY] = applyToPoint64(transform, [
11332
11378
  debugObject.start.x,
11333
11379
  debugObject.start.y
11334
11380
  ]);
11335
- const [screenEndX, screenEndY] = applyToPoint63(transform, [
11381
+ const [screenEndX, screenEndY] = applyToPoint64(transform, [
11336
11382
  debugObject.end.x,
11337
11383
  debugObject.end.y
11338
11384
  ]);
@@ -11382,7 +11428,7 @@ function createSvgObjectsFromSchDebugObject({
11382
11428
  }
11383
11429
 
11384
11430
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
11385
- import { applyToPoint as applyToPoint64 } from "transformation-matrix";
11431
+ import { applyToPoint as applyToPoint65 } from "transformation-matrix";
11386
11432
  function createSchematicTrace({
11387
11433
  trace,
11388
11434
  transform,
@@ -11396,11 +11442,11 @@ function createSchematicTrace({
11396
11442
  for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
11397
11443
  const edge = edges[edgeIndex];
11398
11444
  if (edge.is_crossing) continue;
11399
- const [screenFromX, screenFromY] = applyToPoint64(transform, [
11445
+ const [screenFromX, screenFromY] = applyToPoint65(transform, [
11400
11446
  edge.from.x,
11401
11447
  edge.from.y
11402
11448
  ]);
11403
- const [screenToX, screenToY] = applyToPoint64(transform, [
11449
+ const [screenToX, screenToY] = applyToPoint65(transform, [
11404
11450
  edge.to.x,
11405
11451
  edge.to.y
11406
11452
  ]);
@@ -11444,11 +11490,11 @@ function createSchematicTrace({
11444
11490
  }
11445
11491
  for (const edge of edges) {
11446
11492
  if (!edge.is_crossing) continue;
11447
- const [screenFromX, screenFromY] = applyToPoint64(transform, [
11493
+ const [screenFromX, screenFromY] = applyToPoint65(transform, [
11448
11494
  edge.from.x,
11449
11495
  edge.from.y
11450
11496
  ]);
11451
- const [screenToX, screenToY] = applyToPoint64(transform, [
11497
+ const [screenToX, screenToY] = applyToPoint65(transform, [
11452
11498
  edge.to.x,
11453
11499
  edge.to.y
11454
11500
  ]);
@@ -11492,7 +11538,7 @@ function createSchematicTrace({
11492
11538
  }
11493
11539
  if (trace.junctions) {
11494
11540
  for (const junction of trace.junctions) {
11495
- const [screenX, screenY] = applyToPoint64(transform, [
11541
+ const [screenX, screenY] = applyToPoint65(transform, [
11496
11542
  junction.x,
11497
11543
  junction.y
11498
11544
  ]);
@@ -11547,7 +11593,7 @@ function createSchematicTrace({
11547
11593
 
11548
11594
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
11549
11595
  import {
11550
- applyToPoint as applyToPoint66,
11596
+ applyToPoint as applyToPoint67,
11551
11597
  compose as compose13,
11552
11598
  rotate as rotate7,
11553
11599
  scale as scale7,
@@ -11556,7 +11602,7 @@ import {
11556
11602
 
11557
11603
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
11558
11604
  import {
11559
- applyToPoint as applyToPoint65,
11605
+ applyToPoint as applyToPoint66,
11560
11606
  compose as compose12,
11561
11607
  rotate as rotate6,
11562
11608
  scale as scale6,
@@ -11631,7 +11677,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
11631
11677
  x: symbolBounds.minX,
11632
11678
  y: (symbolBounds.minY + symbolBounds.maxY) / 2
11633
11679
  };
11634
- const rotatedSymbolEnd = applyToPoint65(rotationMatrix, symbolEndPoint);
11680
+ const rotatedSymbolEnd = applyToPoint66(rotationMatrix, symbolEndPoint);
11635
11681
  const symbolToRealTransform = compose12(
11636
11682
  translate12(
11637
11683
  realAnchorPosition.x - rotatedSymbolEnd.x,
@@ -11641,11 +11687,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
11641
11687
  scale6(1)
11642
11688
  // Use full symbol size
11643
11689
  );
11644
- const [screenMinX, screenMinY] = applyToPoint65(
11690
+ const [screenMinX, screenMinY] = applyToPoint66(
11645
11691
  compose12(realToScreenTransform, symbolToRealTransform),
11646
11692
  [bounds.minX, bounds.minY]
11647
11693
  );
11648
- const [screenMaxX, screenMaxY] = applyToPoint65(
11694
+ const [screenMaxX, screenMaxY] = applyToPoint66(
11649
11695
  compose12(realToScreenTransform, symbolToRealTransform),
11650
11696
  [bounds.maxX, bounds.maxY]
11651
11697
  );
@@ -11669,7 +11715,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
11669
11715
  });
11670
11716
  for (const path of symbolPaths) {
11671
11717
  const symbolPath = path.points.map((p, i) => {
11672
- const [x, y] = applyToPoint65(
11718
+ const [x, y] = applyToPoint66(
11673
11719
  compose12(realToScreenTransform, symbolToRealTransform),
11674
11720
  [p.x, p.y]
11675
11721
  );
@@ -11690,7 +11736,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
11690
11736
  });
11691
11737
  }
11692
11738
  for (const text of symbolTexts) {
11693
- const screenTextPos = applyToPoint65(
11739
+ const screenTextPos = applyToPoint66(
11694
11740
  compose12(realToScreenTransform, symbolToRealTransform),
11695
11741
  text
11696
11742
  );
@@ -11732,7 +11778,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
11732
11778
  });
11733
11779
  }
11734
11780
  for (const box of symbolBoxes) {
11735
- const screenBoxPos = applyToPoint65(
11781
+ const screenBoxPos = applyToPoint66(
11736
11782
  compose12(realToScreenTransform, symbolToRealTransform),
11737
11783
  box
11738
11784
  );
@@ -11755,7 +11801,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
11755
11801
  });
11756
11802
  }
11757
11803
  for (const circle of symbolCircles) {
11758
- const screenCirclePos = applyToPoint65(
11804
+ const screenCirclePos = applyToPoint66(
11759
11805
  compose12(realToScreenTransform, symbolToRealTransform),
11760
11806
  circle
11761
11807
  );
@@ -11800,14 +11846,14 @@ var createSvgObjectsForSchNetLabel = ({
11800
11846
  const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
11801
11847
  const fontSizeMm = getSchMmFontSize("net_label");
11802
11848
  const textWidthFSR = estimateTextWidth(labelText || "");
11803
- const screenCenter = applyToPoint66(realToScreenTransform, schNetLabel.center);
11849
+ const screenCenter = applyToPoint67(realToScreenTransform, schNetLabel.center);
11804
11850
  const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
11805
11851
  schNetLabel.anchor_side
11806
11852
  );
11807
11853
  const screenTextGrowthVec = { ...realTextGrowthVec };
11808
11854
  screenTextGrowthVec.y *= -1;
11809
11855
  const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
11810
- const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint66(realToScreenTransform, schNetLabel.anchor_position) : {
11856
+ const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint67(realToScreenTransform, schNetLabel.anchor_position) : {
11811
11857
  x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
11812
11858
  y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
11813
11859
  };
@@ -11848,7 +11894,7 @@ var createSvgObjectsForSchNetLabel = ({
11848
11894
  y: -0.6
11849
11895
  }
11850
11896
  ].map(
11851
- (fontRelativePoint) => applyToPoint66(
11897
+ (fontRelativePoint) => applyToPoint67(
11852
11898
  compose13(
11853
11899
  realToScreenTransform,
11854
11900
  translate13(realAnchorPosition.x, realAnchorPosition.y),
@@ -11925,17 +11971,17 @@ var createSvgObjectsForSchNetLabel = ({
11925
11971
  };
11926
11972
 
11927
11973
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
11928
- import { applyToPoint as applyToPoint67 } from "transformation-matrix";
11974
+ import { applyToPoint as applyToPoint68 } from "transformation-matrix";
11929
11975
  var createSvgObjectsFromSchematicBox = ({
11930
11976
  schematicBox,
11931
11977
  transform,
11932
11978
  colorMap: colorMap2
11933
11979
  }) => {
11934
- const topLeft = applyToPoint67(transform, {
11980
+ const topLeft = applyToPoint68(transform, {
11935
11981
  x: schematicBox.x,
11936
11982
  y: schematicBox.y
11937
11983
  });
11938
- const bottomRight = applyToPoint67(transform, {
11984
+ const bottomRight = applyToPoint68(transform, {
11939
11985
  x: schematicBox.x + schematicBox.width,
11940
11986
  y: schematicBox.y + schematicBox.height
11941
11987
  });
@@ -11971,7 +12017,7 @@ var createSvgObjectsFromSchematicBox = ({
11971
12017
  };
11972
12018
 
11973
12019
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
11974
- import { applyToPoint as applyToPoint68 } from "transformation-matrix";
12020
+ import { applyToPoint as applyToPoint69 } from "transformation-matrix";
11975
12021
  var createSvgObjectsFromSchematicTable = ({
11976
12022
  schematicTable,
11977
12023
  transform,
@@ -12004,11 +12050,11 @@ var createSvgObjectsFromSchematicTable = ({
12004
12050
  const svgObjects = [];
12005
12051
  const borderStrokeWidth = border_width * Math.abs(transform.a);
12006
12052
  const gridStrokeWidth = getSchStrokeSize(transform);
12007
- const [screenTopLeftX, screenTopLeftY] = applyToPoint68(transform, [
12053
+ const [screenTopLeftX, screenTopLeftY] = applyToPoint69(transform, [
12008
12054
  topLeftX,
12009
12055
  topLeftY
12010
12056
  ]);
12011
- const [screenBottomRightX, screenBottomRightY] = applyToPoint68(transform, [
12057
+ const [screenBottomRightX, screenBottomRightY] = applyToPoint69(transform, [
12012
12058
  topLeftX + totalWidth,
12013
12059
  topLeftY - totalHeight
12014
12060
  ]);
@@ -12040,8 +12086,8 @@ var createSvgObjectsFromSchematicTable = ({
12040
12086
  (cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
12041
12087
  );
12042
12088
  if (!isMerged) {
12043
- const start = applyToPoint68(transform, { x: currentX, y: segmentStartY });
12044
- const end = applyToPoint68(transform, { x: currentX, y: segmentEndY });
12089
+ const start = applyToPoint69(transform, { x: currentX, y: segmentStartY });
12090
+ const end = applyToPoint69(transform, { x: currentX, y: segmentEndY });
12045
12091
  svgObjects.push({
12046
12092
  name: "line",
12047
12093
  type: "element",
@@ -12070,11 +12116,11 @@ var createSvgObjectsFromSchematicTable = ({
12070
12116
  (cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
12071
12117
  );
12072
12118
  if (!isMerged) {
12073
- const start = applyToPoint68(transform, {
12119
+ const start = applyToPoint69(transform, {
12074
12120
  x: segmentStartX,
12075
12121
  y: currentY
12076
12122
  });
12077
- const end = applyToPoint68(transform, { x: segmentEndX, y: currentY });
12123
+ const end = applyToPoint69(transform, { x: segmentEndX, y: currentY });
12078
12124
  svgObjects.push({
12079
12125
  name: "line",
12080
12126
  type: "element",
@@ -12116,7 +12162,7 @@ var createSvgObjectsFromSchematicTable = ({
12116
12162
  } else if (vertical_align === "bottom") {
12117
12163
  realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
12118
12164
  }
12119
- const screenTextAnchorPos = applyToPoint68(transform, realTextAnchorPos);
12165
+ const screenTextAnchorPos = applyToPoint69(transform, realTextAnchorPos);
12120
12166
  const fontSize = getSchScreenFontSize(
12121
12167
  transform,
12122
12168
  "reference_designator",
@@ -12172,13 +12218,13 @@ var createSvgObjectsFromSchematicTable = ({
12172
12218
 
12173
12219
  // lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
12174
12220
  import { su as su11 } from "@tscircuit/circuit-json-util";
12175
- import { applyToPoint as applyToPoint69 } from "transformation-matrix";
12221
+ import { applyToPoint as applyToPoint70 } from "transformation-matrix";
12176
12222
  var PIN_CIRCLE_RADIUS_MM2 = 0.02;
12177
12223
  var createSvgObjectsForSchPortHover = ({
12178
12224
  schPort,
12179
12225
  transform
12180
12226
  }) => {
12181
- const screenSchPortPos = applyToPoint69(transform, schPort.center);
12227
+ const screenSchPortPos = applyToPoint70(transform, schPort.center);
12182
12228
  const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
12183
12229
  return [
12184
12230
  {
@@ -12223,14 +12269,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
12223
12269
  };
12224
12270
 
12225
12271
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
12226
- import { applyToPoint as applyToPoint70 } from "transformation-matrix";
12272
+ import { applyToPoint as applyToPoint71 } from "transformation-matrix";
12227
12273
  function createSvgObjectsFromSchematicLine({
12228
12274
  schLine,
12229
12275
  transform,
12230
12276
  colorMap: colorMap2
12231
12277
  }) {
12232
- const p1 = applyToPoint70(transform, { x: schLine.x1, y: schLine.y1 });
12233
- const p2 = applyToPoint70(transform, { x: schLine.x2, y: schLine.y2 });
12278
+ const p1 = applyToPoint71(transform, { x: schLine.x1, y: schLine.y1 });
12279
+ const p2 = applyToPoint71(transform, { x: schLine.x2, y: schLine.y2 });
12234
12280
  const strokeWidth = schLine.stroke_width ?? 0.02;
12235
12281
  const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
12236
12282
  return [
@@ -12259,13 +12305,13 @@ function createSvgObjectsFromSchematicLine({
12259
12305
  }
12260
12306
 
12261
12307
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
12262
- import { applyToPoint as applyToPoint71 } from "transformation-matrix";
12308
+ import { applyToPoint as applyToPoint72 } from "transformation-matrix";
12263
12309
  function createSvgObjectsFromSchematicCircle({
12264
12310
  schCircle,
12265
12311
  transform,
12266
12312
  colorMap: colorMap2
12267
12313
  }) {
12268
- const center = applyToPoint71(transform, schCircle.center);
12314
+ const center = applyToPoint72(transform, schCircle.center);
12269
12315
  const transformedRadius = Math.abs(transform.a) * schCircle.radius;
12270
12316
  const strokeWidth = schCircle.stroke_width ?? 0.02;
12271
12317
  const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
@@ -12295,13 +12341,13 @@ function createSvgObjectsFromSchematicCircle({
12295
12341
  }
12296
12342
 
12297
12343
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
12298
- import { applyToPoint as applyToPoint72 } from "transformation-matrix";
12344
+ import { applyToPoint as applyToPoint73 } from "transformation-matrix";
12299
12345
  function createSvgObjectsFromSchematicRect({
12300
12346
  schRect,
12301
12347
  transform,
12302
12348
  colorMap: colorMap2
12303
12349
  }) {
12304
- const center = applyToPoint72(transform, schRect.center);
12350
+ const center = applyToPoint73(transform, schRect.center);
12305
12351
  const transformedWidth = Math.abs(transform.a) * schRect.width;
12306
12352
  const transformedHeight = Math.abs(transform.d) * schRect.height;
12307
12353
  const strokeWidth = schRect.stroke_width ?? 0.02;
@@ -12337,13 +12383,13 @@ function createSvgObjectsFromSchematicRect({
12337
12383
  }
12338
12384
 
12339
12385
  // lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
12340
- import { applyToPoint as applyToPoint73 } from "transformation-matrix";
12386
+ import { applyToPoint as applyToPoint74 } from "transformation-matrix";
12341
12387
  function createSvgObjectsFromSchematicArc({
12342
12388
  schArc,
12343
12389
  transform,
12344
12390
  colorMap: colorMap2
12345
12391
  }) {
12346
- const center = applyToPoint73(transform, schArc.center);
12392
+ const center = applyToPoint74(transform, schArc.center);
12347
12393
  const transformedRadius = Math.abs(transform.a) * schArc.radius;
12348
12394
  const strokeWidth = schArc.stroke_width ?? 0.02;
12349
12395
  const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
@@ -13463,18 +13509,18 @@ function formatNumber2(value) {
13463
13509
  import { distance as distance4 } from "circuit-json";
13464
13510
  import { stringify as stringify7 } from "svgson";
13465
13511
  import {
13466
- applyToPoint as applyToPoint76,
13512
+ applyToPoint as applyToPoint77,
13467
13513
  compose as compose16,
13468
13514
  scale as scale9,
13469
13515
  translate as translate16
13470
13516
  } from "transformation-matrix";
13471
13517
 
13472
13518
  // lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
13473
- import { applyToPoint as applyToPoint75 } from "transformation-matrix";
13519
+ import { applyToPoint as applyToPoint76 } from "transformation-matrix";
13474
13520
  function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
13475
13521
  const { transform, layer: layerFilter } = ctx;
13476
13522
  if (layerFilter && solderPaste.layer !== layerFilter) return [];
13477
- const [x, y] = applyToPoint75(transform, [solderPaste.x, solderPaste.y]);
13523
+ const [x, y] = applyToPoint76(transform, [solderPaste.x, solderPaste.y]);
13478
13524
  if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
13479
13525
  const width = solderPaste.width * Math.abs(transform.a);
13480
13526
  const height = solderPaste.height * Math.abs(transform.d);
@@ -13700,8 +13746,8 @@ function createSvgObjects4({ elm, ctx }) {
13700
13746
  }
13701
13747
  }
13702
13748
  function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
13703
- const [x1, y1] = applyToPoint76(transform, [minX, minY]);
13704
- const [x2, y2] = applyToPoint76(transform, [maxX, maxY]);
13749
+ const [x1, y1] = applyToPoint77(transform, [minX, minY]);
13750
+ const [x2, y2] = applyToPoint77(transform, [maxX, maxY]);
13705
13751
  const width = Math.abs(x2 - x1);
13706
13752
  const height = Math.abs(y2 - y1);
13707
13753
  const x = Math.min(x1, x2);