@tscircuit/hypergraph 0.0.29 → 0.0.31
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 +73 -10
- package/dist/index.js +9515 -74
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -292,7 +292,7 @@ declare class HyperGraphSolver<RegionType extends Region = Region, RegionPortTyp
|
|
|
292
292
|
_step(): void;
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
type Bounds$
|
|
295
|
+
type Bounds$2 = {
|
|
296
296
|
minX: number;
|
|
297
297
|
minY: number;
|
|
298
298
|
maxX: number;
|
|
@@ -301,7 +301,7 @@ type Bounds$1 = {
|
|
|
301
301
|
|
|
302
302
|
interface JRegion extends Region {
|
|
303
303
|
d: {
|
|
304
|
-
bounds: Bounds$
|
|
304
|
+
bounds: Bounds$2;
|
|
305
305
|
center: {
|
|
306
306
|
x: number;
|
|
307
307
|
y: number;
|
|
@@ -383,7 +383,7 @@ declare class JumperGraphSolver extends HyperGraphSolver<JRegion, JPort> {
|
|
|
383
383
|
visualize(): GraphicsObject;
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
declare const calculateGraphBounds: (regions: JRegion[]) => Bounds$
|
|
386
|
+
declare const calculateGraphBounds: (regions: JRegion[]) => Bounds$2;
|
|
387
387
|
|
|
388
388
|
type XYConnection = {
|
|
389
389
|
start: {
|
|
@@ -479,7 +479,7 @@ type SharedBoundary = {
|
|
|
479
479
|
};
|
|
480
480
|
type RegionData = {
|
|
481
481
|
id: string;
|
|
482
|
-
bounds: Bounds$
|
|
482
|
+
bounds: Bounds$2 | null;
|
|
483
483
|
polygon: {
|
|
484
484
|
x: number;
|
|
485
485
|
y: number;
|
|
@@ -520,7 +520,7 @@ declare class RegionBuilder implements RegionRef {
|
|
|
520
520
|
private data;
|
|
521
521
|
constructor(id: string);
|
|
522
522
|
get id(): string;
|
|
523
|
-
rect(b: Bounds$
|
|
523
|
+
rect(b: Bounds$2): this;
|
|
524
524
|
polygon(points: {
|
|
525
525
|
x: number;
|
|
526
526
|
y: number;
|
|
@@ -549,7 +549,7 @@ declare class ConnectBuilder {
|
|
|
549
549
|
private portIds;
|
|
550
550
|
private boundary;
|
|
551
551
|
private prefixWasExplicitlySet;
|
|
552
|
-
constructor(region1Id: string, region2Id: string, bounds1: Bounds$
|
|
552
|
+
constructor(region1Id: string, region2Id: string, bounds1: Bounds$2, bounds2: Bounds$2, addPortFn: AddPortFn$1, prefixIdFn: PrefixIdFn, opts?: {
|
|
553
553
|
idPrefix?: string;
|
|
554
554
|
tolerance?: number;
|
|
555
555
|
});
|
|
@@ -569,7 +569,7 @@ declare class ConnectBuilder {
|
|
|
569
569
|
|
|
570
570
|
type ResolveRegionFn = (ref: RegionRef | string) => {
|
|
571
571
|
id: string;
|
|
572
|
-
bounds: Bounds$
|
|
572
|
+
bounds: Bounds$2;
|
|
573
573
|
};
|
|
574
574
|
type AddPortFn = (port: PortData) => void;
|
|
575
575
|
declare class PortBuilder {
|
|
@@ -785,7 +785,7 @@ declare class ViaGraphSolver extends HyperGraphSolver<JRegion, JPort> {
|
|
|
785
785
|
visualize(): GraphicsObject;
|
|
786
786
|
}
|
|
787
787
|
|
|
788
|
-
type Bounds = {
|
|
788
|
+
type Bounds$1 = {
|
|
789
789
|
minX: number;
|
|
790
790
|
maxX: number;
|
|
791
791
|
minY: number;
|
|
@@ -802,7 +802,7 @@ type Bounds = {
|
|
|
802
802
|
*/
|
|
803
803
|
declare function generateViaTopologyGrid(opts: {
|
|
804
804
|
viasByNet: ViasByNet;
|
|
805
|
-
bounds: Bounds;
|
|
805
|
+
bounds: Bounds$1;
|
|
806
806
|
tileSize?: number;
|
|
807
807
|
portPitch?: number;
|
|
808
808
|
}): {
|
|
@@ -845,6 +845,38 @@ declare function generateDefaultViaTopologyGrid(opts: Omit<Parameters<typeof gen
|
|
|
845
845
|
};
|
|
846
846
|
};
|
|
847
847
|
|
|
848
|
+
type ConvexViaGraphFromXYConnectionsResult = JumperGraph & {
|
|
849
|
+
connections: Connection[];
|
|
850
|
+
tiledViasByNet: ViasByNet;
|
|
851
|
+
tileCount: {
|
|
852
|
+
rows: number;
|
|
853
|
+
cols: number;
|
|
854
|
+
};
|
|
855
|
+
};
|
|
856
|
+
/**
|
|
857
|
+
* Creates a complete via topology graph from XY connections using convex regions.
|
|
858
|
+
*
|
|
859
|
+
* This function uses ConvexRegionsSolver to compute convex regions around
|
|
860
|
+
* via region obstacles, instead of the manual T/B/L/R outer regions.
|
|
861
|
+
*
|
|
862
|
+
* It:
|
|
863
|
+
* 1. Calculates bounds from connection XY coordinates (no margin)
|
|
864
|
+
* 2. Generates per-net via region polygons on a tiled grid
|
|
865
|
+
* 3. Uses ConvexRegionsSolver to compute convex regions around via regions
|
|
866
|
+
* 4. Creates ports between adjacent convex regions and via regions
|
|
867
|
+
* 5. Attaches connection regions to the graph
|
|
868
|
+
*
|
|
869
|
+
* @param xyConnections - Array of connections with start/end XY coordinates
|
|
870
|
+
* @param viasByNet - Via positions grouped by net name (defaults to built-in vias-by-net.json)
|
|
871
|
+
* @param opts - Optional configuration
|
|
872
|
+
*/
|
|
873
|
+
declare function createConvexViaGraphFromXYConnections(xyConnections: XYConnection[], viasByNet?: ViasByNet, opts?: {
|
|
874
|
+
tileSize?: number;
|
|
875
|
+
portPitch?: number;
|
|
876
|
+
clearance?: number;
|
|
877
|
+
concavityTolerance?: number;
|
|
878
|
+
}): ConvexViaGraphFromXYConnectionsResult;
|
|
879
|
+
|
|
848
880
|
type ViaGraphFromXYConnectionsResult = JumperGraph & {
|
|
849
881
|
connections: Connection[];
|
|
850
882
|
tiledViasByNet: ViasByNet;
|
|
@@ -885,4 +917,35 @@ type ViaGraphWithConnections = JumperGraph & {
|
|
|
885
917
|
*/
|
|
886
918
|
declare const createViaGraphWithConnections: (baseGraph: JumperGraph, xyConnections: XYConnection[]) => ViaGraphWithConnections;
|
|
887
919
|
|
|
888
|
-
|
|
920
|
+
type Bounds = {
|
|
921
|
+
minX: number;
|
|
922
|
+
maxX: number;
|
|
923
|
+
minY: number;
|
|
924
|
+
maxY: number;
|
|
925
|
+
};
|
|
926
|
+
/**
|
|
927
|
+
* Generates a via topology using convex regions computed by ConvexRegionsSolver.
|
|
928
|
+
*
|
|
929
|
+
* 1. Via tiles are placed on a grid (5mm tiles by default)
|
|
930
|
+
* 2. Per-net via region polygons are created within each tile
|
|
931
|
+
* 3. Convex regions are computed globally with via region polygons as obstacles
|
|
932
|
+
* 4. Ports are created between adjacent convex regions and between convex/via regions
|
|
933
|
+
*/
|
|
934
|
+
declare function generateConvexViaTopologyRegions(opts: {
|
|
935
|
+
viasByNet: ViasByNet;
|
|
936
|
+
bounds: Bounds;
|
|
937
|
+
tileSize?: number;
|
|
938
|
+
portPitch?: number;
|
|
939
|
+
clearance?: number;
|
|
940
|
+
concavityTolerance?: number;
|
|
941
|
+
}): {
|
|
942
|
+
regions: JRegion[];
|
|
943
|
+
ports: JPort[];
|
|
944
|
+
tiledViasByNet: ViasByNet;
|
|
945
|
+
tileCount: {
|
|
946
|
+
rows: number;
|
|
947
|
+
cols: number;
|
|
948
|
+
};
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
export { type Bounds$2 as Bounds, type BuildOpts, type Candidate, ConnectBuilder, type ConnectOpts, type Connection, type ConnectionId, type ConvexViaGraphFromXYConnectionsResult, type GScore, type GraphEdgeId, type HyperGraph, HyperGraphSolver, type JPort, type JRegion, JUMPER_GRAPH_SOLVER_DEFAULTS, type JumperGraph, JumperGraphSolver, type JumperGraphWithConnections, type NetworkId, type PortAssignment, PortBuilder, type PortData, type PortId, type PortSpread, type Region, RegionBuilder, type RegionData, type RegionId, type RegionPort, type RegionPortAssignment, type RegionRef, type SerializedConnection, type SerializedGraphPort, type SerializedGraphRegion, type SerializedHyperGraph, type SerializedRegionPortAssignment, type SharedBoundary, type SolvedRoute, Topology, TopologyError, VIA_GRAPH_SOLVER_DEFAULTS, type ValidateOpts, type ViaData, type ViaGraphFromXYConnectionsResult, ViaGraphSolver, type ViaGraphWithConnections, type ViasByNet, type XYConnection, applyTransformToGraph, calculateGraphBounds, convertConnectionsToSerializedConnections, convertHyperGraphToSerializedHyperGraph, createConvexViaGraphFromXYConnections, createGraphWithConnectionsFromBaseGraph, createViaGraphFromXYConnections, createViaGraphWithConnections, generateConvexViaTopologyRegions, generateDefaultViaTopologyGrid, generateDefaultViaTopologyRegions, generateJumperGrid, generateJumperX4Grid, generateViaTopologyGrid, generateViaTopologyRegions, rotateGraph90Degrees, viasByNet };
|