@synergenius/flow-weaver 0.9.3 → 0.9.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.
@@ -60562,6 +60562,20 @@ function assignUnpositionedNodes(layers, diagramNodes, explicitPositions) {
60562
60562
  }
60563
60563
  }
60564
60564
  }
60565
+ function resolveHorizontalOverlaps(diagramNodes) {
60566
+ const nodes = [...diagramNodes.values()].sort((a, b) => a.x - b.x);
60567
+ for (let i = 1; i < nodes.length; i++) {
60568
+ const prev = nodes[i - 1];
60569
+ const curr = nodes[i];
60570
+ const prevRightExtent = maxPortLabelExtent(prev.outputs);
60571
+ const currLeftExtent = maxPortLabelExtent(curr.inputs);
60572
+ const minGap = Math.max(prevRightExtent + LABEL_CLEARANCE + currLeftExtent, MIN_EDGE_GAP);
60573
+ const actualGap = curr.x - (prev.x + prev.width);
60574
+ if (actualGap < minGap) {
60575
+ curr.x = prev.x + prev.width + minGap;
60576
+ }
60577
+ }
60578
+ }
60565
60579
  function buildDiagramGraph(ast, options = {}) {
60566
60580
  const themeName = options.theme ?? "dark";
60567
60581
  const nodeTypeMap = /* @__PURE__ */ new Map();
@@ -60670,12 +60684,14 @@ function buildDiagramGraph(ast, options = {}) {
60670
60684
  node.y = pos.y;
60671
60685
  }
60672
60686
  }
60687
+ resolveHorizontalOverlaps(diagramNodes);
60673
60688
  } else if (nonePositioned) {
60674
60689
  const { layers } = layoutWorkflow(ast);
60675
60690
  assignLayerCoordinates(layers, diagramNodes);
60676
60691
  } else {
60677
60692
  const { layers } = layoutWorkflow(ast);
60678
60693
  assignUnpositionedNodes(layers, diagramNodes, explicitPositions);
60694
+ resolveHorizontalOverlaps(diagramNodes);
60679
60695
  }
60680
60696
  for (const node of diagramNodes.values()) {
60681
60697
  computePortPositions(node);
@@ -61232,10 +61248,10 @@ body {
61232
61248
  .nodes > g:hover ~ .show-port-labels .port-label,
61233
61249
  .nodes > g:hover ~ .show-port-labels .port-type-label { opacity: 1; }
61234
61250
 
61235
- /* Connection hover & dimming */
61236
- .connections path { transition: opacity 0.2s ease, stroke-width 0.15s ease; }
61237
- .connections path:hover { stroke-width: 4; cursor: pointer; }
61238
- body.node-active .connections path.dimmed { opacity: 0.15; }
61251
+ /* Connection hover & dimming (attribute selector covers both main and scope connections) */
61252
+ path[data-source] { transition: opacity 0.2s ease, stroke-width 0.15s ease; }
61253
+ path[data-source]:hover { stroke-width: 4; cursor: pointer; }
61254
+ body.node-active path[data-source].dimmed { opacity: 0.15; }
61239
61255
 
61240
61256
  /* Node hover glow */
61241
61257
  .nodes g[data-node-id]:hover > rect:first-of-type { filter: brightness(1.08); }
@@ -61439,7 +61455,7 @@ body.node-active .connections path.dimmed { opacity: 0.15; }
61439
61455
 
61440
61456
  // Build adjacency: portId \u2192 array of connected portIds
61441
61457
  var portConnections = {};
61442
- content.querySelectorAll('.connections path').forEach(function(p) {
61458
+ content.querySelectorAll('path[data-source]').forEach(function(p) {
61443
61459
  var src = p.getAttribute('data-source');
61444
61460
  var tgt = p.getAttribute('data-target');
61445
61461
  if (!src || !tgt) return;
@@ -61536,7 +61552,7 @@ body.node-active .connections path.dimmed { opacity: 0.15; }
61536
61552
  });
61537
61553
 
61538
61554
  // Connected paths
61539
- var allPaths = content.querySelectorAll('.connections path');
61555
+ var allPaths = content.querySelectorAll('path[data-source]');
61540
61556
  var connectedPaths = [];
61541
61557
  var connectedNodes = new Set();
61542
61558
  allPaths.forEach(function(p) {
@@ -96194,7 +96210,7 @@ function displayInstalledPackage(pkg) {
96194
96210
  }
96195
96211
 
96196
96212
  // src/cli/index.ts
96197
- var version2 = true ? "0.9.3" : "0.0.0-dev";
96213
+ var version2 = true ? "0.9.4" : "0.0.0-dev";
96198
96214
  var program2 = new Command();
96199
96215
  program2.name("flow-weaver").description("Flow Weaver Annotations - Compile and validate workflow files").version(version2, "-v, --version", "Output the current version");
96200
96216
  program2.configureOutput({
@@ -744,7 +744,8 @@ export function buildDiagramGraph(ast, options = {}) {
744
744
  const allPositioned = [...diagramNodes.keys()].every(id => explicitPositions.has(id));
745
745
  const nonePositioned = ![...diagramNodes.keys()].some(id => explicitPositions.has(id));
746
746
  if (allPositioned) {
747
- // All nodes have explicit positions — apply them as-is
747
+ // All nodes have explicit positions — apply them, then fix overlaps
748
+ // caused by scope expansion making nodes wider than the author anticipated.
748
749
  for (const [id, pos] of explicitPositions) {
749
750
  const node = diagramNodes.get(id);
750
751
  if (node) {
@@ -752,6 +753,7 @@ export function buildDiagramGraph(ast, options = {}) {
752
753
  node.y = pos.y;
753
754
  }
754
755
  }
756
+ resolveHorizontalOverlaps(diagramNodes);
755
757
  }
756
758
  else if (nonePositioned) {
757
759
  // No positions — full auto-layout (original behavior)
@@ -762,6 +764,7 @@ export function buildDiagramGraph(ast, options = {}) {
762
764
  // Mixed — explicit positions + auto-layout for remaining nodes
763
765
  const { layers } = layoutWorkflow(ast);
764
766
  assignUnpositionedNodes(layers, diagramNodes, explicitPositions);
767
+ resolveHorizontalOverlaps(diagramNodes);
765
768
  }
766
769
  // Compute external port positions
767
770
  for (const node of diagramNodes.values()) {
@@ -67,10 +67,10 @@ body {
67
67
  .nodes > g:hover ~ .show-port-labels .port-label,
68
68
  .nodes > g:hover ~ .show-port-labels .port-type-label { opacity: 1; }
69
69
 
70
- /* Connection hover & dimming */
71
- .connections path { transition: opacity 0.2s ease, stroke-width 0.15s ease; }
72
- .connections path:hover { stroke-width: 4; cursor: pointer; }
73
- body.node-active .connections path.dimmed { opacity: 0.15; }
70
+ /* Connection hover & dimming (attribute selector covers both main and scope connections) */
71
+ path[data-source] { transition: opacity 0.2s ease, stroke-width 0.15s ease; }
72
+ path[data-source]:hover { stroke-width: 4; cursor: pointer; }
73
+ body.node-active path[data-source].dimmed { opacity: 0.15; }
74
74
 
75
75
  /* Node hover glow */
76
76
  .nodes g[data-node-id]:hover > rect:first-of-type { filter: brightness(1.08); }
@@ -274,7 +274,7 @@ body.node-active .connections path.dimmed { opacity: 0.15; }
274
274
 
275
275
  // Build adjacency: portId → array of connected portIds
276
276
  var portConnections = {};
277
- content.querySelectorAll('.connections path').forEach(function(p) {
277
+ content.querySelectorAll('path[data-source]').forEach(function(p) {
278
278
  var src = p.getAttribute('data-source');
279
279
  var tgt = p.getAttribute('data-target');
280
280
  if (!src || !tgt) return;
@@ -371,7 +371,7 @@ body.node-active .connections path.dimmed { opacity: 0.15; }
371
371
  });
372
372
 
373
373
  // Connected paths
374
- var allPaths = content.querySelectorAll('.connections path');
374
+ var allPaths = content.querySelectorAll('path[data-source]');
375
375
  var connectedPaths = [];
376
376
  var connectedNodes = new Set();
377
377
  allPaths.forEach(function(p) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synergenius/flow-weaver",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "description": "Deterministic workflow compiler for AI agents. Compiles to standalone TypeScript, no runtime dependencies.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -100,7 +100,8 @@
100
100
  "docs": "typedoc && tsx scripts/generate-grammar-docs.ts",
101
101
  "docs:serve": "npm run docs && npx http-server docs/api -c-1 -o",
102
102
  "prepare": "npm run build",
103
- "cli": "tsx src/cli/index.ts"
103
+ "cli": "tsx src/cli/index.ts",
104
+ "diagram": "tsx scripts/generate-diagram.ts"
104
105
  },
105
106
  "keywords": [
106
107
  "flow-weaver",