@tscircuit/core 0.0.419 → 0.0.421

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
@@ -1024,6 +1024,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
1024
1024
  doInitialSourceRender(): void;
1025
1025
  doInitialSourceParentAttachment(): void;
1026
1026
  doInitialPcbComponentRender(): void;
1027
+ doInitialPcbPrimitiveRender(): void;
1027
1028
  doInitialCreateTraceHintsFromProps(): void;
1028
1029
  doInitialSourceAddConnectivityMapKey(): void;
1029
1030
  _areChildSubcircuitsRouted(): boolean;
@@ -12241,7 +12242,7 @@ declare const getPhaseTimingsFromRenderEvents: (renderEvents: RenderEvent[]) =>
12241
12242
  type Nums16 = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16";
12242
12243
  type Nums40 = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "19" | "20" | "21" | "22" | "23" | "24" | "25" | "26" | "27" | "28" | "29" | "30" | "31" | "32" | "33" | "34" | "35" | "36" | "37" | "38" | "39" | "40";
12243
12244
  type PinNumbers100 = "pin0" | "pin1" | "pin2" | "pin3" | "pin4" | "pin5" | "pin6" | "pin7" | "pin8" | "pin9" | "pin10" | "pin11" | "pin12" | "pin13" | "pin14" | "pin15" | "pin16" | "pin17" | "pin18" | "pin19" | "pin20" | "pin21" | "pin22" | "pin23" | "pin24" | "pin25" | "pin26" | "pin27" | "pin28" | "pin29" | "pin30" | "pin31" | "pin32" | "pin33" | "pin34" | "pin35" | "pin36" | "pin37" | "pin38" | "pin39" | "pin40" | "pin41" | "pin42" | "pin43" | "pin44" | "pin45" | "pin46" | "pin47" | "pin48" | "pin49" | "pin50" | "pin51" | "pin52" | "pin53" | "pin54" | "pin55" | "pin56" | "pin57" | "pin58" | "pin59" | "pin60" | "pin61" | "pin62" | "pin63" | "pin64" | "pin65" | "pin66" | "pin67" | "pin68" | "pin69" | "pin70" | "pin71" | "pin72" | "pin73" | "pin74" | "pin75" | "pin76" | "pin77" | "pin78" | "pin79" | "pin80" | "pin81" | "pin82" | "pin83" | "pin84" | "pin85" | "pin86" | "pin87" | "pin88" | "pin89" | "pin90" | "pin91" | "pin92" | "pin93" | "pin94" | "pin95" | "pin96" | "pin97" | "pin98" | "pin99" | "pin100";
12244
- type CommonPinNames = "pos" | "neg" | "V5" | "V3_3" | "PWR" | "VCC" | "VDD" | "GND" | `D${Nums40}` | `GP${Nums40}` | `GPIO${Nums40}` | "DP" | "DN" | "VIN" | "VOUT" | "VREF" | "VIN" | "VOUT" | "VREF" | "VIN" | "VOUT" | "VREF" | "OUT" | "DISCH" | "EN" | "IN" | "CLK" | "DATA" | "THRES" | "TRIG" | "RESET" | `A${Nums40}` | `B${Nums40}` | PinNumbers100;
12245
+ type CommonPinNames = "pos" | "neg" | "V5" | "V3_3" | "PWR" | "VCC" | "VDD" | "GND" | "SHLD" | `D${Nums40}` | `GP${Nums40}` | `GPIO${Nums40}` | "DP" | "DN" | "VIN" | "VOUT" | "VREF" | "VIN" | "VOUT" | "VREF" | "VIN" | "VOUT" | "VREF" | "OUT" | "DISCH" | "EN" | "IN" | "CLK" | "DATA" | "THRES" | "TRIG" | "RESET" | `A${Nums40}` | `B${Nums40}` | PinNumbers100;
12245
12246
  type TransistorPinNames = "base" | "collector" | "emitter";
12246
12247
 
12247
12248
  type NonPolarizedSel = Record<`R${Nums40}`, {
@@ -12266,7 +12267,7 @@ type PolarizedSel = Record<`C${Nums40}` | `L${Nums40}` | `LED${Nums40}` | `D${Nu
12266
12267
  pos: string;
12267
12268
  neg: string;
12268
12269
  }>;
12269
- type CommonNetNames = "VCC" | "GND" | "VDD" | "PWR" | "V5" | "V3_3" | "VIN" | "EN";
12270
+ type CommonNetNames = "VCC" | "GND" | "VDD" | "PWR" | "V5" | "V3_3" | "VIN" | "SHLD" | "EN";
12270
12271
  type TransistorSel = Record<`Q${Nums40}`, Record<TransistorPinNames, string>>;
12271
12272
  type JumperSel = Record<`J${Nums40}` | `CN${Nums40}`, Record<PinNumbers100 | CommonPinNames, string>>;
12272
12273
  type ChipSel = Record<`U${Nums40}`, Record<CommonPinNames, string> & ChipFnSel>;
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;
@@ -6427,6 +6442,21 @@ var Group = class extends NormalComponent {
6427
6442
  });
6428
6443
  }
6429
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
+ }
6459
+ }
6430
6460
  doInitialCreateTraceHintsFromProps() {
6431
6461
  const { _parsedProps: props } = this;
6432
6462
  const { db } = this.root;
@@ -8441,7 +8471,7 @@ import { identity as identity4 } from "transformation-matrix";
8441
8471
  var package_default = {
8442
8472
  name: "@tscircuit/core",
8443
8473
  type: "module",
8444
- version: "0.0.418",
8474
+ version: "0.0.420",
8445
8475
  types: "dist/index.d.ts",
8446
8476
  main: "dist/index.js",
8447
8477
  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.419",
4
+ "version": "0.0.421",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",