easyeda 0.0.368 → 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 +29 -0
- package/dist/browser/index.d.ts +7 -3
- package/dist/browser/index.js +8326 -523
- package/dist/browser/index.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +12360 -4541
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +13008 -5189
- 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
|
|
|
@@ -5332,11 +5333,13 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
|
|
|
5332
5333
|
type RawEasyEdaJson = z.input<typeof EasyEdaJsonSchema>;
|
|
5333
5334
|
type BetterEasyEdaJson = z.infer<typeof EasyEdaJsonSchema>;
|
|
5334
5335
|
|
|
5335
|
-
declare const convertRawEasyToTsx: ({ rawEasy }: {
|
|
5336
|
+
declare const convertRawEasyToTsx: ({ rawEasy, pinAttributes, }: {
|
|
5336
5337
|
rawEasy: any;
|
|
5338
|
+
pinAttributes?: ChipProps["pinAttributes"];
|
|
5337
5339
|
}) => Promise<string>;
|
|
5338
|
-
declare const convertBetterEasyToTsx: ({ betterEasy, }: {
|
|
5340
|
+
declare const convertBetterEasyToTsx: ({ betterEasy, pinAttributes, }: {
|
|
5339
5341
|
betterEasy: BetterEasyEdaJson;
|
|
5342
|
+
pinAttributes?: ChipProps["pinAttributes"];
|
|
5340
5343
|
}) => Promise<string>;
|
|
5341
5344
|
|
|
5342
5345
|
declare function fetchEasyEDAComponent(jlcpcbPartNumber: string, { fetch, includeModelMetadata, }?: {
|
|
@@ -5358,6 +5361,7 @@ declare const getModelStepCdnUrl: ({ easyedaModelUuid, easyedaPartNumber, }: Par
|
|
|
5358
5361
|
declare const getModelCdnUrl: ({ easyedaModelUuid, easyedaPartNumber, }: Params) => string;
|
|
5359
5362
|
|
|
5360
5363
|
interface Options {
|
|
5364
|
+
pinAttributes?: NonNullable<CommonComponentProps["pinAttributes"]>;
|
|
5361
5365
|
useModelCdn?: boolean;
|
|
5362
5366
|
shouldRecenter?: boolean;
|
|
5363
5367
|
cadPositionXMm?: number;
|
|
@@ -5377,6 +5381,6 @@ interface Options {
|
|
|
5377
5381
|
};
|
|
5378
5382
|
showDesignator?: boolean;
|
|
5379
5383
|
}
|
|
5380
|
-
declare const convertEasyEdaJsonToCircuitJson: (easyEdaJson: BetterEasyEdaJson,
|
|
5384
|
+
declare const convertEasyEdaJsonToCircuitJson: (easyEdaJson: BetterEasyEdaJson, options?: Options) => AnyCircuitElement[];
|
|
5381
5385
|
|
|
5382
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 };
|