easyeda 0.0.366 → 0.0.368
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 +109 -10
- package/dist/browser/index.js +125 -110
- package/dist/browser/index.js.map +1 -1
- package/dist/index.d.ts +109 -10
- package/dist/index.js +5061 -5046
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +5062 -5047
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.ts
CHANGED
|
@@ -758,7 +758,7 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
|
|
|
758
758
|
c_spiceCmd?: any;
|
|
759
759
|
};
|
|
760
760
|
canvas: string;
|
|
761
|
-
colors:
|
|
761
|
+
colors: Record<string, string> | string[];
|
|
762
762
|
BBox?: {
|
|
763
763
|
x: number;
|
|
764
764
|
y: number;
|
|
@@ -787,7 +787,7 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
|
|
|
787
787
|
width: number;
|
|
788
788
|
height: number;
|
|
789
789
|
} | undefined;
|
|
790
|
-
colors?:
|
|
790
|
+
colors?: Record<string, string> | string[] | undefined;
|
|
791
791
|
}>, {
|
|
792
792
|
BBox: {
|
|
793
793
|
x: number;
|
|
@@ -908,7 +908,7 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
|
|
|
908
908
|
c_spiceCmd?: any;
|
|
909
909
|
};
|
|
910
910
|
canvas: string;
|
|
911
|
-
colors:
|
|
911
|
+
colors: Record<string, string> | string[];
|
|
912
912
|
}, {
|
|
913
913
|
shape: string[];
|
|
914
914
|
head: {
|
|
@@ -931,7 +931,7 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
|
|
|
931
931
|
width: number;
|
|
932
932
|
height: number;
|
|
933
933
|
} | undefined;
|
|
934
|
-
colors?:
|
|
934
|
+
colors?: Record<string, string> | string[] | undefined;
|
|
935
935
|
}>;
|
|
936
936
|
declare const PackageDetailDataStrSchema: z.ZodObject<{
|
|
937
937
|
head: z.ZodObject<{
|
|
@@ -1002,6 +1002,11 @@ declare const PackageDetailDataStrSchema: z.ZodObject<{
|
|
|
1002
1002
|
y: number;
|
|
1003
1003
|
}[] | undefined;
|
|
1004
1004
|
net?: string | number | undefined;
|
|
1005
|
+
holeLength?: string | undefined;
|
|
1006
|
+
holePoints?: {
|
|
1007
|
+
x: number;
|
|
1008
|
+
y: number;
|
|
1009
|
+
}[] | undefined;
|
|
1005
1010
|
} | {
|
|
1006
1011
|
type: "ARC";
|
|
1007
1012
|
width: number;
|
|
@@ -1146,6 +1151,17 @@ declare const PackageDetailDataStrSchema: z.ZodObject<{
|
|
|
1146
1151
|
net: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
1147
1152
|
number: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
1148
1153
|
holeRadius: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>, string, string | number | undefined>, z.ZodString>;
|
|
1154
|
+
holeLength: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>, string, string | number | undefined>, z.ZodString>>;
|
|
1155
|
+
holePoints: z.ZodOptional<z.ZodArray<z.ZodPipeline<z.ZodEffects<z.ZodAny, any, any>, z.ZodObject<{
|
|
1156
|
+
x: z.ZodNumber;
|
|
1157
|
+
y: z.ZodNumber;
|
|
1158
|
+
}, "strip", z.ZodTypeAny, {
|
|
1159
|
+
x: number;
|
|
1160
|
+
y: number;
|
|
1161
|
+
}, {
|
|
1162
|
+
x: number;
|
|
1163
|
+
y: number;
|
|
1164
|
+
}>>, "many">>;
|
|
1149
1165
|
points: z.ZodOptional<z.ZodArray<z.ZodPipeline<z.ZodEffects<z.ZodAny, any, any>, z.ZodObject<{
|
|
1150
1166
|
x: z.ZodNumber;
|
|
1151
1167
|
y: z.ZodNumber;
|
|
@@ -1179,6 +1195,11 @@ declare const PackageDetailDataStrSchema: z.ZodObject<{
|
|
|
1179
1195
|
y: number;
|
|
1180
1196
|
}[] | undefined;
|
|
1181
1197
|
net?: string | number | undefined;
|
|
1198
|
+
holeLength?: string | undefined;
|
|
1199
|
+
holePoints?: {
|
|
1200
|
+
x: number;
|
|
1201
|
+
y: number;
|
|
1202
|
+
}[] | undefined;
|
|
1182
1203
|
}, {
|
|
1183
1204
|
number: string | number;
|
|
1184
1205
|
type: "PAD";
|
|
@@ -1196,6 +1217,8 @@ declare const PackageDetailDataStrSchema: z.ZodObject<{
|
|
|
1196
1217
|
height?: string | number | undefined;
|
|
1197
1218
|
net?: string | number | undefined;
|
|
1198
1219
|
holeRadius?: string | number | undefined;
|
|
1220
|
+
holeLength?: string | number | undefined;
|
|
1221
|
+
holePoints?: any[] | undefined;
|
|
1199
1222
|
rotation?: string | number | undefined;
|
|
1200
1223
|
}>, z.ZodObject<{
|
|
1201
1224
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -1572,6 +1595,11 @@ declare const PackageDetailDataStrSchema: z.ZodObject<{
|
|
|
1572
1595
|
y: number;
|
|
1573
1596
|
}[] | undefined;
|
|
1574
1597
|
net?: string | number | undefined;
|
|
1598
|
+
holeLength?: string | undefined;
|
|
1599
|
+
holePoints?: {
|
|
1600
|
+
x: number;
|
|
1601
|
+
y: number;
|
|
1602
|
+
}[] | undefined;
|
|
1575
1603
|
} | {
|
|
1576
1604
|
type: "ARC";
|
|
1577
1605
|
width: number;
|
|
@@ -1816,6 +1844,11 @@ declare const PackageDetailSchema: z.ZodObject<{
|
|
|
1816
1844
|
y: number;
|
|
1817
1845
|
}[] | undefined;
|
|
1818
1846
|
net?: string | number | undefined;
|
|
1847
|
+
holeLength?: string | undefined;
|
|
1848
|
+
holePoints?: {
|
|
1849
|
+
x: number;
|
|
1850
|
+
y: number;
|
|
1851
|
+
}[] | undefined;
|
|
1819
1852
|
} | {
|
|
1820
1853
|
type: "ARC";
|
|
1821
1854
|
width: number;
|
|
@@ -1960,6 +1993,17 @@ declare const PackageDetailSchema: z.ZodObject<{
|
|
|
1960
1993
|
net: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
1961
1994
|
number: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
1962
1995
|
holeRadius: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>, string, string | number | undefined>, z.ZodString>;
|
|
1996
|
+
holeLength: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>, string, string | number | undefined>, z.ZodString>>;
|
|
1997
|
+
holePoints: z.ZodOptional<z.ZodArray<z.ZodPipeline<z.ZodEffects<z.ZodAny, any, any>, z.ZodObject<{
|
|
1998
|
+
x: z.ZodNumber;
|
|
1999
|
+
y: z.ZodNumber;
|
|
2000
|
+
}, "strip", z.ZodTypeAny, {
|
|
2001
|
+
x: number;
|
|
2002
|
+
y: number;
|
|
2003
|
+
}, {
|
|
2004
|
+
x: number;
|
|
2005
|
+
y: number;
|
|
2006
|
+
}>>, "many">>;
|
|
1963
2007
|
points: z.ZodOptional<z.ZodArray<z.ZodPipeline<z.ZodEffects<z.ZodAny, any, any>, z.ZodObject<{
|
|
1964
2008
|
x: z.ZodNumber;
|
|
1965
2009
|
y: z.ZodNumber;
|
|
@@ -1993,6 +2037,11 @@ declare const PackageDetailSchema: z.ZodObject<{
|
|
|
1993
2037
|
y: number;
|
|
1994
2038
|
}[] | undefined;
|
|
1995
2039
|
net?: string | number | undefined;
|
|
2040
|
+
holeLength?: string | undefined;
|
|
2041
|
+
holePoints?: {
|
|
2042
|
+
x: number;
|
|
2043
|
+
y: number;
|
|
2044
|
+
}[] | undefined;
|
|
1996
2045
|
}, {
|
|
1997
2046
|
number: string | number;
|
|
1998
2047
|
type: "PAD";
|
|
@@ -2010,6 +2059,8 @@ declare const PackageDetailSchema: z.ZodObject<{
|
|
|
2010
2059
|
height?: string | number | undefined;
|
|
2011
2060
|
net?: string | number | undefined;
|
|
2012
2061
|
holeRadius?: string | number | undefined;
|
|
2062
|
+
holeLength?: string | number | undefined;
|
|
2063
|
+
holePoints?: any[] | undefined;
|
|
2013
2064
|
rotation?: string | number | undefined;
|
|
2014
2065
|
}>, z.ZodObject<{
|
|
2015
2066
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -2386,6 +2437,11 @@ declare const PackageDetailSchema: z.ZodObject<{
|
|
|
2386
2437
|
y: number;
|
|
2387
2438
|
}[] | undefined;
|
|
2388
2439
|
net?: string | number | undefined;
|
|
2440
|
+
holeLength?: string | undefined;
|
|
2441
|
+
holePoints?: {
|
|
2442
|
+
x: number;
|
|
2443
|
+
y: number;
|
|
2444
|
+
}[] | undefined;
|
|
2389
2445
|
} | {
|
|
2390
2446
|
type: "ARC";
|
|
2391
2447
|
width: number;
|
|
@@ -2582,6 +2638,11 @@ declare const PackageDetailSchema: z.ZodObject<{
|
|
|
2582
2638
|
y: number;
|
|
2583
2639
|
}[] | undefined;
|
|
2584
2640
|
net?: string | number | undefined;
|
|
2641
|
+
holeLength?: string | undefined;
|
|
2642
|
+
holePoints?: {
|
|
2643
|
+
x: number;
|
|
2644
|
+
y: number;
|
|
2645
|
+
}[] | undefined;
|
|
2585
2646
|
} | {
|
|
2586
2647
|
type: "ARC";
|
|
2587
2648
|
width: number;
|
|
@@ -3477,7 +3538,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
3477
3538
|
c_spiceCmd?: any;
|
|
3478
3539
|
};
|
|
3479
3540
|
canvas: string;
|
|
3480
|
-
colors:
|
|
3541
|
+
colors: Record<string, string> | string[];
|
|
3481
3542
|
BBox?: {
|
|
3482
3543
|
x: number;
|
|
3483
3544
|
y: number;
|
|
@@ -3506,7 +3567,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
3506
3567
|
width: number;
|
|
3507
3568
|
height: number;
|
|
3508
3569
|
} | undefined;
|
|
3509
|
-
colors?:
|
|
3570
|
+
colors?: Record<string, string> | string[] | undefined;
|
|
3510
3571
|
}>, {
|
|
3511
3572
|
BBox: {
|
|
3512
3573
|
x: number;
|
|
@@ -3627,7 +3688,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
3627
3688
|
c_spiceCmd?: any;
|
|
3628
3689
|
};
|
|
3629
3690
|
canvas: string;
|
|
3630
|
-
colors:
|
|
3691
|
+
colors: Record<string, string> | string[];
|
|
3631
3692
|
}, {
|
|
3632
3693
|
shape: string[];
|
|
3633
3694
|
head: {
|
|
@@ -3650,7 +3711,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
3650
3711
|
width: number;
|
|
3651
3712
|
height: number;
|
|
3652
3713
|
} | undefined;
|
|
3653
|
-
colors?:
|
|
3714
|
+
colors?: Record<string, string> | string[] | undefined;
|
|
3654
3715
|
}>;
|
|
3655
3716
|
verify: z.ZodBoolean;
|
|
3656
3717
|
SMT: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -3750,6 +3811,11 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
3750
3811
|
y: number;
|
|
3751
3812
|
}[] | undefined;
|
|
3752
3813
|
net?: string | number | undefined;
|
|
3814
|
+
holeLength?: string | undefined;
|
|
3815
|
+
holePoints?: {
|
|
3816
|
+
x: number;
|
|
3817
|
+
y: number;
|
|
3818
|
+
}[] | undefined;
|
|
3753
3819
|
} | {
|
|
3754
3820
|
type: "ARC";
|
|
3755
3821
|
width: number;
|
|
@@ -3894,6 +3960,17 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
3894
3960
|
net: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
3895
3961
|
number: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
3896
3962
|
holeRadius: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>, string, string | number | undefined>, z.ZodString>;
|
|
3963
|
+
holeLength: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>, string, string | number | undefined>, z.ZodString>>;
|
|
3964
|
+
holePoints: z.ZodOptional<z.ZodArray<z.ZodPipeline<z.ZodEffects<z.ZodAny, any, any>, z.ZodObject<{
|
|
3965
|
+
x: z.ZodNumber;
|
|
3966
|
+
y: z.ZodNumber;
|
|
3967
|
+
}, "strip", z.ZodTypeAny, {
|
|
3968
|
+
x: number;
|
|
3969
|
+
y: number;
|
|
3970
|
+
}, {
|
|
3971
|
+
x: number;
|
|
3972
|
+
y: number;
|
|
3973
|
+
}>>, "many">>;
|
|
3897
3974
|
points: z.ZodOptional<z.ZodArray<z.ZodPipeline<z.ZodEffects<z.ZodAny, any, any>, z.ZodObject<{
|
|
3898
3975
|
x: z.ZodNumber;
|
|
3899
3976
|
y: z.ZodNumber;
|
|
@@ -3927,6 +4004,11 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
3927
4004
|
y: number;
|
|
3928
4005
|
}[] | undefined;
|
|
3929
4006
|
net?: string | number | undefined;
|
|
4007
|
+
holeLength?: string | undefined;
|
|
4008
|
+
holePoints?: {
|
|
4009
|
+
x: number;
|
|
4010
|
+
y: number;
|
|
4011
|
+
}[] | undefined;
|
|
3930
4012
|
}, {
|
|
3931
4013
|
number: string | number;
|
|
3932
4014
|
type: "PAD";
|
|
@@ -3944,6 +4026,8 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
3944
4026
|
height?: string | number | undefined;
|
|
3945
4027
|
net?: string | number | undefined;
|
|
3946
4028
|
holeRadius?: string | number | undefined;
|
|
4029
|
+
holeLength?: string | number | undefined;
|
|
4030
|
+
holePoints?: any[] | undefined;
|
|
3947
4031
|
rotation?: string | number | undefined;
|
|
3948
4032
|
}>, z.ZodObject<{
|
|
3949
4033
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -4320,6 +4404,11 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
4320
4404
|
y: number;
|
|
4321
4405
|
}[] | undefined;
|
|
4322
4406
|
net?: string | number | undefined;
|
|
4407
|
+
holeLength?: string | undefined;
|
|
4408
|
+
holePoints?: {
|
|
4409
|
+
x: number;
|
|
4410
|
+
y: number;
|
|
4411
|
+
}[] | undefined;
|
|
4323
4412
|
} | {
|
|
4324
4413
|
type: "ARC";
|
|
4325
4414
|
width: number;
|
|
@@ -4516,6 +4605,11 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
4516
4605
|
y: number;
|
|
4517
4606
|
}[] | undefined;
|
|
4518
4607
|
net?: string | number | undefined;
|
|
4608
|
+
holeLength?: string | undefined;
|
|
4609
|
+
holePoints?: {
|
|
4610
|
+
x: number;
|
|
4611
|
+
y: number;
|
|
4612
|
+
}[] | undefined;
|
|
4519
4613
|
} | {
|
|
4520
4614
|
type: "ARC";
|
|
4521
4615
|
width: number;
|
|
@@ -4895,7 +4989,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
4895
4989
|
c_spiceCmd?: any;
|
|
4896
4990
|
};
|
|
4897
4991
|
canvas: string;
|
|
4898
|
-
colors:
|
|
4992
|
+
colors: Record<string, string> | string[];
|
|
4899
4993
|
};
|
|
4900
4994
|
description: string;
|
|
4901
4995
|
szlcsc: {
|
|
@@ -4965,6 +5059,11 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
4965
5059
|
y: number;
|
|
4966
5060
|
}[] | undefined;
|
|
4967
5061
|
net?: string | number | undefined;
|
|
5062
|
+
holeLength?: string | undefined;
|
|
5063
|
+
holePoints?: {
|
|
5064
|
+
x: number;
|
|
5065
|
+
y: number;
|
|
5066
|
+
}[] | undefined;
|
|
4968
5067
|
} | {
|
|
4969
5068
|
type: "ARC";
|
|
4970
5069
|
width: number;
|
|
@@ -5146,7 +5245,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
5146
5245
|
width: number;
|
|
5147
5246
|
height: number;
|
|
5148
5247
|
} | undefined;
|
|
5149
|
-
colors?:
|
|
5248
|
+
colors?: Record<string, string> | string[] | undefined;
|
|
5150
5249
|
};
|
|
5151
5250
|
description: string;
|
|
5152
5251
|
szlcsc: {
|
package/dist/browser/index.js
CHANGED
|
@@ -8676,6 +8676,29 @@ function compose(...matrices) {
|
|
|
8676
8676
|
|
|
8677
8677
|
// node_modules/transformation-matrix/src/rotate.js
|
|
8678
8678
|
var { cos, sin, PI } = Math;
|
|
8679
|
+
function rotate(angle, cx, cy) {
|
|
8680
|
+
const cosAngle = cos(angle);
|
|
8681
|
+
const sinAngle = sin(angle);
|
|
8682
|
+
const rotationMatrix = {
|
|
8683
|
+
a: cosAngle,
|
|
8684
|
+
c: -sinAngle,
|
|
8685
|
+
e: 0,
|
|
8686
|
+
b: sinAngle,
|
|
8687
|
+
d: cosAngle,
|
|
8688
|
+
f: 0
|
|
8689
|
+
};
|
|
8690
|
+
if (isUndefined(cx) || isUndefined(cy)) {
|
|
8691
|
+
return rotationMatrix;
|
|
8692
|
+
}
|
|
8693
|
+
return transform([
|
|
8694
|
+
translate(cx, cy),
|
|
8695
|
+
rotationMatrix,
|
|
8696
|
+
translate(-cx, -cy)
|
|
8697
|
+
]);
|
|
8698
|
+
}
|
|
8699
|
+
function rotateDEG(angle, cx = void 0, cy = void 0) {
|
|
8700
|
+
return rotate(angle * PI / 180, cx, cy);
|
|
8701
|
+
}
|
|
8679
8702
|
|
|
8680
8703
|
// node_modules/transformation-matrix/src/scale.js
|
|
8681
8704
|
function scale(sx, sy = void 0, cx = void 0, cy = void 0) {
|
|
@@ -10282,6 +10305,97 @@ var PIN1_LOCATION_PARTS = {
|
|
|
10282
10305
|
};
|
|
10283
10306
|
var PIN1_LOCATIONS = Object.keys(PIN1_LOCATION_PARTS);
|
|
10284
10307
|
|
|
10308
|
+
// node_modules/@tscircuit/mm/dist/index.js
|
|
10309
|
+
var unitToMm = {
|
|
10310
|
+
in: 25.4,
|
|
10311
|
+
inch: 25.4,
|
|
10312
|
+
mil: 0.0254,
|
|
10313
|
+
mm: 1,
|
|
10314
|
+
m: 1e3,
|
|
10315
|
+
cm: 10,
|
|
10316
|
+
ft: 304.8,
|
|
10317
|
+
feet: 304.8
|
|
10318
|
+
};
|
|
10319
|
+
var mmNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
10320
|
+
useGrouping: false,
|
|
10321
|
+
notation: "standard",
|
|
10322
|
+
maximumFractionDigits: 12
|
|
10323
|
+
});
|
|
10324
|
+
var mm = (n) => {
|
|
10325
|
+
let unit = typeof n === "number" ? "mm" : n.replace(/^[^a-zA-Z]+/g, "").toLowerCase();
|
|
10326
|
+
if (!unit)
|
|
10327
|
+
unit = "mm";
|
|
10328
|
+
const val = typeof n === "number" ? n : Number.parseFloat(n.split(unit)[0]);
|
|
10329
|
+
if (unit in unitToMm) {
|
|
10330
|
+
return val * unitToMm[unit];
|
|
10331
|
+
}
|
|
10332
|
+
throw new Error(`Unsupported unit: ${unit}`);
|
|
10333
|
+
};
|
|
10334
|
+
var mmStr = (n) => {
|
|
10335
|
+
return `${mmNumberFormatter.format(mm(n))}mm`;
|
|
10336
|
+
};
|
|
10337
|
+
var mil2mm = (mil) => {
|
|
10338
|
+
if (typeof mil === "number")
|
|
10339
|
+
return mm(`${mil}mil`);
|
|
10340
|
+
if (mil.match(/^\d+$/))
|
|
10341
|
+
return mm(`${mil}mil`);
|
|
10342
|
+
return mm(mil);
|
|
10343
|
+
};
|
|
10344
|
+
|
|
10345
|
+
// lib/utils/get-easyeda-plated-hole-geometry.ts
|
|
10346
|
+
var getEasyEdaPlatedHoleGeometry = (pad) => {
|
|
10347
|
+
const holeDiameterMm = mil2mm(pad.holeRadius) * 2;
|
|
10348
|
+
const holeLengthMm = pad.holeLength ? mil2mm(pad.holeLength) : 0;
|
|
10349
|
+
let holeWidthMm = holeDiameterMm;
|
|
10350
|
+
let holeHeightMm = holeDiameterMm;
|
|
10351
|
+
if (holeLengthMm > holeDiameterMm) {
|
|
10352
|
+
if (!pad.holePoints) {
|
|
10353
|
+
throw new Error(`Slot on pad ${pad.number} is missing hole endpoints`);
|
|
10354
|
+
}
|
|
10355
|
+
const [start, end] = pad.holePoints;
|
|
10356
|
+
const localHoleDirection = applyToPoint(rotateDEG(pad.rotation), {
|
|
10357
|
+
x: end.x - start.x,
|
|
10358
|
+
y: end.y - start.y
|
|
10359
|
+
});
|
|
10360
|
+
const absX = Math.abs(localHoleDirection.x);
|
|
10361
|
+
const absY = Math.abs(localHoleDirection.y);
|
|
10362
|
+
if (Math.min(absX, absY) > Math.max(absX, absY) * 1e-3) {
|
|
10363
|
+
throw new Error(`Slot on pad ${pad.number} is not aligned with its pad`);
|
|
10364
|
+
}
|
|
10365
|
+
if (absX > absY) holeWidthMm = holeLengthMm;
|
|
10366
|
+
else holeHeightMm = holeLengthMm;
|
|
10367
|
+
}
|
|
10368
|
+
if (pad.shape === "RECT") {
|
|
10369
|
+
return {
|
|
10370
|
+
shape: "rotated_pill_hole_with_rect_pad",
|
|
10371
|
+
hole_shape: "rotated_pill",
|
|
10372
|
+
pad_shape: "rect",
|
|
10373
|
+
hole_width: holeWidthMm,
|
|
10374
|
+
hole_height: holeHeightMm,
|
|
10375
|
+
hole_ccw_rotation: pad.rotation,
|
|
10376
|
+
rect_ccw_rotation: pad.rotation,
|
|
10377
|
+
rect_pad_width: mil2mm(pad.width),
|
|
10378
|
+
rect_pad_height: mil2mm(pad.height)
|
|
10379
|
+
};
|
|
10380
|
+
}
|
|
10381
|
+
if (pad.shape === "OVAL" || holeLengthMm > holeDiameterMm) {
|
|
10382
|
+
return {
|
|
10383
|
+
shape: "pill",
|
|
10384
|
+
hole_width: holeWidthMm,
|
|
10385
|
+
hole_height: holeHeightMm,
|
|
10386
|
+
outer_width: mil2mm(pad.width),
|
|
10387
|
+
outer_height: mil2mm(pad.height),
|
|
10388
|
+
ccw_rotation: pad.rotation
|
|
10389
|
+
};
|
|
10390
|
+
}
|
|
10391
|
+
return {
|
|
10392
|
+
shape: "circle",
|
|
10393
|
+
hole_diameter: holeDiameterMm,
|
|
10394
|
+
outer_diameter: mil2mm(pad.width),
|
|
10395
|
+
radius: mil2mm(pad.holeRadius)
|
|
10396
|
+
};
|
|
10397
|
+
};
|
|
10398
|
+
|
|
10285
10399
|
// lib/utils/normalize-pin-labels.ts
|
|
10286
10400
|
var normalizeActiveLowPinLabel = (label) => {
|
|
10287
10401
|
const hasActiveLowMarker = label.startsWith("#") || label.endsWith("#");
|
|
@@ -10503,43 +10617,6 @@ var getBoardOutlinePolygons = (tracks) => {
|
|
|
10503
10617
|
return polygons;
|
|
10504
10618
|
};
|
|
10505
10619
|
|
|
10506
|
-
// node_modules/@tscircuit/mm/dist/index.js
|
|
10507
|
-
var unitToMm = {
|
|
10508
|
-
in: 25.4,
|
|
10509
|
-
inch: 25.4,
|
|
10510
|
-
mil: 0.0254,
|
|
10511
|
-
mm: 1,
|
|
10512
|
-
m: 1e3,
|
|
10513
|
-
cm: 10,
|
|
10514
|
-
ft: 304.8,
|
|
10515
|
-
feet: 304.8
|
|
10516
|
-
};
|
|
10517
|
-
var mmNumberFormatter = new Intl.NumberFormat("en-US", {
|
|
10518
|
-
useGrouping: false,
|
|
10519
|
-
notation: "standard",
|
|
10520
|
-
maximumFractionDigits: 12
|
|
10521
|
-
});
|
|
10522
|
-
var mm = (n) => {
|
|
10523
|
-
let unit = typeof n === "number" ? "mm" : n.replace(/^[^a-zA-Z]+/g, "").toLowerCase();
|
|
10524
|
-
if (!unit)
|
|
10525
|
-
unit = "mm";
|
|
10526
|
-
const val = typeof n === "number" ? n : Number.parseFloat(n.split(unit)[0]);
|
|
10527
|
-
if (unit in unitToMm) {
|
|
10528
|
-
return val * unitToMm[unit];
|
|
10529
|
-
}
|
|
10530
|
-
throw new Error(`Unsupported unit: ${unit}`);
|
|
10531
|
-
};
|
|
10532
|
-
var mmStr = (n) => {
|
|
10533
|
-
return `${mmNumberFormatter.format(mm(n))}mm`;
|
|
10534
|
-
};
|
|
10535
|
-
var mil2mm = (mil) => {
|
|
10536
|
-
if (typeof mil === "number")
|
|
10537
|
-
return mm(`${mil}mil`);
|
|
10538
|
-
if (mil.match(/^\d+$/))
|
|
10539
|
-
return mm(`${mil}mil`);
|
|
10540
|
-
return mm(mil);
|
|
10541
|
-
};
|
|
10542
|
-
|
|
10543
10620
|
// lib/constants.ts
|
|
10544
10621
|
var DEFAULT_PCB_THICKNESS_MM = 1.6;
|
|
10545
10622
|
|
|
@@ -11241,74 +11318,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
11241
11318
|
pcb_component_id: "pcb_component_1",
|
|
11242
11319
|
pcb_port_id: `pcb_port_${index + 1}`
|
|
11243
11320
|
};
|
|
11244
|
-
|
|
11245
|
-
if (pad.shape === "OVAL") {
|
|
11246
|
-
const largestOuterDimensionName = mil2mm(pad.width) > mil2mm(pad.height) ? "width" : "height";
|
|
11247
|
-
const smallestOuterDimension = Math.min(
|
|
11248
|
-
mil2mm(pad.width),
|
|
11249
|
-
mil2mm(pad.height)
|
|
11250
|
-
);
|
|
11251
|
-
const largestOuterDimension = Math.max(
|
|
11252
|
-
mil2mm(pad.width),
|
|
11253
|
-
mil2mm(pad.height)
|
|
11254
|
-
);
|
|
11255
|
-
const distanceFromOuterPlatingToHole = smallestOuterDimension / 2 - mil2mm(pad.holeRadius);
|
|
11256
|
-
const largestInnerDimension = largestOuterDimension - distanceFromOuterPlatingToHole * 2;
|
|
11257
|
-
const smallestInnerDimension = mil2mm(pad.holeRadius) * 2;
|
|
11258
|
-
const innerWidth = largestOuterDimensionName === "width" ? largestInnerDimension : smallestInnerDimension;
|
|
11259
|
-
const innerHeight = largestOuterDimensionName === "height" ? largestInnerDimension : smallestInnerDimension;
|
|
11260
|
-
additionalPlatedHoleProps = {
|
|
11261
|
-
shape: "pill",
|
|
11262
|
-
hole_width: innerWidth,
|
|
11263
|
-
hole_height: innerHeight,
|
|
11264
|
-
outer_width: mil2mm(pad.width),
|
|
11265
|
-
outer_height: mil2mm(pad.height),
|
|
11266
|
-
ccw_rotation: pad.rotation || 0
|
|
11267
|
-
};
|
|
11268
|
-
} else if (pad.shape === "RECT") {
|
|
11269
|
-
const padWidth = mil2mm(pad.width);
|
|
11270
|
-
const padHeight = mil2mm(pad.height);
|
|
11271
|
-
const holeRadius = mil2mm(pad.holeRadius);
|
|
11272
|
-
const holeDiameter = holeRadius * 2;
|
|
11273
|
-
const aspectRatio = Math.max(padWidth, padHeight) / Math.min(padWidth, padHeight);
|
|
11274
|
-
const isSignificantlyRectangular = aspectRatio > 1.5;
|
|
11275
|
-
if (isSignificantlyRectangular) {
|
|
11276
|
-
const baseWidth = holeDiameter;
|
|
11277
|
-
const pillHeight = baseWidth * 2.6;
|
|
11278
|
-
const holeWidth = padWidth > padHeight ? pillHeight : baseWidth;
|
|
11279
|
-
const holeHeight = padHeight > padWidth ? pillHeight : baseWidth;
|
|
11280
|
-
additionalPlatedHoleProps = {
|
|
11281
|
-
shape: "rotated_pill_hole_with_rect_pad",
|
|
11282
|
-
hole_shape: "rotated_pill",
|
|
11283
|
-
pad_shape: "rect",
|
|
11284
|
-
hole_width: holeWidth,
|
|
11285
|
-
hole_height: holeHeight,
|
|
11286
|
-
hole_ccw_rotation: pad.rotation || 0,
|
|
11287
|
-
rect_ccw_rotation: pad.rotation || 0,
|
|
11288
|
-
rect_pad_width: padWidth,
|
|
11289
|
-
rect_pad_height: padHeight
|
|
11290
|
-
};
|
|
11291
|
-
} else {
|
|
11292
|
-
additionalPlatedHoleProps = {
|
|
11293
|
-
shape: "rotated_pill_hole_with_rect_pad",
|
|
11294
|
-
hole_shape: "rotated_pill",
|
|
11295
|
-
pad_shape: "rect",
|
|
11296
|
-
hole_width: holeDiameter,
|
|
11297
|
-
hole_height: holeDiameter,
|
|
11298
|
-
hole_ccw_rotation: pad.rotation || 0,
|
|
11299
|
-
rect_ccw_rotation: pad.rotation || 0,
|
|
11300
|
-
rect_pad_width: padWidth,
|
|
11301
|
-
rect_pad_height: padHeight
|
|
11302
|
-
};
|
|
11303
|
-
}
|
|
11304
|
-
} else {
|
|
11305
|
-
additionalPlatedHoleProps = {
|
|
11306
|
-
shape: "circle",
|
|
11307
|
-
hole_diameter: mil2mm(pad.holeRadius) * 2,
|
|
11308
|
-
outer_diameter: mil2mm(pad.width),
|
|
11309
|
-
radius: mil2mm(pad.holeRadius)
|
|
11310
|
-
};
|
|
11311
|
-
}
|
|
11321
|
+
const additionalPlatedHoleProps = getEasyEdaPlatedHoleGeometry(pad);
|
|
11312
11322
|
circuitElements.push(
|
|
11313
11323
|
pcb_plated_hole.parse({
|
|
11314
11324
|
...commonPlatedHoleProps,
|
|
@@ -11714,6 +11724,8 @@ var PadSchema = BaseShapeSchema.extend({
|
|
|
11714
11724
|
net: external_exports.union([external_exports.string(), external_exports.number()]).optional(),
|
|
11715
11725
|
number: external_exports.union([external_exports.string(), external_exports.number()]),
|
|
11716
11726
|
holeRadius: tenthmil,
|
|
11727
|
+
holeLength: tenthmil.optional(),
|
|
11728
|
+
holePoints: external_exports.array(PointSchema).length(2).optional(),
|
|
11717
11729
|
points: external_exports.array(PointSchema).optional(),
|
|
11718
11730
|
rotation: safeNumber(0),
|
|
11719
11731
|
// Will default to 0 if NaN or missing
|
|
@@ -11849,6 +11861,8 @@ var ShapeItemSchema = external_exports.object({
|
|
|
11849
11861
|
net,
|
|
11850
11862
|
number: padNumber,
|
|
11851
11863
|
holeRadius,
|
|
11864
|
+
holeLength: rest[3] === void 0 || rest[3] === "" ? void 0 : rest[3],
|
|
11865
|
+
holePoints: rest[4] ? parsePoints(String(rest[4])) : void 0,
|
|
11852
11866
|
points,
|
|
11853
11867
|
rotation: rotation2,
|
|
11854
11868
|
plated: rest.includes("Y")
|
|
@@ -13689,7 +13703,9 @@ var getGeneratedComponentType = (betterEasy, pinCount) => {
|
|
|
13689
13703
|
if (isDiodeCategoryComponent(betterEasy) && pinCount === 2) return "diode";
|
|
13690
13704
|
if (isPushbuttonCategoryComponent(betterEasy)) return "pushbutton";
|
|
13691
13705
|
if (isDipSwitchCategoryComponent(betterEasy)) return "chip";
|
|
13692
|
-
if (isSwitchCategoryComponent(betterEasy))
|
|
13706
|
+
if (isSwitchCategoryComponent(betterEasy)) {
|
|
13707
|
+
return pinCount > 2 ? "chip" : "switch";
|
|
13708
|
+
}
|
|
13693
13709
|
if (isCapacitorComponent(betterEasy)) return "capacitor";
|
|
13694
13710
|
if (isResistorComponent(betterEasy) && pinCount === 2) return "resistor";
|
|
13695
13711
|
if (isInductorComponent(betterEasy) && pinCount === 2) return "inductor";
|
|
@@ -13787,7 +13803,7 @@ var convertBetterEasyToTsx = async ({
|
|
|
13787
13803
|
betterEasy,
|
|
13788
13804
|
sourcePorts.length
|
|
13789
13805
|
);
|
|
13790
|
-
const
|
|
13806
|
+
const isSwitchRenderedAsChip = isDipSwitchCategoryComponent(betterEasy) || isSwitchCategoryComponent(betterEasy) && sourcePorts.length > 2;
|
|
13791
13807
|
const inductance2 = componentType === "inductor" ? betterEasy.dataStr.head.c_para.Value?.trim() : void 0;
|
|
13792
13808
|
const capacitance2 = componentType === "capacitor" ? normalizeCapacitanceValue(betterEasy.dataStr.head.c_para.Value) : void 0;
|
|
13793
13809
|
const resistance2 = componentType === "resistor" ? normalizeResistorValue(betterEasy.dataStr.head.c_para.Value) : void 0;
|
|
@@ -13796,7 +13812,7 @@ var convertBetterEasyToTsx = async ({
|
|
|
13796
13812
|
const isMultiPinDiode = isDiodeCategoryComponent(betterEasy) && sourcePorts.length !== 2;
|
|
13797
13813
|
const isMultiPinInductor = isInductorComponent(betterEasy) && sourcePorts.length !== 2;
|
|
13798
13814
|
const isPassiveWithCustomSymbol = componentType === "capacitor" && sourcePorts.length !== 2;
|
|
13799
|
-
const symbolTsx = isPassiveWithCustomSymbol || componentType === "chip" && !isMultiPinDiode && !isMultiPinInductor && hasNonBoxSchematicSymbol(betterEasy) ? generateSymbolTsx(betterEasy, circuitJson, {
|
|
13815
|
+
const symbolTsx = isPassiveWithCustomSymbol || componentType === "chip" && !isMultiPinDiode && !isMultiPinInductor && !isSwitchRenderedAsChip && hasNonBoxSchematicSymbol(betterEasy) ? generateSymbolTsx(betterEasy, circuitJson, {
|
|
13800
13816
|
alignPortsToDrawing: isPassiveWithCustomSymbol
|
|
13801
13817
|
}) : void 0;
|
|
13802
13818
|
const schPinArrangement = symbolTsx ? void 0 : getVisibleSchematicPinArrangement(betterEasy);
|
|
@@ -13816,8 +13832,7 @@ var convertBetterEasyToTsx = async ({
|
|
|
13816
13832
|
crystalFrequency,
|
|
13817
13833
|
crystalPinVariant,
|
|
13818
13834
|
symbolTsx,
|
|
13819
|
-
schPinArrangement
|
|
13820
|
-
useSymbolPortsOnly: isDipSwitch && Boolean(symbolTsx)
|
|
13835
|
+
schPinArrangement
|
|
13821
13836
|
});
|
|
13822
13837
|
};
|
|
13823
13838
|
var checkModelObjUrlValidity = async (url) => {
|