easyeda 0.0.276 → 0.0.278

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
@@ -6663,7 +6663,7 @@ import { z as z181 } from "zod";
6663
6663
  import { z as z179 } from "zod";
6664
6664
  var safeNumber = (defaultValue = 0) => z179.union([z179.number(), z179.string()]).transform((val) => {
6665
6665
  const num = Number(val);
6666
- return isNaN(num) ? defaultValue : num;
6666
+ return Number.isNaN(num) ? defaultValue : num;
6667
6667
  }).default(defaultValue);
6668
6668
  var tenthmil = z179.union([z179.number(), z179.string()]).optional().transform(
6669
6669
  (n) => typeof n === "string" && n.endsWith("mil") ? n : `${Number.parseFloat(n) * 10}mil`
@@ -6810,6 +6810,7 @@ var ShapeItemSchema = z179.object({
6810
6810
  }
6811
6811
  case "PAD": {
6812
6812
  const [padShape, ...params] = shape.data.split("~");
6813
+ const rawPadNumber = params[6];
6813
6814
  const [
6814
6815
  centerX,
6815
6816
  centerY,
@@ -6817,10 +6818,11 @@ var ShapeItemSchema = z179.object({
6817
6818
  height,
6818
6819
  layermask,
6819
6820
  net,
6820
- number,
6821
+ numericPadNumber,
6821
6822
  holeRadius,
6822
6823
  ...rest
6823
6824
  ] = params.map((p) => Number.isNaN(Number(p)) ? p : Number(p));
6825
+ const padNumber = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(rawPadNumber) ? numericPadNumber : rawPadNumber;
6824
6826
  const center = { x: centerX, y: centerY };
6825
6827
  let points;
6826
6828
  if (padShape === "RECT" || padShape === "POLYGON") {
@@ -6836,7 +6838,7 @@ var ShapeItemSchema = z179.object({
6836
6838
  height,
6837
6839
  layermask,
6838
6840
  net,
6839
- number,
6841
+ number: padNumber,
6840
6842
  holeRadius,
6841
6843
  points,
6842
6844
  rotation: rotation2,
@@ -7288,7 +7290,7 @@ var OwnerSchema = z181.object({
7288
7290
  });
7289
7291
  var HeadSchema = z181.object({
7290
7292
  docType: z181.preprocess((val) => val == null ? val : String(val), z181.string()),
7291
- editorVersion: z181.string(),
7293
+ editorVersion: z181.string().default(""),
7292
7294
  c_para: z181.record(z181.string(), z181.string().nullable()),
7293
7295
  x: z181.number(),
7294
7296
  y: z181.number(),
@@ -7301,7 +7303,7 @@ var HeadSchema = z181.object({
7301
7303
  }, z181.number()),
7302
7304
  importFlag: z181.number().optional(),
7303
7305
  c_spiceCmd: z181.any().optional(),
7304
- hasIdFlag: z181.boolean()
7306
+ hasIdFlag: z181.boolean().default(false)
7305
7307
  });
7306
7308
  var BBoxSchema = z181.object({
7307
7309
  x: z181.number(),
@@ -7326,9 +7328,17 @@ var DataStrSchema = z181.object({
7326
7328
  head: HeadSchema,
7327
7329
  canvas: z181.string(),
7328
7330
  shape: z181.array(SingleLetterShapeSchema),
7329
- BBox: BBoxSchema,
7330
- colors: z181.union([z181.array(z181.string()), z181.record(z181.string())])
7331
- });
7331
+ BBox: BBoxSchema.optional(),
7332
+ colors: z181.union([z181.array(z181.string()), z181.record(z181.string())]).default([])
7333
+ }).transform((data) => ({
7334
+ ...data,
7335
+ BBox: data.BBox ?? {
7336
+ x: data.head.x,
7337
+ y: data.head.y,
7338
+ width: 0,
7339
+ height: 0
7340
+ }
7341
+ }));
7332
7342
  var PackageDetailDataStrSchema = z181.object({
7333
7343
  head: HeadSchema,
7334
7344
  canvas: z181.string(),