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/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.374",
1081
+ version: "0.0.376",
1082
1082
  files: [
1083
1083
  "dist"
1084
1084
  ],
@@ -18511,7 +18511,7 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
18511
18511
  };
18512
18512
 
18513
18513
  // lib/websafe/convert-to-typescript-component/infer-pin-attributes.ts
18514
- var POWER_PIN_LABEL = /^(?:VCC|VDD|VIN|VDDA|VBUS)\d*$/;
18514
+ var POWER_PIN_LABEL = /^(?:VCC|VIN|VBUS|VDDA)\d*$|^VDD$/;
18515
18515
  var GROUND_PIN_LABEL = /^(?:GND|VSS|PGND|AGND)\d*$/;
18516
18516
  var NO_CONNECT_PIN_LABEL = /^NC\d*$/;
18517
18517
  var getAttributeKind = (label) => {
@@ -18548,7 +18548,8 @@ var generateTypescriptComponent = ({
18548
18548
  componentName,
18549
18549
  objUrl,
18550
18550
  stepUrl,
18551
- circuitJson,
18551
+ circuitJson = [],
18552
+ footprint,
18552
18553
  supplierPartNumbers,
18553
18554
  manufacturerPartNumber,
18554
18555
  componentType = "chip",
@@ -18560,17 +18561,22 @@ var generateTypescriptComponent = ({
18560
18561
  crystalPinVariant,
18561
18562
  symbolTsx,
18562
18563
  schPinArrangement,
18563
- useSymbolPortsOnly = false
18564
+ useSymbolPortsOnly = false,
18565
+ inferPinAttributes: inferPinAttributes2 = true
18564
18566
  }) => {
18565
18567
  const safePinLabels = pinLabels ?? {};
18566
18568
  const polarizedPinMetadata = getPolarizedPinMetadata(safePinLabels);
18567
18569
  const polarizedPortHintsMap = polarizedPinMetadata?.portHintsMap;
18568
18570
  const polarizedPinLabels = polarizedPinMetadata?.pinLabels;
18569
18571
  const cadComponent = circuitJson.find((item) => item.type === "cad_component");
18570
- const footprintTsx = generateFootprintTsx(
18572
+ const footprintTsx = footprint !== void 0 ? JSON.stringify(footprint) : generateFootprintTsx(
18571
18573
  circuitJson,
18572
18574
  componentType === "diode" || componentType === "led" ? { portHintsMap: polarizedPortHintsMap } : void 0
18573
18575
  );
18576
+ const serializedManufacturerPartNumber = JSON.stringify(
18577
+ manufacturerPartNumber
18578
+ );
18579
+ const manufacturerPartNumberTsx = serializedManufacturerPartNumber.slice(1, -1) !== manufacturerPartNumber || manufacturerPartNumber.includes("&") ? `{${serializedManufacturerPartNumber}}` : serializedManufacturerPartNumber;
18574
18580
  const simplifiedPinLabels = Object.fromEntries(
18575
18581
  Object.entries(safePinLabels).map(([pin, labels]) => {
18576
18582
  if (Array.isArray(labels) && labels.length > 1 && labels[0] === pin) {
@@ -18580,7 +18586,7 @@ var generateTypescriptComponent = ({
18580
18586
  })
18581
18587
  );
18582
18588
  const pinLabelsString = Object.entries(simplifiedPinLabels).map(([pin, labels]) => ` ${pin}: ${JSON.stringify(labels)}`).join(",\n");
18583
- const inferredPinAttributes = componentType === "chip" ? inferPinAttributes(simplifiedPinLabels) : {};
18589
+ const inferredPinAttributes = componentType === "chip" && inferPinAttributes2 ? inferPinAttributes(simplifiedPinLabels) : {};
18584
18590
  const resolvedPinAttributes = { ...inferredPinAttributes, ...pinAttributes };
18585
18591
  const pinAttributesString = Object.entries(resolvedPinAttributes).map(([pin, attributes]) => {
18586
18592
  const attributesString = Object.entries(attributes).map(
@@ -18644,7 +18650,7 @@ ${polarizedPinLabelsBlock}${pinAttributesBlock}export const ${componentName} = (
18644
18650
  <diode
18645
18651
  name={name}
18646
18652
  ${polarizedPinLabelsProp}${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18647
- manufacturerPartNumber="${manufacturerPartNumber}"
18653
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18648
18654
  ${pinAttributesProp} footprint={${footprintTsx}}
18649
18655
  ${objUrl || stepUrl ? `cadModel={{
18650
18656
  ${cadModelLines}
@@ -18666,7 +18672,7 @@ ${polarizedPinLabelsBlock}${pinAttributesBlock}export const ${componentName} = (
18666
18672
  <led
18667
18673
  name={name}
18668
18674
  ${polarizedPinLabelsProp}${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18669
- manufacturerPartNumber="${manufacturerPartNumber}"
18675
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18670
18676
  ${pinAttributesProp} footprint={${footprintTsx}}
18671
18677
  ${objUrl || stepUrl ? `cadModel={{
18672
18678
  ${cadModelLines}
@@ -18693,7 +18699,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: PushButtonProps<typ
18693
18699
  name={name}
18694
18700
  pinLabels={pinLabels}
18695
18701
  ${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18696
- manufacturerPartNumber="${manufacturerPartNumber}"
18702
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18697
18703
  ${pinAttributesProp} footprint={${footprintTsx}}
18698
18704
  ${objUrl || stepUrl ? `cadModel={{
18699
18705
  ${cadModelLines}
@@ -18720,7 +18726,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: SwitchProps) => {
18720
18726
  name={name}
18721
18727
  pinLabels={pinLabels}
18722
18728
  ${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18723
- manufacturerPartNumber="${manufacturerPartNumber}"
18729
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18724
18730
  ${pinAttributesProp} footprint={${footprintTsx}}
18725
18731
  ${objUrl || stepUrl ? `cadModel={{
18726
18732
  ${cadModelLines}
@@ -18746,7 +18752,7 @@ ${capacitorPolarizedPinLabelsBlock}${pinAttributesBlock}export const ${component
18746
18752
  name={name}
18747
18753
  capacitance=${JSON.stringify(capacitance2)}
18748
18754
  ${capacitorPolarizedPinLabelsProp}${polarizedProp}${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18749
- manufacturerPartNumber="${manufacturerPartNumber}"
18755
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18750
18756
  ${pinAttributesProp} footprint={${footprintTsx}}
18751
18757
  ${objUrl || stepUrl ? `cadModel={{
18752
18758
  ${cadModelLines}
@@ -18772,7 +18778,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: Omit<ResistorProps,
18772
18778
  name={name}
18773
18779
  resistance=${JSON.stringify(resistance2)}
18774
18780
  ${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18775
- manufacturerPartNumber="${manufacturerPartNumber}"
18781
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18776
18782
  ${pinAttributesProp} footprint={${footprintTsx}}
18777
18783
  ${objUrl || stepUrl ? `cadModel={{
18778
18784
  ${cadModelLines}
@@ -18795,7 +18801,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: Omit<InductorProps,
18795
18801
  <inductor
18796
18802
  inductance=${JSON.stringify(inductance2)}
18797
18803
  supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18798
- manufacturerPartNumber="${manufacturerPartNumber}"
18804
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18799
18805
  ${pinAttributesProp} footprint={${footprintTsx}}
18800
18806
  ${objUrl || stepUrl ? `cadModel={{
18801
18807
  ${cadModelLines}
@@ -18824,7 +18830,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: ImportedCrystalProp
18824
18830
  frequency=${JSON.stringify(crystalFrequency)}
18825
18831
  pinVariant=${JSON.stringify(crystalPinVariant)}
18826
18832
  supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18827
- manufacturerPartNumber="${manufacturerPartNumber}"
18833
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18828
18834
  ${pinAttributesProp} footprint={${footprintTsx}}
18829
18835
  ${objUrl || stepUrl ? `cadModel={{
18830
18836
  ${cadModelLines}
@@ -18848,7 +18854,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: ConnectorProps) =>
18848
18854
  <connector
18849
18855
  pinLabels={pinLabels}
18850
18856
  supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18851
- manufacturerPartNumber="${manufacturerPartNumber}"
18857
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18852
18858
  ${pinAttributesProp} footprint={${footprintTsx}}
18853
18859
  ${objUrl || stepUrl ? `cadModel={{
18854
18860
  ${cadModelLines}
@@ -18870,7 +18876,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: ChipProps<typeof pi
18870
18876
  return (
18871
18877
  <chip
18872
18878
  ${useSymbolPortsOnly ? "" : " pinLabels={pinLabels}\n"}${pinAttributesProp}${symbolProp}${schPinArrangementProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
18873
- manufacturerPartNumber="${manufacturerPartNumber}"
18879
+ manufacturerPartNumber=${manufacturerPartNumberTsx}
18874
18880
  footprint={${footprintTsx}}
18875
18881
  ${objUrl || stepUrl ? `cadModel={{
18876
18882
  ${cadModelLines}