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/main.cjs CHANGED
@@ -1078,7 +1078,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
1078
1078
  var package_default = {
1079
1079
  name: "easyeda",
1080
1080
  type: "module",
1081
- version: "0.0.375",
1081
+ version: "0.0.377",
1082
1082
  files: [
1083
1083
  "dist"
1084
1084
  ],
@@ -16470,15 +16470,6 @@ var handleHole = (hole, index) => {
16470
16470
  pcb_hole_id: `pcb_hole_${index + 1}`
16471
16471
  });
16472
16472
  };
16473
- var handleHoleCutout = (hole, index) => {
16474
- return pcb_cutout.parse({
16475
- type: "pcb_cutout",
16476
- pcb_cutout_id: `pcb_cutout_from_hole_${index + 1}`,
16477
- shape: "circle",
16478
- center: { x: milx10(hole.center.x), y: milx10(hole.center.y) },
16479
- radius: milx10(hole.radius)
16480
- });
16481
- };
16482
16473
  var handleVia = (via, index) => {
16483
16474
  const holeDiameter = via.holeRadius * 2;
16484
16475
  return pcb_via.parse({
@@ -16693,7 +16684,6 @@ var convertEasyEdaJsonToCircuitJsonWithPinAttributes = (easyEdaJson, {
16693
16684
  (shape) => shape.type === "HOLE"
16694
16685
  ).forEach((h, index) => {
16695
16686
  circuitElements.push(handleHole(h, index));
16696
- circuitElements.push(handleHoleCutout(h, index));
16697
16687
  });
16698
16688
  easyEdaJson.packageDetail.dataStr.shape.filter((shape) => shape.type === "VIA").forEach((v, index) => {
16699
16689
  circuitElements.push(handleVia(v, index));
@@ -18548,7 +18538,8 @@ var generateTypescriptComponent = ({
18548
18538
  componentName,
18549
18539
  objUrl,
18550
18540
  stepUrl,
18551
- circuitJson,
18541
+ circuitJson = [],
18542
+ footprint,
18552
18543
  supplierPartNumbers,
18553
18544
  manufacturerPartNumber,
18554
18545
  componentType = "chip",
@@ -18560,17 +18551,22 @@ var generateTypescriptComponent = ({
18560
18551
  crystalPinVariant,
18561
18552
  symbolTsx,
18562
18553
  schPinArrangement,
18563
- useSymbolPortsOnly = false
18554
+ useSymbolPortsOnly = false,
18555
+ inferPinAttributes: inferPinAttributes2 = true
18564
18556
  }) => {
18565
18557
  const safePinLabels = pinLabels ?? {};
18566
18558
  const polarizedPinMetadata = getPolarizedPinMetadata(safePinLabels);
18567
18559
  const polarizedPortHintsMap = polarizedPinMetadata?.portHintsMap;
18568
18560
  const polarizedPinLabels = polarizedPinMetadata?.pinLabels;
18569
18561
  const cadComponent = circuitJson.find((item) => item.type === "cad_component");
18570
- const footprintTsx = generateFootprintTsx(
18562
+ const footprintTsx = footprint !== void 0 ? JSON.stringify(footprint) : generateFootprintTsx(
18571
18563
  circuitJson,
18572
18564
  componentType === "diode" || componentType === "led" ? { portHintsMap: polarizedPortHintsMap } : void 0
18573
18565
  );
18566
+ const serializedManufacturerPartNumber = JSON.stringify(
18567
+ manufacturerPartNumber
18568
+ );
18569
+ const manufacturerPartNumberTsx = serializedManufacturerPartNumber.slice(1, -1) !== manufacturerPartNumber || manufacturerPartNumber.includes("&") ? `{${serializedManufacturerPartNumber}}` : serializedManufacturerPartNumber;
18574
18570
  const simplifiedPinLabels = Object.fromEntries(
18575
18571
  Object.entries(safePinLabels).map(([pin, labels]) => {
18576
18572
  if (Array.isArray(labels) && labels.length > 1 && labels[0] === pin) {
@@ -18580,7 +18576,7 @@ var generateTypescriptComponent = ({
18580
18576
  })
18581
18577
  );
18582
18578
  const pinLabelsString = Object.entries(simplifiedPinLabels).map(([pin, labels]) => ` ${pin}: ${JSON.stringify(labels)}`).join(",\n");
18583
- const inferredPinAttributes = componentType === "chip" ? inferPinAttributes(simplifiedPinLabels) : {};
18579
+ const inferredPinAttributes = componentType === "chip" && inferPinAttributes2 ? inferPinAttributes(simplifiedPinLabels) : {};
18584
18580
  const resolvedPinAttributes = { ...inferredPinAttributes, ...pinAttributes };
18585
18581
  const pinAttributesString = Object.entries(resolvedPinAttributes).map(([pin, attributes]) => {
18586
18582
  const attributesString = Object.entries(attributes).map(
@@ -18644,7 +18640,7 @@ ${polarizedPinLabelsBlock}${pinAttributesBlock}export const ${componentName} = (
18644
18640
  <diode
18645
18641
  name={name}
18646
18642
  ${polarizedPinLabelsProp}${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18647
- manufacturerPartNumber="${manufacturerPartNumber}"
18643
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18648
18644
  ${pinAttributesProp} footprint={${footprintTsx}}
18649
18645
  ${objUrl || stepUrl ? `cadModel={{
18650
18646
  ${cadModelLines}
@@ -18666,7 +18662,7 @@ ${polarizedPinLabelsBlock}${pinAttributesBlock}export const ${componentName} = (
18666
18662
  <led
18667
18663
  name={name}
18668
18664
  ${polarizedPinLabelsProp}${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18669
- manufacturerPartNumber="${manufacturerPartNumber}"
18665
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18670
18666
  ${pinAttributesProp} footprint={${footprintTsx}}
18671
18667
  ${objUrl || stepUrl ? `cadModel={{
18672
18668
  ${cadModelLines}
@@ -18693,7 +18689,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: PushButtonProps<typ
18693
18689
  name={name}
18694
18690
  pinLabels={pinLabels}
18695
18691
  ${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18696
- manufacturerPartNumber="${manufacturerPartNumber}"
18692
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18697
18693
  ${pinAttributesProp} footprint={${footprintTsx}}
18698
18694
  ${objUrl || stepUrl ? `cadModel={{
18699
18695
  ${cadModelLines}
@@ -18720,7 +18716,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: SwitchProps) => {
18720
18716
  name={name}
18721
18717
  pinLabels={pinLabels}
18722
18718
  ${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18723
- manufacturerPartNumber="${manufacturerPartNumber}"
18719
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18724
18720
  ${pinAttributesProp} footprint={${footprintTsx}}
18725
18721
  ${objUrl || stepUrl ? `cadModel={{
18726
18722
  ${cadModelLines}
@@ -18746,7 +18742,7 @@ ${capacitorPolarizedPinLabelsBlock}${pinAttributesBlock}export const ${component
18746
18742
  name={name}
18747
18743
  capacitance=${JSON.stringify(capacitance2)}
18748
18744
  ${capacitorPolarizedPinLabelsProp}${polarizedProp}${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18749
- manufacturerPartNumber="${manufacturerPartNumber}"
18745
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18750
18746
  ${pinAttributesProp} footprint={${footprintTsx}}
18751
18747
  ${objUrl || stepUrl ? `cadModel={{
18752
18748
  ${cadModelLines}
@@ -18772,7 +18768,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: Omit<ResistorProps,
18772
18768
  name={name}
18773
18769
  resistance=${JSON.stringify(resistance2)}
18774
18770
  ${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18775
- manufacturerPartNumber="${manufacturerPartNumber}"
18771
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18776
18772
  ${pinAttributesProp} footprint={${footprintTsx}}
18777
18773
  ${objUrl || stepUrl ? `cadModel={{
18778
18774
  ${cadModelLines}
@@ -18795,7 +18791,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: Omit<InductorProps,
18795
18791
  <inductor
18796
18792
  inductance=${JSON.stringify(inductance2)}
18797
18793
  supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18798
- manufacturerPartNumber="${manufacturerPartNumber}"
18794
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18799
18795
  ${pinAttributesProp} footprint={${footprintTsx}}
18800
18796
  ${objUrl || stepUrl ? `cadModel={{
18801
18797
  ${cadModelLines}
@@ -18824,7 +18820,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: ImportedCrystalProp
18824
18820
  frequency=${JSON.stringify(crystalFrequency)}
18825
18821
  pinVariant=${JSON.stringify(crystalPinVariant)}
18826
18822
  supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18827
- manufacturerPartNumber="${manufacturerPartNumber}"
18823
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18828
18824
  ${pinAttributesProp} footprint={${footprintTsx}}
18829
18825
  ${objUrl || stepUrl ? `cadModel={{
18830
18826
  ${cadModelLines}
@@ -18848,7 +18844,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: ConnectorProps) =>
18848
18844
  <connector
18849
18845
  pinLabels={pinLabels}
18850
18846
  supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18851
- manufacturerPartNumber="${manufacturerPartNumber}"
18847
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18852
18848
  ${pinAttributesProp} footprint={${footprintTsx}}
18853
18849
  ${objUrl || stepUrl ? `cadModel={{
18854
18850
  ${cadModelLines}
@@ -18870,7 +18866,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: ChipProps<typeof pi
18870
18866
  return (
18871
18867
  <chip
18872
18868
  ${useSymbolPortsOnly ? "" : " pinLabels={pinLabels}\n"}${pinAttributesProp}${symbolProp}${schPinArrangementProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18873
- manufacturerPartNumber="${manufacturerPartNumber}"
18869
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18874
18870
  footprint={${footprintTsx}}
18875
18871
  ${objUrl || stepUrl ? `cadModel={{
18876
18872
  ${cadModelLines}