@tscircuit/core 0.0.777 → 0.0.779

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
@@ -1176,6 +1176,7 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
1176
1176
  */
1177
1177
  _getSchematicPortArrangement(): SchematicPortArrangement | null;
1178
1178
  _getSchematicBoxDimensions(): SchematicBoxDimensions | null;
1179
+ getFootprinterString(): string | null;
1179
1180
  doInitialCadModelRender(): void;
1180
1181
  private _addCachebustToModelUrl;
1181
1182
  private _getPartsEngineCacheKey;
@@ -12934,6 +12935,7 @@ declare class Led extends NormalComponent<typeof ledProps, PolarizedPassivePorts
12934
12935
  };
12935
12936
  initPorts(): void;
12936
12937
  _getSchematicSymbolDisplayValue(): string | undefined;
12938
+ getFootprinterString(): string | null;
12937
12939
  doInitialSourceRender(): void;
12938
12940
  pos: Port;
12939
12941
  anode: Port;
package/dist/index.js CHANGED
@@ -2611,16 +2611,45 @@ var Hole = class extends PrimitiveComponent2 {
2611
2611
  const { _parsedProps: props } = this;
2612
2612
  const subcircuit = this.getSubcircuit();
2613
2613
  const position = this._getGlobalPcbPositionBeforeLayout();
2614
- const inserted_hole = db.pcb_hole.insert({
2615
- hole_shape: "circle",
2616
- // @ts-ignore
2617
- hole_diameter: props.diameter,
2618
- x: position.x,
2619
- y: position.y,
2620
- subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
2621
- pcb_group_id: subcircuit?.getGroup()?.pcb_group_id ?? void 0
2622
- });
2623
- this.pcb_hole_id = inserted_hole.pcb_hole_id;
2614
+ if (props.shape === "pill") {
2615
+ if (props.pcbRotation && props.pcbRotation !== 0) {
2616
+ const inserted_hole = db.pcb_hole.insert({
2617
+ type: "pcb_hole",
2618
+ hole_shape: "rotated_pill",
2619
+ hole_width: props.width,
2620
+ hole_height: props.height,
2621
+ x: position.x,
2622
+ y: position.y,
2623
+ ccw_rotation: props.pcbRotation,
2624
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
2625
+ pcb_group_id: subcircuit?.getGroup()?.pcb_group_id ?? void 0
2626
+ });
2627
+ this.pcb_hole_id = inserted_hole.pcb_hole_id;
2628
+ } else {
2629
+ const inserted_hole = db.pcb_hole.insert({
2630
+ type: "pcb_hole",
2631
+ hole_shape: "pill",
2632
+ hole_width: props.width,
2633
+ hole_height: props.height,
2634
+ x: position.x,
2635
+ y: position.y,
2636
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
2637
+ pcb_group_id: subcircuit?.getGroup()?.pcb_group_id ?? void 0
2638
+ });
2639
+ this.pcb_hole_id = inserted_hole.pcb_hole_id;
2640
+ }
2641
+ } else {
2642
+ const inserted_hole = db.pcb_hole.insert({
2643
+ hole_shape: "circle",
2644
+ // @ts-ignore
2645
+ hole_diameter: props.diameter,
2646
+ x: position.x,
2647
+ y: position.y,
2648
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
2649
+ pcb_group_id: subcircuit?.getGroup()?.pcb_group_id ?? void 0
2650
+ });
2651
+ this.pcb_hole_id = inserted_hole.pcb_hole_id;
2652
+ }
2624
2653
  }
2625
2654
  _getPcbCircuitJsonBounds() {
2626
2655
  const { db } = this.root;
@@ -3028,6 +3057,27 @@ var createComponentsFromCircuitJson = ({
3028
3057
  diameter: elm.hole_diameter
3029
3058
  })
3030
3059
  );
3060
+ } else if (elm.type === "pcb_hole" && elm.hole_shape === "pill") {
3061
+ components.push(
3062
+ new Hole({
3063
+ pcbX: elm.x,
3064
+ pcbY: elm.y,
3065
+ shape: "pill",
3066
+ width: elm.hole_width,
3067
+ height: elm.hole_height
3068
+ })
3069
+ );
3070
+ } else if (elm.type === "pcb_hole" && elm.hole_shape === "rotated_pill") {
3071
+ components.push(
3072
+ new Hole({
3073
+ pcbX: elm.x,
3074
+ pcbY: elm.y,
3075
+ shape: "pill",
3076
+ width: elm.hole_width,
3077
+ height: elm.hole_height,
3078
+ pcbRotation: elm.ccw_rotation
3079
+ })
3080
+ );
3031
3081
  } else if (elm.type === "pcb_cutout") {
3032
3082
  if (elm.shape === "rect") {
3033
3083
  components.push(
@@ -8182,13 +8232,19 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
8182
8232
  });
8183
8233
  return dimensions;
8184
8234
  }
8235
+ getFootprinterString() {
8236
+ if (typeof this._parsedProps.footprint === "string") {
8237
+ return this._parsedProps.footprint;
8238
+ }
8239
+ return null;
8240
+ }
8185
8241
  doInitialCadModelRender() {
8186
8242
  if (this._isCadModelChild) return;
8187
8243
  const { db } = this.root;
8188
8244
  const { boardThickness = 0 } = this.root?._getBoard() ?? {};
8189
8245
  const cadModelProp = this._parsedProps.cadModel;
8190
8246
  const cadModel = cadModelProp === void 0 ? this._asyncFootprintCadModel : cadModelProp;
8191
- const footprint = this.props.footprint ?? this._getImpliedFootprintString();
8247
+ const footprint = this.getFootprinterString() ?? this._getImpliedFootprintString();
8192
8248
  if (!this.pcb_component_id) return;
8193
8249
  if (!cadModel && !footprint) return;
8194
8250
  if (cadModel === null) return;
@@ -13857,6 +13913,13 @@ var Led = class extends NormalComponent3 {
13857
13913
  _getSchematicSymbolDisplayValue() {
13858
13914
  return this._parsedProps.schDisplayValue || this._parsedProps.color || void 0;
13859
13915
  }
13916
+ getFootprinterString() {
13917
+ const baseFootprint = super.getFootprinterString();
13918
+ if (baseFootprint && this.props.color) {
13919
+ return `${baseFootprint}_color(${this.props.color})`;
13920
+ }
13921
+ return baseFootprint;
13922
+ }
13860
13923
  doInitialSourceRender() {
13861
13924
  const { db } = this.root;
13862
13925
  const { _parsedProps: props } = this;
@@ -16205,7 +16268,7 @@ import { identity as identity6 } from "transformation-matrix";
16205
16268
  var package_default = {
16206
16269
  name: "@tscircuit/core",
16207
16270
  type: "module",
16208
- version: "0.0.776",
16271
+ version: "0.0.778",
16209
16272
  types: "dist/index.d.ts",
16210
16273
  main: "dist/index.js",
16211
16274
  module: "dist/index.js",
@@ -16258,13 +16321,13 @@ var package_default = {
16258
16321
  "bun-match-svg": "0.0.12",
16259
16322
  "calculate-elbow": "^0.0.12",
16260
16323
  "chokidar-cli": "^3.0.0",
16261
- "circuit-json": "^0.0.275",
16324
+ "circuit-json": "^0.0.277",
16262
16325
  "circuit-json-to-bpc": "^0.0.13",
16263
16326
  "circuit-json-to-connectivity-map": "^0.0.22",
16264
16327
  "circuit-json-to-gltf": "^0.0.7",
16265
16328
  "circuit-json-to-simple-3d": "^0.0.9",
16266
16329
  "circuit-json-to-spice": "^0.0.13",
16267
- "circuit-to-svg": "^0.0.230",
16330
+ "circuit-to-svg": "^0.0.235",
16268
16331
  concurrently: "^9.1.2",
16269
16332
  "connectivity-map": "^1.0.0",
16270
16333
  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.777",
4
+ "version": "0.0.779",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -54,13 +54,13 @@
54
54
  "bun-match-svg": "0.0.12",
55
55
  "calculate-elbow": "^0.0.12",
56
56
  "chokidar-cli": "^3.0.0",
57
- "circuit-json": "^0.0.275",
57
+ "circuit-json": "^0.0.277",
58
58
  "circuit-json-to-bpc": "^0.0.13",
59
59
  "circuit-json-to-connectivity-map": "^0.0.22",
60
60
  "circuit-json-to-gltf": "^0.0.7",
61
61
  "circuit-json-to-simple-3d": "^0.0.9",
62
62
  "circuit-json-to-spice": "^0.0.13",
63
- "circuit-to-svg": "^0.0.230",
63
+ "circuit-to-svg": "^0.0.235",
64
64
  "concurrently": "^9.1.2",
65
65
  "connectivity-map": "^1.0.0",
66
66
  "debug": "^4.3.6",