@tscircuit/3d-viewer 0.0.523 → 0.0.525

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 +669 -216
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -4399,6 +4399,52 @@ var require_isA3 = __commonJS({
4399
4399
  }
4400
4400
  });
4401
4401
 
4402
+ // node_modules/@jscad/modeling/src/geometries/geom3/isConvex.js
4403
+ var require_isConvex2 = __commonJS({
4404
+ "node_modules/@jscad/modeling/src/geometries/geom3/isConvex.js"(exports, module) {
4405
+ "use strict";
4406
+ var { EPS } = require_constants();
4407
+ var vec3 = require_vec3();
4408
+ var geom3 = require_isA3();
4409
+ var toPolygons = require_toPolygons();
4410
+ var poly3 = require_poly3();
4411
+ var isConvex = (geometry) => {
4412
+ if (!geom3(geometry)) {
4413
+ throw new Error("isConvex requires a geom3 geometry");
4414
+ }
4415
+ const polygons = toPolygons(geometry);
4416
+ if (polygons.length === 0) {
4417
+ return true;
4418
+ }
4419
+ const vertices = [];
4420
+ const found = /* @__PURE__ */ new Set();
4421
+ for (let i = 0; i < polygons.length; i++) {
4422
+ const verts = polygons[i].vertices;
4423
+ for (let j = 0; j < verts.length; j++) {
4424
+ const v = verts[j];
4425
+ const key = `${v[0]},${v[1]},${v[2]}`;
4426
+ if (!found.has(key)) {
4427
+ found.add(key);
4428
+ vertices.push(v);
4429
+ }
4430
+ }
4431
+ }
4432
+ for (let i = 0; i < polygons.length; i++) {
4433
+ const plane = poly3.plane(polygons[i]);
4434
+ for (let j = 0; j < vertices.length; j++) {
4435
+ const v = vertices[j];
4436
+ const distance4 = vec3.dot(plane, v) - plane[3];
4437
+ if (distance4 > EPS) {
4438
+ return false;
4439
+ }
4440
+ }
4441
+ }
4442
+ return true;
4443
+ };
4444
+ module.exports = isConvex;
4445
+ }
4446
+ });
4447
+
4402
4448
  // node_modules/@jscad/modeling/src/geometries/geom3/toPoints.js
4403
4449
  var require_toPoints3 = __commonJS({
4404
4450
  "node_modules/@jscad/modeling/src/geometries/geom3/toPoints.js"(exports, module) {
@@ -4556,6 +4602,7 @@ var require_geom3 = __commonJS({
4556
4602
  fromCompactBinary: require_fromCompactBinary2(),
4557
4603
  invert: require_invert3(),
4558
4604
  isA: require_isA3(),
4605
+ isConvex: require_isConvex2(),
4559
4606
  toPoints: require_toPoints3(),
4560
4607
  toPolygons: require_toPolygons(),
4561
4608
  toString: require_toString7(),
@@ -4752,7 +4799,7 @@ var require_appendArc = __commonJS({
4752
4799
  } else if (sweepFlag && deltatheta < 0) {
4753
4800
  deltatheta += TAU;
4754
4801
  }
4755
- let numsteps = Math.ceil(Math.abs(deltatheta) / TAU * segments) + 1;
4802
+ let numsteps = Math.floor(segments * (Math.abs(deltatheta) / TAU));
4756
4803
  if (numsteps < 1) numsteps = 1;
4757
4804
  for (let step = 1; step < numsteps; step++) {
4758
4805
  const theta = theta1 + step / numsteps * deltatheta;
@@ -7221,7 +7268,7 @@ var require_arc = __commonJS({
7221
7268
  vec2.add(point, point, centerv);
7222
7269
  pointArray.push(point);
7223
7270
  } else {
7224
- const numsteps = Math.max(1, Math.floor(segments * (rotation / TAU))) + 1;
7271
+ const numsteps = Math.floor(segments * (Math.abs(rotation) / TAU));
7225
7272
  let edgestepsize = numsteps * 0.5 / rotation;
7226
7273
  if (edgestepsize > 0.25) edgestepsize = 0.25;
7227
7274
  const totalsteps = makeTangent ? numsteps + 2 : numsteps;
@@ -11254,6 +11301,205 @@ var require_intersect2 = __commonJS({
11254
11301
  }
11255
11302
  });
11256
11303
 
11304
+ // node_modules/@jscad/modeling/src/operations/hulls/hullPoints3.js
11305
+ var require_hullPoints3 = __commonJS({
11306
+ "node_modules/@jscad/modeling/src/operations/hulls/hullPoints3.js"(exports, module) {
11307
+ "use strict";
11308
+ var poly3 = require_poly3();
11309
+ var quickhull = require_quickhull();
11310
+ var hullPoints3 = (uniquePoints) => {
11311
+ const faces = quickhull(uniquePoints, { skipTriangulation: true });
11312
+ const polygons = faces.map((face) => {
11313
+ const vertices = face.map((index2) => uniquePoints[index2]);
11314
+ return poly3.create(vertices);
11315
+ });
11316
+ return polygons;
11317
+ };
11318
+ module.exports = hullPoints3;
11319
+ }
11320
+ });
11321
+
11322
+ // node_modules/@jscad/modeling/src/operations/booleans/unionGeom3Sub.js
11323
+ var require_unionGeom3Sub = __commonJS({
11324
+ "node_modules/@jscad/modeling/src/operations/booleans/unionGeom3Sub.js"(exports, module) {
11325
+ "use strict";
11326
+ var geom3 = require_geom3();
11327
+ var mayOverlap = require_mayOverlap();
11328
+ var { Tree } = require_trees();
11329
+ var unionSub = (geometry1, geometry2) => {
11330
+ if (!mayOverlap(geometry1, geometry2)) {
11331
+ return unionForNonIntersecting(geometry1, geometry2);
11332
+ }
11333
+ const a = new Tree(geom3.toPolygons(geometry1));
11334
+ const b = new Tree(geom3.toPolygons(geometry2));
11335
+ a.clipTo(b, false);
11336
+ b.clipTo(a);
11337
+ b.invert();
11338
+ b.clipTo(a);
11339
+ b.invert();
11340
+ const newpolygons = a.allPolygons().concat(b.allPolygons());
11341
+ const result = geom3.create(newpolygons);
11342
+ return result;
11343
+ };
11344
+ var unionForNonIntersecting = (geometry1, geometry2) => {
11345
+ let newpolygons = geom3.toPolygons(geometry1);
11346
+ newpolygons = newpolygons.concat(geom3.toPolygons(geometry2));
11347
+ return geom3.create(newpolygons);
11348
+ };
11349
+ module.exports = unionSub;
11350
+ }
11351
+ });
11352
+
11353
+ // node_modules/@jscad/modeling/src/operations/booleans/unionGeom3.js
11354
+ var require_unionGeom3 = __commonJS({
11355
+ "node_modules/@jscad/modeling/src/operations/booleans/unionGeom3.js"(exports, module) {
11356
+ "use strict";
11357
+ var flatten = require_flatten();
11358
+ var retessellate = require_retessellate();
11359
+ var unionSub = require_unionGeom3Sub();
11360
+ var union5 = (...geometries) => {
11361
+ geometries = flatten(geometries);
11362
+ let i;
11363
+ for (i = 1; i < geometries.length; i += 2) {
11364
+ geometries.push(unionSub(geometries[i - 1], geometries[i]));
11365
+ }
11366
+ let newgeometry = geometries[i - 1];
11367
+ newgeometry = retessellate(newgeometry);
11368
+ return newgeometry;
11369
+ };
11370
+ module.exports = union5;
11371
+ }
11372
+ });
11373
+
11374
+ // node_modules/@jscad/modeling/src/operations/minkowski/minkowskiSum.js
11375
+ var require_minkowskiSum = __commonJS({
11376
+ "node_modules/@jscad/modeling/src/operations/minkowski/minkowskiSum.js"(exports, module) {
11377
+ "use strict";
11378
+ var flatten = require_flatten();
11379
+ var geom3 = require_geom3();
11380
+ var poly3 = require_poly3();
11381
+ var hullPoints3 = require_hullPoints3();
11382
+ var unionGeom3 = require_unionGeom3();
11383
+ var minkowskiSum = (...geometries) => {
11384
+ geometries = flatten(geometries);
11385
+ if (geometries.length !== 2) {
11386
+ throw new Error("minkowskiSum requires exactly two geometries");
11387
+ }
11388
+ const [geomA, geomB] = geometries;
11389
+ if (!geom3.isA(geomA) || !geom3.isA(geomB)) {
11390
+ throw new Error("minkowskiSum requires geom3 geometries");
11391
+ }
11392
+ const aConvex = geom3.isConvex(geomA);
11393
+ const bConvex = geom3.isConvex(geomB);
11394
+ if (aConvex && bConvex) {
11395
+ return minkowskiSumConvex(geomA, geomB);
11396
+ }
11397
+ if (!aConvex && bConvex) {
11398
+ return minkowskiSumNonConvexConvex(geomA, geomB);
11399
+ }
11400
+ if (aConvex && !bConvex) {
11401
+ return minkowskiSumNonConvexConvex(geomB, geomA);
11402
+ }
11403
+ throw new Error("minkowskiSum of two non-convex geometries is not yet supported");
11404
+ };
11405
+ var minkowskiSumNonConvexConvex = (geomA, geomB) => {
11406
+ const tetrahedra = decomposeIntoTetrahedra(geomA);
11407
+ if (tetrahedra.length === 0) {
11408
+ return geom3.create();
11409
+ }
11410
+ const parts = tetrahedra.map((tet) => minkowskiSumConvex(tet, geomB));
11411
+ if (parts.length === 1) {
11412
+ return parts[0];
11413
+ }
11414
+ return unionGeom3(parts);
11415
+ };
11416
+ var decomposeIntoTetrahedra = (geometry) => {
11417
+ const polygons = geom3.toPolygons(geometry);
11418
+ if (polygons.length === 0) {
11419
+ return [];
11420
+ }
11421
+ const tetrahedra = [];
11422
+ for (let i = 0; i < polygons.length; i++) {
11423
+ const polygon3 = polygons[i];
11424
+ const vertices = polygon3.vertices;
11425
+ let cx = 0, cy = 0, cz = 0;
11426
+ for (let k = 0; k < vertices.length; k++) {
11427
+ cx += vertices[k][0];
11428
+ cy += vertices[k][1];
11429
+ cz += vertices[k][2];
11430
+ }
11431
+ cx /= vertices.length;
11432
+ cy /= vertices.length;
11433
+ cz /= vertices.length;
11434
+ const plane = poly3.plane(polygon3);
11435
+ const nx = plane[0], ny = plane[1], nz = plane[2];
11436
+ const offset4 = 0.1;
11437
+ const apex = [
11438
+ // Vertex used as apex in tetrahedron polygons below
11439
+ cx - nx * offset4,
11440
+ cy - ny * offset4,
11441
+ cz - nz * offset4
11442
+ ];
11443
+ for (let j = 1; j < vertices.length - 1; j++) {
11444
+ const v0 = vertices[0];
11445
+ const v1 = vertices[j];
11446
+ const v2 = vertices[j + 1];
11447
+ const tetPolygons = createTetrahedronPolygons(apex, v0, v1, v2);
11448
+ tetrahedra.push(geom3.create(tetPolygons));
11449
+ }
11450
+ }
11451
+ return tetrahedra;
11452
+ };
11453
+ var createTetrahedronPolygons = (p0, p1, p2, p3) => {
11454
+ return [
11455
+ poly3.create([p0, p2, p1]),
11456
+ // base seen from p3
11457
+ poly3.create([p0, p1, p3]),
11458
+ // face opposite p2
11459
+ poly3.create([p1, p2, p3]),
11460
+ // face opposite p0
11461
+ poly3.create([p2, p0, p3])
11462
+ // face opposite p1
11463
+ ];
11464
+ };
11465
+ var minkowskiSumConvex = (geomA, geomB) => {
11466
+ const pointsA = extractUniqueVertices(geomA);
11467
+ const pointsB = extractUniqueVertices(geomB);
11468
+ if (pointsA.length === 0 || pointsB.length === 0) {
11469
+ return geom3.create();
11470
+ }
11471
+ const summedPoints = [];
11472
+ for (let i = 0; i < pointsA.length; i++) {
11473
+ const a = pointsA[i];
11474
+ for (let j = 0; j < pointsB.length; j++) {
11475
+ const b = pointsB[j];
11476
+ summedPoints.push([a[0] + b[0], a[1] + b[1], a[2] + b[2]]);
11477
+ }
11478
+ }
11479
+ const hullPolygons = hullPoints3(summedPoints);
11480
+ return geom3.create(hullPolygons);
11481
+ };
11482
+ var extractUniqueVertices = (geometry) => {
11483
+ const found = /* @__PURE__ */ new Set();
11484
+ const unique = [];
11485
+ const polygons = geom3.toPolygons(geometry);
11486
+ for (let i = 0; i < polygons.length; i++) {
11487
+ const vertices = polygons[i].vertices;
11488
+ for (let j = 0; j < vertices.length; j++) {
11489
+ const v = vertices[j];
11490
+ const key = `${v[0]},${v[1]},${v[2]}`;
11491
+ if (!found.has(key)) {
11492
+ found.add(key);
11493
+ unique.push(v);
11494
+ }
11495
+ }
11496
+ }
11497
+ return unique;
11498
+ };
11499
+ module.exports = minkowskiSum;
11500
+ }
11501
+ });
11502
+
11257
11503
  // node_modules/@jscad/modeling/src/operations/booleans/scissionGeom3.js
11258
11504
  var require_scissionGeom3 = __commonJS({
11259
11505
  "node_modules/@jscad/modeling/src/operations/booleans/scissionGeom3.js"(exports, module) {
@@ -11442,58 +11688,6 @@ var require_subtract4 = __commonJS({
11442
11688
  }
11443
11689
  });
11444
11690
 
11445
- // node_modules/@jscad/modeling/src/operations/booleans/unionGeom3Sub.js
11446
- var require_unionGeom3Sub = __commonJS({
11447
- "node_modules/@jscad/modeling/src/operations/booleans/unionGeom3Sub.js"(exports, module) {
11448
- "use strict";
11449
- var geom3 = require_geom3();
11450
- var mayOverlap = require_mayOverlap();
11451
- var { Tree } = require_trees();
11452
- var unionSub = (geometry1, geometry2) => {
11453
- if (!mayOverlap(geometry1, geometry2)) {
11454
- return unionForNonIntersecting(geometry1, geometry2);
11455
- }
11456
- const a = new Tree(geom3.toPolygons(geometry1));
11457
- const b = new Tree(geom3.toPolygons(geometry2));
11458
- a.clipTo(b, false);
11459
- b.clipTo(a);
11460
- b.invert();
11461
- b.clipTo(a);
11462
- b.invert();
11463
- const newpolygons = a.allPolygons().concat(b.allPolygons());
11464
- const result = geom3.create(newpolygons);
11465
- return result;
11466
- };
11467
- var unionForNonIntersecting = (geometry1, geometry2) => {
11468
- let newpolygons = geom3.toPolygons(geometry1);
11469
- newpolygons = newpolygons.concat(geom3.toPolygons(geometry2));
11470
- return geom3.create(newpolygons);
11471
- };
11472
- module.exports = unionSub;
11473
- }
11474
- });
11475
-
11476
- // node_modules/@jscad/modeling/src/operations/booleans/unionGeom3.js
11477
- var require_unionGeom3 = __commonJS({
11478
- "node_modules/@jscad/modeling/src/operations/booleans/unionGeom3.js"(exports, module) {
11479
- "use strict";
11480
- var flatten = require_flatten();
11481
- var retessellate = require_retessellate();
11482
- var unionSub = require_unionGeom3Sub();
11483
- var union5 = (...geometries) => {
11484
- geometries = flatten(geometries);
11485
- let i;
11486
- for (i = 1; i < geometries.length; i += 2) {
11487
- geometries.push(unionSub(geometries[i - 1], geometries[i]));
11488
- }
11489
- let newgeometry = geometries[i - 1];
11490
- newgeometry = retessellate(newgeometry);
11491
- return newgeometry;
11492
- };
11493
- module.exports = union5;
11494
- }
11495
- });
11496
-
11497
11691
  // node_modules/@jscad/modeling/src/operations/booleans/unionGeom2.js
11498
11692
  var require_unionGeom2 = __commonJS({
11499
11693
  "node_modules/@jscad/modeling/src/operations/booleans/unionGeom2.js"(exports, module) {
@@ -11546,6 +11740,7 @@ var require_booleans = __commonJS({
11546
11740
  "use strict";
11547
11741
  module.exports = {
11548
11742
  intersect: require_intersect2(),
11743
+ minkowski: require_minkowskiSum(),
11549
11744
  scission: require_scission(),
11550
11745
  subtract: require_subtract4(),
11551
11746
  union: require_union()
@@ -12585,24 +12780,6 @@ var require_hullGeom2 = __commonJS({
12585
12780
  }
12586
12781
  });
12587
12782
 
12588
- // node_modules/@jscad/modeling/src/operations/hulls/hullPoints3.js
12589
- var require_hullPoints3 = __commonJS({
12590
- "node_modules/@jscad/modeling/src/operations/hulls/hullPoints3.js"(exports, module) {
12591
- "use strict";
12592
- var poly3 = require_poly3();
12593
- var quickhull = require_quickhull();
12594
- var hullPoints3 = (uniquePoints) => {
12595
- const faces = quickhull(uniquePoints, { skipTriangulation: true });
12596
- const polygons = faces.map((face) => {
12597
- const vertices = face.map((index2) => uniquePoints[index2]);
12598
- return poly3.create(vertices);
12599
- });
12600
- return polygons;
12601
- };
12602
- module.exports = hullPoints3;
12603
- }
12604
- });
12605
-
12606
12783
  // node_modules/@jscad/modeling/src/operations/hulls/hullGeom3.js
12607
12784
  var require_hullGeom3 = __commonJS({
12608
12785
  "node_modules/@jscad/modeling/src/operations/hulls/hullGeom3.js"(exports, module) {
@@ -12682,6 +12859,16 @@ var require_hulls = __commonJS({
12682
12859
  }
12683
12860
  });
12684
12861
 
12862
+ // node_modules/@jscad/modeling/src/operations/minkowski/index.js
12863
+ var require_minkowski = __commonJS({
12864
+ "node_modules/@jscad/modeling/src/operations/minkowski/index.js"(exports, module) {
12865
+ "use strict";
12866
+ module.exports = {
12867
+ minkowskiSum: require_minkowskiSum()
12868
+ };
12869
+ }
12870
+ });
12871
+
12685
12872
  // node_modules/@jscad/modeling/src/operations/modifiers/snapPolygons.js
12686
12873
  var require_snapPolygons = __commonJS({
12687
12874
  "node_modules/@jscad/modeling/src/operations/modifiers/snapPolygons.js"(exports, module) {
@@ -13523,6 +13710,7 @@ var require_src = __commonJS({
13523
13710
  expansions: require_expansions(),
13524
13711
  extrusions: require_extrusions(),
13525
13712
  hulls: require_hulls(),
13713
+ minkowski: require_minkowski(),
13526
13714
  modifiers: require_modifiers(),
13527
13715
  transforms: require_transforms()
13528
13716
  };
@@ -14245,7 +14433,7 @@ var require_browser = __commonJS({
14245
14433
 
14246
14434
  // src/CadViewer.tsx
14247
14435
  import { useState as useState36, useCallback as useCallback21, useRef as useRef26, useEffect as useEffect44 } from "react";
14248
- import * as THREE37 from "three";
14436
+ import * as THREE38 from "three";
14249
14437
 
14250
14438
  // src/CadViewerJscad.tsx
14251
14439
  import { su as su11 } from "@tscircuit/circuit-json-util";
@@ -23943,6 +24131,7 @@ var A2512 = ({ color = "#333" }) => {
23943
24131
  var FemaleHeader = ({
23944
24132
  x,
23945
24133
  y,
24134
+ z: z18 = 0,
23946
24135
  pitch = 2.54,
23947
24136
  legsLength = 3,
23948
24137
  innerDiameter = 0.945,
@@ -23960,7 +24149,7 @@ var FemaleHeader = ({
23960
24149
  {
23961
24150
  color: "#000",
23962
24151
  size: [bodyLength10, bodyWidth, bodyHeight],
23963
- center: [x, y, flipZ(bodyHeight / 2)]
24152
+ center: [x, y, flipZ(z18 + bodyHeight / 2)]
23964
24153
  }
23965
24154
  ),
23966
24155
  innerDiameter ? /* @__PURE__ */ jsx2(
@@ -23968,14 +24157,14 @@ var FemaleHeader = ({
23968
24157
  {
23969
24158
  height: bodyHeight + 0.1,
23970
24159
  radius: innerDiameter / 2,
23971
- center: [x, y, flipZ(bodyHeight / 2)],
24160
+ center: [x, y, flipZ(z18 + bodyHeight / 2)],
23972
24161
  color: "#222"
23973
24162
  }
23974
24163
  ) : /* @__PURE__ */ jsx2(
23975
24164
  Cuboid,
23976
24165
  {
23977
24166
  size: [gapWidth, gapWidth, bodyHeight],
23978
- center: [x, y, flipZ(bodyHeight / 2)]
24167
+ center: [x, y, flipZ(z18 + bodyHeight / 2)]
23979
24168
  }
23980
24169
  )
23981
24170
  ] }) }),
@@ -23986,7 +24175,7 @@ var FemaleHeader = ({
23986
24175
  {
23987
24176
  color: "silver",
23988
24177
  size: [pinThickness, pinThickness, legsLength * 0.9],
23989
- center: [x, y, flipZ(-legsLength / 2 * 0.9)]
24178
+ center: [x, y, flipZ(z18 + -legsLength / 2 * 0.9)]
23990
24179
  }
23991
24180
  ),
23992
24181
  /* @__PURE__ */ jsx2(
@@ -23994,7 +24183,7 @@ var FemaleHeader = ({
23994
24183
  {
23995
24184
  color: "silver",
23996
24185
  size: [pinThickness / 1.8, pinThickness / 1.8, legsLength],
23997
- center: [x, y, flipZ(-legsLength / 2)]
24186
+ center: [x, y, flipZ(z18 + -legsLength / 2)]
23998
24187
  }
23999
24188
  )
24000
24189
  ] }),
@@ -24003,7 +24192,7 @@ var FemaleHeader = ({
24003
24192
  {
24004
24193
  color: "silver",
24005
24194
  size: [gapWidth, gapWidth, gapWidth * 0.5],
24006
- center: [x, y, flipZ(gapWidth / 2 * 0.5)]
24195
+ center: [x, y, flipZ(z18 + gapWidth / 2 * 0.5)]
24007
24196
  }
24008
24197
  )
24009
24198
  ] })
@@ -26531,7 +26720,7 @@ var StampBoard = ({
26531
26720
  for (let i = 0; i < leadsRight; i++) {
26532
26721
  const y = yOffset + i * leadsPitch;
26533
26722
  pads.push({
26534
- x: -halfBoardWidth + leadLength / 2,
26723
+ x: halfBoardWidth - leadLength / 2,
26535
26724
  y: -y,
26536
26725
  // Flip y
26537
26726
  pl: leadLength,
@@ -26539,8 +26728,8 @@ var StampBoard = ({
26539
26728
  });
26540
26729
  if (innerHoles) {
26541
26730
  holes.push(
26542
- { x: -halfBoardWidth, y: -y },
26543
- { x: -halfBoardWidth + innerHoleEdgeDistance, y: -y }
26731
+ { x: halfBoardWidth, y: -y },
26732
+ { x: halfBoardWidth - innerHoleEdgeDistance, y: -y }
26544
26733
  );
26545
26734
  }
26546
26735
  }
@@ -26550,7 +26739,7 @@ var StampBoard = ({
26550
26739
  for (let i = 0; i < leadsLeft; i++) {
26551
26740
  const y = yOffset + i * leadsPitch;
26552
26741
  pads.push({
26553
- x: halfBoardWidth - leadLength / 2,
26742
+ x: -halfBoardWidth + leadLength / 2,
26554
26743
  y: -y,
26555
26744
  // Flip y
26556
26745
  pl: leadLength,
@@ -26558,8 +26747,8 @@ var StampBoard = ({
26558
26747
  });
26559
26748
  if (innerHoles) {
26560
26749
  holes.push(
26561
- { x: halfBoardWidth, y: -y },
26562
- { x: halfBoardWidth - innerHoleEdgeDistance, y: -y }
26750
+ { x: -halfBoardWidth, y: -y },
26751
+ { x: -halfBoardWidth + innerHoleEdgeDistance, y: -y }
26563
26752
  );
26564
26753
  }
26565
26754
  }
@@ -26571,14 +26760,14 @@ var StampBoard = ({
26571
26760
  pads.push({
26572
26761
  x: -x,
26573
26762
  // Flip x
26574
- y: -bodyLength10 / 2 + leadLength / 2,
26763
+ y: bodyLength10 / 2 - leadLength / 2,
26575
26764
  pl: leadWidth,
26576
26765
  pw: leadLength
26577
26766
  });
26578
26767
  if (innerHoles) {
26579
26768
  holes.push(
26580
- { x: -x, y: -bodyLength10 / 2 },
26581
- { x: -x, y: -bodyLength10 / 2 + innerHoleEdgeDistance }
26769
+ { x: -x, y: bodyLength10 / 2 },
26770
+ { x: -x, y: bodyLength10 / 2 - innerHoleEdgeDistance }
26582
26771
  );
26583
26772
  }
26584
26773
  }
@@ -26590,14 +26779,14 @@ var StampBoard = ({
26590
26779
  pads.push({
26591
26780
  x: -x,
26592
26781
  // Flip x
26593
- y: bodyLength10 / 2 - leadLength / 2,
26782
+ y: -bodyLength10 / 2 + leadLength / 2,
26594
26783
  pl: leadWidth,
26595
26784
  pw: leadLength
26596
26785
  });
26597
26786
  if (innerHoles) {
26598
26787
  holes.push(
26599
- { x: -x, y: bodyLength10 / 2 },
26600
- { x: -x, y: bodyLength10 / 2 - innerHoleEdgeDistance }
26788
+ { x: -x, y: -bodyLength10 / 2 },
26789
+ { x: -x, y: -bodyLength10 / 2 + innerHoleEdgeDistance }
26601
26790
  );
26602
26791
  }
26603
26792
  }
@@ -26652,6 +26841,66 @@ var StampBoard = ({
26652
26841
  ] }) : rectPads })
26653
26842
  ] });
26654
26843
  };
26844
+ var Screen = ({
26845
+ width: width10 = 30,
26846
+ height: height10 = 22,
26847
+ thickness = 1,
26848
+ bezelInset = 2,
26849
+ bezelDepth = 1,
26850
+ screenColor = "#001414",
26851
+ bezelColor = "#0f1116",
26852
+ screenWidth,
26853
+ screenHeight,
26854
+ offset: offset4
26855
+ }) => {
26856
+ const w = width10;
26857
+ const h2 = height10;
26858
+ const stackHeight = Math.max(thickness, 0.4);
26859
+ const clampedBezelDepth = Math.max(Math.min(bezelDepth, stackHeight), 0.2);
26860
+ const backBlockHeight = Math.max(stackHeight - clampedBezelDepth, 0);
26861
+ const inset = Math.max(bezelInset, 0);
26862
+ const innerWidth = Math.max(screenWidth ?? w - inset * 2, 2);
26863
+ const innerHeight = Math.max(screenHeight ?? h2 - inset * 2, 2);
26864
+ const screenThickness = Math.min(
26865
+ Math.max(clampedBezelDepth * 0.6, 0.2),
26866
+ clampedBezelDepth
26867
+ );
26868
+ const offsetX = offset4?.x ?? 0;
26869
+ const offsetY = offset4?.y ?? 0;
26870
+ const offsetZ = offset4?.z ?? 0;
26871
+ return /* @__PURE__ */ jsxs(Translate, { offset: { x: offsetX, y: offsetY, z: offsetZ }, children: [
26872
+ backBlockHeight > 0 && /* @__PURE__ */ jsx2(Colorize, { color: bezelColor, children: /* @__PURE__ */ jsx2(
26873
+ Cuboid,
26874
+ {
26875
+ size: [w, h2, backBlockHeight],
26876
+ offset: [0, 0, backBlockHeight / 2]
26877
+ }
26878
+ ) }),
26879
+ /* @__PURE__ */ jsx2(Colorize, { color: bezelColor, children: /* @__PURE__ */ jsxs(Subtract, { children: [
26880
+ /* @__PURE__ */ jsx2(
26881
+ Cuboid,
26882
+ {
26883
+ size: [w, h2, clampedBezelDepth],
26884
+ offset: [0, 0, backBlockHeight + clampedBezelDepth / 2]
26885
+ }
26886
+ ),
26887
+ /* @__PURE__ */ jsx2(
26888
+ Cuboid,
26889
+ {
26890
+ size: [innerWidth, innerHeight, clampedBezelDepth + 0.02],
26891
+ offset: [0, 0, backBlockHeight + clampedBezelDepth / 2]
26892
+ }
26893
+ )
26894
+ ] }) }),
26895
+ /* @__PURE__ */ jsx2(Colorize, { color: screenColor, children: /* @__PURE__ */ jsx2(
26896
+ Cuboid,
26897
+ {
26898
+ size: [innerWidth, innerHeight, screenThickness],
26899
+ offset: [0, 0, backBlockHeight + screenThickness / 2]
26900
+ }
26901
+ ) })
26902
+ ] });
26903
+ };
26655
26904
  var MountedPcbModule = ({
26656
26905
  numPins = 5,
26657
26906
  rows = 1,
@@ -26665,8 +26914,15 @@ var MountedPcbModule = ({
26665
26914
  holes = [],
26666
26915
  holeInset = 1,
26667
26916
  pinRowHoleEdgeToEdgeDist = 2,
26668
- nopin
26917
+ female,
26918
+ nopin,
26919
+ screen,
26920
+ screenWidth,
26921
+ screenHeight,
26922
+ screenCenterOffsetX,
26923
+ screenCenterOffsetY
26669
26924
  }) => {
26925
+ const showScreen = screen ?? false;
26670
26926
  const boardCenterZ = boardThickness / 2;
26671
26927
  const numPinsPerRow = Math.ceil(numPins / rows);
26672
26928
  let calculatedWidth;
@@ -26743,7 +26999,8 @@ var MountedPcbModule = ({
26743
26999
  const pinBodyHeight = 2;
26744
27000
  const longSidePinLength = 6;
26745
27001
  const shortSidePinLength = 3;
26746
- const boardOffsetZ = nopin ? 0 : pinBodyHeight;
27002
+ const boardOffsetZ = nopin || female ? 0 : pinBodyHeight;
27003
+ const boardTopZ = boardOffsetZ + boardThickness;
26747
27004
  const boardBody = /* @__PURE__ */ jsx2(Colorize, { color: "#008080", children: /* @__PURE__ */ jsxs(Subtract, { children: [
26748
27005
  /* @__PURE__ */ jsx2(
26749
27006
  Cuboid,
@@ -26802,10 +27059,32 @@ var MountedPcbModule = ({
26802
27059
  },
26803
27060
  `pin-3d-${index2}`
26804
27061
  ));
27062
+ const femaleHeaderRow = pins.map((pin, index2) => /* @__PURE__ */ jsx2(
27063
+ FemaleHeader,
27064
+ {
27065
+ x: pin.x,
27066
+ y: pin.y,
27067
+ flipZ: (z18) => -z18
27068
+ },
27069
+ `female-pin-3d-${index2}`
27070
+ ));
26805
27071
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
26806
27072
  boardBody,
26807
27073
  platedHoles,
26808
- !nopin && headerPins
27074
+ !female && !nopin && headerPins,
27075
+ female && femaleHeaderRow,
27076
+ showScreen && /* @__PURE__ */ jsx2(
27077
+ Screen,
27078
+ {
27079
+ width: screenWidth ?? finalWidth * 0.8,
27080
+ height: screenHeight ?? finalHeight * 0.6,
27081
+ offset: {
27082
+ x: screenCenterOffsetX ?? 0,
27083
+ y: screenCenterOffsetY ?? 0,
27084
+ z: boardTopZ
27085
+ }
27086
+ }
27087
+ )
26809
27088
  ] });
26810
27089
  };
26811
27090
  var Footprinter3d = ({ footprint }) => {
@@ -27086,7 +27365,13 @@ var Footprinter3d = ({ footprint }) => {
27086
27365
  holes,
27087
27366
  holeInset,
27088
27367
  pinRowHoleEdgeToEdgeDist,
27089
- nopin: fpJson.nopin
27368
+ nopin: fpJson.nopin,
27369
+ female: fpJson.female,
27370
+ screen: fpJson.screen,
27371
+ screenWidth: fpJson.screenwidth,
27372
+ screenHeight: fpJson.screenheight,
27373
+ screenCenterOffsetX: fpJson.screencenteroffsetx,
27374
+ screenCenterOffsetY: fpJson.screencenteroffsety
27090
27375
  }
27091
27376
  );
27092
27377
  }
@@ -28483,7 +28768,7 @@ import * as THREE16 from "three";
28483
28768
  // package.json
28484
28769
  var package_default = {
28485
28770
  name: "@tscircuit/3d-viewer",
28486
- version: "0.0.522",
28771
+ version: "0.0.524",
28487
28772
  main: "./dist/index.js",
28488
28773
  module: "./dist/index.js",
28489
28774
  type: "module",
@@ -28543,7 +28828,7 @@ var package_default = {
28543
28828
  "bun-match-svg": "^0.0.9",
28544
28829
  "bun-types": "1.2.1",
28545
28830
  debug: "^4.4.0",
28546
- "jscad-electronics": "^0.0.118",
28831
+ "jscad-electronics": "^0.0.123",
28547
28832
  "jscad-planner": "^0.0.13",
28548
28833
  jsdom: "^26.0.0",
28549
28834
  "manifold-3d": "^3.2.1",
@@ -31452,7 +31737,7 @@ import { su as su8 } from "@tscircuit/circuit-json-util";
31452
31737
  import { useEffect as useEffect23, useMemo as useMemo19 } from "react";
31453
31738
 
31454
31739
  // src/textures/create-combined-board-textures.ts
31455
- import * as THREE27 from "three";
31740
+ import * as THREE28 from "three";
31456
31741
 
31457
31742
  // node_modules/@tscircuit/math-utils/dist/chunk-5N7UJNVK.js
31458
31743
  var getBoundsFromPoints = (points) => {
@@ -32401,12 +32686,11 @@ function createFabricationNoteTextureForLayer({
32401
32686
  return texture;
32402
32687
  }
32403
32688
 
32404
- // src/textures/create-silkscreen-texture-for-layer.ts
32689
+ // src/textures/create-pcb-note-texture-for-layer.ts
32405
32690
  import * as THREE25 from "three";
32406
32691
 
32407
- // src/textures/silkscreen/silkscreen-drawing.ts
32692
+ // src/textures/pcb-note/pcb-note-drawing.ts
32408
32693
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer4 } from "circuit-to-canvas";
32409
- var FABRICATION_NOTE_COLOR2 = "rgb(255,243,204)";
32410
32694
  var TRANSPARENT2 = "rgba(0,0,0,0)";
32411
32695
  var setDrawerBounds3 = (drawer, bounds) => {
32412
32696
  drawer.setCameraBounds({
@@ -32416,14 +32700,75 @@ var setDrawerBounds3 = (drawer, bounds) => {
32416
32700
  maxY: bounds.maxY
32417
32701
  });
32418
32702
  };
32419
- var drawSilkscreenLayer = ({
32703
+ var normalizePcbNoteElement = (element) => {
32704
+ if (element.type === "pcb_note_line") {
32705
+ return {
32706
+ ...element,
32707
+ x1: coerceDimensionToMm(element.x1, 0),
32708
+ y1: coerceDimensionToMm(element.y1, 0),
32709
+ x2: coerceDimensionToMm(element.x2, 0),
32710
+ y2: coerceDimensionToMm(element.y2, 0),
32711
+ stroke_width: coerceDimensionToMm(element.stroke_width, 0.1)
32712
+ };
32713
+ }
32714
+ if (element.type === "pcb_note_rect") {
32715
+ return {
32716
+ ...element,
32717
+ center: {
32718
+ x: coerceDimensionToMm(element.center.x, 0),
32719
+ y: coerceDimensionToMm(element.center.y, 0)
32720
+ },
32721
+ width: coerceDimensionToMm(element.width, 0),
32722
+ height: coerceDimensionToMm(element.height, 0),
32723
+ stroke_width: coerceDimensionToMm(element.stroke_width, 0.1),
32724
+ corner_radius: coerceDimensionToMm(element.corner_radius, 0)
32725
+ };
32726
+ }
32727
+ if (element.type === "pcb_note_text") {
32728
+ return {
32729
+ ...element,
32730
+ anchor_position: {
32731
+ x: coerceDimensionToMm(element.anchor_position.x, 0),
32732
+ y: coerceDimensionToMm(element.anchor_position.y, 0)
32733
+ },
32734
+ font_size: coerceDimensionToMm(element.font_size, 1)
32735
+ };
32736
+ }
32737
+ if (element.type === "pcb_note_path") {
32738
+ return {
32739
+ ...element,
32740
+ route: element.route.map((point) => ({
32741
+ ...point,
32742
+ x: coerceDimensionToMm(point.x, 0),
32743
+ y: coerceDimensionToMm(point.y, 0)
32744
+ })),
32745
+ stroke_width: coerceDimensionToMm(element.stroke_width, 0.1)
32746
+ };
32747
+ }
32748
+ if (element.type === "pcb_note_dimension") {
32749
+ return {
32750
+ ...element,
32751
+ from: {
32752
+ x: coerceDimensionToMm(element.from.x, 0),
32753
+ y: coerceDimensionToMm(element.from.y, 0)
32754
+ },
32755
+ to: {
32756
+ x: coerceDimensionToMm(element.to.x, 0),
32757
+ y: coerceDimensionToMm(element.to.y, 0)
32758
+ },
32759
+ font_size: coerceDimensionToMm(element.font_size, 1),
32760
+ arrow_size: coerceDimensionToMm(element.arrow_size, 1),
32761
+ offset_distance: coerceDimensionToMm(element.offset_distance, 0)
32762
+ };
32763
+ }
32764
+ return element;
32765
+ };
32766
+ var drawPcbNoteLayer = ({
32420
32767
  ctx,
32421
- layer,
32422
32768
  bounds,
32423
- elements,
32424
- silkscreenColor
32769
+ elements
32425
32770
  }) => {
32426
- const renderLayer = layer === "top" ? "top_silkscreen" : "bottom_silkscreen";
32771
+ const normalizedElements = elements.map(normalizePcbNoteElement);
32427
32772
  const drawer = new CircuitToCanvasDrawer4(ctx);
32428
32773
  drawer.configure({
32429
32774
  colorOverrides: {
@@ -32437,29 +32782,130 @@ var drawSilkscreenLayer = ({
32437
32782
  inner5: TRANSPARENT2,
32438
32783
  inner6: TRANSPARENT2
32439
32784
  },
32440
- copperPour: {
32441
- top: TRANSPARENT2,
32442
- bottom: TRANSPARENT2
32443
- },
32785
+ copperPour: { top: TRANSPARENT2, bottom: TRANSPARENT2 },
32444
32786
  drill: TRANSPARENT2,
32445
32787
  boardOutline: TRANSPARENT2,
32446
32788
  substrate: TRANSPARENT2,
32447
32789
  keepout: TRANSPARENT2,
32448
- courtyard: {
32790
+ courtyard: { top: TRANSPARENT2, bottom: TRANSPARENT2 },
32791
+ soldermask: { top: TRANSPARENT2, bottom: TRANSPARENT2 },
32792
+ soldermaskWithCopperUnderneath: {
32449
32793
  top: TRANSPARENT2,
32450
32794
  bottom: TRANSPARENT2
32451
32795
  },
32452
- soldermask: {
32796
+ soldermaskOverCopper: {
32453
32797
  top: TRANSPARENT2,
32454
32798
  bottom: TRANSPARENT2
32455
32799
  },
32800
+ silkscreen: { top: TRANSPARENT2, bottom: TRANSPARENT2 },
32801
+ fabricationNote: TRANSPARENT2
32802
+ }
32803
+ });
32804
+ setDrawerBounds3(drawer, bounds);
32805
+ drawer.drawElements(normalizedElements);
32806
+ };
32807
+
32808
+ // src/textures/create-pcb-note-texture-for-layer.ts
32809
+ var isPcbNoteElement = (element, layer) => {
32810
+ if (!("layer" in element) || element.layer !== layer) return false;
32811
+ return element.type.startsWith("pcb_note_");
32812
+ };
32813
+ function createPcbNoteTextureForLayer({
32814
+ layer,
32815
+ circuitJson,
32816
+ boardData,
32817
+ traceTextureResolution = TRACE_TEXTURE_RESOLUTION
32818
+ }) {
32819
+ const elements = circuitJson.filter(
32820
+ (element) => isPcbNoteElement(element, layer)
32821
+ );
32822
+ if (elements.length === 0) return null;
32823
+ const bounds = getSoldermaskRenderBounds(circuitJson, boardData);
32824
+ const canvasWidth = Math.floor(bounds.width * traceTextureResolution);
32825
+ const canvasHeight = Math.floor(bounds.height * traceTextureResolution);
32826
+ if (canvasWidth <= 0 || canvasHeight <= 0) return null;
32827
+ const canvas = document.createElement("canvas");
32828
+ canvas.width = canvasWidth;
32829
+ canvas.height = canvasHeight;
32830
+ const ctx = canvas.getContext("2d");
32831
+ if (!ctx) return null;
32832
+ if (layer === "bottom") {
32833
+ ctx.translate(0, canvasHeight);
32834
+ ctx.scale(1, -1);
32835
+ }
32836
+ drawPcbNoteLayer({
32837
+ ctx,
32838
+ bounds,
32839
+ elements
32840
+ });
32841
+ const texture = new THREE25.CanvasTexture(canvas);
32842
+ texture.generateMipmaps = true;
32843
+ texture.minFilter = THREE25.LinearMipmapLinearFilter;
32844
+ texture.magFilter = THREE25.LinearFilter;
32845
+ texture.anisotropy = 16;
32846
+ texture.needsUpdate = true;
32847
+ return texture;
32848
+ }
32849
+
32850
+ // src/textures/create-silkscreen-texture-for-layer.ts
32851
+ import * as THREE26 from "three";
32852
+
32853
+ // src/textures/silkscreen/silkscreen-drawing.ts
32854
+ import { CircuitToCanvasDrawer as CircuitToCanvasDrawer5 } from "circuit-to-canvas";
32855
+ var FABRICATION_NOTE_COLOR2 = "rgb(255,243,204)";
32856
+ var TRANSPARENT3 = "rgba(0,0,0,0)";
32857
+ var setDrawerBounds4 = (drawer, bounds) => {
32858
+ drawer.setCameraBounds({
32859
+ minX: bounds.minX,
32860
+ maxX: bounds.maxX,
32861
+ minY: bounds.minY,
32862
+ maxY: bounds.maxY
32863
+ });
32864
+ };
32865
+ var drawSilkscreenLayer = ({
32866
+ ctx,
32867
+ layer,
32868
+ bounds,
32869
+ elements,
32870
+ silkscreenColor
32871
+ }) => {
32872
+ const renderLayer = layer === "top" ? "top_silkscreen" : "bottom_silkscreen";
32873
+ const drawer = new CircuitToCanvasDrawer5(ctx);
32874
+ drawer.configure({
32875
+ colorOverrides: {
32876
+ copper: {
32877
+ top: TRANSPARENT3,
32878
+ bottom: TRANSPARENT3,
32879
+ inner1: TRANSPARENT3,
32880
+ inner2: TRANSPARENT3,
32881
+ inner3: TRANSPARENT3,
32882
+ inner4: TRANSPARENT3,
32883
+ inner5: TRANSPARENT3,
32884
+ inner6: TRANSPARENT3
32885
+ },
32886
+ copperPour: {
32887
+ top: TRANSPARENT3,
32888
+ bottom: TRANSPARENT3
32889
+ },
32890
+ drill: TRANSPARENT3,
32891
+ boardOutline: TRANSPARENT3,
32892
+ substrate: TRANSPARENT3,
32893
+ keepout: TRANSPARENT3,
32894
+ courtyard: {
32895
+ top: TRANSPARENT3,
32896
+ bottom: TRANSPARENT3
32897
+ },
32898
+ soldermask: {
32899
+ top: TRANSPARENT3,
32900
+ bottom: TRANSPARENT3
32901
+ },
32456
32902
  soldermaskWithCopperUnderneath: {
32457
- top: TRANSPARENT2,
32458
- bottom: TRANSPARENT2
32903
+ top: TRANSPARENT3,
32904
+ bottom: TRANSPARENT3
32459
32905
  },
32460
32906
  soldermaskOverCopper: {
32461
- top: TRANSPARENT2,
32462
- bottom: TRANSPARENT2
32907
+ top: TRANSPARENT3,
32908
+ bottom: TRANSPARENT3
32463
32909
  },
32464
32910
  silkscreen: {
32465
32911
  top: silkscreenColor,
@@ -32468,7 +32914,7 @@ var drawSilkscreenLayer = ({
32468
32914
  fabricationNote: FABRICATION_NOTE_COLOR2
32469
32915
  }
32470
32916
  });
32471
- setDrawerBounds3(drawer, bounds);
32917
+ setDrawerBounds4(drawer, bounds);
32472
32918
  drawer.drawElements(elements, {
32473
32919
  layers: [renderLayer]
32474
32920
  });
@@ -32478,7 +32924,7 @@ var drawSilkscreenLayer = ({
32478
32924
  var isSilkscreenElement = (element, layer) => {
32479
32925
  if (!("layer" in element) || element.layer !== layer) return false;
32480
32926
  const elementType = element.type;
32481
- return elementType.startsWith("pcb_silkscreen_") || elementType === "pcb_note_line";
32927
+ return elementType.startsWith("pcb_silkscreen_");
32482
32928
  };
32483
32929
  function createSilkscreenTextureForLayer({
32484
32930
  layer,
@@ -32511,20 +32957,20 @@ function createSilkscreenTextureForLayer({
32511
32957
  elements,
32512
32958
  silkscreenColor
32513
32959
  });
32514
- const texture = new THREE25.CanvasTexture(canvas);
32960
+ const texture = new THREE26.CanvasTexture(canvas);
32515
32961
  texture.generateMipmaps = true;
32516
- texture.minFilter = THREE25.LinearMipmapLinearFilter;
32517
- texture.magFilter = THREE25.LinearFilter;
32962
+ texture.minFilter = THREE26.LinearMipmapLinearFilter;
32963
+ texture.magFilter = THREE26.LinearFilter;
32518
32964
  texture.anisotropy = 16;
32519
32965
  texture.needsUpdate = true;
32520
32966
  return texture;
32521
32967
  }
32522
32968
 
32523
32969
  // src/textures/create-soldermask-texture-for-layer.ts
32524
- import * as THREE26 from "three";
32970
+ import * as THREE27 from "three";
32525
32971
 
32526
32972
  // src/textures/soldermask/soldermask-drawing.ts
32527
- import { CircuitToCanvasDrawer as CircuitToCanvasDrawer5 } from "circuit-to-canvas";
32973
+ import { CircuitToCanvasDrawer as CircuitToCanvasDrawer6 } from "circuit-to-canvas";
32528
32974
  var toRgb = (colorArr) => {
32529
32975
  const [r = 0, g = 0, b = 0] = colorArr;
32530
32976
  return `rgb(${Math.round(r * 255)}, ${Math.round(g * 255)}, ${Math.round(
@@ -32543,7 +32989,7 @@ var getSoldermaskPalette = (material) => {
32543
32989
  transparent: "rgba(0,0,0,0)"
32544
32990
  };
32545
32991
  };
32546
- var setDrawerBounds4 = (drawer, bounds) => {
32992
+ var setDrawerBounds5 = (drawer, bounds) => {
32547
32993
  drawer.setCameraBounds({
32548
32994
  minX: bounds.minX,
32549
32995
  maxX: bounds.maxX,
@@ -32560,7 +33006,7 @@ var drawSoldermaskLayer = ({
32560
33006
  }) => {
32561
33007
  const palette = getSoldermaskPalette(boardMaterial);
32562
33008
  const copperRenderLayer = layer === "top" ? "top_copper" : "bottom_copper";
32563
- const drawer = new CircuitToCanvasDrawer5(ctx);
33009
+ const drawer = new CircuitToCanvasDrawer6(ctx);
32564
33010
  drawer.configure({
32565
33011
  colorOverrides: {
32566
33012
  copper: {
@@ -32591,7 +33037,7 @@ var drawSoldermaskLayer = ({
32591
33037
  }
32592
33038
  }
32593
33039
  });
32594
- setDrawerBounds4(drawer, bounds);
33040
+ setDrawerBounds5(drawer, bounds);
32595
33041
  drawer.drawElements(elements, {
32596
33042
  layers: [copperRenderLayer],
32597
33043
  drawSoldermask: true,
@@ -32604,7 +33050,7 @@ var drawSoldermaskLayer = ({
32604
33050
  if (uncoveredPours.length > 0) {
32605
33051
  ctx.save();
32606
33052
  ctx.globalCompositeOperation = "destination-out";
32607
- const cutoutDrawer = new CircuitToCanvasDrawer5(ctx);
33053
+ const cutoutDrawer = new CircuitToCanvasDrawer6(ctx);
32608
33054
  cutoutDrawer.configure({
32609
33055
  colorOverrides: {
32610
33056
  copper: {
@@ -32619,7 +33065,7 @@ var drawSoldermaskLayer = ({
32619
33065
  }
32620
33066
  }
32621
33067
  });
32622
- setDrawerBounds4(cutoutDrawer, bounds);
33068
+ setDrawerBounds5(cutoutDrawer, bounds);
32623
33069
  cutoutDrawer.drawElements(uncoveredPours, { layers: [copperRenderLayer] });
32624
33070
  ctx.restore();
32625
33071
  }
@@ -32653,10 +33099,10 @@ function createSoldermaskTextureForLayer({
32653
33099
  elements,
32654
33100
  boardMaterial: boardData.material
32655
33101
  });
32656
- const texture = new THREE26.CanvasTexture(canvas);
33102
+ const texture = new THREE27.CanvasTexture(canvas);
32657
33103
  texture.generateMipmaps = true;
32658
- texture.minFilter = THREE26.LinearMipmapLinearFilter;
32659
- texture.magFilter = THREE26.LinearFilter;
33104
+ texture.minFilter = THREE27.LinearMipmapLinearFilter;
33105
+ texture.magFilter = THREE27.LinearFilter;
32660
33106
  texture.anisotropy = 16;
32661
33107
  texture.needsUpdate = true;
32662
33108
  return texture;
@@ -32694,10 +33140,10 @@ var createCombinedTexture = ({
32694
33140
  const image = texture.image;
32695
33141
  ctx.drawImage(image, 0, 0, canvasWidth, canvasHeight);
32696
33142
  });
32697
- const combinedTexture = new THREE27.CanvasTexture(canvas);
33143
+ const combinedTexture = new THREE28.CanvasTexture(canvas);
32698
33144
  combinedTexture.generateMipmaps = false;
32699
- combinedTexture.minFilter = THREE27.LinearFilter;
32700
- combinedTexture.magFilter = THREE27.LinearFilter;
33145
+ combinedTexture.minFilter = THREE28.LinearFilter;
33146
+ combinedTexture.magFilter = THREE28.LinearFilter;
32701
33147
  combinedTexture.premultiplyAlpha = true;
32702
33148
  combinedTexture.anisotropy = 16;
32703
33149
  combinedTexture.needsUpdate = true;
@@ -32764,6 +33210,12 @@ function createCombinedBoardTextures({
32764
33210
  boardData,
32765
33211
  traceTextureResolution
32766
33212
  }) : null;
33213
+ const pcbNoteTexture = showSilkscreen ? createPcbNoteTextureForLayer({
33214
+ layer,
33215
+ circuitJson,
33216
+ boardData,
33217
+ traceTextureResolution
33218
+ }) : null;
32767
33219
  const panelOutlineTexture = showBoardBody ? createPanelOutlineTextureForLayer({
32768
33220
  layer,
32769
33221
  circuitJson,
@@ -32779,6 +33231,7 @@ function createCombinedBoardTextures({
32779
33231
  copperTextTexture,
32780
33232
  silkscreenTexture,
32781
33233
  fabricationNoteTexture,
33234
+ pcbNoteTexture,
32782
33235
  panelOutlineTexture
32783
33236
  ],
32784
33237
  boardData,
@@ -32793,7 +33246,7 @@ function createCombinedBoardTextures({
32793
33246
  }
32794
33247
 
32795
33248
  // src/textures/create-three-texture-meshes.ts
32796
- import * as THREE28 from "three";
33249
+ import * as THREE29 from "three";
32797
33250
  function createTexturePlane(config, boardData) {
32798
33251
  const {
32799
33252
  texture,
@@ -32805,15 +33258,15 @@ function createTexturePlane(config, boardData) {
32805
33258
  } = config;
32806
33259
  if (!texture) return null;
32807
33260
  const boardOutlineBounds = calculateOutlineBounds(boardData);
32808
- const planeGeom = new THREE28.PlaneGeometry(
33261
+ const planeGeom = new THREE29.PlaneGeometry(
32809
33262
  boardOutlineBounds.width,
32810
33263
  boardOutlineBounds.height
32811
33264
  );
32812
- const material = new THREE28.MeshBasicMaterial({
33265
+ const material = new THREE29.MeshBasicMaterial({
32813
33266
  map: texture,
32814
33267
  transparent: true,
32815
33268
  alphaTest: 0.08,
32816
- side: THREE28.DoubleSide,
33269
+ side: THREE29.DoubleSide,
32817
33270
  depthWrite: true,
32818
33271
  polygonOffset: usePolygonOffset,
32819
33272
  polygonOffsetFactor: usePolygonOffset ? -4 : 0,
@@ -32821,7 +33274,7 @@ function createTexturePlane(config, boardData) {
32821
33274
  polygonOffsetUnits: usePolygonOffset ? -4 : 0,
32822
33275
  opacity: isFaux ? FAUX_BOARD_OPACITY : 1
32823
33276
  });
32824
- const mesh = new THREE28.Mesh(planeGeom, material);
33277
+ const mesh = new THREE29.Mesh(planeGeom, material);
32825
33278
  mesh.position.set(
32826
33279
  boardOutlineBounds.centerX,
32827
33280
  boardOutlineBounds.centerY,
@@ -32866,7 +33319,7 @@ function createTextureMeshes(textures, boardData, pcbThickness, isFaux = false)
32866
33319
  }
32867
33320
 
32868
33321
  // src/three-components/JscadBoardTextures.tsx
32869
- import * as THREE29 from "three";
33322
+ import * as THREE30 from "three";
32870
33323
 
32871
33324
  // src/utils/layer-texture-resolution.ts
32872
33325
  var DEFAULT_MAX_TEXTURE_PIXELS = 4e6;
@@ -32962,7 +33415,7 @@ function JscadBoardTextures({
32962
33415
  const typedMaterial = material;
32963
33416
  for (const prop of textureProps) {
32964
33417
  const texture = typedMaterial[prop];
32965
- if (texture && texture instanceof THREE29.Texture) {
33418
+ if (texture && texture instanceof THREE30.Texture) {
32966
33419
  texture.dispose();
32967
33420
  typedMaterial[prop] = null;
32968
33421
  }
@@ -32972,22 +33425,22 @@ function JscadBoardTextures({
32972
33425
  const createTexturePlane2 = (texture, zOffset, isBottomLayer, name, usePolygonOffset = false, depthWrite = true, renderOrder = 1) => {
32973
33426
  if (!texture) return null;
32974
33427
  const boardOutlineBounds = calculateOutlineBounds(boardData);
32975
- const planeGeom = new THREE29.PlaneGeometry(
33428
+ const planeGeom = new THREE30.PlaneGeometry(
32976
33429
  boardOutlineBounds.width,
32977
33430
  boardOutlineBounds.height
32978
33431
  );
32979
- const material = new THREE29.MeshBasicMaterial({
33432
+ const material = new THREE30.MeshBasicMaterial({
32980
33433
  map: texture,
32981
33434
  transparent: true,
32982
33435
  alphaTest: 0.08,
32983
- side: THREE29.DoubleSide,
33436
+ side: THREE30.DoubleSide,
32984
33437
  depthWrite,
32985
33438
  polygonOffset: usePolygonOffset,
32986
33439
  polygonOffsetFactor: usePolygonOffset ? -4 : 0,
32987
33440
  polygonOffsetUnits: usePolygonOffset ? -4 : 0,
32988
33441
  opacity: isFaux ? FAUX_BOARD_OPACITY : 1
32989
33442
  });
32990
- const mesh = new THREE29.Mesh(planeGeom, material);
33443
+ const mesh = new THREE30.Mesh(planeGeom, material);
32991
33444
  mesh.position.set(
32992
33445
  boardOutlineBounds.centerX,
32993
33446
  boardOutlineBounds.centerY,
@@ -33032,7 +33485,7 @@ function JscadBoardTextures({
33032
33485
  mesh.geometry.dispose();
33033
33486
  if (Array.isArray(mesh.material)) {
33034
33487
  mesh.material.forEach((material) => disposeTextureMaterial(material));
33035
- } else if (mesh.material instanceof THREE29.Material) {
33488
+ } else if (mesh.material instanceof THREE30.Material) {
33036
33489
  disposeTextureMaterial(mesh.material);
33037
33490
  }
33038
33491
  });
@@ -33265,12 +33718,12 @@ var CadViewerJscad = forwardRef3(
33265
33718
  // src/CadViewerManifold.tsx
33266
33719
  import { su as su17 } from "@tscircuit/circuit-json-util";
33267
33720
  import { useEffect as useEffect25, useMemo as useMemo22, useState as useState16 } from "react";
33268
- import * as THREE36 from "three";
33721
+ import * as THREE37 from "three";
33269
33722
 
33270
33723
  // src/hooks/useManifoldBoardBuilder.ts
33271
33724
  import { su as su16 } from "@tscircuit/circuit-json-util";
33272
33725
  import { useEffect as useEffect24, useMemo as useMemo21, useRef as useRef9, useState as useState15 } from "react";
33273
- import * as THREE33 from "three";
33726
+ import * as THREE34 from "three";
33274
33727
 
33275
33728
  // src/utils/manifold/create-manifold-board.ts
33276
33729
  var arePointsClockwise2 = (points) => {
@@ -33612,17 +34065,17 @@ function processNonPlatedHolesForManifold(Manifold, CrossSection, circuitJson, p
33612
34065
 
33613
34066
  // src/utils/manifold/process-plated-holes.ts
33614
34067
  import { su as su14 } from "@tscircuit/circuit-json-util";
33615
- import * as THREE31 from "three";
34068
+ import * as THREE32 from "three";
33616
34069
 
33617
34070
  // src/utils/manifold-mesh-to-three-geometry.ts
33618
- import * as THREE30 from "three";
34071
+ import * as THREE31 from "three";
33619
34072
  function manifoldMeshToThreeGeometry(manifoldMesh) {
33620
- const geometry = new THREE30.BufferGeometry();
34073
+ const geometry = new THREE31.BufferGeometry();
33621
34074
  geometry.setAttribute(
33622
34075
  "position",
33623
- new THREE30.Float32BufferAttribute(manifoldMesh.vertProperties, 3)
34076
+ new THREE31.Float32BufferAttribute(manifoldMesh.vertProperties, 3)
33624
34077
  );
33625
- geometry.setIndex(new THREE30.Uint32BufferAttribute(manifoldMesh.triVerts, 1));
34078
+ geometry.setIndex(new THREE31.Uint32BufferAttribute(manifoldMesh.triVerts, 1));
33626
34079
  if (manifoldMesh.runIndex && manifoldMesh.runIndex.length > 1 && manifoldMesh.runOriginalID) {
33627
34080
  for (let i = 0; i < manifoldMesh.runIndex.length - 1; i++) {
33628
34081
  const start = manifoldMesh.runIndex[i];
@@ -33656,7 +34109,7 @@ var createEllipsePoints = (width10, height10, segments) => {
33656
34109
  }
33657
34110
  return points;
33658
34111
  };
33659
- var COPPER_COLOR = new THREE31.Color(...colors.copper);
34112
+ var COPPER_COLOR = new THREE32.Color(...colors.copper);
33660
34113
  var PLATED_HOLE_LIP_HEIGHT = 0.05;
33661
34114
  var PLATED_HOLE_PAD_THICKNESS = 3e-3;
33662
34115
  var PLATED_HOLE_SURFACE_CLEARANCE = 5e-4;
@@ -34398,7 +34851,7 @@ function processPlatedHolesForManifold(Manifold, CrossSection, circuitJson, pcbT
34398
34851
 
34399
34852
  // src/utils/manifold/process-vias.ts
34400
34853
  import { su as su15 } from "@tscircuit/circuit-json-util";
34401
- import * as THREE32 from "three";
34854
+ import * as THREE33 from "three";
34402
34855
 
34403
34856
  // src/utils/via-geoms.ts
34404
34857
  function createViaCopper2({
@@ -34451,7 +34904,7 @@ function createViaCopper2({
34451
34904
  }
34452
34905
 
34453
34906
  // src/utils/manifold/process-vias.ts
34454
- var COPPER_COLOR2 = new THREE32.Color(...colors.copper);
34907
+ var COPPER_COLOR2 = new THREE33.Color(...colors.copper);
34455
34908
  function processViasForManifold(Manifold, circuitJson, pcbThickness, manifoldInstancesForCleanup, boardClipVolume) {
34456
34909
  const viaBoardDrills = [];
34457
34910
  const pcbVias = su15(circuitJson).pcb_via.list();
@@ -34671,7 +35124,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
34671
35124
  {
34672
35125
  key: "plated-holes-union",
34673
35126
  geometry: cutPlatedGeom,
34674
- color: new THREE33.Color(
35127
+ color: new THREE34.Color(
34675
35128
  colors.copper[0],
34676
35129
  colors.copper[1],
34677
35130
  colors.copper[2]
@@ -34701,7 +35154,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
34701
35154
  const matColorArray = boardMaterialColors[boardData.material] ?? colors.fr4Tan;
34702
35155
  currentGeoms.board = {
34703
35156
  geometry: finalBoardGeom,
34704
- color: new THREE33.Color(
35157
+ color: new THREE34.Color(
34705
35158
  matColorArray[0],
34706
35159
  matColorArray[1],
34707
35160
  matColorArray[2]
@@ -34746,11 +35199,11 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
34746
35199
  };
34747
35200
 
34748
35201
  // src/utils/manifold/create-three-geometry-meshes.ts
34749
- import * as THREE35 from "three";
35202
+ import * as THREE36 from "three";
34750
35203
 
34751
35204
  // src/utils/create-board-material.ts
34752
- import * as THREE34 from "three";
34753
- var DEFAULT_SIDE = THREE34.DoubleSide;
35205
+ import * as THREE35 from "three";
35206
+ var DEFAULT_SIDE = THREE35.DoubleSide;
34754
35207
  var createBoardMaterial = ({
34755
35208
  material,
34756
35209
  color,
@@ -34758,7 +35211,7 @@ var createBoardMaterial = ({
34758
35211
  isFaux = false
34759
35212
  }) => {
34760
35213
  if (material === "fr4") {
34761
- return new THREE34.MeshPhysicalMaterial({
35214
+ return new THREE35.MeshPhysicalMaterial({
34762
35215
  color,
34763
35216
  side,
34764
35217
  metalness: 0,
@@ -34775,7 +35228,7 @@ var createBoardMaterial = ({
34775
35228
  polygonOffsetUnits: 1
34776
35229
  });
34777
35230
  }
34778
- return new THREE34.MeshStandardMaterial({
35231
+ return new THREE35.MeshStandardMaterial({
34779
35232
  color,
34780
35233
  side,
34781
35234
  flatShading: true,
@@ -34794,12 +35247,12 @@ function createGeometryMeshes(geoms) {
34794
35247
  const meshes = [];
34795
35248
  if (!geoms) return meshes;
34796
35249
  if (geoms.board && geoms.board.geometry) {
34797
- const mesh = new THREE35.Mesh(
35250
+ const mesh = new THREE36.Mesh(
34798
35251
  geoms.board.geometry,
34799
35252
  createBoardMaterial({
34800
35253
  material: geoms.board.material,
34801
35254
  color: geoms.board.color,
34802
- side: THREE35.DoubleSide,
35255
+ side: THREE36.DoubleSide,
34803
35256
  isFaux: geoms.board.isFaux
34804
35257
  })
34805
35258
  );
@@ -34809,11 +35262,11 @@ function createGeometryMeshes(geoms) {
34809
35262
  const createMeshesFromArray = (geomArray) => {
34810
35263
  if (geomArray) {
34811
35264
  geomArray.forEach((comp) => {
34812
- const mesh = new THREE35.Mesh(
35265
+ const mesh = new THREE36.Mesh(
34813
35266
  comp.geometry,
34814
- new THREE35.MeshStandardMaterial({
35267
+ new THREE36.MeshStandardMaterial({
34815
35268
  color: comp.color,
34816
- side: THREE35.DoubleSide,
35269
+ side: THREE36.DoubleSide,
34817
35270
  flatShading: true
34818
35271
  // Consistent with board
34819
35272
  })
@@ -34857,7 +35310,7 @@ var BoardMeshes = ({
34857
35310
  const typedMaterial = material;
34858
35311
  for (const prop of textureProps) {
34859
35312
  const texture = typedMaterial[prop];
34860
- if (texture && texture instanceof THREE36.Texture) {
35313
+ if (texture && texture instanceof THREE37.Texture) {
34861
35314
  texture.dispose();
34862
35315
  typedMaterial[prop] = null;
34863
35316
  }
@@ -41746,7 +42199,7 @@ var KeyboardShortcutsDialog = ({
41746
42199
 
41747
42200
  // src/CadViewer.tsx
41748
42201
  import { jsx as jsx38, jsxs as jsxs11 } from "react/jsx-runtime";
41749
- var DEFAULT_TARGET = new THREE37.Vector3(0, 0, 0);
42202
+ var DEFAULT_TARGET = new THREE38.Vector3(0, 0, 0);
41750
42203
  var INITIAL_CAMERA_POSITION = [5, -5, 5];
41751
42204
  var CadViewerInner = (props) => {
41752
42205
  const [engine, setEngine] = useState36("manifold");
@@ -42013,11 +42466,11 @@ var CadViewer = (props) => {
42013
42466
  // src/convert-circuit-json-to-3d-svg.ts
42014
42467
  var import_debug = __toESM(require_browser(), 1);
42015
42468
  import { su as su18 } from "@tscircuit/circuit-json-util";
42016
- import * as THREE41 from "three";
42469
+ import * as THREE42 from "three";
42017
42470
  import { SVGRenderer } from "three/examples/jsm/renderers/SVGRenderer.js";
42018
42471
 
42019
42472
  // src/utils/create-geometry-from-polygons.ts
42020
- import * as THREE38 from "three";
42473
+ import * as THREE39 from "three";
42021
42474
  import { BufferGeometry as BufferGeometry4, Float32BufferAttribute as Float32BufferAttribute3 } from "three";
42022
42475
  function createGeometryFromPolygons(polygons) {
42023
42476
  const geometry = new BufferGeometry4();
@@ -42031,12 +42484,12 @@ function createGeometryFromPolygons(polygons) {
42031
42484
  ...polygon3.vertices[i + 1]
42032
42485
  // Third vertex
42033
42486
  );
42034
- const v1 = new THREE38.Vector3(...polygon3.vertices[0]);
42035
- const v2 = new THREE38.Vector3(...polygon3.vertices[i]);
42036
- const v3 = new THREE38.Vector3(...polygon3.vertices[i + 1]);
42037
- const normal = new THREE38.Vector3().crossVectors(
42038
- new THREE38.Vector3().subVectors(v2, v1),
42039
- new THREE38.Vector3().subVectors(v3, v1)
42487
+ const v1 = new THREE39.Vector3(...polygon3.vertices[0]);
42488
+ const v2 = new THREE39.Vector3(...polygon3.vertices[i]);
42489
+ const v3 = new THREE39.Vector3(...polygon3.vertices[i + 1]);
42490
+ const normal = new THREE39.Vector3().crossVectors(
42491
+ new THREE39.Vector3().subVectors(v2, v1),
42492
+ new THREE39.Vector3().subVectors(v3, v1)
42040
42493
  ).normalize();
42041
42494
  normals.push(
42042
42495
  normal.x,
@@ -42060,10 +42513,10 @@ function createGeometryFromPolygons(polygons) {
42060
42513
  var import_modeling2 = __toESM(require_src(), 1);
42061
42514
  var import_jscad_planner2 = __toESM(require_dist(), 1);
42062
42515
  var jscadModeling2 = __toESM(require_src(), 1);
42063
- import * as THREE40 from "three";
42516
+ import * as THREE41 from "three";
42064
42517
 
42065
42518
  // src/utils/load-model.ts
42066
- import * as THREE39 from "three";
42519
+ import * as THREE40 from "three";
42067
42520
  import { GLTFLoader as GLTFLoader2 } from "three/examples/jsm/loaders/GLTFLoader.js";
42068
42521
  import { OBJLoader as OBJLoader2 } from "three/examples/jsm/loaders/OBJLoader.js";
42069
42522
  import { STLLoader as STLLoader2 } from "three/examples/jsm/loaders/STLLoader.js";
@@ -42071,12 +42524,12 @@ async function load3DModel(url) {
42071
42524
  if (url.endsWith(".stl")) {
42072
42525
  const loader = new STLLoader2();
42073
42526
  const geometry = await loader.loadAsync(url);
42074
- const material = new THREE39.MeshStandardMaterial({
42527
+ const material = new THREE40.MeshStandardMaterial({
42075
42528
  color: 8947848,
42076
42529
  metalness: 0.5,
42077
42530
  roughness: 0.5
42078
42531
  });
42079
- return new THREE39.Mesh(geometry, material);
42532
+ return new THREE40.Mesh(geometry, material);
42080
42533
  }
42081
42534
  if (url.endsWith(".obj")) {
42082
42535
  const loader = new OBJLoader2();
@@ -42109,9 +42562,9 @@ async function renderComponent(component, scene) {
42109
42562
  }
42110
42563
  if (component.rotation) {
42111
42564
  model.rotation.set(
42112
- THREE40.MathUtils.degToRad(component.rotation.x ?? 0),
42113
- THREE40.MathUtils.degToRad(component.rotation.y ?? 0),
42114
- THREE40.MathUtils.degToRad(component.rotation.z ?? 0)
42565
+ THREE41.MathUtils.degToRad(component.rotation.x ?? 0),
42566
+ THREE41.MathUtils.degToRad(component.rotation.y ?? 0),
42567
+ THREE41.MathUtils.degToRad(component.rotation.z ?? 0)
42115
42568
  );
42116
42569
  }
42117
42570
  scene.add(model);
@@ -42125,13 +42578,13 @@ async function renderComponent(component, scene) {
42125
42578
  );
42126
42579
  if (jscadObject && (jscadObject.polygons || jscadObject.sides)) {
42127
42580
  const threeGeom = convertCSGToThreeGeom(jscadObject);
42128
- const material2 = new THREE40.MeshStandardMaterial({
42581
+ const material2 = new THREE41.MeshStandardMaterial({
42129
42582
  color: 8947848,
42130
42583
  metalness: 0.5,
42131
42584
  roughness: 0.5,
42132
- side: THREE40.DoubleSide
42585
+ side: THREE41.DoubleSide
42133
42586
  });
42134
- const mesh2 = new THREE40.Mesh(threeGeom, material2);
42587
+ const mesh2 = new THREE41.Mesh(threeGeom, material2);
42135
42588
  if (component.position) {
42136
42589
  mesh2.position.set(
42137
42590
  component.position.x ?? 0,
@@ -42141,9 +42594,9 @@ async function renderComponent(component, scene) {
42141
42594
  }
42142
42595
  if (component.rotation) {
42143
42596
  mesh2.rotation.set(
42144
- THREE40.MathUtils.degToRad(component.rotation.x ?? 0),
42145
- THREE40.MathUtils.degToRad(component.rotation.y ?? 0),
42146
- THREE40.MathUtils.degToRad(component.rotation.z ?? 0)
42597
+ THREE41.MathUtils.degToRad(component.rotation.x ?? 0),
42598
+ THREE41.MathUtils.degToRad(component.rotation.y ?? 0),
42599
+ THREE41.MathUtils.degToRad(component.rotation.z ?? 0)
42147
42600
  );
42148
42601
  }
42149
42602
  scene.add(mesh2);
@@ -42160,17 +42613,17 @@ async function renderComponent(component, scene) {
42160
42613
  if (!geom || !geom.polygons && !geom.sides) {
42161
42614
  continue;
42162
42615
  }
42163
- const color = new THREE40.Color(geomInfo.color);
42616
+ const color = new THREE41.Color(geomInfo.color);
42164
42617
  color.convertLinearToSRGB();
42165
42618
  const geomWithColor = { ...geom, color: [color.r, color.g, color.b] };
42166
42619
  const threeGeom = convertCSGToThreeGeom(geomWithColor);
42167
- const material2 = new THREE40.MeshStandardMaterial({
42620
+ const material2 = new THREE41.MeshStandardMaterial({
42168
42621
  vertexColors: true,
42169
42622
  metalness: 0.2,
42170
42623
  roughness: 0.8,
42171
- side: THREE40.DoubleSide
42624
+ side: THREE41.DoubleSide
42172
42625
  });
42173
- const mesh2 = new THREE40.Mesh(threeGeom, material2);
42626
+ const mesh2 = new THREE41.Mesh(threeGeom, material2);
42174
42627
  if (component.position) {
42175
42628
  mesh2.position.set(
42176
42629
  component.position.x ?? 0,
@@ -42180,22 +42633,22 @@ async function renderComponent(component, scene) {
42180
42633
  }
42181
42634
  if (component.rotation) {
42182
42635
  mesh2.rotation.set(
42183
- THREE40.MathUtils.degToRad(component.rotation.x ?? 0),
42184
- THREE40.MathUtils.degToRad(component.rotation.y ?? 0),
42185
- THREE40.MathUtils.degToRad(component.rotation.z ?? 0)
42636
+ THREE41.MathUtils.degToRad(component.rotation.x ?? 0),
42637
+ THREE41.MathUtils.degToRad(component.rotation.y ?? 0),
42638
+ THREE41.MathUtils.degToRad(component.rotation.z ?? 0)
42186
42639
  );
42187
42640
  }
42188
42641
  scene.add(mesh2);
42189
42642
  }
42190
42643
  return;
42191
42644
  }
42192
- const geometry = new THREE40.BoxGeometry(0.5, 0.5, 0.5);
42193
- const material = new THREE40.MeshStandardMaterial({
42645
+ const geometry = new THREE41.BoxGeometry(0.5, 0.5, 0.5);
42646
+ const material = new THREE41.MeshStandardMaterial({
42194
42647
  color: 16711680,
42195
42648
  transparent: true,
42196
42649
  opacity: 0.25
42197
42650
  });
42198
- const mesh = new THREE40.Mesh(geometry, material);
42651
+ const mesh = new THREE41.Mesh(geometry, material);
42199
42652
  if (component.position) {
42200
42653
  mesh.position.set(
42201
42654
  component.position.x ?? 0,
@@ -42216,11 +42669,11 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
42216
42669
  padding = 20,
42217
42670
  zoom = 1.5
42218
42671
  } = options;
42219
- const scene = new THREE41.Scene();
42672
+ const scene = new THREE42.Scene();
42220
42673
  const renderer = new SVGRenderer();
42221
42674
  renderer.setSize(width10, height10);
42222
- renderer.setClearColor(new THREE41.Color(backgroundColor), 1);
42223
- const camera = new THREE41.OrthographicCamera();
42675
+ renderer.setClearColor(new THREE42.Color(backgroundColor), 1);
42676
+ const camera = new THREE42.OrthographicCamera();
42224
42677
  const aspect = width10 / height10;
42225
42678
  const frustumSize = 100;
42226
42679
  const halfFrustumSize = frustumSize / 2 / zoom;
@@ -42234,11 +42687,11 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
42234
42687
  camera.position.set(position.x, position.y, position.z);
42235
42688
  camera.up.set(0, 1, 0);
42236
42689
  const lookAt = options.camera?.lookAt ?? { x: 0, y: 0, z: 0 };
42237
- camera.lookAt(new THREE41.Vector3(lookAt.x, lookAt.y, lookAt.z));
42690
+ camera.lookAt(new THREE42.Vector3(lookAt.x, lookAt.y, lookAt.z));
42238
42691
  camera.updateProjectionMatrix();
42239
- const ambientLight = new THREE41.AmbientLight(16777215, Math.PI / 2);
42692
+ const ambientLight = new THREE42.AmbientLight(16777215, Math.PI / 2);
42240
42693
  scene.add(ambientLight);
42241
- const pointLight = new THREE41.PointLight(16777215, Math.PI / 4);
42694
+ const pointLight = new THREE42.PointLight(16777215, Math.PI / 4);
42242
42695
  pointLight.position.set(-10, -10, 10);
42243
42696
  scene.add(pointLight);
42244
42697
  const components = su18(circuitJson).cad_component.list();
@@ -42249,7 +42702,7 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
42249
42702
  const boardGeom = createBoardGeomFromCircuitJson(circuitJson);
42250
42703
  if (boardGeom) {
42251
42704
  const solderMaskColor = colors.fr4SolderMaskGreen;
42252
- const baseColor = new THREE41.Color(
42705
+ const baseColor = new THREE42.Color(
42253
42706
  solderMaskColor[0],
42254
42707
  solderMaskColor[1],
42255
42708
  solderMaskColor[2]
@@ -42261,28 +42714,28 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
42261
42714
  const material = createBoardMaterial({
42262
42715
  material: boardData?.material,
42263
42716
  color: baseColor,
42264
- side: THREE41.DoubleSide
42717
+ side: THREE42.DoubleSide
42265
42718
  });
42266
- const mesh = new THREE41.Mesh(geometry, material);
42719
+ const mesh = new THREE42.Mesh(geometry, material);
42267
42720
  scene.add(mesh);
42268
42721
  }
42269
42722
  }
42270
- const gridColor = new THREE41.Color(8947848);
42271
- const gridHelper = new THREE41.GridHelper(100, 100, gridColor, gridColor);
42723
+ const gridColor = new THREE42.Color(8947848);
42724
+ const gridHelper = new THREE42.GridHelper(100, 100, gridColor, gridColor);
42272
42725
  gridHelper.rotation.x = Math.PI / 2;
42273
42726
  const materials = Array.isArray(gridHelper.material) ? gridHelper.material : [gridHelper.material];
42274
42727
  for (const mat of materials) {
42275
42728
  mat.transparent = true;
42276
42729
  mat.opacity = 0.3;
42277
- if (mat instanceof THREE41.LineBasicMaterial) {
42730
+ if (mat instanceof THREE42.LineBasicMaterial) {
42278
42731
  mat.color = gridColor;
42279
42732
  mat.vertexColors = false;
42280
42733
  }
42281
42734
  }
42282
42735
  scene.add(gridHelper);
42283
- const box = new THREE41.Box3().setFromObject(scene);
42284
- const center = box.getCenter(new THREE41.Vector3());
42285
- const size4 = box.getSize(new THREE41.Vector3());
42736
+ const box = new THREE42.Box3().setFromObject(scene);
42737
+ const center = box.getCenter(new THREE42.Vector3());
42738
+ const size4 = box.getSize(new THREE42.Vector3());
42286
42739
  scene.position.sub(center);
42287
42740
  const maxDim = Math.max(size4.x, size4.y, size4.z);
42288
42741
  if (maxDim > 0) {