@tscircuit/core 0.0.211 → 0.0.212

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
@@ -88,6 +88,7 @@ declare class Circuit {
88
88
  db: SoupUtilObjects;
89
89
  root: Circuit | null;
90
90
  isRoot: boolean;
91
+ schematicDisabled: boolean;
91
92
  _hasRenderedAtleastOnce: boolean;
92
93
  constructor();
93
94
  add(componentOrElm: PrimitiveComponent | ReactElement): void;
package/dist/index.js CHANGED
@@ -2630,6 +2630,7 @@ var NormalComponent = class extends PrimitiveComponent {
2630
2630
  *
2631
2631
  */
2632
2632
  initPorts(opts = {}) {
2633
+ if (this.root?.schematicDisabled) return;
2633
2634
  const { config } = this;
2634
2635
  const portsToCreate = [];
2635
2636
  const schPortArrangement = this._parsedProps.schPortArrangement;
@@ -2838,6 +2839,7 @@ var NormalComponent = class extends PrimitiveComponent {
2838
2839
  * You can override this method to do more complicated things.
2839
2840
  */
2840
2841
  doInitialSchematicComponentRender() {
2842
+ if (this.root?.schematicDisabled) return;
2841
2843
  const { schematicSymbolName } = this.config;
2842
2844
  if (schematicSymbolName) {
2843
2845
  return this._doInitialSchematicComponentRenderWithSymbol();
@@ -2851,6 +2853,7 @@ var NormalComponent = class extends PrimitiveComponent {
2851
2853
  return void 0;
2852
2854
  }
2853
2855
  _doInitialSchematicComponentRenderWithSymbol() {
2856
+ if (this.root?.schematicDisabled) return;
2854
2857
  const { db } = this.root;
2855
2858
  const { _parsedProps: props } = this;
2856
2859
  const symbol_name = this._getSchematicSymbolNameOrThrow();
@@ -2868,6 +2871,7 @@ var NormalComponent = class extends PrimitiveComponent {
2868
2871
  }
2869
2872
  }
2870
2873
  _doInitialSchematicComponentRenderWithSchematicBoxDimensions() {
2874
+ if (this.root?.schematicDisabled) return;
2871
2875
  const { db } = this.root;
2872
2876
  const { _parsedProps: props } = this;
2873
2877
  const dimensions = this._getSchematicBoxDimensions();
@@ -3042,6 +3046,7 @@ var NormalComponent = class extends PrimitiveComponent {
3042
3046
  return newPorts;
3043
3047
  }
3044
3048
  getPortsFromSchematicSymbol() {
3049
+ if (this.root?.schematicDisabled) return [];
3045
3050
  const { config } = this;
3046
3051
  if (!config.schematicSymbolName) return [];
3047
3052
  const symbol = symbols2[config.schematicSymbolName];
@@ -4538,6 +4543,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
4538
4543
  }
4539
4544
  }
4540
4545
  doInitialSchematicTraceRender() {
4546
+ if (this.root?.schematicDisabled) return;
4541
4547
  const { db } = this.root;
4542
4548
  const { _parsedProps: props, parent } = this;
4543
4549
  if (!parent) throw new Error("Trace has no parent");
@@ -4759,32 +4765,34 @@ var Chip = class extends NormalComponent {
4759
4765
  manufacturer_part_number: props.manufacturerPartNumber,
4760
4766
  supplier_part_numbers: props.supplierPartNumbers
4761
4767
  });
4762
- const dimensions = this._getSchematicBoxDimensions();
4763
- const hasTopOrBottomPins = props.schPortArrangement?.topSide !== void 0 || props.schPortArrangement?.bottomSide !== void 0;
4764
- const schematic_box_width = dimensions?.getSize().width;
4765
- const schematic_box_height = dimensions?.getSize().height;
4766
- const manufacturer_part_number_text = db.schematic_text.insert({
4767
- text: props.manufacturerPartNumber ?? "",
4768
- schematic_component_id: source_component.source_component_id,
4769
- anchor: "left",
4770
- rotation: 0,
4771
- position: {
4772
- x: hasTopOrBottomPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 + 0.1 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
4773
- y: hasTopOrBottomPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.35 : (props.schY ?? 0) - (schematic_box_height ?? 0) / 2 - 0.13
4774
- },
4775
- color: "#006464"
4776
- });
4777
- const component_name_text = db.schematic_text.insert({
4778
- text: props.name ?? "",
4779
- schematic_component_id: source_component.source_component_id,
4780
- anchor: "left",
4781
- rotation: 0,
4782
- position: {
4783
- x: hasTopOrBottomPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 + 0.1 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
4784
- y: hasTopOrBottomPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.55 : (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.13
4785
- },
4786
- color: "#006464"
4787
- });
4768
+ if (!this.parent?.root?.schematicDisabled) {
4769
+ const dimensions = this._getSchematicBoxDimensions();
4770
+ const hasTopOrBottomPins = props.schPortArrangement?.topSide !== void 0 || props.schPortArrangement?.bottomSide !== void 0;
4771
+ const schematic_box_width = dimensions?.getSize().width;
4772
+ const schematic_box_height = dimensions?.getSize().height;
4773
+ const manufacturer_part_number_text = db.schematic_text.insert({
4774
+ text: props.manufacturerPartNumber ?? "",
4775
+ schematic_component_id: source_component.source_component_id,
4776
+ anchor: "left",
4777
+ rotation: 0,
4778
+ position: {
4779
+ x: hasTopOrBottomPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 + 0.1 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
4780
+ y: hasTopOrBottomPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.35 : (props.schY ?? 0) - (schematic_box_height ?? 0) / 2 - 0.13
4781
+ },
4782
+ color: "#006464"
4783
+ });
4784
+ const component_name_text = db.schematic_text.insert({
4785
+ text: props.name ?? "",
4786
+ schematic_component_id: source_component.source_component_id,
4787
+ anchor: "left",
4788
+ rotation: 0,
4789
+ position: {
4790
+ x: hasTopOrBottomPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 + 0.1 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
4791
+ y: hasTopOrBottomPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.55 : (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.13
4792
+ },
4793
+ color: "#006464"
4794
+ });
4795
+ }
4788
4796
  this.source_component_id = source_component.source_component_id;
4789
4797
  }
4790
4798
  doInitialPcbComponentRender() {
@@ -5162,6 +5170,7 @@ var NetAlias = class extends PrimitiveComponent {
5162
5170
  };
5163
5171
  }
5164
5172
  doInitialSchematicComponentRender() {
5173
+ if (this.root?.schematicDisabled) return;
5165
5174
  const { db } = this.root;
5166
5175
  const { _parsedProps: props } = this;
5167
5176
  const anchorPos = { x: props.schX ?? 0, y: props.schY ?? 0 };
@@ -5426,20 +5435,22 @@ var PinHeader = class extends NormalComponent {
5426
5435
  pin_count: props.pinCount,
5427
5436
  gender: props.gender
5428
5437
  });
5429
- const dimensions = this._getSchematicBoxDimensions();
5430
- const schematic_box_width = dimensions?.getSize().width;
5431
- const schematic_box_height = dimensions?.getSize().height;
5432
- const component_name_text = db.schematic_text.insert({
5433
- text: props.name ?? "",
5434
- schematic_component_id: source_component.source_component_id,
5435
- anchor: "left",
5436
- rotation: 0,
5437
- position: {
5438
- x: (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
5439
- y: (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.13
5440
- },
5441
- color: "#006464"
5442
- });
5438
+ if (!this.parent?.root?.schematicDisabled) {
5439
+ const dimensions = this._getSchematicBoxDimensions();
5440
+ const schematic_box_width = dimensions?.getSize().width;
5441
+ const schematic_box_height = dimensions?.getSize().height;
5442
+ const component_name_text = db.schematic_text.insert({
5443
+ text: props.name ?? "",
5444
+ schematic_component_id: source_component.source_component_id,
5445
+ anchor: "left",
5446
+ rotation: 0,
5447
+ position: {
5448
+ x: (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
5449
+ y: (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.13
5450
+ },
5451
+ color: "#006464"
5452
+ });
5453
+ }
5443
5454
  this.source_component_id = source_component.source_component_id;
5444
5455
  }
5445
5456
  };
@@ -5590,6 +5601,7 @@ var Circuit = class {
5590
5601
  db;
5591
5602
  root = null;
5592
5603
  isRoot = true;
5604
+ schematicDisabled = false;
5593
5605
  _hasRenderedAtleastOnce = false;
5594
5606
  constructor() {
5595
5607
  this.children = [];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.211",
4
+ "version": "0.0.212",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",