easyeda 0.0.326 → 0.0.328

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
@@ -234,9 +234,9 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
234
234
  y: number;
235
235
  };
236
236
  radius: number;
237
+ pathData: string;
237
238
  lineWidth: number;
238
239
  sweepFlag: boolean;
239
- pathData: string;
240
240
  color: string;
241
241
  } | {
242
242
  path: string;
@@ -606,9 +606,9 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
606
606
  y: number;
607
607
  };
608
608
  radius: number;
609
+ pathData: string;
609
610
  lineWidth: number;
610
611
  sweepFlag: boolean;
611
- pathData: string;
612
612
  color: string;
613
613
  }, {
614
614
  type: "ARC";
@@ -622,9 +622,9 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
622
622
  y: number;
623
623
  };
624
624
  radius: number;
625
+ pathData: string;
625
626
  lineWidth: number;
626
627
  sweepFlag: boolean;
627
- pathData: string;
628
628
  color: string;
629
629
  }>]>>, "many">;
630
630
  BBox: z.ZodOptional<z.ZodObject<{
@@ -681,9 +681,9 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
681
681
  y: number;
682
682
  };
683
683
  radius: number;
684
+ pathData: string;
684
685
  lineWidth: number;
685
686
  sweepFlag: boolean;
686
- pathData: string;
687
687
  color: string;
688
688
  } | {
689
689
  path: string;
@@ -831,9 +831,9 @@ declare const DataStrSchema: z.ZodEffects<z.ZodObject<{
831
831
  y: number;
832
832
  };
833
833
  radius: number;
834
+ pathData: string;
834
835
  lineWidth: number;
835
836
  sweepFlag: boolean;
836
- pathData: string;
837
837
  color: string;
838
838
  } | {
839
839
  path: string;
@@ -1036,6 +1036,7 @@ declare const PackageDetailDataStrSchema: z.ZodObject<{
1036
1036
  y: number;
1037
1037
  }[];
1038
1038
  layermask: number;
1039
+ pathData: string;
1039
1040
  fillStyle: string;
1040
1041
  id?: string | undefined;
1041
1042
  layer?: number | undefined;
@@ -1294,6 +1295,7 @@ declare const PackageDetailDataStrSchema: z.ZodObject<{
1294
1295
  } & {
1295
1296
  type: z.ZodLiteral<"SOLIDREGION">;
1296
1297
  layermask: z.ZodNumber;
1298
+ pathData: z.ZodString;
1297
1299
  points: z.ZodArray<z.ZodPipeline<z.ZodEffects<z.ZodAny, any, any>, z.ZodObject<{
1298
1300
  x: z.ZodNumber;
1299
1301
  y: z.ZodNumber;
@@ -1312,6 +1314,7 @@ declare const PackageDetailDataStrSchema: z.ZodObject<{
1312
1314
  y: number;
1313
1315
  }[];
1314
1316
  layermask: number;
1317
+ pathData: string;
1315
1318
  fillStyle: string;
1316
1319
  id?: string | undefined;
1317
1320
  layer?: number | undefined;
@@ -1319,6 +1322,7 @@ declare const PackageDetailDataStrSchema: z.ZodObject<{
1319
1322
  type: "SOLIDREGION";
1320
1323
  points: any[];
1321
1324
  layermask: number;
1325
+ pathData: string;
1322
1326
  id?: string | undefined;
1323
1327
  layer?: number | undefined;
1324
1328
  fillStyle?: string | undefined;
@@ -1602,6 +1606,7 @@ declare const PackageDetailDataStrSchema: z.ZodObject<{
1602
1606
  y: number;
1603
1607
  }[];
1604
1608
  layermask: number;
1609
+ pathData: string;
1605
1610
  fillStyle: string;
1606
1611
  id?: string | undefined;
1607
1612
  layer?: number | undefined;
@@ -1845,6 +1850,7 @@ declare const PackageDetailSchema: z.ZodObject<{
1845
1850
  y: number;
1846
1851
  }[];
1847
1852
  layermask: number;
1853
+ pathData: string;
1848
1854
  fillStyle: string;
1849
1855
  id?: string | undefined;
1850
1856
  layer?: number | undefined;
@@ -2103,6 +2109,7 @@ declare const PackageDetailSchema: z.ZodObject<{
2103
2109
  } & {
2104
2110
  type: z.ZodLiteral<"SOLIDREGION">;
2105
2111
  layermask: z.ZodNumber;
2112
+ pathData: z.ZodString;
2106
2113
  points: z.ZodArray<z.ZodPipeline<z.ZodEffects<z.ZodAny, any, any>, z.ZodObject<{
2107
2114
  x: z.ZodNumber;
2108
2115
  y: z.ZodNumber;
@@ -2121,6 +2128,7 @@ declare const PackageDetailSchema: z.ZodObject<{
2121
2128
  y: number;
2122
2129
  }[];
2123
2130
  layermask: number;
2131
+ pathData: string;
2124
2132
  fillStyle: string;
2125
2133
  id?: string | undefined;
2126
2134
  layer?: number | undefined;
@@ -2128,6 +2136,7 @@ declare const PackageDetailSchema: z.ZodObject<{
2128
2136
  type: "SOLIDREGION";
2129
2137
  points: any[];
2130
2138
  layermask: number;
2139
+ pathData: string;
2131
2140
  id?: string | undefined;
2132
2141
  layer?: number | undefined;
2133
2142
  fillStyle?: string | undefined;
@@ -2411,6 +2420,7 @@ declare const PackageDetailSchema: z.ZodObject<{
2411
2420
  y: number;
2412
2421
  }[];
2413
2422
  layermask: number;
2423
+ pathData: string;
2414
2424
  fillStyle: string;
2415
2425
  id?: string | undefined;
2416
2426
  layer?: number | undefined;
@@ -2606,6 +2616,7 @@ declare const PackageDetailSchema: z.ZodObject<{
2606
2616
  y: number;
2607
2617
  }[];
2608
2618
  layermask: number;
2619
+ pathData: string;
2609
2620
  fillStyle: string;
2610
2621
  id?: string | undefined;
2611
2622
  layer?: number | undefined;
@@ -2942,9 +2953,9 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
2942
2953
  y: number;
2943
2954
  };
2944
2955
  radius: number;
2956
+ pathData: string;
2945
2957
  lineWidth: number;
2946
2958
  sweepFlag: boolean;
2947
- pathData: string;
2948
2959
  color: string;
2949
2960
  } | {
2950
2961
  path: string;
@@ -3314,9 +3325,9 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
3314
3325
  y: number;
3315
3326
  };
3316
3327
  radius: number;
3328
+ pathData: string;
3317
3329
  lineWidth: number;
3318
3330
  sweepFlag: boolean;
3319
- pathData: string;
3320
3331
  color: string;
3321
3332
  }, {
3322
3333
  type: "ARC";
@@ -3330,9 +3341,9 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
3330
3341
  y: number;
3331
3342
  };
3332
3343
  radius: number;
3344
+ pathData: string;
3333
3345
  lineWidth: number;
3334
3346
  sweepFlag: boolean;
3335
- pathData: string;
3336
3347
  color: string;
3337
3348
  }>]>>, "many">;
3338
3349
  BBox: z.ZodOptional<z.ZodObject<{
@@ -3389,9 +3400,9 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
3389
3400
  y: number;
3390
3401
  };
3391
3402
  radius: number;
3403
+ pathData: string;
3392
3404
  lineWidth: number;
3393
3405
  sweepFlag: boolean;
3394
- pathData: string;
3395
3406
  color: string;
3396
3407
  } | {
3397
3408
  path: string;
@@ -3539,9 +3550,9 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
3539
3550
  y: number;
3540
3551
  };
3541
3552
  radius: number;
3553
+ pathData: string;
3542
3554
  lineWidth: number;
3543
3555
  sweepFlag: boolean;
3544
- pathData: string;
3545
3556
  color: string;
3546
3557
  } | {
3547
3558
  path: string;
@@ -3773,6 +3784,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
3773
3784
  y: number;
3774
3785
  }[];
3775
3786
  layermask: number;
3787
+ pathData: string;
3776
3788
  fillStyle: string;
3777
3789
  id?: string | undefined;
3778
3790
  layer?: number | undefined;
@@ -4031,6 +4043,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
4031
4043
  } & {
4032
4044
  type: z.ZodLiteral<"SOLIDREGION">;
4033
4045
  layermask: z.ZodNumber;
4046
+ pathData: z.ZodString;
4034
4047
  points: z.ZodArray<z.ZodPipeline<z.ZodEffects<z.ZodAny, any, any>, z.ZodObject<{
4035
4048
  x: z.ZodNumber;
4036
4049
  y: z.ZodNumber;
@@ -4049,6 +4062,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
4049
4062
  y: number;
4050
4063
  }[];
4051
4064
  layermask: number;
4065
+ pathData: string;
4052
4066
  fillStyle: string;
4053
4067
  id?: string | undefined;
4054
4068
  layer?: number | undefined;
@@ -4056,6 +4070,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
4056
4070
  type: "SOLIDREGION";
4057
4071
  points: any[];
4058
4072
  layermask: number;
4073
+ pathData: string;
4059
4074
  id?: string | undefined;
4060
4075
  layer?: number | undefined;
4061
4076
  fillStyle?: string | undefined;
@@ -4339,6 +4354,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
4339
4354
  y: number;
4340
4355
  }[];
4341
4356
  layermask: number;
4357
+ pathData: string;
4342
4358
  fillStyle: string;
4343
4359
  id?: string | undefined;
4344
4360
  layer?: number | undefined;
@@ -4534,6 +4550,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
4534
4550
  y: number;
4535
4551
  }[];
4536
4552
  layermask: number;
4553
+ pathData: string;
4537
4554
  fillStyle: string;
4538
4555
  id?: string | undefined;
4539
4556
  layer?: number | undefined;
@@ -4801,9 +4818,9 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
4801
4818
  y: number;
4802
4819
  };
4803
4820
  radius: number;
4821
+ pathData: string;
4804
4822
  lineWidth: number;
4805
4823
  sweepFlag: boolean;
4806
- pathData: string;
4807
4824
  color: string;
4808
4825
  } | {
4809
4826
  path: string;
@@ -4982,6 +4999,7 @@ declare const EasyEdaJsonSchema: z.ZodObject<{
4982
4999
  y: number;
4983
5000
  }[];
4984
5001
  layermask: number;
5002
+ pathData: string;
4985
5003
  fillStyle: string;
4986
5004
  id?: string | undefined;
4987
5005
  layer?: number | undefined;
package/dist/index.js CHANGED
@@ -5607,9 +5607,9 @@ var insertionDirectionToVec = (direction) => {
5607
5607
  return { x: -1, y: 0 };
5608
5608
  case "from_right":
5609
5609
  return { x: 1, y: 0 };
5610
- case "from_front":
5610
+ case "from_top":
5611
5611
  return { x: 0, y: 1 };
5612
- case "from_back":
5612
+ case "from_bottom":
5613
5613
  return { x: 0, y: -1 };
5614
5614
  }
5615
5615
  };
@@ -5619,11 +5619,15 @@ var vecToInsertionDirection = ({
5619
5619
  }) => {
5620
5620
  if (x > 0) return "from_right";
5621
5621
  if (x < 0) return "from_left";
5622
- if (y > 0) return "from_front";
5623
- return "from_back";
5622
+ if (y > 0) return "from_top";
5623
+ return "from_bottom";
5624
5624
  };
5625
5625
  var transformInsertionDirection = (direction, opts) => {
5626
- if (!direction || direction === "from_above") return direction;
5626
+ if (!direction) return direction;
5627
+ if (direction === "from_above" || direction === "from_below") {
5628
+ if (!opts.isFlipped) return direction;
5629
+ return direction === "from_above" ? "from_below" : "from_above";
5630
+ }
5627
5631
  let { x, y } = insertionDirectionToVec(direction);
5628
5632
  let quarterTurns = Math.round(opts.rotationDegrees / 90);
5629
5633
  while (quarterTurns > 0) {
@@ -5646,7 +5650,7 @@ var transformPCBElement = (elm, matrix) => {
5646
5650
  const flipPadWidthHeight = Math.abs(getQuarterTurns(tsr.rotation.angle)) % 2 === 1;
5647
5651
  const rotationDegrees = tsr.rotation.angle / Math.PI * 180;
5648
5652
  const isFlipped = tsr.scale.sy < 0;
5649
- if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
5653
+ if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_solder_paste" || elm.type === "pcb_port") {
5650
5654
  const { x, y } = applyToPoint(matrix, {
5651
5655
  x: Number(elm.x),
5652
5656
  y: Number(elm.y)
@@ -5666,10 +5670,14 @@ var transformPCBElement = (elm, matrix) => {
5666
5670
  elm.center = applyToPoint(matrix, elm.center);
5667
5671
  } else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text" || elm.type === "pcb_note_text") {
5668
5672
  elm.anchor_position = applyToPoint(matrix, elm.anchor_position);
5673
+ } else if (elm.type === "pcb_copper_text") {
5674
+ if (elm.anchor_position) {
5675
+ elm.anchor_position = applyToPoint(matrix, elm.anchor_position);
5676
+ }
5669
5677
  } else if (elm.type === "pcb_courtyard_rect") {
5670
5678
  elm.center = applyToPoint(matrix, elm.center);
5671
5679
  elm.ccw_rotation = ((elm.ccw_rotation ?? 0) + rotationDegrees) % 360;
5672
- } else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_circle") {
5680
+ } else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_silkscreen_pill" || elm.type === "pcb_silkscreen_oval" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_circle") {
5673
5681
  elm.center = applyToPoint(matrix, elm.center);
5674
5682
  } else if (elm.type === "pcb_component") {
5675
5683
  elm.center = applyToPoint(matrix, elm.center);
@@ -5706,7 +5714,19 @@ var transformPCBElement = (elm, matrix) => {
5706
5714
  p.y = tp.y;
5707
5715
  return p;
5708
5716
  });
5709
- } else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace" || elm.type === "pcb_fabrication_note_path" || elm.type === "pcb_note_path") {
5717
+ } else if (elm.type === "pcb_trace") {
5718
+ elm.route = elm.route.map((rp) => {
5719
+ if (!("x" in rp)) {
5720
+ rp.start = applyToPoint(matrix, rp.start);
5721
+ rp.end = applyToPoint(matrix, rp.end);
5722
+ return rp;
5723
+ }
5724
+ const tp = applyToPoint(matrix, rp);
5725
+ rp.x = tp.x;
5726
+ rp.y = tp.y;
5727
+ return rp;
5728
+ });
5729
+ } else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace_hint" || elm.type === "pcb_fabrication_note_path" || elm.type === "pcb_note_path") {
5710
5730
  elm.route = elm.route.map((rp) => {
5711
5731
  const tp = applyToPoint(matrix, rp);
5712
5732
  rp.x = tp.x;
@@ -5739,7 +5759,7 @@ var transformPCBElements = (elms, matrix) => {
5739
5759
  let transformedElms = elms.map((elm) => transformPCBElement(elm, matrix));
5740
5760
  if (flipPadWidthHeight) {
5741
5761
  transformedElms = transformedElms.map((elm) => {
5742
- if (elm.type === "pcb_smtpad" && (elm.shape === "rect" || elm.shape === "pill")) {
5762
+ if ((elm.type === "pcb_smtpad" || elm.type === "pcb_solder_paste") && (elm.shape === "rect" || elm.shape === "pill")) {
5743
5763
  ;
5744
5764
  [elm.width, elm.height] = [elm.height, elm.width];
5745
5765
  }
@@ -5894,7 +5914,10 @@ var getDebugLayoutObject = (lo) => {
5894
5914
  const content = lo;
5895
5915
  if (x === void 0 || y === void 0) return null;
5896
5916
  if (width === void 0) {
5897
- if ("outer_diameter" in lo) {
5917
+ if ("radius" in lo) {
5918
+ width = lo.radius * 2;
5919
+ height = lo.radius * 2;
5920
+ } else if ("outer_diameter" in lo) {
5898
5921
  width = lo.outer_diameter;
5899
5922
  height = lo.outer_diameter;
5900
5923
  } else if ("rect_pad_width" in lo && "rect_pad_height" in lo) {
@@ -5949,6 +5972,17 @@ var findBoundsAndCenter = (elements) => {
5949
5972
  const center = { x: minX + width / 2, y: minY + height / 2 };
5950
5973
  return { center, width, height };
5951
5974
  };
5975
+ var PIN1_LOCATION_PARTS = {
5976
+ leftside_top: { side: "leftside", alignment: "top" },
5977
+ leftside_bottom: { side: "leftside", alignment: "bottom" },
5978
+ rightside_top: { side: "rightside", alignment: "top" },
5979
+ rightside_bottom: { side: "rightside", alignment: "bottom" },
5980
+ topside_left: { side: "topside", alignment: "left" },
5981
+ topside_right: { side: "topside", alignment: "right" },
5982
+ bottomside_left: { side: "bottomside", alignment: "left" },
5983
+ bottomside_right: { side: "bottomside", alignment: "right" }
5984
+ };
5985
+ var PIN1_LOCATIONS = Object.keys(PIN1_LOCATION_PARTS);
5952
5986
 
5953
5987
  // node_modules/@tscircuit/mm/dist/index.js
5954
5988
  var unitToMm = {
@@ -6440,6 +6474,62 @@ var handleFabricationNotePath = (track, index) => pcb_fabrication_note_path.pars
6440
6474
  })),
6441
6475
  stroke_width: mil10ToMm(track.width)
6442
6476
  });
6477
+ var handleFabricationNoteSolidRegion = (solidRegion, index) => {
6478
+ const rawRoute = [];
6479
+ let currentPoint;
6480
+ for (const commandMatch of solidRegion.pathData.matchAll(
6481
+ /([MLAZ])([^MLAZ]*)/gi
6482
+ )) {
6483
+ const command = commandMatch[1]?.toUpperCase();
6484
+ const values = commandMatch[2]?.match(/[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/g)?.map(Number) ?? [];
6485
+ if ((command === "M" || command === "L") && values.length >= 2) {
6486
+ currentPoint = { x: values[0], y: values[1] };
6487
+ rawRoute.push(currentPoint);
6488
+ } else if (command === "A" && currentPoint && values.length >= 7) {
6489
+ const [radiusX, , , largeArcFlag, sweepFlag, endX, endY] = values;
6490
+ const generatedArcRoute = generateArcFromSweep(
6491
+ currentPoint.x,
6492
+ currentPoint.y,
6493
+ endX,
6494
+ endY,
6495
+ radiusX,
6496
+ largeArcFlag === 1,
6497
+ sweepFlag === 1
6498
+ );
6499
+ const maxArcSegments = 16;
6500
+ const arcRoute = generatedArcRoute.length <= maxArcSegments + 1 ? generatedArcRoute : Array.from(
6501
+ { length: maxArcSegments + 1 },
6502
+ (_, pointIndex) => generatedArcRoute.at(
6503
+ Math.round(
6504
+ pointIndex * (generatedArcRoute.length - 1) / maxArcSegments
6505
+ )
6506
+ )
6507
+ ).filter((point2) => !!point2);
6508
+ rawRoute.push(...arcRoute.slice(1));
6509
+ currentPoint = { x: endX, y: endY };
6510
+ }
6511
+ }
6512
+ const route = rawRoute.map((point2) => ({
6513
+ x: mil10ToMm(point2.x),
6514
+ y: mil10ToMm(point2.y)
6515
+ }));
6516
+ const firstPoint = route[0];
6517
+ const lastPoint = route.at(-1);
6518
+ if (firstPoint && lastPoint && (firstPoint.x !== lastPoint.x || firstPoint.y !== lastPoint.y)) {
6519
+ route.push({ ...firstPoint });
6520
+ }
6521
+ if (route.length < 2) return null;
6522
+ return pcb_fabrication_note_path.parse({
6523
+ type: "pcb_fabrication_note_path",
6524
+ pcb_fabrication_note_path_id: `pcb_fabrication_note_solid_region_${index + 1}`,
6525
+ pcb_component_id: "pcb_component_1",
6526
+ layer: "top",
6527
+ route,
6528
+ // EasyEDA solid regions have no stroke width. Use its standard 1-unit
6529
+ // document stroke so the closed region remains visible as a note path.
6530
+ stroke_width: mil10ToMm(1)
6531
+ });
6532
+ };
6443
6533
  var getSideFromLayer = (layer) => {
6444
6534
  if (layer === 4 || layer === 14) return "bottom";
6445
6535
  return "top";
@@ -6466,24 +6556,17 @@ var handleSilkscreenArc = (arc, index) => {
6466
6556
  stroke_width: mil10ToMm(arc.width)
6467
6557
  });
6468
6558
  };
6469
- var SILKSCREEN_CIRCLE_SEGMENTS = 24;
6470
6559
  var handleSilkscreenCircle = (circle, index) => {
6471
- const route = Array.from(
6472
- { length: SILKSCREEN_CIRCLE_SEGMENTS + 1 },
6473
- (_, segmentIndex) => {
6474
- const angle = Math.PI * 2 * segmentIndex / SILKSCREEN_CIRCLE_SEGMENTS;
6475
- return {
6476
- x: milx10(circle.center.x + Math.cos(angle) * circle.radius),
6477
- y: milx10(circle.center.y + Math.sin(angle) * circle.radius)
6478
- };
6479
- }
6480
- );
6481
- return pcb_silkscreen_path.parse({
6482
- type: "pcb_silkscreen_path",
6483
- pcb_silkscreen_path_id: `pcb_silkscreen_circle_${index + 1}`,
6560
+ return pcb_silkscreen_circle.parse({
6561
+ type: "pcb_silkscreen_circle",
6562
+ pcb_silkscreen_circle_id: `pcb_silkscreen_circle_${index + 1}`,
6484
6563
  pcb_component_id: "pcb_component_1",
6485
6564
  layer: getSideFromLayer(circle.layer),
6486
- route,
6565
+ center: {
6566
+ x: milx10(circle.center.x),
6567
+ y: milx10(circle.center.y)
6568
+ },
6569
+ radius: milx10(circle.radius),
6487
6570
  stroke_width: mil10ToMm(circle.width)
6488
6571
  });
6489
6572
  };
@@ -6817,6 +6900,9 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
6817
6900
  } else if (isDocumentLayer(shape.layer)) {
6818
6901
  circuitElements.push(handleFabricationNotePath(shape, index));
6819
6902
  }
6903
+ } else if (shape.type === "SOLIDREGION" && isDocumentLayer(shape.layermask)) {
6904
+ const fabricationNote = handleFabricationNoteSolidRegion(shape, index);
6905
+ if (fabricationNote) circuitElements.push(fabricationNote);
6820
6906
  } else if (shape.type === "CIRCLE") {
6821
6907
  if (isSilkscreenLayer(shape.layer)) {
6822
6908
  circuitElements.push(handleSilkscreenCircle(shape, index));
@@ -6883,7 +6969,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
6883
6969
  );
6884
6970
  }
6885
6971
  const pcbElements = circuitElements.filter(
6886
- (e) => e.type === "pcb_smtpad" || e.type === "pcb_plated_hole" || e.type === "pcb_hole" || e.type === "pcb_via" || e.type === "pcb_courtyard_outline" || e.type === "pcb_courtyard_rect" || e.type === "pcb_silkscreen_path" || e.type === "pcb_silkscreen_rect" || e.type === "pcb_silkscreen_text"
6972
+ (e) => e.type === "pcb_smtpad" || e.type === "pcb_plated_hole" || e.type === "pcb_hole" || e.type === "pcb_via" || e.type === "pcb_courtyard_outline" || e.type === "pcb_courtyard_rect" || e.type === "pcb_silkscreen_path" || e.type === "pcb_silkscreen_circle" || e.type === "pcb_silkscreen_rect" || e.type === "pcb_silkscreen_text"
6887
6973
  );
6888
6974
  if (pcbElements.length > 0) {
6889
6975
  const bounds = findBoundsAndCenter(pcbElements);
@@ -6950,7 +7036,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
6950
7036
  }
6951
7037
  if (shouldRecenter) {
6952
7038
  const elementsForBounds = circuitElements.filter(
6953
- (e) => e.type !== "pcb_component" && e.type !== "cad_component"
7039
+ (e) => e.type !== "pcb_component" && e.type !== "cad_component" && e.type !== "pcb_silkscreen_circle"
6954
7040
  );
6955
7041
  const bounds = findBoundsAndCenter(elementsForBounds);
6956
7042
  if (Number.isFinite(bounds.center.x) && Number.isFinite(bounds.center.y)) {
@@ -7304,6 +7390,7 @@ var CircleSchema = BaseShapeSchema.extend({
7304
7390
  var SolidRegionSchema = BaseShapeSchema.extend({
7305
7391
  type: z193.literal("SOLIDREGION"),
7306
7392
  layermask: z193.number(),
7393
+ pathData: z193.string(),
7307
7394
  points: z193.array(PointSchema),
7308
7395
  fillStyle: z193.string().default("none")
7309
7396
  });
@@ -7498,6 +7585,7 @@ var ShapeItemSchema = z193.object({
7498
7585
  return SolidRegionSchema.parse({
7499
7586
  type: "SOLIDREGION",
7500
7587
  layermask: Number(layermask),
7588
+ pathData,
7501
7589
  points,
7502
7590
  fillStyle: fillStyle || void 0,
7503
7591
  id
@@ -8151,15 +8239,27 @@ var mapPortHints = (portHints, portHintsMap) => {
8151
8239
  if (!portHintsMap || !portHints) return portHints;
8152
8240
  return [...new Set(portHints.flatMap((hint) => portHintsMap[hint] ?? [hint]))];
8153
8241
  };
8242
+ var getLayerAttr = (layer) => layer && layer !== "top" ? ` layer="${layer}"` : "";
8243
+ var getRotationAttr = (rotation2) => rotation2 ? ` pcbRotation="${rotation2}deg"` : "";
8244
+ var getStringAttr = (name, value) => value === void 0 ? "" : ` ${name}=${JSON.stringify(value)}`;
8154
8245
  var generateFootprintTsx = (circuitJson, options = {}) => {
8155
8246
  const holes = su(circuitJson).pcb_hole.list();
8156
8247
  const platedHoles = su(circuitJson).pcb_plated_hole.list();
8157
8248
  const smtPads = su(circuitJson).pcb_smtpad.list();
8158
8249
  const vias = su(circuitJson).pcb_via.list();
8159
8250
  const silkscreenPaths = su(circuitJson).pcb_silkscreen_path.list();
8251
+ const silkscreenCircles = su(circuitJson).pcb_silkscreen_circle.list();
8160
8252
  const silkscreenRects = su(circuitJson).pcb_silkscreen_rect.list();
8161
8253
  const silkscreenTexts = su(circuitJson).pcb_silkscreen_text.list();
8162
8254
  const fabricationNotePaths = su(circuitJson).pcb_fabrication_note_path.list();
8255
+ const fabricationNoteTexts = su(circuitJson).pcb_fabrication_note_text.list();
8256
+ const fabricationNoteRects = su(circuitJson).pcb_fabrication_note_rect.list();
8257
+ const fabricationNoteDimensions = su(circuitJson).pcb_fabrication_note_dimension.list();
8258
+ const pcbNoteTexts = su(circuitJson).pcb_note_text.list();
8259
+ const pcbNoteRects = su(circuitJson).pcb_note_rect.list();
8260
+ const pcbNotePaths = su(circuitJson).pcb_note_path.list();
8261
+ const pcbNoteLines = su(circuitJson).pcb_note_line.list();
8262
+ const pcbNoteDimensions = su(circuitJson).pcb_note_dimension.list();
8163
8263
  const courtyardOutlines = su(circuitJson).pcb_courtyard_outline.list();
8164
8264
  const elementStrings = [];
8165
8265
  for (const hole of holes) {
@@ -8227,6 +8327,11 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
8227
8327
  `<silkscreenpath route={${JSON.stringify(silkscreenPath.route)}} />`
8228
8328
  );
8229
8329
  }
8330
+ for (const silkscreenCircle of silkscreenCircles) {
8331
+ elementStrings.push(
8332
+ `<silkscreencircle pcbX="${mmStr(silkscreenCircle.center.x)}" pcbY="${mmStr(silkscreenCircle.center.y)}" radius="${mmStr(silkscreenCircle.radius)}" />`
8333
+ );
8334
+ }
8230
8335
  for (const silkscreenRect of silkscreenRects) {
8231
8336
  const rotation2 = silkscreenRect.ccw_rotation || 0;
8232
8337
  const rotationAttr = rotation2 ? ` pcbRotation="${rotation2}deg"` : "";
@@ -8247,7 +8352,49 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
8247
8352
  }
8248
8353
  for (const fabricationNotePath of fabricationNotePaths) {
8249
8354
  elementStrings.push(
8250
- `<fabricationnotepath route={${JSON.stringify(fabricationNotePath.route)}} strokeWidth="${mmStr(fabricationNotePath.stroke_width)}" />`
8355
+ `<fabricationnotepath route={${JSON.stringify(fabricationNotePath.route)}} strokeWidth="${mmStr(fabricationNotePath.stroke_width)}"${getStringAttr("color", fabricationNotePath.color)}${getLayerAttr(fabricationNotePath.layer)} />`
8356
+ );
8357
+ }
8358
+ for (const fabricationNoteText of fabricationNoteTexts) {
8359
+ elementStrings.push(
8360
+ `<fabricationnotetext text=${JSON.stringify(fabricationNoteText.text)} pcbX="${mmStr(fabricationNoteText.anchor_position.x)}" pcbY="${mmStr(fabricationNoteText.anchor_position.y)}" anchorAlignment="${fabricationNoteText.anchor_alignment}"${getStringAttr("font", fabricationNoteText.font)}${fabricationNoteText.font_size === void 0 ? "" : ` fontSize="${mmStr(fabricationNoteText.font_size)}"`}${getStringAttr("color", fabricationNoteText.color)}${getRotationAttr(fabricationNoteText.ccw_rotation)}${getLayerAttr(fabricationNoteText.layer)} />`
8361
+ );
8362
+ }
8363
+ for (const fabricationNoteRect of fabricationNoteRects) {
8364
+ elementStrings.push(
8365
+ `<fabricationnoterect pcbX="${mmStr(fabricationNoteRect.center.x)}" pcbY="${mmStr(fabricationNoteRect.center.y)}" width="${mmStr(fabricationNoteRect.width)}" height="${mmStr(fabricationNoteRect.height)}" strokeWidth="${mmStr(fabricationNoteRect.stroke_width)}"${fabricationNoteRect.corner_radius === void 0 ? "" : ` cornerRadius="${mmStr(fabricationNoteRect.corner_radius)}"`}${fabricationNoteRect.is_filled === void 0 ? "" : ` isFilled={${fabricationNoteRect.is_filled}}`}${fabricationNoteRect.has_stroke === void 0 ? "" : ` hasStroke={${fabricationNoteRect.has_stroke}}`}${fabricationNoteRect.is_stroke_dashed === void 0 ? "" : ` isStrokeDashed={${fabricationNoteRect.is_stroke_dashed}}`}${getStringAttr("color", fabricationNoteRect.color)}${getLayerAttr(fabricationNoteRect.layer)} />`
8366
+ );
8367
+ }
8368
+ for (const fabricationNoteDimension of fabricationNoteDimensions) {
8369
+ const offset = "offset" in fabricationNoteDimension ? fabricationNoteDimension.offset : fabricationNoteDimension.offset_distance;
8370
+ elementStrings.push(
8371
+ `<fabricationnotedimension from={${JSON.stringify(fabricationNoteDimension.from)}} to={${JSON.stringify(fabricationNoteDimension.to)}}${getStringAttr("text", fabricationNoteDimension.text)}${getStringAttr("font", fabricationNoteDimension.font)}${fabricationNoteDimension.font_size === void 0 ? "" : ` fontSize="${mmStr(fabricationNoteDimension.font_size)}"`}${fabricationNoteDimension.arrow_size === void 0 ? "" : ` arrowSize="${mmStr(fabricationNoteDimension.arrow_size)}"`}${offset === void 0 ? "" : ` offset="${mmStr(offset)}"`}${getStringAttr("color", fabricationNoteDimension.color)}${getLayerAttr(fabricationNoteDimension.layer)} />`
8372
+ );
8373
+ }
8374
+ for (const pcbNoteText of pcbNoteTexts) {
8375
+ elementStrings.push(
8376
+ `<pcbnotetext text=${JSON.stringify(pcbNoteText.text ?? "")} pcbX="${mmStr(pcbNoteText.anchor_position.x)}" pcbY="${mmStr(pcbNoteText.anchor_position.y)}" anchorAlignment="${pcbNoteText.anchor_alignment}"${getStringAttr("font", pcbNoteText.font)}${pcbNoteText.font_size === void 0 ? "" : ` fontSize="${mmStr(pcbNoteText.font_size)}"`}${getStringAttr("color", pcbNoteText.color)}${getLayerAttr(pcbNoteText.layer)} />`
8377
+ );
8378
+ }
8379
+ for (const pcbNoteRect of pcbNoteRects) {
8380
+ elementStrings.push(
8381
+ `<pcbnoterect pcbX="${mmStr(pcbNoteRect.center.x)}" pcbY="${mmStr(pcbNoteRect.center.y)}" width="${mmStr(pcbNoteRect.width)}" height="${mmStr(pcbNoteRect.height)}" strokeWidth="${mmStr(pcbNoteRect.stroke_width)}"${pcbNoteRect.corner_radius === void 0 ? "" : ` cornerRadius="${mmStr(pcbNoteRect.corner_radius)}"`}${pcbNoteRect.is_filled === void 0 ? "" : ` isFilled={${pcbNoteRect.is_filled}}`}${pcbNoteRect.has_stroke === void 0 ? "" : ` hasStroke={${pcbNoteRect.has_stroke}}`}${pcbNoteRect.is_stroke_dashed === void 0 ? "" : ` isStrokeDashed={${pcbNoteRect.is_stroke_dashed}}`}${getStringAttr("color", pcbNoteRect.color)}${getLayerAttr(pcbNoteRect.layer)} />`
8382
+ );
8383
+ }
8384
+ for (const pcbNotePath of pcbNotePaths) {
8385
+ elementStrings.push(
8386
+ `<pcbnotepath route={${JSON.stringify(pcbNotePath.route)}} strokeWidth="${mmStr(pcbNotePath.stroke_width)}"${getStringAttr("color", pcbNotePath.color)}${getLayerAttr(pcbNotePath.layer)} />`
8387
+ );
8388
+ }
8389
+ for (const pcbNoteLine of pcbNoteLines) {
8390
+ elementStrings.push(
8391
+ `<pcbnoteline x1="${mmStr(pcbNoteLine.x1)}" y1="${mmStr(pcbNoteLine.y1)}" x2="${mmStr(pcbNoteLine.x2)}" y2="${mmStr(pcbNoteLine.y2)}" strokeWidth="${mmStr(pcbNoteLine.stroke_width)}"${pcbNoteLine.is_dashed === void 0 ? "" : ` isDashed={${pcbNoteLine.is_dashed}}`}${getStringAttr("color", pcbNoteLine.color)}${getLayerAttr(pcbNoteLine.layer)} />`
8392
+ );
8393
+ }
8394
+ for (const pcbNoteDimension of pcbNoteDimensions) {
8395
+ const offset = pcbNoteDimension.offset_distance;
8396
+ elementStrings.push(
8397
+ `<pcbnotedimension from={${JSON.stringify(pcbNoteDimension.from)}} to={${JSON.stringify(pcbNoteDimension.to)}}${getStringAttr("text", pcbNoteDimension.text)}${getStringAttr("font", pcbNoteDimension.font)}${pcbNoteDimension.font_size === void 0 ? "" : ` fontSize="${mmStr(pcbNoteDimension.font_size)}"`}${pcbNoteDimension.arrow_size === void 0 ? "" : ` arrowSize="${mmStr(pcbNoteDimension.arrow_size)}"`}${offset === void 0 ? "" : ` offset="${mmStr(offset)}"`}${getStringAttr("color", pcbNoteDimension.color)}${getLayerAttr(pcbNoteDimension.layer)} />`
8251
8398
  );
8252
8399
  }
8253
8400
  for (const courtyardOutline of courtyardOutlines) {