easyeda 0.0.337 → 0.0.338

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.
@@ -12170,11 +12170,11 @@ var generateShapeTsx = ({
12170
12170
  x: shape.position.x + shape.width / 2,
12171
12171
  y: shape.position.y + shape.height / 2
12172
12172
  });
12173
- return `<schematicrect schX={${center.x}} schY={${center.y}} width={${toSchematicUnits(shape.width)}} height={${toSchematicUnits(shape.height)}} color=${JSON.stringify(shape.color)}${shape.fillColor && shape.fillColor !== "none" ? ` isFilled fillColor=${JSON.stringify(shape.fillColor)}` : ""} />`;
12173
+ return `<schematicrect schX={${center.x}} schY={${center.y}} width={${toSchematicUnits(shape.width)}} height={${toSchematicUnits(shape.height)}} strokeWidth={${toSchematicUnits(shape.lineWidth)}} color=${JSON.stringify(shape.color)}${shape.fillColor && shape.fillColor !== "none" ? ` isFilled fillColor=${JSON.stringify(shape.fillColor)}` : ""} />`;
12174
12174
  }
12175
12175
  if (shape.type === "ELLIPSE") {
12176
12176
  const center = transformPoint(shape.center);
12177
- return `<schematiccircle center={{ x: ${center.x}, y: ${center.y} }} radius={${toSchematicUnits(Math.max(shape.radiusX, shape.radiusY))}} color=${JSON.stringify(shape.color)}${shape.fillColor && shape.fillColor !== "none" ? ` isFilled fillColor=${JSON.stringify(shape.fillColor)}` : ""} />`;
12177
+ return `<schematiccircle center={{ x: ${center.x}, y: ${center.y} }} radius={${toSchematicUnits(Math.max(shape.radiusX, shape.radiusY))}} strokeWidth={${toSchematicUnits(shape.lineWidth)}} color=${JSON.stringify(shape.color)}${shape.fillColor && shape.fillColor !== "none" ? ` isFilled fillColor=${JSON.stringify(shape.fillColor)}` : ""} />`;
12178
12178
  }
12179
12179
  if (shape.type === "POLYLINE" || shape.type === "POLYGON") {
12180
12180
  const isPolygon = shape.type === "POLYGON";
@@ -12486,7 +12486,8 @@ var generateTypescriptComponent = ({
12486
12486
  crystalFrequency,
12487
12487
  crystalPinVariant,
12488
12488
  symbolTsx,
12489
- schPinArrangement
12489
+ schPinArrangement,
12490
+ useSymbolPortsOnly = false
12490
12491
  }) => {
12491
12492
  const safePinLabels = pinLabels ?? {};
12492
12493
  const polarizedPinMetadata = getPolarizedPinMetadata(safePinLabels);
@@ -12781,8 +12782,7 @@ ${pinLabelsString}
12781
12782
  ${pinAttributesBlock}export const ${componentName} = (props: ChipProps<typeof pinLabels>) => {
12782
12783
  return (
12783
12784
  <chip
12784
- pinLabels={pinLabels}
12785
- ${pinAttributesProp}${symbolProp}${schPinArrangementProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
12785
+ ${useSymbolPortsOnly ? "" : " pinLabels={pinLabels}\n"}${pinAttributesProp}${symbolProp}${schPinArrangementProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
12786
12786
  manufacturerPartNumber="${manufacturerPartNumber}"
12787
12787
  footprint={${footprintTsx}}
12788
12788
  ${objUrl || stepUrl ? `cadModel={{
@@ -12819,6 +12819,29 @@ var isCrystalComponent = (betterEasy) => {
12819
12819
  return componentParameters.pre === "X?" && packageName?.toUpperCase().startsWith("CRYSTAL-") === true && typeof value === "string" && frequencyPattern.test(value.trim());
12820
12820
  };
12821
12821
 
12822
+ // lib/websafe/convert-to-typescript-component/is-dip-switch-category-component.ts
12823
+ var categoryValueContainsDipSwitch = (value) => {
12824
+ if (typeof value === "string") {
12825
+ return /\bdip\s+switch(?:es)?\b/i.test(value);
12826
+ }
12827
+ if (Array.isArray(value)) return value.some(categoryValueContainsDipSwitch);
12828
+ if (value && typeof value === "object") {
12829
+ return Object.values(value).some(categoryValueContainsDipSwitch);
12830
+ }
12831
+ return false;
12832
+ };
12833
+ var isDipSwitchCategoryComponent = (betterEasy) => {
12834
+ const cPara = betterEasy.dataStr.head.c_para;
12835
+ return [
12836
+ betterEasy.tags,
12837
+ cPara.category,
12838
+ cPara.Category,
12839
+ cPara["LCSC Category"],
12840
+ cPara["JLCPCB Category"],
12841
+ betterEasy.category
12842
+ ].some(categoryValueContainsDipSwitch);
12843
+ };
12844
+
12822
12845
  // lib/websafe/convert-to-typescript-component/is-inductor-component.ts
12823
12846
  var inductancePattern = /^\d+(?:\.\d+)?\s*(?:pH|nH|uH|µH|mH|H)$/i;
12824
12847
  var isInductorComponent = (betterEasy) => {
@@ -12942,6 +12965,7 @@ var getGeneratedComponentType = (betterEasy, pinCount) => {
12942
12965
  if (isLedCategoryComponent(betterEasy) && pinCount === 2) return "led";
12943
12966
  if (isDiodeCategoryComponent(betterEasy) && pinCount === 2) return "diode";
12944
12967
  if (isPushbuttonCategoryComponent(betterEasy)) return "pushbutton";
12968
+ if (isDipSwitchCategoryComponent(betterEasy)) return "chip";
12945
12969
  if (isSwitchCategoryComponent(betterEasy)) return "switch";
12946
12970
  if (isCapacitorComponent(betterEasy)) return "capacitor";
12947
12971
  if (isResistorComponent(betterEasy) && pinCount === 2) return "resistor";
@@ -13040,6 +13064,7 @@ var convertBetterEasyToTsx = async ({
13040
13064
  betterEasy,
13041
13065
  sourcePorts.length
13042
13066
  );
13067
+ const isDipSwitch = isDipSwitchCategoryComponent(betterEasy);
13043
13068
  const inductance2 = componentType === "inductor" ? betterEasy.dataStr.head.c_para.Value?.trim() : void 0;
13044
13069
  const capacitance2 = componentType === "capacitor" ? normalizeCapacitanceValue(betterEasy.dataStr.head.c_para.Value) : void 0;
13045
13070
  const resistance2 = componentType === "resistor" ? normalizeResistorValue(betterEasy.dataStr.head.c_para.Value) : void 0;
@@ -13067,7 +13092,8 @@ var convertBetterEasyToTsx = async ({
13067
13092
  crystalFrequency,
13068
13093
  crystalPinVariant,
13069
13094
  symbolTsx,
13070
- schPinArrangement
13095
+ schPinArrangement,
13096
+ useSymbolPortsOnly: isDipSwitch && Boolean(symbolTsx)
13071
13097
  });
13072
13098
  };
13073
13099
  var checkModelObjUrlValidity = async (url) => {