@tscircuit/core 0.0.900 → 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.
package/dist/index.d.ts CHANGED
@@ -3322,19 +3322,24 @@ declare class Panel extends Group<typeof panelProps> {
3322
3322
  topMargin?: string | number | undefined;
3323
3323
  bottomMargin?: string | number | undefined;
3324
3324
  }>>>;
3325
- }, "children" | "width" | "height"> & {
3326
- width: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
3327
- height: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
3325
+ }, "children" | "width" | "height" | "layoutMode"> & {
3326
+ width: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
3327
+ height: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
3328
3328
  children: zod.ZodOptional<zod.ZodAny>;
3329
3329
  noSolderMask: zod.ZodOptional<zod.ZodBoolean>;
3330
3330
  panelizationMethod: zod.ZodOptional<zod.ZodEnum<["tab-routing", "none"]>>;
3331
3331
  boardGap: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
3332
+ boardAreaWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
3333
+ boardAreaHeight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
3334
+ layoutMode: zod.ZodOptional<zod.ZodEnum<["grid", "pack", "none"]>>;
3335
+ row: zod.ZodOptional<zod.ZodNumber>;
3336
+ col: zod.ZodOptional<zod.ZodNumber>;
3337
+ cellWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
3338
+ cellHeight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
3332
3339
  tabWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
3333
3340
  tabLength: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
3334
3341
  mouseBites: zod.ZodOptional<zod.ZodBoolean>;
3335
3342
  }, "strip", zod.ZodTypeAny, {
3336
- width: number;
3337
- height: number;
3338
3343
  symbol?: _tscircuit_props.SymbolProp | undefined;
3339
3344
  key?: any;
3340
3345
  pcbX?: string | number | undefined;
@@ -3386,7 +3391,7 @@ declare class Panel extends Group<typeof panelProps> {
3386
3391
  children?: any;
3387
3392
  grid?: boolean | undefined;
3388
3393
  flex?: string | boolean | undefined;
3389
- layoutMode?: "none" | "relative" | "grid" | "flex" | "match-adapt" | undefined;
3394
+ layoutMode?: "none" | "grid" | "pack" | undefined;
3390
3395
  position?: "relative" | "absolute" | undefined;
3391
3396
  gridCols?: string | number | undefined;
3392
3397
  gridRows?: string | number | undefined;
@@ -3396,6 +3401,7 @@ declare class Panel extends Group<typeof panelProps> {
3396
3401
  gridGap?: string | number | undefined;
3397
3402
  gridRowGap?: string | number | undefined;
3398
3403
  gridColumnGap?: string | number | undefined;
3404
+ row?: number | undefined;
3399
3405
  flexDirection?: "row" | "column" | undefined;
3400
3406
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
3401
3407
  justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
@@ -3412,6 +3418,8 @@ declare class Panel extends Group<typeof panelProps> {
3412
3418
  paddingBottom?: number | undefined;
3413
3419
  paddingX?: number | undefined;
3414
3420
  paddingY?: number | undefined;
3421
+ width?: number | undefined;
3422
+ height?: number | undefined;
3415
3423
  matchAdapt?: boolean | undefined;
3416
3424
  matchAdaptTemplate?: any;
3417
3425
  schTitle?: string | undefined;
@@ -3588,12 +3596,15 @@ declare class Panel extends Group<typeof panelProps> {
3588
3596
  noSolderMask?: boolean | undefined;
3589
3597
  panelizationMethod?: "none" | "tab-routing" | undefined;
3590
3598
  boardGap?: number | undefined;
3599
+ boardAreaWidth?: number | undefined;
3600
+ boardAreaHeight?: number | undefined;
3601
+ col?: number | undefined;
3602
+ cellWidth?: number | undefined;
3603
+ cellHeight?: number | undefined;
3591
3604
  tabWidth?: number | undefined;
3592
3605
  tabLength?: number | undefined;
3593
3606
  mouseBites?: boolean | undefined;
3594
3607
  }, {
3595
- width: string | number;
3596
- height: string | number;
3597
3608
  symbol?: _tscircuit_props.SymbolProp | undefined;
3598
3609
  key?: any;
3599
3610
  pcbX?: string | number | undefined;
@@ -3647,7 +3658,7 @@ declare class Panel extends Group<typeof panelProps> {
3647
3658
  children?: any;
3648
3659
  grid?: boolean | undefined;
3649
3660
  flex?: string | boolean | undefined;
3650
- layoutMode?: "none" | "relative" | "grid" | "flex" | "match-adapt" | undefined;
3661
+ layoutMode?: "none" | "grid" | "pack" | undefined;
3651
3662
  position?: "relative" | "absolute" | undefined;
3652
3663
  gridCols?: string | number | undefined;
3653
3664
  gridRows?: string | number | undefined;
@@ -3657,6 +3668,7 @@ declare class Panel extends Group<typeof panelProps> {
3657
3668
  gridGap?: string | number | undefined;
3658
3669
  gridRowGap?: string | number | undefined;
3659
3670
  gridColumnGap?: string | number | undefined;
3671
+ row?: number | undefined;
3660
3672
  flexDirection?: "row" | "column" | undefined;
3661
3673
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
3662
3674
  justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
@@ -3673,6 +3685,8 @@ declare class Panel extends Group<typeof panelProps> {
3673
3685
  paddingBottom?: string | number | undefined;
3674
3686
  paddingX?: string | number | undefined;
3675
3687
  paddingY?: string | number | undefined;
3688
+ width?: string | number | undefined;
3689
+ height?: string | number | undefined;
3676
3690
  matchAdapt?: boolean | undefined;
3677
3691
  matchAdaptTemplate?: any;
3678
3692
  schTitle?: string | undefined;
@@ -3849,6 +3863,11 @@ declare class Panel extends Group<typeof panelProps> {
3849
3863
  noSolderMask?: boolean | undefined;
3850
3864
  panelizationMethod?: "none" | "tab-routing" | undefined;
3851
3865
  boardGap?: string | number | undefined;
3866
+ boardAreaWidth?: string | number | undefined;
3867
+ boardAreaHeight?: string | number | undefined;
3868
+ col?: number | undefined;
3869
+ cellWidth?: string | number | undefined;
3870
+ cellHeight?: string | number | undefined;
3852
3871
  tabWidth?: string | number | undefined;
3853
3872
  tabLength?: string | number | undefined;
3854
3873
  mouseBites?: boolean | undefined;
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);
@@ -16177,14 +16167,19 @@ var Panel = class extends Group6 {
16177
16167
  minY = Math.min(minY, bottom);
16178
16168
  maxY = Math.max(maxY, top);
16179
16169
  }
16180
- if (isFinite(minX)) {
16170
+ const hasExplicitWidth = this._parsedProps.width !== void 0;
16171
+ const hasExplicitHeight = this._parsedProps.height !== void 0;
16172
+ if (hasExplicitWidth && hasExplicitHeight) {
16173
+ db.pcb_panel.update(this.pcb_panel_id, {
16174
+ width: distance9.parse(this._parsedProps.width),
16175
+ height: distance9.parse(this._parsedProps.height)
16176
+ });
16177
+ } else if (isFinite(minX)) {
16181
16178
  const boundsWidth = maxX - minX;
16182
16179
  const boundsHeight = maxY - minY;
16183
- const newPanelWidth = boundsWidth + 2 * DEFAULT_PANEL_MARGIN;
16184
- const newPanelHeight = boundsHeight + 2 * DEFAULT_PANEL_MARGIN;
16185
16180
  db.pcb_panel.update(this.pcb_panel_id, {
16186
- width: newPanelWidth,
16187
- height: newPanelHeight
16181
+ width: hasExplicitWidth ? distance9.parse(this._parsedProps.width) : boundsWidth + 2 * DEFAULT_PANEL_MARGIN,
16182
+ height: hasExplicitHeight ? distance9.parse(this._parsedProps.height) : boundsHeight + 2 * DEFAULT_PANEL_MARGIN
16188
16183
  });
16189
16184
  }
16190
16185
  }
@@ -16227,8 +16222,8 @@ var Panel = class extends Group6 {
16227
16222
  const { db } = this.root;
16228
16223
  const props = this._parsedProps;
16229
16224
  const inserted = db.pcb_panel.insert({
16230
- width: distance9.parse(props.width),
16231
- height: distance9.parse(props.height),
16225
+ width: props.width !== void 0 ? distance9.parse(props.width) : 0,
16226
+ height: props.height !== void 0 ? distance9.parse(props.height) : 0,
16232
16227
  center: this._getGlobalPcbPositionBeforeLayout(),
16233
16228
  covered_with_solder_mask: !(props.noSolderMask ?? false)
16234
16229
  });
@@ -16239,9 +16234,10 @@ var Panel = class extends Group6 {
16239
16234
  if (!this.pcb_panel_id) return;
16240
16235
  const { db } = this.root;
16241
16236
  const props = this._parsedProps;
16237
+ const currentPanel = db.pcb_panel.get(this.pcb_panel_id);
16242
16238
  db.pcb_panel.update(this.pcb_panel_id, {
16243
- width: distance9.parse(props.width),
16244
- height: distance9.parse(props.height),
16239
+ width: props.width !== void 0 ? distance9.parse(props.width) : currentPanel?.width,
16240
+ height: props.height !== void 0 ? distance9.parse(props.height) : currentPanel?.height,
16245
16241
  center: this._getGlobalPcbPositionBeforeLayout(),
16246
16242
  covered_with_solder_mask: !(props.noSolderMask ?? false)
16247
16243
  });
@@ -17473,7 +17469,7 @@ var BreakoutPoint = class extends PrimitiveComponent2 {
17473
17469
  import { netLabelProps } from "@tscircuit/props";
17474
17470
  import {
17475
17471
  applyToPoint as applyToPoint17,
17476
- identity as identity5,
17472
+ identity as identity4,
17477
17473
  translate as translate7
17478
17474
  } from "transformation-matrix";
17479
17475
  import { calculateElbow as calculateElbow2 } from "calculate-elbow";
@@ -17524,7 +17520,7 @@ var NetLabel = class extends PrimitiveComponent2 {
17524
17520
  if (connectedPorts.length > 0) {
17525
17521
  const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
17526
17522
  const parentCenter = applyToPoint17(
17527
- this.parent?.computeSchematicGlobalTransform?.() ?? identity5(),
17523
+ this.parent?.computeSchematicGlobalTransform?.() ?? identity4(),
17528
17524
  { x: 0, y: 0 }
17529
17525
  );
17530
17526
  return translate7(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
@@ -19259,13 +19255,13 @@ var VoltageProbe = class extends PrimitiveComponent2 {
19259
19255
  // lib/RootCircuit.ts
19260
19256
  import { su as su5 } from "@tscircuit/circuit-json-util";
19261
19257
  import { isValidElement as isValidElement2 } from "react";
19262
- import { identity as identity6 } from "transformation-matrix";
19258
+ import { identity as identity5 } from "transformation-matrix";
19263
19259
 
19264
19260
  // package.json
19265
19261
  var package_default = {
19266
19262
  name: "@tscircuit/core",
19267
19263
  type: "module",
19268
- version: "0.0.899",
19264
+ version: "0.0.901",
19269
19265
  types: "dist/index.d.ts",
19270
19266
  main: "dist/index.js",
19271
19267
  module: "dist/index.js",
@@ -19309,7 +19305,7 @@ var package_default = {
19309
19305
  "@tscircuit/math-utils": "^0.0.29",
19310
19306
  "@tscircuit/miniflex": "^0.0.4",
19311
19307
  "@tscircuit/ngspice-spice-engine": "^0.0.4",
19312
- "@tscircuit/props": "^0.0.423",
19308
+ "@tscircuit/props": "^0.0.424",
19313
19309
  "@tscircuit/schematic-autolayout": "^0.0.6",
19314
19310
  "@tscircuit/schematic-match-adapt": "^0.0.16",
19315
19311
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
@@ -19329,7 +19325,7 @@ var package_default = {
19329
19325
  "circuit-json-to-gltf": "^0.0.31",
19330
19326
  "circuit-json-to-simple-3d": "^0.0.9",
19331
19327
  "circuit-json-to-spice": "^0.0.27",
19332
- "circuit-to-svg": "^0.0.280",
19328
+ "circuit-to-svg": "^0.0.284",
19333
19329
  concurrently: "^9.1.2",
19334
19330
  "connectivity-map": "^1.0.0",
19335
19331
  debug: "^4.3.6",
@@ -19545,10 +19541,10 @@ var RootCircuit = class {
19545
19541
  throw new Error("project.preview is not yet implemented");
19546
19542
  }
19547
19543
  computeSchematicGlobalTransform() {
19548
- return identity6();
19544
+ return identity5();
19549
19545
  }
19550
19546
  _computePcbGlobalTransformBeforeLayout() {
19551
- return identity6();
19547
+ return identity5();
19552
19548
  }
19553
19549
  selectAll(selector) {
19554
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.900",
4
+ "version": "0.0.902",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -45,7 +45,7 @@
45
45
  "@tscircuit/math-utils": "^0.0.29",
46
46
  "@tscircuit/miniflex": "^0.0.4",
47
47
  "@tscircuit/ngspice-spice-engine": "^0.0.4",
48
- "@tscircuit/props": "^0.0.423",
48
+ "@tscircuit/props": "^0.0.424",
49
49
  "@tscircuit/schematic-autolayout": "^0.0.6",
50
50
  "@tscircuit/schematic-match-adapt": "^0.0.16",
51
51
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
@@ -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",