@angflow/angular 0.0.19 → 0.3.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 +108 -15
- package/dist/base.css +8 -0
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/lib/agent/agent-bridge.service.d.ts +3 -1
- package/dist/esm/lib/agent/agent-bridge.service.js +130 -23
- package/dist/esm/lib/agent/agent-bridge.service.js.map +1 -1
- package/dist/esm/lib/agent/chat/agent-chat.component.d.ts +0 -1
- package/dist/esm/lib/agent/chat/agent-chat.service.d.ts +0 -1
- package/dist/esm/lib/agent/chat/agent-chat.service.js +11 -2
- package/dist/esm/lib/agent/chat/agent-chat.service.js.map +1 -1
- package/dist/esm/lib/agent/chat/default-system-prompt.d.ts +1 -2
- package/dist/esm/lib/agent/chat/default-system-prompt.js +2 -1
- package/dist/esm/lib/agent/chat/default-system-prompt.js.map +1 -1
- package/dist/esm/lib/agent/chat/index.d.ts +0 -1
- package/dist/esm/lib/agent/chat/provide-agent-chat.d.ts +0 -1
- package/dist/esm/lib/agent/chat/types.d.ts +0 -1
- package/dist/esm/lib/agent/history.d.ts +0 -1
- package/dist/esm/lib/agent/index.d.ts +0 -1
- package/dist/esm/lib/agent/provide-agent-bridge.d.ts +0 -1
- package/dist/esm/lib/agent/tool-schemas.d.ts +0 -1
- package/dist/esm/lib/agent/tool-schemas.js +3 -1
- package/dist/esm/lib/agent/tool-schemas.js.map +1 -1
- package/dist/esm/lib/agent/transports/websocket.d.ts +8 -1
- package/dist/esm/lib/agent/transports/websocket.js +14 -2
- package/dist/esm/lib/agent/transports/websocket.js.map +1 -1
- package/dist/esm/lib/agent/transports/window.d.ts +0 -1
- package/dist/esm/lib/agent/transports/window.js +2 -1
- package/dist/esm/lib/agent/transports/window.js.map +1 -1
- package/dist/esm/lib/agent/types.d.ts +0 -1
- package/dist/esm/lib/components/a11y-descriptions/a11y-descriptions.component.d.ts +0 -1
- package/dist/esm/lib/components/attribution/attribution.component.d.ts +0 -1
- package/dist/esm/lib/components/background/background.component.d.ts +0 -1
- package/dist/esm/lib/components/connection-line/connection-line.component.d.ts +0 -1
- package/dist/esm/lib/components/controls/controls.component.d.ts +0 -1
- package/dist/esm/lib/components/controls/controls.component.js +2 -1
- package/dist/esm/lib/components/controls/controls.component.js.map +1 -1
- package/dist/esm/lib/components/edge-label-renderer/edge-label-renderer.component.d.ts +0 -1
- package/dist/esm/lib/components/edge-toolbar/edge-toolbar.component.d.ts +7 -2
- package/dist/esm/lib/components/edge-toolbar/edge-toolbar.component.js +11 -4
- package/dist/esm/lib/components/edge-toolbar/edge-toolbar.component.js.map +1 -1
- package/dist/esm/lib/components/edges/base-edge.component.d.ts +0 -1
- package/dist/esm/lib/components/edges/bezier-edge.component.d.ts +0 -1
- package/dist/esm/lib/components/edges/bezier-edge.component.js +2 -1
- package/dist/esm/lib/components/edges/bezier-edge.component.js.map +1 -1
- package/dist/esm/lib/components/edges/edge-text.component.d.ts +0 -1
- package/dist/esm/lib/components/edges/simple-bezier-edge.component.d.ts +0 -1
- package/dist/esm/lib/components/edges/simple-bezier-edge.component.js +2 -1
- package/dist/esm/lib/components/edges/simple-bezier-edge.component.js.map +1 -1
- package/dist/esm/lib/components/edges/smooth-step-edge.component.d.ts +0 -1
- package/dist/esm/lib/components/edges/smooth-step-edge.component.js +2 -1
- package/dist/esm/lib/components/edges/smooth-step-edge.component.js.map +1 -1
- package/dist/esm/lib/components/edges/step-edge.component.d.ts +0 -1
- package/dist/esm/lib/components/edges/step-edge.component.js +2 -1
- package/dist/esm/lib/components/edges/step-edge.component.js.map +1 -1
- package/dist/esm/lib/components/edges/straight-edge.component.d.ts +0 -1
- package/dist/esm/lib/components/edges/straight-edge.component.js +2 -1
- package/dist/esm/lib/components/edges/straight-edge.component.js.map +1 -1
- package/dist/esm/lib/components/handle/handle.component.d.ts +1 -1
- package/dist/esm/lib/components/handle/handle.component.js +13 -1
- package/dist/esm/lib/components/handle/handle.component.js.map +1 -1
- package/dist/esm/lib/components/handle-group/handle-group.component.d.ts +0 -1
- package/dist/esm/lib/components/handle-group/handle-row.component.d.ts +0 -1
- package/dist/esm/lib/components/minimap/minimap.component.d.ts +19 -17
- package/dist/esm/lib/components/minimap/minimap.component.js +143 -183
- package/dist/esm/lib/components/minimap/minimap.component.js.map +1 -1
- package/dist/esm/lib/components/ng-flow-provider/ng-flow-provider.component.d.ts +13 -5
- package/dist/esm/lib/components/ng-flow-provider/ng-flow-provider.component.js +13 -4
- package/dist/esm/lib/components/ng-flow-provider/ng-flow-provider.component.js.map +1 -1
- package/dist/esm/lib/components/node-resizer/node-resizer.component.d.ts +2 -1
- package/dist/esm/lib/components/node-resizer/node-resizer.component.js +43 -26
- package/dist/esm/lib/components/node-resizer/node-resizer.component.js.map +1 -1
- package/dist/esm/lib/components/node-toolbar/node-toolbar.component.d.ts +0 -1
- package/dist/esm/lib/components/node-toolbar/node-toolbar.component.js +1 -1
- package/dist/esm/lib/components/node-toolbar/node-toolbar.component.js.map +1 -1
- package/dist/esm/lib/components/nodes/default-node.component.d.ts +6 -15
- package/dist/esm/lib/components/nodes/default-node.component.js +13 -22
- package/dist/esm/lib/components/nodes/default-node.component.js.map +1 -1
- package/dist/esm/lib/components/nodes/group-node.component.d.ts +5 -16
- package/dist/esm/lib/components/nodes/group-node.component.js +8 -16
- package/dist/esm/lib/components/nodes/group-node.component.js.map +1 -1
- package/dist/esm/lib/components/nodes/input-node.component.d.ts +6 -15
- package/dist/esm/lib/components/nodes/input-node.component.js +11 -20
- package/dist/esm/lib/components/nodes/input-node.component.js.map +1 -1
- package/dist/esm/lib/components/nodes/output-node.component.d.ts +6 -15
- package/dist/esm/lib/components/nodes/output-node.component.js +11 -20
- package/dist/esm/lib/components/nodes/output-node.component.js.map +1 -1
- package/dist/esm/lib/components/nodes/template-node.component.d.ts +2 -14
- package/dist/esm/lib/components/nodes/template-node.component.js +16 -26
- package/dist/esm/lib/components/nodes/template-node.component.js.map +1 -1
- package/dist/esm/lib/components/panel/panel.component.d.ts +0 -1
- package/dist/esm/lib/components/selection-box/selection-box.component.d.ts +11 -1
- package/dist/esm/lib/components/selection-box/selection-box.component.js +108 -3
- package/dist/esm/lib/components/selection-box/selection-box.component.js.map +1 -1
- package/dist/esm/lib/components/viewport-portal/viewport-portal.component.d.ts +0 -1
- package/dist/esm/lib/container/edge-renderer/edge-renderer.component.d.ts +27 -3
- package/dist/esm/lib/container/edge-renderer/edge-renderer.component.js +151 -61
- package/dist/esm/lib/container/edge-renderer/edge-renderer.component.js.map +1 -1
- package/dist/esm/lib/container/ng-flow/ng-flow.component.d.ts +4 -8
- package/dist/esm/lib/container/ng-flow/ng-flow.component.js +151 -54
- package/dist/esm/lib/container/ng-flow/ng-flow.component.js.map +1 -1
- package/dist/esm/lib/container/node-renderer/node-renderer.component.d.ts +7 -1
- package/dist/esm/lib/container/node-renderer/node-renderer.component.js +70 -14
- package/dist/esm/lib/container/node-renderer/node-renderer.component.js.map +1 -1
- package/dist/esm/lib/container/pane/pane.component.d.ts +0 -1
- package/dist/esm/lib/container/pane/pane.component.js +23 -3
- package/dist/esm/lib/container/pane/pane.component.js.map +1 -1
- package/dist/esm/lib/container/viewport/viewport.component.d.ts +0 -1
- package/dist/esm/lib/directives/drag.directive.d.ts +1 -2
- package/dist/esm/lib/directives/drag.directive.js +1 -1
- package/dist/esm/lib/directives/drag.directive.js.map +1 -1
- package/dist/esm/lib/directives/drop-zone.directive.d.ts +0 -1
- package/dist/esm/lib/directives/key-handler.directive.d.ts +0 -1
- package/dist/esm/lib/directives/key-handler.directive.js +6 -2
- package/dist/esm/lib/directives/key-handler.directive.js.map +1 -1
- package/dist/esm/lib/directives/node-type.directive.d.ts +0 -1
- package/dist/esm/lib/graph/collapse.d.ts +35 -0
- package/dist/esm/lib/graph/collapse.js +102 -0
- package/dist/esm/lib/graph/collapse.js.map +1 -0
- package/dist/esm/lib/graph/group-bounds.d.ts +42 -0
- package/dist/esm/lib/graph/group-bounds.js +34 -0
- package/dist/esm/lib/graph/group-bounds.js.map +1 -0
- package/dist/esm/lib/layout/dagre-layout.d.ts +0 -1
- package/dist/esm/lib/layout/index.d.ts +1 -2
- package/dist/esm/lib/layout/index.js.map +1 -1
- package/dist/esm/lib/layout/layout-nodes.d.ts +39 -5
- package/dist/esm/lib/layout/layout-nodes.js +94 -7
- package/dist/esm/lib/layout/layout-nodes.js.map +1 -1
- package/dist/esm/lib/public-api.d.ts +4 -2
- package/dist/esm/lib/public-api.js +2 -1
- package/dist/esm/lib/public-api.js.map +1 -1
- package/dist/esm/lib/services/flow-store.service.d.ts +25 -2
- package/dist/esm/lib/services/flow-store.service.js +101 -14
- package/dist/esm/lib/services/flow-store.service.js.map +1 -1
- package/dist/esm/lib/services/ng-flow.service.d.ts +82 -7
- package/dist/esm/lib/services/ng-flow.service.js +210 -25
- package/dist/esm/lib/services/ng-flow.service.js.map +1 -1
- package/dist/esm/lib/services/tokens.d.ts +0 -1
- package/dist/esm/lib/types/edges.d.ts +0 -1
- package/dist/esm/lib/types/general.d.ts +0 -1
- package/dist/esm/lib/types/index.d.ts +0 -1
- package/dist/esm/lib/types/node-template.d.ts +2 -1
- package/dist/esm/lib/types/nodes.d.ts +4 -1
- package/dist/esm/lib/types/store.d.ts +0 -1
- package/dist/esm/lib/utils/changes.d.ts +28 -2
- package/dist/esm/lib/utils/changes.js +57 -1
- package/dist/esm/lib/utils/changes.js.map +1 -1
- package/dist/esm/lib/utils/index.d.ts +2 -2
- package/dist/esm/lib/utils/index.js +2 -1
- package/dist/esm/lib/utils/index.js.map +1 -1
- package/dist/esm/lib/utils/inject-flow-store.d.ts +16 -0
- package/dist/esm/lib/utils/inject-flow-store.js +23 -0
- package/dist/esm/lib/utils/inject-flow-store.js.map +1 -0
- package/dist/esm/lib/utils/inject-ng-flow-node.d.ts +0 -1
- package/dist/esm/lib/utils/position-tween.d.ts +0 -1
- package/dist/esm/lib/utils/template-interpolation.d.ts +0 -1
- package/dist/esm/lib/utils/type-guards.d.ts +0 -1
- package/dist/esm/lib/utils/type-guards.js +2 -0
- package/dist/esm/lib/utils/type-guards.js.map +1 -1
- package/dist/esm/test-setup.d.ts +0 -1
- package/dist/style.css +8 -0
- package/package.json +83 -78
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/lib/agent/agent-bridge.service.d.ts.map +0 -1
- package/dist/esm/lib/agent/chat/agent-chat.component.d.ts.map +0 -1
- package/dist/esm/lib/agent/chat/agent-chat.service.d.ts.map +0 -1
- package/dist/esm/lib/agent/chat/default-system-prompt.d.ts.map +0 -1
- package/dist/esm/lib/agent/chat/index.d.ts.map +0 -1
- package/dist/esm/lib/agent/chat/provide-agent-chat.d.ts.map +0 -1
- package/dist/esm/lib/agent/chat/types.d.ts.map +0 -1
- package/dist/esm/lib/agent/history.d.ts.map +0 -1
- package/dist/esm/lib/agent/index.d.ts.map +0 -1
- package/dist/esm/lib/agent/provide-agent-bridge.d.ts.map +0 -1
- package/dist/esm/lib/agent/tool-schemas.d.ts.map +0 -1
- package/dist/esm/lib/agent/transports/websocket.d.ts.map +0 -1
- package/dist/esm/lib/agent/transports/window.d.ts.map +0 -1
- package/dist/esm/lib/agent/types.d.ts.map +0 -1
- package/dist/esm/lib/components/a11y-descriptions/a11y-descriptions.component.d.ts.map +0 -1
- package/dist/esm/lib/components/attribution/attribution.component.d.ts.map +0 -1
- package/dist/esm/lib/components/background/background.component.d.ts.map +0 -1
- package/dist/esm/lib/components/connection-line/connection-line.component.d.ts.map +0 -1
- package/dist/esm/lib/components/controls/controls.component.d.ts.map +0 -1
- package/dist/esm/lib/components/edge-label-renderer/edge-label-renderer.component.d.ts.map +0 -1
- package/dist/esm/lib/components/edge-toolbar/edge-toolbar.component.d.ts.map +0 -1
- package/dist/esm/lib/components/edges/base-edge.component.d.ts.map +0 -1
- package/dist/esm/lib/components/edges/bezier-edge.component.d.ts.map +0 -1
- package/dist/esm/lib/components/edges/edge-text.component.d.ts.map +0 -1
- package/dist/esm/lib/components/edges/simple-bezier-edge.component.d.ts.map +0 -1
- package/dist/esm/lib/components/edges/smooth-step-edge.component.d.ts.map +0 -1
- package/dist/esm/lib/components/edges/step-edge.component.d.ts.map +0 -1
- package/dist/esm/lib/components/edges/straight-edge.component.d.ts.map +0 -1
- package/dist/esm/lib/components/handle/handle.component.d.ts.map +0 -1
- package/dist/esm/lib/components/handle-group/handle-group.component.d.ts.map +0 -1
- package/dist/esm/lib/components/handle-group/handle-row.component.d.ts.map +0 -1
- package/dist/esm/lib/components/minimap/minimap.component.d.ts.map +0 -1
- package/dist/esm/lib/components/ng-flow-provider/ng-flow-provider.component.d.ts.map +0 -1
- package/dist/esm/lib/components/node-resizer/node-resizer.component.d.ts.map +0 -1
- package/dist/esm/lib/components/node-toolbar/node-toolbar.component.d.ts.map +0 -1
- package/dist/esm/lib/components/nodes/default-node.component.d.ts.map +0 -1
- package/dist/esm/lib/components/nodes/group-node.component.d.ts.map +0 -1
- package/dist/esm/lib/components/nodes/input-node.component.d.ts.map +0 -1
- package/dist/esm/lib/components/nodes/output-node.component.d.ts.map +0 -1
- package/dist/esm/lib/components/nodes/template-node.component.d.ts.map +0 -1
- package/dist/esm/lib/components/panel/panel.component.d.ts.map +0 -1
- package/dist/esm/lib/components/selection-box/selection-box.component.d.ts.map +0 -1
- package/dist/esm/lib/components/viewport-portal/viewport-portal.component.d.ts.map +0 -1
- package/dist/esm/lib/container/edge-renderer/edge-renderer.component.d.ts.map +0 -1
- package/dist/esm/lib/container/ng-flow/ng-flow.component.d.ts.map +0 -1
- package/dist/esm/lib/container/node-renderer/node-renderer.component.d.ts.map +0 -1
- package/dist/esm/lib/container/pane/pane.component.d.ts.map +0 -1
- package/dist/esm/lib/container/viewport/viewport.component.d.ts.map +0 -1
- package/dist/esm/lib/directives/drag.directive.d.ts.map +0 -1
- package/dist/esm/lib/directives/drop-zone.directive.d.ts.map +0 -1
- package/dist/esm/lib/directives/key-handler.directive.d.ts.map +0 -1
- package/dist/esm/lib/directives/node-type.directive.d.ts.map +0 -1
- package/dist/esm/lib/layout/dagre-layout.d.ts.map +0 -1
- package/dist/esm/lib/layout/index.d.ts.map +0 -1
- package/dist/esm/lib/layout/layout-nodes.d.ts.map +0 -1
- package/dist/esm/lib/public-api.d.ts.map +0 -1
- package/dist/esm/lib/services/flow-store.service.d.ts.map +0 -1
- package/dist/esm/lib/services/ng-flow.service.d.ts.map +0 -1
- package/dist/esm/lib/services/tokens.d.ts.map +0 -1
- package/dist/esm/lib/types/edges.d.ts.map +0 -1
- package/dist/esm/lib/types/general.d.ts.map +0 -1
- package/dist/esm/lib/types/index.d.ts.map +0 -1
- package/dist/esm/lib/types/node-template.d.ts.map +0 -1
- package/dist/esm/lib/types/nodes.d.ts.map +0 -1
- package/dist/esm/lib/types/store.d.ts.map +0 -1
- package/dist/esm/lib/utils/changes.d.ts.map +0 -1
- package/dist/esm/lib/utils/index.d.ts.map +0 -1
- package/dist/esm/lib/utils/inject-ng-flow-node.d.ts.map +0 -1
- package/dist/esm/lib/utils/position-tween.d.ts.map +0 -1
- package/dist/esm/lib/utils/template-interpolation.d.ts.map +0 -1
- package/dist/esm/lib/utils/type-guards.d.ts.map +0 -1
- package/dist/esm/test-setup.d.ts.map +0 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** Options for {@link getGroupBounds}. */
|
|
2
|
+
export interface GroupBoundsOptions {
|
|
3
|
+
/** Inset on left, right, and bottom. Default 0. */
|
|
4
|
+
padding?: number;
|
|
5
|
+
/** Extra inset on top (for a header/title bar). Default 0. */
|
|
6
|
+
headerHeight?: number;
|
|
7
|
+
/** Minimum box width. Default 0. */
|
|
8
|
+
minWidth?: number;
|
|
9
|
+
/** Minimum box height. Default 0. */
|
|
10
|
+
minHeight?: number;
|
|
11
|
+
}
|
|
12
|
+
/** A computed group box. */
|
|
13
|
+
export interface GroupBounds {
|
|
14
|
+
position: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
};
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
}
|
|
21
|
+
/** Minimal member shape {@link getGroupBounds} reads. */
|
|
22
|
+
interface GroupMember {
|
|
23
|
+
position: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
};
|
|
27
|
+
measured?: {
|
|
28
|
+
width?: number;
|
|
29
|
+
height?: number;
|
|
30
|
+
};
|
|
31
|
+
width?: number | null;
|
|
32
|
+
height?: number | null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Compute the box that wraps `members` with padding and an optional header
|
|
36
|
+
* inset. Coordinate-agnostic: members' positions and the returned position are
|
|
37
|
+
* in the same space (pass absolute members → absolute bounds). Member sizes
|
|
38
|
+
* resolve `measured → width → 0`. With no members, returns a min-sized box at
|
|
39
|
+
* `{0,0}` (the caller positions it).
|
|
40
|
+
*/
|
|
41
|
+
export declare function getGroupBounds(members: ReadonlyArray<GroupMember>, opts?: GroupBoundsOptions): GroupBounds;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compute the box that wraps `members` with padding and an optional header
|
|
3
|
+
* inset. Coordinate-agnostic: members' positions and the returned position are
|
|
4
|
+
* in the same space (pass absolute members → absolute bounds). Member sizes
|
|
5
|
+
* resolve `measured → width → 0`. With no members, returns a min-sized box at
|
|
6
|
+
* `{0,0}` (the caller positions it).
|
|
7
|
+
*/
|
|
8
|
+
export function getGroupBounds(members, opts = {}) {
|
|
9
|
+
const p = opts.padding ?? 0;
|
|
10
|
+
const hh = opts.headerHeight ?? 0;
|
|
11
|
+
const minWidth = opts.minWidth ?? 0;
|
|
12
|
+
const minHeight = opts.minHeight ?? 0;
|
|
13
|
+
if (members.length === 0) {
|
|
14
|
+
return { position: { x: 0, y: 0 }, width: Math.max(minWidth, 2 * p), height: Math.max(minHeight, hh + p) };
|
|
15
|
+
}
|
|
16
|
+
let minX = Infinity;
|
|
17
|
+
let minY = Infinity;
|
|
18
|
+
let maxX = -Infinity;
|
|
19
|
+
let maxY = -Infinity;
|
|
20
|
+
for (const m of members) {
|
|
21
|
+
const w = m.measured?.width ?? m.width ?? 0;
|
|
22
|
+
const h = m.measured?.height ?? m.height ?? 0;
|
|
23
|
+
minX = Math.min(minX, m.position.x);
|
|
24
|
+
minY = Math.min(minY, m.position.y);
|
|
25
|
+
maxX = Math.max(maxX, m.position.x + w);
|
|
26
|
+
maxY = Math.max(maxY, m.position.y + h);
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
position: { x: minX - p, y: minY - hh },
|
|
30
|
+
width: Math.max(minWidth, maxX - minX + 2 * p),
|
|
31
|
+
height: Math.max(minHeight, maxY - minY + hh + p),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=group-bounds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-bounds.js","sourceRoot":"","sources":["../../../../src/lib/graph/group-bounds.ts"],"names":[],"mappings":"AA2BA;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,OAAmC,EAAE,OAA2B,EAAE;IAC/F,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;IAC5B,MAAM,EAAE,GAAG,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC;IAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC;IAEtC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,CAA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utNodes, type LayoutNodesOptions, type LayoutNodeInput } from './layout-nodes';
|
|
1
|
+
export { layoutNodes, type LayoutNodesOptions, type LayoutNodeInput, type LayoutEdgeInput } from './layout-nodes';
|
|
2
2
|
export { dagreLayout } from './dagre-layout';
|
|
3
3
|
export type { AgentLayoutFn, AgentLayoutOptions } from '../types/node-template';
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAuE,MAAM,gBAAgB,CAAC;AAClH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -20,6 +20,24 @@ export interface LayoutNodeInput {
|
|
|
20
20
|
width?: number;
|
|
21
21
|
height?: number;
|
|
22
22
|
};
|
|
23
|
+
/** Group/sub-flow parent id. When present (and in the node set), the node is
|
|
24
|
+
* clustered within that parent via dagre compound layout. */
|
|
25
|
+
parentId?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Minimal structural shape `layoutNodes` reads from each edge. Real angflow
|
|
29
|
+
* `Edge` / `InternalEdge` objects satisfy it as-is. When `labelWidth`/
|
|
30
|
+
* `labelHeight` are present, dagre reserves that space for the label;
|
|
31
|
+
* otherwise a truthy `label` reserves a small default box, and a falsy `label`
|
|
32
|
+
* reserves nothing (current behavior). `applyLayout` fills the measured box
|
|
33
|
+
* from the live DOM.
|
|
34
|
+
*/
|
|
35
|
+
export interface LayoutEdgeInput {
|
|
36
|
+
source: string;
|
|
37
|
+
target: string;
|
|
38
|
+
label?: unknown;
|
|
39
|
+
labelWidth?: number;
|
|
40
|
+
labelHeight?: number;
|
|
23
41
|
}
|
|
24
42
|
/**
|
|
25
43
|
* Standalone dagre auto-layout: returns a map of node id → top-left position
|
|
@@ -36,12 +54,28 @@ export interface LayoutNodeInput {
|
|
|
36
54
|
* `initialWidth`/`initialHeight` → 150×40. Edges referencing ids not present in `nodes` are ignored in the result. Lives in the
|
|
37
55
|
* `@angflow/angular/layout` subpath so `@dagrejs/dagre` (an optional peer
|
|
38
56
|
* dependency) is only pulled into bundles that import it.
|
|
57
|
+
*
|
|
58
|
+
* Prefer `NgFlowService.applyLayout(layoutNodes, …)`: it measures live node
|
|
59
|
+
* footprints and edge-label boxes from the DOM and passes them in, so layout is
|
|
60
|
+
* correct even when `measured` is absent/stale (e.g. the controlled-mode
|
|
61
|
+
* round-trip). Calling `layoutNodes` directly uses only the dimensions on the
|
|
62
|
+
* objects you pass — supply measured nodes (e.g. internal nodes) for best
|
|
63
|
+
* results. Edge labels: pass `labelWidth`/`labelHeight` (or a truthy `label` for
|
|
64
|
+
* a default reservation) to reserve dagre space.
|
|
65
|
+
*
|
|
66
|
+
* Groups: a node with a `parentId` that is also in the input is clustered within
|
|
67
|
+
* that parent (dagre compound layout); nesting is supported. Compound output is
|
|
68
|
+
* in absolute coordinates — apply it with
|
|
69
|
+
* `applyLayout(layoutNodes, { coordinateSpace: 'absolute' })` so parented nodes
|
|
70
|
+
* are translated into their parent-relative space. Group boxes are laid out but
|
|
71
|
+
* NOT resized to wrap their members (size them app-side, or see the auto-size
|
|
72
|
+
* feature). Edges whose endpoints aren't in the node set are skipped.
|
|
73
|
+
* Edges whose source or target is a compound parent are also skipped (dagre
|
|
74
|
+
* cannot rank cluster-touching edges). parentId cycles (of any length) are
|
|
75
|
+
* treated as top-level (matching collapse semantics) — cycle members are
|
|
76
|
+
* detached from each other and laid out as ordinary nodes.
|
|
39
77
|
*/
|
|
40
|
-
export declare function layoutNodes(nodes: LayoutNodeInput[], edges: ReadonlyArray<{
|
|
41
|
-
source: string;
|
|
42
|
-
target: string;
|
|
43
|
-
}>, opts?: LayoutNodesOptions): Record<string, {
|
|
78
|
+
export declare function layoutNodes(nodes: LayoutNodeInput[], edges: ReadonlyArray<LayoutEdgeInput>, opts?: LayoutNodesOptions): Record<string, {
|
|
44
79
|
x: number;
|
|
45
80
|
y: number;
|
|
46
81
|
}>;
|
|
47
|
-
//# sourceMappingURL=layout-nodes.d.ts.map
|
|
@@ -2,6 +2,9 @@ import { graphlib, layout } from '@dagrejs/dagre';
|
|
|
2
2
|
// Match the renderer's unmeasured-node fallbacks (edge-renderer.component.ts).
|
|
3
3
|
const DEFAULT_WIDTH = 150;
|
|
4
4
|
const DEFAULT_HEIGHT = 40;
|
|
5
|
+
// Conservative reservation for a labeled edge whose label box wasn't measured.
|
|
6
|
+
const DEFAULT_LABEL_WIDTH = 60;
|
|
7
|
+
const DEFAULT_LABEL_HEIGHT = 20;
|
|
5
8
|
/**
|
|
6
9
|
* Standalone dagre auto-layout: returns a map of node id → top-left position
|
|
7
10
|
* in flow coordinates. Pure — no store, no DI, callable from anywhere:
|
|
@@ -17,32 +20,116 @@ const DEFAULT_HEIGHT = 40;
|
|
|
17
20
|
* `initialWidth`/`initialHeight` → 150×40. Edges referencing ids not present in `nodes` are ignored in the result. Lives in the
|
|
18
21
|
* `@angflow/angular/layout` subpath so `@dagrejs/dagre` (an optional peer
|
|
19
22
|
* dependency) is only pulled into bundles that import it.
|
|
23
|
+
*
|
|
24
|
+
* Prefer `NgFlowService.applyLayout(layoutNodes, …)`: it measures live node
|
|
25
|
+
* footprints and edge-label boxes from the DOM and passes them in, so layout is
|
|
26
|
+
* correct even when `measured` is absent/stale (e.g. the controlled-mode
|
|
27
|
+
* round-trip). Calling `layoutNodes` directly uses only the dimensions on the
|
|
28
|
+
* objects you pass — supply measured nodes (e.g. internal nodes) for best
|
|
29
|
+
* results. Edge labels: pass `labelWidth`/`labelHeight` (or a truthy `label` for
|
|
30
|
+
* a default reservation) to reserve dagre space.
|
|
31
|
+
*
|
|
32
|
+
* Groups: a node with a `parentId` that is also in the input is clustered within
|
|
33
|
+
* that parent (dagre compound layout); nesting is supported. Compound output is
|
|
34
|
+
* in absolute coordinates — apply it with
|
|
35
|
+
* `applyLayout(layoutNodes, { coordinateSpace: 'absolute' })` so parented nodes
|
|
36
|
+
* are translated into their parent-relative space. Group boxes are laid out but
|
|
37
|
+
* NOT resized to wrap their members (size them app-side, or see the auto-size
|
|
38
|
+
* feature). Edges whose endpoints aren't in the node set are skipped.
|
|
39
|
+
* Edges whose source or target is a compound parent are also skipped (dagre
|
|
40
|
+
* cannot rank cluster-touching edges). parentId cycles (of any length) are
|
|
41
|
+
* treated as top-level (matching collapse semantics) — cycle members are
|
|
42
|
+
* detached from each other and laid out as ordinary nodes.
|
|
20
43
|
*/
|
|
21
44
|
export function layoutNodes(nodes, edges, opts = {}) {
|
|
22
|
-
const
|
|
45
|
+
const ids = new Set(nodes.map((n) => n.id));
|
|
46
|
+
// Build the valid parent-child map: entries where the parent exists in the
|
|
47
|
+
// input set and is not the node itself (self-parent guard).
|
|
48
|
+
const parentOf = new Map();
|
|
49
|
+
for (const n of nodes) {
|
|
50
|
+
if (n.parentId != null && n.parentId !== n.id && ids.has(n.parentId)) {
|
|
51
|
+
parentOf.set(n.id, n.parentId);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Cycle detection: walk each node's parent chain; if the walk revisits a
|
|
55
|
+
// node already seen in this walk, a cycle exists — collect its members and
|
|
56
|
+
// remove them from parentOf so graphlib never sees a cycle.
|
|
57
|
+
// Only actual cycle members are removed; nodes that point INTO a cycle but
|
|
58
|
+
// are not on it (e.g. d→a where a∈cycle) keep their parentOf entry intact
|
|
59
|
+
// (the parent was just demoted to top-level, which is a valid parent).
|
|
60
|
+
const inCycle = new Set();
|
|
61
|
+
for (const start of parentOf.keys()) {
|
|
62
|
+
if (inCycle.has(start))
|
|
63
|
+
continue; // already processed as part of a known cycle
|
|
64
|
+
const seen = new Set();
|
|
65
|
+
let cur = start;
|
|
66
|
+
while (cur !== undefined && parentOf.has(cur)) {
|
|
67
|
+
if (seen.has(cur)) {
|
|
68
|
+
// cur is the entry point of the cycle — trace from cur back to cur
|
|
69
|
+
// to collect exactly the cycle members.
|
|
70
|
+
let walker = cur;
|
|
71
|
+
do {
|
|
72
|
+
inCycle.add(walker);
|
|
73
|
+
walker = parentOf.get(walker);
|
|
74
|
+
} while (walker !== cur);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
seen.add(cur);
|
|
78
|
+
cur = parentOf.get(cur);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
for (const id of inCycle) {
|
|
82
|
+
parentOf.delete(id);
|
|
83
|
+
}
|
|
84
|
+
const compound = parentOf.size > 0;
|
|
85
|
+
const g = new graphlib.Graph(compound ? { compound: true } : undefined);
|
|
23
86
|
g.setGraph({
|
|
24
87
|
rankdir: opts.direction ?? 'TB',
|
|
25
88
|
nodesep: opts.nodeSep ?? 50,
|
|
26
89
|
ranksep: opts.rankSep ?? 80,
|
|
27
90
|
});
|
|
28
91
|
g.setDefaultEdgeLabel(() => ({}));
|
|
29
|
-
const dims = new Map();
|
|
30
92
|
for (const n of nodes) {
|
|
31
93
|
const width = n.measured?.width ?? n.width ?? n.initialWidth ?? DEFAULT_WIDTH;
|
|
32
94
|
const height = n.measured?.height ?? n.height ?? n.initialHeight ?? DEFAULT_HEIGHT;
|
|
33
|
-
dims.set(n.id, { width, height });
|
|
34
95
|
g.setNode(n.id, { width, height });
|
|
35
96
|
}
|
|
97
|
+
const compoundParentIds = new Set();
|
|
98
|
+
if (compound) {
|
|
99
|
+
for (const [child, parent] of parentOf) {
|
|
100
|
+
g.setParent(child, parent);
|
|
101
|
+
compoundParentIds.add(parent);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
36
104
|
for (const e of edges) {
|
|
37
|
-
|
|
105
|
+
// Skip dangling edges: otherwise dagre auto-creates phantom nodes that
|
|
106
|
+
// distort layout (especially compound clusters).
|
|
107
|
+
if (!ids.has(e.source) || !ids.has(e.target))
|
|
108
|
+
continue;
|
|
109
|
+
// Skip edges incident on a compound parent: dagre cannot rank an edge
|
|
110
|
+
// touching a cluster and throws ("Cannot set properties of undefined").
|
|
111
|
+
if (compoundParentIds.has(e.source) || compoundParentIds.has(e.target))
|
|
112
|
+
continue;
|
|
113
|
+
const hasExplicitBox = e.labelWidth != null || e.labelHeight != null;
|
|
114
|
+
if (e.label || hasExplicitBox) {
|
|
115
|
+
g.setEdge(e.source, e.target, {
|
|
116
|
+
width: e.labelWidth ?? DEFAULT_LABEL_WIDTH,
|
|
117
|
+
height: e.labelHeight ?? DEFAULT_LABEL_HEIGHT,
|
|
118
|
+
labelpos: 'c',
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
g.setEdge(e.source, e.target);
|
|
123
|
+
}
|
|
38
124
|
}
|
|
39
125
|
layout(g);
|
|
40
126
|
const positions = {};
|
|
41
127
|
for (const n of nodes) {
|
|
42
128
|
const placed = g.node(n.id);
|
|
43
|
-
|
|
44
|
-
//
|
|
45
|
-
|
|
129
|
+
// dagre positions by center; angflow by top-left. Use dagre's computed
|
|
130
|
+
// width/height so cluster (group) nodes convert by their wrapping size
|
|
131
|
+
// (for leaf nodes this equals the size we set, so flat output is unchanged).
|
|
132
|
+
positions[n.id] = { x: placed.x - placed.width / 2, y: placed.y - placed.height / 2 };
|
|
46
133
|
}
|
|
47
134
|
return positions;
|
|
48
135
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-nodes.js","sourceRoot":"","sources":["../../../../src/lib/layout/layout-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"layout-nodes.js","sourceRoot":"","sources":["../../../../src/lib/layout/layout-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AA2ClD,+EAA+E;AAC/E,MAAM,aAAa,GAA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W,IAAI,oBAAoB;gBAC7C,QAAQ,EAAE,GAAG;aACd,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED,MAAM,CAAC,CAAC,CAAC,CAAC;IAEV,MAAM,SAAS,GAA6C,EAAE,CAAC;IAC/D,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAA4D,CAAC;QACvF,uEAAuE;QACvE,uEAAuE;QACvE,6EAA6E;QAC7E,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;IACxF,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -36,10 +36,12 @@ export { FlowStore } from './services/flow-store.service';
|
|
|
36
36
|
export { NgFlowService } from './services/ng-flow.service';
|
|
37
37
|
export { NODE_ID, EDGE_ID } from './services/tokens';
|
|
38
38
|
export * from './types';
|
|
39
|
-
export { applyNodeChanges, applyEdgeChanges } from './utils/changes';
|
|
39
|
+
export { applyNodeChanges, applyEdgeChanges, applyDimensionChanges } from './utils/changes';
|
|
40
|
+
export type { DisplayEdge } from './graph/collapse';
|
|
41
|
+
export { getGroupBounds } from './graph/group-bounds';
|
|
42
|
+
export type { GroupBounds, GroupBoundsOptions } from './graph/group-bounds';
|
|
40
43
|
export { isNode, isEdge } from './utils/type-guards';
|
|
41
44
|
export { injectNgFlowNode } from './utils/inject-ng-flow-node';
|
|
42
45
|
export { AngflowAgentBridge, provideAgentBridge, AGENT_TOOL_SCHEMAS, WindowTransport, WebSocketTransport, type AgentBridgeConfig, type WindowTransportOptions, type WebSocketTransportOptions, type AgentRequest, type AgentResponse, type AgentSuccessResponse, type AgentErrorResponse, type AgentEvent, type AgentInbound, type AgentOutbound, type AgentTransport, type AgentToolSchema, provideAgentChat, AgentChatService, AgentChatComponent, DEFAULT_AGENT_CHAT_SYSTEM_PROMPT, type AgentChatConfig, type AgentChatRequest, type AgentChatResponse, type CompleteFn, type ChatMessage, type ToolActivity, } from './agent';
|
|
43
46
|
export { ConnectionMode, ConnectionLineType, MarkerType, PanOnScrollMode, Position, SelectionMode, getBezierPath, getSmoothStepPath, getStraightPath, getBezierEdgeCenter, getEdgeCenter, getConnectedEdges, getIncomers, getOutgoers, getNodesBounds, getViewportForBounds, addEdge, reconnectEdge, isEdgeBase, isNodeBase, getMarkerId, getEdgeToolbarTransform, getNodeToolbarTransform, infiniteExtent, } from '@angflow/system';
|
|
44
47
|
export type { XYPosition, XYZPosition, Dimensions, Rect, Box, Transform, CoordinateExtent, Viewport, SnapGrid, KeyCode, ColorMode, ColorModeClass, NodeBase, InternalNodeBase, NodeOrigin, NodeHandleBounds, NodeDragItem, EdgeBase, EdgeMarker, EdgeMarkerType, EdgePosition, DefaultEdgeOptionsBase, Handle as SystemHandle, HandleType, HandleConnection, Connection, ConnectionState, ConnectionInProgress, FinalConnectionState, NoConnection, OnConnect, OnConnectStart, OnConnectEnd, OnConnectStartParams, IsValidConnection as SystemIsValidConnection, NodeChange, NodeDimensionChange, NodePositionChange, NodeSelectionChange, NodeRemoveChange, NodeAddChange, NodeReplaceChange, EdgeChange, EdgeSelectionChange, EdgeRemoveChange, EdgeAddChange, EdgeReplaceChange, OnMove, OnMoveStart, OnMoveEnd, OnError, OnViewportChange, OnReconnect, ViewportHelperFunctionOptions, SetCenterOptions, FitBoundsOptions, PanelPosition, SelectionRect, ProOptions, NodeConnection, ShouldResize, OnResizeStart, OnResize, OnResizeEnd, ControlPosition, ControlLinePosition, ResizeControlVariant, ResizeParams, ResizeParamsWithDirection, ResizeDragEvent, ZIndexMode, BezierPathOptions, SmoothStepPathOptions, GetBezierPathParams, GetSmoothStepPathParams, GetStraightPathParams, AriaLabelConfig, } from '@angflow/system';
|
|
45
|
-
//# sourceMappingURL=public-api.d.ts.map
|
|
@@ -47,7 +47,8 @@ export { NODE_ID, EDGE_ID } from './services/tokens';
|
|
|
47
47
|
// Types
|
|
48
48
|
export * from './types';
|
|
49
49
|
// Utilities
|
|
50
|
-
export { applyNodeChanges, applyEdgeChanges } from './utils/changes';
|
|
50
|
+
export { applyNodeChanges, applyEdgeChanges, applyDimensionChanges } from './utils/changes';
|
|
51
|
+
export { getGroupBounds } from './graph/group-bounds';
|
|
51
52
|
// Wrapper utility functions for Angular-specific typing
|
|
52
53
|
export { isNode, isEdge } from './utils/type-guards';
|
|
53
54
|
// Node injection helper
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-api.js","sourceRoot":"","sources":["../../../src/lib/public-api.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAClB,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0DAA0D,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE5E,kBAAkB;AAClB,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAEnF,kBAAkB;AAClB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0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4BAA4B,CAAC;AAE3D,SAAS;AACT,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAErD,QAAQ;AACR,cAAc,SAAS,CAAC;AAExB,YAAY;AACZ,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE5F,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,wDAAwD;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAErD,wBAAwB;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,eAAe;AACf,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,kBAAkB;AAalB,6EAA6E;AAC7E,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,GAOjC,MAAM,SAAS,CAAC;AAEjB,4CAA4C;AAC5C,OAAO;AACL,oBAAoB;AACpB,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,QAAQ,EACR,aAAa;AAEb,iBAAiB;AACjB,aAAa,EACb,iBAAiB,EACjB,eAAe;AAEf,wBAAwB;AACxB,mBAAmB,EACnB,aAAa;AAEb,kBAAkB;AAClB,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,OAAO,EACP,aAAa,EACb,UAAU,EACV,UAAU;AAEV,mBAAmB;AACnB,WAAW;AAEX,uBAAuB;AACvB,uBAAuB;AAEvB,uBAAuB;AACvB,uBAAuB;AAEvB,YAAY;AACZ,cAAc,GACf,MAAM,iBAAiB,CAAC"}
|
|
@@ -2,7 +2,14 @@ import { OnDestroy, type WritableSignal, type Signal } from '@angular/core';
|
|
|
2
2
|
import { ConnectionMode, type NodeChange, type EdgeChange, type Transform, type Viewport, type PanZoomInstance, type CoordinateExtent, type NodeOrigin, type SnapGrid, type ConnectionState, type SelectionRect, type InternalNodeBase, type NodeLookup, type ParentLookup, type EdgeLookup, type OnError, type ZIndexMode, type FitViewOptionsBase, type HandleType } from '@angflow/system';
|
|
3
3
|
import type { Node, Edge } from '../types';
|
|
4
4
|
import type { NodeTemplateSpec } from '../types/node-template';
|
|
5
|
+
import { type DisplayEdge } from '../graph/collapse';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Content equality for derived string-id sets. Used as a computed `equal` so
|
|
9
|
+
* a recompute that lands on identical membership keeps the previous Set
|
|
10
|
+
* identity and does not notify consumers. Exported for tests.
|
|
11
|
+
*/
|
|
12
|
+
export declare function stringSetEquals(a: ReadonlySet<string>, b: ReadonlySet<string>): boolean;
|
|
6
13
|
export declare class FlowStore<NodeType extends Node = Node, EdgeType extends Edge = Edge> implements OnDestroy {
|
|
7
14
|
readonly rfId: WritableSignal<string>;
|
|
8
15
|
readonly width: WritableSignal<number>;
|
|
@@ -26,6 +33,13 @@ export declare class FlowStore<NodeType extends Node = Node, EdgeType extends Ed
|
|
|
26
33
|
readonly paneDragging: WritableSignal<boolean>;
|
|
27
34
|
readonly nodesSelectionActive: WritableSignal<boolean>;
|
|
28
35
|
readonly userSelectionActive: WritableSignal<boolean>;
|
|
36
|
+
/**
|
|
37
|
+
* Transient flag set by PaneComponent.onMouseUp after a completed marquee
|
|
38
|
+
* drag. Consumed (and reset to false) by NgFlowComponent.onPaneClick so the
|
|
39
|
+
* click synthesised from the same mouseup does not clear the selection box.
|
|
40
|
+
* Ported from React's `selectionInProgress` ref in Pane/index.tsx.
|
|
41
|
+
*/
|
|
42
|
+
readonly selectionInProgress: WritableSignal<boolean>;
|
|
29
43
|
/** Id of the node currently showing Stage 2 floating-drop feedback during a connection drag.
|
|
30
44
|
* Null when no candidate is active or when Stage 1 owns the drop target. */
|
|
31
45
|
readonly connectionTargetNodeId: WritableSignal<string | null>;
|
|
@@ -159,7 +173,9 @@ export declare class FlowStore<NodeType extends Node = Node, EdgeType extends Ed
|
|
|
159
173
|
readonly viewport: Signal<Viewport>;
|
|
160
174
|
readonly selectedNodes: Signal<NodeType[]>;
|
|
161
175
|
readonly selectedEdges: Signal<EdgeType[]>;
|
|
176
|
+
readonly collapsedHiddenIds: Signal<Set<string>>;
|
|
162
177
|
readonly visibleNodes: Signal<InternalNodeBase<NodeType>[]>;
|
|
178
|
+
readonly displayEdges: Signal<DisplayEdge<EdgeType>[]>;
|
|
163
179
|
readonly visibleEdgeIds: Signal<Set<string>>;
|
|
164
180
|
setNodes(nodes: NodeType[]): void;
|
|
165
181
|
setEdges(edges: EdgeType[]): void;
|
|
@@ -201,11 +217,19 @@ export declare class FlowStore<NodeType extends Node = Node, EdgeType extends Ed
|
|
|
201
217
|
y: number;
|
|
202
218
|
}): Promise<boolean>;
|
|
203
219
|
fitView(options?: FitViewOptionsBase<NodeType>): Promise<boolean>;
|
|
220
|
+
/**
|
|
221
|
+
* Set the panZoom instance and drain any fitView queued before it existed.
|
|
222
|
+
* Init order is setNodes (ngOnInit) → panZoom (ngAfterViewInit); a flow whose
|
|
223
|
+
* nodes carry explicit dimensions reports nodesInitialized on that first
|
|
224
|
+
* setNodes, so the queued fit must wait here for panZoom rather than firing
|
|
225
|
+
* against null. Signal-write-driven (no timer): the queue drains exactly once.
|
|
226
|
+
*/
|
|
227
|
+
setPanZoom(panZoom: PanZoomInstance | null): void;
|
|
204
228
|
setCenter(x: number, y: number, options?: {
|
|
205
229
|
zoom?: number;
|
|
206
230
|
duration?: number;
|
|
207
231
|
ease?: (t: number) => number;
|
|
208
|
-
interpolate?:
|
|
232
|
+
interpolate?: 'smooth' | 'linear';
|
|
209
233
|
}): Promise<boolean>;
|
|
210
234
|
setViewport(viewport: Viewport, options?: {
|
|
211
235
|
duration?: number;
|
|
@@ -294,4 +318,3 @@ export declare class FlowStore<NodeType extends Node = Node, EdgeType extends Ed
|
|
|
294
318
|
static ɵfac: i0.ɵɵFactoryDeclaration<FlowStore<any, any>, never>;
|
|
295
319
|
static ɵprov: i0.ɵɵInjectableDeclaration<FlowStore<any, any>>;
|
|
296
320
|
}
|
|
297
|
-
//# sourceMappingURL=flow-store.service.d.ts.map
|