@tscircuit/core 0.0.418 → 0.0.420

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
@@ -1010,6 +1010,7 @@ declare class NormalComponent<ZodProps extends ZodType = any, PortNames extends
1010
1010
 
1011
1011
  declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps> extends NormalComponent<Props> implements ISubcircuit {
1012
1012
  pcb_group_id: string | null;
1013
+ schematic_group_id: string | null;
1013
1014
  subcircuit_id: string | null;
1014
1015
  _hasStartedAsyncAutorouting: boolean;
1015
1016
  _asyncAutoroutingResult: {
@@ -1023,6 +1024,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
1023
1024
  doInitialSourceRender(): void;
1024
1025
  doInitialSourceParentAttachment(): void;
1025
1026
  doInitialPcbComponentRender(): void;
1027
+ doInitialPcbPrimitiveRender(): void;
1026
1028
  doInitialCreateTraceHintsFromProps(): void;
1027
1029
  doInitialSourceAddConnectivityMapKey(): void;
1028
1030
  _areChildSubcircuitsRouted(): boolean;
@@ -1038,6 +1040,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
1038
1040
  updatePcbTraceRender(): void;
1039
1041
  _updatePcbTraceRenderFromSimpleRouteJson(): void;
1040
1042
  _updatePcbTraceRenderFromPcbTraces(): void;
1043
+ doInitialSchematicComponentRender(): void;
1041
1044
  doInitialSchematicLayout(): void;
1042
1045
  _getAutorouterConfig(): AutorouterConfig;
1043
1046
  /**
package/dist/index.js CHANGED
@@ -2427,6 +2427,7 @@ function getBoundsOfPcbComponents(components) {
2427
2427
  let minY = Infinity;
2428
2428
  let maxX = -Infinity;
2429
2429
  let maxY = -Infinity;
2430
+ let hasValidComponents = false;
2430
2431
  for (const child of components) {
2431
2432
  if (child.isPcbPrimitive && !child.componentName.startsWith("Silkscreen")) {
2432
2433
  const { x, y } = child._getGlobalPcbPositionBeforeLayout();
@@ -2435,14 +2436,28 @@ function getBoundsOfPcbComponents(components) {
2435
2436
  minY = Math.min(minY, y - height2 / 2);
2436
2437
  maxX = Math.max(maxX, x + width2 / 2);
2437
2438
  maxY = Math.max(maxY, y + height2 / 2);
2438
- } else if (child.componentName === "Footprint") {
2439
+ hasValidComponents = true;
2440
+ } else if (child.children.length > 0) {
2439
2441
  const childBounds = getBoundsOfPcbComponents(child.children);
2440
- minX = Math.min(minX, childBounds.minX);
2441
- minY = Math.min(minY, childBounds.minY);
2442
- maxX = Math.max(maxX, childBounds.maxX);
2443
- maxY = Math.max(maxY, childBounds.maxY);
2442
+ if (childBounds.width > 0 || childBounds.height > 0) {
2443
+ minX = Math.min(minX, childBounds.minX);
2444
+ minY = Math.min(minY, childBounds.minY);
2445
+ maxX = Math.max(maxX, childBounds.maxX);
2446
+ maxY = Math.max(maxY, childBounds.maxY);
2447
+ hasValidComponents = true;
2448
+ }
2444
2449
  }
2445
2450
  }
2451
+ if (!hasValidComponents) {
2452
+ return {
2453
+ minX: 0,
2454
+ minY: 0,
2455
+ maxX: 0,
2456
+ maxY: 0,
2457
+ width: 0,
2458
+ height: 0
2459
+ };
2460
+ }
2446
2461
  let width = maxX - minX;
2447
2462
  let height = maxY - minY;
2448
2463
  if (width < 0) width = 0;
@@ -6370,6 +6385,7 @@ var getPhaseTimingsFromRenderEvents = (renderEvents) => {
6370
6385
  import "@tscircuit/checks";
6371
6386
  var Group = class extends NormalComponent {
6372
6387
  pcb_group_id = null;
6388
+ schematic_group_id = null;
6373
6389
  subcircuit_id = null;
6374
6390
  _hasStartedAsyncAutorouting = false;
6375
6391
  _asyncAutoroutingResult = null;
@@ -6390,6 +6406,11 @@ var Group = class extends NormalComponent {
6390
6406
  db.source_group.update(source_group.source_group_id, {
6391
6407
  subcircuit_id: this.subcircuit_id
6392
6408
  });
6409
+ for (const child of this.children) {
6410
+ db.source_component.update(child.source_component_id, {
6411
+ source_group_id: this.source_group_id
6412
+ });
6413
+ }
6393
6414
  }
6394
6415
  doInitialSourceParentAttachment() {
6395
6416
  const { db } = this.root;
@@ -6415,6 +6436,26 @@ var Group = class extends NormalComponent {
6415
6436
  source_group_id: this.source_group_id
6416
6437
  });
6417
6438
  this.pcb_group_id = pcb_group.pcb_group_id;
6439
+ for (const child of this.children) {
6440
+ db.pcb_component.update(child.pcb_component_id, {
6441
+ pcb_group_id: pcb_group.pcb_group_id
6442
+ });
6443
+ }
6444
+ }
6445
+ doInitialPcbPrimitiveRender() {
6446
+ if (this.root?.pcbDisabled) return;
6447
+ const { db } = this.root;
6448
+ const bounds = getBoundsOfPcbComponents(this.children);
6449
+ if (this.pcb_group_id) {
6450
+ db.pcb_group.update(this.pcb_group_id, {
6451
+ width: bounds.width,
6452
+ height: bounds.height,
6453
+ center: {
6454
+ x: (bounds.minX + bounds.maxX) / 2,
6455
+ y: (bounds.minY + bounds.maxY) / 2
6456
+ }
6457
+ });
6458
+ }
6418
6459
  }
6419
6460
  doInitialCreateTraceHintsFromProps() {
6420
6461
  const { _parsedProps: props } = this;
@@ -6789,6 +6830,27 @@ var Group = class extends NormalComponent {
6789
6830
  }
6790
6831
  }
6791
6832
  }
6833
+ doInitialSchematicComponentRender() {
6834
+ if (this.root?.schematicDisabled) return;
6835
+ const { db } = this.root;
6836
+ const { _parsedProps: props } = this;
6837
+ const schematic_group = db.schematic_group.insert({
6838
+ is_subcircuit: this.isSubcircuit,
6839
+ subcircuit_id: this.subcircuit_id,
6840
+ name: this._parsedProps.name,
6841
+ center: this._getGlobalSchematicPositionBeforeLayout(),
6842
+ width: 0,
6843
+ height: 0,
6844
+ schematic_component_ids: [],
6845
+ source_group_id: this.source_group_id
6846
+ });
6847
+ this.schematic_group_id = schematic_group.schematic_group_id;
6848
+ for (const child of this.children) {
6849
+ db.schematic_component.update(child.schematic_component_id, {
6850
+ schematic_group_id: schematic_group.schematic_group_id
6851
+ });
6852
+ }
6853
+ }
6792
6854
  doInitialSchematicLayout() {
6793
6855
  if (!this.isSubcircuit) return;
6794
6856
  const props = this._parsedProps;
@@ -8409,7 +8471,7 @@ import { identity as identity4 } from "transformation-matrix";
8409
8471
  var package_default = {
8410
8472
  name: "@tscircuit/core",
8411
8473
  type: "module",
8412
- version: "0.0.417",
8474
+ version: "0.0.419",
8413
8475
  types: "dist/index.d.ts",
8414
8476
  main: "dist/index.js",
8415
8477
  module: "dist/index.js",
@@ -8432,7 +8494,7 @@ var package_default = {
8432
8494
  },
8433
8495
  devDependencies: {
8434
8496
  "@biomejs/biome": "^1.8.3",
8435
- "@tscircuit/capacity-autorouter": "^0.0.66",
8497
+ "@tscircuit/capacity-autorouter": "^0.0.67",
8436
8498
  "@tscircuit/checks": "^0.0.46",
8437
8499
  "@tscircuit/circuit-json-util": "^0.0.47",
8438
8500
  "@tscircuit/footprinter": "^0.0.159",
@@ -8450,7 +8512,7 @@ var package_default = {
8450
8512
  "@types/react-reconciler": "^0.28.9",
8451
8513
  "bun-match-svg": "0.0.8",
8452
8514
  "chokidar-cli": "^3.0.0",
8453
- "circuit-json": "^0.0.180",
8515
+ "circuit-json": "^0.0.186",
8454
8516
  "circuit-json-to-connectivity-map": "^0.0.22",
8455
8517
  "circuit-json-to-simple-3d": "^0.0.2",
8456
8518
  "circuit-to-svg": "^0.0.127",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.418",
4
+ "version": "0.0.420",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@biomejs/biome": "^1.8.3",
27
- "@tscircuit/capacity-autorouter": "^0.0.66",
27
+ "@tscircuit/capacity-autorouter": "^0.0.67",
28
28
  "@tscircuit/checks": "^0.0.46",
29
29
  "@tscircuit/circuit-json-util": "^0.0.47",
30
30
  "@tscircuit/footprinter": "^0.0.159",
@@ -42,7 +42,7 @@
42
42
  "@types/react-reconciler": "^0.28.9",
43
43
  "bun-match-svg": "0.0.8",
44
44
  "chokidar-cli": "^3.0.0",
45
- "circuit-json": "^0.0.180",
45
+ "circuit-json": "^0.0.186",
46
46
  "circuit-json-to-connectivity-map": "^0.0.22",
47
47
  "circuit-json-to-simple-3d": "^0.0.2",
48
48
  "circuit-to-svg": "^0.0.127",