easyeda 0.0.367 → 0.0.369

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/README.md CHANGED
@@ -108,6 +108,35 @@ const soupJson = convertEasyEdaJsonToCircuitJson(rawEasyJson, {
108
108
  })
109
109
  ```
110
110
 
111
+ ### Supplying Datasheet Pin Attributes
112
+
113
+ Callers can provide a `pinAttributes` map using the `@tscircuit/props` schema.
114
+ The converter matches rows to physical footprint pad identifiers: both `"1"`
115
+ and `"pin1"` are accepted, as are `"A1"` and `"pinA1"` for BGA pads. A `pin`-prefixed
116
+ row takes precedence when both forms specify the same attribute. Signal aliases
117
+ are used only when no physical row is supplied, and conflicting alias rows are
118
+ ignored.
119
+
120
+ ```tsx
121
+ import { convertEasyEdaJsonToCircuitJson, convertRawEasyEdaToTs } from "easyeda"
122
+
123
+ const pinAttributes = {
124
+ "1": { requiresPower: true, requiresVoltage: "2.8V" },
125
+ "2": { requiresGround: true },
126
+ "3": {}, // Explicitly undocumented electrical role
127
+ }
128
+
129
+ const circuitJson = convertEasyEdaJsonToCircuitJson(betterEasy, { pinAttributes })
130
+ const tsx = await convertRawEasyEdaToTs({ rawEasy, pinAttributes })
131
+ ```
132
+
133
+ Attributes are written onto Circuit JSON `source_port` records and included in
134
+ the generated TSX. Supplied rows replace TSX label inference for that pin,
135
+ including an explicit empty row. Other pins retain the existing inference.
136
+ The browser exports `convertRawEasyToTsx` and `convertBetterEasyToTsx` accept the
137
+ same option. Fetching and validating datasheet metadata remains the caller's
138
+ responsibility; these options do not make a datasheet API request.
139
+
111
140
  ### Working with Generated TypeScript Components
112
141
 
113
142
  The generated TypeScript React components can be imported and used in your tscircuit projects:
@@ -1,3 +1,4 @@
1
+ import { ChipProps, CommonComponentProps } from '@tscircuit/props';
1
2
  import { z } from 'zod';
2
3
  import { AnyCircuitElement } from 'circuit-json';
3
4
 
@@ -758,7 +759,7 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
758
759
  c_spiceCmd?: any;
759
760
  };
760
761
  canvas: string;
761
- colors: string[] | Record<string, string>;
762
+ colors: Record<string, string> | string[];
762
763
  BBox?: {
763
764
  x: number;
764
765
  y: number;
@@ -787,7 +788,7 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
787
788
  width: number;
788
789
  height: number;
789
790
  } | undefined;
790
- colors?: string[] | Record<string, string> | undefined;
791
+ colors?: Record<string, string> | string[] | undefined;
791
792
  }>, {
792
793
  BBox: {
793
794
  x: number;
@@ -908,7 +909,7 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
908
909
  c_spiceCmd?: any;
909
910
  };
910
911
  canvas: string;
911
- colors: string[] | Record<string, string>;
912
+ colors: Record<string, string> | string[];
912
913
  }, {
913
914
  shape: string[];
914
915
  head: {
@@ -931,7 +932,7 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
931
932
  width: number;
932
933
  height: number;
933
934
  } | undefined;
934
- colors?: string[] | Record<string, string> | undefined;
935
+ colors?: Record<string, string> | string[] | undefined;
935
936
  }>;
936
937
  declare const PackageDetailDataStrSchema: z.ZodObject<{
937
938
  head: z.ZodObject<{
@@ -1002,6 +1003,11 @@ declare const PackageDetailDataStrSchema: z.ZodObject<{
1002
1003
  y: number;
1003
1004
  }[] | undefined;
1004
1005
  net?: string | number | undefined;
1006
+ holeLength?: string | undefined;
1007
+ holePoints?: {
1008
+ x: number;
1009
+ y: number;
1010
+ }[] | undefined;
1005
1011
  } | {
1006
1012
  type: "ARC";
1007
1013
  width: number;
@@ -1146,6 +1152,17 @@ declare const PackageDetailDataStrSchema: z.ZodObject<{
1146
1152
  net: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
1147
1153
  number: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
1148
1154
  holeRadius: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>, string, string | number | undefined>, z.ZodString>;
1155
+ holeLength: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>, string, string | number | undefined>, z.ZodString>>;
1156
+ holePoints: z.ZodOptional<z.ZodArray<z.ZodPipeline<z.ZodEffects<z.ZodAny, any, any>, z.ZodObject<{
1157
+ x: z.ZodNumber;
1158
+ y: z.ZodNumber;
1159
+ }, "strip", z.ZodTypeAny, {
1160
+ x: number;
1161
+ y: number;
1162
+ }, {
1163
+ x: number;
1164
+ y: number;
1165
+ }>>, "many">>;
1149
1166
  points: z.ZodOptional<z.ZodArray<z.ZodPipeline<z.ZodEffects<z.ZodAny, any, any>, z.ZodObject<{
1150
1167
  x: z.ZodNumber;
1151
1168
  y: z.ZodNumber;
@@ -1179,6 +1196,11 @@ declare const PackageDetailDataStrSchema: z.ZodObject<{
1179
1196
  y: number;
1180
1197
  }[] | undefined;
1181
1198
  net?: string | number | undefined;
1199
+ holeLength?: string | undefined;
1200
+ holePoints?: {
1201
+ x: number;
1202
+ y: number;
1203
+ }[] | undefined;
1182
1204
  }, {
1183
1205
  number: string | number;
1184
1206
  type: "PAD";
@@ -1196,6 +1218,8 @@ declare const PackageDetailDataStrSchema: z.ZodObject<{
1196
1218
  height?: string | number | undefined;
1197
1219
  net?: string | number | undefined;
1198
1220
  holeRadius?: string | number | undefined;
1221
+ holeLength?: string | number | undefined;
1222
+ holePoints?: any[] | undefined;
1199
1223
  rotation?: string | number | undefined;
1200
1224
  }>, z.ZodObject<{
1201
1225
  id: z.ZodOptional<z.ZodString>;
@@ -1572,6 +1596,11 @@ declare const PackageDetailDataStrSchema: z.ZodObject<{
1572
1596
  y: number;
1573
1597
  }[] | undefined;
1574
1598
  net?: string | number | undefined;
1599
+ holeLength?: string | undefined;
1600
+ holePoints?: {
1601
+ x: number;
1602
+ y: number;
1603
+ }[] | undefined;
1575
1604
  } | {
1576
1605
  type: "ARC";
1577
1606
  width: number;
@@ -1816,6 +1845,11 @@ declare const PackageDetailSchema: z.ZodObject<{
1816
1845
  y: number;
1817
1846
  }[] | undefined;
1818
1847
  net?: string | number | undefined;
1848
+ holeLength?: string | undefined;
1849
+ holePoints?: {
1850
+ x: number;
1851
+ y: number;
1852
+ }[] | undefined;
1819
1853
  } | {
1820
1854
  type: "ARC";
1821
1855
  width: number;
@@ -1960,6 +1994,17 @@ declare const PackageDetailSchema: z.ZodObject<{
1960
1994
  net: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
1961
1995
  number: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
1962
1996
  holeRadius: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>, string, string | number | undefined>, z.ZodString>;
1997
+ holeLength: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>, string, string | number | undefined>, z.ZodString>>;
1998
+ holePoints: z.ZodOptional<z.ZodArray<z.ZodPipeline<z.ZodEffects<z.ZodAny, any, any>, z.ZodObject<{
1999
+ x: z.ZodNumber;
2000
+ y: z.ZodNumber;
2001
+ }, "strip", z.ZodTypeAny, {
2002
+ x: number;
2003
+ y: number;
2004
+ }, {
2005
+ x: number;
2006
+ y: number;
2007
+ }>>, "many">>;
1963
2008
  points: z.ZodOptional<z.ZodArray<z.ZodPipeline<z.ZodEffects<z.ZodAny, any, any>, z.ZodObject<{
1964
2009
  x: z.ZodNumber;
1965
2010
  y: z.ZodNumber;
@@ -1993,6 +2038,11 @@ declare const PackageDetailSchema: z.ZodObject<{
1993
2038
  y: number;
1994
2039
  }[] | undefined;
1995
2040
  net?: string | number | undefined;
2041
+ holeLength?: string | undefined;
2042
+ holePoints?: {
2043
+ x: number;
2044
+ y: number;
2045
+ }[] | undefined;
1996
2046
  }, {
1997
2047
  number: string | number;
1998
2048
  type: "PAD";
@@ -2010,6 +2060,8 @@ declare const PackageDetailSchema: z.ZodObject<{
2010
2060
  height?: string | number | undefined;
2011
2061
  net?: string | number | undefined;
2012
2062
  holeRadius?: string | number | undefined;
2063
+ holeLength?: string | number | undefined;
2064
+ holePoints?: any[] | undefined;
2013
2065
  rotation?: string | number | undefined;
2014
2066
  }>, z.ZodObject<{
2015
2067
  id: z.ZodOptional<z.ZodString>;
@@ -2386,6 +2438,11 @@ declare const PackageDetailSchema: z.ZodObject<{
2386
2438
  y: number;
2387
2439
  }[] | undefined;
2388
2440
  net?: string | number | undefined;
2441
+ holeLength?: string | undefined;
2442
+ holePoints?: {
2443
+ x: number;
2444
+ y: number;
2445
+ }[] | undefined;
2389
2446
  } | {
2390
2447
  type: "ARC";
2391
2448
  width: number;
@@ -2582,6 +2639,11 @@ declare const PackageDetailSchema: z.ZodObject<{
2582
2639
  y: number;
2583
2640
  }[] | undefined;
2584
2641
  net?: string | number | undefined;
2642
+ holeLength?: string | undefined;
2643
+ holePoints?: {
2644
+ x: number;
2645
+ y: number;
2646
+ }[] | undefined;
2585
2647
  } | {
2586
2648
  type: "ARC";
2587
2649
  width: number;
@@ -3477,7 +3539,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
3477
3539
  c_spiceCmd?: any;
3478
3540
  };
3479
3541
  canvas: string;
3480
- colors: string[] | Record<string, string>;
3542
+ colors: Record<string, string> | string[];
3481
3543
  BBox?: {
3482
3544
  x: number;
3483
3545
  y: number;
@@ -3506,7 +3568,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
3506
3568
  width: number;
3507
3569
  height: number;
3508
3570
  } | undefined;
3509
- colors?: string[] | Record<string, string> | undefined;
3571
+ colors?: Record<string, string> | string[] | undefined;
3510
3572
  }>, {
3511
3573
  BBox: {
3512
3574
  x: number;
@@ -3627,7 +3689,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
3627
3689
  c_spiceCmd?: any;
3628
3690
  };
3629
3691
  canvas: string;
3630
- colors: string[] | Record<string, string>;
3692
+ colors: Record<string, string> | string[];
3631
3693
  }, {
3632
3694
  shape: string[];
3633
3695
  head: {
@@ -3650,7 +3712,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
3650
3712
  width: number;
3651
3713
  height: number;
3652
3714
  } | undefined;
3653
- colors?: string[] | Record<string, string> | undefined;
3715
+ colors?: Record<string, string> | string[] | undefined;
3654
3716
  }>;
3655
3717
  verify: z.ZodBoolean;
3656
3718
  SMT: z.ZodOptional<z.ZodBoolean>;
@@ -3750,6 +3812,11 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
3750
3812
  y: number;
3751
3813
  }[] | undefined;
3752
3814
  net?: string | number | undefined;
3815
+ holeLength?: string | undefined;
3816
+ holePoints?: {
3817
+ x: number;
3818
+ y: number;
3819
+ }[] | undefined;
3753
3820
  } | {
3754
3821
  type: "ARC";
3755
3822
  width: number;
@@ -3894,6 +3961,17 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
3894
3961
  net: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
3895
3962
  number: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
3896
3963
  holeRadius: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>, string, string | number | undefined>, z.ZodString>;
3964
+ holeLength: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>, string, string | number | undefined>, z.ZodString>>;
3965
+ holePoints: z.ZodOptional<z.ZodArray<z.ZodPipeline<z.ZodEffects<z.ZodAny, any, any>, z.ZodObject<{
3966
+ x: z.ZodNumber;
3967
+ y: z.ZodNumber;
3968
+ }, "strip", z.ZodTypeAny, {
3969
+ x: number;
3970
+ y: number;
3971
+ }, {
3972
+ x: number;
3973
+ y: number;
3974
+ }>>, "many">>;
3897
3975
  points: z.ZodOptional<z.ZodArray<z.ZodPipeline<z.ZodEffects<z.ZodAny, any, any>, z.ZodObject<{
3898
3976
  x: z.ZodNumber;
3899
3977
  y: z.ZodNumber;
@@ -3927,6 +4005,11 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
3927
4005
  y: number;
3928
4006
  }[] | undefined;
3929
4007
  net?: string | number | undefined;
4008
+ holeLength?: string | undefined;
4009
+ holePoints?: {
4010
+ x: number;
4011
+ y: number;
4012
+ }[] | undefined;
3930
4013
  }, {
3931
4014
  number: string | number;
3932
4015
  type: "PAD";
@@ -3944,6 +4027,8 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
3944
4027
  height?: string | number | undefined;
3945
4028
  net?: string | number | undefined;
3946
4029
  holeRadius?: string | number | undefined;
4030
+ holeLength?: string | number | undefined;
4031
+ holePoints?: any[] | undefined;
3947
4032
  rotation?: string | number | undefined;
3948
4033
  }>, z.ZodObject<{
3949
4034
  id: z.ZodOptional<z.ZodString>;
@@ -4320,6 +4405,11 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
4320
4405
  y: number;
4321
4406
  }[] | undefined;
4322
4407
  net?: string | number | undefined;
4408
+ holeLength?: string | undefined;
4409
+ holePoints?: {
4410
+ x: number;
4411
+ y: number;
4412
+ }[] | undefined;
4323
4413
  } | {
4324
4414
  type: "ARC";
4325
4415
  width: number;
@@ -4516,6 +4606,11 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
4516
4606
  y: number;
4517
4607
  }[] | undefined;
4518
4608
  net?: string | number | undefined;
4609
+ holeLength?: string | undefined;
4610
+ holePoints?: {
4611
+ x: number;
4612
+ y: number;
4613
+ }[] | undefined;
4519
4614
  } | {
4520
4615
  type: "ARC";
4521
4616
  width: number;
@@ -4895,7 +4990,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
4895
4990
  c_spiceCmd?: any;
4896
4991
  };
4897
4992
  canvas: string;
4898
- colors: string[] | Record<string, string>;
4993
+ colors: Record<string, string> | string[];
4899
4994
  };
4900
4995
  description: string;
4901
4996
  szlcsc: {
@@ -4965,6 +5060,11 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
4965
5060
  y: number;
4966
5061
  }[] | undefined;
4967
5062
  net?: string | number | undefined;
5063
+ holeLength?: string | undefined;
5064
+ holePoints?: {
5065
+ x: number;
5066
+ y: number;
5067
+ }[] | undefined;
4968
5068
  } | {
4969
5069
  type: "ARC";
4970
5070
  width: number;
@@ -5146,7 +5246,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
5146
5246
  width: number;
5147
5247
  height: number;
5148
5248
  } | undefined;
5149
- colors?: string[] | Record<string, string> | undefined;
5249
+ colors?: Record<string, string> | string[] | undefined;
5150
5250
  };
5151
5251
  description: string;
5152
5252
  szlcsc: {
@@ -5233,11 +5333,13 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
5233
5333
  type RawEasyEdaJson = z.input<typeof EasyEdaJsonSchema>;
5234
5334
  type BetterEasyEdaJson = z.infer<typeof EasyEdaJsonSchema>;
5235
5335
 
5236
- declare const convertRawEasyToTsx: ({ rawEasy }: {
5336
+ declare const convertRawEasyToTsx: ({ rawEasy, pinAttributes, }: {
5237
5337
  rawEasy: any;
5338
+ pinAttributes?: ChipProps["pinAttributes"];
5238
5339
  }) => Promise<string>;
5239
- declare const convertBetterEasyToTsx: ({ betterEasy, }: {
5340
+ declare const convertBetterEasyToTsx: ({ betterEasy, pinAttributes, }: {
5240
5341
  betterEasy: BetterEasyEdaJson;
5342
+ pinAttributes?: ChipProps["pinAttributes"];
5241
5343
  }) => Promise<string>;
5242
5344
 
5243
5345
  declare function fetchEasyEDAComponent(jlcpcbPartNumber: string, { fetch, includeModelMetadata, }?: {
@@ -5259,6 +5361,7 @@ declare const getModelStepCdnUrl: ({ easyedaModelUuid, easyedaPartNumber, }: Par
5259
5361
  declare const getModelCdnUrl: ({ easyedaModelUuid, easyedaPartNumber, }: Params) => string;
5260
5362
 
5261
5363
  interface Options {
5364
+ pinAttributes?: NonNullable<CommonComponentProps["pinAttributes"]>;
5262
5365
  useModelCdn?: boolean;
5263
5366
  shouldRecenter?: boolean;
5264
5367
  cadPositionXMm?: number;
@@ -5278,6 +5381,6 @@ interface Options {
5278
5381
  };
5279
5382
  showDesignator?: boolean;
5280
5383
  }
5281
- declare const convertEasyEdaJsonToCircuitJson: (easyEdaJson: BetterEasyEdaJson, { useModelCdn, shouldRecenter, cadPositionXMm, cadPositionYMm, cadPositionZMm, cadModelBounds, showDesignator, }?: Options) => AnyCircuitElement[];
5384
+ declare const convertEasyEdaJsonToCircuitJson: (easyEdaJson: BetterEasyEdaJson, options?: Options) => AnyCircuitElement[];
5282
5385
 
5283
5386
  export { BBoxSchema, type BetterEasyEdaJson, DataStrSchema, EasyEdaJsonSchema, HeadSchema, LayerItemSchema, LcscSchema, ModelBoundsSchema, ObjectItemSchema, OwnerSchema, PackageDetailDataStrSchema, PackageDetailSchema, type RawEasyEdaJson, SzlcscSchema, convertBetterEasyToTsx, convertEasyEdaJsonToCircuitJson, convertRawEasyToTsx, fetchEasyEDAComponent, generateFootprintTsx, getModelCdnUrl, getModelObjCdnUrl, getModelStepCdnUrl, maybeNumber };