@tscircuit/core 0.0.921 → 0.0.922

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
@@ -12,6 +12,8 @@ import { Matrix } from 'transformation-matrix';
12
12
  import { CircuitJsonUtilObjects } from '@tscircuit/circuit-json-util';
13
13
  import { ConnectivityMap } from 'circuit-json-to-connectivity-map';
14
14
  import { GraphicsObject } from 'graphics-debug';
15
+ import { PackSolver2 } from 'calculate-packing';
16
+ import { AutoroutingPipelineSolver, AssignableViaAutoroutingPipelineSolver } from '@tscircuit/capacity-autorouter';
15
17
 
16
18
  declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SchematicPrimitiveRender", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SimulationSpiceEngineRender"];
17
19
  type RenderPhase = (typeof orderedRenderPhases)[number];
@@ -183,7 +185,7 @@ interface SimpleRouteJson {
183
185
  traces?: SimplifiedPcbTrace[];
184
186
  }
185
187
 
186
- type RootCircuitEventName = "asyncEffect:start" | "asyncEffect:end" | "renderable:renderLifecycle:anyEvent" | `renderable:renderLifecycle:${RenderPhase}:start` | `renderable:renderLifecycle:${RenderPhase}:end` | `board:renderPhaseStarted` | "external:evalError" | "autorouting:start" | "autorouting:end" | "autorouting:error" | "autorouting:progress" | "packing:start" | "packing:end" | "packing:error" | "renderComplete" | "debug:logOutput";
188
+ type RootCircuitEventName = "asyncEffect:start" | "asyncEffect:end" | "renderable:renderLifecycle:anyEvent" | `renderable:renderLifecycle:${RenderPhase}:start` | `renderable:renderLifecycle:${RenderPhase}:end` | `board:renderPhaseStarted` | "external:evalError" | "autorouting:start" | "autorouting:end" | "autorouting:error" | "autorouting:progress" | "packing:start" | "packing:end" | "packing:error" | "solver:started" | "renderComplete" | "debug:logOutput";
187
189
  interface AutoroutingStartEvent {
188
190
  type: "autorouting:start";
189
191
  subcircuit_id: string;
@@ -230,6 +232,12 @@ interface PackingErrorEvent {
230
232
  message: string;
231
233
  };
232
234
  }
235
+ interface SolverStartedEvent {
236
+ type: "solver:started";
237
+ solverName: string;
238
+ solverParams: unknown;
239
+ componentName: string;
240
+ }
233
241
  interface DebugLogOutputEvent {
234
242
  type: "debug:logOutput";
235
243
  name: string;
@@ -43227,6 +43235,13 @@ declare const applySchematicEditEventsToManualEditsFile: ({ circuitJson, editEve
43227
43235
  manualEditsFile: z.infer<typeof manual_edits_file>;
43228
43236
  }) => z.infer<typeof manual_edits_file>;
43229
43237
 
43238
+ declare const SOLVERS: {
43239
+ PackSolver2: typeof PackSolver2;
43240
+ AutoroutingPipelineSolver: typeof AutoroutingPipelineSolver;
43241
+ AssignableViaAutoroutingPipelineSolver: typeof AssignableViaAutoroutingPipelineSolver;
43242
+ };
43243
+ type SolverName = keyof typeof SOLVERS;
43244
+
43230
43245
  interface TscircuitElements {
43231
43246
  resistor: _tscircuit_props.ResistorProps;
43232
43247
  capacitor: _tscircuit_props.CapacitorProps;
@@ -43322,4 +43337,4 @@ declare module "react/jsx-runtime" {
43322
43337
  }
43323
43338
  }
43324
43339
 
43325
- export { AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, CopperPour, Crystal, Cutout, type DebugLogOutputEvent, Diode, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Interconnect, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, NormalComponent, type Obstacle, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbTrace, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicRect, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, Subcircuit, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, resolveStaticFileImport, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
43340
+ export { AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, CopperPour, Crystal, Cutout, type DebugLogOutputEvent, Diode, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Interconnect, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, NormalComponent, type Obstacle, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbTrace, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicRect, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, type SolverName, type SolverStartedEvent, Subcircuit, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, resolveStaticFileImport, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -9575,18 +9575,30 @@ var CapacityMeshAutorouter = class {
9575
9575
  capacityDepth,
9576
9576
  targetMinCapacity,
9577
9577
  stepDelay = 0,
9578
- useAssignableViaSolver = false
9578
+ useAssignableViaSolver = false,
9579
+ onSolverStarted
9579
9580
  } = options;
9580
9581
  const {
9581
- AutoroutingPipelineSolver,
9582
- AssignableViaAutoroutingPipelineSolver
9582
+ AutoroutingPipelineSolver: AutoroutingPipelineSolver2,
9583
+ AssignableViaAutoroutingPipelineSolver: AssignableViaAutoroutingPipelineSolver2
9583
9584
  } = CapacityAutorouter;
9584
- const SolverClass = useAssignableViaSolver ? AssignableViaAutoroutingPipelineSolver : AutoroutingPipelineSolver;
9585
+ const SolverClass = useAssignableViaSolver ? AssignableViaAutoroutingPipelineSolver2 : AutoroutingPipelineSolver2;
9585
9586
  this.solver = new SolverClass(input, {
9586
9587
  capacityDepth,
9587
9588
  targetMinCapacity,
9588
9589
  cacheProvider: null
9589
9590
  });
9591
+ onSolverStarted?.({
9592
+ solverName: SolverClass.name,
9593
+ solverParams: {
9594
+ input,
9595
+ options: {
9596
+ capacityDepth,
9597
+ targetMinCapacity,
9598
+ cacheProvider: null
9599
+ }
9600
+ }
9601
+ });
9590
9602
  this.stepDelay = stepDelay;
9591
9603
  }
9592
9604
  /**
@@ -11897,7 +11909,7 @@ function getPresetAutoroutingConfig(autorouterConfig) {
11897
11909
 
11898
11910
  // lib/components/primitive-components/Group/Group_doInitialPcbLayoutPack/Group_doInitialPcbLayoutPack.ts
11899
11911
  import {
11900
- pack,
11912
+ PackSolver2,
11901
11913
  convertCircuitJsonToPackOutput,
11902
11914
  convertPackOutputToPackInput,
11903
11915
  getGraphicsFromPackOutput
@@ -12403,7 +12415,18 @@ var Group_doInitialPcbLayoutPack = (group) => {
12403
12415
  }
12404
12416
  let packOutput;
12405
12417
  try {
12406
- packOutput = pack(packInput);
12418
+ const solver = new PackSolver2(packInput);
12419
+ group.root?.emit("solver:started", {
12420
+ type: "solver:started",
12421
+ solverName: solver.constructor.name,
12422
+ solverParams: solver.getConstructorParams(),
12423
+ componentName: group.getString()
12424
+ });
12425
+ solver.solve();
12426
+ packOutput = {
12427
+ ...packInput,
12428
+ components: solver.packedComponents
12429
+ };
12407
12430
  } catch (error) {
12408
12431
  group.root?.emit("packing:error", {
12409
12432
  subcircuit_id: group.subcircuit_id,
@@ -14016,7 +14039,13 @@ var Group6 = class extends NormalComponent3 {
14016
14039
  // Optional configuration parameters
14017
14040
  capacityDepth: this.props.autorouter?.capacityDepth,
14018
14041
  targetMinCapacity: this.props.autorouter?.targetMinCapacity,
14019
- useAssignableViaSolver: isLaserPrefabPreset || isSingleLayerBoard
14042
+ useAssignableViaSolver: isLaserPrefabPreset || isSingleLayerBoard,
14043
+ onSolverStarted: ({ solverName, solverParams }) => this.root?.emit("solver:started", {
14044
+ type: "solver:started",
14045
+ solverName,
14046
+ solverParams,
14047
+ componentName: this.getString()
14048
+ })
14020
14049
  });
14021
14050
  }
14022
14051
  const routingPromise = new Promise(
@@ -19300,7 +19329,7 @@ import { identity as identity5 } from "transformation-matrix";
19300
19329
  var package_default = {
19301
19330
  name: "@tscircuit/core",
19302
19331
  type: "module",
19303
- version: "0.0.920",
19332
+ version: "0.0.921",
19304
19333
  types: "dist/index.d.ts",
19305
19334
  main: "dist/index.js",
19306
19335
  module: "dist/index.js",
@@ -19830,6 +19859,18 @@ var sel = new Proxy(
19830
19859
  }
19831
19860
  );
19832
19861
 
19862
+ // lib/solvers.ts
19863
+ import { PackSolver2 as PackSolver22 } from "calculate-packing";
19864
+ import {
19865
+ AutoroutingPipelineSolver,
19866
+ AssignableViaAutoroutingPipelineSolver
19867
+ } from "@tscircuit/capacity-autorouter";
19868
+ var SOLVERS = {
19869
+ PackSolver2: PackSolver22,
19870
+ AutoroutingPipelineSolver,
19871
+ AssignableViaAutoroutingPipelineSolver
19872
+ };
19873
+
19833
19874
  // lib/index.ts
19834
19875
  import { createElement } from "react";
19835
19876
 
@@ -19891,6 +19932,7 @@ export {
19891
19932
  Resistor,
19892
19933
  Resonator,
19893
19934
  RootCircuit,
19935
+ SOLVERS,
19894
19936
  SchematicArc,
19895
19937
  SchematicBox,
19896
19938
  SchematicCell,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.921",
4
+ "version": "0.0.922",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",