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.
package/dist/index.js CHANGED
@@ -8485,11 +8485,11 @@ var generateShapeTsx = ({
8485
8485
  x: shape.position.x + shape.width / 2,
8486
8486
  y: shape.position.y + shape.height / 2
8487
8487
  });
8488
- 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)}` : ""} />`;
8488
+ 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)}` : ""} />`;
8489
8489
  }
8490
8490
  if (shape.type === "ELLIPSE") {
8491
8491
  const center = transformPoint(shape.center);
8492
- 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)}` : ""} />`;
8492
+ 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)}` : ""} />`;
8493
8493
  }
8494
8494
  if (shape.type === "POLYLINE" || shape.type === "POLYGON") {
8495
8495
  const isPolygon = shape.type === "POLYGON";
@@ -8801,7 +8801,8 @@ var generateTypescriptComponent = ({
8801
8801
  crystalFrequency,
8802
8802
  crystalPinVariant,
8803
8803
  symbolTsx,
8804
- schPinArrangement
8804
+ schPinArrangement,
8805
+ useSymbolPortsOnly = false
8805
8806
  }) => {
8806
8807
  const safePinLabels = pinLabels ?? {};
8807
8808
  const polarizedPinMetadata = getPolarizedPinMetadata(safePinLabels);
@@ -9096,8 +9097,7 @@ ${pinLabelsString}
9096
9097
  ${pinAttributesBlock}export const ${componentName} = (props: ChipProps<typeof pinLabels>) => {
9097
9098
  return (
9098
9099
  <chip
9099
- pinLabels={pinLabels}
9100
- ${pinAttributesProp}${symbolProp}${schPinArrangementProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
9100
+ ${useSymbolPortsOnly ? "" : " pinLabels={pinLabels}\n"}${pinAttributesProp}${symbolProp}${schPinArrangementProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
9101
9101
  manufacturerPartNumber="${manufacturerPartNumber}"
9102
9102
  footprint={${footprintTsx}}
9103
9103
  ${objUrl || stepUrl ? `cadModel={{
@@ -9134,6 +9134,29 @@ var isCrystalComponent = (betterEasy) => {
9134
9134
  return componentParameters.pre === "X?" && packageName?.toUpperCase().startsWith("CRYSTAL-") === true && typeof value === "string" && frequencyPattern.test(value.trim());
9135
9135
  };
9136
9136
 
9137
+ // lib/websafe/convert-to-typescript-component/is-dip-switch-category-component.ts
9138
+ var categoryValueContainsDipSwitch = (value) => {
9139
+ if (typeof value === "string") {
9140
+ return /\bdip\s+switch(?:es)?\b/i.test(value);
9141
+ }
9142
+ if (Array.isArray(value)) return value.some(categoryValueContainsDipSwitch);
9143
+ if (value && typeof value === "object") {
9144
+ return Object.values(value).some(categoryValueContainsDipSwitch);
9145
+ }
9146
+ return false;
9147
+ };
9148
+ var isDipSwitchCategoryComponent = (betterEasy) => {
9149
+ const cPara = betterEasy.dataStr.head.c_para;
9150
+ return [
9151
+ betterEasy.tags,
9152
+ cPara.category,
9153
+ cPara.Category,
9154
+ cPara["LCSC Category"],
9155
+ cPara["JLCPCB Category"],
9156
+ betterEasy.category
9157
+ ].some(categoryValueContainsDipSwitch);
9158
+ };
9159
+
9137
9160
  // lib/websafe/convert-to-typescript-component/is-inductor-component.ts
9138
9161
  var inductancePattern = /^\d+(?:\.\d+)?\s*(?:pH|nH|uH|µH|mH|H)$/i;
9139
9162
  var isInductorComponent = (betterEasy) => {
@@ -9257,6 +9280,7 @@ var getGeneratedComponentType = (betterEasy, pinCount) => {
9257
9280
  if (isLedCategoryComponent(betterEasy) && pinCount === 2) return "led";
9258
9281
  if (isDiodeCategoryComponent(betterEasy) && pinCount === 2) return "diode";
9259
9282
  if (isPushbuttonCategoryComponent(betterEasy)) return "pushbutton";
9283
+ if (isDipSwitchCategoryComponent(betterEasy)) return "chip";
9260
9284
  if (isSwitchCategoryComponent(betterEasy)) return "switch";
9261
9285
  if (isCapacitorComponent(betterEasy)) return "capacitor";
9262
9286
  if (isResistorComponent(betterEasy) && pinCount === 2) return "resistor";
@@ -9355,6 +9379,7 @@ var convertBetterEasyToTsx = async ({
9355
9379
  betterEasy,
9356
9380
  sourcePorts.length
9357
9381
  );
9382
+ const isDipSwitch = isDipSwitchCategoryComponent(betterEasy);
9358
9383
  const inductance2 = componentType === "inductor" ? betterEasy.dataStr.head.c_para.Value?.trim() : void 0;
9359
9384
  const capacitance2 = componentType === "capacitor" ? normalizeCapacitanceValue(betterEasy.dataStr.head.c_para.Value) : void 0;
9360
9385
  const resistance2 = componentType === "resistor" ? normalizeResistorValue(betterEasy.dataStr.head.c_para.Value) : void 0;
@@ -9382,7 +9407,8 @@ var convertBetterEasyToTsx = async ({
9382
9407
  crystalFrequency,
9383
9408
  crystalPinVariant,
9384
9409
  symbolTsx,
9385
- schPinArrangement
9410
+ schPinArrangement,
9411
+ useSymbolPortsOnly: isDipSwitch && Boolean(symbolTsx)
9386
9412
  });
9387
9413
  };
9388
9414
  var checkModelObjUrlValidity = async (url) => {