@tscircuit/core 0.0.210 → 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];
@@ -3487,13 +3492,25 @@ var Group = class extends NormalComponent {
3487
3492
  ).then((r) => r.json());
3488
3493
  while (true) {
3489
3494
  const { autorouting_job: job } = await fetchWithDebug(
3490
- `${serverUrl}/autorouting/jobs/get?autorouting_job_id=${autorouting_job.autorouting_job_id}`,
3491
- { method: "POST" }
3495
+ `${serverUrl}/autorouting/jobs/get`,
3496
+ {
3497
+ method: "POST",
3498
+ body: JSON.stringify({
3499
+ autorouting_job_id: autorouting_job.autorouting_job_id
3500
+ }),
3501
+ headers: { "Content-Type": "application/json" }
3502
+ }
3492
3503
  ).then((r) => r.json());
3493
3504
  if (job.is_finished) {
3494
3505
  const { autorouting_job_output } = await fetchWithDebug(
3495
- `${serverUrl}/autorouting/jobs/get_output?autorouting_job_id=${autorouting_job.autorouting_job_id}`,
3496
- { method: "POST" }
3506
+ `${serverUrl}/autorouting/jobs/get_output`,
3507
+ {
3508
+ method: "POST",
3509
+ body: JSON.stringify({
3510
+ autorouting_job_id: autorouting_job.autorouting_job_id
3511
+ }),
3512
+ headers: { "Content-Type": "application/json" }
3513
+ }
3497
3514
  ).then((r) => r.json());
3498
3515
  this._asyncAutoroutingResult = {
3499
3516
  output_pcb_traces: autorouting_job_output.output_pcb_traces
@@ -4526,6 +4543,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
4526
4543
  }
4527
4544
  }
4528
4545
  doInitialSchematicTraceRender() {
4546
+ if (this.root?.schematicDisabled) return;
4529
4547
  const { db } = this.root;
4530
4548
  const { _parsedProps: props, parent } = this;
4531
4549
  if (!parent) throw new Error("Trace has no parent");
@@ -4747,32 +4765,34 @@ var Chip = class extends NormalComponent {
4747
4765
  manufacturer_part_number: props.manufacturerPartNumber,
4748
4766
  supplier_part_numbers: props.supplierPartNumbers
4749
4767
  });
4750
- const dimensions = this._getSchematicBoxDimensions();
4751
- const hasTopOrBottomPins = props.schPortArrangement?.topSide !== void 0 || props.schPortArrangement?.bottomSide !== void 0;
4752
- const schematic_box_width = dimensions?.getSize().width;
4753
- const schematic_box_height = dimensions?.getSize().height;
4754
- const manufacturer_part_number_text = db.schematic_text.insert({
4755
- text: props.manufacturerPartNumber ?? "",
4756
- schematic_component_id: source_component.source_component_id,
4757
- anchor: "left",
4758
- rotation: 0,
4759
- position: {
4760
- x: hasTopOrBottomPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 + 0.1 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
4761
- y: hasTopOrBottomPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.35 : (props.schY ?? 0) - (schematic_box_height ?? 0) / 2 - 0.13
4762
- },
4763
- color: "#006464"
4764
- });
4765
- const component_name_text = db.schematic_text.insert({
4766
- text: props.name ?? "",
4767
- schematic_component_id: source_component.source_component_id,
4768
- anchor: "left",
4769
- rotation: 0,
4770
- position: {
4771
- x: hasTopOrBottomPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 + 0.1 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
4772
- y: hasTopOrBottomPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.55 : (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.13
4773
- },
4774
- color: "#006464"
4775
- });
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
+ }
4776
4796
  this.source_component_id = source_component.source_component_id;
4777
4797
  }
4778
4798
  doInitialPcbComponentRender() {
@@ -5150,6 +5170,7 @@ var NetAlias = class extends PrimitiveComponent {
5150
5170
  };
5151
5171
  }
5152
5172
  doInitialSchematicComponentRender() {
5173
+ if (this.root?.schematicDisabled) return;
5153
5174
  const { db } = this.root;
5154
5175
  const { _parsedProps: props } = this;
5155
5176
  const anchorPos = { x: props.schX ?? 0, y: props.schY ?? 0 };
@@ -5414,20 +5435,22 @@ var PinHeader = class extends NormalComponent {
5414
5435
  pin_count: props.pinCount,
5415
5436
  gender: props.gender
5416
5437
  });
5417
- const dimensions = this._getSchematicBoxDimensions();
5418
- const schematic_box_width = dimensions?.getSize().width;
5419
- const schematic_box_height = dimensions?.getSize().height;
5420
- const component_name_text = db.schematic_text.insert({
5421
- text: props.name ?? "",
5422
- schematic_component_id: source_component.source_component_id,
5423
- anchor: "left",
5424
- rotation: 0,
5425
- position: {
5426
- x: (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
5427
- y: (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.13
5428
- },
5429
- color: "#006464"
5430
- });
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
+ }
5431
5454
  this.source_component_id = source_component.source_component_id;
5432
5455
  }
5433
5456
  };
@@ -5578,6 +5601,7 @@ var Circuit = class {
5578
5601
  db;
5579
5602
  root = null;
5580
5603
  isRoot = true;
5604
+ schematicDisabled = false;
5581
5605
  _hasRenderedAtleastOnce = false;
5582
5606
  constructor() {
5583
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.210",
4
+ "version": "0.0.212",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",