@synergenius/flow-weaver 0.9.3 → 0.9.5

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,21 @@ function assignUnpositionedNodes(layers, diagramNodes, explicitPositions) {
60562
60562
  }
60563
60563
  }
60564
60564
  }
60565
+ function resolveHorizontalOverlaps(diagramNodes, explicitPositions) {
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
+ if (explicitPositions.has(curr.id)) continue;
60571
+ const prevRightExtent = maxPortLabelExtent(prev.outputs);
60572
+ const currLeftExtent = maxPortLabelExtent(curr.inputs);
60573
+ const minGap = Math.max(prevRightExtent + LABEL_CLEARANCE + currLeftExtent, MIN_EDGE_GAP);
60574
+ const actualGap = curr.x - (prev.x + prev.width);
60575
+ if (actualGap < minGap) {
60576
+ curr.x = prev.x + prev.width + minGap;
60577
+ }
60578
+ }
60579
+ }
60565
60580
  function buildDiagramGraph(ast, options = {}) {
60566
60581
  const themeName = options.theme ?? "dark";
60567
60582
  const nodeTypeMap = /* @__PURE__ */ new Map();
@@ -60676,6 +60691,7 @@ function buildDiagramGraph(ast, options = {}) {
60676
60691
  } else {
60677
60692
  const { layers } = layoutWorkflow(ast);
60678
60693
  assignUnpositionedNodes(layers, diagramNodes, explicitPositions);
60694
+ resolveHorizontalOverlaps(diagramNodes, explicitPositions);
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.5" : "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({
@@ -610,11 +610,13 @@ function assignUnpositionedNodes(layers, diagramNodes, explicitPositions) {
610
610
  * label extent) intrudes into the previous node's right edge (plus its
611
611
  * output label extent and clearance).
612
612
  */
613
- function resolveHorizontalOverlaps(diagramNodes) {
613
+ function resolveHorizontalOverlaps(diagramNodes, explicitPositions) {
614
614
  const nodes = [...diagramNodes.values()].sort((a, b) => a.x - b.x);
615
615
  for (let i = 1; i < nodes.length; i++) {
616
616
  const prev = nodes[i - 1];
617
617
  const curr = nodes[i];
618
+ if (explicitPositions.has(curr.id))
619
+ continue; // respect author-set positions
618
620
  // Only external port labels overhang the node boundary.
619
621
  // Scope inner-edge port labels face inward and don't extend past the node box.
620
622
  const prevRightExtent = maxPortLabelExtent(prev.outputs);
@@ -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, explicitPositions);
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.5",
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",