@synergenius/flow-weaver 0.9.4 → 0.10.0
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/cli/flow-weaver.mjs +402 -100
- package/dist/diagram/geometry.js +5 -5
- package/dist/diagram/html-viewer.d.ts +2 -1
- package/dist/diagram/html-viewer.js +401 -99
- package/dist/diagram/renderer.js +8 -0
- package/package.json +1 -1
package/dist/diagram/geometry.js
CHANGED
|
@@ -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);
|
|
@@ -744,8 +746,7 @@ export function buildDiagramGraph(ast, options = {}) {
|
|
|
744
746
|
const allPositioned = [...diagramNodes.keys()].every(id => explicitPositions.has(id));
|
|
745
747
|
const nonePositioned = ![...diagramNodes.keys()].some(id => explicitPositions.has(id));
|
|
746
748
|
if (allPositioned) {
|
|
747
|
-
// All nodes have explicit positions — apply them
|
|
748
|
-
// caused by scope expansion making nodes wider than the author anticipated.
|
|
749
|
+
// All nodes have explicit positions — apply them as-is
|
|
749
750
|
for (const [id, pos] of explicitPositions) {
|
|
750
751
|
const node = diagramNodes.get(id);
|
|
751
752
|
if (node) {
|
|
@@ -753,7 +754,6 @@ export function buildDiagramGraph(ast, options = {}) {
|
|
|
753
754
|
node.y = pos.y;
|
|
754
755
|
}
|
|
755
756
|
}
|
|
756
|
-
resolveHorizontalOverlaps(diagramNodes);
|
|
757
757
|
}
|
|
758
758
|
else if (nonePositioned) {
|
|
759
759
|
// No positions — full auto-layout (original behavior)
|
|
@@ -764,7 +764,7 @@ export function buildDiagramGraph(ast, options = {}) {
|
|
|
764
764
|
// Mixed — explicit positions + auto-layout for remaining nodes
|
|
765
765
|
const { layers } = layoutWorkflow(ast);
|
|
766
766
|
assignUnpositionedNodes(layers, diagramNodes, explicitPositions);
|
|
767
|
-
resolveHorizontalOverlaps(diagramNodes);
|
|
767
|
+
resolveHorizontalOverlaps(diagramNodes, explicitPositions);
|
|
768
768
|
}
|
|
769
769
|
// Compute external port positions
|
|
770
770
|
for (const node of diagramNodes.values()) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HTML Viewer — wraps an SVG diagram in a self-contained interactive HTML page.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* The SVG element itself is the canvas: zoom and pan are driven by viewBox
|
|
5
|
+
* manipulation, so nodes can be dragged anywhere without hitting a boundary.
|
|
5
6
|
* No external dependencies — works standalone or inside an iframe.
|
|
6
7
|
*/
|
|
7
8
|
export interface HtmlViewerOptions {
|