@tscircuit/3d-viewer 0.0.372 → 0.0.373

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.
Files changed (2) hide show
  1. package/dist/index.js +382 -231
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -144,8 +144,8 @@ var require_dist = __commonJS({
144
144
  fromValues: (x, y) => [x, y]
145
145
  },
146
146
  vec3: {
147
- create: (x, y, z103) => [x, y, z103],
148
- fromValues: (x, y, z103) => [x, y, z103]
147
+ create: (x, y, z105) => [x, y, z105],
148
+ fromValues: (x, y, z105) => [x, y, z105]
149
149
  }
150
150
  },
151
151
  geometries: {
@@ -532,29 +532,29 @@ var require_fromRotation = __commonJS({
532
532
  var { sin: sin2, cos: cos2 } = require_trigonometry();
533
533
  var identity = require_identity();
534
534
  var fromRotation = (out, rad, axis) => {
535
- let [x, y, z103] = axis;
536
- const lengthSquared = x * x + y * y + z103 * z103;
535
+ let [x, y, z105] = axis;
536
+ const lengthSquared = x * x + y * y + z105 * z105;
537
537
  if (Math.abs(lengthSquared) < EPS) {
538
538
  return identity(out);
539
539
  }
540
540
  const len = 1 / Math.sqrt(lengthSquared);
541
541
  x *= len;
542
542
  y *= len;
543
- z103 *= len;
543
+ z105 *= len;
544
544
  const s = sin2(rad);
545
545
  const c = cos2(rad);
546
546
  const t = 1 - c;
547
547
  out[0] = x * x * t + c;
548
- out[1] = y * x * t + z103 * s;
549
- out[2] = z103 * x * t - y * s;
548
+ out[1] = y * x * t + z105 * s;
549
+ out[2] = z105 * x * t - y * s;
550
550
  out[3] = 0;
551
- out[4] = x * y * t - z103 * s;
551
+ out[4] = x * y * t - z105 * s;
552
552
  out[5] = y * y * t + c;
553
- out[6] = z103 * y * t + x * s;
553
+ out[6] = z105 * y * t + x * s;
554
554
  out[7] = 0;
555
- out[8] = x * z103 * t + y * s;
556
- out[9] = y * z103 * t - x * s;
557
- out[10] = z103 * z103 * t + c;
555
+ out[8] = x * z105 * t + y * s;
556
+ out[9] = y * z105 * t - x * s;
557
+ out[10] = z105 * z105 * t + c;
558
558
  out[11] = 0;
559
559
  out[12] = 0;
560
560
  out[13] = 0;
@@ -808,8 +808,8 @@ var require_distance = __commonJS({
808
808
  var distance2 = (a, b) => {
809
809
  const x = b[0] - a[0];
810
810
  const y = b[1] - a[1];
811
- const z103 = b[2] - a[2];
812
- return Math.sqrt(x * x + y * y + z103 * z103);
811
+ const z105 = b[2] - a[2];
812
+ return Math.sqrt(x * x + y * y + z105 * z105);
813
813
  };
814
814
  module.exports = distance2;
815
815
  }
@@ -857,11 +857,11 @@ var require_fromValues2 = __commonJS({
857
857
  "node_modules/@jscad/modeling/src/maths/vec3/fromValues.js"(exports, module) {
858
858
  "use strict";
859
859
  var create = require_create2();
860
- var fromValues = (x, y, z103) => {
860
+ var fromValues = (x, y, z105) => {
861
861
  const out = create();
862
862
  out[0] = x;
863
863
  out[1] = y;
864
- out[2] = z103;
864
+ out[2] = z105;
865
865
  return out;
866
866
  };
867
867
  module.exports = fromValues;
@@ -872,10 +872,10 @@ var require_fromValues2 = __commonJS({
872
872
  var require_fromVec2 = __commonJS({
873
873
  "node_modules/@jscad/modeling/src/maths/vec3/fromVec2.js"(exports, module) {
874
874
  "use strict";
875
- var fromVector2 = (out, vector, z103 = 0) => {
875
+ var fromVector2 = (out, vector, z105 = 0) => {
876
876
  out[0] = vector[0];
877
877
  out[1] = vector[1];
878
- out[2] = z103;
878
+ out[2] = z105;
879
879
  return out;
880
880
  };
881
881
  module.exports = fromVector2;
@@ -889,8 +889,8 @@ var require_length = __commonJS({
889
889
  var length2 = (vector) => {
890
890
  const x = vector[0];
891
891
  const y = vector[1];
892
- const z103 = vector[2];
893
- return Math.sqrt(x * x + y * y + z103 * z103);
892
+ const z105 = vector[2];
893
+ return Math.sqrt(x * x + y * y + z105 * z105);
894
894
  };
895
895
  module.exports = length2;
896
896
  }
@@ -973,14 +973,14 @@ var require_normalize = __commonJS({
973
973
  var normalize = (out, vector) => {
974
974
  const x = vector[0];
975
975
  const y = vector[1];
976
- const z103 = vector[2];
977
- let len = x * x + y * y + z103 * z103;
976
+ const z105 = vector[2];
977
+ let len = x * x + y * y + z105 * z105;
978
978
  if (len > 0) {
979
979
  len = 1 / Math.sqrt(len);
980
980
  }
981
981
  out[0] = x * len;
982
982
  out[1] = y * len;
983
- out[2] = z103 * len;
983
+ out[2] = z105 * len;
984
984
  return out;
985
985
  };
986
986
  module.exports = normalize;
@@ -1104,8 +1104,8 @@ var require_squaredDistance = __commonJS({
1104
1104
  var squaredDistance = (a, b) => {
1105
1105
  const x = b[0] - a[0];
1106
1106
  const y = b[1] - a[1];
1107
- const z103 = b[2] - a[2];
1108
- return x * x + y * y + z103 * z103;
1107
+ const z105 = b[2] - a[2];
1108
+ return x * x + y * y + z105 * z105;
1109
1109
  };
1110
1110
  module.exports = squaredDistance;
1111
1111
  }
@@ -1118,8 +1118,8 @@ var require_squaredLength = __commonJS({
1118
1118
  var squaredLength = (vector) => {
1119
1119
  const x = vector[0];
1120
1120
  const y = vector[1];
1121
- const z103 = vector[2];
1122
- return x * x + y * y + z103 * z103;
1121
+ const z105 = vector[2];
1122
+ return x * x + y * y + z105 * z105;
1123
1123
  };
1124
1124
  module.exports = squaredLength;
1125
1125
  }
@@ -1155,12 +1155,12 @@ var require_transform = __commonJS({
1155
1155
  var transform2 = (out, vector, matrix) => {
1156
1156
  const x = vector[0];
1157
1157
  const y = vector[1];
1158
- const z103 = vector[2];
1159
- let w = matrix[3] * x + matrix[7] * y + matrix[11] * z103 + matrix[15];
1158
+ const z105 = vector[2];
1159
+ let w = matrix[3] * x + matrix[7] * y + matrix[11] * z105 + matrix[15];
1160
1160
  w = w || 1;
1161
- out[0] = (matrix[0] * x + matrix[4] * y + matrix[8] * z103 + matrix[12]) / w;
1162
- out[1] = (matrix[1] * x + matrix[5] * y + matrix[9] * z103 + matrix[13]) / w;
1163
- out[2] = (matrix[2] * x + matrix[6] * y + matrix[10] * z103 + matrix[14]) / w;
1161
+ out[0] = (matrix[0] * x + matrix[4] * y + matrix[8] * z105 + matrix[12]) / w;
1162
+ out[1] = (matrix[1] * x + matrix[5] * y + matrix[9] * z105 + matrix[13]) / w;
1163
+ out[2] = (matrix[2] * x + matrix[6] * y + matrix[10] * z105 + matrix[14]) / w;
1164
1164
  return out;
1165
1165
  };
1166
1166
  module.exports = transform2;
@@ -1362,8 +1362,8 @@ var require_isMirroring = __commonJS({
1362
1362
  var isMirroring = (matrix) => {
1363
1363
  const x = matrix[4] * matrix[9] - matrix[8] * matrix[5];
1364
1364
  const y = matrix[8] * matrix[1] - matrix[0] * matrix[9];
1365
- const z103 = matrix[0] * matrix[5] - matrix[4] * matrix[1];
1366
- const d = x * matrix[2] + y * matrix[6] + z103 * matrix[10];
1365
+ const z105 = matrix[0] * matrix[5] - matrix[4] * matrix[1];
1366
+ const d = x * matrix[2] + y * matrix[6] + z105 * matrix[10];
1367
1367
  return d < 0;
1368
1368
  };
1369
1369
  module.exports = isMirroring;
@@ -1465,15 +1465,15 @@ var require_rotate = __commonJS({
1465
1465
  var { sin: sin2, cos: cos2 } = require_trigonometry();
1466
1466
  var copy = require_copy();
1467
1467
  var rotate2 = (out, matrix, radians, axis) => {
1468
- let [x, y, z103] = axis;
1469
- const lengthSquared = x * x + y * y + z103 * z103;
1468
+ let [x, y, z105] = axis;
1469
+ const lengthSquared = x * x + y * y + z105 * z105;
1470
1470
  if (Math.abs(lengthSquared) < EPS) {
1471
1471
  return copy(out, matrix);
1472
1472
  }
1473
1473
  const len = 1 / Math.sqrt(lengthSquared);
1474
1474
  x *= len;
1475
1475
  y *= len;
1476
- z103 *= len;
1476
+ z105 *= len;
1477
1477
  const s = sin2(radians);
1478
1478
  const c = cos2(radians);
1479
1479
  const t = 1 - c;
@@ -1490,14 +1490,14 @@ var require_rotate = __commonJS({
1490
1490
  const a22 = matrix[10];
1491
1491
  const a23 = matrix[11];
1492
1492
  const b00 = x * x * t + c;
1493
- const b01 = y * x * t + z103 * s;
1494
- const b02 = z103 * x * t - y * s;
1495
- const b10 = x * y * t - z103 * s;
1493
+ const b01 = y * x * t + z105 * s;
1494
+ const b02 = z105 * x * t - y * s;
1495
+ const b10 = x * y * t - z105 * s;
1496
1496
  const b11 = y * y * t + c;
1497
- const b12 = z103 * y * t + x * s;
1498
- const b20 = x * z103 * t + y * s;
1499
- const b21 = y * z103 * t - x * s;
1500
- const b22 = z103 * z103 * t + c;
1497
+ const b12 = z105 * y * t + x * s;
1498
+ const b20 = x * z105 * t + y * s;
1499
+ const b21 = y * z105 * t - x * s;
1500
+ const b22 = z105 * z105 * t + c;
1501
1501
  out[0] = a00 * b00 + a10 * b01 + a20 * b02;
1502
1502
  out[1] = a01 * b00 + a11 * b01 + a21 * b02;
1503
1503
  out[2] = a02 * b00 + a12 * b01 + a22 * b02;
@@ -1649,7 +1649,7 @@ var require_scale2 = __commonJS({
1649
1649
  var scale2 = (out, matrix, dimensions) => {
1650
1650
  const x = dimensions[0];
1651
1651
  const y = dimensions[1];
1652
- const z103 = dimensions[2];
1652
+ const z105 = dimensions[2];
1653
1653
  out[0] = matrix[0] * x;
1654
1654
  out[1] = matrix[1] * x;
1655
1655
  out[2] = matrix[2] * x;
@@ -1658,10 +1658,10 @@ var require_scale2 = __commonJS({
1658
1658
  out[5] = matrix[5] * y;
1659
1659
  out[6] = matrix[6] * y;
1660
1660
  out[7] = matrix[7] * y;
1661
- out[8] = matrix[8] * z103;
1662
- out[9] = matrix[9] * z103;
1663
- out[10] = matrix[10] * z103;
1664
- out[11] = matrix[11] * z103;
1661
+ out[8] = matrix[8] * z105;
1662
+ out[9] = matrix[9] * z105;
1663
+ out[10] = matrix[10] * z105;
1664
+ out[11] = matrix[11] * z105;
1665
1665
  out[12] = matrix[12];
1666
1666
  out[13] = matrix[13];
1667
1667
  out[14] = matrix[14];
@@ -1715,7 +1715,7 @@ var require_translate = __commonJS({
1715
1715
  var translate5 = (out, matrix, offsets) => {
1716
1716
  const x = offsets[0];
1717
1717
  const y = offsets[1];
1718
- const z103 = offsets[2];
1718
+ const z105 = offsets[2];
1719
1719
  let a00;
1720
1720
  let a01;
1721
1721
  let a02;
@@ -1729,10 +1729,10 @@ var require_translate = __commonJS({
1729
1729
  let a22;
1730
1730
  let a23;
1731
1731
  if (matrix === out) {
1732
- out[12] = matrix[0] * x + matrix[4] * y + matrix[8] * z103 + matrix[12];
1733
- out[13] = matrix[1] * x + matrix[5] * y + matrix[9] * z103 + matrix[13];
1734
- out[14] = matrix[2] * x + matrix[6] * y + matrix[10] * z103 + matrix[14];
1735
- out[15] = matrix[3] * x + matrix[7] * y + matrix[11] * z103 + matrix[15];
1732
+ out[12] = matrix[0] * x + matrix[4] * y + matrix[8] * z105 + matrix[12];
1733
+ out[13] = matrix[1] * x + matrix[5] * y + matrix[9] * z105 + matrix[13];
1734
+ out[14] = matrix[2] * x + matrix[6] * y + matrix[10] * z105 + matrix[14];
1735
+ out[15] = matrix[3] * x + matrix[7] * y + matrix[11] * z105 + matrix[15];
1736
1736
  } else {
1737
1737
  a00 = matrix[0];
1738
1738
  a01 = matrix[1];
@@ -1758,10 +1758,10 @@ var require_translate = __commonJS({
1758
1758
  out[9] = a21;
1759
1759
  out[10] = a22;
1760
1760
  out[11] = a23;
1761
- out[12] = a00 * x + a10 * y + a20 * z103 + matrix[12];
1762
- out[13] = a01 * x + a11 * y + a21 * z103 + matrix[13];
1763
- out[14] = a02 * x + a12 * y + a22 * z103 + matrix[14];
1764
- out[15] = a03 * x + a13 * y + a23 * z103 + matrix[15];
1761
+ out[12] = a00 * x + a10 * y + a20 * z105 + matrix[12];
1762
+ out[13] = a01 * x + a11 * y + a21 * z105 + matrix[13];
1763
+ out[14] = a02 * x + a12 * y + a22 * z105 + matrix[14];
1764
+ out[15] = a03 * x + a13 * y + a23 * z105 + matrix[15];
1765
1765
  }
1766
1766
  return out;
1767
1767
  };
@@ -3831,11 +3831,11 @@ var require_fromValues4 = __commonJS({
3831
3831
  "node_modules/@jscad/modeling/src/maths/vec4/fromValues.js"(exports, module) {
3832
3832
  "use strict";
3833
3833
  var create = require_create7();
3834
- var fromValues = (x, y, z103, w) => {
3834
+ var fromValues = (x, y, z105, w) => {
3835
3835
  const out = create();
3836
3836
  out[0] = x;
3837
3837
  out[1] = y;
3838
- out[2] = z103;
3838
+ out[2] = z105;
3839
3839
  out[3] = w;
3840
3840
  return out;
3841
3841
  };
@@ -3993,8 +3993,8 @@ var require_projectionOfPoint = __commonJS({
3993
3993
  const a = point2[0] * plane[0] + point2[1] * plane[1] + point2[2] * plane[2] - plane[3];
3994
3994
  const x = point2[0] - a * plane[0];
3995
3995
  const y = point2[1] - a * plane[1];
3996
- const z103 = point2[2] - a * plane[2];
3997
- return vec3.fromValues(x, y, z103);
3996
+ const z105 = point2[2] - a * plane[2];
3997
+ return vec3.fromValues(x, y, z105);
3998
3998
  };
3999
3999
  module.exports = projectionOfPoint;
4000
4000
  }
@@ -4298,11 +4298,11 @@ var require_transform5 = __commonJS({
4298
4298
  "node_modules/@jscad/modeling/src/maths/vec4/transform.js"(exports, module) {
4299
4299
  "use strict";
4300
4300
  var transform2 = (out, vector, matrix) => {
4301
- const [x, y, z103, w] = vector;
4302
- out[0] = matrix[0] * x + matrix[4] * y + matrix[8] * z103 + matrix[12] * w;
4303
- out[1] = matrix[1] * x + matrix[5] * y + matrix[9] * z103 + matrix[13] * w;
4304
- out[2] = matrix[2] * x + matrix[6] * y + matrix[10] * z103 + matrix[14] * w;
4305
- out[3] = matrix[3] * x + matrix[7] * y + matrix[11] * z103 + matrix[15] * w;
4301
+ const [x, y, z105, w] = vector;
4302
+ out[0] = matrix[0] * x + matrix[4] * y + matrix[8] * z105 + matrix[12] * w;
4303
+ out[1] = matrix[1] * x + matrix[5] * y + matrix[9] * z105 + matrix[13] * w;
4304
+ out[2] = matrix[2] * x + matrix[6] * y + matrix[10] * z105 + matrix[14] * w;
4305
+ out[3] = matrix[3] * x + matrix[7] * y + matrix[11] * z105 + matrix[15] * w;
4306
4306
  return out;
4307
4307
  };
4308
4308
  module.exports = transform2;
@@ -4364,8 +4364,8 @@ var require_measureBoundingSphere = __commonJS({
4364
4364
  out[2] = (minz[2] + maxz[2]) * 0.5;
4365
4365
  const x = out[0] - maxx[0];
4366
4366
  const y = out[1] - maxy[1];
4367
- const z103 = out[2] - maxz[2];
4368
- out[3] = Math.sqrt(x * x + y * y + z103 * z103);
4367
+ const z105 = out[2] - maxz[2];
4368
+ out[3] = Math.sqrt(x * x + y * y + z105 * z105);
4369
4369
  cache.set(polygon2, out);
4370
4370
  return out;
4371
4371
  };
@@ -14655,7 +14655,7 @@ var import_jscad_planner = __toESM(require_dist(), 1);
14655
14655
  var import_modeling2 = __toESM(require_src(), 1);
14656
14656
 
14657
14657
  // node_modules/@tscircuit/footprinter/dist/index.js
14658
- import { z as z102 } from "zod";
14658
+ import { z as z104 } from "zod";
14659
14659
 
14660
14660
  // node_modules/@tscircuit/mm/dist/index.js
14661
14661
  var unitToMm = {
@@ -14785,6 +14785,8 @@ import { z as z98 } from "zod";
14785
14785
  import { z as z99 } from "zod";
14786
14786
  import { z as z100 } from "zod";
14787
14787
  import { z as z101 } from "zod";
14788
+ import { z as z102 } from "zod";
14789
+ import { z as z103 } from "zod";
14788
14790
  var unitMappings = {
14789
14791
  Hz: {
14790
14792
  baseUnit: "Hz",
@@ -16429,106 +16431,120 @@ var pcb_missing_footprint_error = z90.object({
16429
16431
  expectTypesMatch(
16430
16432
  true
16431
16433
  );
16432
- var pcb_group = z91.object({
16433
- type: z91.literal("pcb_group"),
16434
- pcb_group_id: getZodPrefixedIdWithDefault("pcb_group"),
16435
- source_group_id: z91.string(),
16436
- is_subcircuit: z91.boolean().optional(),
16434
+ var external_footprint_load_error = z91.object({
16435
+ type: z91.literal("external_footprint_load_error"),
16436
+ external_footprint_load_error_id: getZodPrefixedIdWithDefault(
16437
+ "external_footprint_load_error"
16438
+ ),
16439
+ pcb_component_id: z91.string(),
16440
+ source_component_id: z91.string(),
16441
+ pcb_group_id: z91.string().optional(),
16437
16442
  subcircuit_id: z91.string().optional(),
16443
+ footprinter_string: z91.string().optional(),
16444
+ error_type: z91.literal("external_footprint_load_error").default("external_footprint_load_error"),
16445
+ message: z91.string()
16446
+ }).describe("Defines an error when an external footprint fails to load");
16447
+ expectTypesMatch(true);
16448
+ var pcb_group = z92.object({
16449
+ type: z92.literal("pcb_group"),
16450
+ pcb_group_id: getZodPrefixedIdWithDefault("pcb_group"),
16451
+ source_group_id: z92.string(),
16452
+ is_subcircuit: z92.boolean().optional(),
16453
+ subcircuit_id: z92.string().optional(),
16438
16454
  width: length,
16439
16455
  height: length,
16440
16456
  center: point,
16441
- pcb_component_ids: z91.array(z91.string()),
16442
- name: z91.string().optional(),
16443
- description: z91.string().optional(),
16444
- layout_mode: z91.string().optional(),
16445
- autorouter_configuration: z91.object({
16457
+ pcb_component_ids: z92.array(z92.string()),
16458
+ name: z92.string().optional(),
16459
+ description: z92.string().optional(),
16460
+ layout_mode: z92.string().optional(),
16461
+ autorouter_configuration: z92.object({
16446
16462
  trace_clearance: length
16447
16463
  }).optional(),
16448
- autorouter_used_string: z91.string().optional()
16464
+ autorouter_used_string: z92.string().optional()
16449
16465
  }).describe("Defines a group of components on the PCB");
16450
16466
  expectTypesMatch(true);
16451
- var pcb_autorouting_error = z92.object({
16452
- type: z92.literal("pcb_autorouting_error"),
16467
+ var pcb_autorouting_error = z93.object({
16468
+ type: z93.literal("pcb_autorouting_error"),
16453
16469
  pcb_error_id: getZodPrefixedIdWithDefault("pcb_autorouting_error"),
16454
- error_type: z92.literal("pcb_autorouting_error").default("pcb_autorouting_error"),
16455
- message: z92.string(),
16456
- subcircuit_id: z92.string().optional()
16470
+ error_type: z93.literal("pcb_autorouting_error").default("pcb_autorouting_error"),
16471
+ message: z93.string(),
16472
+ subcircuit_id: z93.string().optional()
16457
16473
  }).describe("The autorouting has failed to route a portion of the board");
16458
16474
  expectTypesMatch(true);
16459
- var pcb_manual_edit_conflict_warning = z93.object({
16460
- type: z93.literal("pcb_manual_edit_conflict_warning"),
16475
+ var pcb_manual_edit_conflict_warning = z94.object({
16476
+ type: z94.literal("pcb_manual_edit_conflict_warning"),
16461
16477
  pcb_manual_edit_conflict_warning_id: getZodPrefixedIdWithDefault(
16462
16478
  "pcb_manual_edit_conflict_warning"
16463
16479
  ),
16464
- warning_type: z93.literal("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),
16465
- message: z93.string(),
16466
- pcb_component_id: z93.string(),
16467
- pcb_group_id: z93.string().optional(),
16468
- subcircuit_id: z93.string().optional(),
16469
- source_component_id: z93.string()
16480
+ warning_type: z94.literal("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),
16481
+ message: z94.string(),
16482
+ pcb_component_id: z94.string(),
16483
+ pcb_group_id: z94.string().optional(),
16484
+ subcircuit_id: z94.string().optional(),
16485
+ source_component_id: z94.string()
16470
16486
  }).describe(
16471
16487
  "Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"
16472
16488
  );
16473
16489
  expectTypesMatch(true);
16474
- var pcb_breakout_point = z94.object({
16475
- type: z94.literal("pcb_breakout_point"),
16490
+ var pcb_breakout_point = z95.object({
16491
+ type: z95.literal("pcb_breakout_point"),
16476
16492
  pcb_breakout_point_id: getZodPrefixedIdWithDefault("pcb_breakout_point"),
16477
- pcb_group_id: z94.string(),
16478
- subcircuit_id: z94.string().optional(),
16479
- source_trace_id: z94.string().optional(),
16480
- source_port_id: z94.string().optional(),
16481
- source_net_id: z94.string().optional(),
16493
+ pcb_group_id: z95.string(),
16494
+ subcircuit_id: z95.string().optional(),
16495
+ source_trace_id: z95.string().optional(),
16496
+ source_port_id: z95.string().optional(),
16497
+ source_net_id: z95.string().optional(),
16482
16498
  x: distance,
16483
16499
  y: distance
16484
16500
  }).describe(
16485
16501
  "Defines a routing target within a pcb_group for a source_trace or source_net"
16486
16502
  );
16487
16503
  expectTypesMatch(true);
16488
- var pcb_ground_plane = z95.object({
16489
- type: z95.literal("pcb_ground_plane"),
16504
+ var pcb_ground_plane = z96.object({
16505
+ type: z96.literal("pcb_ground_plane"),
16490
16506
  pcb_ground_plane_id: getZodPrefixedIdWithDefault("pcb_ground_plane"),
16491
- source_pcb_ground_plane_id: z95.string(),
16492
- source_net_id: z95.string(),
16493
- pcb_group_id: z95.string().optional(),
16494
- subcircuit_id: z95.string().optional()
16507
+ source_pcb_ground_plane_id: z96.string(),
16508
+ source_net_id: z96.string(),
16509
+ pcb_group_id: z96.string().optional(),
16510
+ subcircuit_id: z96.string().optional()
16495
16511
  }).describe("Defines a ground plane on the PCB");
16496
16512
  expectTypesMatch(true);
16497
- var pcb_ground_plane_region = z96.object({
16498
- type: z96.literal("pcb_ground_plane_region"),
16513
+ var pcb_ground_plane_region = z97.object({
16514
+ type: z97.literal("pcb_ground_plane_region"),
16499
16515
  pcb_ground_plane_region_id: getZodPrefixedIdWithDefault(
16500
16516
  "pcb_ground_plane_region"
16501
16517
  ),
16502
- pcb_ground_plane_id: z96.string(),
16503
- pcb_group_id: z96.string().optional(),
16504
- subcircuit_id: z96.string().optional(),
16518
+ pcb_ground_plane_id: z97.string(),
16519
+ pcb_group_id: z97.string().optional(),
16520
+ subcircuit_id: z97.string().optional(),
16505
16521
  layer: layer_ref,
16506
- points: z96.array(point)
16522
+ points: z97.array(point)
16507
16523
  }).describe("Defines a polygon region of a ground plane");
16508
16524
  expectTypesMatch(true);
16509
- var pcb_thermal_spoke = z97.object({
16510
- type: z97.literal("pcb_thermal_spoke"),
16525
+ var pcb_thermal_spoke = z98.object({
16526
+ type: z98.literal("pcb_thermal_spoke"),
16511
16527
  pcb_thermal_spoke_id: getZodPrefixedIdWithDefault("pcb_thermal_spoke"),
16512
- pcb_ground_plane_id: z97.string(),
16513
- shape: z97.string(),
16514
- spoke_count: z97.number(),
16528
+ pcb_ground_plane_id: z98.string(),
16529
+ shape: z98.string(),
16530
+ spoke_count: z98.number(),
16515
16531
  spoke_thickness: distance,
16516
16532
  spoke_inner_diameter: distance,
16517
16533
  spoke_outer_diameter: distance,
16518
- pcb_plated_hole_id: z97.string().optional(),
16519
- subcircuit_id: z97.string().optional()
16534
+ pcb_plated_hole_id: z98.string().optional(),
16535
+ subcircuit_id: z98.string().optional()
16520
16536
  }).describe("Pattern for connecting a ground plane to a plated hole");
16521
16537
  expectTypesMatch(true);
16522
- var pcb_copper_pour_base = z98.object({
16523
- type: z98.literal("pcb_copper_pour"),
16538
+ var pcb_copper_pour_base = z99.object({
16539
+ type: z99.literal("pcb_copper_pour"),
16524
16540
  pcb_copper_pour_id: getZodPrefixedIdWithDefault("pcb_copper_pour"),
16525
- pcb_group_id: z98.string().optional(),
16526
- subcircuit_id: z98.string().optional(),
16541
+ pcb_group_id: z99.string().optional(),
16542
+ subcircuit_id: z99.string().optional(),
16527
16543
  layer: layer_ref,
16528
- source_net_id: z98.string().optional()
16544
+ source_net_id: z99.string().optional()
16529
16545
  });
16530
16546
  var pcb_copper_pour_rect = pcb_copper_pour_base.extend({
16531
- shape: z98.literal("rect"),
16547
+ shape: z99.literal("rect"),
16532
16548
  center: point,
16533
16549
  width: length,
16534
16550
  height: length,
@@ -16536,45 +16552,67 @@ var pcb_copper_pour_rect = pcb_copper_pour_base.extend({
16536
16552
  });
16537
16553
  expectTypesMatch(true);
16538
16554
  var pcb_copper_pour_brep = pcb_copper_pour_base.extend({
16539
- shape: z98.literal("brep"),
16555
+ shape: z99.literal("brep"),
16540
16556
  brep_shape
16541
16557
  });
16542
16558
  expectTypesMatch(true);
16543
16559
  var pcb_copper_pour_polygon = pcb_copper_pour_base.extend({
16544
- shape: z98.literal("polygon"),
16545
- points: z98.array(point)
16560
+ shape: z99.literal("polygon"),
16561
+ points: z99.array(point)
16546
16562
  });
16547
16563
  expectTypesMatch(true);
16548
- var pcb_copper_pour = z98.discriminatedUnion("shape", [
16564
+ var pcb_copper_pour = z99.discriminatedUnion("shape", [
16549
16565
  pcb_copper_pour_rect,
16550
16566
  pcb_copper_pour_brep,
16551
16567
  pcb_copper_pour_polygon
16552
16568
  ]).describe("Defines a copper pour on the PCB.");
16553
16569
  expectTypesMatch(true);
16554
- var cad_component = z99.object({
16555
- type: z99.literal("cad_component"),
16556
- cad_component_id: z99.string(),
16557
- pcb_component_id: z99.string(),
16558
- source_component_id: z99.string(),
16570
+ var pcb_component_outside_board_error = z100.object({
16571
+ type: z100.literal("pcb_component_outside_board_error"),
16572
+ pcb_component_outside_board_error_id: getZodPrefixedIdWithDefault(
16573
+ "pcb_component_outside_board_error"
16574
+ ),
16575
+ error_type: z100.literal("pcb_component_outside_board_error").default("pcb_component_outside_board_error"),
16576
+ message: z100.string(),
16577
+ pcb_component_id: z100.string(),
16578
+ pcb_board_id: z100.string(),
16579
+ component_center: point,
16580
+ component_bounds: z100.object({
16581
+ min_x: z100.number(),
16582
+ max_x: z100.number(),
16583
+ min_y: z100.number(),
16584
+ max_y: z100.number()
16585
+ }),
16586
+ subcircuit_id: z100.string().optional(),
16587
+ source_component_id: z100.string().optional()
16588
+ }).describe(
16589
+ "Error emitted when a PCB component is placed outside the board boundaries"
16590
+ );
16591
+ expectTypesMatch(true);
16592
+ var cad_component = z101.object({
16593
+ type: z101.literal("cad_component"),
16594
+ cad_component_id: z101.string(),
16595
+ pcb_component_id: z101.string(),
16596
+ source_component_id: z101.string(),
16559
16597
  position: point3,
16560
16598
  rotation: point3.optional(),
16561
16599
  size: point3.optional(),
16562
16600
  layer: layer_ref.optional(),
16563
- subcircuit_id: z99.string().optional(),
16601
+ subcircuit_id: z101.string().optional(),
16564
16602
  // These are all ways to generate/load the 3d model
16565
- footprinter_string: z99.string().optional(),
16566
- model_obj_url: z99.string().optional(),
16567
- model_stl_url: z99.string().optional(),
16568
- model_3mf_url: z99.string().optional(),
16569
- model_gltf_url: z99.string().optional(),
16570
- model_glb_url: z99.string().optional(),
16571
- model_step_url: z99.string().optional(),
16572
- model_wrl_url: z99.string().optional(),
16573
- model_jscad: z99.any().optional()
16603
+ footprinter_string: z101.string().optional(),
16604
+ model_obj_url: z101.string().optional(),
16605
+ model_stl_url: z101.string().optional(),
16606
+ model_3mf_url: z101.string().optional(),
16607
+ model_gltf_url: z101.string().optional(),
16608
+ model_glb_url: z101.string().optional(),
16609
+ model_step_url: z101.string().optional(),
16610
+ model_wrl_url: z101.string().optional(),
16611
+ model_jscad: z101.any().optional()
16574
16612
  }).describe("Defines a component on the PCB");
16575
16613
  expectTypesMatch(true);
16576
- var wave_shape = z100.enum(["sinewave", "square", "triangle", "sawtooth"]);
16577
- var percentage = z100.union([z100.string(), z100.number()]).transform((val) => {
16614
+ var wave_shape = z102.enum(["sinewave", "square", "triangle", "sawtooth"]);
16615
+ var percentage = z102.union([z102.string(), z102.number()]).transform((val) => {
16578
16616
  if (typeof val === "string") {
16579
16617
  if (val.endsWith("%")) {
16580
16618
  return parseFloat(val.slice(0, -1)) / 100;
@@ -16583,30 +16621,30 @@ var percentage = z100.union([z100.string(), z100.number()]).transform((val) => {
16583
16621
  }
16584
16622
  return val;
16585
16623
  }).pipe(
16586
- z100.number().min(0, "Duty cycle must be non-negative").max(1, "Duty cycle cannot be greater than 100%")
16624
+ z102.number().min(0, "Duty cycle must be non-negative").max(1, "Duty cycle cannot be greater than 100%")
16587
16625
  );
16588
- var simulation_dc_voltage_source = z100.object({
16589
- type: z100.literal("simulation_voltage_source"),
16626
+ var simulation_dc_voltage_source = z102.object({
16627
+ type: z102.literal("simulation_voltage_source"),
16590
16628
  simulation_voltage_source_id: getZodPrefixedIdWithDefault(
16591
16629
  "simulation_voltage_source"
16592
16630
  ),
16593
- is_dc_source: z100.literal(true).optional().default(true),
16594
- positive_source_port_id: z100.string().optional(),
16595
- negative_source_port_id: z100.string().optional(),
16596
- positive_source_net_id: z100.string().optional(),
16597
- negative_source_net_id: z100.string().optional(),
16631
+ is_dc_source: z102.literal(true).optional().default(true),
16632
+ positive_source_port_id: z102.string().optional(),
16633
+ negative_source_port_id: z102.string().optional(),
16634
+ positive_source_net_id: z102.string().optional(),
16635
+ negative_source_net_id: z102.string().optional(),
16598
16636
  voltage
16599
16637
  }).describe("Defines a DC voltage source for simulation");
16600
- var simulation_ac_voltage_source = z100.object({
16601
- type: z100.literal("simulation_voltage_source"),
16638
+ var simulation_ac_voltage_source = z102.object({
16639
+ type: z102.literal("simulation_voltage_source"),
16602
16640
  simulation_voltage_source_id: getZodPrefixedIdWithDefault(
16603
16641
  "simulation_voltage_source"
16604
16642
  ),
16605
- is_dc_source: z100.literal(false),
16606
- terminal1_source_port_id: z100.string().optional(),
16607
- terminal2_source_port_id: z100.string().optional(),
16608
- terminal1_source_net_id: z100.string().optional(),
16609
- terminal2_source_net_id: z100.string().optional(),
16643
+ is_dc_source: z102.literal(false),
16644
+ terminal1_source_port_id: z102.string().optional(),
16645
+ terminal2_source_port_id: z102.string().optional(),
16646
+ terminal1_source_net_id: z102.string().optional(),
16647
+ terminal2_source_net_id: z102.string().optional(),
16610
16648
  voltage: voltage.optional(),
16611
16649
  frequency: frequency.optional(),
16612
16650
  peak_to_peak_voltage: voltage.optional(),
@@ -16614,11 +16652,11 @@ var simulation_ac_voltage_source = z100.object({
16614
16652
  phase: rotation.optional(),
16615
16653
  duty_cycle: percentage.optional()
16616
16654
  }).describe("Defines an AC voltage source for simulation");
16617
- var simulation_voltage_source = z100.union([simulation_dc_voltage_source, simulation_ac_voltage_source]).describe("Defines a voltage source for simulation");
16655
+ var simulation_voltage_source = z102.union([simulation_dc_voltage_source, simulation_ac_voltage_source]).describe("Defines a voltage source for simulation");
16618
16656
  expectTypesMatch(true);
16619
16657
  expectTypesMatch(true);
16620
16658
  expectTypesMatch(true);
16621
- var any_circuit_element = z101.union([
16659
+ var any_circuit_element = z103.union([
16622
16660
  source_trace,
16623
16661
  source_port,
16624
16662
  any_source_component,
@@ -16649,6 +16687,7 @@ var any_circuit_element = z101.union([
16649
16687
  pcb_component,
16650
16688
  pcb_hole,
16651
16689
  pcb_missing_footprint_error,
16690
+ external_footprint_load_error,
16652
16691
  pcb_manual_edit_conflict_warning,
16653
16692
  pcb_plated_hole,
16654
16693
  pcb_keepout,
@@ -16682,6 +16721,7 @@ var any_circuit_element = z101.union([
16682
16721
  pcb_ground_plane_region,
16683
16722
  pcb_thermal_spoke,
16684
16723
  pcb_copper_pour,
16724
+ pcb_component_outside_board_error,
16685
16725
  schematic_box,
16686
16726
  schematic_text,
16687
16727
  schematic_line,
@@ -16890,12 +16930,12 @@ function convertMilToMm(value) {
16890
16930
  }
16891
16931
  return Number(value);
16892
16932
  }
16893
- var lengthInMm = z102.union([z102.string(), z102.number()]).transform((val) => convertMilToMm(val));
16894
- var extendDipDef = (newDefaults) => z102.object({
16895
- fn: z102.string(),
16896
- num_pins: z102.number().optional().default(6),
16897
- wide: z102.boolean().optional(),
16898
- narrow: z102.boolean().optional(),
16933
+ var lengthInMm = z104.union([z104.string(), z104.number()]).transform((val) => convertMilToMm(val));
16934
+ var extendDipDef = (newDefaults) => z104.object({
16935
+ fn: z104.string(),
16936
+ num_pins: z104.number().optional().default(6),
16937
+ wide: z104.boolean().optional(),
16938
+ narrow: z104.boolean().optional(),
16899
16939
  w: lengthInMm.optional(),
16900
16940
  p: lengthInMm.default(newDefaults.p ?? "2.54mm"),
16901
16941
  id: lengthInMm.optional(),
@@ -17422,6 +17462,20 @@ var bga = (raw_params) => {
17422
17462
  parameters
17423
17463
  };
17424
17464
  };
17465
+ var pillpad = (pn, x, y, w, h2) => {
17466
+ return {
17467
+ type: "pcb_smtpad",
17468
+ x,
17469
+ y,
17470
+ width: w,
17471
+ height: h2,
17472
+ radius: h2 / 2,
17473
+ layer: "top",
17474
+ shape: "pill",
17475
+ pcb_smtpad_id: "",
17476
+ port_hints: Array.isArray(pn) ? pn.map((item) => item.toString()) : [pn.toString()]
17477
+ };
17478
+ };
17425
17479
  var extendSoicDef = (newDefaults) => z610.object({
17426
17480
  fn: z610.string(),
17427
17481
  num_pins: z610.number().optional().default(8),
@@ -17429,7 +17483,8 @@ var extendSoicDef = (newDefaults) => z610.object({
17429
17483
  p: length.default(length.parse(newDefaults.p ?? "1.27mm")),
17430
17484
  pw: length.default(length.parse(newDefaults.pw ?? "0.6mm")),
17431
17485
  pl: length.default(length.parse(newDefaults.pl ?? "1.0mm")),
17432
- legsoutside: z610.boolean().optional().default(newDefaults.legsoutside ?? false)
17486
+ legsoutside: z610.boolean().optional().default(newDefaults.legsoutside ?? false),
17487
+ pillpads: z610.boolean().optional().default(newDefaults.pillpads ?? false)
17433
17488
  }).transform((v) => {
17434
17489
  if (!v.pw && !v.pl) {
17435
17490
  v.pw = length.parse("0.6mm");
@@ -17476,7 +17531,11 @@ var soicWithoutParsing = (parameters) => {
17476
17531
  pl: parameters.pl,
17477
17532
  legsoutside: parameters.legsoutside
17478
17533
  });
17479
- pads.push(rectpad(i + 1, x, y, parameters.pl, parameters.pw));
17534
+ if (parameters.pillpads) {
17535
+ pads.push(pillpad(i + 1, x, y, parameters.pl, parameters.pw));
17536
+ } else {
17537
+ pads.push(rectpad(i + 1, x, y, parameters.pl, parameters.pw));
17538
+ }
17480
17539
  }
17481
17540
  const m = Math.min(1, parameters.p / 2);
17482
17541
  const sw = parameters.w - (parameters.legsoutside ? 0 : parameters.pl * 2) - 0.2;
@@ -18790,7 +18849,9 @@ var stampboard_def = z172.object({
18790
18849
  pw: length.default(length.parse("1.6mm")),
18791
18850
  pl: length.default(length.parse("2.4mm")),
18792
18851
  innerhole: z172.boolean().default(false),
18793
- innerholeedgedistance: length.default(length.parse("1.61mm"))
18852
+ innerholeedgedistance: length.default(length.parse("1.61mm")),
18853
+ silkscreenlabels: z172.boolean().default(false),
18854
+ silkscreenlabelmargin: length.default(length.parse("0.1mm"))
18794
18855
  });
18795
18856
  var getHeight = (parameters) => {
18796
18857
  const params = stampboard_def.parse(parameters);
@@ -18912,14 +18973,17 @@ var stampboard = (raw_params) => {
18912
18973
  const height10 = params.h ?? getHeight(params);
18913
18974
  const rectpads = [];
18914
18975
  const holes = [];
18976
+ const pinLabels = [];
18915
18977
  let routes = [];
18916
18978
  const innerDiameter = 1;
18917
- const outerDiameter = 1.2;
18979
+ const outerDiameter = innerDiameter;
18918
18980
  const totalPadsNumber = params.left + params.right + (params.bottom ?? 0) + (params.top ?? 0);
18981
+ const maxLabelLength = `pin${totalPadsNumber}`.length;
18982
+ const textHalf = maxLabelLength * 0.7 / 2;
18919
18983
  if (params.right) {
18920
18984
  const yoff = -((params.right - 1) / 2) * params.p;
18921
18985
  for (let i = 0; i < params.right; i++) {
18922
- if (i === 0 && !params.left && !params.bottom) {
18986
+ if (i === 0 && !params.left && !params.bottom && !params.silkscreenlabels) {
18923
18987
  routes = getTriangleDir(
18924
18988
  params.w / 2 - params.pl * 1.4,
18925
18989
  yoff + i * params.p,
@@ -18935,6 +18999,24 @@ var stampboard = (raw_params) => {
18935
18999
  params.pw
18936
19000
  )
18937
19001
  );
19002
+ if (params.silkscreenlabels) {
19003
+ const padIndex = i + 1 + params.left + (params.bottom ?? 0);
19004
+ const label = `pin${padIndex}`;
19005
+ pinLabels.push({
19006
+ type: "pcb_silkscreen_text",
19007
+ pcb_silkscreen_text_id: `pin_${padIndex}`,
19008
+ pcb_component_id: "1",
19009
+ layer: "top",
19010
+ anchor_position: {
19011
+ x: params.w / 2 - params.pl - (textHalf + params.silkscreenlabelmargin),
19012
+ y: yoff + i * params.p
19013
+ },
19014
+ text: label,
19015
+ font_size: 0.7,
19016
+ font: "tscircuit2024",
19017
+ anchor_alignment: "center"
19018
+ });
19019
+ }
18938
19020
  if (params.innerhole) {
18939
19021
  holes.push(
18940
19022
  platedhole(
@@ -18958,12 +19040,12 @@ var stampboard = (raw_params) => {
18958
19040
  }
18959
19041
  }
18960
19042
  if (params.left) {
18961
- const yoff = -((params.left - 1) / 2) * params.p;
19043
+ const yoff = (params.left - 1) / 2 * params.p;
18962
19044
  for (let i = 0; i < params.left; i++) {
18963
- if (i === params.left - 1) {
19045
+ if (i === 0 && !params.silkscreenlabels) {
18964
19046
  routes = getTriangleDir(
18965
19047
  -params.w / 2 + params.pl * 1.4,
18966
- yoff + i * params.p,
19048
+ yoff - i * params.p,
18967
19049
  "left"
18968
19050
  );
18969
19051
  }
@@ -18971,17 +19053,35 @@ var stampboard = (raw_params) => {
18971
19053
  rectpad(
18972
19054
  i + 1,
18973
19055
  -params.w / 2 + params.pl / 2,
18974
- yoff + i * params.p,
19056
+ yoff - i * params.p,
18975
19057
  params.pl,
18976
19058
  params.pw
18977
19059
  )
18978
19060
  );
19061
+ if (params.silkscreenlabels) {
19062
+ const padIndex = i + 1;
19063
+ const label = `pin${padIndex}`;
19064
+ pinLabels.push({
19065
+ type: "pcb_silkscreen_text",
19066
+ pcb_silkscreen_text_id: `pin_${padIndex}`,
19067
+ pcb_component_id: "1",
19068
+ layer: "top",
19069
+ anchor_position: {
19070
+ x: -params.w / 2 + params.pl + (textHalf + params.silkscreenlabelmargin),
19071
+ y: yoff - i * params.p
19072
+ },
19073
+ text: label,
19074
+ font_size: 0.7,
19075
+ font: "tscircuit2024",
19076
+ anchor_alignment: "center"
19077
+ });
19078
+ }
18979
19079
  if (params.innerhole) {
18980
19080
  holes.push(
18981
19081
  platedhole(
18982
19082
  i + 1 + totalPadsNumber,
18983
19083
  -params.w / 2,
18984
- yoff + i * params.p,
19084
+ yoff - i * params.p,
18985
19085
  innerDiameter,
18986
19086
  outerDiameter
18987
19087
  )
@@ -18990,7 +19090,7 @@ var stampboard = (raw_params) => {
18990
19090
  platedhole(
18991
19091
  i + 1 + totalPadsNumber * 2,
18992
19092
  -params.w / 2 + params.innerholeedgedistance,
18993
- yoff + i * params.p,
19093
+ yoff - i * params.p,
18994
19094
  innerDiameter,
18995
19095
  outerDiameter
18996
19096
  )
@@ -18999,11 +19099,11 @@ var stampboard = (raw_params) => {
18999
19099
  }
19000
19100
  }
19001
19101
  if (params.top) {
19002
- const xoff = -((params.top - 1) / 2) * params.p;
19102
+ const xoff = (params.top - 1) / 2 * params.p;
19003
19103
  for (let i = 0; i < params.top; i++) {
19004
- if (i === params.top - 1 && !params.left && !params.bottom && !params.right) {
19104
+ if (i === 0 && !params.left && !params.bottom && !params.right && !params.silkscreenlabels) {
19005
19105
  routes = getTriangleDir(
19006
- xoff + i * params.p,
19106
+ xoff - i * params.p,
19007
19107
  height10 / 2 - params.pl * 1.4,
19008
19108
  "top"
19009
19109
  );
@@ -19011,17 +19111,36 @@ var stampboard = (raw_params) => {
19011
19111
  rectpads.push(
19012
19112
  rectpad(
19013
19113
  i + 1 + params.left + params.right + (params.bottom ?? 0),
19014
- xoff + i * params.p,
19114
+ xoff - i * params.p,
19015
19115
  height10 / 2 - params.pl / 2,
19016
19116
  params.pw,
19017
19117
  params.pl
19018
19118
  )
19019
19119
  );
19120
+ if (params.silkscreenlabels) {
19121
+ const padIndex = i + 1 + params.left + params.right + (params.bottom ?? 0);
19122
+ const label = `pin${padIndex}`;
19123
+ pinLabels.push({
19124
+ type: "pcb_silkscreen_text",
19125
+ pcb_silkscreen_text_id: `pin_${padIndex}`,
19126
+ pcb_component_id: "1",
19127
+ layer: "top",
19128
+ anchor_position: {
19129
+ x: xoff - i * params.p,
19130
+ y: height10 / 2 - params.pl - (textHalf + params.silkscreenlabelmargin)
19131
+ },
19132
+ text: label,
19133
+ font_size: 0.7,
19134
+ font: "tscircuit2024",
19135
+ anchor_alignment: "center",
19136
+ ccw_rotation: 270
19137
+ });
19138
+ }
19020
19139
  if (params.innerhole) {
19021
19140
  holes.push(
19022
19141
  platedhole(
19023
19142
  i + 1 + params.left + params.right + (params.bottom ?? 0) + totalPadsNumber,
19024
- xoff + i * params.p,
19143
+ xoff - i * params.p,
19025
19144
  height10 / 2,
19026
19145
  innerDiameter,
19027
19146
  outerDiameter
@@ -19030,7 +19149,7 @@ var stampboard = (raw_params) => {
19030
19149
  holes.push(
19031
19150
  platedhole(
19032
19151
  i + 1 + params.left + params.right + (params.bottom ?? 0) + totalPadsNumber * 2,
19033
- xoff + i * params.p,
19152
+ xoff - i * params.p,
19034
19153
  height10 / 2 - params.innerholeedgedistance,
19035
19154
  innerDiameter,
19036
19155
  outerDiameter
@@ -19042,7 +19161,7 @@ var stampboard = (raw_params) => {
19042
19161
  if (params.bottom) {
19043
19162
  const xoff = -((params.bottom - 1) / 2) * params.p;
19044
19163
  for (let i = 0; i < params.bottom; i++) {
19045
- if (i === 0 && !params.left) {
19164
+ if (i === 0 && !params.left && !params.silkscreenlabels) {
19046
19165
  routes = getTriangleDir(
19047
19166
  xoff + i * params.p,
19048
19167
  -height10 / 2 + params.pl * 1.4,
@@ -19058,6 +19177,25 @@ var stampboard = (raw_params) => {
19058
19177
  params.pl
19059
19178
  )
19060
19179
  );
19180
+ if (params.silkscreenlabels) {
19181
+ const padIndex = i + 1 + params.left;
19182
+ const label = `pin${padIndex}`;
19183
+ pinLabels.push({
19184
+ type: "pcb_silkscreen_text",
19185
+ pcb_silkscreen_text_id: `pin_${padIndex}`,
19186
+ pcb_component_id: "1",
19187
+ layer: "top",
19188
+ anchor_position: {
19189
+ x: xoff + i * params.p,
19190
+ y: -height10 / 2 + params.pl + (textHalf + params.silkscreenlabelmargin)
19191
+ },
19192
+ text: label,
19193
+ font_size: 0.7,
19194
+ font: "tscircuit2024",
19195
+ anchor_alignment: "center",
19196
+ ccw_rotation: 90
19197
+ });
19198
+ }
19061
19199
  if (params.innerhole) {
19062
19200
  holes.push(
19063
19201
  platedhole(
@@ -19111,8 +19249,9 @@ var stampboard = (raw_params) => {
19111
19249
  circuitJson: [
19112
19250
  ...rectpads,
19113
19251
  ...holes,
19252
+ ...pinLabels,
19114
19253
  silkscreenPath,
19115
- silkscreenTriangle,
19254
+ ...params.silkscreenlabels ? [] : [silkscreenTriangle],
19116
19255
  silkscreenRefText
19117
19256
  ],
19118
19257
  parameters: params
@@ -22686,20 +22825,6 @@ var solderjumper = (params) => {
22686
22825
  parameters: params
22687
22826
  };
22688
22827
  };
22689
- var pillpad = (pn, x, y, w, h2) => {
22690
- return {
22691
- type: "pcb_smtpad",
22692
- x,
22693
- y,
22694
- width: w,
22695
- height: h2,
22696
- radius: h2 / 2,
22697
- layer: "top",
22698
- shape: "pill",
22699
- pcb_smtpad_id: "",
22700
- port_hints: Array.isArray(pn) ? pn.map((item) => item.toString()) : [pn.toString()]
22701
- };
22702
- };
22703
22828
  var commonSchema = {
22704
22829
  fn: z542.literal("sot457"),
22705
22830
  num_pins: z542.literal(6).default(6),
@@ -23222,6 +23347,7 @@ var smtpad_def = z592.object({
23222
23347
  circle: z592.boolean().optional(),
23223
23348
  rect: z592.boolean().optional(),
23224
23349
  square: z592.boolean().optional(),
23350
+ pill: z592.boolean().optional(),
23225
23351
  d: length.optional(),
23226
23352
  pd: length.optional(),
23227
23353
  diameter: length.optional(),
@@ -23242,6 +23368,7 @@ var smtpad_def = z592.object({
23242
23368
  if (v.circle) shape = "circle";
23243
23369
  if (v.square) shape = "square";
23244
23370
  if (v.rect) shape = "rect";
23371
+ if (v.pill) shape = "pill";
23245
23372
  let radius;
23246
23373
  let width10;
23247
23374
  let height10;
@@ -23263,7 +23390,10 @@ var smtpad_def = z592.object({
23263
23390
  if (v.h !== void 0) height10 = mm(v.h);
23264
23391
  else if (v.ph !== void 0) height10 = mm(v.ph);
23265
23392
  else if (v.height !== void 0) height10 = mm(v.height);
23266
- else height10 = width10;
23393
+ else if (shape === "square") height10 = width10;
23394
+ else if (shape === "rect")
23395
+ height10 = width10;
23396
+ else height10 = mm("1mm");
23267
23397
  }
23268
23398
  return {
23269
23399
  fn: v.fn,
@@ -23276,14 +23406,22 @@ var smtpad_def = z592.object({
23276
23406
  var smtpad = (raw_params) => {
23277
23407
  const params = smtpad_def.parse(raw_params);
23278
23408
  const { shape, radius, width: width10, height: height10 } = params;
23409
+ let pad2;
23410
+ let silkscreenOffset;
23411
+ if (shape === "circle") {
23412
+ pad2 = circlepad(1, { x: 0, y: 0, radius });
23413
+ silkscreenOffset = radius + 0.5;
23414
+ } else if (shape === "pill") {
23415
+ pad2 = pillpad(1, 0, 0, width10, height10);
23416
+ silkscreenOffset = Math.max(width10, height10) / 2 + 0.5;
23417
+ } else {
23418
+ pad2 = rectpad(1, 0, 0, width10, height10);
23419
+ silkscreenOffset = height10 / 2 + 0.5;
23420
+ }
23279
23421
  return {
23280
23422
  circuitJson: [
23281
- shape === "circle" ? circlepad(1, { x: 0, y: 0, radius }) : rectpad(1, 0, 0, width10, height10),
23282
- silkscreenRef(
23283
- 0,
23284
- shape === "circle" ? radius + 0.5 : height10 / 2 + 0.5,
23285
- 0.2
23286
- )
23423
+ pad2,
23424
+ silkscreenRef(0, silkscreenOffset, 0.2)
23287
23425
  ],
23288
23426
  parameters: params
23289
23427
  };
@@ -23464,10 +23602,12 @@ var m2host = (raw_params) => {
23464
23602
  const pn = i + 1;
23465
23603
  if (pn >= 24 && pn <= 31) continue;
23466
23604
  const y = startY - i * halfPitch;
23467
- const x = i % 2 === 0 ? 0 : -rowOffset / 2;
23468
- const padLengthWithOffset = padLength + (i % 2 === 0 ? 0 : 0.25);
23605
+ const isBottomLayer = pn % 2 === 0;
23606
+ const padLengthWithOffset = padLength + (isBottomLayer ? 0.25 : 0);
23607
+ const rightEdgeOffset = 0.5;
23608
+ const x = rightEdgeOffset - padLengthWithOffset / 2;
23469
23609
  const pad2 = rectpad(pn, x, y, padLengthWithOffset, padWidth);
23470
- pad2.layer = pn % 2 === 0 ? "bottom" : "top";
23610
+ pad2.layer = isBottomLayer ? "bottom" : "top";
23471
23611
  pads.push(pad2);
23472
23612
  }
23473
23613
  const cutoutWidth = 46 * 0.0254;
@@ -23548,7 +23688,7 @@ var m2host = (raw_params) => {
23548
23688
  };
23549
23689
  };
23550
23690
  function isNotNull(value) {
23551
- return value !== null;
23691
+ return value !== null && value !== void 0;
23552
23692
  }
23553
23693
  var applyOrigin = (elements, origin) => {
23554
23694
  if (!origin) return elements;
@@ -23621,12 +23761,22 @@ var applyOrigin = (elements, origin) => {
23621
23761
  break;
23622
23762
  }
23623
23763
  if (dx === 0 && dy === 0) return elements;
23624
- for (const pad2 of pads) {
23625
- pad2.x -= dx;
23626
- pad2.y -= dy;
23627
- if (pad2.center) {
23628
- pad2.center.x -= dx;
23629
- pad2.center.y -= dy;
23764
+ for (const el of elements) {
23765
+ if (typeof el.x === "number") el.x -= dx;
23766
+ if (typeof el.y === "number") el.y -= dy;
23767
+ if (el.center && typeof el.center.x === "number") {
23768
+ el.center.x -= dx;
23769
+ el.center.y -= dy;
23770
+ }
23771
+ if (el.type === "pcb_silkscreen_path") {
23772
+ for (const pt of el.route) {
23773
+ pt.x -= dx;
23774
+ pt.y -= dy;
23775
+ }
23776
+ }
23777
+ if (el.type === "pcb_silkscreen_text" && el.anchor_position) {
23778
+ el.anchor_position.x -= dx;
23779
+ el.anchor_position.y -= dy;
23630
23780
  }
23631
23781
  }
23632
23782
  return elements;
@@ -23636,8 +23786,9 @@ var string2 = (def) => {
23636
23786
  const modifiedDef = def.replace(/^((?:\d{4}|\d{5}))(?=$|_)/, "res$1");
23637
23787
  const def_parts = modifiedDef.split(/_(?!metric)/).map((s) => {
23638
23788
  const m = s.match(/([a-z]+)([\(\d\.\+\?].*)?/);
23639
- const [_, fn, v] = m ?? [];
23640
- if (v?.includes("?")) return null;
23789
+ if (!m) return null;
23790
+ const [, fn, v] = m;
23791
+ if (!fn || v?.includes("?")) return null;
23641
23792
  return { fn, v };
23642
23793
  }).filter(isNotNull);
23643
23794
  for (const { fn, v } of def_parts) {
@@ -23863,17 +24014,17 @@ var svgPathPoints = normalizeOnY([
23863
24014
  ]);
23864
24015
  var DIP_PIN_HEIGHT = 5.47;
23865
24016
  var heightAboveSurface = 0.5;
23866
- var DipPinLeg = ({ x, y, z: z103 }) => {
24017
+ var DipPinLeg = ({ x, y, z: z105 }) => {
23867
24018
  const isRotated = x > 0;
23868
24019
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
23869
- /* @__PURE__ */ jsx5(Translate, { offset: { x: x + 0.25 / 2, y, z: z103 }, children: /* @__PURE__ */ jsx5(Rotate, { rotation: ["-90deg", 0, "90deg"], children: /* @__PURE__ */ jsx5(ExtrudeLinear, { height: 0.25, children: /* @__PURE__ */ jsx5(Polygon, { points: svgPathPoints.map((p) => [p.x, p.y]) }) }) }) }),
24020
+ /* @__PURE__ */ jsx5(Translate, { offset: { x: x + 0.25 / 2, y, z: z105 }, children: /* @__PURE__ */ jsx5(Rotate, { rotation: ["-90deg", 0, "90deg"], children: /* @__PURE__ */ jsx5(ExtrudeLinear, { height: 0.25, children: /* @__PURE__ */ jsx5(Polygon, { points: svgPathPoints.map((p) => [p.x, p.y]) }) }) }) }),
23870
24021
  /* @__PURE__ */ jsx5(
23871
24022
  Translate,
23872
24023
  {
23873
24024
  offset: {
23874
24025
  x,
23875
24026
  y: y + (isRotated ? 1 : -1),
23876
- z: z103
24027
+ z: z105
23877
24028
  },
23878
24029
  children: /* @__PURE__ */ jsx5(Rotate, { rotation: ["-90deg", "90deg", isRotated ? "180deg" : "0deg"], children: /* @__PURE__ */ jsx5(ExtrudeLinear, { height: 2, children: /* @__PURE__ */ jsx5(
23879
24030
  Polygon,
@@ -25808,7 +25959,7 @@ import * as THREE11 from "three";
25808
25959
  // package.json
25809
25960
  var package_default = {
25810
25961
  name: "@tscircuit/3d-viewer",
25811
- version: "0.0.371",
25962
+ version: "0.0.372",
25812
25963
  main: "./dist/index.js",
25813
25964
  module: "./dist/index.js",
25814
25965
  type: "module",
@@ -25853,9 +26004,9 @@ var package_default = {
25853
26004
  "@chromatic-com/storybook": "^1.9.0",
25854
26005
  "@jscad/modeling": "^2.12.5",
25855
26006
  "@storybook/blocks": "9.0.0-alpha.17",
25856
- "@storybook/react-vite": "^9.1.2",
26007
+ "@storybook/react-vite": "^9.1.5",
25857
26008
  "@tscircuit/circuit-json-util": "^0.0.67",
25858
- "@tscircuit/core": "^0.0.691",
26009
+ "@tscircuit/core": "^0.0.714",
25859
26010
  "@tscircuit/props": "^0.0.312",
25860
26011
  "@types/jsdom": "^21.1.7",
25861
26012
  "@types/react": "19",
@@ -25864,7 +26015,7 @@ var package_default = {
25864
26015
  "@vitejs/plugin-react": "^4.3.4",
25865
26016
  "bun-match-svg": "^0.0.9",
25866
26017
  "bun-types": "1.2.1",
25867
- "circuit-json": "0.0.246",
26018
+ "circuit-json": "0.0.248",
25868
26019
  "circuit-to-svg": "^0.0.179",
25869
26020
  debug: "^4.4.0",
25870
26021
  "jscad-electronics": "^0.0.38",
@@ -25874,10 +26025,10 @@ var package_default = {
25874
26025
  "react-use-gesture": "^9.1.3",
25875
26026
  semver: "^7.7.0",
25876
26027
  "strip-ansi": "^7.1.0",
25877
- tscircuit: "^0.0.622",
26028
+ tscircuit: "^0.0.630",
25878
26029
  tsup: "^8.3.6",
25879
26030
  typescript: "^5.7.3",
25880
- vite: "^7.1.2",
26031
+ vite: "^7.1.5",
25881
26032
  "vite-tsconfig-paths": "^4.3.2"
25882
26033
  }
25883
26034
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/3d-viewer",
3
- "version": "0.0.372",
3
+ "version": "0.0.373",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",
@@ -45,9 +45,9 @@
45
45
  "@chromatic-com/storybook": "^1.9.0",
46
46
  "@jscad/modeling": "^2.12.5",
47
47
  "@storybook/blocks": "9.0.0-alpha.17",
48
- "@storybook/react-vite": "^9.1.2",
48
+ "@storybook/react-vite": "^9.1.5",
49
49
  "@tscircuit/circuit-json-util": "^0.0.67",
50
- "@tscircuit/core": "^0.0.691",
50
+ "@tscircuit/core": "^0.0.714",
51
51
  "@tscircuit/props": "^0.0.312",
52
52
  "@types/jsdom": "^21.1.7",
53
53
  "@types/react": "19",
@@ -56,7 +56,7 @@
56
56
  "@vitejs/plugin-react": "^4.3.4",
57
57
  "bun-match-svg": "^0.0.9",
58
58
  "bun-types": "1.2.1",
59
- "circuit-json": "0.0.246",
59
+ "circuit-json": "0.0.248",
60
60
  "circuit-to-svg": "^0.0.179",
61
61
  "debug": "^4.4.0",
62
62
  "jscad-electronics": "^0.0.38",
@@ -66,10 +66,10 @@
66
66
  "react-use-gesture": "^9.1.3",
67
67
  "semver": "^7.7.0",
68
68
  "strip-ansi": "^7.1.0",
69
- "tscircuit": "^0.0.622",
69
+ "tscircuit": "^0.0.630",
70
70
  "tsup": "^8.3.6",
71
71
  "typescript": "^5.7.3",
72
- "vite": "^7.1.2",
72
+ "vite": "^7.1.5",
73
73
  "vite-tsconfig-paths": "^4.3.2"
74
74
  }
75
75
  }