easyeda 0.0.264 → 0.0.266
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 +21 -6
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +21 -6
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +22 -12
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -997,7 +997,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
|
|
|
997
997
|
var package_default = {
|
|
998
998
|
name: "easyeda",
|
|
999
999
|
type: "module",
|
|
1000
|
-
version: "0.0.
|
|
1000
|
+
version: "0.0.265",
|
|
1001
1001
|
files: [
|
|
1002
1002
|
"dist"
|
|
1003
1003
|
],
|
|
@@ -1041,10 +1041,6 @@ var package_default = {
|
|
|
1041
1041
|
"easyeda-converter": "./dist/main.cjs",
|
|
1042
1042
|
easyeda: "./dist/main.cjs"
|
|
1043
1043
|
},
|
|
1044
|
-
files: [
|
|
1045
|
-
"dist"
|
|
1046
|
-
],
|
|
1047
|
-
license: "MIT",
|
|
1048
1044
|
scripts: {
|
|
1049
1045
|
test: "bun test",
|
|
1050
1046
|
cli: "bun cli/main.ts",
|
|
@@ -1054,7 +1050,6 @@ var package_default = {
|
|
|
1054
1050
|
format: "biome format . --write",
|
|
1055
1051
|
"add-test-for-part": "bun run scripts/add-test-for-part.ts"
|
|
1056
1052
|
},
|
|
1057
|
-
type: "module",
|
|
1058
1053
|
types: "./dist/index.d.ts"
|
|
1059
1054
|
};
|
|
1060
1055
|
|
|
@@ -6461,6 +6456,10 @@ var handleCutout = (solidRegion, index) => {
|
|
|
6461
6456
|
}))
|
|
6462
6457
|
});
|
|
6463
6458
|
};
|
|
6459
|
+
var LEAD_SHAPE_LAYER = 100;
|
|
6460
|
+
var isPcbSolidRegionCutout = (shape) => {
|
|
6461
|
+
return shape.fillStyle === "cutout" && shape.layermask !== LEAD_SHAPE_LAYER;
|
|
6462
|
+
};
|
|
6464
6463
|
var getCadPositionZMmFromMetadata = (easyEdaJson) => {
|
|
6465
6464
|
const svgNode = easyEdaJson.packageDetail.dataStr.shape.find(
|
|
6466
6465
|
(shape) => shape.type === "SVGNODE" && shape.svgData.attrs?.uuid
|
|
@@ -6618,7 +6617,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
6618
6617
|
} else if (pad.shape === "ELLIPSE") {
|
|
6619
6618
|
soupShape = "rect";
|
|
6620
6619
|
} else if (pad.shape === "OVAL") {
|
|
6621
|
-
soupShape = "
|
|
6620
|
+
soupShape = "pill";
|
|
6622
6621
|
} else if (pad.shape === "POLYGON") {
|
|
6623
6622
|
soupShape = "polygon";
|
|
6624
6623
|
}
|
|
@@ -6638,12 +6637,17 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
6638
6637
|
x: mil2mm(pad.center.x),
|
|
6639
6638
|
y: mil2mm(pad.center.y)
|
|
6640
6639
|
},
|
|
6641
|
-
...soupShape === "rect" ? rectSize : soupShape === "
|
|
6640
|
+
...soupShape === "rect" ? rectSize : soupShape === "pill" ? {
|
|
6641
|
+
...rectSize,
|
|
6642
|
+
radius: Math.min(rectSize.width, rectSize.height) / 2
|
|
6643
|
+
} : soupShape === "polygon" && pad.points ? {
|
|
6642
6644
|
points: pad.points.map((p) => ({
|
|
6643
6645
|
x: milx10(p.x),
|
|
6644
6646
|
y: milx10(p.y)
|
|
6645
6647
|
}))
|
|
6646
|
-
} : {
|
|
6648
|
+
} : {
|
|
6649
|
+
radius: Math.min(mil2mm(pad.width), mil2mm(pad.height)) / 2
|
|
6650
|
+
},
|
|
6647
6651
|
layer: "top",
|
|
6648
6652
|
port_hints: [`pin${pinNumber}`],
|
|
6649
6653
|
pcb_component_id: "pcb_component_1",
|
|
@@ -6662,7 +6666,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
6662
6666
|
circuitElements.push(handleVia(v, index));
|
|
6663
6667
|
});
|
|
6664
6668
|
easyEdaJson.packageDetail.dataStr.shape.filter(
|
|
6665
|
-
(shape) => shape.type === "SOLIDREGION" && shape
|
|
6669
|
+
(shape) => shape.type === "SOLIDREGION" && isPcbSolidRegionCutout(shape)
|
|
6666
6670
|
).forEach((sr, index) => {
|
|
6667
6671
|
circuitElements.push(handleCutout(sr, index));
|
|
6668
6672
|
});
|
|
@@ -6714,7 +6718,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
6714
6718
|
circuitElements.push(
|
|
6715
6719
|
pcb_silkscreen_text.parse({
|
|
6716
6720
|
type: "pcb_silkscreen_text",
|
|
6717
|
-
pcb_silkscreen_text_id:
|
|
6721
|
+
pcb_silkscreen_text_id: "pcb_silkscreen_text_designator_fallback",
|
|
6718
6722
|
pcb_component_id: "pcb_component_1",
|
|
6719
6723
|
text: "{NAME}",
|
|
6720
6724
|
anchor_position: {
|
|
@@ -7814,8 +7818,14 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
|
|
|
7814
7818
|
`<smtpad portHints={${JSON.stringify(mapPortHints(smtPad.port_hints, options.portHintsMap))}} pcbX="${mmStr(smtPad.x)}" pcbY="${mmStr(smtPad.y)}" radius="${mmStr(smtPad.radius)}" shape="circle" />`
|
|
7815
7819
|
);
|
|
7816
7820
|
} else if (smtPad.shape === "rect") {
|
|
7821
|
+
const cornerRadius = smtPad.corner_radius ?? smtPad.rect_border_radius ?? void 0;
|
|
7822
|
+
const cornerRadiusAttr = cornerRadius !== void 0 ? ` cornerRadius="${mmStr(cornerRadius)}"` : "";
|
|
7823
|
+
elementStrings.push(
|
|
7824
|
+
`<smtpad portHints={${JSON.stringify(smtPad.port_hints)}} pcbX="${mmStr(smtPad.x)}" pcbY="${mmStr(smtPad.y)}" width="${mmStr(smtPad.width)}" height="${mmStr(smtPad.height)}"${cornerRadiusAttr} shape="rect" />`
|
|
7825
|
+
);
|
|
7826
|
+
} else if (smtPad.shape === "pill") {
|
|
7817
7827
|
elementStrings.push(
|
|
7818
|
-
`<smtpad portHints={${JSON.stringify(
|
|
7828
|
+
`<smtpad portHints={${JSON.stringify(smtPad.port_hints)}} pcbX="${mmStr(smtPad.x)}" pcbY="${mmStr(smtPad.y)}" width="${mmStr(smtPad.width)}" height="${mmStr(smtPad.height)}" radius="${mmStr(smtPad.radius)}" shape="pill" />`
|
|
7819
7829
|
);
|
|
7820
7830
|
} else if (smtPad.shape === "polygon") {
|
|
7821
7831
|
const pointsStr = smtPad.points.map((p) => `{x: "${mmStr(p.x)}", y: "${mmStr(p.y)}"}`).join(", ");
|