@tscircuit/core 0.0.2002 → 0.0.2003

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
@@ -258,7 +258,10 @@ type RootCircuitEventName = "asyncEffect:start" | "asyncEffect:end" | "renderabl
258
258
  type AutoroutingCacheStatus = "disabled" | "hit" | "miss";
259
259
  type AutoroutingCacheDisabledReason = "custom_algorithm" | "strategy_not_cacheable" | "no_cache_engine";
260
260
  interface AutoroutingExecutionMetadata {
261
+ /** Declared routing phase index; null identifies the default/unassigned phase. */
261
262
  routingPhaseIndex?: number | null;
263
+ /** Zero-based execution order after expanding phases into routing stages. */
264
+ _actualRoutingPhaseOrderIndex?: number;
262
265
  phaseOrdinal?: number;
263
266
  phaseCount?: number;
264
267
  connectionCount?: number;
package/dist/index.js CHANGED
@@ -64162,7 +64162,7 @@ function Group_getRoutingPhasePlans(group) {
64162
64162
  var package_default = {
64163
64163
  name: "@tscircuit/core",
64164
64164
  type: "module",
64165
- version: "0.0.2001",
64165
+ version: "0.0.2002",
64166
64166
  types: "dist/index.d.ts",
64167
64167
  main: "dist/index.js",
64168
64168
  module: "dist/index.js",
@@ -65991,20 +65991,17 @@ var Group5 = class extends NormalComponent {
65991
65991
  const routingPhasePlans = this._getRoutingPhasePlans();
65992
65992
  const hasPhasedAutorouting = this.getInheritedProperty("routeRemaining") === false || Group_hasPhasedAutorouting(routingPhasePlans);
65993
65993
  const shouldEmitRoutingPhaseDebugObjects = routingPhasePlans.length > 1;
65994
- const routingPhaseDisplayIndexes = new Map(
65995
- routingPhasePlans.map((plan, index) => [plan, index])
65996
- );
65994
+ const routingPhaseDebugLabels = /* @__PURE__ */ new Map();
65997
65995
  if (shouldEmitRoutingPhaseDebugObjects) {
65998
65996
  for (const debugObject of db.pcb_debug_object.list()) {
65999
- if (debugObject.subcircuit_id === this.subcircuit_id && (debugObject.label?.startsWith("Autorouting phase: ") || /^autorouting phase \d+(?: |$)/.test(debugObject.label ?? ""))) {
65997
+ if (debugObject.subcircuit_id === this.subcircuit_id && (debugObject.label?.startsWith("Autorouting phase: ") || debugObject.label?.startsWith("autorouting phase "))) {
66000
65998
  db.pcb_debug_object.delete(debugObject.pcb_debug_object_id);
66001
65999
  }
66002
66000
  }
66003
66001
  }
66004
66002
  const emitRoutingPhaseDebugObject = (routingPhasePlan, bounds) => {
66005
66003
  if (!shouldEmitRoutingPhaseDebugObjects) return;
66006
- const phaseIndex = routingPhaseDisplayIndexes.get(routingPhasePlan);
66007
- if (phaseIndex === void 0) return;
66004
+ const phaseLabel = routingPhaseDebugLabels.get(routingPhasePlan);
66008
66005
  const phaseName = routingPhasePlan.phaseName?.trim();
66009
66006
  db.pcb_debug_object.insert({
66010
66007
  shape: "rect",
@@ -66016,7 +66013,7 @@ var Group5 = class extends NormalComponent {
66016
66013
  width: bounds.maxX - bounds.minX,
66017
66014
  height: bounds.maxY - bounds.minY
66018
66015
  },
66019
- label: `autorouting phase ${phaseIndex}${phaseName ? ` ${phaseName}` : ""}`,
66016
+ label: `autorouting phase ${phaseLabel}${phaseName ? ` ${phaseName}` : ""}`,
66020
66017
  subcircuit_id: this.subcircuit_id ?? void 0
66021
66018
  });
66022
66019
  };
@@ -66025,6 +66022,12 @@ var Group5 = class extends NormalComponent {
66025
66022
  routingPhasePlan.autorouter,
66026
66023
  this.root?.platform
66027
66024
  ) : autorouterConfig;
66025
+ const preset = resolvedPhaseAutorouterConfig.preset;
66026
+ const implicitPhaseLabel = routingPhasePlan.reroute ? preset === "simplify" ? "simplify" : "reroute" : routingPhasePlan.fanoutRegionPcbGroupId ? routingPhasePlan.autorouter === "default" && !routingPhasePlan.getPrecomputedRoutingResult ? "breakout" : "fanout" : preset && preset !== "default" ? preset.replaceAll("_", " ") : "default";
66027
+ routingPhaseDebugLabels.set(
66028
+ routingPhasePlan,
66029
+ routingPhasePlan.routingPhaseIndex?.toString() ?? implicitPhaseLabel
66030
+ );
66028
66031
  const phaseAutorouterConfig = routingPhasePlan.getPrecomputedRoutingResult ? {
66029
66032
  ...resolvedPhaseAutorouterConfig,
66030
66033
  allowViaInPad: (typeof routingPhasePlan.autorouter === "object" ? routingPhasePlan.autorouter.allowViaInPad : void 0) ?? autorouterConfig.allowViaInPad
@@ -66044,6 +66047,24 @@ var Group5 = class extends NormalComponent {
66044
66047
  phaseStageCount: stages.length
66045
66048
  }));
66046
66049
  });
66050
+ const implicitPhaseLabelCounts = /* @__PURE__ */ new Map();
66051
+ for (const plan of routingPhasePlans) {
66052
+ if (plan.routingPhaseIndex !== null) continue;
66053
+ const label = routingPhaseDebugLabels.get(plan);
66054
+ implicitPhaseLabelCounts.set(
66055
+ label,
66056
+ (implicitPhaseLabelCounts.get(label) ?? 0) + 1
66057
+ );
66058
+ }
66059
+ const implicitPhaseLabelOrdinals = /* @__PURE__ */ new Map();
66060
+ for (const plan of routingPhasePlans) {
66061
+ if (plan.routingPhaseIndex !== null) continue;
66062
+ const label = routingPhaseDebugLabels.get(plan);
66063
+ if (implicitPhaseLabelCounts.get(label) <= 1) continue;
66064
+ const ordinal = (implicitPhaseLabelOrdinals.get(label) ?? 0) + 1;
66065
+ implicitPhaseLabelOrdinals.set(label, ordinal);
66066
+ routingPhaseDebugLabels.set(plan, `${label} ${ordinal}`);
66067
+ }
66047
66068
  const hasFanoutStage = routingStages.some(
66048
66069
  ({ autorouterConfig: autorouterConfig2 }) => ["fanout", "single_layer_fanout"].includes(autorouterConfig2.preset ?? "")
66049
66070
  );
@@ -66422,7 +66443,8 @@ var Group5 = class extends NormalComponent {
66422
66443
  const cachedResult = cacheKey ? await getCachedLocalAutoroutingPhaseResult({ cacheEngine, cacheKey }) : null;
66423
66444
  const cacheDisabledReason = getPrecomputedRoutingResult ? "precomputed" : phaseAutorouterConfig.algorithmFn ? "custom_algorithm" : !localAutorouterStrategy.cacheable ? "strategy_not_cacheable" : !cacheEngine ? "no_cache_engine" : void 0;
66424
66445
  const autoroutingMetadata = {
66425
- routingPhaseIndex: routingStageIndex,
66446
+ routingPhaseIndex: routingPhasePlan.routingPhaseIndex,
66447
+ _actualRoutingPhaseOrderIndex: routingStageIndex,
66426
66448
  phaseOrdinal: routingStageIndex + 1,
66427
66449
  phaseCount: routingStages.length,
66428
66450
  connectionCount: simpleRouteJson.connections.length,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.2002",
4
+ "version": "0.0.2003",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",