@tscircuit/core 0.0.287 → 0.0.289

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
@@ -2567,6 +2567,7 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
2567
2567
  doInitialSchematicComponentRender(): void;
2568
2568
  doInitialSourceRender(): void;
2569
2569
  doInitialPcbComponentRender(): void;
2570
+ doInitialCreateTracesFromProps(): void;
2570
2571
  }
2571
2572
 
2572
2573
  declare class Diode extends NormalComponent<typeof diodeProps, PolarizedPassivePorts> {
package/dist/index.js CHANGED
@@ -4029,9 +4029,21 @@ var Board = class extends Group {
4029
4029
  if (this.root?.pcbDisabled) return;
4030
4030
  const { db } = this.root;
4031
4031
  const { _parsedProps: props } = this;
4032
- if (!props.width || !props.height) {
4032
+ if (!props.outline && (!props.width || !props.height)) {
4033
4033
  throw new Error("Board width and height or an outline are required");
4034
4034
  }
4035
+ let computedWidth = props.width;
4036
+ let computedHeight = props.height;
4037
+ if (props.outline) {
4038
+ const xValues = props.outline.map((point) => point.x);
4039
+ const yValues = props.outline.map((point) => point.y);
4040
+ const minX = Math.min(...xValues);
4041
+ const maxX = Math.max(...xValues);
4042
+ const minY = Math.min(...yValues);
4043
+ const maxY = Math.max(...yValues);
4044
+ computedWidth = maxX - minX;
4045
+ computedHeight = maxY - minY;
4046
+ }
4035
4047
  const pcb_board = db.pcb_board.insert({
4036
4048
  center: {
4037
4049
  x: (props.pcbX ?? 0) + (props.outlineOffsetX ?? 0),
@@ -4039,8 +4051,8 @@ var Board = class extends Group {
4039
4051
  },
4040
4052
  thickness: this.boardThickness,
4041
4053
  num_layers: this.allLayers.length,
4042
- width: props.width,
4043
- height: props.height,
4054
+ width: computedWidth,
4055
+ height: computedHeight,
4044
4056
  outline: props.outline?.map((point) => ({
4045
4057
  x: point.x + (props.outlineOffsetX ?? 0),
4046
4058
  y: point.y + (props.outlineOffsetY ?? 0)
@@ -5613,6 +5625,19 @@ var Chip = class extends NormalComponent {
5613
5625
  });
5614
5626
  this.pcb_component_id = pcb_component.pcb_component_id;
5615
5627
  }
5628
+ doInitialCreateTracesFromProps() {
5629
+ const { _parsedProps: props } = this;
5630
+ if (props.externallyConnectedPins) {
5631
+ for (const [pin1, pin2] of props.externallyConnectedPins) {
5632
+ this.add(
5633
+ new Trace2({
5634
+ from: `${this.getSubcircuitSelector()} > port.${pin1}`,
5635
+ to: `${this.getSubcircuitSelector()} > port.${pin2}`
5636
+ })
5637
+ );
5638
+ }
5639
+ }
5640
+ }
5616
5641
  };
5617
5642
 
5618
5643
  // lib/components/normal-components/Diode.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.287",
4
+ "version": "0.0.289",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",