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/index.d.ts CHANGED
@@ -501,11 +501,11 @@ declare const DataStrSchema: z.ZodObject<{
501
501
  y: z.ZodNumber;
502
502
  rotation: z.ZodNumber;
503
503
  fontColor: z.ZodString;
504
- backgroundColor: z.ZodOptional<z.ZodString>;
504
+ backgroundColor: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
505
505
  fontSize: z.ZodString;
506
- fontWeight: z.ZodDefault<z.ZodOptional<z.ZodString>>;
507
- fontStyle: z.ZodDefault<z.ZodOptional<z.ZodEnum<["normal", "italic"]>>>;
508
- fontDecoration: z.ZodDefault<z.ZodOptional<z.ZodString>>;
506
+ fontWeight: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, string, unknown>;
507
+ fontStyle: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodEnum<["normal", "italic"]>>>, "normal" | "italic", unknown>;
508
+ fontDecoration: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, string, unknown>;
509
509
  content: z.ZodString;
510
510
  textType: z.ZodString;
511
511
  visibility: z.ZodEnum<["0", "1"]>;
@@ -541,10 +541,10 @@ declare const DataStrSchema: z.ZodObject<{
541
541
  content: string;
542
542
  textType: string;
543
543
  mirror: string;
544
- backgroundColor?: string | undefined;
545
- fontWeight?: string | undefined;
546
- fontStyle?: "normal" | "italic" | undefined;
547
- fontDecoration?: string | undefined;
544
+ backgroundColor?: unknown;
545
+ fontWeight?: unknown;
546
+ fontStyle?: unknown;
547
+ fontDecoration?: unknown;
548
548
  }>, z.ZodObject<{
549
549
  type: z.ZodLiteral<"ARC">;
550
550
  start: z.ZodObject<{
@@ -3034,11 +3034,11 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
3034
3034
  y: z.ZodNumber;
3035
3035
  rotation: z.ZodNumber;
3036
3036
  fontColor: z.ZodString;
3037
- backgroundColor: z.ZodOptional<z.ZodString>;
3037
+ backgroundColor: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
3038
3038
  fontSize: z.ZodString;
3039
- fontWeight: z.ZodDefault<z.ZodOptional<z.ZodString>>;
3040
- fontStyle: z.ZodDefault<z.ZodOptional<z.ZodEnum<["normal", "italic"]>>>;
3041
- fontDecoration: z.ZodDefault<z.ZodOptional<z.ZodString>>;
3039
+ fontWeight: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, string, unknown>;
3040
+ fontStyle: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodEnum<["normal", "italic"]>>>, "normal" | "italic", unknown>;
3041
+ fontDecoration: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, string, unknown>;
3042
3042
  content: z.ZodString;
3043
3043
  textType: z.ZodString;
3044
3044
  visibility: z.ZodEnum<["0", "1"]>;
@@ -3074,10 +3074,10 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
3074
3074
  content: string;
3075
3075
  textType: string;
3076
3076
  mirror: string;
3077
- backgroundColor?: string | undefined;
3078
- fontWeight?: string | undefined;
3079
- fontStyle?: "normal" | "italic" | undefined;
3080
- fontDecoration?: string | undefined;
3077
+ backgroundColor?: unknown;
3078
+ fontWeight?: unknown;
3079
+ fontStyle?: unknown;
3080
+ fontDecoration?: unknown;
3081
3081
  }>, z.ZodObject<{
3082
3082
  type: z.ZodLiteral<"ARC">;
3083
3083
  start: z.ZodObject<{
package/dist/index.js CHANGED
@@ -5368,15 +5368,12 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
5368
5368
  const innerWidth = largestOuterDimensionName === "width" ? largestInnerDimension : smallestInnerDimension;
5369
5369
  const innerHeight = largestOuterDimensionName === "height" ? largestInnerDimension : smallestInnerDimension;
5370
5370
  additionalPlatedHoleProps = {
5371
- shape: "pill_hole_with_rect_pad",
5372
- hole_shape: "pill",
5373
- pad_shape: "rect",
5371
+ shape: "pill",
5374
5372
  hole_width: innerWidth,
5375
5373
  hole_height: innerHeight,
5376
- rect_pad_width: mil2mm(pad.width),
5377
- rect_pad_height: mil2mm(pad.height),
5378
- hole_offset_x: 0,
5379
- hole_offset_y: 0
5374
+ outer_width: mil2mm(pad.width),
5375
+ outer_height: mil2mm(pad.height),
5376
+ ccw_rotation: pad.rotation || 0
5380
5377
  };
5381
5378
  } else if (pad.shape === "RECT") {
5382
5379
  const padWidth = mil2mm(pad.width);
@@ -6363,6 +6360,12 @@ var parsePath = (str) => {
6363
6360
  };
6364
6361
  };
6365
6362
  var PathShapeSchema = z162.string().startsWith("PT~").transform(parsePath).pipe(PathShapeOutputSchema);
6363
+ var optionalEasyEdaTextField = (fieldSchema) => z162.preprocess((textField) => {
6364
+ if (textField == null || textField === "" || textField === "undefined") {
6365
+ return void 0;
6366
+ }
6367
+ return textField;
6368
+ }, fieldSchema);
6366
6369
  var TextShapeOutputSchema = z162.object({
6367
6370
  type: z162.literal("TEXT"),
6368
6371
  alignment: z162.enum(["L", "C", "R"]),
@@ -6370,11 +6373,13 @@ var TextShapeOutputSchema = z162.object({
6370
6373
  y: z162.number(),
6371
6374
  rotation: z162.number(),
6372
6375
  fontColor: z162.string(),
6373
- backgroundColor: z162.string().optional(),
6376
+ backgroundColor: optionalEasyEdaTextField(z162.string().optional()),
6374
6377
  fontSize: z162.string(),
6375
- fontWeight: z162.string().optional().default("normal"),
6376
- fontStyle: z162.enum(["normal", "italic"]).optional().default("normal"),
6377
- fontDecoration: z162.string().optional().default(""),
6378
+ fontWeight: optionalEasyEdaTextField(z162.string().optional().default("normal")),
6379
+ fontStyle: optionalEasyEdaTextField(
6380
+ z162.enum(["normal", "italic"]).optional().default("normal")
6381
+ ),
6382
+ fontDecoration: optionalEasyEdaTextField(z162.string().optional().default("")),
6378
6383
  content: z162.string(),
6379
6384
  textType: z162.string(),
6380
6385
  visibility: z162.enum(["0", "1"]),
@@ -6407,11 +6412,11 @@ var parseText = (str) => {
6407
6412
  y: Number(y),
6408
6413
  rotation: Number(rotation2),
6409
6414
  fontColor,
6410
- backgroundColor: backgroundColor || void 0,
6415
+ backgroundColor,
6411
6416
  fontSize,
6412
- fontWeight: fontWeight || "normal",
6413
- fontStyle: fontStyle || "normal",
6414
- fontDecoration: fontDecoration || "",
6417
+ fontWeight,
6418
+ fontStyle,
6419
+ fontDecoration,
6415
6420
  content,
6416
6421
  textType,
6417
6422
  visibility,
@@ -6815,7 +6820,13 @@ var generateFootprintTsx = (circuitJson) => {
6815
6820
  }
6816
6821
  }
6817
6822
  for (const platedHole of platedHoles) {
6818
- if (platedHole.shape === "pill_hole_with_rect_pad") {
6823
+ if (platedHole.shape === "pill" || platedHole.shape === "oval") {
6824
+ const cccwRotationDegree = platedHole.ccw_rotation || 0;
6825
+ const rotation2 = cccwRotationDegree ? ` pcbRotation="${cccwRotationDegree}deg"` : "";
6826
+ elementStrings.push(
6827
+ `<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}" />`
6828
+ );
6829
+ } else if (platedHole.shape === "pill_hole_with_rect_pad") {
6819
6830
  elementStrings.push(
6820
6831
  `<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" />`
6821
6832
  );