@tscircuit/core 0.0.788 → 0.0.789

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -84,6 +84,7 @@ __export(components_exports, {
84
84
  // lib/components/base-components/NormalComponent/NormalComponent.ts
85
85
  import { fp } from "@tscircuit/footprinter";
86
86
  import {
87
+ distance as distance4,
87
88
  pcb_manual_edit_conflict_warning,
88
89
  point3 as point32,
89
90
  rotation as rotation2,
@@ -4372,6 +4373,7 @@ var Footprint = class extends PrimitiveComponent2 {
4372
4373
  // lib/components/primitive-components/CadModel.ts
4373
4374
  import { cadmodelProps, point3 } from "@tscircuit/props";
4374
4375
  import { z as z7 } from "zod";
4376
+ import { distance } from "circuit-json";
4375
4377
  import { decomposeTSR as decomposeTSR4 } from "transformation-matrix";
4376
4378
 
4377
4379
  // lib/components/base-components/NormalComponent/utils/getFileExtension.ts
@@ -4423,6 +4425,7 @@ var CadModel = class extends PrimitiveComponent2 {
4423
4425
  z: props.pcbZ ?? 0,
4424
4426
  ...typeof props.positionOffset === "object" ? props.positionOffset : {}
4425
4427
  });
4428
+ const zOffsetFromSurface = props.zOffsetFromSurface !== void 0 ? distance.parse(props.zOffsetFromSurface) : 0;
4426
4429
  const layer = parent.props.layer === "bottom" ? "bottom" : "top";
4427
4430
  const ext = getFileExtension(props.modelUrl);
4428
4431
  const urlProps = {};
@@ -4443,7 +4446,7 @@ var CadModel = class extends PrimitiveComponent2 {
4443
4446
  position: {
4444
4447
  x: bounds.center.x + Number(positionOffset.x),
4445
4448
  y: bounds.center.y + Number(positionOffset.y),
4446
- z: (layer === "bottom" ? -boardThickness / 2 : boardThickness / 2) + Number(positionOffset.z)
4449
+ z: (layer === "bottom" ? -boardThickness / 2 : boardThickness / 2) + (layer === "bottom" ? -zOffsetFromSurface : zOffsetFromSurface) + Number(positionOffset.z)
4447
4450
  },
4448
4451
  rotation: {
4449
4452
  x: Number(rotationOffset.x),
@@ -4727,7 +4730,7 @@ var getEnteringEdgeFromDirection = (direction) => {
4727
4730
  };
4728
4731
 
4729
4732
  // lib/utils/schematic/getStubEdges.ts
4730
- import { distance } from "@tscircuit/math-utils";
4733
+ import { distance as distance2 } from "@tscircuit/math-utils";
4731
4734
  var getStubEdges = ({
4732
4735
  firstEdge,
4733
4736
  firstEdgePort,
@@ -4774,7 +4777,7 @@ var getStubEdges = ({
4774
4777
  });
4775
4778
  }
4776
4779
  }
4777
- edges = edges.filter((e) => distance(e.from, e.to) > 0.01);
4780
+ edges = edges.filter((e) => distance2(e.from, e.to) > 0.01);
4778
4781
  return edges;
4779
4782
  };
4780
4783
 
@@ -5277,7 +5280,7 @@ import { calculateElbow } from "calculate-elbow";
5277
5280
  import { doesLineIntersectLine as doesLineIntersectLine3 } from "@tscircuit/math-utils";
5278
5281
 
5279
5282
  // lib/components/primitive-components/Trace/trace-utils/create-schematic-trace-crossing-segments.ts
5280
- import { distance as distance2, doesLineIntersectLine } from "@tscircuit/math-utils";
5283
+ import { distance as distance3, doesLineIntersectLine } from "@tscircuit/math-utils";
5281
5284
 
5282
5285
  // lib/components/primitive-components/Trace/trace-utils/get-other-schematic-traces.ts
5283
5286
  var getOtherSchematicTraces = ({
@@ -5344,7 +5347,7 @@ var createSchematicTraceCrossingSegments = ({
5344
5347
  otherEdgesIntersections.push({
5345
5348
  otherEdge,
5346
5349
  crossingPoint: crossingPoint2,
5347
- distanceFromEdgeFrom: distance2(edge.from, crossingPoint2)
5350
+ distanceFromEdgeFrom: distance3(edge.from, crossingPoint2)
5348
5351
  });
5349
5352
  }
5350
5353
  }
@@ -5369,7 +5372,7 @@ var createSchematicTraceCrossingSegments = ({
5369
5372
  x: crossingPoint.x + crossingUnitVec.x * crossingSegmentLength / 2,
5370
5373
  y: crossingPoint.y + crossingUnitVec.y * crossingSegmentLength / 2
5371
5374
  };
5372
- const overshot = distance2(afterCrossing, edge.to) < crossingSegmentLength;
5375
+ const overshot = distance3(afterCrossing, edge.to) < crossingSegmentLength;
5373
5376
  const newEdges = [
5374
5377
  { from: edge.from, to: beforeCrossing },
5375
5378
  { from: beforeCrossing, to: afterCrossing, is_crossing: true },
@@ -8272,6 +8275,9 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
8272
8275
  z: 0,
8273
8276
  ...typeof cadModel?.positionOffset === "object" ? cadModel.positionOffset : {}
8274
8277
  });
8278
+ const zOffsetFromSurface = cadModel && typeof cadModel === "object" && "zOffsetFromSurface" in cadModel ? cadModel.zOffsetFromSurface !== void 0 ? distance4.parse(
8279
+ cadModel.zOffsetFromSurface
8280
+ ) : 0 : 0;
8275
8281
  const computedLayer = this.props.layer === "bottom" ? "bottom" : "top";
8276
8282
  const globalTransform = this._computePcbGlobalTransformBeforeLayout();
8277
8283
  const decomposedTransform = decomposeTSR5(globalTransform);
@@ -8281,7 +8287,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
8281
8287
  position: {
8282
8288
  x: bounds.center.x + positionOffset.x,
8283
8289
  y: bounds.center.y + positionOffset.y,
8284
- z: (computedLayer === "bottom" ? -boardThickness / 2 : boardThickness / 2) + positionOffset.z
8290
+ z: (computedLayer === "bottom" ? -boardThickness / 2 : boardThickness / 2) + (computedLayer === "bottom" ? -zOffsetFromSurface : zOffsetFromSurface) + positionOffset.z
8285
8291
  },
8286
8292
  rotation: {
8287
8293
  x: rotationOffset.x,
@@ -13077,7 +13083,7 @@ var Board = class extends Group6 {
13077
13083
  }
13078
13084
  get boardThickness() {
13079
13085
  const { _parsedProps: props } = this;
13080
- return 1.4;
13086
+ return props.thickness ?? 1.4;
13081
13087
  }
13082
13088
  /**
13083
13089
  * Get all available layers for the board
@@ -16690,7 +16696,7 @@ import { identity as identity6 } from "transformation-matrix";
16690
16696
  var package_default = {
16691
16697
  name: "@tscircuit/core",
16692
16698
  type: "module",
16693
- version: "0.0.787",
16699
+ version: "0.0.788",
16694
16700
  types: "dist/index.d.ts",
16695
16701
  main: "dist/index.js",
16696
16702
  module: "dist/index.js",
@@ -16730,7 +16736,7 @@ var package_default = {
16730
16736
  "@tscircuit/matchpack": "^0.0.16",
16731
16737
  "@tscircuit/math-utils": "^0.0.21",
16732
16738
  "@tscircuit/miniflex": "^0.0.4",
16733
- "@tscircuit/props": "0.0.361",
16739
+ "@tscircuit/props": "0.0.363",
16734
16740
  "@tscircuit/schematic-autolayout": "^0.0.6",
16735
16741
  "@tscircuit/schematic-match-adapt": "^0.0.16",
16736
16742
  "@tscircuit/schematic-trace-solver": "^0.0.41",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.788",
4
+ "version": "0.0.789",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -41,7 +41,7 @@
41
41
  "@tscircuit/matchpack": "^0.0.16",
42
42
  "@tscircuit/math-utils": "^0.0.21",
43
43
  "@tscircuit/miniflex": "^0.0.4",
44
- "@tscircuit/props": "0.0.361",
44
+ "@tscircuit/props": "0.0.363",
45
45
  "@tscircuit/schematic-autolayout": "^0.0.6",
46
46
  "@tscircuit/schematic-match-adapt": "^0.0.16",
47
47
  "@tscircuit/schematic-trace-solver": "^0.0.41",