@tscircuit/core 0.0.918 → 0.0.919

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
@@ -118,6 +118,7 @@ interface BoardI {
118
118
  _connectedSchematicPortPairs: Set<string>;
119
119
  allLayers: ReadonlyArray<LayerRef>;
120
120
  _getBoardCalcVariables(): Record<string, number>;
121
+ pcb_board_id?: string | null;
121
122
  }
122
123
 
123
124
  type SimplifiedPcbTrace = {
@@ -1262,6 +1263,7 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
1262
1263
  doInitialCreateTracesFromProps(): void;
1263
1264
  _createTracesFromConnectionsProp(): void;
1264
1265
  doInitialSourceDesignRuleChecks(): void;
1266
+ doInitialPcbLayout(): void;
1265
1267
  /**
1266
1268
  * Get the minimum flex container size for this component on PCB
1267
1269
  */
package/dist/index.js CHANGED
@@ -9453,6 +9453,24 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
9453
9453
  doInitialSourceDesignRuleChecks() {
9454
9454
  NormalComponent_doInitialSourceDesignRuleChecks(this);
9455
9455
  }
9456
+ doInitialPcbLayout() {
9457
+ if (this.root?.pcbDisabled) return;
9458
+ if (!this.pcb_component_id) return;
9459
+ const { db } = this.root;
9460
+ const props = this._parsedProps;
9461
+ const hasExplicitPcbPosition = props.pcbX !== void 0 || props.pcbY !== void 0;
9462
+ if (!hasExplicitPcbPosition) return;
9463
+ const sourceComponent = db.source_component.get(this.source_component_id);
9464
+ const positionedRelativeToGroupId = sourceComponent?.source_group_id ? db.pcb_group.getWhere({
9465
+ source_group_id: sourceComponent.source_group_id
9466
+ })?.pcb_group_id : void 0;
9467
+ const positionedRelativeToBoardId = positionedRelativeToGroupId ? void 0 : this._getBoard()?.pcb_board_id ?? void 0;
9468
+ db.pcb_component.update(this.pcb_component_id, {
9469
+ position_mode: "relative_to_group_anchor",
9470
+ positioned_relative_to_pcb_group_id: positionedRelativeToGroupId,
9471
+ positioned_relative_to_pcb_board_id: positionedRelativeToBoardId
9472
+ });
9473
+ }
9456
9474
  /**
9457
9475
  * Get the minimum flex container size for this component on PCB
9458
9476
  */
@@ -12146,6 +12164,9 @@ var applyPackOutput = (group, packOutput, clusterMap) => {
12146
12164
  for (const memberId of cluster.componentIds) {
12147
12165
  const rel = cluster.relativeCenters[memberId];
12148
12166
  if (!rel) continue;
12167
+ db.pcb_component.update(memberId, {
12168
+ position_mode: "packed"
12169
+ });
12149
12170
  const rotatedRel = {
12150
12171
  x: rel.x * Math.cos(angleRad) - rel.y * Math.sin(angleRad),
12151
12172
  y: rel.x * Math.sin(angleRad) + rel.y * Math.cos(angleRad)
@@ -12174,6 +12195,9 @@ var applyPackOutput = (group, packOutput, clusterMap) => {
12174
12195
  }
12175
12196
  const pcbComponent = db.pcb_component.get(componentId);
12176
12197
  if (pcbComponent) {
12198
+ db.pcb_component.update(componentId, {
12199
+ position_mode: "packed"
12200
+ });
12177
12201
  const currentGroupId = group.source_group_id;
12178
12202
  const sourceComponent = db.source_component.get(
12179
12203
  pcbComponent.source_component_id
@@ -12250,6 +12274,13 @@ var applyPackOutput = (group, packOutput, clusterMap) => {
12250
12274
  }
12251
12275
  return false;
12252
12276
  });
12277
+ for (const elm of relatedElements) {
12278
+ if (elm.type === "pcb_component") {
12279
+ db.pcb_component.update(elm.pcb_component_id, {
12280
+ position_mode: "packed"
12281
+ });
12282
+ }
12283
+ }
12253
12284
  transformPCBElements(relatedElements, transformMatrix);
12254
12285
  db.pcb_group.update(pcbGroup.pcb_group_id, { center });
12255
12286
  }
@@ -19247,7 +19278,7 @@ import { identity as identity5 } from "transformation-matrix";
19247
19278
  var package_default = {
19248
19279
  name: "@tscircuit/core",
19249
19280
  type: "module",
19250
- version: "0.0.917",
19281
+ version: "0.0.918",
19251
19282
  types: "dist/index.d.ts",
19252
19283
  main: "dist/index.js",
19253
19284
  module: "dist/index.js",
@@ -19311,7 +19342,7 @@ var package_default = {
19311
19342
  "circuit-json-to-gltf": "^0.0.31",
19312
19343
  "circuit-json-to-simple-3d": "^0.0.9",
19313
19344
  "circuit-json-to-spice": "^0.0.30",
19314
- "circuit-to-svg": "^0.0.287",
19345
+ "circuit-to-svg": "^0.0.288",
19315
19346
  concurrently: "^9.1.2",
19316
19347
  "connectivity-map": "^1.0.0",
19317
19348
  debug: "^4.3.6",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.918",
4
+ "version": "0.0.919",
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.30",
68
- "circuit-to-svg": "^0.0.287",
68
+ "circuit-to-svg": "^0.0.288",
69
69
  "concurrently": "^9.1.2",
70
70
  "connectivity-map": "^1.0.0",
71
71
  "debug": "^4.3.6",