@tscircuit/core 0.0.83 → 0.0.84

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 +18 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -771,7 +771,7 @@ var Footprint = class extends PrimitiveComponent {
771
771
  };
772
772
 
773
773
  // lib/components/base-components/NormalComponent.ts
774
- import "zod";
774
+ import { z as z4 } from "zod";
775
775
 
776
776
  // lib/components/primitive-components/Port.ts
777
777
  import { z as z2 } from "zod";
@@ -1733,6 +1733,12 @@ function getBoundsOfPcbComponents(components) {
1733
1733
  }
1734
1734
 
1735
1735
  // lib/components/base-components/NormalComponent.ts
1736
+ import { rotation } from "circuit-json";
1737
+ var rotation3 = z4.object({
1738
+ x: rotation,
1739
+ y: rotation,
1740
+ z: rotation
1741
+ });
1736
1742
  var NormalComponent = class extends PrimitiveComponent {
1737
1743
  reactSubtrees = [];
1738
1744
  isPrimitiveContainer = true;
@@ -2038,14 +2044,19 @@ var NormalComponent = class extends PrimitiveComponent {
2038
2044
  doInitialCadModelRender() {
2039
2045
  const { db } = this.root;
2040
2046
  const { boardThickness = 0 } = this.root?._getBoard() ?? {};
2041
- const { _parsedProps: props } = this;
2042
- if (props.cadModel) {
2047
+ const cadModel = this._parsedProps.cadModel;
2048
+ if (cadModel) {
2043
2049
  const bounds = this._getPcbCircuitJsonBounds();
2044
2050
  const pcb_component = db.pcb_component.get(this.pcb_component_id);
2045
- const cadModel = props.cadModel;
2046
2051
  if (typeof cadModel === "string") {
2047
2052
  throw new Error("String cadModel not yet implemented");
2048
2053
  }
2054
+ const rotationOffset = rotation3.parse({
2055
+ x: 0,
2056
+ y: 0,
2057
+ z: typeof cadModel.rotationOffset === "number" ? cadModel.rotationOffset : 0,
2058
+ ...typeof cadModel.rotationOffset === "object" ? cadModel.rotationOffset ?? {} : {}
2059
+ });
2049
2060
  const cad_model = db.cad_component.insert({
2050
2061
  // TODO z maybe depends on layer
2051
2062
  position: {
@@ -2054,9 +2065,9 @@ var NormalComponent = class extends PrimitiveComponent {
2054
2065
  z: this.props.layer === "bottom" ? -boardThickness / 2 : boardThickness / 2
2055
2066
  },
2056
2067
  rotation: {
2057
- x: 0,
2058
- y: this.props.layer === "top" ? 0 : 180,
2059
- z: (pcb_component?.rotation ?? 0) + (this.props.layer === "bottom" ? 180 : 0)
2068
+ x: rotationOffset.x,
2069
+ y: (this.props.layer === "top" ? 0 : 180) + rotationOffset.y,
2070
+ z: (pcb_component?.rotation ?? 0) + (this.props.layer === "bottom" ? 180 : 0) + rotationOffset.z
2060
2071
  },
2061
2072
  pcb_component_id: this.pcb_component_id,
2062
2073
  source_component_id: this.source_component_id,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.83",
4
+ "version": "0.0.84",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",