easyeda 0.0.124 → 0.0.126

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.
@@ -2655,36 +2655,40 @@ var soupTypescriptComponentTemplate = ({
2655
2655
  supplierPartNumbers,
2656
2656
  manufacturerPartNumber
2657
2657
  }) => {
2658
+ const safePinLabels = pinLabels ?? {};
2658
2659
  const footprintTsx = generateFootprintTsx(circuitJson);
2660
+ const simplifiedPinLabels = Object.fromEntries(
2661
+ Object.entries(safePinLabels).map(([pin, labels]) => {
2662
+ if (Array.isArray(labels) && labels.length > 1) {
2663
+ return [pin, [labels[1]]];
2664
+ }
2665
+ return [pin, labels];
2666
+ })
2667
+ );
2668
+ const pinLabelsString = Object.entries(simplifiedPinLabels).map(([pin, labels]) => ` ${pin}: ${JSON.stringify(labels)}`).join(",\n");
2659
2669
  return `
2660
- import { createUseComponent } from "@tscircuit/core"
2661
- import type { CommonLayoutProps } from "@tscircuit/props"
2670
+ import type { ChipProps } from "@tscircuit/props"
2662
2671
 
2663
- const pinLabels = ${JSON.stringify(pinLabels, null, " ")} as const
2664
-
2665
- interface Props extends CommonLayoutProps {
2666
- name: string
2667
- }
2672
+ const pinLabels = {
2673
+ ${pinLabelsString}
2674
+ } as const
2668
2675
 
2669
- export const ${componentName} = (props: Props) => {
2676
+ export const ${componentName} = (props: ChipProps<typeof pinLabels>) => {
2670
2677
  return (
2671
2678
  <chip
2672
- {...props}
2679
+ pinLabels={pinLabels}
2680
+ supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
2681
+ manufacturerPartNumber="${manufacturerPartNumber}"
2682
+ footprint={${footprintTsx}}
2673
2683
  ${objUrl ? `cadModel={{
2674
2684
  objUrl: "${objUrl}",
2675
2685
  rotationOffset: { x: 0, y: 0, z: 0 },
2676
2686
  positionOffset: { x: 0, y: 0, z: 0 },
2677
2687
  }}` : ""}
2678
- pinLabels={pinLabels}
2679
- supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
2680
- manufacturerPartNumber="${manufacturerPartNumber}"
2681
- footprint={${footprintTsx}}
2688
+ {...props}
2682
2689
  />
2683
2690
  )
2684
2691
  }
2685
-
2686
- export const use${componentName} = createUseComponent(${componentName}, pinLabels)
2687
-
2688
2692
  `.trim();
2689
2693
  };
2690
2694
 
@@ -2831,9 +2835,9 @@ var convertEasyEdaJsonToVariousFormats = async ({
2831
2835
  };
2832
2836
 
2833
2837
  export {
2838
+ fetchEasyEDAComponent,
2834
2839
  convertEasyEdaJsonToCircuitJson,
2835
2840
  convertEasyEdaJsonToTscircuitSoupJson,
2836
- fetchEasyEDAComponent,
2837
2841
  maybeNumber,
2838
2842
  SzlcscSchema,
2839
2843
  LcscSchema,
@@ -2850,4 +2854,4 @@ export {
2850
2854
  convertRawEasyToTsx,
2851
2855
  convertEasyEdaJsonToVariousFormats
2852
2856
  };
2853
- //# sourceMappingURL=chunk-2SZ5LCBA.js.map
2857
+ //# sourceMappingURL=chunk-DDVPTL72.js.map