easyeda 0.0.368 → 0.0.370
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 +29 -0
- package/dist/browser/index.d.ts +20 -3
- package/dist/browser/index.js +8369 -533
- package/dist/browser/index.js.map +1 -1
- package/dist/index.d.ts +18 -2
- package/dist/index.js +12395 -4543
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +12162 -4310
- package/dist/main.cjs.map +1 -1
- package/package.json +4 -4
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:
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -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
|
|
|
@@ -296,6 +297,7 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
|
|
|
296
297
|
textType: string;
|
|
297
298
|
mirror: string;
|
|
298
299
|
backgroundColor?: string | undefined;
|
|
300
|
+
isReferenceDesignator?: boolean | undefined;
|
|
299
301
|
}, string>, z.ZodUnion<[z.ZodObject<{
|
|
300
302
|
type: z.ZodLiteral<"RECTANGLE">;
|
|
301
303
|
position: z.ZodObject<{
|
|
@@ -520,6 +522,7 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
|
|
|
520
522
|
fontDecoration: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, string, unknown>;
|
|
521
523
|
content: z.ZodString;
|
|
522
524
|
textType: z.ZodString;
|
|
525
|
+
isReferenceDesignator: z.ZodOptional<z.ZodBoolean>;
|
|
523
526
|
visibility: z.ZodEnum<["0", "1"]>;
|
|
524
527
|
mirror: z.ZodString;
|
|
525
528
|
id: z.ZodString;
|
|
@@ -540,6 +543,7 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
|
|
|
540
543
|
textType: string;
|
|
541
544
|
mirror: string;
|
|
542
545
|
backgroundColor?: string | undefined;
|
|
546
|
+
isReferenceDesignator?: boolean | undefined;
|
|
543
547
|
}, {
|
|
544
548
|
type: "TEXT";
|
|
545
549
|
x: number;
|
|
@@ -557,6 +561,7 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
|
|
|
557
561
|
fontWeight?: unknown;
|
|
558
562
|
fontStyle?: unknown;
|
|
559
563
|
fontDecoration?: unknown;
|
|
564
|
+
isReferenceDesignator?: boolean | undefined;
|
|
560
565
|
}>, z.ZodObject<{
|
|
561
566
|
type: z.ZodLiteral<"IGNORED">;
|
|
562
567
|
sourceType: z.ZodEnum<["AR", "I"]>;
|
|
@@ -743,6 +748,7 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
|
|
|
743
748
|
textType: string;
|
|
744
749
|
mirror: string;
|
|
745
750
|
backgroundColor?: string | undefined;
|
|
751
|
+
isReferenceDesignator?: boolean | undefined;
|
|
746
752
|
})[];
|
|
747
753
|
head: {
|
|
748
754
|
x: number;
|
|
@@ -893,6 +899,7 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
|
|
|
893
899
|
textType: string;
|
|
894
900
|
mirror: string;
|
|
895
901
|
backgroundColor?: string | undefined;
|
|
902
|
+
isReferenceDesignator?: boolean | undefined;
|
|
896
903
|
})[];
|
|
897
904
|
head: {
|
|
898
905
|
x: number;
|
|
@@ -3076,6 +3083,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
3076
3083
|
textType: string;
|
|
3077
3084
|
mirror: string;
|
|
3078
3085
|
backgroundColor?: string | undefined;
|
|
3086
|
+
isReferenceDesignator?: boolean | undefined;
|
|
3079
3087
|
}, string>, z.ZodUnion<[z.ZodObject<{
|
|
3080
3088
|
type: z.ZodLiteral<"RECTANGLE">;
|
|
3081
3089
|
position: z.ZodObject<{
|
|
@@ -3300,6 +3308,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
3300
3308
|
fontDecoration: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, string, unknown>;
|
|
3301
3309
|
content: z.ZodString;
|
|
3302
3310
|
textType: z.ZodString;
|
|
3311
|
+
isReferenceDesignator: z.ZodOptional<z.ZodBoolean>;
|
|
3303
3312
|
visibility: z.ZodEnum<["0", "1"]>;
|
|
3304
3313
|
mirror: z.ZodString;
|
|
3305
3314
|
id: z.ZodString;
|
|
@@ -3320,6 +3329,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
3320
3329
|
textType: string;
|
|
3321
3330
|
mirror: string;
|
|
3322
3331
|
backgroundColor?: string | undefined;
|
|
3332
|
+
isReferenceDesignator?: boolean | undefined;
|
|
3323
3333
|
}, {
|
|
3324
3334
|
type: "TEXT";
|
|
3325
3335
|
x: number;
|
|
@@ -3337,6 +3347,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
3337
3347
|
fontWeight?: unknown;
|
|
3338
3348
|
fontStyle?: unknown;
|
|
3339
3349
|
fontDecoration?: unknown;
|
|
3350
|
+
isReferenceDesignator?: boolean | undefined;
|
|
3340
3351
|
}>, z.ZodObject<{
|
|
3341
3352
|
type: z.ZodLiteral<"IGNORED">;
|
|
3342
3353
|
sourceType: z.ZodEnum<["AR", "I"]>;
|
|
@@ -3523,6 +3534,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
3523
3534
|
textType: string;
|
|
3524
3535
|
mirror: string;
|
|
3525
3536
|
backgroundColor?: string | undefined;
|
|
3537
|
+
isReferenceDesignator?: boolean | undefined;
|
|
3526
3538
|
})[];
|
|
3527
3539
|
head: {
|
|
3528
3540
|
x: number;
|
|
@@ -3673,6 +3685,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
3673
3685
|
textType: string;
|
|
3674
3686
|
mirror: string;
|
|
3675
3687
|
backgroundColor?: string | undefined;
|
|
3688
|
+
isReferenceDesignator?: boolean | undefined;
|
|
3676
3689
|
})[];
|
|
3677
3690
|
head: {
|
|
3678
3691
|
x: number;
|
|
@@ -4974,6 +4987,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
4974
4987
|
textType: string;
|
|
4975
4988
|
mirror: string;
|
|
4976
4989
|
backgroundColor?: string | undefined;
|
|
4990
|
+
isReferenceDesignator?: boolean | undefined;
|
|
4977
4991
|
})[];
|
|
4978
4992
|
head: {
|
|
4979
4993
|
x: number;
|
|
@@ -5332,11 +5346,13 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
5332
5346
|
type RawEasyEdaJson = z.input<typeof EasyEdaJsonSchema>;
|
|
5333
5347
|
type BetterEasyEdaJson = z.infer<typeof EasyEdaJsonSchema>;
|
|
5334
5348
|
|
|
5335
|
-
declare const convertRawEasyToTsx: ({ rawEasy }: {
|
|
5349
|
+
declare const convertRawEasyToTsx: ({ rawEasy, pinAttributes, }: {
|
|
5336
5350
|
rawEasy: any;
|
|
5351
|
+
pinAttributes?: ChipProps["pinAttributes"];
|
|
5337
5352
|
}) => Promise<string>;
|
|
5338
|
-
declare const convertBetterEasyToTsx: ({ betterEasy, }: {
|
|
5353
|
+
declare const convertBetterEasyToTsx: ({ betterEasy, pinAttributes, }: {
|
|
5339
5354
|
betterEasy: BetterEasyEdaJson;
|
|
5355
|
+
pinAttributes?: ChipProps["pinAttributes"];
|
|
5340
5356
|
}) => Promise<string>;
|
|
5341
5357
|
|
|
5342
5358
|
declare function fetchEasyEDAComponent(jlcpcbPartNumber: string, { fetch, includeModelMetadata, }?: {
|
|
@@ -5358,6 +5374,7 @@ declare const getModelStepCdnUrl: ({ easyedaModelUuid, easyedaPartNumber, }: Par
|
|
|
5358
5374
|
declare const getModelCdnUrl: ({ easyedaModelUuid, easyedaPartNumber, }: Params) => string;
|
|
5359
5375
|
|
|
5360
5376
|
interface Options {
|
|
5377
|
+
pinAttributes?: NonNullable<CommonComponentProps["pinAttributes"]>;
|
|
5361
5378
|
useModelCdn?: boolean;
|
|
5362
5379
|
shouldRecenter?: boolean;
|
|
5363
5380
|
cadPositionXMm?: number;
|
|
@@ -5377,6 +5394,6 @@ interface Options {
|
|
|
5377
5394
|
};
|
|
5378
5395
|
showDesignator?: boolean;
|
|
5379
5396
|
}
|
|
5380
|
-
declare const convertEasyEdaJsonToCircuitJson: (easyEdaJson: BetterEasyEdaJson,
|
|
5397
|
+
declare const convertEasyEdaJsonToCircuitJson: (easyEdaJson: BetterEasyEdaJson, options?: Options) => AnyCircuitElement[];
|
|
5381
5398
|
|
|
5382
5399
|
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 };
|