flowfig 0.8.3 → 0.8.4

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/README.md CHANGED
@@ -65,7 +65,7 @@ jobs:
65
65
  - uses: actions/setup-node@v4
66
66
  with:
67
67
  node-version: 22
68
- - uses: iamalvisng/flowfig@v0.8.3
68
+ - uses: iamalvisng/flowfig@v0.8.4
69
69
  with:
70
70
  figures: 'docs/**/*.svg' # default **/*.svg
71
71
  ```
@@ -478,7 +478,7 @@ jobs:
478
478
  - uses: actions/setup-node@v4
479
479
  with:
480
480
  node-version: 22
481
- - uses: iamalvisng/flowfig@v0.8.3
481
+ - uses: iamalvisng/flowfig@v0.8.4
482
482
  with:
483
483
  figures: 'docs/**/*.svg' # default **/*.svg
484
484
  ```
package/dist/geometry.js CHANGED
@@ -505,13 +505,16 @@ export function labelAlong(r, w, boxes, placed, fig, lines = []) {
505
505
  y: Math.max(fig.y + 9, Math.min(at.y, fig.y + fig.h - 9)),
506
506
  }
507
507
  : at;
508
- const free = (at, strict) => {
508
+ const free = (at, strict, room = 1) => {
509
509
  const pill = { x: at.x - w / 2, y: at.y - 9, w, h: 18 };
510
510
  return (inFig(at) &&
511
- !boxes.some((b) => overlaps(pill, b, 1)) &&
511
+ !boxes.some((b) => overlaps(pill, b, room)) &&
512
512
  !placed.some((b) => overlaps(pill, b, 1)) &&
513
513
  (!strict || !lines.some((q) => q.x > pill.x - 2 && q.x < pill.x + w + 2 && q.y > pill.y - 2 && q.y < pill.y + 20)));
514
514
  };
515
+ for (const at of spots)
516
+ if (free(at, true, 6))
517
+ return at;
515
518
  for (const strict of [true, false])
516
519
  for (const at of spots)
517
520
  if (free(at, strict))
package/dist/model.js CHANGED
@@ -452,20 +452,21 @@ export const counts = (p) => {
452
452
  };
453
453
  };
454
454
  const idsIn = (c) => (isGroup(c) ? [...(c.id ? [c.id] : []), ...c.children.flatMap(idsIn)] : [c.id]);
455
+ const LINE_CLEAR = 16;
455
456
  export function groupGap(g, edges) {
456
457
  const side = new Map();
457
458
  g.children.forEach((c, i) => idsIn(c).forEach((id) => side.set(id, i)));
458
459
  const spans = edges.filter((e) => e.label != null && side.has(e.from) && side.has(e.to) && side.get(e.from) !== side.get(e.to) && !(g.gap != null && e.around));
459
460
  if (g.gap != null && !spans.length)
460
461
  return g.gap;
461
- const need = Math.max(0, ...spans.map((e) => labelPillW(str(e.label)) + 16));
462
+ const need = Math.max(0, ...spans.map((e) => labelPillW(str(e.label)) + 2 * LINE_CLEAR));
462
463
  if (g.gap != null && g.direction !== 'column')
463
- return Math.max(g.gap, need - 16);
464
+ return Math.max(g.gap, need);
464
465
  let auto;
465
466
  if (g.direction === 'column') {
466
467
  const ends = spans.map((e) => [side.get(e.from), side.get(e.to)].sort((p, q) => p - q));
467
468
  const most = Math.max(0, ...g.children.map((_, k) => ends.filter(([lo, hi]) => lo <= k && k < hi).length));
468
- auto = most > 1 ? Math.min(most, 3) * 22 + 16 : 28;
469
+ auto = most ? Math.min(most, 3) * 22 + 2 * LINE_CLEAR - 4 : 28;
469
470
  }
470
471
  else
471
472
  auto = Math.max(56, need);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.8.3";
1
+ export declare const VERSION = "0.8.4";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // The release list bumps this with package.json.
2
- export const VERSION = '0.8.3';
2
+ export const VERSION = '0.8.4';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowfig",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "description": "Your coding agent draws animated diagrams from your code, and flowfig checks each box and arrow against that code. CI fails when a diagram drifts from the code. The output is one animated SVG with no script, for a README, PR or issue. Works with Claude Code, Cursor, GitHub Copilot, Codex, Gemini CLI, Windsurf and Kiro.",
5
5
  "license": "MIT",
6
6
  "repository": {