@tscircuit/capacity-autorouter 0.0.35 → 0.0.37

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
@@ -105,6 +105,11 @@ declare class BaseSolver {
105
105
  _step(): void;
106
106
  solve(): void;
107
107
  visualize(): GraphicsObject;
108
+ /**
109
+ * A lightweight version of the visualize method that can be used to stream
110
+ * progress
111
+ */
112
+ preview(): GraphicsObject;
108
113
  }
109
114
 
110
115
  declare class CapacityMeshEdgeSolver extends BaseSolver {
@@ -1447,6 +1452,16 @@ declare class CapacityMeshSolver extends BaseSolver {
1447
1452
  _step(): void;
1448
1453
  getCurrentPhase(): string;
1449
1454
  visualize(): GraphicsObject;
1455
+ /**
1456
+ * A lightweight version of the visualize method that can be used to stream
1457
+ * progress
1458
+ *
1459
+ * We return the most relevant graphic for the stage:
1460
+ * 1. netToPointPairs output
1461
+ * 2. Capacity Planning Output
1462
+ * 3. High Density Route Solver Output, max 200 lines
1463
+ */
1464
+ preview(): GraphicsObject;
1450
1465
  /**
1451
1466
  * Get original connection name from connection name with MST suffix
1452
1467
  * @param mstConnectionName The MST-suffixed connection name (e.g. "connection1_mst0")
package/dist/index.js CHANGED
@@ -83,6 +83,18 @@ var BaseSolver = class {
83
83
  circles: []
84
84
  };
85
85
  }
86
+ /**
87
+ * A lightweight version of the visualize method that can be used to stream
88
+ * progress
89
+ */
90
+ preview() {
91
+ return {
92
+ lines: [],
93
+ points: [],
94
+ rects: [],
95
+ circles: []
96
+ };
97
+ }
86
98
  };
87
99
 
88
100
  // node_modules/@babel/runtime/helpers/esm/extends.js
@@ -8086,6 +8098,50 @@ var CapacityMeshSolver = class extends BaseSolver {
8086
8098
  ].filter(Boolean);
8087
8099
  return combineVisualizations(...visualizations);
8088
8100
  }
8101
+ /**
8102
+ * A lightweight version of the visualize method that can be used to stream
8103
+ * progress
8104
+ *
8105
+ * We return the most relevant graphic for the stage:
8106
+ * 1. netToPointPairs output
8107
+ * 2. Capacity Planning Output
8108
+ * 3. High Density Route Solver Output, max 200 lines
8109
+ */
8110
+ preview() {
8111
+ if (this.highDensityRouteSolver) {
8112
+ const lines = [];
8113
+ for (let i = this.highDensityRouteSolver.routes.length - 1; i >= 0; i--) {
8114
+ const route = this.highDensityRouteSolver.routes[i];
8115
+ lines.push({
8116
+ points: route.route.map((n) => ({
8117
+ x: n.x,
8118
+ y: n.y
8119
+ })),
8120
+ strokeColor: this.colorMap[route.connectionName]
8121
+ });
8122
+ if (lines.length > 200) break;
8123
+ }
8124
+ return { lines };
8125
+ }
8126
+ if (this.pathingSolver) {
8127
+ const lines = [];
8128
+ for (const connection of this.pathingSolver.connectionsWithNodes) {
8129
+ if (!connection.path) continue;
8130
+ lines.push({
8131
+ points: connection.path.map((n) => ({
8132
+ x: n.center.x,
8133
+ y: n.center.y
8134
+ })),
8135
+ strokeColor: this.colorMap[connection.connection.name]
8136
+ });
8137
+ }
8138
+ return { lines };
8139
+ }
8140
+ if (this.netToPointPairsSolver) {
8141
+ return this.netToPointPairsSolver?.visualize();
8142
+ }
8143
+ return {};
8144
+ }
8089
8145
  /**
8090
8146
  * Get original connection name from connection name with MST suffix
8091
8147
  * @param mstConnectionName The MST-suffixed connection name (e.g. "connection1_mst0")