easyeda 0.0.326 → 0.0.327
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/browser/index.js +60 -27
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +60 -27
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +62 -29
- package/dist/main.cjs.map +1 -1
- package/package.json +2 -2
package/dist/browser/index.js
CHANGED
|
@@ -9456,9 +9456,9 @@ var insertionDirectionToVec = (direction) => {
|
|
|
9456
9456
|
return { x: -1, y: 0 };
|
|
9457
9457
|
case "from_right":
|
|
9458
9458
|
return { x: 1, y: 0 };
|
|
9459
|
-
case "
|
|
9459
|
+
case "from_top":
|
|
9460
9460
|
return { x: 0, y: 1 };
|
|
9461
|
-
case "
|
|
9461
|
+
case "from_bottom":
|
|
9462
9462
|
return { x: 0, y: -1 };
|
|
9463
9463
|
}
|
|
9464
9464
|
};
|
|
@@ -9468,11 +9468,15 @@ var vecToInsertionDirection = ({
|
|
|
9468
9468
|
}) => {
|
|
9469
9469
|
if (x > 0) return "from_right";
|
|
9470
9470
|
if (x < 0) return "from_left";
|
|
9471
|
-
if (y > 0) return "
|
|
9472
|
-
return "
|
|
9471
|
+
if (y > 0) return "from_top";
|
|
9472
|
+
return "from_bottom";
|
|
9473
9473
|
};
|
|
9474
9474
|
var transformInsertionDirection = (direction, opts) => {
|
|
9475
|
-
if (!direction
|
|
9475
|
+
if (!direction) return direction;
|
|
9476
|
+
if (direction === "from_above" || direction === "from_below") {
|
|
9477
|
+
if (!opts.isFlipped) return direction;
|
|
9478
|
+
return direction === "from_above" ? "from_below" : "from_above";
|
|
9479
|
+
}
|
|
9476
9480
|
let { x, y } = insertionDirectionToVec(direction);
|
|
9477
9481
|
let quarterTurns = Math.round(opts.rotationDegrees / 90);
|
|
9478
9482
|
while (quarterTurns > 0) {
|
|
@@ -9495,7 +9499,7 @@ var transformPCBElement = (elm, matrix) => {
|
|
|
9495
9499
|
const flipPadWidthHeight = Math.abs(getQuarterTurns(tsr.rotation.angle)) % 2 === 1;
|
|
9496
9500
|
const rotationDegrees = tsr.rotation.angle / Math.PI * 180;
|
|
9497
9501
|
const isFlipped = tsr.scale.sy < 0;
|
|
9498
|
-
if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
|
|
9502
|
+
if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_solder_paste" || elm.type === "pcb_port") {
|
|
9499
9503
|
const { x, y } = applyToPoint(matrix, {
|
|
9500
9504
|
x: Number(elm.x),
|
|
9501
9505
|
y: Number(elm.y)
|
|
@@ -9515,10 +9519,14 @@ var transformPCBElement = (elm, matrix) => {
|
|
|
9515
9519
|
elm.center = applyToPoint(matrix, elm.center);
|
|
9516
9520
|
} else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text" || elm.type === "pcb_note_text") {
|
|
9517
9521
|
elm.anchor_position = applyToPoint(matrix, elm.anchor_position);
|
|
9522
|
+
} else if (elm.type === "pcb_copper_text") {
|
|
9523
|
+
if (elm.anchor_position) {
|
|
9524
|
+
elm.anchor_position = applyToPoint(matrix, elm.anchor_position);
|
|
9525
|
+
}
|
|
9518
9526
|
} else if (elm.type === "pcb_courtyard_rect") {
|
|
9519
9527
|
elm.center = applyToPoint(matrix, elm.center);
|
|
9520
9528
|
elm.ccw_rotation = ((elm.ccw_rotation ?? 0) + rotationDegrees) % 360;
|
|
9521
|
-
} else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_circle") {
|
|
9529
|
+
} else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_silkscreen_pill" || elm.type === "pcb_silkscreen_oval" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_circle") {
|
|
9522
9530
|
elm.center = applyToPoint(matrix, elm.center);
|
|
9523
9531
|
} else if (elm.type === "pcb_component") {
|
|
9524
9532
|
elm.center = applyToPoint(matrix, elm.center);
|
|
@@ -9555,7 +9563,19 @@ var transformPCBElement = (elm, matrix) => {
|
|
|
9555
9563
|
p.y = tp.y;
|
|
9556
9564
|
return p;
|
|
9557
9565
|
});
|
|
9558
|
-
} else if (elm.type === "
|
|
9566
|
+
} else if (elm.type === "pcb_trace") {
|
|
9567
|
+
elm.route = elm.route.map((rp) => {
|
|
9568
|
+
if (!("x" in rp)) {
|
|
9569
|
+
rp.start = applyToPoint(matrix, rp.start);
|
|
9570
|
+
rp.end = applyToPoint(matrix, rp.end);
|
|
9571
|
+
return rp;
|
|
9572
|
+
}
|
|
9573
|
+
const tp = applyToPoint(matrix, rp);
|
|
9574
|
+
rp.x = tp.x;
|
|
9575
|
+
rp.y = tp.y;
|
|
9576
|
+
return rp;
|
|
9577
|
+
});
|
|
9578
|
+
} else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace_hint" || elm.type === "pcb_fabrication_note_path" || elm.type === "pcb_note_path") {
|
|
9559
9579
|
elm.route = elm.route.map((rp) => {
|
|
9560
9580
|
const tp = applyToPoint(matrix, rp);
|
|
9561
9581
|
rp.x = tp.x;
|
|
@@ -9588,7 +9608,7 @@ var transformPCBElements = (elms, matrix) => {
|
|
|
9588
9608
|
let transformedElms = elms.map((elm) => transformPCBElement(elm, matrix));
|
|
9589
9609
|
if (flipPadWidthHeight) {
|
|
9590
9610
|
transformedElms = transformedElms.map((elm) => {
|
|
9591
|
-
if (elm.type === "pcb_smtpad" && (elm.shape === "rect" || elm.shape === "pill")) {
|
|
9611
|
+
if ((elm.type === "pcb_smtpad" || elm.type === "pcb_solder_paste") && (elm.shape === "rect" || elm.shape === "pill")) {
|
|
9592
9612
|
;
|
|
9593
9613
|
[elm.width, elm.height] = [elm.height, elm.width];
|
|
9594
9614
|
}
|
|
@@ -9743,7 +9763,10 @@ var getDebugLayoutObject = (lo) => {
|
|
|
9743
9763
|
const content = lo;
|
|
9744
9764
|
if (x === void 0 || y === void 0) return null;
|
|
9745
9765
|
if (width === void 0) {
|
|
9746
|
-
if ("
|
|
9766
|
+
if ("radius" in lo) {
|
|
9767
|
+
width = lo.radius * 2;
|
|
9768
|
+
height = lo.radius * 2;
|
|
9769
|
+
} else if ("outer_diameter" in lo) {
|
|
9747
9770
|
width = lo.outer_diameter;
|
|
9748
9771
|
height = lo.outer_diameter;
|
|
9749
9772
|
} else if ("rect_pad_width" in lo && "rect_pad_height" in lo) {
|
|
@@ -9798,6 +9821,17 @@ var findBoundsAndCenter = (elements) => {
|
|
|
9798
9821
|
const center = { x: minX + width / 2, y: minY + height / 2 };
|
|
9799
9822
|
return { center, width, height };
|
|
9800
9823
|
};
|
|
9824
|
+
var PIN1_LOCATION_PARTS = {
|
|
9825
|
+
leftside_top: { side: "leftside", alignment: "top" },
|
|
9826
|
+
leftside_bottom: { side: "leftside", alignment: "bottom" },
|
|
9827
|
+
rightside_top: { side: "rightside", alignment: "top" },
|
|
9828
|
+
rightside_bottom: { side: "rightside", alignment: "bottom" },
|
|
9829
|
+
topside_left: { side: "topside", alignment: "left" },
|
|
9830
|
+
topside_right: { side: "topside", alignment: "right" },
|
|
9831
|
+
bottomside_left: { side: "bottomside", alignment: "left" },
|
|
9832
|
+
bottomside_right: { side: "bottomside", alignment: "right" }
|
|
9833
|
+
};
|
|
9834
|
+
var PIN1_LOCATIONS = Object.keys(PIN1_LOCATION_PARTS);
|
|
9801
9835
|
|
|
9802
9836
|
// node_modules/@tscircuit/mm/dist/index.js
|
|
9803
9837
|
var unitToMm = {
|
|
@@ -10315,24 +10349,17 @@ var handleSilkscreenArc = (arc, index) => {
|
|
|
10315
10349
|
stroke_width: mil10ToMm(arc.width)
|
|
10316
10350
|
});
|
|
10317
10351
|
};
|
|
10318
|
-
var SILKSCREEN_CIRCLE_SEGMENTS = 24;
|
|
10319
10352
|
var handleSilkscreenCircle = (circle, index) => {
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
const angle = Math.PI * 2 * segmentIndex / SILKSCREEN_CIRCLE_SEGMENTS;
|
|
10324
|
-
return {
|
|
10325
|
-
x: milx10(circle.center.x + Math.cos(angle) * circle.radius),
|
|
10326
|
-
y: milx10(circle.center.y + Math.sin(angle) * circle.radius)
|
|
10327
|
-
};
|
|
10328
|
-
}
|
|
10329
|
-
);
|
|
10330
|
-
return pcb_silkscreen_path.parse({
|
|
10331
|
-
type: "pcb_silkscreen_path",
|
|
10332
|
-
pcb_silkscreen_path_id: `pcb_silkscreen_circle_${index + 1}`,
|
|
10353
|
+
return pcb_silkscreen_circle.parse({
|
|
10354
|
+
type: "pcb_silkscreen_circle",
|
|
10355
|
+
pcb_silkscreen_circle_id: `pcb_silkscreen_circle_${index + 1}`,
|
|
10333
10356
|
pcb_component_id: "pcb_component_1",
|
|
10334
10357
|
layer: getSideFromLayer(circle.layer),
|
|
10335
|
-
|
|
10358
|
+
center: {
|
|
10359
|
+
x: milx10(circle.center.x),
|
|
10360
|
+
y: milx10(circle.center.y)
|
|
10361
|
+
},
|
|
10362
|
+
radius: milx10(circle.radius),
|
|
10336
10363
|
stroke_width: mil10ToMm(circle.width)
|
|
10337
10364
|
});
|
|
10338
10365
|
};
|
|
@@ -10732,7 +10759,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
10732
10759
|
);
|
|
10733
10760
|
}
|
|
10734
10761
|
const pcbElements = circuitElements.filter(
|
|
10735
|
-
(e) => e.type === "pcb_smtpad" || e.type === "pcb_plated_hole" || e.type === "pcb_hole" || e.type === "pcb_via" || e.type === "pcb_courtyard_outline" || e.type === "pcb_courtyard_rect" || e.type === "pcb_silkscreen_path" || e.type === "pcb_silkscreen_rect" || e.type === "pcb_silkscreen_text"
|
|
10762
|
+
(e) => e.type === "pcb_smtpad" || e.type === "pcb_plated_hole" || e.type === "pcb_hole" || e.type === "pcb_via" || e.type === "pcb_courtyard_outline" || e.type === "pcb_courtyard_rect" || e.type === "pcb_silkscreen_path" || e.type === "pcb_silkscreen_circle" || e.type === "pcb_silkscreen_rect" || e.type === "pcb_silkscreen_text"
|
|
10736
10763
|
);
|
|
10737
10764
|
if (pcbElements.length > 0) {
|
|
10738
10765
|
const bounds = findBoundsAndCenter(pcbElements);
|
|
@@ -10799,7 +10826,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
10799
10826
|
}
|
|
10800
10827
|
if (shouldRecenter) {
|
|
10801
10828
|
const elementsForBounds = circuitElements.filter(
|
|
10802
|
-
(e) => e.type !== "pcb_component" && e.type !== "cad_component"
|
|
10829
|
+
(e) => e.type !== "pcb_component" && e.type !== "cad_component" && e.type !== "pcb_silkscreen_circle"
|
|
10803
10830
|
);
|
|
10804
10831
|
const bounds = findBoundsAndCenter(elementsForBounds);
|
|
10805
10832
|
if (Number.isFinite(bounds.center.x) && Number.isFinite(bounds.center.y)) {
|
|
@@ -11842,6 +11869,7 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
|
|
|
11842
11869
|
const smtPads = su(circuitJson).pcb_smtpad.list();
|
|
11843
11870
|
const vias = su(circuitJson).pcb_via.list();
|
|
11844
11871
|
const silkscreenPaths = su(circuitJson).pcb_silkscreen_path.list();
|
|
11872
|
+
const silkscreenCircles = su(circuitJson).pcb_silkscreen_circle.list();
|
|
11845
11873
|
const silkscreenRects = su(circuitJson).pcb_silkscreen_rect.list();
|
|
11846
11874
|
const silkscreenTexts = su(circuitJson).pcb_silkscreen_text.list();
|
|
11847
11875
|
const fabricationNotePaths = su(circuitJson).pcb_fabrication_note_path.list();
|
|
@@ -11912,6 +11940,11 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
|
|
|
11912
11940
|
`<silkscreenpath route={${JSON.stringify(silkscreenPath.route)}} />`
|
|
11913
11941
|
);
|
|
11914
11942
|
}
|
|
11943
|
+
for (const silkscreenCircle of silkscreenCircles) {
|
|
11944
|
+
elementStrings.push(
|
|
11945
|
+
`<silkscreencircle pcbX="${mmStr(silkscreenCircle.center.x)}" pcbY="${mmStr(silkscreenCircle.center.y)}" radius="${mmStr(silkscreenCircle.radius)}" />`
|
|
11946
|
+
);
|
|
11947
|
+
}
|
|
11915
11948
|
for (const silkscreenRect of silkscreenRects) {
|
|
11916
11949
|
const rotation2 = silkscreenRect.ccw_rotation || 0;
|
|
11917
11950
|
const rotationAttr = rotation2 ? ` pcbRotation="${rotation2}deg"` : "";
|