easyeda 0.0.56 → 0.0.58
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/{chunk-OP7TC45O.js → chunk-CVJME4JW.js} +70 -5
- package/dist/chunk-CVJME4JW.js.map +1 -0
- package/dist/cli/main.js +2 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/lib/index.d.ts +187 -0
- package/dist/lib/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-OP7TC45O.js.map +0 -1
|
@@ -1486,6 +1486,11 @@ var computeCenterOffset = (easyeda) => {
|
|
|
1486
1486
|
|
|
1487
1487
|
// lib/convert-easyeda-json-to-tscircuit-soup-json.ts
|
|
1488
1488
|
import { mm as mm2 } from "@tscircuit/mm";
|
|
1489
|
+
|
|
1490
|
+
// lib/utils/easyeda-unit-to-mm.ts
|
|
1491
|
+
var mil10ToMm = (value) => value * 10 * 0.0254;
|
|
1492
|
+
|
|
1493
|
+
// lib/convert-easyeda-json-to-tscircuit-soup-json.ts
|
|
1489
1494
|
var mil2mm = (mil) => {
|
|
1490
1495
|
if (typeof mil === "number") return mm2(`${mil}mil`);
|
|
1491
1496
|
if (mil.match(/^\d+$/)) return mm2(`${mil}mil`);
|
|
@@ -1507,7 +1512,7 @@ var handleSilkscreenPath = (track, index) => {
|
|
|
1507
1512
|
x: milx10(point2.x),
|
|
1508
1513
|
y: milx10(point2.y)
|
|
1509
1514
|
})),
|
|
1510
|
-
stroke_width: track.width
|
|
1515
|
+
stroke_width: mil10ToMm(track.width)
|
|
1511
1516
|
});
|
|
1512
1517
|
};
|
|
1513
1518
|
var handleSilkscreenArc = (arc, index) => {
|
|
@@ -1530,7 +1535,7 @@ var handleSilkscreenArc = (arc, index) => {
|
|
|
1530
1535
|
x: milx10(p.x),
|
|
1531
1536
|
y: milx10(p.y)
|
|
1532
1537
|
})),
|
|
1533
|
-
stroke_width:
|
|
1538
|
+
stroke_width: mil10ToMm(arc.width)
|
|
1534
1539
|
});
|
|
1535
1540
|
};
|
|
1536
1541
|
var handleHole = (hole, index) => {
|
|
@@ -1977,6 +1982,7 @@ var ShapesArraySchema = z59.array(ShapeItemSchema);
|
|
|
1977
1982
|
|
|
1978
1983
|
// lib/schemas/single-letter-shape-schema.ts
|
|
1979
1984
|
import { z as z60 } from "zod";
|
|
1985
|
+
import "@tscircuit/mm";
|
|
1980
1986
|
var PointSchema2 = z60.object({
|
|
1981
1987
|
x: z60.number(),
|
|
1982
1988
|
y: z60.number()
|
|
@@ -2128,12 +2134,69 @@ var parsePath = (str) => {
|
|
|
2128
2134
|
type: "PATH",
|
|
2129
2135
|
pathData,
|
|
2130
2136
|
fillColor,
|
|
2131
|
-
strokeWidth: Number(strokeWidth),
|
|
2137
|
+
strokeWidth: mil10ToMm(Number(strokeWidth)),
|
|
2132
2138
|
strokeColor,
|
|
2133
2139
|
id
|
|
2134
2140
|
};
|
|
2135
2141
|
};
|
|
2136
2142
|
var PathShapeSchema = z60.string().startsWith("PT~").transform(parsePath).pipe(PathShapeOutputSchema);
|
|
2143
|
+
var TextShapeOutputSchema = z60.object({
|
|
2144
|
+
type: z60.literal("TEXT"),
|
|
2145
|
+
alignment: z60.enum(["L", "C", "R"]),
|
|
2146
|
+
x: z60.number(),
|
|
2147
|
+
y: z60.number(),
|
|
2148
|
+
rotation: z60.number(),
|
|
2149
|
+
fontColor: z60.string(),
|
|
2150
|
+
backgroundColor: z60.string().optional(),
|
|
2151
|
+
fontSize: z60.string(),
|
|
2152
|
+
fontWeight: z60.enum(["normal", "bold"]).optional().default("normal"),
|
|
2153
|
+
fontStyle: z60.enum(["normal", "italic"]).optional().default("normal"),
|
|
2154
|
+
fontDecoration: z60.enum(["", "underline"]),
|
|
2155
|
+
content: z60.string(),
|
|
2156
|
+
textType: z60.string(),
|
|
2157
|
+
visibility: z60.enum(["0", "1"]),
|
|
2158
|
+
mirror: z60.string(),
|
|
2159
|
+
id: z60.string()
|
|
2160
|
+
});
|
|
2161
|
+
var parseText = (str) => {
|
|
2162
|
+
const [
|
|
2163
|
+
,
|
|
2164
|
+
alignment,
|
|
2165
|
+
x,
|
|
2166
|
+
y,
|
|
2167
|
+
rotation2,
|
|
2168
|
+
fontColor,
|
|
2169
|
+
backgroundColor,
|
|
2170
|
+
fontSize,
|
|
2171
|
+
fontWeight,
|
|
2172
|
+
fontStyle,
|
|
2173
|
+
fontDecoration,
|
|
2174
|
+
content,
|
|
2175
|
+
textType,
|
|
2176
|
+
visibility,
|
|
2177
|
+
mirror,
|
|
2178
|
+
id
|
|
2179
|
+
] = str.split("~");
|
|
2180
|
+
return {
|
|
2181
|
+
type: "TEXT",
|
|
2182
|
+
alignment,
|
|
2183
|
+
x: Number(x),
|
|
2184
|
+
y: Number(y),
|
|
2185
|
+
rotation: Number(rotation2),
|
|
2186
|
+
fontColor,
|
|
2187
|
+
backgroundColor: backgroundColor || void 0,
|
|
2188
|
+
fontSize,
|
|
2189
|
+
fontWeight: fontWeight || "normal",
|
|
2190
|
+
fontStyle: fontStyle || "normal",
|
|
2191
|
+
fontDecoration,
|
|
2192
|
+
content,
|
|
2193
|
+
textType,
|
|
2194
|
+
visibility,
|
|
2195
|
+
mirror,
|
|
2196
|
+
id
|
|
2197
|
+
};
|
|
2198
|
+
};
|
|
2199
|
+
var TextShapeSchema = z60.string().startsWith("T~").transform(parseText).pipe(TextShapeOutputSchema);
|
|
2137
2200
|
var SingleLetterShapeSchema = z60.string().transform((x) => {
|
|
2138
2201
|
if (x.startsWith("R~")) return RectangleShapeSchema.parse(x);
|
|
2139
2202
|
if (x.startsWith("E~")) return EllipseShapeSchema.parse(x);
|
|
@@ -2141,6 +2204,7 @@ var SingleLetterShapeSchema = z60.string().transform((x) => {
|
|
|
2141
2204
|
if (x.startsWith("PL~")) return PolylineShapeSchema.parse(x);
|
|
2142
2205
|
if (x.startsWith("PG~")) return PolygonShapeSchema.parse(x);
|
|
2143
2206
|
if (x.startsWith("PT~")) return PathShapeSchema.parse(x);
|
|
2207
|
+
if (x.startsWith("T~")) return TextShapeSchema.parse(x);
|
|
2144
2208
|
throw new Error(`Invalid shape type: ${x}`);
|
|
2145
2209
|
}).pipe(
|
|
2146
2210
|
z60.union([
|
|
@@ -2149,7 +2213,8 @@ var SingleLetterShapeSchema = z60.string().transform((x) => {
|
|
|
2149
2213
|
PinShapeOutputSchema,
|
|
2150
2214
|
PolylineShapeOutputSchema,
|
|
2151
2215
|
PolygonShapeOutputSchema,
|
|
2152
|
-
PathShapeOutputSchema
|
|
2216
|
+
PathShapeOutputSchema,
|
|
2217
|
+
TextShapeOutputSchema
|
|
2153
2218
|
])
|
|
2154
2219
|
);
|
|
2155
2220
|
|
|
@@ -2554,4 +2619,4 @@ export {
|
|
|
2554
2619
|
convertRawEasyToTsx,
|
|
2555
2620
|
convertEasyEdaJsonToVariousFormats
|
|
2556
2621
|
};
|
|
2557
|
-
//# sourceMappingURL=chunk-
|
|
2622
|
+
//# sourceMappingURL=chunk-CVJME4JW.js.map
|