@tscircuit/core 0.0.1218 → 0.0.1219

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
@@ -1,7 +1,7 @@
1
1
  import * as circuit_json from 'circuit-json';
2
2
  import { PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, PcbViaClearanceError, LayerRef, AnyCircuitElement, Size, PcbTraceRoutePoint, AnySourceComponent, PcbComponent, PcbTrace as PcbTrace$1, PcbVia, SchematicPort, SchematicComponent, RouteHintPoint, CircuitJson } from 'circuit-json';
3
3
  import * as _tscircuit_props from '@tscircuit/props';
4
- import { PlatformConfig, traceProps, netProps, subcircuitGroupProps, AutorouterConfig, PcbSx, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, subcircuitProps, subpanelProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, resistorProps, constraintProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, courtyardCircleProps, courtyardOutlineProps, courtyardRectProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, fiducialProps, traceHintProps, viaProps, copperPourProps, copperTextProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, opampProps, OpAmpPinLabels, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicPathProps, schematicBoxProps, schematicSectionProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, voltageProbeProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
4
+ import { PlatformConfig, traceProps, netProps, AutorouterProp, subcircuitGroupProps, AutorouterConfig, PcbSx, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, subcircuitProps, subpanelProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, resistorProps, constraintProps, autoroutingPhaseProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, courtyardCircleProps, courtyardOutlineProps, courtyardRectProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, fiducialProps, traceHintProps, viaProps, copperPourProps, copperTextProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, opampProps, OpAmpPinLabels, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicPathProps, schematicBoxProps, schematicSectionProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, voltageProbeProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
5
5
  export { kicadFootprintStrings } from '@tscircuit/props';
6
6
  import * as react from 'react';
7
7
  import react__default, { ReactElement, DetailedHTMLProps, SVGProps } from 'react';
@@ -1341,6 +1341,7 @@ declare class Net extends PrimitiveComponent<typeof netProps> {
1341
1341
 
1342
1342
  interface RoutingPhasePlan {
1343
1343
  routingPhaseIndex: number | null;
1344
+ autorouter?: AutorouterProp;
1344
1345
  nets: Net[];
1345
1346
  traces: Trace[];
1346
1347
  }
@@ -71004,6 +71005,79 @@ declare class Constraint extends PrimitiveComponent<typeof constraintProps> {
71004
71005
  };
71005
71006
  }
71006
71007
 
71008
+ declare class AutoroutingPhase extends PrimitiveComponent<typeof autoroutingPhaseProps> {
71009
+ get config(): {
71010
+ componentName: string;
71011
+ zodProps: zod.ZodEffects<zod.ZodObject<{
71012
+ key: zod.ZodOptional<zod.ZodAny>;
71013
+ autorouter: zod.ZodOptional<zod.ZodType<_tscircuit_props.AutorouterProp, zod.ZodTypeDef, _tscircuit_props.AutorouterProp>>;
71014
+ phaseIndex: zod.ZodOptional<zod.ZodNumber>;
71015
+ region: zod.ZodOptional<zod.ZodObject<{
71016
+ minX: zod.ZodNumber;
71017
+ maxX: zod.ZodNumber;
71018
+ minY: zod.ZodNumber;
71019
+ maxY: zod.ZodNumber;
71020
+ }, "strip", zod.ZodTypeAny, {
71021
+ minX: number;
71022
+ maxX: number;
71023
+ minY: number;
71024
+ maxY: number;
71025
+ }, {
71026
+ minX: number;
71027
+ maxX: number;
71028
+ minY: number;
71029
+ maxY: number;
71030
+ }>>;
71031
+ reroute: zod.ZodOptional<zod.ZodBoolean>;
71032
+ }, "strip", zod.ZodTypeAny, {
71033
+ key?: any;
71034
+ autorouter?: _tscircuit_props.AutorouterProp | undefined;
71035
+ phaseIndex?: number | undefined;
71036
+ region?: {
71037
+ minX: number;
71038
+ maxX: number;
71039
+ minY: number;
71040
+ maxY: number;
71041
+ } | undefined;
71042
+ reroute?: boolean | undefined;
71043
+ }, {
71044
+ key?: any;
71045
+ autorouter?: _tscircuit_props.AutorouterProp | undefined;
71046
+ phaseIndex?: number | undefined;
71047
+ region?: {
71048
+ minX: number;
71049
+ maxX: number;
71050
+ minY: number;
71051
+ maxY: number;
71052
+ } | undefined;
71053
+ reroute?: boolean | undefined;
71054
+ }>, {
71055
+ key?: any;
71056
+ autorouter?: _tscircuit_props.AutorouterProp | undefined;
71057
+ phaseIndex?: number | undefined;
71058
+ region?: {
71059
+ minX: number;
71060
+ maxX: number;
71061
+ minY: number;
71062
+ maxY: number;
71063
+ } | undefined;
71064
+ reroute?: boolean | undefined;
71065
+ }, {
71066
+ key?: any;
71067
+ autorouter?: _tscircuit_props.AutorouterProp | undefined;
71068
+ phaseIndex?: number | undefined;
71069
+ region?: {
71070
+ minX: number;
71071
+ maxX: number;
71072
+ minY: number;
71073
+ maxY: number;
71074
+ } | undefined;
71075
+ reroute?: boolean | undefined;
71076
+ }>;
71077
+ };
71078
+ add(_component: PrimitiveComponent): void;
71079
+ }
71080
+
71007
71081
  declare class FabricationNoteRect extends PrimitiveComponent<typeof fabricationNoteRectProps> {
71008
71082
  fabrication_note_rect_id: string | null;
71009
71083
  isPcbPrimitive: boolean;
@@ -152578,6 +152652,7 @@ interface TscircuitElements {
152578
152652
  trace: _tscircuit_props.TraceProps;
152579
152653
  breakout: _tscircuit_props.BreakoutProps;
152580
152654
  breakoutpoint: _tscircuit_props.BreakoutPointProps;
152655
+ autoroutingphase: _tscircuit_props.AutoroutingPhaseProps;
152581
152656
  custom: any;
152582
152657
  component: _tscircuit_props.ComponentProps;
152583
152658
  crystal: _tscircuit_props.CrystalProps;
@@ -152638,4 +152713,4 @@ declare module "react/jsx-runtime" {
152638
152713
  }
152639
152714
  }
152640
152715
 
152641
- 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, Connector, Constraint, CopperPour, CopperText, CourtyardCircle, CourtyardOutline, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, Diode, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IIsolatedCircuit, type IRenderable, type IRootCircuit, Inductor, Interconnect, IsolatedCircuit, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, MountedBoard, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, 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, SchematicPath, SchematicRect, SchematicRow, SchematicSection, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, type SolverName, type SolverStartedEvent, Subcircuit, Subpanel, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveStaticFileImport, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
152716
+ export { AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, AutoroutingPhase, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Connector, Constraint, CopperPour, CopperText, CourtyardCircle, CourtyardOutline, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, Diode, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IIsolatedCircuit, type IRenderable, type IRootCircuit, Inductor, Interconnect, IsolatedCircuit, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, MountedBoard, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, 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, SchematicPath, SchematicRect, SchematicRow, SchematicSection, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, type SolverName, type SolverStartedEvent, Subcircuit, Subpanel, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveStaticFileImport, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ var __export = (target, all) => {
8
8
  var components_exports = {};
9
9
  __export(components_exports, {
10
10
  AnalogSimulation: () => AnalogSimulation,
11
+ AutoroutingPhase: () => AutoroutingPhase,
11
12
  Battery: () => Battery,
12
13
  Board: () => Board,
13
14
  Breakout: () => Breakout,
@@ -18205,7 +18206,7 @@ function getTraceRoutingPhaseIndex(trace) {
18205
18206
  let routingPhaseIndex = null;
18206
18207
  const connectedNets = trace._findConnectedNets().nets;
18207
18208
  for (const net of connectedNets) {
18208
- const netRoutingPhaseIndex = net.props.routingPhaseIndex;
18209
+ const netRoutingPhaseIndex = getNetRoutingPhaseIndex(net);
18209
18210
  if (typeof netRoutingPhaseIndex === "number") {
18210
18211
  if (routingPhaseIndex === null || netRoutingPhaseIndex < routingPhaseIndex) {
18211
18212
  routingPhaseIndex = netRoutingPhaseIndex;
@@ -18214,11 +18215,24 @@ function getTraceRoutingPhaseIndex(trace) {
18214
18215
  }
18215
18216
  return routingPhaseIndex;
18216
18217
  }
18218
+ function getAutoroutersByPhaseIndex(group) {
18219
+ const autoroutingPhases = group.selectAll(
18220
+ "autoroutingphase"
18221
+ );
18222
+ const autoroutersByPhaseIndex = /* @__PURE__ */ new Map();
18223
+ for (const autoroutingPhase of autoroutingPhases) {
18224
+ const { phaseIndex, autorouter } = autoroutingPhase._parsedProps;
18225
+ if (autorouter === void 0) continue;
18226
+ autoroutersByPhaseIndex.set(phaseIndex ?? null, autorouter);
18227
+ }
18228
+ return autoroutersByPhaseIndex;
18229
+ }
18217
18230
  function Group_getRoutingPhasePlans(group) {
18218
18231
  const traces = group.selectAll("trace");
18219
18232
  const nets = group.selectAll("net");
18220
18233
  if (traces.length === 0 && nets.length === 0) return [];
18221
18234
  const plansByPhaseIndex = /* @__PURE__ */ new Map();
18235
+ const autoroutersByPhaseIndex = getAutoroutersByPhaseIndex(group);
18222
18236
  for (const net of nets) {
18223
18237
  const routingPhaseIndex = getNetRoutingPhaseIndex(net);
18224
18238
  getOrCreateRoutingPhasePlan(plansByPhaseIndex, routingPhaseIndex).nets.push(
@@ -18232,7 +18246,13 @@ function Group_getRoutingPhasePlans(group) {
18232
18246
  routingPhaseIndex
18233
18247
  ).traces.push(trace);
18234
18248
  }
18235
- return Array.from(plansByPhaseIndex.values()).sort(compareRoutingPhasePlans);
18249
+ const plans = Array.from(plansByPhaseIndex.values()).sort(
18250
+ compareRoutingPhasePlans
18251
+ );
18252
+ for (const plan of plans) {
18253
+ plan.autorouter = autoroutersByPhaseIndex.get(plan.routingPhaseIndex);
18254
+ }
18255
+ return plans;
18236
18256
  }
18237
18257
 
18238
18258
  // lib/components/primitive-components/Group/Group_phasedAutoroutingUtils.ts
@@ -19122,6 +19142,7 @@ var Group6 = class extends NormalComponent3 {
19122
19142
  const outputTraces = [];
19123
19143
  const outputJumpers = [];
19124
19144
  for (const routingPhasePlan of routingPhasePlans) {
19145
+ const phaseAutorouterConfig = routingPhasePlan.autorouter ? getPresetAutoroutingConfig(routingPhasePlan.autorouter) : autorouterConfig;
19125
19146
  let simpleRouteJson = baseSimpleRouteJson;
19126
19147
  if (hasPhasedAutorouting) {
19127
19148
  simpleRouteJson = Group_filterSimpleRouteJsonForPhase(
@@ -19136,10 +19157,12 @@ var Group6 = class extends NormalComponent3 {
19136
19157
  if (hasPhasedAutorouting && simpleRouteJson.connections.length === 0) {
19137
19158
  continue;
19138
19159
  }
19139
- if (isAutoJumperPreset) {
19160
+ const phaseIsAutoJumperPreset = routingPhasePlan.autorouter !== void 0 ? this._isAutoJumperAutorouter(phaseAutorouterConfig) : isAutoJumperPreset;
19161
+ const phaseIsLaserPrefabPreset = routingPhasePlan.autorouter !== void 0 ? this._isLaserPrefabAutorouter(phaseAutorouterConfig) : isLaserPrefabPreset;
19162
+ if (phaseIsAutoJumperPreset) {
19140
19163
  simpleRouteJson.allowJumpers = true;
19141
- if (autorouterConfig.availableJumperTypes) {
19142
- simpleRouteJson.availableJumperTypes = autorouterConfig.availableJumperTypes;
19164
+ if (phaseAutorouterConfig.availableJumperTypes) {
19165
+ simpleRouteJson.availableJumperTypes = phaseAutorouterConfig.availableJumperTypes;
19143
19166
  }
19144
19167
  }
19145
19168
  if (debug11.enabled) {
@@ -19162,18 +19185,18 @@ var Group6 = class extends NormalComponent3 {
19162
19185
  simpleRouteJson
19163
19186
  });
19164
19187
  let autorouter;
19165
- if (autorouterConfig.algorithmFn) {
19166
- autorouter = await autorouterConfig.algorithmFn(simpleRouteJson);
19188
+ if (phaseAutorouterConfig.algorithmFn) {
19189
+ autorouter = await phaseAutorouterConfig.algorithmFn(simpleRouteJson);
19167
19190
  } else {
19168
19191
  const autorouterVersion2 = this.props.autorouterVersion;
19169
19192
  const effortLevel = this.props.autorouterEffortLevel;
19170
19193
  const effort = effortLevel ? Number.parseInt(effortLevel.replace("x", ""), 10) : void 0;
19171
19194
  autorouter = new TscircuitAutorouter(simpleRouteJson, {
19172
19195
  // Optional configuration parameters
19173
- capacityDepth: this.props.autorouter?.capacityDepth,
19174
- targetMinCapacity: this.props.autorouter?.targetMinCapacity,
19175
- useAssignableSolver: isLaserPrefabPreset || isSingleLayerBoard,
19176
- useAutoJumperSolver: isAutoJumperPreset,
19196
+ capacityDepth: phaseAutorouterConfig.capacityDepth,
19197
+ targetMinCapacity: phaseAutorouterConfig.targetMinCapacity,
19198
+ useAssignableSolver: phaseIsLaserPrefabPreset || isSingleLayerBoard,
19199
+ useAutoJumperSolver: phaseIsAutoJumperPreset,
19177
19200
  autorouterVersion: autorouterVersion2,
19178
19201
  effort,
19179
19202
  onSolverStarted: ({ solverName, solverParams }) => this.root?.emit("solver:started", {
@@ -20436,7 +20459,7 @@ import { identity as identity5 } from "transformation-matrix";
20436
20459
  var package_default = {
20437
20460
  name: "@tscircuit/core",
20438
20461
  type: "module",
20439
- version: "0.0.1217",
20462
+ version: "0.0.1218",
20440
20463
  types: "dist/index.d.ts",
20441
20464
  main: "dist/index.js",
20442
20465
  module: "dist/index.js",
@@ -23161,6 +23184,20 @@ var Constraint3 = class extends PrimitiveComponent2 {
23161
23184
  }
23162
23185
  };
23163
23186
 
23187
+ // lib/components/primitive-components/AutoroutingPhase.ts
23188
+ import { autoroutingPhaseProps } from "@tscircuit/props";
23189
+ var AutoroutingPhase = class extends PrimitiveComponent2 {
23190
+ get config() {
23191
+ return {
23192
+ componentName: "AutoroutingPhase",
23193
+ zodProps: autoroutingPhaseProps
23194
+ };
23195
+ }
23196
+ add(_component) {
23197
+ throw new Error("<autoroutingphase> cannot contain children");
23198
+ }
23199
+ };
23200
+
23164
23201
  // lib/components/primitive-components/FabricationNoteDimension.ts
23165
23202
  import { fabricationNoteDimensionProps } from "@tscircuit/props";
23166
23203
  import { applyToPoint as applyToPoint18 } from "transformation-matrix";
@@ -26916,6 +26953,7 @@ extendCatalogue({
26916
26953
  });
26917
26954
  export {
26918
26955
  AnalogSimulation,
26956
+ AutoroutingPhase,
26919
26957
  Battery,
26920
26958
  Board,
26921
26959
  Breakout,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1218",
4
+ "version": "0.0.1219",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",