@tscircuit/hypergraph 0.0.16 → 0.0.17

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
@@ -161,7 +161,7 @@ declare const generateJumperX4Grid: ({ cols, rows, marginX, marginY, innerColCha
161
161
  parallelTracesUnderJumperCount?: number;
162
162
  }) => JumperGraph;
163
163
 
164
- declare const generateJumperGrid: ({ cols, rows, marginX, marginY, innerColChannelPointCount, innerRowChannelPointCount, outerPaddingX, outerPaddingY, outerChannelXPoints, outerChannelYPoints, }: {
164
+ declare const generateJumperGrid: ({ cols, rows, marginX, marginY, innerColChannelPointCount, innerRowChannelPointCount, outerPaddingX, outerPaddingY, outerChannelXPoints, outerChannelYPoints, orientation, }: {
165
165
  cols: number;
166
166
  rows: number;
167
167
  marginX: number;
@@ -172,10 +172,8 @@ declare const generateJumperGrid: ({ cols, rows, marginX, marginY, innerColChann
172
172
  outerPaddingY?: number;
173
173
  outerChannelXPoints?: number;
174
174
  outerChannelYPoints?: number;
175
- }) => {
176
- regions: JRegion[];
177
- ports: JPort[];
178
- };
175
+ orientation?: "vertical" | "horizontal";
176
+ }) => JumperGraph;
179
177
 
180
178
  type XYConnection = {
181
179
  start: {
package/dist/index.js CHANGED
@@ -228,7 +228,7 @@ var generateJumperX4Grid = ({
228
228
  orientation: orientation2 = "vertical",
229
229
  center,
230
230
  bounds,
231
- parallelTracesUnderJumperCount = 4
231
+ parallelTracesUnderJumperCount = 2
232
232
  }) => {
233
233
  const regions = [];
234
234
  const ports = [];
@@ -1053,7 +1053,8 @@ var generateJumperGrid = ({
1053
1053
  outerPaddingX = 0.5,
1054
1054
  outerPaddingY = 0.5,
1055
1055
  outerChannelXPoints,
1056
- outerChannelYPoints
1056
+ outerChannelYPoints,
1057
+ orientation: orientation2 = "vertical"
1057
1058
  }) => {
1058
1059
  const effectiveOuterChannelXPoints = outerChannelXPoints ?? Math.max(1, Math.floor(outerPaddingX / 0.4));
1059
1060
  const effectiveOuterChannelYPoints = outerChannelYPoints ?? Math.max(1, Math.floor(outerPaddingY / 0.4));
@@ -1293,11 +1294,9 @@ var generateJumperGrid = ({
1293
1294
  `${idPrefix}:T-R`,
1294
1295
  top,
1295
1296
  right,
1296
- effectiveOuterChannelXPoints
1297
+ isLastCol ? effectiveOuterChannelXPoints : innerColChannelPointCount
1297
1298
  )
1298
1299
  );
1299
- ports.push(createPort(`${idPrefix}:T-LP`, top, leftPad));
1300
- ports.push(createPort(`${idPrefix}:T-RP`, top, rightPad));
1301
1300
  ports.push(createPort(`${idPrefix}:T-UJ`, top, underjumper));
1302
1301
  }
1303
1302
  if (bottom) {
@@ -1316,11 +1315,9 @@ var generateJumperGrid = ({
1316
1315
  `${idPrefix}:B-R`,
1317
1316
  bottom,
1318
1317
  right,
1319
- effectiveOuterChannelXPoints
1318
+ isLastCol ? effectiveOuterChannelXPoints : innerColChannelPointCount
1320
1319
  )
1321
1320
  );
1322
- ports.push(createPort(`${idPrefix}:B-LP`, bottom, leftPad));
1323
- ports.push(createPort(`${idPrefix}:B-RP`, bottom, rightPad));
1324
1321
  ports.push(createPort(`${idPrefix}:B-UJ`, bottom, underjumper));
1325
1322
  }
1326
1323
  if (left) {
@@ -1387,13 +1384,6 @@ var generateJumperGrid = ({
1387
1384
  )
1388
1385
  );
1389
1386
  }
1390
- ports.push(
1391
- createPort(
1392
- `cell_${row - 1}_${col}->cell_${row}_${col}:B-LP`,
1393
- aboveCell.bottom,
1394
- leftPad
1395
- )
1396
- );
1397
1387
  ports.push(
1398
1388
  createPort(
1399
1389
  `cell_${row - 1}_${col}->cell_${row}_${col}:B-UJ`,
@@ -1401,28 +1391,32 @@ var generateJumperGrid = ({
1401
1391
  underjumper
1402
1392
  )
1403
1393
  );
1404
- ports.push(
1405
- createPort(
1406
- `cell_${row - 1}_${col}->cell_${row}_${col}:B-RP`,
1407
- aboveCell.bottom,
1408
- rightPad
1409
- )
1410
- );
1411
1394
  ports.push(
1412
1395
  ...createMultiplePorts(
1413
1396
  `cell_${row - 1}_${col}->cell_${row}_${col}:B-R`,
1414
1397
  aboveCell.bottom,
1415
1398
  right,
1416
- effectiveOuterChannelXPoints
1399
+ isLastCol ? effectiveOuterChannelXPoints : innerColChannelPointCount
1417
1400
  )
1418
1401
  );
1419
1402
  }
1420
1403
  }
1421
1404
  }
1422
- return {
1405
+ let graph = {
1423
1406
  regions,
1424
1407
  ports
1425
1408
  };
1409
+ if (orientation2 === "horizontal") {
1410
+ const currentBounds = calculateGraphBounds(graph.regions);
1411
+ const currentCenter = computeBoundsCenter(currentBounds);
1412
+ const matrix = compose(
1413
+ translate(currentCenter.x, currentCenter.y),
1414
+ rotate(-Math.PI / 2),
1415
+ translate(-currentCenter.x, -currentCenter.y)
1416
+ );
1417
+ graph = applyTransformToGraph(graph, matrix);
1418
+ }
1419
+ return graph;
1426
1420
  };
1427
1421
 
1428
1422
  // lib/JumperGraphSolver/jumper-graph-generator/createConnectionPort.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/hypergraph",
3
3
  "main": "dist/index.js",
4
- "version": "0.0.16",
4
+ "version": "0.0.17",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "start": "cosmos",