@tscircuit/schematic-trace-solver 0.0.156 → 0.0.157

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
@@ -191,6 +191,7 @@ type MspConnectionPair = {
191
191
  declare class MspConnectionPairSolver extends BaseSolver {
192
192
  inputProblem: InputProblem;
193
193
  mspConnectionPairs: MspConnectionPair[];
194
+ mspConnectionPairIds: Set<string>;
194
195
  dcConnMap: ConnectivityMap;
195
196
  globalConnMap: ConnectivityMap;
196
197
  queuedDcNetIds: string[];
@@ -205,6 +206,7 @@ declare class MspConnectionPairSolver extends BaseSolver {
205
206
  inputProblem: InputProblem;
206
207
  });
207
208
  getConstructorParams(): ConstructorParameters<typeof MspConnectionPairSolver>[0];
209
+ private addMspConnectionPair;
208
210
  _step(): void;
209
211
  visualize(): GraphicsObject;
210
212
  }
package/dist/index.js CHANGED
@@ -503,6 +503,7 @@ var getPinPairKey = (pinIds) => [...pinIds].sort().join("::");
503
503
  var MspConnectionPairSolver = class extends BaseSolver {
504
504
  inputProblem;
505
505
  mspConnectionPairs = [];
506
+ mspConnectionPairIds = /* @__PURE__ */ new Set();
506
507
  dcConnMap;
507
508
  globalConnMap;
508
509
  queuedDcNetIds;
@@ -550,6 +551,11 @@ var MspConnectionPairSolver = class extends BaseSolver {
550
551
  inputProblem: this.inputProblem
551
552
  };
552
553
  }
554
+ addMspConnectionPair(pair) {
555
+ if (this.mspConnectionPairIds.has(pair.mspPairId)) return;
556
+ this.mspConnectionPairIds.add(pair.mspPairId);
557
+ this.mspConnectionPairs.push(pair);
558
+ }
553
559
  _step() {
554
560
  if (this.queuedDcNetIds.length === 0) {
555
561
  this.solved = true;
@@ -594,7 +600,7 @@ var MspConnectionPairSolver = class extends BaseSolver {
594
600
  const globalConnNetId = this.globalConnMap.getNetConnectedToId(pin1);
595
601
  const userNetId = this.userNetIdByPinId[pin1] ?? this.userNetIdByPinId[pin2];
596
602
  const suppressNetLabel = pairDistance > this.maxMspPairDistance && labeledConnectionRouteReason === "overlapping-fallback-labels";
597
- this.mspConnectionPairs.push({
603
+ this.addMspConnectionPair({
598
604
  mspPairId: `${pin1}-${pin2}`,
599
605
  dcConnNetId: dcNetId,
600
606
  globalConnNetId,
@@ -639,7 +645,7 @@ var MspConnectionPairSolver = class extends BaseSolver {
639
645
  }
640
646
  const globalConnNetId = this.globalConnMap.getNetConnectedToId(pin1);
641
647
  const userNetId = this.userNetIdByPinId[pin1] ?? this.userNetIdByPinId[pin2];
642
- this.mspConnectionPairs.push({
648
+ this.addMspConnectionPair({
643
649
  mspPairId: `${pin1}-${pin2}`,
644
650
  dcConnNetId: dcNetId,
645
651
  globalConnNetId,
@@ -35,6 +35,7 @@ export class MspConnectionPairSolver extends BaseSolver {
35
35
  inputProblem: InputProblem
36
36
 
37
37
  mspConnectionPairs: MspConnectionPair[] = []
38
+ mspConnectionPairIds = new Set<MspConnectionPairId>()
38
39
  dcConnMap: ConnectivityMap
39
40
  globalConnMap: ConnectivityMap
40
41
  queuedDcNetIds: string[]
@@ -97,6 +98,13 @@ export class MspConnectionPairSolver extends BaseSolver {
97
98
  }
98
99
  }
99
100
 
101
+ private addMspConnectionPair(pair: MspConnectionPair) {
102
+ if (this.mspConnectionPairIds.has(pair.mspPairId)) return
103
+
104
+ this.mspConnectionPairIds.add(pair.mspPairId)
105
+ this.mspConnectionPairs.push(pair)
106
+ }
107
+
100
108
  override _step() {
101
109
  if (this.queuedDcNetIds.length === 0) {
102
110
  this.solved = true
@@ -164,7 +172,7 @@ export class MspConnectionPairSolver extends BaseSolver {
164
172
  pairDistance > this.maxMspPairDistance &&
165
173
  labeledConnectionRouteReason === "overlapping-fallback-labels"
166
174
 
167
- this.mspConnectionPairs.push({
175
+ this.addMspConnectionPair({
168
176
  mspPairId: `${pin1}-${pin2}`,
169
177
  dcConnNetId: dcNetId,
170
178
  globalConnNetId,
@@ -226,7 +234,7 @@ export class MspConnectionPairSolver extends BaseSolver {
226
234
  const globalConnNetId = this.globalConnMap.getNetConnectedToId(pin1!)!
227
235
  const userNetId =
228
236
  this.userNetIdByPinId[pin1!] ?? this.userNetIdByPinId[pin2!]
229
- this.mspConnectionPairs.push({
237
+ this.addMspConnectionPair({
230
238
  mspPairId: `${pin1}-${pin2}`,
231
239
  dcConnNetId: dcNetId,
232
240
  globalConnNetId,
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "https://github.com/tscircuit/schematic-trace-solver.git"
6
6
  },
7
7
  "main": "dist/index.js",
8
- "version": "0.0.156",
8
+ "version": "0.0.157",
9
9
  "type": "module",
10
10
  "scripts": {
11
11
  "start": "cosmos",
@@ -7,13 +7,15 @@ import { PipelineStageTable } from "./PipelineStageTable"
7
7
 
8
8
  export const PipelineDebugger = ({
9
9
  inputProblem,
10
+ hideRatsNet = false,
10
11
  }: {
11
12
  inputProblem: InputProblem
13
+ hideRatsNet?: boolean
12
14
  }) => {
13
15
  const [, incRenderCount] = useReducer((x) => x + 1, 0)
14
16
  const solver = useMemo(
15
- () => new SchematicTracePipelineSolver(inputProblem),
16
- [],
17
+ () => new SchematicTracePipelineSolver(inputProblem, { hideRatsNet }),
18
+ [inputProblem, hideRatsNet],
17
19
  )
18
20
 
19
21
  return (
@@ -1,4 +1,6 @@
1
1
  import { PipelineDebugger } from "site/components/PipelineDebugger"
2
2
  import inputProblem from "../../tests/assets/example51.json"
3
3
 
4
- export default () => <PipelineDebugger inputProblem={inputProblem as any} />
4
+ export default () => (
5
+ <PipelineDebugger inputProblem={inputProblem as any} hideRatsNet />
6
+ )