@tscircuit/core 0.0.653 → 0.0.655

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.
Files changed (2) hide show
  1. package/dist/index.js +47 -30
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -7211,7 +7211,7 @@ var CapacityMeshAutorouter = class {
7211
7211
 
7212
7212
  // lib/components/primitive-components/Group/Group.ts
7213
7213
  import "circuit-json";
7214
- import Debug9 from "debug";
7214
+ import Debug10 from "debug";
7215
7215
  import "zod";
7216
7216
 
7217
7217
  // lib/components/primitive-components/TraceHint.ts
@@ -9489,7 +9489,7 @@ import { convertSrjToGraphicsObject } from "@tscircuit/capacity-autorouter";
9489
9489
 
9490
9490
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/Group_doInitialSchematicTraceRender.ts
9491
9491
  import { SchematicTracePipelineSolver as SchematicTracePipelineSolver4 } from "@tscircuit/schematic-trace-solver";
9492
- import Debug8 from "debug";
9492
+ import Debug9 from "debug";
9493
9493
 
9494
9494
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/createSchematicTraceSolverInputProblem.ts
9495
9495
  import "@tscircuit/schematic-trace-solver";
@@ -9568,7 +9568,6 @@ function createSchematicTraceSolverInputProblem(group) {
9568
9568
  const directConnections = [];
9569
9569
  const pairKeyToSourceTraceId = /* @__PURE__ */ new Map();
9570
9570
  for (const st of db.source_trace.list()) {
9571
- if (displayLabelSourceTraceIds.has(st.source_trace_id)) continue;
9572
9571
  if (st.subcircuit_id && !allowedSubcircuitIds.has(st.subcircuit_id)) {
9573
9572
  continue;
9574
9573
  }
@@ -9633,7 +9632,7 @@ function createSchematicTraceSolverInputProblem(group) {
9633
9632
  )) {
9634
9633
  if (!net.name) continue;
9635
9634
  if (!presentNetIds.has(net.name)) continue;
9636
- if (net.name === "GND") {
9635
+ if (net.is_ground || net.name.startsWith("GND")) {
9637
9636
  netToAllowedOrientations[net.name] = ["y-"];
9638
9637
  } else if (/^V/.test(net.name)) {
9639
9638
  netToAllowedOrientations[net.name] = ["y+"];
@@ -10056,11 +10055,22 @@ var oppositeSide = (input) => {
10056
10055
 
10057
10056
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/getNetNameFromPorts.ts
10058
10057
  var getNetNameFromPorts = (ports) => {
10058
+ for (const port of ports) {
10059
+ const traces = port._getDirectlyConnectedTraces();
10060
+ for (const trace of traces) {
10061
+ const displayLabel = trace._parsedProps.schDisplayLabel;
10062
+ if (displayLabel) {
10063
+ return { name: displayLabel, wasAssignedDisplayLabel: true };
10064
+ }
10065
+ }
10066
+ }
10059
10067
  const netName = ports.map((p) => p._getNetLabelText()).join("/");
10060
- return netName;
10068
+ return { name: netName, wasAssignedDisplayLabel: false };
10061
10069
  };
10062
10070
 
10063
10071
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/applyNetLabelPlacements.ts
10072
+ import Debug8 from "debug";
10073
+ var debug7 = Debug8("Group_doInitialSchematicTraceRender");
10064
10074
  function applyNetLabelPlacements(args) {
10065
10075
  const {
10066
10076
  group,
@@ -10078,6 +10088,7 @@ function applyNetLabelPlacements(args) {
10078
10088
  const netLabelPlacements = solver.netLabelPlacementSolver?.netLabelPlacements ?? [];
10079
10089
  const globalConnMap = solver.mspConnectionPairSolver.globalConnMap;
10080
10090
  for (const placement of netLabelPlacements) {
10091
+ debug7(`processing placement: ${placement.netId}`);
10081
10092
  const placementUserNetId = globalConnMap.getIdsConnectedToNet(placement.globalConnNetId).find((id) => userNetIdToSck.get(id));
10082
10093
  const placementSck = userNetIdToSck.get(placementUserNetId);
10083
10094
  const anchor_position = placement.anchorPoint;
@@ -10090,6 +10101,9 @@ function applyNetLabelPlacements(args) {
10090
10101
  if (schPortIds.some(
10091
10102
  (schPortId) => schematicPortIdsWithPreExistingNetLabels.has(schPortId)
10092
10103
  )) {
10104
+ debug7(
10105
+ `skipping net label placement for "${placement.netId}" REASON:schematic port has pre-existing net label`
10106
+ );
10093
10107
  continue;
10094
10108
  }
10095
10109
  if (sourceNet) {
@@ -10106,15 +10120,18 @@ function applyNetLabelPlacements(args) {
10106
10120
  anchor_side,
10107
10121
  ...sourceNet?.source_net_id ? { source_net_id: sourceNet.source_net_id } : {}
10108
10122
  });
10109
- return;
10123
+ continue;
10110
10124
  }
10111
- if (schPortIds.some(
10125
+ const ports = group.selectAll("port").filter((p) => p._getSubcircuitConnectivityKey() === placementSck);
10126
+ const { name: text, wasAssignedDisplayLabel } = getNetNameFromPorts(ports);
10127
+ if (!wasAssignedDisplayLabel && schPortIds.some(
10112
10128
  (schPortId) => schematicPortIdsWithRoutedTraces.has(schPortId)
10113
10129
  )) {
10130
+ debug7(
10131
+ `skipping net label placement for "${placement.netId}" REASON:schematic port has routed traces and no display label`
10132
+ );
10114
10133
  continue;
10115
10134
  }
10116
- const ports = group.selectAll("port").filter((p) => p._getSubcircuitConnectivityKey() === placementSck);
10117
- const text = getNetNameFromPorts(ports);
10118
10135
  const center = computeSchematicNetLabelCenter({
10119
10136
  anchor_position,
10120
10137
  anchor_side,
@@ -10216,7 +10233,7 @@ var getSchematicPortIdsWithRoutedTraces = ({
10216
10233
  };
10217
10234
 
10218
10235
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/Group_doInitialSchematicTraceRender.ts
10219
- var debug7 = Debug8("Group_doInitialSchematicTraceRender");
10236
+ var debug8 = Debug9("Group_doInitialSchematicTraceRender");
10220
10237
  var Group_doInitialSchematicTraceRender = (group) => {
10221
10238
  if (!group.root?._featureMspSchematicTraceRouting) return;
10222
10239
  if (!group.isSubcircuit) return;
@@ -10233,7 +10250,7 @@ var Group_doInitialSchematicTraceRender = (group) => {
10233
10250
  userNetIdToSck
10234
10251
  } = createSchematicTraceSolverInputProblem(group);
10235
10252
  const schematicPortIdsWithPreExistingNetLabels = getSchematicPortIdsWithAssignedNetLabels(group);
10236
- if (debug7.enabled) {
10253
+ if (debug8.enabled) {
10237
10254
  globalThis.debugOutputs?.add(
10238
10255
  "group-trace-render-input-problem",
10239
10256
  JSON.stringify(inputProblem, null, 2)
@@ -10438,20 +10455,20 @@ var Group6 = class extends NormalComponent {
10438
10455
  return false;
10439
10456
  }
10440
10457
  _hasTracesToRoute() {
10441
- const debug8 = Debug9("tscircuit:core:_hasTracesToRoute");
10458
+ const debug9 = Debug10("tscircuit:core:_hasTracesToRoute");
10442
10459
  const traces = this.selectAll("trace");
10443
- debug8(`[${this.getString()}] has ${traces.length} traces to route`);
10460
+ debug9(`[${this.getString()}] has ${traces.length} traces to route`);
10444
10461
  return traces.length > 0;
10445
10462
  }
10446
10463
  async _runEffectMakeHttpAutoroutingRequest() {
10447
10464
  const { db } = this.root;
10448
- const debug8 = Debug9("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
10465
+ const debug9 = Debug10("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
10449
10466
  const props = this._parsedProps;
10450
10467
  const autorouterConfig = this._getAutorouterConfig();
10451
10468
  const serverUrl = autorouterConfig.serverUrl;
10452
10469
  const serverMode = autorouterConfig.serverMode;
10453
10470
  const fetchWithDebug = (url, options) => {
10454
- debug8("fetching", url);
10471
+ debug9("fetching", url);
10455
10472
  if (options.headers) {
10456
10473
  options.headers["Tscircuit-Core-Version"] = this.root?.getCoreVersion();
10457
10474
  }
@@ -10567,15 +10584,15 @@ var Group6 = class extends NormalComponent {
10567
10584
  async _runLocalAutorouting() {
10568
10585
  const { db } = this.root;
10569
10586
  const props = this._parsedProps;
10570
- const debug8 = Debug9("tscircuit:core:_runLocalAutorouting");
10571
- debug8(`[${this.getString()}] starting local autorouting`);
10587
+ const debug9 = Debug10("tscircuit:core:_runLocalAutorouting");
10588
+ debug9(`[${this.getString()}] starting local autorouting`);
10572
10589
  const autorouterConfig = this._getAutorouterConfig();
10573
10590
  const { simpleRouteJson } = getSimpleRouteJsonFromCircuitJson({
10574
10591
  db,
10575
10592
  minTraceWidth: this.props.autorouter?.minTraceWidth ?? 0.15,
10576
10593
  subcircuit_id: this.subcircuit_id
10577
10594
  });
10578
- if (debug8.enabled) {
10595
+ if (debug9.enabled) {
10579
10596
  const graphicsObject = convertSrjToGraphicsObject(
10580
10597
  simpleRouteJson
10581
10598
  );
@@ -10600,11 +10617,11 @@ var Group6 = class extends NormalComponent {
10600
10617
  const routingPromise = new Promise(
10601
10618
  (resolve, reject) => {
10602
10619
  autorouter.on("complete", (event) => {
10603
- debug8(`[${this.getString()}] local autorouting complete`);
10620
+ debug9(`[${this.getString()}] local autorouting complete`);
10604
10621
  resolve(event.traces);
10605
10622
  });
10606
10623
  autorouter.on("error", (event) => {
10607
- debug8(
10624
+ debug9(
10608
10625
  `[${this.getString()}] local autorouting error: ${event.error.message}`
10609
10626
  );
10610
10627
  reject(event.error);
@@ -10661,18 +10678,18 @@ var Group6 = class extends NormalComponent {
10661
10678
  }
10662
10679
  }
10663
10680
  doInitialPcbTraceRender() {
10664
- const debug8 = Debug9("tscircuit:core:doInitialPcbTraceRender");
10681
+ const debug9 = Debug10("tscircuit:core:doInitialPcbTraceRender");
10665
10682
  if (!this.isSubcircuit) return;
10666
10683
  if (this.root?.pcbDisabled) return;
10667
10684
  if (this.getInheritedProperty("routingDisabled")) return;
10668
10685
  if (this._shouldUseTraceByTraceRouting()) return;
10669
10686
  if (!this._areChildSubcircuitsRouted()) {
10670
- debug8(
10687
+ debug9(
10671
10688
  `[${this.getString()}] child subcircuits are not routed, skipping async autorouting until subcircuits routed`
10672
10689
  );
10673
10690
  return;
10674
10691
  }
10675
- debug8(
10692
+ debug9(
10676
10693
  `[${this.getString()}] no child subcircuits to wait for, initiating async routing`
10677
10694
  );
10678
10695
  if (!this._hasTracesToRoute()) return;
@@ -10682,12 +10699,12 @@ var Group6 = class extends NormalComponent {
10682
10699
  Group_doInitialSchematicTraceRender(this);
10683
10700
  }
10684
10701
  updatePcbTraceRender() {
10685
- const debug8 = Debug9("tscircuit:core:updatePcbTraceRender");
10686
- debug8(`[${this.getString()}] updating...`);
10702
+ const debug9 = Debug10("tscircuit:core:updatePcbTraceRender");
10703
+ debug9(`[${this.getString()}] updating...`);
10687
10704
  if (!this.isSubcircuit) return;
10688
10705
  if (this._shouldRouteAsync() && this._hasTracesToRoute() && !this._hasStartedAsyncAutorouting) {
10689
10706
  if (this._areChildSubcircuitsRouted()) {
10690
- debug8(
10707
+ debug9(
10691
10708
  `[${this.getString()}] child subcircuits are now routed, starting async autorouting`
10692
10709
  );
10693
10710
  this._startAsyncAutorouting();
@@ -10698,14 +10715,14 @@ var Group6 = class extends NormalComponent {
10698
10715
  if (this._shouldUseTraceByTraceRouting()) return;
10699
10716
  const { db } = this.root;
10700
10717
  if (this._asyncAutoroutingResult.output_simple_route_json) {
10701
- debug8(
10718
+ debug9(
10702
10719
  `[${this.getString()}] updating PCB traces from simple route json (${this._asyncAutoroutingResult.output_simple_route_json.traces?.length} traces)`
10703
10720
  );
10704
10721
  this._updatePcbTraceRenderFromSimpleRouteJson();
10705
10722
  return;
10706
10723
  }
10707
10724
  if (this._asyncAutoroutingResult.output_pcb_traces) {
10708
- debug8(
10725
+ debug9(
10709
10726
  `[${this.getString()}] updating PCB traces from ${this._asyncAutoroutingResult.output_pcb_traces.length} traces`
10710
10727
  );
10711
10728
  this._updatePcbTraceRenderFromPcbTraces();
@@ -13712,7 +13729,7 @@ import { identity as identity5 } from "transformation-matrix";
13712
13729
  var package_default = {
13713
13730
  name: "@tscircuit/core",
13714
13731
  type: "module",
13715
- version: "0.0.652",
13732
+ version: "0.0.654",
13716
13733
  types: "dist/index.d.ts",
13717
13734
  main: "dist/index.js",
13718
13735
  module: "dist/index.js",
@@ -13754,7 +13771,7 @@ var package_default = {
13754
13771
  "@tscircuit/props": "^0.0.287",
13755
13772
  "@tscircuit/schematic-autolayout": "^0.0.6",
13756
13773
  "@tscircuit/schematic-match-adapt": "^0.0.16",
13757
- "@tscircuit/schematic-trace-solver": "^0.0.17",
13774
+ "@tscircuit/schematic-trace-solver": "^0.0.22",
13758
13775
  "@tscircuit/simple-3d-svg": "^0.0.38",
13759
13776
  "@types/bun": "^1.2.16",
13760
13777
  "@types/debug": "^4.1.12",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.653",
4
+ "version": "0.0.655",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -43,7 +43,7 @@
43
43
  "@tscircuit/props": "^0.0.287",
44
44
  "@tscircuit/schematic-autolayout": "^0.0.6",
45
45
  "@tscircuit/schematic-match-adapt": "^0.0.16",
46
- "@tscircuit/schematic-trace-solver": "^0.0.17",
46
+ "@tscircuit/schematic-trace-solver": "^0.0.22",
47
47
  "@tscircuit/simple-3d-svg": "^0.0.38",
48
48
  "@types/bun": "^1.2.16",
49
49
  "@types/debug": "^4.1.12",