@tscircuit/core 0.0.691 → 0.0.693

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 +57 -44
  2. package/package.json +5 -4
package/dist/index.js CHANGED
@@ -7627,7 +7627,7 @@ var CapacityMeshAutorouter = class {
7627
7627
 
7628
7628
  // lib/components/primitive-components/Group/Group.ts
7629
7629
  import "circuit-json";
7630
- import Debug10 from "debug";
7630
+ import Debug11 from "debug";
7631
7631
  import "zod";
7632
7632
 
7633
7633
  // lib/components/primitive-components/TraceHint.ts
@@ -8407,10 +8407,10 @@ function facingDirectionToSide(facingDirection) {
8407
8407
  }
8408
8408
  function rotateDirection(direction, degrees) {
8409
8409
  const directions = [
8410
- "up",
8411
8410
  "right",
8412
- "down",
8413
- "left"
8411
+ "up",
8412
+ "left",
8413
+ "down"
8414
8414
  ];
8415
8415
  const currentIndex = directions.indexOf(direction);
8416
8416
  if (currentIndex === -1) return direction;
@@ -9893,7 +9893,7 @@ import { convertSrjToGraphicsObject } from "@tscircuit/capacity-autorouter";
9893
9893
 
9894
9894
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/Group_doInitialSchematicTraceRender.ts
9895
9895
  import { SchematicTracePipelineSolver as SchematicTracePipelineSolver4 } from "@tscircuit/schematic-trace-solver";
9896
- import Debug9 from "debug";
9896
+ import Debug10 from "debug";
9897
9897
 
9898
9898
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/createSchematicTraceSolverInputProblem.ts
9899
9899
  import "@tscircuit/schematic-trace-solver";
@@ -9906,9 +9906,6 @@ function createSchematicTraceSolverInputProblem(group) {
9906
9906
  const displayLabelTraces = traces.filter(
9907
9907
  (t) => t._parsedProps?.schDisplayLabel
9908
9908
  );
9909
- const displayLabelSourceTraceIds = new Set(
9910
- displayLabelTraces.map((t) => t.source_trace_id).filter((id) => Boolean(id))
9911
- );
9912
9909
  const childGroups = group.selectAll("group");
9913
9910
  const allSchematicGroupIds = [
9914
9911
  group.schematic_group_id,
@@ -10409,14 +10406,24 @@ function computeJunctions(traces, opts = {}) {
10409
10406
  }
10410
10407
 
10411
10408
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/applyTracesFromSolverOutput.ts
10409
+ import Debug8 from "debug";
10410
+ var debug7 = Debug8("Group_doInitialSchematicTraceRender");
10412
10411
  function applyTracesFromSolverOutput(args) {
10413
10412
  const { group, solver, pinIdToSchematicPortId, userNetIdToSck } = args;
10414
10413
  const { db } = group.root;
10415
10414
  const correctedMap = solver.traceOverlapShiftSolver?.correctedTraceMap;
10416
10415
  const pendingTraces = [];
10416
+ debug7(
10417
+ `Traces inside SchematicTraceSolver output: ${Object.values(correctedMap ?? {}).length}`
10418
+ );
10417
10419
  for (const solvedTracePath of Object.values(correctedMap ?? {})) {
10418
10420
  const points = solvedTracePath?.tracePath;
10419
- if (!Array.isArray(points) || points.length < 2) continue;
10421
+ if (!Array.isArray(points) || points.length < 2) {
10422
+ debug7(
10423
+ `Skipping trace ${solvedTracePath?.pinIds.join(",")} because it has less than 2 points`
10424
+ );
10425
+ continue;
10426
+ }
10420
10427
  const edges = [];
10421
10428
  for (let i = 0; i < points.length - 1; i++) {
10422
10429
  edges.push({
@@ -10451,6 +10458,9 @@ function applyTracesFromSolverOutput(args) {
10451
10458
  subcircuit_connectivity_map_key
10452
10459
  });
10453
10460
  }
10461
+ debug7(
10462
+ `Applying ${pendingTraces.length} traces from SchematicTraceSolver output`
10463
+ );
10454
10464
  const withCrossings = computeCrossings(
10455
10465
  pendingTraces.map((t) => ({
10456
10466
  source_trace_id: t.source_trace_id,
@@ -10511,8 +10521,8 @@ var getNetNameFromPorts = (ports) => {
10511
10521
  };
10512
10522
 
10513
10523
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/applyNetLabelPlacements.ts
10514
- import Debug8 from "debug";
10515
- var debug7 = Debug8("Group_doInitialSchematicTraceRender");
10524
+ import Debug9 from "debug";
10525
+ var debug8 = Debug9("Group_doInitialSchematicTraceRender");
10516
10526
  function applyNetLabelPlacements(args) {
10517
10527
  const {
10518
10528
  group,
@@ -10530,7 +10540,7 @@ function applyNetLabelPlacements(args) {
10530
10540
  const netLabelPlacements = solver.netLabelPlacementSolver?.netLabelPlacements ?? [];
10531
10541
  const globalConnMap = solver.mspConnectionPairSolver.globalConnMap;
10532
10542
  for (const placement of netLabelPlacements) {
10533
- debug7(`processing placement: ${placement.netId}`);
10543
+ debug8(`processing placement: ${placement.netId}`);
10534
10544
  const placementUserNetId = globalConnMap.getIdsConnectedToNet(placement.globalConnNetId).find((id) => userNetIdToSck.get(id));
10535
10545
  const placementSck = userNetIdToSck.get(placementUserNetId);
10536
10546
  const anchor_position = placement.anchorPoint;
@@ -10543,7 +10553,7 @@ function applyNetLabelPlacements(args) {
10543
10553
  if (schPortIds.some(
10544
10554
  (schPortId) => schematicPortIdsWithPreExistingNetLabels.has(schPortId)
10545
10555
  )) {
10546
- debug7(
10556
+ debug8(
10547
10557
  `skipping net label placement for "${placement.netId}" REASON:schematic port has pre-existing net label`
10548
10558
  );
10549
10559
  continue;
@@ -10569,7 +10579,7 @@ function applyNetLabelPlacements(args) {
10569
10579
  if (!wasAssignedDisplayLabel && schPortIds.some(
10570
10580
  (schPortId) => schematicPortIdsWithRoutedTraces.has(schPortId)
10571
10581
  )) {
10572
- debug7(
10582
+ debug8(
10573
10583
  `skipping net label placement for "${placement.netId}" REASON:schematic port has routed traces and no display label`
10574
10584
  );
10575
10585
  continue;
@@ -10604,9 +10614,9 @@ var insertNetLabelsForPortsMissingTrace = ({
10604
10614
  for (const schOrSrcPortId of Array.from(
10605
10615
  allSourceAndSchematicPortIdsInScope
10606
10616
  )) {
10607
- const sp = db.schematic_port.get(schOrSrcPortId);
10608
- if (!sp) continue;
10609
- if (sp.is_connected) continue;
10617
+ const schPort = db.schematic_port.get(schOrSrcPortId);
10618
+ if (!schPort) continue;
10619
+ if (schPort.is_connected) continue;
10610
10620
  const srcPortId = schPortIdToSourcePortId.get(schOrSrcPortId);
10611
10621
  if (!srcPortId) continue;
10612
10622
  const sourcePort = db.source_port.get(srcPortId);
@@ -10617,7 +10627,7 @@ var insertNetLabelsForPortsMissingTrace = ({
10617
10627
  continue;
10618
10628
  }
10619
10629
  const existingAtPort = db.schematic_net_label.list().some((nl) => {
10620
- const samePos = Math.abs(nl.anchor_position.x - sp.center.x) < 0.1 && Math.abs(nl.anchor_position.y - sp.center.y) < 0.1;
10630
+ const samePos = Math.abs(nl.anchor_position.x - schPort.center.x) < 0.1 && Math.abs(nl.anchor_position.y - schPort.center.y) < 0.1;
10621
10631
  if (!samePos) return false;
10622
10632
  if (sourceNet.source_net_id && nl.source_net_id) {
10623
10633
  return nl.source_net_id === sourceNet.source_net_id;
@@ -10626,15 +10636,17 @@ var insertNetLabelsForPortsMissingTrace = ({
10626
10636
  });
10627
10637
  if (existingAtPort) continue;
10628
10638
  const text = sourceNet.name || sourceNet.source_net_id || key;
10629
- const side = getEnteringEdgeFromDirection(sp.facing_direction || "right") || "right";
10639
+ const side = getEnteringEdgeFromDirection(
10640
+ schPort.facing_direction || "right"
10641
+ ) || "right";
10630
10642
  const center = computeSchematicNetLabelCenter({
10631
- anchor_position: sp.center,
10643
+ anchor_position: schPort.center,
10632
10644
  anchor_side: side,
10633
10645
  text
10634
10646
  });
10635
10647
  db.schematic_net_label.insert({
10636
10648
  text,
10637
- anchor_position: sp.center,
10649
+ anchor_position: schPort.center,
10638
10650
  center,
10639
10651
  anchor_side: side,
10640
10652
  ...sourceNet.source_net_id ? { source_net_id: sourceNet.source_net_id } : {}
@@ -10675,7 +10687,7 @@ var getSchematicPortIdsWithRoutedTraces = ({
10675
10687
  };
10676
10688
 
10677
10689
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/Group_doInitialSchematicTraceRender.ts
10678
- var debug8 = Debug9("Group_doInitialSchematicTraceRender");
10690
+ var debug9 = Debug10("Group_doInitialSchematicTraceRender");
10679
10691
  var Group_doInitialSchematicTraceRender = (group) => {
10680
10692
  if (!group.root?._featureMspSchematicTraceRouting) return;
10681
10693
  if (!group.isSubcircuit) return;
@@ -10692,7 +10704,7 @@ var Group_doInitialSchematicTraceRender = (group) => {
10692
10704
  userNetIdToSck
10693
10705
  } = createSchematicTraceSolverInputProblem(group);
10694
10706
  const schematicPortIdsWithPreExistingNetLabels = getSchematicPortIdsWithAssignedNetLabels(group);
10695
- if (debug8.enabled) {
10707
+ if (debug9.enabled) {
10696
10708
  globalThis.debugOutputs?.add(
10697
10709
  "group-trace-render-input-problem",
10698
10710
  JSON.stringify(inputProblem, null, 2)
@@ -10897,20 +10909,20 @@ var Group6 = class extends NormalComponent2 {
10897
10909
  return false;
10898
10910
  }
10899
10911
  _hasTracesToRoute() {
10900
- const debug9 = Debug10("tscircuit:core:_hasTracesToRoute");
10912
+ const debug10 = Debug11("tscircuit:core:_hasTracesToRoute");
10901
10913
  const traces = this.selectAll("trace");
10902
- debug9(`[${this.getString()}] has ${traces.length} traces to route`);
10914
+ debug10(`[${this.getString()}] has ${traces.length} traces to route`);
10903
10915
  return traces.length > 0;
10904
10916
  }
10905
10917
  async _runEffectMakeHttpAutoroutingRequest() {
10906
10918
  const { db } = this.root;
10907
- const debug9 = Debug10("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
10919
+ const debug10 = Debug11("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
10908
10920
  const props = this._parsedProps;
10909
10921
  const autorouterConfig = this._getAutorouterConfig();
10910
10922
  const serverUrl = autorouterConfig.serverUrl;
10911
10923
  const serverMode = autorouterConfig.serverMode;
10912
10924
  const fetchWithDebug = (url, options) => {
10913
- debug9("fetching", url);
10925
+ debug10("fetching", url);
10914
10926
  if (options.headers) {
10915
10927
  options.headers["Tscircuit-Core-Version"] = this.root?.getCoreVersion();
10916
10928
  }
@@ -11026,15 +11038,15 @@ var Group6 = class extends NormalComponent2 {
11026
11038
  async _runLocalAutorouting() {
11027
11039
  const { db } = this.root;
11028
11040
  const props = this._parsedProps;
11029
- const debug9 = Debug10("tscircuit:core:_runLocalAutorouting");
11030
- debug9(`[${this.getString()}] starting local autorouting`);
11041
+ const debug10 = Debug11("tscircuit:core:_runLocalAutorouting");
11042
+ debug10(`[${this.getString()}] starting local autorouting`);
11031
11043
  const autorouterConfig = this._getAutorouterConfig();
11032
11044
  const { simpleRouteJson } = getSimpleRouteJsonFromCircuitJson({
11033
11045
  db,
11034
11046
  minTraceWidth: this.props.autorouter?.minTraceWidth ?? 0.15,
11035
11047
  subcircuit_id: this.subcircuit_id
11036
11048
  });
11037
- if (debug9.enabled) {
11049
+ if (debug10.enabled) {
11038
11050
  const graphicsObject = convertSrjToGraphicsObject(
11039
11051
  simpleRouteJson
11040
11052
  );
@@ -11059,11 +11071,11 @@ var Group6 = class extends NormalComponent2 {
11059
11071
  const routingPromise = new Promise(
11060
11072
  (resolve, reject) => {
11061
11073
  autorouter.on("complete", (event) => {
11062
- debug9(`[${this.getString()}] local autorouting complete`);
11074
+ debug10(`[${this.getString()}] local autorouting complete`);
11063
11075
  resolve(event.traces);
11064
11076
  });
11065
11077
  autorouter.on("error", (event) => {
11066
- debug9(
11078
+ debug10(
11067
11079
  `[${this.getString()}] local autorouting error: ${event.error.message}`
11068
11080
  );
11069
11081
  reject(event.error);
@@ -11120,18 +11132,18 @@ var Group6 = class extends NormalComponent2 {
11120
11132
  }
11121
11133
  }
11122
11134
  doInitialPcbTraceRender() {
11123
- const debug9 = Debug10("tscircuit:core:doInitialPcbTraceRender");
11135
+ const debug10 = Debug11("tscircuit:core:doInitialPcbTraceRender");
11124
11136
  if (!this.isSubcircuit) return;
11125
11137
  if (this.root?.pcbDisabled) return;
11126
11138
  if (this.getInheritedProperty("routingDisabled")) return;
11127
11139
  if (this._shouldUseTraceByTraceRouting()) return;
11128
11140
  if (!this._areChildSubcircuitsRouted()) {
11129
- debug9(
11141
+ debug10(
11130
11142
  `[${this.getString()}] child subcircuits are not routed, skipping async autorouting until subcircuits routed`
11131
11143
  );
11132
11144
  return;
11133
11145
  }
11134
- debug9(
11146
+ debug10(
11135
11147
  `[${this.getString()}] no child subcircuits to wait for, initiating async routing`
11136
11148
  );
11137
11149
  if (!this._hasTracesToRoute()) return;
@@ -11141,12 +11153,12 @@ var Group6 = class extends NormalComponent2 {
11141
11153
  Group_doInitialSchematicTraceRender(this);
11142
11154
  }
11143
11155
  updatePcbTraceRender() {
11144
- const debug9 = Debug10("tscircuit:core:updatePcbTraceRender");
11145
- debug9(`[${this.getString()}] updating...`);
11156
+ const debug10 = Debug11("tscircuit:core:updatePcbTraceRender");
11157
+ debug10(`[${this.getString()}] updating...`);
11146
11158
  if (!this.isSubcircuit) return;
11147
11159
  if (this._shouldRouteAsync() && this._hasTracesToRoute() && !this._hasStartedAsyncAutorouting) {
11148
11160
  if (this._areChildSubcircuitsRouted()) {
11149
- debug9(
11161
+ debug10(
11150
11162
  `[${this.getString()}] child subcircuits are now routed, starting async autorouting`
11151
11163
  );
11152
11164
  this._startAsyncAutorouting();
@@ -11157,14 +11169,14 @@ var Group6 = class extends NormalComponent2 {
11157
11169
  if (this._shouldUseTraceByTraceRouting()) return;
11158
11170
  const { db } = this.root;
11159
11171
  if (this._asyncAutoroutingResult.output_simple_route_json) {
11160
- debug9(
11172
+ debug10(
11161
11173
  `[${this.getString()}] updating PCB traces from simple route json (${this._asyncAutoroutingResult.output_simple_route_json.traces?.length} traces)`
11162
11174
  );
11163
11175
  this._updatePcbTraceRenderFromSimpleRouteJson();
11164
11176
  return;
11165
11177
  }
11166
11178
  if (this._asyncAutoroutingResult.output_pcb_traces) {
11167
- debug9(
11179
+ debug10(
11168
11180
  `[${this.getString()}] updating PCB traces from ${this._asyncAutoroutingResult.output_pcb_traces.length} traces`
11169
11181
  );
11170
11182
  this._updatePcbTraceRenderFromPcbTraces();
@@ -14172,7 +14184,7 @@ import { identity as identity6 } from "transformation-matrix";
14172
14184
  var package_default = {
14173
14185
  name: "@tscircuit/core",
14174
14186
  type: "module",
14175
- version: "0.0.690",
14187
+ version: "0.0.692",
14176
14188
  types: "dist/index.d.ts",
14177
14189
  main: "dist/index.js",
14178
14190
  module: "dist/index.js",
@@ -14209,12 +14221,12 @@ var package_default = {
14209
14221
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
14210
14222
  "@tscircuit/log-soup": "^1.0.2",
14211
14223
  "@tscircuit/matchpack": "^0.0.16",
14212
- "@tscircuit/math-utils": "^0.0.18",
14224
+ "@tscircuit/math-utils": "^0.0.19",
14213
14225
  "@tscircuit/miniflex": "^0.0.4",
14214
14226
  "@tscircuit/props": "0.0.298",
14215
14227
  "@tscircuit/schematic-autolayout": "^0.0.6",
14216
14228
  "@tscircuit/schematic-match-adapt": "^0.0.16",
14217
- "@tscircuit/schematic-trace-solver": "^0.0.25",
14229
+ "@tscircuit/schematic-trace-solver": "^0.0.33",
14218
14230
  "@tscircuit/simple-3d-svg": "^0.0.38",
14219
14231
  "@types/bun": "^1.2.16",
14220
14232
  "@types/debug": "^4.1.12",
@@ -14223,7 +14235,7 @@ var package_default = {
14223
14235
  "@types/react-reconciler": "^0.28.9",
14224
14236
  "bpc-graph": "^0.0.57",
14225
14237
  "bun-match-svg": "0.0.12",
14226
- "calculate-elbow": "^0.0.9",
14238
+ "calculate-elbow": "^0.0.11",
14227
14239
  "chokidar-cli": "^3.0.0",
14228
14240
  "circuit-json": "^0.0.242",
14229
14241
  "circuit-json-to-bpc": "^0.0.13",
@@ -14233,6 +14245,7 @@ var package_default = {
14233
14245
  concurrently: "^9.1.2",
14234
14246
  "connectivity-map": "^1.0.0",
14235
14247
  debug: "^4.3.6",
14248
+ flatbush: "^4.5.0",
14236
14249
  "graphics-debug": "^0.0.60",
14237
14250
  howfat: "^0.3.8",
14238
14251
  "live-server": "^1.2.2",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.691",
4
+ "version": "0.0.693",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -38,12 +38,12 @@
38
38
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
39
39
  "@tscircuit/log-soup": "^1.0.2",
40
40
  "@tscircuit/matchpack": "^0.0.16",
41
- "@tscircuit/math-utils": "^0.0.18",
41
+ "@tscircuit/math-utils": "^0.0.19",
42
42
  "@tscircuit/miniflex": "^0.0.4",
43
43
  "@tscircuit/props": "0.0.298",
44
44
  "@tscircuit/schematic-autolayout": "^0.0.6",
45
45
  "@tscircuit/schematic-match-adapt": "^0.0.16",
46
- "@tscircuit/schematic-trace-solver": "^0.0.25",
46
+ "@tscircuit/schematic-trace-solver": "^0.0.33",
47
47
  "@tscircuit/simple-3d-svg": "^0.0.38",
48
48
  "@types/bun": "^1.2.16",
49
49
  "@types/debug": "^4.1.12",
@@ -52,7 +52,7 @@
52
52
  "@types/react-reconciler": "^0.28.9",
53
53
  "bpc-graph": "^0.0.57",
54
54
  "bun-match-svg": "0.0.12",
55
- "calculate-elbow": "^0.0.9",
55
+ "calculate-elbow": "^0.0.11",
56
56
  "chokidar-cli": "^3.0.0",
57
57
  "circuit-json": "^0.0.242",
58
58
  "circuit-json-to-bpc": "^0.0.13",
@@ -62,6 +62,7 @@
62
62
  "concurrently": "^9.1.2",
63
63
  "connectivity-map": "^1.0.0",
64
64
  "debug": "^4.3.6",
65
+ "flatbush": "^4.5.0",
65
66
  "graphics-debug": "^0.0.60",
66
67
  "howfat": "^0.3.8",
67
68
  "live-server": "^1.2.2",