@tscircuit/core 0.0.187 → 0.0.189

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
@@ -158,6 +158,7 @@ declare abstract class PrimitiveComponent<ZodProps extends ZodType = any> extend
158
158
  * components share the same names) unless you explicitly break out some ports
159
159
  */
160
160
  get isSubcircuit(): any;
161
+ get isGroup(): boolean;
161
162
  /**
162
163
  * A primitive container is a component that contains one or more ports and
163
164
  * primitive components that are designed to interact.
package/dist/index.js CHANGED
@@ -505,6 +505,9 @@ var PrimitiveComponent = class extends Renderable {
505
505
  return Boolean(this.props.subcircuit) || // Implied opaque group for top-level group
506
506
  this.lowercaseComponentName === "group" && this?.parent?.isRoot;
507
507
  }
508
+ get isGroup() {
509
+ return this.lowercaseComponentName === "group";
510
+ }
508
511
  /**
509
512
  * A primitive container is a component that contains one or more ports and
510
513
  * primitive components that are designed to interact.
@@ -2812,7 +2815,7 @@ var NormalComponent = class extends PrimitiveComponent {
2812
2815
  rotation: props.pcbRotation ?? 0,
2813
2816
  source_component_id: this.source_component_id
2814
2817
  });
2815
- if (!props.footprint) {
2818
+ if (!props.footprint && !this.isGroup) {
2816
2819
  const footprint_error = db.pcb_missing_footprint_error.insert({
2817
2820
  message: `No footprint found for component: ${this.componentName}`,
2818
2821
  source_component_id: `${this.source_component_id}`,
@@ -3981,7 +3984,7 @@ var Trace = class extends PrimitiveComponent {
3981
3984
  this.renderError(`Could not find port for selector "${selector}"`);
3982
3985
  } else {
3983
3986
  this.renderError(
3984
- `Could not find port for selector "${selector}"
3987
+ `Could not find port for selector "${selector}" (did you forget to include the pin name?)
3985
3988
  searched component ${targetComponent.getString()}, which has ports: ${targetComponent.children.filter((c) => c.componentName === "Port").map(
3986
3989
  (c) => `${c.getString()}(${c.getNameAndAliases().join(",")})`
3987
3990
  ).join(" & ")}`
@@ -4533,6 +4536,7 @@ var Chip = class extends NormalComponent {
4533
4536
  supplier_part_numbers: props.supplierPartNumbers
4534
4537
  });
4535
4538
  const dimensions = this._getSchematicBoxDimensions();
4539
+ const hasOnlyLeftAndRightPins = props.schPortArrangement?.topSide !== void 0 && props.schPortArrangement?.bottomSide !== void 0;
4536
4540
  const schematic_box_width = dimensions?.getSize().width;
4537
4541
  const schematic_box_height = dimensions?.getSize().height;
4538
4542
  const manufacturer_part_number_text = db.schematic_text.insert({
@@ -4541,8 +4545,8 @@ var Chip = class extends NormalComponent {
4541
4545
  anchor: "left",
4542
4546
  rotation: 0,
4543
4547
  position: {
4544
- x: (props.schX ?? 0) + (schematic_box_width ?? 0) / 2,
4545
- y: (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.55
4548
+ x: hasOnlyLeftAndRightPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
4549
+ y: hasOnlyLeftAndRightPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.55 : (props.schY ?? 0) - (schematic_box_height ?? 0) / 2 - 0.13
4546
4550
  },
4547
4551
  color: "#006464"
4548
4552
  });
@@ -4552,8 +4556,8 @@ var Chip = class extends NormalComponent {
4552
4556
  anchor: "left",
4553
4557
  rotation: 0,
4554
4558
  position: {
4555
- x: (props.schX ?? 0) + (schematic_box_width ?? 0) / 2,
4556
- y: (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.35
4559
+ x: hasOnlyLeftAndRightPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
4560
+ y: hasOnlyLeftAndRightPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.35 : (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.13
4557
4561
  },
4558
4562
  color: "#006464"
4559
4563
  });
@@ -4623,6 +4627,32 @@ var Jumper = class extends NormalComponent {
4623
4627
  manufacturer_part_number: props.manufacturerPartNumber,
4624
4628
  supplier_part_numbers: props.supplierPartNumbers
4625
4629
  });
4630
+ const dimensions = this._getSchematicBoxDimensions();
4631
+ const hasOnlyLeftAndRightPins = props.schPortArrangement?.topSide !== void 0 && props.schPortArrangement?.bottomSide !== void 0;
4632
+ const schematic_box_width = dimensions?.getSize().width;
4633
+ const schematic_box_height = dimensions?.getSize().height;
4634
+ const manufacturer_part_number_text = db.schematic_text.insert({
4635
+ text: props.manufacturerPartNumber ?? "",
4636
+ schematic_component_id: source_component.source_component_id,
4637
+ anchor: "left",
4638
+ rotation: 0,
4639
+ position: {
4640
+ x: hasOnlyLeftAndRightPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
4641
+ y: hasOnlyLeftAndRightPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.55 : (props.schY ?? 0) - (schematic_box_height ?? 0) / 2 - 0.13
4642
+ },
4643
+ color: "#006464"
4644
+ });
4645
+ const component_name_text = db.schematic_text.insert({
4646
+ text: props.name ?? "",
4647
+ schematic_component_id: source_component.source_component_id,
4648
+ anchor: "left",
4649
+ rotation: 0,
4650
+ position: {
4651
+ x: hasOnlyLeftAndRightPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
4652
+ y: hasOnlyLeftAndRightPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.35 : (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.13
4653
+ },
4654
+ color: "#006464"
4655
+ });
4626
4656
  this.source_component_id = source_component.source_component_id;
4627
4657
  }
4628
4658
  doInitialPcbComponentRender() {
@@ -5173,6 +5203,20 @@ var PinHeader = class extends NormalComponent {
5173
5203
  // gender: props.gender,
5174
5204
  // pitch: props.pitch,
5175
5205
  });
5206
+ const dimensions = this._getSchematicBoxDimensions();
5207
+ const schematic_box_width = dimensions?.getSize().width;
5208
+ const schematic_box_height = dimensions?.getSize().height;
5209
+ const component_name_text = db.schematic_text.insert({
5210
+ text: props.name ?? "",
5211
+ schematic_component_id: source_component.source_component_id,
5212
+ anchor: "left",
5213
+ rotation: 0,
5214
+ position: {
5215
+ x: (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
5216
+ y: (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.13
5217
+ },
5218
+ color: "#006464"
5219
+ });
5176
5220
  this.source_component_id = source_component.source_component_id;
5177
5221
  }
5178
5222
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.187",
4
+ "version": "0.0.189",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -40,12 +40,12 @@
40
40
  "@tscircuit/footprinter": "^0.0.77",
41
41
  "@tscircuit/infgrid-ijump-astar": "^0.0.24",
42
42
  "@tscircuit/math-utils": "^0.0.5",
43
- "@tscircuit/props": "^0.0.98",
43
+ "@tscircuit/props": "^0.0.99",
44
44
  "@tscircuit/schematic-autolayout": "^0.0.6",
45
45
  "@tscircuit/soup-util": "^0.0.40",
46
46
  "circuit-json": "^0.0.104",
47
47
  "circuit-json-to-connectivity-map": "^0.0.17",
48
- "circuit-to-svg": "^0.0.80",
48
+ "circuit-to-svg": "^0.0.81",
49
49
  "format-si-unit": "^0.0.2",
50
50
  "nanoid": "^5.0.7",
51
51
  "performance-now": "^2.1.0",