@tscircuit/core 0.0.901 → 0.0.902

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 +21 -31
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -9529,7 +9529,6 @@ var getBoardCenterFromAnchor = ({
9529
9529
 
9530
9530
  // lib/components/normal-components/Board.ts
9531
9531
  import { boardProps } from "@tscircuit/props";
9532
- import "transformation-matrix";
9533
9532
 
9534
9533
  // lib/components/primitive-components/Group/Group.ts
9535
9534
  import {
@@ -15518,14 +15517,7 @@ var Board = class extends Group6 {
15518
15517
  };
15519
15518
  }
15520
15519
  get boardThickness() {
15521
- const { _parsedProps: props } = this;
15522
- const pcbX = this._resolvePcbCoordinate(props.pcbX, "pcbX", {
15523
- allowBoardVariables: false
15524
- });
15525
- const pcbY = this._resolvePcbCoordinate(props.pcbY, "pcbY", {
15526
- allowBoardVariables: false
15527
- });
15528
- return props.thickness ?? 1.4;
15520
+ return this._parsedProps.thickness ?? 1.4;
15529
15521
  }
15530
15522
  /**
15531
15523
  * Get all available layers for the board
@@ -15573,12 +15565,7 @@ var Board = class extends Group6 {
15573
15565
  if (!this.pcb_board_id) return;
15574
15566
  const { db } = this.root;
15575
15567
  const { _parsedProps: props } = this;
15576
- const pcbX = this._resolvePcbCoordinate(props.pcbX, "pcbX", {
15577
- allowBoardVariables: false
15578
- });
15579
- const pcbY = this._resolvePcbCoordinate(props.pcbY, "pcbY", {
15580
- allowBoardVariables: false
15581
- });
15568
+ const globalPos = this._getGlobalPcbPositionBeforeLayout();
15582
15569
  const pcbBoard = db.pcb_board.get(this.pcb_board_id);
15583
15570
  if (pcbBoard?.width && pcbBoard?.height || pcbBoard?.outline && pcbBoard.outline.length > 0)
15584
15571
  return;
@@ -15629,8 +15616,8 @@ var Board = class extends Group6 {
15629
15616
  const computedWidth = hasComponents ? maxX - minX + padding * 2 : 0;
15630
15617
  const computedHeight = hasComponents ? maxY - minY + padding * 2 : 0;
15631
15618
  const center = {
15632
- x: hasComponents ? (minX + maxX) / 2 + (props.outlineOffsetX ?? 0) : (props.outlineOffsetX ?? 0) + pcbX,
15633
- y: hasComponents ? (minY + maxY) / 2 + (props.outlineOffsetY ?? 0) : (props.outlineOffsetY ?? 0) + pcbY
15619
+ x: hasComponents ? (minX + maxX) / 2 + (props.outlineOffsetX ?? 0) : (props.outlineOffsetX ?? 0) + globalPos.x,
15620
+ y: hasComponents ? (minY + maxY) / 2 + (props.outlineOffsetY ?? 0) : (props.outlineOffsetY ?? 0) + globalPos.y
15634
15621
  };
15635
15622
  const finalWidth = props.width ?? computedWidth;
15636
15623
  const finalHeight = props.height ?? computedHeight;
@@ -15714,10 +15701,10 @@ var Board = class extends Group6 {
15714
15701
  );
15715
15702
  let computedWidth = props.width ?? pcbBoardFromCircuitJson?.width ?? 0;
15716
15703
  let computedHeight = props.height ?? pcbBoardFromCircuitJson?.height ?? 0;
15717
- const { pcbX, pcbY } = this.getResolvedPcbPositionProp();
15704
+ const globalPos = this._getGlobalPcbPositionBeforeLayout();
15718
15705
  let center = {
15719
- x: pcbX + (props.outlineOffsetX ?? 0),
15720
- y: pcbY + (props.outlineOffsetY ?? 0)
15706
+ x: globalPos.x + (props.outlineOffsetX ?? 0),
15707
+ y: globalPos.y + (props.outlineOffsetY ?? 0)
15721
15708
  };
15722
15709
  const { boardAnchorPosition, boardAnchorAlignment } = props;
15723
15710
  if (boardAnchorPosition) {
@@ -16147,16 +16134,19 @@ var Panel = class extends Group6 {
16147
16134
  for (let i = 0; i < gridCols - 1; i++) {
16148
16135
  colXOffsets.push(colXOffsets[i] + colWidths[i] + boardGap);
16149
16136
  }
16137
+ const panelGlobalPos = this._getGlobalPcbPositionBeforeLayout();
16150
16138
  unpositionedBoards.forEach((board, i) => {
16151
16139
  const col = i % gridCols;
16152
16140
  const row = Math.floor(i / gridCols);
16153
16141
  const pcbBoard = db.pcb_board.get(board.pcb_board_id);
16154
16142
  if (!pcbBoard || !pcbBoard.width || !pcbBoard.height) return;
16155
- const xPos = colXOffsets[col] + colWidths[col] / 2;
16156
- const yPos = rowYOffsets[row] + rowHeights[row] / 2;
16157
- board._repositionOnPcb({ x: xPos, y: yPos });
16143
+ const relativeX = colXOffsets[col] + colWidths[col] / 2;
16144
+ const relativeY = rowYOffsets[row] + rowHeights[row] / 2;
16145
+ const absoluteX = panelGlobalPos.x + relativeX;
16146
+ const absoluteY = panelGlobalPos.y + relativeY;
16147
+ board._repositionOnPcb({ x: absoluteX, y: absoluteY });
16158
16148
  db.pcb_board.update(board.pcb_board_id, {
16159
- center: { x: xPos, y: yPos }
16149
+ center: { x: absoluteX, y: absoluteY }
16160
16150
  });
16161
16151
  });
16162
16152
  const allBoardPcbIds = childBoardInstances.map((b) => b.pcb_board_id).filter((id) => !!id);
@@ -17479,7 +17469,7 @@ var BreakoutPoint = class extends PrimitiveComponent2 {
17479
17469
  import { netLabelProps } from "@tscircuit/props";
17480
17470
  import {
17481
17471
  applyToPoint as applyToPoint17,
17482
- identity as identity5,
17472
+ identity as identity4,
17483
17473
  translate as translate7
17484
17474
  } from "transformation-matrix";
17485
17475
  import { calculateElbow as calculateElbow2 } from "calculate-elbow";
@@ -17530,7 +17520,7 @@ var NetLabel = class extends PrimitiveComponent2 {
17530
17520
  if (connectedPorts.length > 0) {
17531
17521
  const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
17532
17522
  const parentCenter = applyToPoint17(
17533
- this.parent?.computeSchematicGlobalTransform?.() ?? identity5(),
17523
+ this.parent?.computeSchematicGlobalTransform?.() ?? identity4(),
17534
17524
  { x: 0, y: 0 }
17535
17525
  );
17536
17526
  return translate7(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
@@ -19265,13 +19255,13 @@ var VoltageProbe = class extends PrimitiveComponent2 {
19265
19255
  // lib/RootCircuit.ts
19266
19256
  import { su as su5 } from "@tscircuit/circuit-json-util";
19267
19257
  import { isValidElement as isValidElement2 } from "react";
19268
- import { identity as identity6 } from "transformation-matrix";
19258
+ import { identity as identity5 } from "transformation-matrix";
19269
19259
 
19270
19260
  // package.json
19271
19261
  var package_default = {
19272
19262
  name: "@tscircuit/core",
19273
19263
  type: "module",
19274
- version: "0.0.900",
19264
+ version: "0.0.901",
19275
19265
  types: "dist/index.d.ts",
19276
19266
  main: "dist/index.js",
19277
19267
  module: "dist/index.js",
@@ -19335,7 +19325,7 @@ var package_default = {
19335
19325
  "circuit-json-to-gltf": "^0.0.31",
19336
19326
  "circuit-json-to-simple-3d": "^0.0.9",
19337
19327
  "circuit-json-to-spice": "^0.0.27",
19338
- "circuit-to-svg": "^0.0.280",
19328
+ "circuit-to-svg": "^0.0.284",
19339
19329
  concurrently: "^9.1.2",
19340
19330
  "connectivity-map": "^1.0.0",
19341
19331
  debug: "^4.3.6",
@@ -19551,10 +19541,10 @@ var RootCircuit = class {
19551
19541
  throw new Error("project.preview is not yet implemented");
19552
19542
  }
19553
19543
  computeSchematicGlobalTransform() {
19554
- return identity6();
19544
+ return identity5();
19555
19545
  }
19556
19546
  _computePcbGlobalTransformBeforeLayout() {
19557
- return identity6();
19547
+ return identity5();
19558
19548
  }
19559
19549
  selectAll(selector) {
19560
19550
  this._guessRootComponent();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.901",
4
+ "version": "0.0.902",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -65,7 +65,7 @@
65
65
  "circuit-json-to-gltf": "^0.0.31",
66
66
  "circuit-json-to-simple-3d": "^0.0.9",
67
67
  "circuit-json-to-spice": "^0.0.27",
68
- "circuit-to-svg": "^0.0.280",
68
+ "circuit-to-svg": "^0.0.284",
69
69
  "concurrently": "^9.1.2",
70
70
  "connectivity-map": "^1.0.0",
71
71
  "debug": "^4.3.6",