easyeda 0.0.375 → 0.0.377
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 +31 -2
- package/dist/browser/index.js +22 -15
- package/dist/browser/index.js.map +1 -1
- package/dist/index.d.ts +31 -2
- package/dist/index.js +22 -15
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +22 -16
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChipProps, CommonComponentProps } from '@tscircuit/props';
|
|
1
|
+
import { ChipProps, SupplierPartNumbers, CommonComponentProps } from '@tscircuit/props';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { AnyCircuitElement } from 'circuit-json';
|
|
4
4
|
|
|
@@ -5355,6 +5355,35 @@ declare const convertBetterEasyToTsx: ({ betterEasy, pinAttributes, }: {
|
|
|
5355
5355
|
pinAttributes?: ChipProps["pinAttributes"];
|
|
5356
5356
|
}) => Promise<string>;
|
|
5357
5357
|
|
|
5358
|
+
type GeneratedComponentType = "chip" | "diode" | "led" | "pushbutton" | "switch" | "capacitor" | "resistor" | "inductor" | "crystal" | "connector";
|
|
5359
|
+
type GenerateTypescriptComponentParams = {
|
|
5360
|
+
pinLabels: ChipProps["pinLabels"];
|
|
5361
|
+
pinAttributes?: ChipProps["pinAttributes"];
|
|
5362
|
+
componentName: string;
|
|
5363
|
+
objUrl?: string;
|
|
5364
|
+
stepUrl?: string;
|
|
5365
|
+
supplierPartNumbers: SupplierPartNumbers;
|
|
5366
|
+
manufacturerPartNumber: string;
|
|
5367
|
+
componentType?: GeneratedComponentType;
|
|
5368
|
+
isPolarizedCapacitor?: boolean;
|
|
5369
|
+
capacitance?: string;
|
|
5370
|
+
resistance?: string;
|
|
5371
|
+
inductance?: string;
|
|
5372
|
+
crystalFrequency?: string;
|
|
5373
|
+
crystalPinVariant?: "two_pin" | "four_pin";
|
|
5374
|
+
symbolTsx?: string;
|
|
5375
|
+
schPinArrangement?: ChipProps["schPinArrangement"];
|
|
5376
|
+
useSymbolPortsOnly?: boolean;
|
|
5377
|
+
inferPinAttributes?: boolean;
|
|
5378
|
+
} & ({
|
|
5379
|
+
circuitJson: AnyCircuitElement[];
|
|
5380
|
+
footprint?: string;
|
|
5381
|
+
} | {
|
|
5382
|
+
footprint: string;
|
|
5383
|
+
circuitJson?: AnyCircuitElement[];
|
|
5384
|
+
});
|
|
5385
|
+
declare const generateTypescriptComponent: ({ pinLabels, pinAttributes, componentName, objUrl, stepUrl, circuitJson, footprint, supplierPartNumbers, manufacturerPartNumber, componentType, isPolarizedCapacitor, capacitance, resistance, inductance, crystalFrequency, crystalPinVariant, symbolTsx, schPinArrangement, useSymbolPortsOnly, inferPinAttributes, }: GenerateTypescriptComponentParams) => string;
|
|
5386
|
+
|
|
5358
5387
|
declare function fetchEasyEDAComponent(jlcpcbPartNumber: string, { fetch, includeModelMetadata, }?: {
|
|
5359
5388
|
fetch?: typeof globalThis.fetch;
|
|
5360
5389
|
includeModelMetadata?: boolean;
|
|
@@ -5396,4 +5425,4 @@ interface Options {
|
|
|
5396
5425
|
}
|
|
5397
5426
|
declare const convertEasyEdaJsonToCircuitJson: (easyEdaJson: BetterEasyEdaJson, options?: Options) => AnyCircuitElement[];
|
|
5398
5427
|
|
|
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 };
|
|
5428
|
+
export { BBoxSchema, type BetterEasyEdaJson, DataStrSchema, EasyEdaJsonSchema, type GenerateTypescriptComponentParams, type GeneratedComponentType, HeadSchema, LayerItemSchema, LcscSchema, ModelBoundsSchema, ObjectItemSchema, OwnerSchema, PackageDetailDataStrSchema, PackageDetailSchema, type RawEasyEdaJson, SzlcscSchema, convertBetterEasyToTsx, convertEasyEdaJsonToCircuitJson, convertRawEasyToTsx, fetchEasyEDAComponent, generateFootprintTsx, generateTypescriptComponent, getModelCdnUrl, getModelObjCdnUrl, getModelStepCdnUrl, maybeNumber };
|
package/dist/browser/index.js
CHANGED
|
@@ -21205,7 +21205,7 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
|
|
|
21205
21205
|
};
|
|
21206
21206
|
|
|
21207
21207
|
// lib/websafe/convert-to-typescript-component/infer-pin-attributes.ts
|
|
21208
|
-
var POWER_PIN_LABEL = /^(?:VCC|
|
|
21208
|
+
var POWER_PIN_LABEL = /^(?:VCC|VIN|VBUS|VDDA)\d*$|^VDD$/;
|
|
21209
21209
|
var GROUND_PIN_LABEL = /^(?:GND|VSS|PGND|AGND)\d*$/;
|
|
21210
21210
|
var NO_CONNECT_PIN_LABEL = /^NC\d*$/;
|
|
21211
21211
|
var getAttributeKind = (label) => {
|
|
@@ -21242,7 +21242,8 @@ var generateTypescriptComponent = ({
|
|
|
21242
21242
|
componentName,
|
|
21243
21243
|
objUrl,
|
|
21244
21244
|
stepUrl,
|
|
21245
|
-
circuitJson,
|
|
21245
|
+
circuitJson = [],
|
|
21246
|
+
footprint,
|
|
21246
21247
|
supplierPartNumbers,
|
|
21247
21248
|
manufacturerPartNumber,
|
|
21248
21249
|
componentType = "chip",
|
|
@@ -21254,17 +21255,22 @@ var generateTypescriptComponent = ({
|
|
|
21254
21255
|
crystalPinVariant,
|
|
21255
21256
|
symbolTsx,
|
|
21256
21257
|
schPinArrangement,
|
|
21257
|
-
useSymbolPortsOnly = false
|
|
21258
|
+
useSymbolPortsOnly = false,
|
|
21259
|
+
inferPinAttributes: inferPinAttributes2 = true
|
|
21258
21260
|
}) => {
|
|
21259
21261
|
const safePinLabels = pinLabels ?? {};
|
|
21260
21262
|
const polarizedPinMetadata = getPolarizedPinMetadata(safePinLabels);
|
|
21261
21263
|
const polarizedPortHintsMap = polarizedPinMetadata?.portHintsMap;
|
|
21262
21264
|
const polarizedPinLabels = polarizedPinMetadata?.pinLabels;
|
|
21263
21265
|
const cadComponent = circuitJson.find((item) => item.type === "cad_component");
|
|
21264
|
-
const footprintTsx = generateFootprintTsx(
|
|
21266
|
+
const footprintTsx = footprint !== void 0 ? JSON.stringify(footprint) : generateFootprintTsx(
|
|
21265
21267
|
circuitJson,
|
|
21266
21268
|
componentType === "diode" || componentType === "led" ? { portHintsMap: polarizedPortHintsMap } : void 0
|
|
21267
21269
|
);
|
|
21270
|
+
const serializedManufacturerPartNumber = JSON.stringify(
|
|
21271
|
+
manufacturerPartNumber
|
|
21272
|
+
);
|
|
21273
|
+
const manufacturerPartNumberTsx = serializedManufacturerPartNumber.slice(1, -1) !== manufacturerPartNumber || manufacturerPartNumber.includes("&") ? `{${serializedManufacturerPartNumber}}` : serializedManufacturerPartNumber;
|
|
21268
21274
|
const simplifiedPinLabels = Object.fromEntries(
|
|
21269
21275
|
Object.entries(safePinLabels).map(([pin, labels]) => {
|
|
21270
21276
|
if (Array.isArray(labels) && labels.length > 1 && labels[0] === pin) {
|
|
@@ -21274,7 +21280,7 @@ var generateTypescriptComponent = ({
|
|
|
21274
21280
|
})
|
|
21275
21281
|
);
|
|
21276
21282
|
const pinLabelsString = Object.entries(simplifiedPinLabels).map(([pin, labels]) => ` ${pin}: ${JSON.stringify(labels)}`).join(",\n");
|
|
21277
|
-
const inferredPinAttributes = componentType === "chip" ? inferPinAttributes(simplifiedPinLabels) : {};
|
|
21283
|
+
const inferredPinAttributes = componentType === "chip" && inferPinAttributes2 ? inferPinAttributes(simplifiedPinLabels) : {};
|
|
21278
21284
|
const resolvedPinAttributes = { ...inferredPinAttributes, ...pinAttributes };
|
|
21279
21285
|
const pinAttributesString = Object.entries(resolvedPinAttributes).map(([pin, attributes]) => {
|
|
21280
21286
|
const attributesString = Object.entries(attributes).map(
|
|
@@ -21338,7 +21344,7 @@ ${polarizedPinLabelsBlock}${pinAttributesBlock}export const ${componentName} = (
|
|
|
21338
21344
|
<diode
|
|
21339
21345
|
name={name}
|
|
21340
21346
|
${polarizedPinLabelsProp}${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21341
|
-
manufacturerPartNumber
|
|
21347
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21342
21348
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21343
21349
|
${objUrl || stepUrl ? `cadModel={{
|
|
21344
21350
|
${cadModelLines}
|
|
@@ -21360,7 +21366,7 @@ ${polarizedPinLabelsBlock}${pinAttributesBlock}export const ${componentName} = (
|
|
|
21360
21366
|
<led
|
|
21361
21367
|
name={name}
|
|
21362
21368
|
${polarizedPinLabelsProp}${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21363
|
-
manufacturerPartNumber
|
|
21369
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21364
21370
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21365
21371
|
${objUrl || stepUrl ? `cadModel={{
|
|
21366
21372
|
${cadModelLines}
|
|
@@ -21387,7 +21393,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: PushButtonProps<typ
|
|
|
21387
21393
|
name={name}
|
|
21388
21394
|
pinLabels={pinLabels}
|
|
21389
21395
|
${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21390
|
-
manufacturerPartNumber
|
|
21396
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21391
21397
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21392
21398
|
${objUrl || stepUrl ? `cadModel={{
|
|
21393
21399
|
${cadModelLines}
|
|
@@ -21414,7 +21420,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: SwitchProps) => {
|
|
|
21414
21420
|
name={name}
|
|
21415
21421
|
pinLabels={pinLabels}
|
|
21416
21422
|
${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21417
|
-
manufacturerPartNumber
|
|
21423
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21418
21424
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21419
21425
|
${objUrl || stepUrl ? `cadModel={{
|
|
21420
21426
|
${cadModelLines}
|
|
@@ -21440,7 +21446,7 @@ ${capacitorPolarizedPinLabelsBlock}${pinAttributesBlock}export const ${component
|
|
|
21440
21446
|
name={name}
|
|
21441
21447
|
capacitance=${JSON.stringify(capacitance2)}
|
|
21442
21448
|
${capacitorPolarizedPinLabelsProp}${polarizedProp}${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21443
|
-
manufacturerPartNumber
|
|
21449
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21444
21450
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21445
21451
|
${objUrl || stepUrl ? `cadModel={{
|
|
21446
21452
|
${cadModelLines}
|
|
@@ -21466,7 +21472,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: Omit<ResistorProps,
|
|
|
21466
21472
|
name={name}
|
|
21467
21473
|
resistance=${JSON.stringify(resistance2)}
|
|
21468
21474
|
${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21469
|
-
manufacturerPartNumber
|
|
21475
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21470
21476
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21471
21477
|
${objUrl || stepUrl ? `cadModel={{
|
|
21472
21478
|
${cadModelLines}
|
|
@@ -21489,7 +21495,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: Omit<InductorProps,
|
|
|
21489
21495
|
<inductor
|
|
21490
21496
|
inductance=${JSON.stringify(inductance2)}
|
|
21491
21497
|
supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21492
|
-
manufacturerPartNumber
|
|
21498
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21493
21499
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21494
21500
|
${objUrl || stepUrl ? `cadModel={{
|
|
21495
21501
|
${cadModelLines}
|
|
@@ -21518,7 +21524,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: ImportedCrystalProp
|
|
|
21518
21524
|
frequency=${JSON.stringify(crystalFrequency)}
|
|
21519
21525
|
pinVariant=${JSON.stringify(crystalPinVariant)}
|
|
21520
21526
|
supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21521
|
-
manufacturerPartNumber
|
|
21527
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21522
21528
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21523
21529
|
${objUrl || stepUrl ? `cadModel={{
|
|
21524
21530
|
${cadModelLines}
|
|
@@ -21542,7 +21548,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: ConnectorProps) =>
|
|
|
21542
21548
|
<connector
|
|
21543
21549
|
pinLabels={pinLabels}
|
|
21544
21550
|
supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21545
|
-
manufacturerPartNumber
|
|
21551
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21546
21552
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21547
21553
|
${objUrl || stepUrl ? `cadModel={{
|
|
21548
21554
|
${cadModelLines}
|
|
@@ -21564,7 +21570,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: ChipProps<typeof pi
|
|
|
21564
21570
|
return (
|
|
21565
21571
|
<chip
|
|
21566
21572
|
${useSymbolPortsOnly ? "" : " pinLabels={pinLabels}\n"}${pinAttributesProp}${symbolProp}${schPinArrangementProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21567
|
-
manufacturerPartNumber
|
|
21573
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21568
21574
|
footprint={${footprintTsx}}
|
|
21569
21575
|
${objUrl || stepUrl ? `cadModel={{
|
|
21570
21576
|
${cadModelLines}
|
|
@@ -22146,6 +22152,7 @@ export {
|
|
|
22146
22152
|
convertRawEasyToTsx,
|
|
22147
22153
|
fetchEasyEDAComponent,
|
|
22148
22154
|
generateFootprintTsx,
|
|
22155
|
+
generateTypescriptComponent,
|
|
22149
22156
|
getModelCdnUrl,
|
|
22150
22157
|
getModelObjCdnUrl,
|
|
22151
22158
|
getModelStepCdnUrl,
|