@tscircuit/core 0.0.742 → 0.0.744

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 +22 -16
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1850,16 +1850,18 @@ var SmtPad = class extends PrimitiveComponent2 {
1850
1850
  const { db } = this.root;
1851
1851
  const { _parsedProps: props } = this;
1852
1852
  if (!props.portHints) return;
1853
- const container = this.getPrimitiveContainer();
1854
1853
  const subcircuit = this.getSubcircuit();
1855
1854
  const position = this._getGlobalPcbPositionBeforeLayout();
1856
- const containerCenter = container?._getGlobalPcbPositionBeforeLayout();
1857
- const decomposedMat = decomposeTSR(
1855
+ const decomposedTransform = decomposeTSR(
1858
1856
  this._computePcbGlobalTransformBeforeLayout()
1859
1857
  );
1860
- const isRotated90 = Math.abs(decomposedMat.rotation.angle * (180 / Math.PI) - 90) % 180 < 0.01;
1858
+ const rotationDegrees = decomposedTransform.rotation.angle * 180 / Math.PI;
1859
+ const normalizedRotationDegrees = (rotationDegrees % 360 + 360) % 360;
1860
+ const rotationTolerance = 0.01;
1861
+ const isAxisAligned = Math.abs(normalizedRotationDegrees) < rotationTolerance || Math.abs(normalizedRotationDegrees - 180) < rotationTolerance || Math.abs(normalizedRotationDegrees - 360) < rotationTolerance;
1862
+ const isRotated90Degrees = Math.abs(normalizedRotationDegrees - 90) < rotationTolerance || Math.abs(normalizedRotationDegrees - 270) < rotationTolerance;
1863
+ const finalRotationDegrees = Math.abs(normalizedRotationDegrees - 360) < rotationTolerance ? 0 : normalizedRotationDegrees;
1861
1864
  const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
1862
- const parentRotation = container?._parsedProps.pcbRotation ?? 0;
1863
1865
  let pcb_smtpad = null;
1864
1866
  const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
1865
1867
  if (props.shape === "circle") {
@@ -1888,14 +1890,14 @@ var SmtPad = class extends PrimitiveComponent2 {
1888
1890
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
1889
1891
  });
1890
1892
  } else if (props.shape === "rect") {
1891
- pcb_smtpad = parentRotation === 0 || isRotated90 ? db.pcb_smtpad.insert({
1893
+ pcb_smtpad = isAxisAligned || isRotated90Degrees ? db.pcb_smtpad.insert({
1892
1894
  pcb_component_id,
1893
1895
  pcb_port_id: this.matchedPort?.pcb_port_id,
1894
1896
  // port likely isn't matched
1895
1897
  layer: maybeFlipLayer(props.layer ?? "top"),
1896
1898
  shape: "rect",
1897
- width: isRotated90 ? props.height : props.width,
1898
- height: isRotated90 ? props.width : props.height,
1899
+ width: isRotated90Degrees ? props.height : props.width,
1900
+ height: isRotated90Degrees ? props.width : props.height,
1899
1901
  port_hints: props.portHints.map((ph) => ph.toString()),
1900
1902
  is_covered_with_solder_mask: props.coveredWithSolderMask ?? false,
1901
1903
  x: position.x,
@@ -1910,7 +1912,7 @@ var SmtPad = class extends PrimitiveComponent2 {
1910
1912
  height: props.height,
1911
1913
  x: position.x,
1912
1914
  y: position.y,
1913
- ccw_rotation: parentRotation,
1915
+ ccw_rotation: finalRotationDegrees,
1914
1916
  port_hints: props.portHints.map((ph) => ph.toString()),
1915
1917
  is_covered_with_solder_mask: props.coveredWithSolderMask ?? false,
1916
1918
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
@@ -1937,7 +1939,7 @@ var SmtPad = class extends PrimitiveComponent2 {
1937
1939
  height: pcb_smtpad.height * 0.7,
1938
1940
  x: pcb_smtpad.x,
1939
1941
  y: pcb_smtpad.y,
1940
- ccw_rotation: parentRotation,
1942
+ ccw_rotation: finalRotationDegrees,
1941
1943
  pcb_component_id: pcb_smtpad.pcb_component_id,
1942
1944
  pcb_smtpad_id: pcb_smtpad.pcb_smtpad_id,
1943
1945
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
@@ -7648,7 +7650,8 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
7648
7650
  layer: props.layer ?? "top",
7649
7651
  rotation: props.pcbRotation ?? 0,
7650
7652
  source_component_id: this.source_component_id,
7651
- subcircuit_id: subcircuit.subcircuit_id ?? void 0
7653
+ subcircuit_id: subcircuit.subcircuit_id ?? void 0,
7654
+ do_not_place: props.doNotPlace ?? false
7652
7655
  });
7653
7656
  const footprint = props.footprint ?? this._getImpliedFootprintString();
7654
7657
  if (!footprint && !this.isGroup) {
@@ -12967,7 +12970,8 @@ var Chip = class extends NormalComponent3 {
12967
12970
  layer: props.layer ?? "top",
12968
12971
  rotation: props.pcbRotation ?? 0,
12969
12972
  source_component_id: this.source_component_id,
12970
- subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0
12973
+ subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0,
12974
+ do_not_place: props.doNotPlace ?? false
12971
12975
  });
12972
12976
  this.pcb_component_id = pcb_component.pcb_component_id;
12973
12977
  }
@@ -13191,7 +13195,8 @@ var Jumper = class extends NormalComponent3 {
13191
13195
  layer: props.layer ?? "top",
13192
13196
  rotation: props.pcbRotation ?? 0,
13193
13197
  source_component_id: this.source_component_id,
13194
- subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0
13198
+ subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0,
13199
+ do_not_place: props.doNotPlace ?? false
13195
13200
  });
13196
13201
  this.pcb_component_id = pcb_component.pcb_component_id;
13197
13202
  }
@@ -13345,7 +13350,8 @@ var SolderJumper = class extends NormalComponent3 {
13345
13350
  layer: props.layer ?? "top",
13346
13351
  rotation: props.pcbRotation ?? 0,
13347
13352
  source_component_id: this.source_component_id,
13348
- subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0
13353
+ subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0,
13354
+ do_not_place: props.doNotPlace ?? false
13349
13355
  });
13350
13356
  this.pcb_component_id = pcb_component.pcb_component_id;
13351
13357
  }
@@ -15699,7 +15705,7 @@ import { identity as identity6 } from "transformation-matrix";
15699
15705
  var package_default = {
15700
15706
  name: "@tscircuit/core",
15701
15707
  type: "module",
15702
- version: "0.0.741",
15708
+ version: "0.0.743",
15703
15709
  types: "dist/index.d.ts",
15704
15710
  main: "dist/index.js",
15705
15711
  module: "dist/index.js",
@@ -15752,7 +15758,7 @@ var package_default = {
15752
15758
  "bun-match-svg": "0.0.12",
15753
15759
  "calculate-elbow": "^0.0.12",
15754
15760
  "chokidar-cli": "^3.0.0",
15755
- "circuit-json": "^0.0.261",
15761
+ "circuit-json": "^0.0.265",
15756
15762
  "circuit-json-to-bpc": "^0.0.13",
15757
15763
  "circuit-json-to-connectivity-map": "^0.0.22",
15758
15764
  "circuit-json-to-simple-3d": "^0.0.9",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.742",
4
+ "version": "0.0.744",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -54,7 +54,7 @@
54
54
  "bun-match-svg": "0.0.12",
55
55
  "calculate-elbow": "^0.0.12",
56
56
  "chokidar-cli": "^3.0.0",
57
- "circuit-json": "^0.0.261",
57
+ "circuit-json": "^0.0.265",
58
58
  "circuit-json-to-bpc": "^0.0.13",
59
59
  "circuit-json-to-connectivity-map": "^0.0.22",
60
60
  "circuit-json-to-simple-3d": "^0.0.9",