@tscircuit/core 0.0.482 → 0.0.484

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
@@ -14161,6 +14161,7 @@ declare class TestPoint extends NormalComponent<typeof testpointProps> {
14161
14161
  }>;
14162
14162
  sourceFtype: "simple_test_point";
14163
14163
  };
14164
+ private _getPropsWithDefaults;
14164
14165
  _getImpliedFootprintString(): string | null;
14165
14166
  doInitialSourceRender(): void;
14166
14167
  }
package/dist/index.js CHANGED
@@ -8172,9 +8172,11 @@ var Board = class extends Group {
8172
8172
  x: hasComponents ? (minX + maxX) / 2 + (props.outlineOffsetX ?? 0) : props.outlineOffsetX ?? 0,
8173
8173
  y: hasComponents ? (minY + maxY) / 2 + (props.outlineOffsetY ?? 0) : props.outlineOffsetY ?? 0
8174
8174
  };
8175
+ const finalWidth = props.width ?? computedWidth;
8176
+ const finalHeight = props.height ?? computedHeight;
8175
8177
  db.pcb_board.update(this.pcb_board_id, {
8176
- width: computedWidth,
8177
- height: computedHeight,
8178
+ width: finalWidth,
8179
+ height: finalHeight,
8178
8180
  center
8179
8181
  });
8180
8182
  }
@@ -9895,6 +9897,11 @@ var Switch = class extends NormalComponent {
9895
9897
 
9896
9898
  // lib/components/normal-components/TestPoint.ts
9897
9899
  import { testpointProps } from "@tscircuit/props";
9900
+ var TESTPOINT_DEFAULTS = {
9901
+ HOLE_DIAMETER: 0.5,
9902
+ SMT_CIRCLE_DIAMETER: 1.2,
9903
+ SMT_RECT_SIZE: 2
9904
+ };
9898
9905
  var TestPoint = class extends NormalComponent {
9899
9906
  get config() {
9900
9907
  return {
@@ -9904,12 +9911,11 @@ var TestPoint = class extends NormalComponent {
9904
9911
  sourceFtype: FTYPE.simple_test_point
9905
9912
  };
9906
9913
  }
9907
- _getImpliedFootprintString() {
9914
+ _getPropsWithDefaults() {
9908
9915
  let {
9909
9916
  padShape,
9910
9917
  holeDiameter,
9911
9918
  footprintVariant,
9912
- // TODO SMTPAD
9913
9919
  padDiameter,
9914
9920
  width,
9915
9921
  height
@@ -9919,25 +9925,70 @@ var TestPoint = class extends NormalComponent {
9919
9925
  }
9920
9926
  footprintVariant ??= "through_hole";
9921
9927
  padShape ??= "circle";
9928
+ if (footprintVariant === "pad") {
9929
+ if (padShape === "circle") {
9930
+ padDiameter ??= TESTPOINT_DEFAULTS.SMT_CIRCLE_DIAMETER;
9931
+ } else if (padShape === "rect") {
9932
+ width ??= TESTPOINT_DEFAULTS.SMT_RECT_SIZE;
9933
+ height ??= width;
9934
+ }
9935
+ } else if (footprintVariant === "through_hole") {
9936
+ holeDiameter ??= TESTPOINT_DEFAULTS.HOLE_DIAMETER;
9937
+ }
9938
+ return {
9939
+ padShape,
9940
+ holeDiameter,
9941
+ footprintVariant,
9942
+ padDiameter,
9943
+ width,
9944
+ height
9945
+ };
9946
+ }
9947
+ _getImpliedFootprintString() {
9948
+ const {
9949
+ padShape,
9950
+ holeDiameter,
9951
+ footprintVariant,
9952
+ padDiameter,
9953
+ width,
9954
+ height
9955
+ } = this._getPropsWithDefaults();
9922
9956
  if (footprintVariant === "through_hole") {
9923
- holeDiameter ??= 0.5;
9924
9957
  return `platedhole_d${holeDiameter}`;
9925
9958
  }
9926
- throw new Error(`Footprint variant "${footprintVariant}" not implemented`);
9959
+ if (footprintVariant === "pad") {
9960
+ if (padShape === "circle") {
9961
+ return `smtpad_circle_d${padDiameter}`;
9962
+ }
9963
+ if (padShape === "rect") {
9964
+ return `smtpad_rect_w${width}_h${height}`;
9965
+ }
9966
+ }
9967
+ throw new Error(
9968
+ `Footprint variant "${footprintVariant}" with pad shape "${padShape}" not implemented`
9969
+ );
9927
9970
  }
9928
9971
  doInitialSourceRender() {
9929
9972
  const { db } = this.root;
9930
9973
  const { _parsedProps: props } = this;
9974
+ const {
9975
+ padShape,
9976
+ holeDiameter,
9977
+ footprintVariant,
9978
+ padDiameter,
9979
+ width,
9980
+ height
9981
+ } = this._getPropsWithDefaults();
9931
9982
  const source_component = db.source_component.insert({
9932
9983
  ftype: FTYPE.simple_test_point,
9933
9984
  name: props.name,
9934
9985
  supplier_part_numbers: props.supplierPartNumbers,
9935
- footprint_variant: props.footprintVariant,
9936
- pad_shape: props.padShape,
9937
- pad_diameter: props.padDiameter,
9938
- hole_diameter: props.holeDiameter,
9939
- width: props.width,
9940
- height: props.height,
9986
+ footprint_variant: footprintVariant,
9987
+ pad_shape: padShape,
9988
+ pad_diameter: padDiameter,
9989
+ hole_diameter: holeDiameter,
9990
+ width,
9991
+ height,
9941
9992
  are_pins_interchangeable: true
9942
9993
  });
9943
9994
  this.source_component_id = source_component.source_component_id;
@@ -10177,7 +10228,7 @@ import { identity as identity4 } from "transformation-matrix";
10177
10228
  var package_default = {
10178
10229
  name: "@tscircuit/core",
10179
10230
  type: "module",
10180
- version: "0.0.481",
10231
+ version: "0.0.483",
10181
10232
  types: "dist/index.d.ts",
10182
10233
  main: "dist/index.js",
10183
10234
  module: "dist/index.js",
@@ -10202,8 +10253,8 @@ var package_default = {
10202
10253
  "@biomejs/biome": "^1.8.3",
10203
10254
  "@tscircuit/capacity-autorouter": "^0.0.75",
10204
10255
  "@tscircuit/checks": "^0.0.52",
10256
+ "@tscircuit/footprinter": "^0.0.182",
10205
10257
  "@tscircuit/circuit-json-util": "^0.0.49",
10206
- "@tscircuit/footprinter": "^0.0.177",
10207
10258
  "@tscircuit/import-snippet": "^0.0.4",
10208
10259
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
10209
10260
  "@tscircuit/layout": "^0.0.28",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.482",
4
+ "version": "0.0.484",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -26,8 +26,8 @@
26
26
  "@biomejs/biome": "^1.8.3",
27
27
  "@tscircuit/capacity-autorouter": "^0.0.75",
28
28
  "@tscircuit/checks": "^0.0.52",
29
+ "@tscircuit/footprinter": "^0.0.182",
29
30
  "@tscircuit/circuit-json-util": "^0.0.49",
30
- "@tscircuit/footprinter": "^0.0.177",
31
31
  "@tscircuit/import-snippet": "^0.0.4",
32
32
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
33
33
  "@tscircuit/layout": "^0.0.28",