@tscircuit/core 0.0.976 → 0.0.978
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 +136 -109
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2355,10 +2355,10 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
2355
2355
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
2356
2356
|
});
|
|
2357
2357
|
} else if (props.shape === "polygon") {
|
|
2358
|
-
const transformedPoints = props.points.map((
|
|
2358
|
+
const transformedPoints = props.points.map((point4) => {
|
|
2359
2359
|
const transformed = applyToPoint2(globalTransform, {
|
|
2360
|
-
x: distance.parse(
|
|
2361
|
-
y: distance.parse(
|
|
2360
|
+
x: distance.parse(point4.x),
|
|
2361
|
+
y: distance.parse(point4.y)
|
|
2362
2362
|
});
|
|
2363
2363
|
return {
|
|
2364
2364
|
x: transformed.x,
|
|
@@ -2590,18 +2590,18 @@ var SilkscreenPath = class extends PrimitiveComponent2 {
|
|
|
2590
2590
|
if (!currentPath) return;
|
|
2591
2591
|
let currentCenterX = 0;
|
|
2592
2592
|
let currentCenterY = 0;
|
|
2593
|
-
for (const
|
|
2594
|
-
currentCenterX +=
|
|
2595
|
-
currentCenterY +=
|
|
2593
|
+
for (const point4 of currentPath.route) {
|
|
2594
|
+
currentCenterX += point4.x;
|
|
2595
|
+
currentCenterY += point4.y;
|
|
2596
2596
|
}
|
|
2597
2597
|
currentCenterX /= currentPath.route.length;
|
|
2598
2598
|
currentCenterY /= currentPath.route.length;
|
|
2599
2599
|
const offsetX = newCenter.x - currentCenterX;
|
|
2600
2600
|
const offsetY = newCenter.y - currentCenterY;
|
|
2601
|
-
const newRoute = currentPath.route.map((
|
|
2602
|
-
...
|
|
2603
|
-
x:
|
|
2604
|
-
y:
|
|
2601
|
+
const newRoute = currentPath.route.map((point4) => ({
|
|
2602
|
+
...point4,
|
|
2603
|
+
x: point4.x + offsetX,
|
|
2604
|
+
y: point4.y + offsetY
|
|
2605
2605
|
}));
|
|
2606
2606
|
db.pcb_silkscreen_path.update(this.pcb_silkscreen_path_id, {
|
|
2607
2607
|
route: newRoute
|
|
@@ -2631,11 +2631,11 @@ var SilkscreenPath = class extends PrimitiveComponent2 {
|
|
|
2631
2631
|
return { width: 0, height: 0 };
|
|
2632
2632
|
}
|
|
2633
2633
|
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
2634
|
-
for (const
|
|
2635
|
-
minX = Math.min(minX,
|
|
2636
|
-
maxX = Math.max(maxX,
|
|
2637
|
-
minY = Math.min(minY,
|
|
2638
|
-
maxY = Math.max(maxY,
|
|
2634
|
+
for (const point4 of props.route) {
|
|
2635
|
+
minX = Math.min(minX, point4.x);
|
|
2636
|
+
maxX = Math.max(maxX, point4.x);
|
|
2637
|
+
minY = Math.min(minY, point4.y);
|
|
2638
|
+
maxY = Math.max(maxY, point4.y);
|
|
2639
2639
|
}
|
|
2640
2640
|
return {
|
|
2641
2641
|
width: maxX - minX,
|
|
@@ -2671,14 +2671,14 @@ var PcbTrace = class extends PrimitiveComponent2 {
|
|
|
2671
2671
|
const subcircuit = this.getSubcircuit();
|
|
2672
2672
|
const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
|
|
2673
2673
|
const parentTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
2674
|
-
const transformedRoute = props.route.map((
|
|
2675
|
-
const { x, y, ...restOfPoint } =
|
|
2674
|
+
const transformedRoute = props.route.map((point4) => {
|
|
2675
|
+
const { x, y, ...restOfPoint } = point4;
|
|
2676
2676
|
const transformedPoint = applyToPoint4(parentTransform, { x, y });
|
|
2677
|
-
if (
|
|
2677
|
+
if (point4.route_type === "wire" && point4.layer) {
|
|
2678
2678
|
return {
|
|
2679
2679
|
...transformedPoint,
|
|
2680
2680
|
...restOfPoint,
|
|
2681
|
-
layer: maybeFlipLayer(
|
|
2681
|
+
layer: maybeFlipLayer(point4.layer)
|
|
2682
2682
|
};
|
|
2683
2683
|
}
|
|
2684
2684
|
return { ...transformedPoint, ...restOfPoint };
|
|
@@ -2698,16 +2698,16 @@ var PcbTrace = class extends PrimitiveComponent2 {
|
|
|
2698
2698
|
return { width: 0, height: 0 };
|
|
2699
2699
|
}
|
|
2700
2700
|
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
2701
|
-
for (const
|
|
2702
|
-
minX = Math.min(minX,
|
|
2703
|
-
maxX = Math.max(maxX,
|
|
2704
|
-
minY = Math.min(minY,
|
|
2705
|
-
maxY = Math.max(maxY,
|
|
2706
|
-
if (
|
|
2707
|
-
minX = Math.min(minX,
|
|
2708
|
-
maxX = Math.max(maxX,
|
|
2709
|
-
minY = Math.min(minY,
|
|
2710
|
-
maxY = Math.max(maxY,
|
|
2701
|
+
for (const point4 of props.route) {
|
|
2702
|
+
minX = Math.min(minX, point4.x);
|
|
2703
|
+
maxX = Math.max(maxX, point4.x);
|
|
2704
|
+
minY = Math.min(minY, point4.y);
|
|
2705
|
+
maxY = Math.max(maxY, point4.y);
|
|
2706
|
+
if (point4.route_type === "wire") {
|
|
2707
|
+
minX = Math.min(minX, point4.x - point4.width / 2);
|
|
2708
|
+
maxX = Math.max(maxX, point4.x + point4.width / 2);
|
|
2709
|
+
minY = Math.min(minY, point4.y - point4.width / 2);
|
|
2710
|
+
maxY = Math.max(maxY, point4.y + point4.width / 2);
|
|
2711
2711
|
}
|
|
2712
2712
|
}
|
|
2713
2713
|
if (minX === Infinity || maxX === -Infinity || minY === Infinity || maxY === -Infinity) {
|
|
@@ -2974,9 +2974,9 @@ var PlatedHole = class extends PrimitiveComponent2 {
|
|
|
2974
2974
|
});
|
|
2975
2975
|
this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
|
|
2976
2976
|
} else if (props.shape === "hole_with_polygon_pad") {
|
|
2977
|
-
const padOutline = (props.padOutline || []).map((
|
|
2978
|
-
const x = typeof
|
|
2979
|
-
const y = typeof
|
|
2977
|
+
const padOutline = (props.padOutline || []).map((point4) => {
|
|
2978
|
+
const x = typeof point4.x === "number" ? point4.x : parseFloat(String(point4.x));
|
|
2979
|
+
const y = typeof point4.y === "number" ? point4.y : parseFloat(String(point4.y));
|
|
2980
2980
|
return {
|
|
2981
2981
|
x,
|
|
2982
2982
|
y
|
|
@@ -3395,11 +3395,11 @@ var Cutout = class extends PrimitiveComponent2 {
|
|
|
3395
3395
|
if (props.shape === "polygon") {
|
|
3396
3396
|
if (props.points.length === 0) return { width: 0, height: 0 };
|
|
3397
3397
|
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
3398
|
-
for (const
|
|
3399
|
-
minX = Math.min(minX,
|
|
3400
|
-
maxX = Math.max(maxX,
|
|
3401
|
-
minY = Math.min(minY,
|
|
3402
|
-
maxY = Math.max(maxY,
|
|
3398
|
+
for (const point4 of props.points) {
|
|
3399
|
+
minX = Math.min(minX, point4.x);
|
|
3400
|
+
maxX = Math.max(maxX, point4.x);
|
|
3401
|
+
minY = Math.min(minY, point4.y);
|
|
3402
|
+
maxY = Math.max(maxY, point4.y);
|
|
3403
3403
|
}
|
|
3404
3404
|
return { width: maxX - minX, height: maxY - minY };
|
|
3405
3405
|
}
|
|
@@ -3438,11 +3438,11 @@ var Cutout = class extends PrimitiveComponent2 {
|
|
|
3438
3438
|
} else if (cutout.shape === "polygon") {
|
|
3439
3439
|
if (cutout.points.length === 0) return super._getPcbCircuitJsonBounds();
|
|
3440
3440
|
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
3441
|
-
for (const
|
|
3442
|
-
minX = Math.min(minX,
|
|
3443
|
-
maxX = Math.max(maxX,
|
|
3444
|
-
minY = Math.min(minY,
|
|
3445
|
-
maxY = Math.max(maxY,
|
|
3441
|
+
for (const point4 of cutout.points) {
|
|
3442
|
+
minX = Math.min(minX, point4.x);
|
|
3443
|
+
maxX = Math.max(maxX, point4.x);
|
|
3444
|
+
minY = Math.min(minY, point4.y);
|
|
3445
|
+
maxY = Math.max(maxY, point4.y);
|
|
3446
3446
|
}
|
|
3447
3447
|
return {
|
|
3448
3448
|
center: { x: (minX + maxX) / 2, y: (minY + maxY) / 2 },
|
|
@@ -5485,13 +5485,13 @@ var getDistance = (a, b) => {
|
|
|
5485
5485
|
const bPos = "_getGlobalPcbPositionBeforeLayout" in b ? b._getGlobalPcbPositionBeforeLayout() : b;
|
|
5486
5486
|
return Math.sqrt((aPos.x - bPos.x) ** 2 + (aPos.y - bPos.y) ** 2);
|
|
5487
5487
|
};
|
|
5488
|
-
function getClosest(
|
|
5488
|
+
function getClosest(point4, candidates) {
|
|
5489
5489
|
if (candidates.length === 0)
|
|
5490
5490
|
throw new Error("No candidates given to getClosest method");
|
|
5491
5491
|
let closest = candidates[0];
|
|
5492
5492
|
let closestDist = Infinity;
|
|
5493
5493
|
for (const candidate of candidates) {
|
|
5494
|
-
const dist = getDistance(
|
|
5494
|
+
const dist = getDistance(point4, candidate);
|
|
5495
5495
|
if (dist < closestDist) {
|
|
5496
5496
|
closest = candidate;
|
|
5497
5497
|
closestDist = dist;
|
|
@@ -5625,24 +5625,24 @@ var isRouteOutsideBoard = (mergedRoute, { db }) => {
|
|
|
5625
5625
|
const pcbBoard = db.pcb_board.list()[0];
|
|
5626
5626
|
if (pcbBoard.outline) {
|
|
5627
5627
|
const boardOutline = pcbBoard.outline;
|
|
5628
|
-
const isInsidePolygon = (
|
|
5628
|
+
const isInsidePolygon = (point4, polygon) => {
|
|
5629
5629
|
let inside = false;
|
|
5630
5630
|
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
|
|
5631
5631
|
const xi = polygon[i].x, yi = polygon[i].y;
|
|
5632
5632
|
const xj = polygon[j].x, yj = polygon[j].y;
|
|
5633
|
-
const intersect = yi >
|
|
5633
|
+
const intersect = yi > point4.y !== yj > point4.y && point4.x < (xj - xi) * (point4.y - yi) / (yj - yi) + xi;
|
|
5634
5634
|
if (intersect) inside = !inside;
|
|
5635
5635
|
}
|
|
5636
5636
|
return inside;
|
|
5637
5637
|
};
|
|
5638
|
-
return mergedRoute.some((
|
|
5638
|
+
return mergedRoute.some((point4) => !isInsidePolygon(point4, boardOutline));
|
|
5639
5639
|
}
|
|
5640
5640
|
const boardWidth = pcbBoard.width;
|
|
5641
5641
|
const boardHeight = pcbBoard.height;
|
|
5642
5642
|
const boardCenterX = pcbBoard.center.x;
|
|
5643
5643
|
const boardCenterY = pcbBoard.center.y;
|
|
5644
|
-
const outsideBoard = mergedRoute.some((
|
|
5645
|
-
return
|
|
5644
|
+
const outsideBoard = mergedRoute.some((point4) => {
|
|
5645
|
+
return point4.x < boardCenterX - boardWidth / 2 || point4.y < boardCenterY - boardHeight / 2 || point4.x > boardCenterX + boardWidth / 2 || point4.y > boardCenterY + boardHeight / 2;
|
|
5646
5646
|
});
|
|
5647
5647
|
return outsideBoard;
|
|
5648
5648
|
};
|
|
@@ -6224,12 +6224,12 @@ var createSchematicTraceCrossingSegments = ({
|
|
|
6224
6224
|
|
|
6225
6225
|
// lib/components/primitive-components/Trace/trace-utils/create-schematic-trace-junctions.ts
|
|
6226
6226
|
var TOLERANCE = 1e-3;
|
|
6227
|
-
var isPointWithinEdge = (
|
|
6227
|
+
var isPointWithinEdge = (point4, edge) => {
|
|
6228
6228
|
const minX = Math.min(edge.from.x, edge.to.x);
|
|
6229
6229
|
const maxX = Math.max(edge.from.x, edge.to.x);
|
|
6230
6230
|
const minY = Math.min(edge.from.y, edge.to.y);
|
|
6231
6231
|
const maxY = Math.max(edge.from.y, edge.to.y);
|
|
6232
|
-
return
|
|
6232
|
+
return point4.x >= minX && point4.x <= maxX && point4.y >= minY && point4.y <= maxY;
|
|
6233
6233
|
};
|
|
6234
6234
|
var getEdgeOrientation = (edge) => {
|
|
6235
6235
|
const isVertical = Math.abs(edge.from.x - edge.to.x) < TOLERANCE;
|
|
@@ -6837,15 +6837,15 @@ import { getFullConnectivityMapFromCircuitJson } from "circuit-json-to-connectiv
|
|
|
6837
6837
|
function getTraceLength(route) {
|
|
6838
6838
|
let totalLength = 0;
|
|
6839
6839
|
for (let i = 0; i < route.length; i++) {
|
|
6840
|
-
const
|
|
6841
|
-
if (
|
|
6840
|
+
const point4 = route[i];
|
|
6841
|
+
if (point4.route_type === "wire") {
|
|
6842
6842
|
const nextPoint = route[i + 1];
|
|
6843
6843
|
if (nextPoint) {
|
|
6844
|
-
const dx = nextPoint.x -
|
|
6845
|
-
const dy = nextPoint.y -
|
|
6844
|
+
const dx = nextPoint.x - point4.x;
|
|
6845
|
+
const dy = nextPoint.y - point4.y;
|
|
6846
6846
|
totalLength += Math.sqrt(dx * dx + dy * dy);
|
|
6847
6847
|
}
|
|
6848
|
-
} else if (
|
|
6848
|
+
} else if (point4.route_type === "via") {
|
|
6849
6849
|
totalLength += 1.6;
|
|
6850
6850
|
}
|
|
6851
6851
|
}
|
|
@@ -7155,17 +7155,17 @@ function Trace_doInitialPcbTraceRender(trace) {
|
|
|
7155
7155
|
});
|
|
7156
7156
|
trace._portsRoutedOnPcb = ports;
|
|
7157
7157
|
trace.pcb_trace_id = pcb_trace.pcb_trace_id;
|
|
7158
|
-
for (const
|
|
7159
|
-
if (
|
|
7158
|
+
for (const point4 of mergedRoute) {
|
|
7159
|
+
if (point4.route_type === "via") {
|
|
7160
7160
|
db.pcb_via.insert({
|
|
7161
7161
|
pcb_trace_id: pcb_trace.pcb_trace_id,
|
|
7162
|
-
x:
|
|
7163
|
-
y:
|
|
7162
|
+
x: point4.x,
|
|
7163
|
+
y: point4.y,
|
|
7164
7164
|
hole_diameter: holeDiameter,
|
|
7165
7165
|
outer_diameter: padDiameter,
|
|
7166
|
-
layers: [
|
|
7167
|
-
from_layer:
|
|
7168
|
-
to_layer:
|
|
7166
|
+
layers: [point4.from_layer, point4.to_layer],
|
|
7167
|
+
from_layer: point4.from_layer,
|
|
7168
|
+
to_layer: point4.to_layer
|
|
7169
7169
|
});
|
|
7170
7170
|
}
|
|
7171
7171
|
}
|
|
@@ -10549,7 +10549,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
10549
10549
|
layerCount: board?.num_layers ?? 2,
|
|
10550
10550
|
minTraceWidth,
|
|
10551
10551
|
nominalTraceWidth,
|
|
10552
|
-
outline: board?.outline?.map((
|
|
10552
|
+
outline: board?.outline?.map((point4) => ({ ...point4 }))
|
|
10553
10553
|
},
|
|
10554
10554
|
connMap
|
|
10555
10555
|
};
|
|
@@ -14245,16 +14245,16 @@ function splitRouteAtJumperPads(route, padInfos) {
|
|
|
14245
14245
|
const segments = [];
|
|
14246
14246
|
let currentSegment = [];
|
|
14247
14247
|
for (let i = 0; i < route.length; i++) {
|
|
14248
|
-
const
|
|
14249
|
-
currentSegment.push(
|
|
14250
|
-
if (
|
|
14251
|
-
const padInfo = findJumperPortContainingPoint(padInfos,
|
|
14248
|
+
const point4 = route[i];
|
|
14249
|
+
currentSegment.push(point4);
|
|
14250
|
+
if (point4.route_type === "wire" && i > 0 && i < route.length - 1) {
|
|
14251
|
+
const padInfo = findJumperPortContainingPoint(padInfos, point4.x, point4.y);
|
|
14252
14252
|
if (padInfo) {
|
|
14253
|
-
if (!
|
|
14254
|
-
|
|
14253
|
+
if (!point4.end_pcb_port_id) {
|
|
14254
|
+
point4.end_pcb_port_id = padInfo.pcb_port_id;
|
|
14255
14255
|
}
|
|
14256
14256
|
segments.push(currentSegment);
|
|
14257
|
-
const newStartPoint = { ...
|
|
14257
|
+
const newStartPoint = { ...point4 };
|
|
14258
14258
|
delete newStartPoint.end_pcb_port_id;
|
|
14259
14259
|
if (!newStartPoint.start_pcb_port_id) {
|
|
14260
14260
|
newStartPoint.start_pcb_port_id = padInfo.pcb_port_id;
|
|
@@ -14392,9 +14392,9 @@ var Group6 = class extends NormalComponent3 {
|
|
|
14392
14392
|
const { _parsedProps: props } = this;
|
|
14393
14393
|
const groupProps2 = props;
|
|
14394
14394
|
const hasOutline = groupProps2.outline && groupProps2.outline.length > 0;
|
|
14395
|
-
const numericOutline = hasOutline ? groupProps2.outline.map((
|
|
14396
|
-
x: distance8.parse(
|
|
14397
|
-
y: distance8.parse(
|
|
14395
|
+
const numericOutline = hasOutline ? groupProps2.outline.map((point4) => ({
|
|
14396
|
+
x: distance8.parse(point4.x),
|
|
14397
|
+
y: distance8.parse(point4.y)
|
|
14398
14398
|
})) : void 0;
|
|
14399
14399
|
const ctx = this.props;
|
|
14400
14400
|
const anchorPosition = this._getGlobalPcbPositionBeforeLayout();
|
|
@@ -14431,9 +14431,9 @@ var Group6 = class extends NormalComponent3 {
|
|
|
14431
14431
|
const hasOutline = props.outline && props.outline.length > 0;
|
|
14432
14432
|
const hasExplicitPositioning = this._parsedProps.pcbX !== void 0 || this._parsedProps.pcbY !== void 0;
|
|
14433
14433
|
if (hasOutline) {
|
|
14434
|
-
const numericOutline = props.outline.map((
|
|
14435
|
-
x: distance8.parse(
|
|
14436
|
-
y: distance8.parse(
|
|
14434
|
+
const numericOutline = props.outline.map((point4) => ({
|
|
14435
|
+
x: distance8.parse(point4.x),
|
|
14436
|
+
y: distance8.parse(point4.y)
|
|
14437
14437
|
}));
|
|
14438
14438
|
const outlineBounds = getBoundsFromPoints3(numericOutline);
|
|
14439
14439
|
if (!outlineBounds) return;
|
|
@@ -14903,20 +14903,20 @@ var Group6 = class extends NormalComponent3 {
|
|
|
14903
14903
|
continue;
|
|
14904
14904
|
}
|
|
14905
14905
|
if (pcb_trace.type === "pcb_trace") {
|
|
14906
|
-
for (const
|
|
14907
|
-
if (
|
|
14906
|
+
for (const point4 of pcb_trace.route) {
|
|
14907
|
+
if (point4.route_type === "via") {
|
|
14908
14908
|
db.pcb_via.insert({
|
|
14909
14909
|
pcb_trace_id: pcb_trace.pcb_trace_id,
|
|
14910
|
-
x:
|
|
14911
|
-
y:
|
|
14910
|
+
x: point4.x,
|
|
14911
|
+
y: point4.y,
|
|
14912
14912
|
hole_diameter: holeDiameter,
|
|
14913
14913
|
outer_diameter: padDiameter,
|
|
14914
14914
|
layers: [
|
|
14915
|
-
|
|
14916
|
-
|
|
14915
|
+
point4.from_layer,
|
|
14916
|
+
point4.to_layer
|
|
14917
14917
|
],
|
|
14918
|
-
from_layer:
|
|
14919
|
-
to_layer:
|
|
14918
|
+
from_layer: point4.from_layer,
|
|
14919
|
+
to_layer: point4.to_layer
|
|
14920
14920
|
});
|
|
14921
14921
|
}
|
|
14922
14922
|
}
|
|
@@ -16400,9 +16400,9 @@ var Board = class extends Group6 {
|
|
|
16400
16400
|
center
|
|
16401
16401
|
};
|
|
16402
16402
|
if (outline) {
|
|
16403
|
-
update.outline = outline.map((
|
|
16404
|
-
x:
|
|
16405
|
-
y:
|
|
16403
|
+
update.outline = outline.map((point4) => ({
|
|
16404
|
+
x: point4.x + (props.outlineOffsetX ?? 0),
|
|
16405
|
+
y: point4.y + (props.outlineOffsetY ?? 0)
|
|
16406
16406
|
}));
|
|
16407
16407
|
}
|
|
16408
16408
|
db.pcb_board.update(this.pcb_board_id, update);
|
|
@@ -16489,8 +16489,8 @@ var Board = class extends Group6 {
|
|
|
16489
16489
|
});
|
|
16490
16490
|
}
|
|
16491
16491
|
if (props.outline) {
|
|
16492
|
-
const xValues = props.outline.map((
|
|
16493
|
-
const yValues = props.outline.map((
|
|
16492
|
+
const xValues = props.outline.map((point4) => point4.x);
|
|
16493
|
+
const yValues = props.outline.map((point4) => point4.y);
|
|
16494
16494
|
const minX = Math.min(...xValues);
|
|
16495
16495
|
const maxX = Math.max(...xValues);
|
|
16496
16496
|
const minY = Math.min(...yValues);
|
|
@@ -16525,9 +16525,9 @@ var Board = class extends Group6 {
|
|
|
16525
16525
|
num_layers: this.allLayers.length,
|
|
16526
16526
|
width: computedWidth,
|
|
16527
16527
|
height: computedHeight,
|
|
16528
|
-
outline: outline?.map((
|
|
16529
|
-
x:
|
|
16530
|
-
y:
|
|
16528
|
+
outline: outline?.map((point4) => ({
|
|
16529
|
+
x: point4.x + (props.outlineOffsetX ?? 0) + outlineTranslation.x,
|
|
16530
|
+
y: point4.y + (props.outlineOffsetY ?? 0) + outlineTranslation.y
|
|
16531
16531
|
})),
|
|
16532
16532
|
material: props.material
|
|
16533
16533
|
});
|
|
@@ -16641,6 +16641,7 @@ import { distance as distance11 } from "circuit-json";
|
|
|
16641
16641
|
|
|
16642
16642
|
// lib/utils/panels/generate-panel-tabs-and-mouse-bites.ts
|
|
16643
16643
|
import * as Flatten from "@flatten-js/core";
|
|
16644
|
+
import { point as point2, Polygon as Polygon2 } from "@flatten-js/core";
|
|
16644
16645
|
var DEFAULT_TAB_LENGTH = 5;
|
|
16645
16646
|
var DEFAULT_TAB_WIDTH = 2;
|
|
16646
16647
|
var generateCutoutsAndMousebitesForOutline = (outline, options) => {
|
|
@@ -16770,7 +16771,33 @@ var generateCutoutsAndMousebitesForOutline = (outline, options) => {
|
|
|
16770
16771
|
function generatePanelTabsAndMouseBites(boards, options) {
|
|
16771
16772
|
const finalTabCutouts = [];
|
|
16772
16773
|
const allMouseBites = [];
|
|
16773
|
-
|
|
16774
|
+
let { tabWidth, tabLength, mouseBites: useMouseBites } = options;
|
|
16775
|
+
const boardDimensions = [];
|
|
16776
|
+
for (const board of boards) {
|
|
16777
|
+
if (board.width && board.height) {
|
|
16778
|
+
boardDimensions.push(Math.min(board.width, board.height));
|
|
16779
|
+
} else if (board.outline && board.outline.length > 0) {
|
|
16780
|
+
const outlinePolygon = new Polygon2(
|
|
16781
|
+
board.outline.map((p) => point2(p.x, p.y))
|
|
16782
|
+
);
|
|
16783
|
+
const area = Math.abs(outlinePolygon.area());
|
|
16784
|
+
if (area > 0) {
|
|
16785
|
+
boardDimensions.push(Math.sqrt(area));
|
|
16786
|
+
}
|
|
16787
|
+
}
|
|
16788
|
+
}
|
|
16789
|
+
if (boardDimensions.length > 0) {
|
|
16790
|
+
const minBoardDimension = Math.min(...boardDimensions);
|
|
16791
|
+
const scaleFactor = minBoardDimension / 20;
|
|
16792
|
+
tabWidth = Math.min(
|
|
16793
|
+
tabWidth,
|
|
16794
|
+
DEFAULT_TAB_WIDTH * Math.max(scaleFactor, 0.3)
|
|
16795
|
+
);
|
|
16796
|
+
tabLength = Math.min(
|
|
16797
|
+
tabLength,
|
|
16798
|
+
DEFAULT_TAB_LENGTH * Math.max(scaleFactor, 0.3)
|
|
16799
|
+
);
|
|
16800
|
+
}
|
|
16774
16801
|
const processedBoards = boards.map((board) => {
|
|
16775
16802
|
if ((!board.outline || board.outline.length === 0) && board.width && board.height) {
|
|
16776
16803
|
const w2 = board.width / 2;
|
|
@@ -17963,10 +17990,10 @@ var FabricationNotePath = class extends PrimitiveComponent2 {
|
|
|
17963
17990
|
const { _parsedProps: props } = this;
|
|
17964
17991
|
if (props.route.length === 0) return { width: 0, height: 0 };
|
|
17965
17992
|
const xs = props.route.map(
|
|
17966
|
-
(
|
|
17993
|
+
(point4) => typeof point4.x === "string" ? parseFloat(point4.x) : point4.x
|
|
17967
17994
|
);
|
|
17968
17995
|
const ys = props.route.map(
|
|
17969
|
-
(
|
|
17996
|
+
(point4) => typeof point4.y === "string" ? parseFloat(point4.y) : point4.y
|
|
17970
17997
|
);
|
|
17971
17998
|
const minX = Math.min(...xs);
|
|
17972
17999
|
const maxX = Math.max(...xs);
|
|
@@ -18384,8 +18411,8 @@ var PcbNotePath = class extends PrimitiveComponent2 {
|
|
|
18384
18411
|
const subcircuit = this.getSubcircuit();
|
|
18385
18412
|
const group = this.getGroup();
|
|
18386
18413
|
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? void 0;
|
|
18387
|
-
const transformedRoute = props.route.map((
|
|
18388
|
-
const { x, y, ...rest } =
|
|
18414
|
+
const transformedRoute = props.route.map((point4) => {
|
|
18415
|
+
const { x, y, ...rest } = point4;
|
|
18389
18416
|
const numericX = typeof x === "string" ? parseFloat(x) : x;
|
|
18390
18417
|
const numericY = typeof y === "string" ? parseFloat(y) : y;
|
|
18391
18418
|
const transformed = applyToPoint15(transform, { x: numericX, y: numericY });
|
|
@@ -18405,10 +18432,10 @@ var PcbNotePath = class extends PrimitiveComponent2 {
|
|
|
18405
18432
|
const { _parsedProps: props } = this;
|
|
18406
18433
|
if (props.route.length === 0) return { width: 0, height: 0 };
|
|
18407
18434
|
const xs = props.route.map(
|
|
18408
|
-
(
|
|
18435
|
+
(point4) => typeof point4.x === "string" ? parseFloat(point4.x) : point4.x
|
|
18409
18436
|
);
|
|
18410
18437
|
const ys = props.route.map(
|
|
18411
|
-
(
|
|
18438
|
+
(point4) => typeof point4.y === "string" ? parseFloat(point4.y) : point4.y
|
|
18412
18439
|
);
|
|
18413
18440
|
const minX = Math.min(...xs);
|
|
18414
18441
|
const maxX = Math.max(...xs);
|
|
@@ -18684,11 +18711,11 @@ var BreakoutPoint = class extends PrimitiveComponent2 {
|
|
|
18684
18711
|
if (this.root?.pcbDisabled) return;
|
|
18685
18712
|
const { db } = this.root;
|
|
18686
18713
|
if (!this.pcb_breakout_point_id) return;
|
|
18687
|
-
const
|
|
18688
|
-
if (
|
|
18714
|
+
const point4 = db.pcb_breakout_point.get(this.pcb_breakout_point_id);
|
|
18715
|
+
if (point4) {
|
|
18689
18716
|
db.pcb_breakout_point.update(this.pcb_breakout_point_id, {
|
|
18690
|
-
x:
|
|
18691
|
-
y:
|
|
18717
|
+
x: point4.x + deltaX,
|
|
18718
|
+
y: point4.y + deltaY
|
|
18692
18719
|
});
|
|
18693
18720
|
}
|
|
18694
18721
|
}
|
|
@@ -20249,9 +20276,9 @@ var SchematicPath = class extends PrimitiveComponent2 {
|
|
|
20249
20276
|
const schematic_component_id = this.getPrimitiveContainer()?.parent?.schematic_component_id;
|
|
20250
20277
|
db.schematic_path.insert({
|
|
20251
20278
|
schematic_component_id,
|
|
20252
|
-
points: props.points.map((
|
|
20253
|
-
x:
|
|
20254
|
-
y:
|
|
20279
|
+
points: props.points.map((point4) => ({
|
|
20280
|
+
x: point4.x + globalPos.x,
|
|
20281
|
+
y: point4.y + globalPos.y
|
|
20255
20282
|
})),
|
|
20256
20283
|
is_filled: props.isFilled,
|
|
20257
20284
|
fill_color: props.fillColor,
|
|
@@ -20926,7 +20953,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
20926
20953
|
var package_default = {
|
|
20927
20954
|
name: "@tscircuit/core",
|
|
20928
20955
|
type: "module",
|
|
20929
|
-
version: "0.0.
|
|
20956
|
+
version: "0.0.977",
|
|
20930
20957
|
types: "dist/index.d.ts",
|
|
20931
20958
|
main: "dist/index.js",
|
|
20932
20959
|
module: "dist/index.js",
|
|
@@ -20957,7 +20984,7 @@ var package_default = {
|
|
|
20957
20984
|
devDependencies: {
|
|
20958
20985
|
"@biomejs/biome": "^1.8.3",
|
|
20959
20986
|
"@resvg/resvg-js": "^2.6.2",
|
|
20960
|
-
"@tscircuit/capacity-autorouter": "^0.0.
|
|
20987
|
+
"@tscircuit/capacity-autorouter": "^0.0.264",
|
|
20961
20988
|
"@tscircuit/checks": "^0.0.87",
|
|
20962
20989
|
"@tscircuit/circuit-json-util": "^0.0.75",
|
|
20963
20990
|
"@tscircuit/common": "^0.0.20",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.978",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@biomejs/biome": "^1.8.3",
|
|
34
34
|
"@resvg/resvg-js": "^2.6.2",
|
|
35
|
-
"@tscircuit/capacity-autorouter": "^0.0.
|
|
35
|
+
"@tscircuit/capacity-autorouter": "^0.0.264",
|
|
36
36
|
"@tscircuit/checks": "^0.0.87",
|
|
37
37
|
"@tscircuit/circuit-json-util": "^0.0.75",
|
|
38
38
|
"@tscircuit/common": "^0.0.20",
|