@tscircuit/core 0.0.490 → 0.0.491

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
@@ -1045,6 +1045,12 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
1045
1045
  doInitialSourceParentAttachment(): void;
1046
1046
  doInitialPcbComponentRender(): void;
1047
1047
  doInitialPcbPrimitiveRender(): void;
1048
+ _resolvePcbPadding(): {
1049
+ padLeft: number;
1050
+ padRight: number;
1051
+ padTop: number;
1052
+ padBottom: number;
1053
+ };
1048
1054
  doInitialCreateTraceHintsFromProps(): void;
1049
1055
  doInitialSourceAddConnectivityMapKey(): void;
1050
1056
  _areChildSubcircuitsRouted(): boolean;
package/dist/index.js CHANGED
@@ -6216,7 +6216,6 @@ import { identity as identity3 } from "transformation-matrix";
6216
6216
  import {
6217
6217
  groupProps
6218
6218
  } from "@tscircuit/props";
6219
- import "@tscircuit/schematic-autolayout";
6220
6219
 
6221
6220
  // lib/utils/autorouting/CapacityMeshAutorouter.ts
6222
6221
  import { CapacityMeshSolver } from "@tscircuit/capacity-autorouter";
@@ -6380,7 +6379,6 @@ var CapacityMeshAutorouter = class {
6380
6379
 
6381
6380
  // lib/components/primitive-components/Group/Group.ts
6382
6381
  import "circuit-json";
6383
- import "circuit-json-to-connectivity-map";
6384
6382
  import Debug5 from "debug";
6385
6383
  import "zod";
6386
6384
 
@@ -6968,9 +6966,6 @@ var normalizePinLabels = (inputPinLabels) => {
6968
6966
  return result;
6969
6967
  };
6970
6968
 
6971
- // lib/components/primitive-components/Group/Group.ts
6972
- import "@tscircuit/checks";
6973
-
6974
6969
  // lib/components/primitive-components/Group/Group_doInitialSchematicLayoutMatchAdapt.ts
6975
6970
  import {
6976
6971
  SchematicLayoutPipelineSolver,
@@ -7550,18 +7545,49 @@ var Group = class extends NormalComponent {
7550
7545
  doInitialPcbPrimitiveRender() {
7551
7546
  if (this.root?.pcbDisabled) return;
7552
7547
  const { db } = this.root;
7548
+ const props = this._parsedProps;
7553
7549
  const bounds = getBoundsOfPcbComponents(this.children);
7554
7550
  if (this.pcb_group_id) {
7551
+ let width = bounds.width;
7552
+ let height = bounds.height;
7553
+ let centerX = (bounds.minX + bounds.maxX) / 2;
7554
+ let centerY = (bounds.minY + bounds.maxY) / 2;
7555
+ if (this.isSubcircuit) {
7556
+ const { padLeft, padRight, padTop, padBottom } = this._resolvePcbPadding();
7557
+ width += padLeft + padRight;
7558
+ height += padTop + padBottom;
7559
+ centerX += (padRight - padLeft) / 2;
7560
+ centerY += (padTop - padBottom) / 2;
7561
+ }
7555
7562
  db.pcb_group.update(this.pcb_group_id, {
7556
- width: bounds.width,
7557
- height: bounds.height,
7563
+ width,
7564
+ height,
7558
7565
  center: {
7559
- x: (bounds.minX + bounds.maxX) / 2,
7560
- y: (bounds.minY + bounds.maxY) / 2
7566
+ x: centerX,
7567
+ y: centerY
7561
7568
  }
7562
7569
  });
7563
7570
  }
7564
7571
  }
7572
+ _resolvePcbPadding() {
7573
+ const props = this._parsedProps;
7574
+ const layout = props.pcbLayout;
7575
+ const getPaddingValue = (key) => {
7576
+ const layoutValue = layout?.[key];
7577
+ const propsValue = props[key];
7578
+ if (typeof layoutValue === "number") return layoutValue;
7579
+ if (typeof propsValue === "number") return propsValue;
7580
+ return void 0;
7581
+ };
7582
+ const generalPadding = getPaddingValue("padding") ?? 0;
7583
+ const paddingX = getPaddingValue("paddingX");
7584
+ const paddingY = getPaddingValue("paddingY");
7585
+ const padLeft = getPaddingValue("paddingLeft") ?? paddingX ?? generalPadding;
7586
+ const padRight = getPaddingValue("paddingRight") ?? paddingX ?? generalPadding;
7587
+ const padTop = getPaddingValue("paddingTop") ?? paddingY ?? generalPadding;
7588
+ const padBottom = getPaddingValue("paddingBottom") ?? paddingY ?? generalPadding;
7589
+ return { padLeft, padRight, padTop, padBottom };
7590
+ }
7565
7591
  doInitialCreateTraceHintsFromProps() {
7566
7592
  const { _parsedProps: props } = this;
7567
7593
  const { db } = this.root;
@@ -8155,7 +8181,7 @@ var Group = class extends NormalComponent {
8155
8181
  };
8156
8182
 
8157
8183
  // lib/components/normal-components/Board.ts
8158
- import { checkEachPcbTraceNonOverlapping as checkEachPcbTraceNonOverlapping2 } from "@tscircuit/checks";
8184
+ import { checkEachPcbTraceNonOverlapping } from "@tscircuit/checks";
8159
8185
  var Board = class extends Group {
8160
8186
  pcb_board_id = null;
8161
8187
  _drcChecksComplete = false;
@@ -8272,7 +8298,7 @@ var Board = class extends Group {
8272
8298
  if (!this._areChildSubcircuitsRouted()) return;
8273
8299
  if (this._drcChecksComplete) return;
8274
8300
  this._drcChecksComplete = true;
8275
- const errors = checkEachPcbTraceNonOverlapping2(db.toArray());
8301
+ const errors = checkEachPcbTraceNonOverlapping(db.toArray());
8276
8302
  for (const error of errors) {
8277
8303
  db.pcb_trace_error.insert(error);
8278
8304
  }
@@ -10300,7 +10326,7 @@ import { identity as identity4 } from "transformation-matrix";
10300
10326
  var package_default = {
10301
10327
  name: "@tscircuit/core",
10302
10328
  type: "module",
10303
- version: "0.0.488",
10329
+ version: "0.0.490",
10304
10330
  types: "dist/index.d.ts",
10305
10331
  main: "dist/index.js",
10306
10332
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.490",
4
+ "version": "0.0.491",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",