easyeda 0.0.258 → 0.0.260

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
@@ -997,7 +997,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
997
997
  var package_default = {
998
998
  name: "easyeda",
999
999
  type: "module",
1000
- version: "0.0.257",
1000
+ version: "0.0.258",
1001
1001
  files: [
1002
1002
  "dist"
1003
1003
  ],
@@ -6416,15 +6416,12 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
6416
6416
  const innerWidth = largestOuterDimensionName === "width" ? largestInnerDimension : smallestInnerDimension;
6417
6417
  const innerHeight = largestOuterDimensionName === "height" ? largestInnerDimension : smallestInnerDimension;
6418
6418
  additionalPlatedHoleProps = {
6419
- shape: "pill_hole_with_rect_pad",
6420
- hole_shape: "pill",
6421
- pad_shape: "rect",
6419
+ shape: "pill",
6422
6420
  hole_width: innerWidth,
6423
6421
  hole_height: innerHeight,
6424
- rect_pad_width: mil2mm(pad.width),
6425
- rect_pad_height: mil2mm(pad.height),
6426
- hole_offset_x: 0,
6427
- hole_offset_y: 0
6422
+ outer_width: mil2mm(pad.width),
6423
+ outer_height: mil2mm(pad.height),
6424
+ ccw_rotation: pad.rotation || 0
6428
6425
  };
6429
6426
  } else if (pad.shape === "RECT") {
6430
6427
  const padWidth = mil2mm(pad.width);
@@ -7266,6 +7263,12 @@ var parsePath = (str) => {
7266
7263
  };
7267
7264
  };
7268
7265
  var PathShapeSchema = import_zod162.z.string().startsWith("PT~").transform(parsePath).pipe(PathShapeOutputSchema);
7266
+ var optionalEasyEdaTextField = (fieldSchema) => import_zod162.z.preprocess((textField) => {
7267
+ if (textField == null || textField === "" || textField === "undefined") {
7268
+ return void 0;
7269
+ }
7270
+ return textField;
7271
+ }, fieldSchema);
7269
7272
  var TextShapeOutputSchema = import_zod162.z.object({
7270
7273
  type: import_zod162.z.literal("TEXT"),
7271
7274
  alignment: import_zod162.z.enum(["L", "C", "R"]),
@@ -7273,11 +7276,13 @@ var TextShapeOutputSchema = import_zod162.z.object({
7273
7276
  y: import_zod162.z.number(),
7274
7277
  rotation: import_zod162.z.number(),
7275
7278
  fontColor: import_zod162.z.string(),
7276
- backgroundColor: import_zod162.z.string().optional(),
7279
+ backgroundColor: optionalEasyEdaTextField(import_zod162.z.string().optional()),
7277
7280
  fontSize: import_zod162.z.string(),
7278
- fontWeight: import_zod162.z.string().optional().default("normal"),
7279
- fontStyle: import_zod162.z.enum(["normal", "italic"]).optional().default("normal"),
7280
- fontDecoration: import_zod162.z.string().optional().default(""),
7281
+ fontWeight: optionalEasyEdaTextField(import_zod162.z.string().optional().default("normal")),
7282
+ fontStyle: optionalEasyEdaTextField(
7283
+ import_zod162.z.enum(["normal", "italic"]).optional().default("normal")
7284
+ ),
7285
+ fontDecoration: optionalEasyEdaTextField(import_zod162.z.string().optional().default("")),
7281
7286
  content: import_zod162.z.string(),
7282
7287
  textType: import_zod162.z.string(),
7283
7288
  visibility: import_zod162.z.enum(["0", "1"]),
@@ -7310,11 +7315,11 @@ var parseText = (str) => {
7310
7315
  y: Number(y),
7311
7316
  rotation: Number(rotation2),
7312
7317
  fontColor,
7313
- backgroundColor: backgroundColor || void 0,
7318
+ backgroundColor,
7314
7319
  fontSize,
7315
- fontWeight: fontWeight || "normal",
7316
- fontStyle: fontStyle || "normal",
7317
- fontDecoration: fontDecoration || "",
7320
+ fontWeight,
7321
+ fontStyle,
7322
+ fontDecoration,
7318
7323
  content,
7319
7324
  textType,
7320
7325
  visibility,
@@ -7718,7 +7723,13 @@ var generateFootprintTsx = (circuitJson) => {
7718
7723
  }
7719
7724
  }
7720
7725
  for (const platedHole of platedHoles) {
7721
- if (platedHole.shape === "pill_hole_with_rect_pad") {
7726
+ if (platedHole.shape === "pill" || platedHole.shape === "oval") {
7727
+ const cccwRotationDegree = platedHole.ccw_rotation || 0;
7728
+ const rotation2 = cccwRotationDegree ? ` pcbRotation="${cccwRotationDegree}deg"` : "";
7729
+ elementStrings.push(
7730
+ `<platedhole portHints={${JSON.stringify(platedHole.port_hints)}} pcbX="${mmStr(platedHole.x)}" pcbY="${mmStr(platedHole.y)}" holeWidth="${mmStr(platedHole.hole_width)}" holeHeight="${mmStr(platedHole.hole_height)}" outerWidth="${mmStr(platedHole.outer_width)}" outerHeight="${mmStr(platedHole.outer_height)}"${rotation2} shape="${platedHole.shape}" />`
7731
+ );
7732
+ } else if (platedHole.shape === "pill_hole_with_rect_pad") {
7722
7733
  elementStrings.push(
7723
7734
  `<platedhole portHints={${JSON.stringify(platedHole.port_hints)}} pcbX="${mmStr(platedHole.x)}" pcbY="${mmStr(platedHole.y)}" holeWidth="${mmStr(platedHole.hole_width)}" holeHeight="${mmStr(platedHole.hole_height)}" outerWidth="${mmStr(platedHole.rect_pad_width)}" outerHeight="${mmStr(platedHole.rect_pad_height)}" shape="pill" />`
7724
7735
  );