easyeda 0.0.101 → 0.0.103
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.
|
@@ -1820,6 +1820,26 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
1820
1820
|
soupElements.push(handleSilkscreenPath(shape, index));
|
|
1821
1821
|
} else if (shape.type === "ARC") {
|
|
1822
1822
|
soupElements.push(handleSilkscreenArc(shape, index));
|
|
1823
|
+
} else if (shape.type === "TEXT") {
|
|
1824
|
+
soupElements.push(
|
|
1825
|
+
pcb_silkscreen_text.parse({
|
|
1826
|
+
type: "pcb_silkscreen_text",
|
|
1827
|
+
pcb_silkscreen_text_id: `pcb_silkscreen_text_${index + 1}`,
|
|
1828
|
+
pcb_component_id: "pcb_component_1",
|
|
1829
|
+
text: shape.text,
|
|
1830
|
+
anchor_position: {
|
|
1831
|
+
x: mil2mm(shape.x),
|
|
1832
|
+
y: mil2mm(shape.y)
|
|
1833
|
+
},
|
|
1834
|
+
anchor_alignment: {
|
|
1835
|
+
L: "bottom_left",
|
|
1836
|
+
C: "center",
|
|
1837
|
+
R: "bottom_right"
|
|
1838
|
+
}[shape.textAnchor ?? "L"],
|
|
1839
|
+
font_size: shape.size_mm ? shape.size_mm : void 0,
|
|
1840
|
+
layer: "top"
|
|
1841
|
+
})
|
|
1842
|
+
);
|
|
1823
1843
|
}
|
|
1824
1844
|
});
|
|
1825
1845
|
const svgNode = easyEdaJson.packageDetail.dataStr.shape.find(
|
|
@@ -2005,6 +2025,17 @@ var RectSchema = BaseShapeSchema.extend({
|
|
|
2005
2025
|
fillStyle: z61.string(),
|
|
2006
2026
|
rotation: z61.number().optional()
|
|
2007
2027
|
});
|
|
2028
|
+
var TextSchema = BaseShapeSchema.extend({
|
|
2029
|
+
type: z61.literal("TEXT"),
|
|
2030
|
+
text: z61.string(),
|
|
2031
|
+
x: tenthmil,
|
|
2032
|
+
y: tenthmil,
|
|
2033
|
+
size_mm: z61.number(),
|
|
2034
|
+
rotation: z61.number().optional(),
|
|
2035
|
+
layer: z61.number().optional(),
|
|
2036
|
+
textAnchor: z61.enum(["L", "C", "R", ""]).optional().transform((val) => val === "" ? void 0 : val),
|
|
2037
|
+
font: z61.string().optional()
|
|
2038
|
+
});
|
|
2008
2039
|
var PackageDetailShapeSchema = z61.discriminatedUnion("type", [
|
|
2009
2040
|
TrackSchema,
|
|
2010
2041
|
PadSchema,
|
|
@@ -2013,7 +2044,8 @@ var PackageDetailShapeSchema = z61.discriminatedUnion("type", [
|
|
|
2013
2044
|
SolidRegionSchema,
|
|
2014
2045
|
SVGNodeSchema,
|
|
2015
2046
|
HoleSchema,
|
|
2016
|
-
RectSchema
|
|
2047
|
+
RectSchema,
|
|
2048
|
+
TextSchema
|
|
2017
2049
|
]);
|
|
2018
2050
|
var pairs = (arr) => {
|
|
2019
2051
|
const pairs2 = [];
|
|
@@ -2162,6 +2194,22 @@ var ShapeItemSchema = z61.object({
|
|
|
2162
2194
|
fillStyle: fillStyle || void 0
|
|
2163
2195
|
});
|
|
2164
2196
|
}
|
|
2197
|
+
case "TEXT": {
|
|
2198
|
+
const [textAnchor, x, y, size2, layer, id, rotation2, , font, text] = shape.data.split("~");
|
|
2199
|
+
return TextSchema.parse({
|
|
2200
|
+
type: "TEXT",
|
|
2201
|
+
text,
|
|
2202
|
+
x,
|
|
2203
|
+
y,
|
|
2204
|
+
size_mm: Number(size2) * 2.54,
|
|
2205
|
+
// empirically this seems to match, C5248081 is a good test case
|
|
2206
|
+
layer: layer ? Number(layer) : void 0,
|
|
2207
|
+
id,
|
|
2208
|
+
rotation: rotation2 ? Number(rotation2) : void 0,
|
|
2209
|
+
textAnchor,
|
|
2210
|
+
font: font || void 0
|
|
2211
|
+
});
|
|
2212
|
+
}
|
|
2165
2213
|
default:
|
|
2166
2214
|
throw new Error(`Unknown shape type: ${shape.type}`);
|
|
2167
2215
|
return BaseShapeSchema.parse({ type: shape.type });
|
|
@@ -2548,6 +2596,7 @@ var generateFootprintTsx = (circuitJson) => {
|
|
|
2548
2596
|
const platedHoles = su_default(circuitJson).pcb_plated_hole.list();
|
|
2549
2597
|
const smtPads = su_default(circuitJson).pcb_smtpad.list();
|
|
2550
2598
|
const silkscreenPaths = su_default(circuitJson).pcb_silkscreen_path.list();
|
|
2599
|
+
const silkscreenTexts = su_default(circuitJson).pcb_silkscreen_text.list();
|
|
2551
2600
|
const elementStrings = [];
|
|
2552
2601
|
for (const hole of holes) {
|
|
2553
2602
|
if (hole.hole_shape === "circle") {
|
|
@@ -2585,6 +2634,11 @@ var generateFootprintTsx = (circuitJson) => {
|
|
|
2585
2634
|
`<silkscreenpath route={${JSON.stringify(silkscreenPath.route)}} />`
|
|
2586
2635
|
);
|
|
2587
2636
|
}
|
|
2637
|
+
for (const silkscreenText of silkscreenTexts) {
|
|
2638
|
+
elementStrings.push(
|
|
2639
|
+
`<silkscreentext text="${silkscreenText.text}" pcbX="${mmStr(silkscreenText.anchor_position.x)}" pcbY="${mmStr(silkscreenText.anchor_position.y)}" anchorAlignment="${silkscreenText.anchor_alignment}" ${silkscreenText.font_size ? `fontSize="${mmStr(silkscreenText.font_size)}"` : ""} />`
|
|
2640
|
+
);
|
|
2641
|
+
}
|
|
2588
2642
|
return `
|
|
2589
2643
|
<footprint>
|
|
2590
2644
|
${elementStrings.join("\n")}
|
|
@@ -2796,4 +2850,4 @@ export {
|
|
|
2796
2850
|
convertRawEasyToTsx,
|
|
2797
2851
|
convertEasyEdaJsonToVariousFormats
|
|
2798
2852
|
};
|
|
2799
|
-
//# sourceMappingURL=chunk-
|
|
2853
|
+
//# sourceMappingURL=chunk-CIUQOZZR.js.map
|