easyeda 0.0.376 → 0.0.378
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 +21 -24
- package/dist/browser/index.js.map +1 -1
- package/dist/index.d.ts +31 -2
- package/dist/index.js +21 -24
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +21 -25
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommonComponentProps, ChipProps } from '@tscircuit/props';
|
|
1
|
+
import { CommonComponentProps, ChipProps, SupplierPartNumbers } from '@tscircuit/props';
|
|
2
2
|
import { AnyCircuitElement } from 'circuit-json';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
@@ -5379,6 +5379,35 @@ declare const convertRawEasyToTsx: ({ rawEasy, pinAttributes, }: {
|
|
|
5379
5379
|
pinAttributes?: ChipProps["pinAttributes"];
|
|
5380
5380
|
}) => Promise<string>;
|
|
5381
5381
|
|
|
5382
|
+
type GeneratedComponentType = "chip" | "diode" | "led" | "pushbutton" | "switch" | "capacitor" | "resistor" | "inductor" | "crystal" | "connector";
|
|
5383
|
+
type GenerateTypescriptComponentParams = {
|
|
5384
|
+
pinLabels: ChipProps["pinLabels"];
|
|
5385
|
+
pinAttributes?: ChipProps["pinAttributes"];
|
|
5386
|
+
componentName: string;
|
|
5387
|
+
objUrl?: string;
|
|
5388
|
+
stepUrl?: string;
|
|
5389
|
+
supplierPartNumbers: SupplierPartNumbers;
|
|
5390
|
+
manufacturerPartNumber: string;
|
|
5391
|
+
componentType?: GeneratedComponentType;
|
|
5392
|
+
isPolarizedCapacitor?: boolean;
|
|
5393
|
+
capacitance?: string;
|
|
5394
|
+
resistance?: string;
|
|
5395
|
+
inductance?: string;
|
|
5396
|
+
crystalFrequency?: string;
|
|
5397
|
+
crystalPinVariant?: "two_pin" | "four_pin";
|
|
5398
|
+
symbolTsx?: string;
|
|
5399
|
+
schPinArrangement?: ChipProps["schPinArrangement"];
|
|
5400
|
+
useSymbolPortsOnly?: boolean;
|
|
5401
|
+
inferPinAttributes?: boolean;
|
|
5402
|
+
} & ({
|
|
5403
|
+
circuitJson: AnyCircuitElement[];
|
|
5404
|
+
footprint?: string;
|
|
5405
|
+
} | {
|
|
5406
|
+
footprint: string;
|
|
5407
|
+
circuitJson?: AnyCircuitElement[];
|
|
5408
|
+
});
|
|
5409
|
+
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;
|
|
5410
|
+
|
|
5382
5411
|
declare function normalizeManufacturerPartNumber(partNumber: string): string;
|
|
5383
5412
|
|
|
5384
5413
|
declare const normalizePinLabels: (inputPinLabels: string[][]) => string[][];
|
|
@@ -5389,4 +5418,4 @@ declare const convertEasyEdaJsonToVariousFormats: ({ jlcpcbPartNumberOrFilepath,
|
|
|
5389
5418
|
outputFormat: string;
|
|
5390
5419
|
}) => Promise<void>;
|
|
5391
5420
|
|
|
5392
|
-
export { BBoxSchema, type BetterEasyEdaJson, DataStrSchema, EasyEdaJsonSchema, HeadSchema, LayerItemSchema, LcscSchema, ModelBoundsSchema, ObjectItemSchema, OwnerSchema, PackageDetailDataStrSchema, PackageDetailSchema, type RawEasyEdaJson, SzlcscSchema, convertEasyEdaJsonToCircuitJson, convertEasyEdaJsonToVariousFormats, convertRawEasyToTsx as convertRawEasyEdaToTs, fetchEasyEDAComponent, maybeNumber, normalizeManufacturerPartNumber, normalizePinLabels };
|
|
5421
|
+
export { BBoxSchema, type BetterEasyEdaJson, DataStrSchema, EasyEdaJsonSchema, type GenerateTypescriptComponentParams, type GeneratedComponentType, HeadSchema, LayerItemSchema, LcscSchema, ModelBoundsSchema, ObjectItemSchema, OwnerSchema, PackageDetailDataStrSchema, PackageDetailSchema, type RawEasyEdaJson, SzlcscSchema, convertEasyEdaJsonToCircuitJson, convertEasyEdaJsonToVariousFormats, convertRawEasyToTsx as convertRawEasyEdaToTs, fetchEasyEDAComponent, generateTypescriptComponent, maybeNumber, normalizeManufacturerPartNumber, normalizePinLabels };
|
package/dist/index.js
CHANGED
|
@@ -15333,15 +15333,6 @@ var handleHole = (hole, index) => {
|
|
|
15333
15333
|
pcb_hole_id: `pcb_hole_${index + 1}`
|
|
15334
15334
|
});
|
|
15335
15335
|
};
|
|
15336
|
-
var handleHoleCutout = (hole, index) => {
|
|
15337
|
-
return pcb_cutout.parse({
|
|
15338
|
-
type: "pcb_cutout",
|
|
15339
|
-
pcb_cutout_id: `pcb_cutout_from_hole_${index + 1}`,
|
|
15340
|
-
shape: "circle",
|
|
15341
|
-
center: { x: milx10(hole.center.x), y: milx10(hole.center.y) },
|
|
15342
|
-
radius: milx10(hole.radius)
|
|
15343
|
-
});
|
|
15344
|
-
};
|
|
15345
15336
|
var handleVia = (via, index) => {
|
|
15346
15337
|
const holeDiameter = via.holeRadius * 2;
|
|
15347
15338
|
return pcb_via.parse({
|
|
@@ -15556,7 +15547,6 @@ var convertEasyEdaJsonToCircuitJsonWithPinAttributes = (easyEdaJson, {
|
|
|
15556
15547
|
(shape) => shape.type === "HOLE"
|
|
15557
15548
|
).forEach((h, index) => {
|
|
15558
15549
|
circuitElements.push(handleHole(h, index));
|
|
15559
|
-
circuitElements.push(handleHoleCutout(h, index));
|
|
15560
15550
|
});
|
|
15561
15551
|
easyEdaJson.packageDetail.dataStr.shape.filter((shape) => shape.type === "VIA").forEach((v, index) => {
|
|
15562
15552
|
circuitElements.push(handleVia(v, index));
|
|
@@ -17637,7 +17627,8 @@ var generateTypescriptComponent = ({
|
|
|
17637
17627
|
componentName,
|
|
17638
17628
|
objUrl,
|
|
17639
17629
|
stepUrl,
|
|
17640
|
-
circuitJson,
|
|
17630
|
+
circuitJson = [],
|
|
17631
|
+
footprint,
|
|
17641
17632
|
supplierPartNumbers,
|
|
17642
17633
|
manufacturerPartNumber,
|
|
17643
17634
|
componentType = "chip",
|
|
@@ -17649,17 +17640,22 @@ var generateTypescriptComponent = ({
|
|
|
17649
17640
|
crystalPinVariant,
|
|
17650
17641
|
symbolTsx,
|
|
17651
17642
|
schPinArrangement,
|
|
17652
|
-
useSymbolPortsOnly = false
|
|
17643
|
+
useSymbolPortsOnly = false,
|
|
17644
|
+
inferPinAttributes: inferPinAttributes2 = true
|
|
17653
17645
|
}) => {
|
|
17654
17646
|
const safePinLabels = pinLabels ?? {};
|
|
17655
17647
|
const polarizedPinMetadata = getPolarizedPinMetadata(safePinLabels);
|
|
17656
17648
|
const polarizedPortHintsMap = polarizedPinMetadata?.portHintsMap;
|
|
17657
17649
|
const polarizedPinLabels = polarizedPinMetadata?.pinLabels;
|
|
17658
17650
|
const cadComponent = circuitJson.find((item) => item.type === "cad_component");
|
|
17659
|
-
const footprintTsx = generateFootprintTsx(
|
|
17651
|
+
const footprintTsx = footprint !== void 0 ? JSON.stringify(footprint) : generateFootprintTsx(
|
|
17660
17652
|
circuitJson,
|
|
17661
17653
|
componentType === "diode" || componentType === "led" ? { portHintsMap: polarizedPortHintsMap } : void 0
|
|
17662
17654
|
);
|
|
17655
|
+
const serializedManufacturerPartNumber = JSON.stringify(
|
|
17656
|
+
manufacturerPartNumber
|
|
17657
|
+
);
|
|
17658
|
+
const manufacturerPartNumberTsx = serializedManufacturerPartNumber.slice(1, -1) !== manufacturerPartNumber || manufacturerPartNumber.includes("&") ? `{${serializedManufacturerPartNumber}}` : serializedManufacturerPartNumber;
|
|
17663
17659
|
const simplifiedPinLabels = Object.fromEntries(
|
|
17664
17660
|
Object.entries(safePinLabels).map(([pin, labels]) => {
|
|
17665
17661
|
if (Array.isArray(labels) && labels.length > 1 && labels[0] === pin) {
|
|
@@ -17669,7 +17665,7 @@ var generateTypescriptComponent = ({
|
|
|
17669
17665
|
})
|
|
17670
17666
|
);
|
|
17671
17667
|
const pinLabelsString = Object.entries(simplifiedPinLabels).map(([pin, labels]) => ` ${pin}: ${JSON.stringify(labels)}`).join(",\n");
|
|
17672
|
-
const inferredPinAttributes = componentType === "chip" ? inferPinAttributes(simplifiedPinLabels) : {};
|
|
17668
|
+
const inferredPinAttributes = componentType === "chip" && inferPinAttributes2 ? inferPinAttributes(simplifiedPinLabels) : {};
|
|
17673
17669
|
const resolvedPinAttributes = { ...inferredPinAttributes, ...pinAttributes };
|
|
17674
17670
|
const pinAttributesString = Object.entries(resolvedPinAttributes).map(([pin, attributes]) => {
|
|
17675
17671
|
const attributesString = Object.entries(attributes).map(
|
|
@@ -17733,7 +17729,7 @@ ${polarizedPinLabelsBlock}${pinAttributesBlock}export const ${componentName} = (
|
|
|
17733
17729
|
<diode
|
|
17734
17730
|
name={name}
|
|
17735
17731
|
${polarizedPinLabelsProp}${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
17736
|
-
manufacturerPartNumber
|
|
17732
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
17737
17733
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
17738
17734
|
${objUrl || stepUrl ? `cadModel={{
|
|
17739
17735
|
${cadModelLines}
|
|
@@ -17755,7 +17751,7 @@ ${polarizedPinLabelsBlock}${pinAttributesBlock}export const ${componentName} = (
|
|
|
17755
17751
|
<led
|
|
17756
17752
|
name={name}
|
|
17757
17753
|
${polarizedPinLabelsProp}${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
17758
|
-
manufacturerPartNumber
|
|
17754
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
17759
17755
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
17760
17756
|
${objUrl || stepUrl ? `cadModel={{
|
|
17761
17757
|
${cadModelLines}
|
|
@@ -17782,7 +17778,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: PushButtonProps<typ
|
|
|
17782
17778
|
name={name}
|
|
17783
17779
|
pinLabels={pinLabels}
|
|
17784
17780
|
${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
17785
|
-
manufacturerPartNumber
|
|
17781
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
17786
17782
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
17787
17783
|
${objUrl || stepUrl ? `cadModel={{
|
|
17788
17784
|
${cadModelLines}
|
|
@@ -17809,7 +17805,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: SwitchProps) => {
|
|
|
17809
17805
|
name={name}
|
|
17810
17806
|
pinLabels={pinLabels}
|
|
17811
17807
|
${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
17812
|
-
manufacturerPartNumber
|
|
17808
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
17813
17809
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
17814
17810
|
${objUrl || stepUrl ? `cadModel={{
|
|
17815
17811
|
${cadModelLines}
|
|
@@ -17835,7 +17831,7 @@ ${capacitorPolarizedPinLabelsBlock}${pinAttributesBlock}export const ${component
|
|
|
17835
17831
|
name={name}
|
|
17836
17832
|
capacitance=${JSON.stringify(capacitance2)}
|
|
17837
17833
|
${capacitorPolarizedPinLabelsProp}${polarizedProp}${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
17838
|
-
manufacturerPartNumber
|
|
17834
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
17839
17835
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
17840
17836
|
${objUrl || stepUrl ? `cadModel={{
|
|
17841
17837
|
${cadModelLines}
|
|
@@ -17861,7 +17857,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: Omit<ResistorProps,
|
|
|
17861
17857
|
name={name}
|
|
17862
17858
|
resistance=${JSON.stringify(resistance2)}
|
|
17863
17859
|
${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
17864
|
-
manufacturerPartNumber
|
|
17860
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
17865
17861
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
17866
17862
|
${objUrl || stepUrl ? `cadModel={{
|
|
17867
17863
|
${cadModelLines}
|
|
@@ -17884,7 +17880,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: Omit<InductorProps,
|
|
|
17884
17880
|
<inductor
|
|
17885
17881
|
inductance=${JSON.stringify(inductance2)}
|
|
17886
17882
|
supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
17887
|
-
manufacturerPartNumber
|
|
17883
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
17888
17884
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
17889
17885
|
${objUrl || stepUrl ? `cadModel={{
|
|
17890
17886
|
${cadModelLines}
|
|
@@ -17913,7 +17909,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: ImportedCrystalProp
|
|
|
17913
17909
|
frequency=${JSON.stringify(crystalFrequency)}
|
|
17914
17910
|
pinVariant=${JSON.stringify(crystalPinVariant)}
|
|
17915
17911
|
supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
17916
|
-
manufacturerPartNumber
|
|
17912
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
17917
17913
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
17918
17914
|
${objUrl || stepUrl ? `cadModel={{
|
|
17919
17915
|
${cadModelLines}
|
|
@@ -17937,7 +17933,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: ConnectorProps) =>
|
|
|
17937
17933
|
<connector
|
|
17938
17934
|
pinLabels={pinLabels}
|
|
17939
17935
|
supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
17940
|
-
manufacturerPartNumber
|
|
17936
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
17941
17937
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
17942
17938
|
${objUrl || stepUrl ? `cadModel={{
|
|
17943
17939
|
${cadModelLines}
|
|
@@ -17959,7 +17955,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: ChipProps<typeof pi
|
|
|
17959
17955
|
return (
|
|
17960
17956
|
<chip
|
|
17961
17957
|
${useSymbolPortsOnly ? "" : " pinLabels={pinLabels}\n"}${pinAttributesProp}${symbolProp}${schPinArrangementProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
17962
|
-
manufacturerPartNumber
|
|
17958
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
17963
17959
|
footprint={${footprintTsx}}
|
|
17964
17960
|
${objUrl || stepUrl ? `cadModel={{
|
|
17965
17961
|
${cadModelLines}
|
|
@@ -18401,6 +18397,7 @@ export {
|
|
|
18401
18397
|
convertEasyEdaJsonToVariousFormats,
|
|
18402
18398
|
convertRawEasyToTsx as convertRawEasyEdaToTs,
|
|
18403
18399
|
fetchEasyEDAComponent,
|
|
18400
|
+
generateTypescriptComponent,
|
|
18404
18401
|
maybeNumber,
|
|
18405
18402
|
normalizeManufacturerPartNumber,
|
|
18406
18403
|
normalizePinLabels
|