@tscircuit/core 0.0.986 → 0.0.987

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.
Files changed (2) hide show
  1. package/dist/index.js +144 -130
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2376,10 +2376,10 @@ var SmtPad = class extends PrimitiveComponent2 {
2376
2376
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
2377
2377
  });
2378
2378
  } else if (props.shape === "polygon") {
2379
- const transformedPoints = props.points.map((point4) => {
2379
+ const transformedPoints = props.points.map((point6) => {
2380
2380
  const transformed = applyToPoint2(globalTransform, {
2381
- x: distance.parse(point4.x),
2382
- y: distance.parse(point4.y)
2381
+ x: distance.parse(point6.x),
2382
+ y: distance.parse(point6.y)
2383
2383
  });
2384
2384
  return {
2385
2385
  x: transformed.x,
@@ -2611,18 +2611,18 @@ var SilkscreenPath = class extends PrimitiveComponent2 {
2611
2611
  if (!currentPath) return;
2612
2612
  let currentCenterX = 0;
2613
2613
  let currentCenterY = 0;
2614
- for (const point4 of currentPath.route) {
2615
- currentCenterX += point4.x;
2616
- currentCenterY += point4.y;
2614
+ for (const point6 of currentPath.route) {
2615
+ currentCenterX += point6.x;
2616
+ currentCenterY += point6.y;
2617
2617
  }
2618
2618
  currentCenterX /= currentPath.route.length;
2619
2619
  currentCenterY /= currentPath.route.length;
2620
2620
  const offsetX = newCenter.x - currentCenterX;
2621
2621
  const offsetY = newCenter.y - currentCenterY;
2622
- const newRoute = currentPath.route.map((point4) => ({
2623
- ...point4,
2624
- x: point4.x + offsetX,
2625
- y: point4.y + offsetY
2622
+ const newRoute = currentPath.route.map((point6) => ({
2623
+ ...point6,
2624
+ x: point6.x + offsetX,
2625
+ y: point6.y + offsetY
2626
2626
  }));
2627
2627
  db.pcb_silkscreen_path.update(this.pcb_silkscreen_path_id, {
2628
2628
  route: newRoute
@@ -2652,11 +2652,11 @@ var SilkscreenPath = class extends PrimitiveComponent2 {
2652
2652
  return { width: 0, height: 0 };
2653
2653
  }
2654
2654
  let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
2655
- for (const point4 of props.route) {
2656
- minX = Math.min(minX, point4.x);
2657
- maxX = Math.max(maxX, point4.x);
2658
- minY = Math.min(minY, point4.y);
2659
- maxY = Math.max(maxY, point4.y);
2655
+ for (const point6 of props.route) {
2656
+ minX = Math.min(minX, point6.x);
2657
+ maxX = Math.max(maxX, point6.x);
2658
+ minY = Math.min(minY, point6.y);
2659
+ maxY = Math.max(maxY, point6.y);
2660
2660
  }
2661
2661
  return {
2662
2662
  width: maxX - minX,
@@ -2692,14 +2692,14 @@ var PcbTrace = class extends PrimitiveComponent2 {
2692
2692
  const subcircuit = this.getSubcircuit();
2693
2693
  const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
2694
2694
  const parentTransform = this._computePcbGlobalTransformBeforeLayout();
2695
- const transformedRoute = props.route.map((point4) => {
2696
- const { x, y, ...restOfPoint } = point4;
2695
+ const transformedRoute = props.route.map((point6) => {
2696
+ const { x, y, ...restOfPoint } = point6;
2697
2697
  const transformedPoint = applyToPoint4(parentTransform, { x, y });
2698
- if (point4.route_type === "wire" && point4.layer) {
2698
+ if (point6.route_type === "wire" && point6.layer) {
2699
2699
  return {
2700
2700
  ...transformedPoint,
2701
2701
  ...restOfPoint,
2702
- layer: maybeFlipLayer(point4.layer)
2702
+ layer: maybeFlipLayer(point6.layer)
2703
2703
  };
2704
2704
  }
2705
2705
  return { ...transformedPoint, ...restOfPoint };
@@ -2719,16 +2719,16 @@ var PcbTrace = class extends PrimitiveComponent2 {
2719
2719
  return { width: 0, height: 0 };
2720
2720
  }
2721
2721
  let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
2722
- for (const point4 of props.route) {
2723
- minX = Math.min(minX, point4.x);
2724
- maxX = Math.max(maxX, point4.x);
2725
- minY = Math.min(minY, point4.y);
2726
- maxY = Math.max(maxY, point4.y);
2727
- if (point4.route_type === "wire") {
2728
- minX = Math.min(minX, point4.x - point4.width / 2);
2729
- maxX = Math.max(maxX, point4.x + point4.width / 2);
2730
- minY = Math.min(minY, point4.y - point4.width / 2);
2731
- maxY = Math.max(maxY, point4.y + point4.width / 2);
2722
+ for (const point6 of props.route) {
2723
+ minX = Math.min(minX, point6.x);
2724
+ maxX = Math.max(maxX, point6.x);
2725
+ minY = Math.min(minY, point6.y);
2726
+ maxY = Math.max(maxY, point6.y);
2727
+ if (point6.route_type === "wire") {
2728
+ minX = Math.min(minX, point6.x - point6.width / 2);
2729
+ maxX = Math.max(maxX, point6.x + point6.width / 2);
2730
+ minY = Math.min(minY, point6.y - point6.width / 2);
2731
+ maxY = Math.max(maxY, point6.y + point6.width / 2);
2732
2732
  }
2733
2733
  }
2734
2734
  if (minX === Infinity || maxX === -Infinity || minY === Infinity || maxY === -Infinity) {
@@ -2995,9 +2995,9 @@ var PlatedHole = class extends PrimitiveComponent2 {
2995
2995
  });
2996
2996
  this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
2997
2997
  } else if (props.shape === "hole_with_polygon_pad") {
2998
- const padOutline = (props.padOutline || []).map((point4) => {
2999
- const x = typeof point4.x === "number" ? point4.x : parseFloat(String(point4.x));
3000
- const y = typeof point4.y === "number" ? point4.y : parseFloat(String(point4.y));
2998
+ const padOutline = (props.padOutline || []).map((point6) => {
2999
+ const x = typeof point6.x === "number" ? point6.x : parseFloat(String(point6.x));
3000
+ const y = typeof point6.y === "number" ? point6.y : parseFloat(String(point6.y));
3001
3001
  return {
3002
3002
  x,
3003
3003
  y
@@ -3416,11 +3416,11 @@ var Cutout = class extends PrimitiveComponent2 {
3416
3416
  if (props.shape === "polygon") {
3417
3417
  if (props.points.length === 0) return { width: 0, height: 0 };
3418
3418
  let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
3419
- for (const point4 of props.points) {
3420
- minX = Math.min(minX, point4.x);
3421
- maxX = Math.max(maxX, point4.x);
3422
- minY = Math.min(minY, point4.y);
3423
- maxY = Math.max(maxY, point4.y);
3419
+ for (const point6 of props.points) {
3420
+ minX = Math.min(minX, point6.x);
3421
+ maxX = Math.max(maxX, point6.x);
3422
+ minY = Math.min(minY, point6.y);
3423
+ maxY = Math.max(maxY, point6.y);
3424
3424
  }
3425
3425
  return { width: maxX - minX, height: maxY - minY };
3426
3426
  }
@@ -3459,11 +3459,11 @@ var Cutout = class extends PrimitiveComponent2 {
3459
3459
  } else if (cutout.shape === "polygon") {
3460
3460
  if (cutout.points.length === 0) return super._getPcbCircuitJsonBounds();
3461
3461
  let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
3462
- for (const point4 of cutout.points) {
3463
- minX = Math.min(minX, point4.x);
3464
- maxX = Math.max(maxX, point4.x);
3465
- minY = Math.min(minY, point4.y);
3466
- maxY = Math.max(maxY, point4.y);
3462
+ for (const point6 of cutout.points) {
3463
+ minX = Math.min(minX, point6.x);
3464
+ maxX = Math.max(maxX, point6.x);
3465
+ minY = Math.min(minY, point6.y);
3466
+ maxY = Math.max(maxY, point6.y);
3467
3467
  }
3468
3468
  return {
3469
3469
  center: { x: (minX + maxX) / 2, y: (minY + maxY) / 2 },
@@ -5506,13 +5506,13 @@ var getDistance = (a, b) => {
5506
5506
  const bPos = "_getGlobalPcbPositionBeforeLayout" in b ? b._getGlobalPcbPositionBeforeLayout() : b;
5507
5507
  return Math.sqrt((aPos.x - bPos.x) ** 2 + (aPos.y - bPos.y) ** 2);
5508
5508
  };
5509
- function getClosest(point4, candidates) {
5509
+ function getClosest(point6, candidates) {
5510
5510
  if (candidates.length === 0)
5511
5511
  throw new Error("No candidates given to getClosest method");
5512
5512
  let closest = candidates[0];
5513
5513
  let closestDist = Infinity;
5514
5514
  for (const candidate of candidates) {
5515
- const dist = getDistance(point4, candidate);
5515
+ const dist = getDistance(point6, candidate);
5516
5516
  if (dist < closestDist) {
5517
5517
  closest = candidate;
5518
5518
  closestDist = dist;
@@ -5642,30 +5642,36 @@ function getTraceDisplayName({
5642
5642
  }
5643
5643
 
5644
5644
  // lib/utils/is-route-outside-board.ts
5645
- var isRouteOutsideBoard = (mergedRoute, { db }) => {
5646
- const pcbBoard = db.pcb_board.list()[0];
5647
- if (pcbBoard.outline) {
5648
- const boardOutline = pcbBoard.outline;
5649
- const isInsidePolygon = (point4, polygon) => {
5650
- let inside = false;
5651
- for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
5652
- const xi = polygon[i].x, yi = polygon[i].y;
5653
- const xj = polygon[j].x, yj = polygon[j].y;
5654
- const intersect = yi > point4.y !== yj > point4.y && point4.x < (xj - xi) * (point4.y - yi) / (yj - yi) + xi;
5655
- if (intersect) inside = !inside;
5656
- }
5657
- return inside;
5658
- };
5659
- return mergedRoute.some((point4) => !isInsidePolygon(point4, boardOutline));
5660
- }
5661
- const boardWidth = pcbBoard.width;
5662
- const boardHeight = pcbBoard.height;
5663
- const boardCenterX = pcbBoard.center.x;
5664
- const boardCenterY = pcbBoard.center.y;
5665
- const outsideBoard = mergedRoute.some((point4) => {
5666
- return point4.x < boardCenterX - boardWidth / 2 || point4.y < boardCenterY - boardHeight / 2 || point4.x > boardCenterX + boardWidth / 2 || point4.y > boardCenterY + boardHeight / 2;
5667
- });
5668
- return outsideBoard;
5645
+ import { point as point2 } from "@flatten-js/core";
5646
+
5647
+ // lib/utils/get-pcb-board-outline-polygon.ts
5648
+ import { Box, point, Polygon } from "@flatten-js/core";
5649
+ var getPcbBoardOutlinePolygon = (pcbBoard) => {
5650
+ if (pcbBoard.outline && pcbBoard.outline.length > 0) {
5651
+ return new Polygon(pcbBoard.outline.map((p) => point(p.x, p.y)));
5652
+ }
5653
+ return new Polygon(
5654
+ new Box(
5655
+ pcbBoard.center.x - pcbBoard.width / 2,
5656
+ pcbBoard.center.y - pcbBoard.height / 2,
5657
+ pcbBoard.center.x + pcbBoard.width / 2,
5658
+ pcbBoard.center.y + pcbBoard.height / 2
5659
+ ).toPoints()
5660
+ );
5661
+ };
5662
+
5663
+ // lib/utils/is-route-outside-board.ts
5664
+ var isRouteOutsideBoard = ({
5665
+ mergedRoute,
5666
+ db,
5667
+ pcbBoardId
5668
+ }) => {
5669
+ const pcbBoard = db.pcb_board.get(pcbBoardId);
5670
+ if (!pcbBoard) return false;
5671
+ const boardOutlinePolygon = getPcbBoardOutlinePolygon(pcbBoard);
5672
+ return !mergedRoute.flat().every(
5673
+ (routePoint) => boardOutlinePolygon.contains(point2(routePoint.x, routePoint.y))
5674
+ );
5669
5675
  };
5670
5676
 
5671
5677
  // lib/utils/obstacles/getObstaclesFromRoute.ts
@@ -6245,12 +6251,12 @@ var createSchematicTraceCrossingSegments = ({
6245
6251
 
6246
6252
  // lib/components/primitive-components/Trace/trace-utils/create-schematic-trace-junctions.ts
6247
6253
  var TOLERANCE = 1e-3;
6248
- var isPointWithinEdge = (point4, edge) => {
6254
+ var isPointWithinEdge = (point6, edge) => {
6249
6255
  const minX = Math.min(edge.from.x, edge.to.x);
6250
6256
  const maxX = Math.max(edge.from.x, edge.to.x);
6251
6257
  const minY = Math.min(edge.from.y, edge.to.y);
6252
6258
  const maxY = Math.max(edge.from.y, edge.to.y);
6253
- return point4.x >= minX && point4.x <= maxX && point4.y >= minY && point4.y <= maxY;
6259
+ return point6.x >= minX && point6.x <= maxX && point6.y >= minY && point6.y <= maxY;
6254
6260
  };
6255
6261
  var getEdgeOrientation = (edge) => {
6256
6262
  const isVertical = Math.abs(edge.from.x - edge.to.x) < TOLERANCE;
@@ -6858,15 +6864,15 @@ import { getFullConnectivityMapFromCircuitJson } from "circuit-json-to-connectiv
6858
6864
  function getTraceLength(route) {
6859
6865
  let totalLength = 0;
6860
6866
  for (let i = 0; i < route.length; i++) {
6861
- const point4 = route[i];
6862
- if (point4.route_type === "wire") {
6867
+ const point6 = route[i];
6868
+ if (point6.route_type === "wire") {
6863
6869
  const nextPoint = route[i + 1];
6864
6870
  if (nextPoint) {
6865
- const dx = nextPoint.x - point4.x;
6866
- const dy = nextPoint.y - point4.y;
6871
+ const dx = nextPoint.x - point6.x;
6872
+ const dy = nextPoint.y - point6.y;
6867
6873
  totalLength += Math.sqrt(dx * dx + dy * dy);
6868
6874
  }
6869
- } else if (point4.route_type === "via") {
6875
+ } else if (point6.route_type === "via") {
6870
6876
  totalLength += 1.6;
6871
6877
  }
6872
6878
  }
@@ -7176,17 +7182,17 @@ function Trace_doInitialPcbTraceRender(trace) {
7176
7182
  });
7177
7183
  trace._portsRoutedOnPcb = ports;
7178
7184
  trace.pcb_trace_id = pcb_trace.pcb_trace_id;
7179
- for (const point4 of mergedRoute) {
7180
- if (point4.route_type === "via") {
7185
+ for (const point6 of mergedRoute) {
7186
+ if (point6.route_type === "via") {
7181
7187
  db.pcb_via.insert({
7182
7188
  pcb_trace_id: pcb_trace.pcb_trace_id,
7183
- x: point4.x,
7184
- y: point4.y,
7189
+ x: point6.x,
7190
+ y: point6.y,
7185
7191
  hole_diameter: holeDiameter,
7186
7192
  outer_diameter: padDiameter,
7187
- layers: [point4.from_layer, point4.to_layer],
7188
- from_layer: point4.from_layer,
7189
- to_layer: point4.to_layer
7193
+ layers: [point6.from_layer, point6.to_layer],
7194
+ from_layer: point6.from_layer,
7195
+ to_layer: point6.to_layer
7190
7196
  });
7191
7197
  }
7192
7198
  }
@@ -7848,7 +7854,15 @@ var Trace3 = class extends PrimitiveComponent2 {
7848
7854
  }
7849
7855
  _insertErrorIfTraceIsOutsideBoard(mergedRoute, ports) {
7850
7856
  const { db } = this.root;
7851
- const isOutsideBoard = isRouteOutsideBoard(mergedRoute, { db });
7857
+ const board = this._getBoard();
7858
+ if (!board) return;
7859
+ const pcbBoardId = board.pcb_board_id;
7860
+ if (!pcbBoardId) return;
7861
+ const isOutsideBoard = isRouteOutsideBoard({
7862
+ mergedRoute,
7863
+ db,
7864
+ pcbBoardId
7865
+ });
7852
7866
  if (isOutsideBoard) {
7853
7867
  db.pcb_trace_error.insert({
7854
7868
  error_type: "pcb_trace_error",
@@ -10571,7 +10585,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
10571
10585
  layerCount: board?.num_layers ?? 2,
10572
10586
  minTraceWidth,
10573
10587
  nominalTraceWidth,
10574
- outline: board?.outline?.map((point4) => ({ ...point4 }))
10588
+ outline: board?.outline?.map((point6) => ({ ...point6 }))
10575
10589
  },
10576
10590
  connMap
10577
10591
  };
@@ -14267,16 +14281,16 @@ function splitRouteAtJumperPads(route, padInfos) {
14267
14281
  const segments = [];
14268
14282
  let currentSegment = [];
14269
14283
  for (let i = 0; i < route.length; i++) {
14270
- const point4 = route[i];
14271
- currentSegment.push(point4);
14272
- if (point4.route_type === "wire" && i > 0 && i < route.length - 1) {
14273
- const padInfo = findJumperPortContainingPoint(padInfos, point4.x, point4.y);
14284
+ const point6 = route[i];
14285
+ currentSegment.push(point6);
14286
+ if (point6.route_type === "wire" && i > 0 && i < route.length - 1) {
14287
+ const padInfo = findJumperPortContainingPoint(padInfos, point6.x, point6.y);
14274
14288
  if (padInfo) {
14275
- if (!point4.end_pcb_port_id) {
14276
- point4.end_pcb_port_id = padInfo.pcb_port_id;
14289
+ if (!point6.end_pcb_port_id) {
14290
+ point6.end_pcb_port_id = padInfo.pcb_port_id;
14277
14291
  }
14278
14292
  segments.push(currentSegment);
14279
- const newStartPoint = { ...point4 };
14293
+ const newStartPoint = { ...point6 };
14280
14294
  delete newStartPoint.end_pcb_port_id;
14281
14295
  if (!newStartPoint.start_pcb_port_id) {
14282
14296
  newStartPoint.start_pcb_port_id = padInfo.pcb_port_id;
@@ -14414,9 +14428,9 @@ var Group6 = class extends NormalComponent3 {
14414
14428
  const { _parsedProps: props } = this;
14415
14429
  const groupProps2 = props;
14416
14430
  const hasOutline = groupProps2.outline && groupProps2.outline.length > 0;
14417
- const numericOutline = hasOutline ? groupProps2.outline.map((point4) => ({
14418
- x: distance8.parse(point4.x),
14419
- y: distance8.parse(point4.y)
14431
+ const numericOutline = hasOutline ? groupProps2.outline.map((point6) => ({
14432
+ x: distance8.parse(point6.x),
14433
+ y: distance8.parse(point6.y)
14420
14434
  })) : void 0;
14421
14435
  const ctx = this.props;
14422
14436
  const anchorPosition = this._getGlobalPcbPositionBeforeLayout();
@@ -14453,9 +14467,9 @@ var Group6 = class extends NormalComponent3 {
14453
14467
  const hasOutline = props.outline && props.outline.length > 0;
14454
14468
  const hasExplicitPositioning = this._parsedProps.pcbX !== void 0 || this._parsedProps.pcbY !== void 0;
14455
14469
  if (hasOutline) {
14456
- const numericOutline = props.outline.map((point4) => ({
14457
- x: distance8.parse(point4.x),
14458
- y: distance8.parse(point4.y)
14470
+ const numericOutline = props.outline.map((point6) => ({
14471
+ x: distance8.parse(point6.x),
14472
+ y: distance8.parse(point6.y)
14459
14473
  }));
14460
14474
  const outlineBounds = getBoundsFromPoints3(numericOutline);
14461
14475
  if (!outlineBounds) return;
@@ -14925,20 +14939,20 @@ var Group6 = class extends NormalComponent3 {
14925
14939
  continue;
14926
14940
  }
14927
14941
  if (pcb_trace.type === "pcb_trace") {
14928
- for (const point4 of pcb_trace.route) {
14929
- if (point4.route_type === "via") {
14942
+ for (const point6 of pcb_trace.route) {
14943
+ if (point6.route_type === "via") {
14930
14944
  db.pcb_via.insert({
14931
14945
  pcb_trace_id: pcb_trace.pcb_trace_id,
14932
- x: point4.x,
14933
- y: point4.y,
14946
+ x: point6.x,
14947
+ y: point6.y,
14934
14948
  hole_diameter: holeDiameter,
14935
14949
  outer_diameter: padDiameter,
14936
14950
  layers: [
14937
- point4.from_layer,
14938
- point4.to_layer
14951
+ point6.from_layer,
14952
+ point6.to_layer
14939
14953
  ],
14940
- from_layer: point4.from_layer,
14941
- to_layer: point4.to_layer
14954
+ from_layer: point6.from_layer,
14955
+ to_layer: point6.to_layer
14942
14956
  });
14943
14957
  }
14944
14958
  }
@@ -16428,9 +16442,9 @@ var Board = class extends Group6 {
16428
16442
  center
16429
16443
  };
16430
16444
  if (outline) {
16431
- update.outline = outline.map((point4) => ({
16432
- x: point4.x + (props.outlineOffsetX ?? 0),
16433
- y: point4.y + (props.outlineOffsetY ?? 0)
16445
+ update.outline = outline.map((point6) => ({
16446
+ x: point6.x + (props.outlineOffsetX ?? 0),
16447
+ y: point6.y + (props.outlineOffsetY ?? 0)
16434
16448
  }));
16435
16449
  }
16436
16450
  db.pcb_board.update(this.pcb_board_id, update);
@@ -16517,8 +16531,8 @@ var Board = class extends Group6 {
16517
16531
  });
16518
16532
  }
16519
16533
  if (props.outline) {
16520
- const xValues = props.outline.map((point4) => point4.x);
16521
- const yValues = props.outline.map((point4) => point4.y);
16534
+ const xValues = props.outline.map((point6) => point6.x);
16535
+ const yValues = props.outline.map((point6) => point6.y);
16522
16536
  const minX = Math.min(...xValues);
16523
16537
  const maxX = Math.max(...xValues);
16524
16538
  const minY = Math.min(...yValues);
@@ -16553,9 +16567,9 @@ var Board = class extends Group6 {
16553
16567
  num_layers: this.allLayers.length,
16554
16568
  width: computedWidth,
16555
16569
  height: computedHeight,
16556
- outline: outline?.map((point4) => ({
16557
- x: point4.x + (props.outlineOffsetX ?? 0) + outlineTranslation.x,
16558
- y: point4.y + (props.outlineOffsetY ?? 0) + outlineTranslation.y
16570
+ outline: outline?.map((point6) => ({
16571
+ x: point6.x + (props.outlineOffsetX ?? 0) + outlineTranslation.x,
16572
+ y: point6.y + (props.outlineOffsetY ?? 0) + outlineTranslation.y
16559
16573
  })),
16560
16574
  material: props.material
16561
16575
  });
@@ -16672,7 +16686,7 @@ import { distance as distance11 } from "circuit-json";
16672
16686
 
16673
16687
  // lib/utils/panels/generate-panel-tabs-and-mouse-bites.ts
16674
16688
  import * as Flatten from "@flatten-js/core";
16675
- import { point as point2, Polygon as Polygon2 } from "@flatten-js/core";
16689
+ import { point as point5, Polygon as Polygon3 } from "@flatten-js/core";
16676
16690
  var DEFAULT_TAB_LENGTH = 5;
16677
16691
  var DEFAULT_TAB_WIDTH = 2;
16678
16692
  var generateCutoutsAndMousebitesForOutline = (outline, options) => {
@@ -16808,8 +16822,8 @@ function generatePanelTabsAndMouseBites(boards, options) {
16808
16822
  if (board.width && board.height) {
16809
16823
  boardDimensions.push(Math.min(board.width, board.height));
16810
16824
  } else if (board.outline && board.outline.length > 0) {
16811
- const outlinePolygon = new Polygon2(
16812
- board.outline.map((p) => point2(p.x, p.y))
16825
+ const outlinePolygon = new Polygon3(
16826
+ board.outline.map((p) => point5(p.x, p.y))
16813
16827
  );
16814
16828
  const area = Math.abs(outlinePolygon.area());
16815
16829
  if (area > 0) {
@@ -18047,10 +18061,10 @@ var FabricationNotePath = class extends PrimitiveComponent2 {
18047
18061
  const { _parsedProps: props } = this;
18048
18062
  if (props.route.length === 0) return { width: 0, height: 0 };
18049
18063
  const xs = props.route.map(
18050
- (point4) => typeof point4.x === "string" ? parseFloat(point4.x) : point4.x
18064
+ (point6) => typeof point6.x === "string" ? parseFloat(point6.x) : point6.x
18051
18065
  );
18052
18066
  const ys = props.route.map(
18053
- (point4) => typeof point4.y === "string" ? parseFloat(point4.y) : point4.y
18067
+ (point6) => typeof point6.y === "string" ? parseFloat(point6.y) : point6.y
18054
18068
  );
18055
18069
  const minX = Math.min(...xs);
18056
18070
  const maxX = Math.max(...xs);
@@ -18468,8 +18482,8 @@ var PcbNotePath = class extends PrimitiveComponent2 {
18468
18482
  const subcircuit = this.getSubcircuit();
18469
18483
  const group = this.getGroup();
18470
18484
  const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? void 0;
18471
- const transformedRoute = props.route.map((point4) => {
18472
- const { x, y, ...rest } = point4;
18485
+ const transformedRoute = props.route.map((point6) => {
18486
+ const { x, y, ...rest } = point6;
18473
18487
  const numericX = typeof x === "string" ? parseFloat(x) : x;
18474
18488
  const numericY = typeof y === "string" ? parseFloat(y) : y;
18475
18489
  const transformed = applyToPoint15(transform, { x: numericX, y: numericY });
@@ -18489,10 +18503,10 @@ var PcbNotePath = class extends PrimitiveComponent2 {
18489
18503
  const { _parsedProps: props } = this;
18490
18504
  if (props.route.length === 0) return { width: 0, height: 0 };
18491
18505
  const xs = props.route.map(
18492
- (point4) => typeof point4.x === "string" ? parseFloat(point4.x) : point4.x
18506
+ (point6) => typeof point6.x === "string" ? parseFloat(point6.x) : point6.x
18493
18507
  );
18494
18508
  const ys = props.route.map(
18495
- (point4) => typeof point4.y === "string" ? parseFloat(point4.y) : point4.y
18509
+ (point6) => typeof point6.y === "string" ? parseFloat(point6.y) : point6.y
18496
18510
  );
18497
18511
  const minX = Math.min(...xs);
18498
18512
  const maxX = Math.max(...xs);
@@ -18768,11 +18782,11 @@ var BreakoutPoint = class extends PrimitiveComponent2 {
18768
18782
  if (this.root?.pcbDisabled) return;
18769
18783
  const { db } = this.root;
18770
18784
  if (!this.pcb_breakout_point_id) return;
18771
- const point4 = db.pcb_breakout_point.get(this.pcb_breakout_point_id);
18772
- if (point4) {
18785
+ const point6 = db.pcb_breakout_point.get(this.pcb_breakout_point_id);
18786
+ if (point6) {
18773
18787
  db.pcb_breakout_point.update(this.pcb_breakout_point_id, {
18774
- x: point4.x + deltaX,
18775
- y: point4.y + deltaY
18788
+ x: point6.x + deltaX,
18789
+ y: point6.y + deltaY
18776
18790
  });
18777
18791
  }
18778
18792
  }
@@ -20343,9 +20357,9 @@ var SchematicPath = class extends PrimitiveComponent2 {
20343
20357
  const schematic_component_id = this.getPrimitiveContainer()?.parent?.schematic_component_id;
20344
20358
  db.schematic_path.insert({
20345
20359
  schematic_component_id,
20346
- points: props.points.map((point4) => ({
20347
- x: point4.x + globalPos.x,
20348
- y: point4.y + globalPos.y
20360
+ points: props.points.map((point6) => ({
20361
+ x: point6.x + globalPos.x,
20362
+ y: point6.y + globalPos.y
20349
20363
  })),
20350
20364
  is_filled: props.isFilled,
20351
20365
  fill_color: props.fillColor,
@@ -21020,7 +21034,7 @@ import { identity as identity5 } from "transformation-matrix";
21020
21034
  var package_default = {
21021
21035
  name: "@tscircuit/core",
21022
21036
  type: "module",
21023
- version: "0.0.985",
21037
+ version: "0.0.986",
21024
21038
  types: "dist/index.d.ts",
21025
21039
  main: "dist/index.js",
21026
21040
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.986",
4
+ "version": "0.0.987",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",