easyeda 0.0.128 → 0.0.130
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.d.ts +102 -0
- package/dist/browser/index.js +42 -5
- package/dist/browser/index.js.map +1 -1
- package/dist/{chunk-YCCBLZAH.js → chunk-SMM32IOL.js} +43 -6
- package/dist/{chunk-YCCBLZAH.js.map → chunk-SMM32IOL.js.map} +1 -1
- package/dist/cli/main.js +3 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/lib/index.d.ts +830 -641
- package/dist/lib/index.js +1 -1
- package/package.json +2 -2
package/dist/browser/index.d.ts
CHANGED
|
@@ -140,6 +140,21 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
140
140
|
radiusY: number;
|
|
141
141
|
lineWidth: number;
|
|
142
142
|
color: string;
|
|
143
|
+
} | {
|
|
144
|
+
type: "ARC";
|
|
145
|
+
id: string;
|
|
146
|
+
start: {
|
|
147
|
+
x: number;
|
|
148
|
+
y: number;
|
|
149
|
+
};
|
|
150
|
+
end: {
|
|
151
|
+
x: number;
|
|
152
|
+
y: number;
|
|
153
|
+
};
|
|
154
|
+
radius: number;
|
|
155
|
+
lineWidth: number;
|
|
156
|
+
sweepFlag: boolean;
|
|
157
|
+
color: string;
|
|
143
158
|
} | {
|
|
144
159
|
path: string;
|
|
145
160
|
type: "PIN";
|
|
@@ -450,6 +465,63 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
450
465
|
backgroundColor?: string | undefined;
|
|
451
466
|
fontWeight?: "normal" | "bold" | undefined;
|
|
452
467
|
fontStyle?: "normal" | "italic" | undefined;
|
|
468
|
+
}>, z.ZodObject<{
|
|
469
|
+
type: z.ZodLiteral<"ARC">;
|
|
470
|
+
start: z.ZodObject<{
|
|
471
|
+
x: z.ZodNumber;
|
|
472
|
+
y: z.ZodNumber;
|
|
473
|
+
}, "strip", z.ZodTypeAny, {
|
|
474
|
+
x: number;
|
|
475
|
+
y: number;
|
|
476
|
+
}, {
|
|
477
|
+
x: number;
|
|
478
|
+
y: number;
|
|
479
|
+
}>;
|
|
480
|
+
end: z.ZodObject<{
|
|
481
|
+
x: z.ZodNumber;
|
|
482
|
+
y: z.ZodNumber;
|
|
483
|
+
}, "strip", z.ZodTypeAny, {
|
|
484
|
+
x: number;
|
|
485
|
+
y: number;
|
|
486
|
+
}, {
|
|
487
|
+
x: number;
|
|
488
|
+
y: number;
|
|
489
|
+
}>;
|
|
490
|
+
radius: z.ZodNumber;
|
|
491
|
+
sweepFlag: z.ZodBoolean;
|
|
492
|
+
color: z.ZodString;
|
|
493
|
+
lineWidth: z.ZodNumber;
|
|
494
|
+
id: z.ZodString;
|
|
495
|
+
}, "strip", z.ZodTypeAny, {
|
|
496
|
+
type: "ARC";
|
|
497
|
+
id: string;
|
|
498
|
+
start: {
|
|
499
|
+
x: number;
|
|
500
|
+
y: number;
|
|
501
|
+
};
|
|
502
|
+
end: {
|
|
503
|
+
x: number;
|
|
504
|
+
y: number;
|
|
505
|
+
};
|
|
506
|
+
radius: number;
|
|
507
|
+
lineWidth: number;
|
|
508
|
+
sweepFlag: boolean;
|
|
509
|
+
color: string;
|
|
510
|
+
}, {
|
|
511
|
+
type: "ARC";
|
|
512
|
+
id: string;
|
|
513
|
+
start: {
|
|
514
|
+
x: number;
|
|
515
|
+
y: number;
|
|
516
|
+
};
|
|
517
|
+
end: {
|
|
518
|
+
x: number;
|
|
519
|
+
y: number;
|
|
520
|
+
};
|
|
521
|
+
radius: number;
|
|
522
|
+
lineWidth: number;
|
|
523
|
+
sweepFlag: boolean;
|
|
524
|
+
color: string;
|
|
453
525
|
}>]>>, "many">;
|
|
454
526
|
BBox: z.ZodObject<{
|
|
455
527
|
x: z.ZodNumber;
|
|
@@ -491,6 +563,21 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
491
563
|
radiusY: number;
|
|
492
564
|
lineWidth: number;
|
|
493
565
|
color: string;
|
|
566
|
+
} | {
|
|
567
|
+
type: "ARC";
|
|
568
|
+
id: string;
|
|
569
|
+
start: {
|
|
570
|
+
x: number;
|
|
571
|
+
y: number;
|
|
572
|
+
};
|
|
573
|
+
end: {
|
|
574
|
+
x: number;
|
|
575
|
+
y: number;
|
|
576
|
+
};
|
|
577
|
+
radius: number;
|
|
578
|
+
lineWidth: number;
|
|
579
|
+
sweepFlag: boolean;
|
|
580
|
+
color: string;
|
|
494
581
|
} | {
|
|
495
582
|
path: string;
|
|
496
583
|
type: "PIN";
|
|
@@ -1600,6 +1687,21 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
1600
1687
|
radiusY: number;
|
|
1601
1688
|
lineWidth: number;
|
|
1602
1689
|
color: string;
|
|
1690
|
+
} | {
|
|
1691
|
+
type: "ARC";
|
|
1692
|
+
id: string;
|
|
1693
|
+
start: {
|
|
1694
|
+
x: number;
|
|
1695
|
+
y: number;
|
|
1696
|
+
};
|
|
1697
|
+
end: {
|
|
1698
|
+
x: number;
|
|
1699
|
+
y: number;
|
|
1700
|
+
};
|
|
1701
|
+
radius: number;
|
|
1702
|
+
lineWidth: number;
|
|
1703
|
+
sweepFlag: boolean;
|
|
1704
|
+
color: string;
|
|
1603
1705
|
} | {
|
|
1604
1706
|
path: string;
|
|
1605
1707
|
type: "PIN";
|
package/dist/browser/index.js
CHANGED
|
@@ -212,6 +212,7 @@ var ShapeItemSchema = z.object({
|
|
|
212
212
|
radiusX: Number(radiusX),
|
|
213
213
|
radiusY: Number(radiusY),
|
|
214
214
|
largeArc: largeArcFlag === "1",
|
|
215
|
+
// sweepFlag=1 means clockwise (CW), sweepFlag=0 means counter-clockwise (CCW)
|
|
215
216
|
sweepDirection: sweepFlag === "1" ? "CW" : "CCW"
|
|
216
217
|
});
|
|
217
218
|
}
|
|
@@ -349,6 +350,40 @@ var parseEllipse = (str) => {
|
|
|
349
350
|
};
|
|
350
351
|
};
|
|
351
352
|
var EllipseShapeSchema = z2.string().startsWith("E~").transform(parseEllipse).pipe(EllipseShapeOutputSchema);
|
|
353
|
+
var ArcShapeOutputSchema = z2.object({
|
|
354
|
+
type: z2.literal("ARC"),
|
|
355
|
+
start: PointSchema2,
|
|
356
|
+
end: PointSchema2,
|
|
357
|
+
radius: z2.number(),
|
|
358
|
+
sweepFlag: z2.boolean(),
|
|
359
|
+
color: z2.string(),
|
|
360
|
+
lineWidth: z2.number(),
|
|
361
|
+
id: z2.string()
|
|
362
|
+
});
|
|
363
|
+
var parseArc = (str) => {
|
|
364
|
+
const [, pathData, color, lineWidth, , , id] = str.split("~");
|
|
365
|
+
const parts = pathData.split(" ");
|
|
366
|
+
const x1 = Number(parts[1]) || 0;
|
|
367
|
+
const y1 = Number(parts[2]) || 0;
|
|
368
|
+
const radius = Number(parts[4]) || 0;
|
|
369
|
+
const sweepFlag = parts[7] === "1";
|
|
370
|
+
const x2 = Number(parts[8]) || 0;
|
|
371
|
+
const y2 = Number(parts[9]) || 0;
|
|
372
|
+
const parsedLineWidth = Number(lineWidth);
|
|
373
|
+
const finalLineWidth = isNaN(parsedLineWidth) ? 1 : parsedLineWidth;
|
|
374
|
+
return {
|
|
375
|
+
type: "ARC",
|
|
376
|
+
start: { x: x1, y: y1 },
|
|
377
|
+
end: { x: x2, y: y2 },
|
|
378
|
+
radius,
|
|
379
|
+
sweepFlag,
|
|
380
|
+
color: color || "#880000",
|
|
381
|
+
// Default color
|
|
382
|
+
lineWidth: finalLineWidth,
|
|
383
|
+
id: id || "gge1"
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
var ArcShapeSchema = z2.string().startsWith("A~").transform(parseArc).pipe(ArcShapeOutputSchema);
|
|
352
387
|
var PinShapeOutputSchema = z2.object({
|
|
353
388
|
type: z2.literal("PIN"),
|
|
354
389
|
visibility: z2.enum(["show", "hide"]),
|
|
@@ -523,6 +558,7 @@ var SingleLetterShapeSchema = z2.string().transform((x) => {
|
|
|
523
558
|
if (x.startsWith("PG~")) return PolygonShapeSchema.parse(x);
|
|
524
559
|
if (x.startsWith("PT~")) return PathShapeSchema.parse(x);
|
|
525
560
|
if (x.startsWith("T~")) return TextShapeSchema.parse(x);
|
|
561
|
+
if (x.startsWith("A~")) return ArcShapeSchema.parse(x);
|
|
526
562
|
throw new Error(`Invalid shape type: ${x}`);
|
|
527
563
|
}).pipe(
|
|
528
564
|
z2.union([
|
|
@@ -532,7 +568,8 @@ var SingleLetterShapeSchema = z2.string().transform((x) => {
|
|
|
532
568
|
PolylineShapeOutputSchema,
|
|
533
569
|
PolygonShapeOutputSchema,
|
|
534
570
|
PathShapeOutputSchema,
|
|
535
|
-
TextShapeOutputSchema
|
|
571
|
+
TextShapeOutputSchema,
|
|
572
|
+
ArcShapeOutputSchema
|
|
536
573
|
])
|
|
537
574
|
);
|
|
538
575
|
|
|
@@ -2633,13 +2670,13 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
|
|
|
2633
2670
|
}
|
|
2634
2671
|
const h = Math.sqrt(radius * radius - distance2 * distance2 / 4);
|
|
2635
2672
|
const angle = Math.atan2(dy, dx);
|
|
2636
|
-
const centerX = midX + h * Math.sin(angle) * (sweepFlag ? 1 :
|
|
2637
|
-
const centerY = midY - h * Math.cos(angle) * (sweepFlag ? 1 :
|
|
2673
|
+
const centerX = midX + h * Math.sin(angle) * (sweepFlag ? -1 : 1);
|
|
2674
|
+
const centerY = midY - h * Math.cos(angle) * (sweepFlag ? -1 : 1);
|
|
2638
2675
|
const startAngle = Math.atan2(startY - centerY, startX - centerX);
|
|
2639
2676
|
let endAngle = Math.atan2(endY - centerY, endX - centerX);
|
|
2640
|
-
if (
|
|
2677
|
+
if (sweepFlag && endAngle > startAngle) {
|
|
2641
2678
|
endAngle -= 2 * Math.PI;
|
|
2642
|
-
} else if (sweepFlag && endAngle < startAngle) {
|
|
2679
|
+
} else if (!sweepFlag && endAngle < startAngle) {
|
|
2643
2680
|
endAngle += 2 * Math.PI;
|
|
2644
2681
|
}
|
|
2645
2682
|
if (!largeArcFlag && Math.abs(endAngle - startAngle) > Math.PI || largeArcFlag && Math.abs(endAngle - startAngle) < Math.PI) {
|