@tscircuit/core 0.0.277 → 0.0.279

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
@@ -939,6 +939,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
939
939
  componentName: string;
940
940
  };
941
941
  doInitialSourceRender(): void;
942
+ doInitialSourceParentAttachment(): void;
942
943
  doInitialPcbComponentRender(): void;
943
944
  doInitialCreateTraceHintsFromProps(): void;
944
945
  _getSimpleRouteJsonFromPcbTraces(): SimpleRouteJson;
package/dist/index.js CHANGED
@@ -59,7 +59,7 @@ import Debug4 from "debug";
59
59
  import React from "react";
60
60
  import ReactReconciler from "react-reconciler";
61
61
  import ReactReconciler18 from "react-reconciler-18";
62
- import { DefaultEventPriority } from "react-reconciler/constants";
62
+ import { DefaultEventPriority } from "react-reconciler/constants.js";
63
63
 
64
64
  // lib/components/base-components/Renderable.ts
65
65
  import Debug from "debug";
@@ -3137,6 +3137,7 @@ var NormalComponent = class extends PrimitiveComponent {
3137
3137
  if (this.root?.pcbDisabled) return;
3138
3138
  const { db } = this.root;
3139
3139
  const { _parsedProps: props } = this;
3140
+ const subcircuit = this.getSubcircuit();
3140
3141
  const pcb_component = db.pcb_component.insert({
3141
3142
  center: this._getGlobalPcbPositionBeforeLayout(),
3142
3143
  // width/height are computed in the PcbComponentSizeCalculation phase
@@ -3144,7 +3145,8 @@ var NormalComponent = class extends PrimitiveComponent {
3144
3145
  height: 0,
3145
3146
  layer: props.layer ?? "top",
3146
3147
  rotation: props.pcbRotation ?? 0,
3147
- source_component_id: this.source_component_id
3148
+ source_component_id: this.source_component_id,
3149
+ subcircuit_id: subcircuit.subcircuit_id ?? void 0
3148
3150
  });
3149
3151
  if (!props.footprint && !this.isGroup) {
3150
3152
  const footprint_error = db.pcb_missing_footprint_error.insert({
@@ -3644,6 +3646,15 @@ var Group = class extends NormalComponent {
3644
3646
  subcircuit_id: this.subcircuit_id
3645
3647
  });
3646
3648
  }
3649
+ doInitialSourceParentAttachment() {
3650
+ const { db } = this.root;
3651
+ if (!this.isSubcircuit) return;
3652
+ const parent_subcircuit_id = this.parent?.getSubcircuit?.()?.subcircuit_id;
3653
+ if (!parent_subcircuit_id) return;
3654
+ db.source_group.update(this.source_group_id, {
3655
+ parent_subcircuit_id
3656
+ });
3657
+ }
3647
3658
  doInitialPcbComponentRender() {
3648
3659
  if (this.root?.pcbDisabled) return;
3649
3660
  const { db } = this.root;
@@ -3742,6 +3753,11 @@ var Group = class extends NormalComponent {
3742
3753
  debug4("fetching", url);
3743
3754
  return fetch(url, options);
3744
3755
  };
3756
+ const pcbAndSourceCircuitJson = this.root.db.toArray().filter(
3757
+ (element) => {
3758
+ return element.type.startsWith("source_") || element.type.startsWith("pcb_");
3759
+ }
3760
+ );
3745
3761
  if (serverMode === "solve-endpoint") {
3746
3762
  if (this.props.autorouter?.inputFormat === "simplified") {
3747
3763
  const { autorouting_result: autorouting_result2 } = await fetchWithDebug(
@@ -3763,7 +3779,8 @@ var Group = class extends NormalComponent {
3763
3779
  {
3764
3780
  method: "POST",
3765
3781
  body: JSON.stringify({
3766
- input_circuit_json: this.root.db.toArray()
3782
+ input_circuit_json: pcbAndSourceCircuitJson,
3783
+ subcircuit_id: this.subcircuit_id
3767
3784
  }),
3768
3785
  headers: { "Content-Type": "application/json" }
3769
3786
  }
@@ -3777,10 +3794,11 @@ var Group = class extends NormalComponent {
3777
3794
  {
3778
3795
  method: "POST",
3779
3796
  body: JSON.stringify({
3780
- input_circuit_json: this.root.db.toArray(),
3797
+ input_circuit_json: pcbAndSourceCircuitJson,
3781
3798
  provider: "freerouting",
3782
3799
  autostart: true,
3783
- display_name: this.root?.name
3800
+ display_name: this.root?.name,
3801
+ subcircuit_id: this.subcircuit_id
3784
3802
  }),
3785
3803
  headers: { "Content-Type": "application/json" }
3786
3804
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.277",
4
+ "version": "0.0.279",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -22,6 +22,7 @@
22
22
  "start:benchmarking": "concurrently \"bun run build:benchmarking:watch\" \"live-server ./benchmarking-dist\""
23
23
  },
24
24
  "devDependencies": {
25
+ "react-reconciler-18": "npm:react-reconciler@0.29.2",
25
26
  "@biomejs/biome": "^1.8.3",
26
27
  "@tscircuit/import-snippet": "^0.0.4",
27
28
  "@tscircuit/layout": "^0.0.28",
@@ -57,13 +58,12 @@
57
58
  "@tscircuit/props": "^0.0.130",
58
59
  "@tscircuit/schematic-autolayout": "^0.0.6",
59
60
  "@tscircuit/soup-util": "^0.0.41",
60
- "circuit-json": "^0.0.133",
61
+ "circuit-json": "^0.0.134",
61
62
  "circuit-json-to-connectivity-map": "^0.0.17",
62
63
  "format-si-unit": "^0.0.2",
63
64
  "nanoid": "^5.0.7",
64
65
  "performance-now": "^2.1.0",
65
66
  "react-reconciler": "^0.31.0",
66
- "react-reconciler-18": "npm:react-reconciler@0.29.2",
67
67
  "schematic-symbols": "^0.0.113",
68
68
  "transformation-matrix": "^2.16.1",
69
69
  "zod": "^3.23.8"