@vanduo-oss/vd3-flowchart 1.2.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/CHANGELOG.md +11 -0
- package/LICENSE +22 -0
- package/README.md +118 -0
- package/SKILL.md +47 -0
- package/dist/core.d.ts +288 -0
- package/dist/index.cjs +3482 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +3459 -0
- package/dist/index.js.map +7 -0
- package/dist/meta.json +133 -0
- package/dist/vd3-flowchart.css +729 -0
- package/dist/vue.d.ts +66 -0
- package/package.json +84 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@vanduo-oss/vd3-flowchart` are documented here.
|
|
4
|
+
|
|
5
|
+
## 1.2.0 — 2026-09-13
|
|
6
|
+
|
|
7
|
+
Extracted from `@vanduo-oss/vd3-cbun@1.4.2` as a standalone package. Component
|
|
8
|
+
API and `VD_FLOWCHART_VERSION` remain `1.2.0` (Vue wrapper + `VdFlowchartCore`,
|
|
9
|
+
`computeLayout`, `LAYOUT_MODES`, `FLOWCHART_*` tables, `{ version, viewport,
|
|
10
|
+
nodes, edges }` serialization, `MAX_NODES`/`MAX_EDGES` caps, `--vd-bg-*`
|
|
11
|
+
chrome). Playwright smoke is new in this repo (cbun never shipped one).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vanduo Open Source Foundation
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# @vanduo-oss/vd3-flowchart
|
|
2
|
+
|
|
3
|
+
[](./LICENSE)
|
|
4
|
+
|
|
5
|
+
Vanduo **flowchart** for Vue 3: a node/edge editor with undo/redo, layout
|
|
6
|
+
modes, and a framework-agnostic core. Extracted 1-to-1 from
|
|
7
|
+
`@vanduo-oss/vd3-cbun` flowchart **1.2.0**.
|
|
8
|
+
|
|
9
|
+
**Status: 1.2.0.** `VD_FLOWCHART_VERSION` matches the package version and is
|
|
10
|
+
**load-bearing** — `toJSON()` writes it into user documents. Do not reset it.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
pnpm add @vanduo-oss/vd3-flowchart
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`vue >=3.3.0` is a **required** peer dependency (the only runtime dep) — install
|
|
19
|
+
it alongside if your project does not already depend on Vue. For correct
|
|
20
|
+
theming, also provide the Vanduo `--vd-*` design tokens (see
|
|
21
|
+
[Theming](#theming)).
|
|
22
|
+
|
|
23
|
+
## Import
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import {
|
|
27
|
+
VdFlowchart,
|
|
28
|
+
VdFlowchartCore,
|
|
29
|
+
computeLayout,
|
|
30
|
+
LAYOUT_MODES,
|
|
31
|
+
FLOWCHART_NODE_TYPES,
|
|
32
|
+
VD_FLOWCHART_VERSION,
|
|
33
|
+
} from '@vanduo-oss/vd3-flowchart';
|
|
34
|
+
import '@vanduo-oss/vd3-flowchart/css';
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Named exports only — no default export. `VdFlowchart` is the Vue wrapper; the
|
|
38
|
+
editor class is re-exported as `VdFlowchartCore` (same class name upstream).
|
|
39
|
+
`computeLayout`, `LAYOUT_MODES`, and the `FLOWCHART_*` tables
|
|
40
|
+
(`FLOWCHART_NODE_TYPES`, `FLOWCHART_PORTS`, `FLOWCHART_EDGE_MARKERS`,
|
|
41
|
+
`FLOWCHART_EDGE_ROUTES`) ship alongside. The core does not import Vue.
|
|
42
|
+
|
|
43
|
+
`vue` is never bundled — it stays external in both the esm and cjs outputs.
|
|
44
|
+
The build emits `dist/meta.json` and **fails** if any input leaves `src/` or
|
|
45
|
+
if anything but `vue` is externalized. The package declares
|
|
46
|
+
`sideEffects: ["**/*.css"]`.
|
|
47
|
+
|
|
48
|
+
## Version policy
|
|
49
|
+
|
|
50
|
+
`package.json` version **is** `VD_FLOWCHART_VERSION` (`1.2.0`). Bump both
|
|
51
|
+
together, and only when the serialized document format changes. This continues
|
|
52
|
+
the old-line `@vanduo-oss/flowchart` lineage (never reset to `1.0.0`). Do not
|
|
53
|
+
reuse the retired npm name `@vanduo-oss/flowchart`.
|
|
54
|
+
|
|
55
|
+
## Theming
|
|
56
|
+
|
|
57
|
+
Flowchart chrome renders against Vanduo `--vd-*` design tokens — the same
|
|
58
|
+
tokens `@vanduo-oss/vd3` defines — with built-in fallbacks. vd3 is not a
|
|
59
|
+
package dependency; any provider of the tokens works.
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
import '@vanduo-oss/vd3/css';
|
|
63
|
+
// …or the tokens-only layer:
|
|
64
|
+
import '@vanduo-oss/vd3/css/core';
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Tokens consumed include `--vd-bg-primary`, `--vd-bg-secondary`,
|
|
68
|
+
`--vd-text-primary`, `--vd-text-muted`, `--vd-border-color`, and
|
|
69
|
+
`--vd-color-primary` (via `--vd-flowchart-*` locals).
|
|
70
|
+
|
|
71
|
+
## Security
|
|
72
|
+
|
|
73
|
+
- **No bundled dependencies** — beyond the `vue` peer, nothing is bundled; the
|
|
74
|
+
build fails if any other module is externalized or any `node_modules` input
|
|
75
|
+
is bundled.
|
|
76
|
+
- **Hardened `.npmrc`:** `ignore-scripts`, `minimum-release-age`, `save-exact`,
|
|
77
|
+
`strict-peer-dependencies`, `trust-policy=no-downgrade`,
|
|
78
|
+
`block-exotic-subdeps`, and an explicit `registry`.
|
|
79
|
+
- **MIT** licensed ([LICENSE](./LICENSE)); toolbar Phosphor paths are inlined
|
|
80
|
+
(MIT) so the package vendors no third-party runtime modules.
|
|
81
|
+
|
|
82
|
+
## Exports
|
|
83
|
+
|
|
84
|
+
| Export | Contents |
|
|
85
|
+
| --- | --- |
|
|
86
|
+
| `@vanduo-oss/vd3-flowchart` | `VdFlowchart` + `VdFlowchartCore`, layout, `FLOWCHART_*`, `VD_FLOWCHART_VERSION` |
|
|
87
|
+
| `@vanduo-oss/vd3-flowchart/css` | Stylesheet (`dist/vd3-flowchart.css`) |
|
|
88
|
+
|
|
89
|
+
## Development
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
pnpm install
|
|
93
|
+
pnpm lint # eslint
|
|
94
|
+
pnpm format:check # prettier
|
|
95
|
+
pnpm stylelint # authored CSS
|
|
96
|
+
pnpm test # vitest (jsdom + node)
|
|
97
|
+
pnpm build # esbuild harness → dist/
|
|
98
|
+
pnpm test:types # tsc --noEmit over tests/types (needs dist/)
|
|
99
|
+
pnpm test:e2e # Playwright Chromium (needs dist/)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`test:types` and `test:e2e` consume the built `dist/` output, so **run
|
|
103
|
+
`pnpm build` first**. Chromium must be installed once:
|
|
104
|
+
`pnpm exec playwright install chromium`.
|
|
105
|
+
|
|
106
|
+
The published package declares a consumer-friendly `engines.node >=20.19.0`;
|
|
107
|
+
the dev/CI toolchain pins Node 24 via `packageManager` +
|
|
108
|
+
`.github/workflows/ci.yml`.
|
|
109
|
+
|
|
110
|
+
## Documentation
|
|
111
|
+
|
|
112
|
+
- Agent / LLM reference — [SKILL.md](./SKILL.md)
|
|
113
|
+
- Contributing — [CONTRIBUTING.md](./CONTRIBUTING.md)
|
|
114
|
+
- Changelog — [CHANGELOG.md](./CHANGELOG.md)
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
[MIT](./LICENSE) © Vanduo Open Source Foundation
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vanduo-vd3-flowchart
|
|
3
|
+
description: Use when adding Vanduo Vue 3 flowchart with @vanduo-oss/vd3-flowchart — node/edge editor, undo/redo, layout modes, and a framework-agnostic core. Covers install, CSS, theming, and the load-bearing VD_FLOWCHART_VERSION 1.2.0.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @vanduo-oss/vd3-flowchart
|
|
7
|
+
|
|
8
|
+
Standalone Vue 3 flowchart package. `vue >=3.3.0` is a required peer. The root
|
|
9
|
+
import re-exports the Vue wrapper AND the framework-agnostic core
|
|
10
|
+
(`VdFlowchartCore`). `VD_FLOWCHART_VERSION` is `1.2.0` and matches
|
|
11
|
+
`package.json`.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
pnpm add @vanduo-oss/vd3-flowchart
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Nothing registers globally. For correct theming, provide the Vanduo `--vd-*`
|
|
20
|
+
design tokens (see [Theming](#theming)).
|
|
21
|
+
|
|
22
|
+
## Flowchart
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import { VdFlowchart, VdFlowchartCore } from '@vanduo-oss/vd3-flowchart';
|
|
26
|
+
import '@vanduo-oss/vd3-flowchart/css';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`VdFlowchart` is the Vue 3 wrapper; the framework-agnostic editor core is the
|
|
30
|
+
same class name upstream, so it is re-exported as `VdFlowchartCore`. The entry
|
|
31
|
+
also re-exports `computeLayout`, `LAYOUT_MODES`, and the `FLOWCHART_*` constant
|
|
32
|
+
tables (`FLOWCHART_NODE_TYPES`, `FLOWCHART_PORTS`, `FLOWCHART_EDGE_MARKERS`,
|
|
33
|
+
`FLOWCHART_EDGE_ROUTES`) plus `VD_FLOWCHART_VERSION`. CSS ships at
|
|
34
|
+
`@vanduo-oss/vd3-flowchart/css`. `VD_FLOWCHART_VERSION` is `1.2.0` — it
|
|
35
|
+
continues the old-line lineage (never reset to `1.0.0`) because the value is
|
|
36
|
+
serialized into user documents via `toJSON().version`; resetting it would
|
|
37
|
+
mislabel documents saved by the old line.
|
|
38
|
+
|
|
39
|
+
## Theming
|
|
40
|
+
|
|
41
|
+
Flowchart uses `--vd-*` tokens (via `--vd-flowchart-*` locals) with built-in
|
|
42
|
+
fallbacks. vd3 is not a package dependency.
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
import '@vanduo-oss/vd3/css';
|
|
46
|
+
import '@vanduo-oss/vd3/css/core';
|
|
47
|
+
```
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
// Type definitions for the framework-agnostic flowchart editor core.
|
|
2
|
+
// Hand-written to mirror the runtime in ./core.js (the vanilla auto-init layer
|
|
3
|
+
// has been excised).
|
|
4
|
+
|
|
5
|
+
export type FlowchartNodeType =
|
|
6
|
+
'rounded-rect' | 'rect' | 'diamond' | 'circle' | 'textbox' | 'label' | 'junction';
|
|
7
|
+
|
|
8
|
+
export type FlowchartPort = 'top' | 'right' | 'bottom' | 'left';
|
|
9
|
+
export type FlowchartEdgeMarker = 'none' | 'arrow' | 'dot';
|
|
10
|
+
export type FlowchartEdgeRoute = 'curve' | 'straight' | 'orthogonal';
|
|
11
|
+
export type FlowchartEdgeKind = 'line' | 'arrow';
|
|
12
|
+
export type FlowchartDirection = 'right' | 'left' | 'up' | 'down';
|
|
13
|
+
export type LayoutMode = 'tree' | 'radial' | 'grid';
|
|
14
|
+
|
|
15
|
+
export interface FlowchartViewport {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
scale: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface FlowchartNode {
|
|
22
|
+
id: string;
|
|
23
|
+
type: FlowchartNodeType;
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
text: string;
|
|
29
|
+
data: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface FlowchartEndpoint {
|
|
33
|
+
nodeId: string;
|
|
34
|
+
port: FlowchartPort;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface FlowchartEdge {
|
|
38
|
+
id: string;
|
|
39
|
+
from: FlowchartEndpoint;
|
|
40
|
+
to: FlowchartEndpoint;
|
|
41
|
+
kind: FlowchartEdgeKind;
|
|
42
|
+
startMarker: FlowchartEdgeMarker;
|
|
43
|
+
endMarker: FlowchartEdgeMarker;
|
|
44
|
+
strokeWidth: number;
|
|
45
|
+
route: FlowchartEdgeRoute;
|
|
46
|
+
label: string;
|
|
47
|
+
data: Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface FlowchartDocument {
|
|
51
|
+
version: string;
|
|
52
|
+
viewport: FlowchartViewport;
|
|
53
|
+
nodes: FlowchartNode[];
|
|
54
|
+
edges: FlowchartEdge[];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Snapshot delivered by the `select` event and `getSelectionSnapshot()`. */
|
|
58
|
+
export type FlowchartSelection =
|
|
59
|
+
| { kind: 'node'; id: string; node: FlowchartNode }
|
|
60
|
+
| { kind: 'edge'; id: string; edge: FlowchartEdge };
|
|
61
|
+
|
|
62
|
+
/** Reference to an anchor node for relative placement. */
|
|
63
|
+
export interface FlowchartRelativeTo {
|
|
64
|
+
node?: string;
|
|
65
|
+
nodeId?: string;
|
|
66
|
+
id?: string;
|
|
67
|
+
direction?: FlowchartDirection;
|
|
68
|
+
distance?: number;
|
|
69
|
+
/** Angle in degrees, screen space (0 = right, 90 = down). Overrides direction. */
|
|
70
|
+
angle?: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface FlowchartNodeInput {
|
|
74
|
+
id?: string;
|
|
75
|
+
type?: FlowchartNodeType;
|
|
76
|
+
x?: number;
|
|
77
|
+
y?: number;
|
|
78
|
+
width?: number;
|
|
79
|
+
height?: number;
|
|
80
|
+
text?: string;
|
|
81
|
+
data?: Record<string, unknown>;
|
|
82
|
+
/** Place relative to another node instead of at the viewport center. */
|
|
83
|
+
relativeTo?: string | FlowchartRelativeTo;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface FlowchartEndpointInput {
|
|
87
|
+
nodeId?: string;
|
|
88
|
+
port?: FlowchartPort;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface FlowchartEdgeInput {
|
|
92
|
+
id?: string;
|
|
93
|
+
from?: string | FlowchartEndpointInput;
|
|
94
|
+
to?: string | FlowchartEndpointInput;
|
|
95
|
+
/** Infer omitted ports from node geometry. */
|
|
96
|
+
autoPort?: boolean;
|
|
97
|
+
kind?: FlowchartEdgeKind;
|
|
98
|
+
startMarker?: FlowchartEdgeMarker;
|
|
99
|
+
endMarker?: FlowchartEdgeMarker;
|
|
100
|
+
strokeWidth?: number;
|
|
101
|
+
route?: FlowchartEdgeRoute;
|
|
102
|
+
label?: string;
|
|
103
|
+
data?: Record<string, unknown>;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface AddChildNodeOptions extends FlowchartNodeInput {
|
|
107
|
+
direction?: FlowchartDirection;
|
|
108
|
+
distance?: number;
|
|
109
|
+
angle?: number;
|
|
110
|
+
/** Extra options merged into the parent → child edge. */
|
|
111
|
+
edge?: FlowchartEdgeInput;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface LayoutOptions {
|
|
115
|
+
/** Force a specific root node id; defaults to nodes with no incoming edges. */
|
|
116
|
+
root?: string;
|
|
117
|
+
direction?: FlowchartDirection;
|
|
118
|
+
levelGap?: number;
|
|
119
|
+
siblingGap?: number;
|
|
120
|
+
radius?: number;
|
|
121
|
+
columns?: number;
|
|
122
|
+
gap?: number;
|
|
123
|
+
/** Re-pick edge ports after moving nodes (default true). */
|
|
124
|
+
reroutePorts?: boolean;
|
|
125
|
+
/** Call fitView() after arranging. */
|
|
126
|
+
fit?: boolean;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface MutationOptions {
|
|
130
|
+
reason?: string;
|
|
131
|
+
inspector?: boolean;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface LoadOptions {
|
|
135
|
+
/** Keep the prior selection if the entity still exists after load. */
|
|
136
|
+
preserveSelection?: boolean;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface RemoveNodeOptions {
|
|
140
|
+
/** Also remove every node reachable through outgoing edges (cycle-safe). */
|
|
141
|
+
cascade?: boolean;
|
|
142
|
+
reason?: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface FlowchartChangeEvent {
|
|
146
|
+
reason: string;
|
|
147
|
+
document: FlowchartDocument;
|
|
148
|
+
node?: FlowchartNode;
|
|
149
|
+
edge?: FlowchartEdge;
|
|
150
|
+
nodeId?: string;
|
|
151
|
+
nodeIds?: string[];
|
|
152
|
+
edgeId?: string;
|
|
153
|
+
mode?: LayoutMode;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface FlowchartSelectEvent {
|
|
157
|
+
selection: FlowchartSelection | null;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface FlowchartViewportEvent {
|
|
161
|
+
reason: string;
|
|
162
|
+
viewport: FlowchartViewport;
|
|
163
|
+
document: FlowchartDocument;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface FlowchartConnectEvent {
|
|
167
|
+
edge: FlowchartEdge;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface FlowchartHistoryEvent {
|
|
171
|
+
reason: string;
|
|
172
|
+
canUndo: boolean;
|
|
173
|
+
canRedo: boolean;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface FlowchartEventMap {
|
|
177
|
+
change: FlowchartChangeEvent;
|
|
178
|
+
select: FlowchartSelectEvent;
|
|
179
|
+
viewport: FlowchartViewportEvent;
|
|
180
|
+
connect: FlowchartConnectEvent;
|
|
181
|
+
history: FlowchartHistoryEvent;
|
|
182
|
+
ready: VdFlowchart;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface VdFlowchartOptions {
|
|
186
|
+
element?: Element | string;
|
|
187
|
+
/** Alias for `element`. */
|
|
188
|
+
target?: Element | string;
|
|
189
|
+
data?: Partial<FlowchartDocument> | string;
|
|
190
|
+
readonly?: boolean;
|
|
191
|
+
gridSize?: number;
|
|
192
|
+
/** Fit to content once the canvas reports a measurable size. */
|
|
193
|
+
autoFit?: boolean;
|
|
194
|
+
/** Enable built-in undo/redo (default true). */
|
|
195
|
+
history?: boolean;
|
|
196
|
+
/** Maximum retained history entries (default 100). */
|
|
197
|
+
historyLimit?: number;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export class VdFlowchart {
|
|
201
|
+
constructor(options?: VdFlowchartOptions);
|
|
202
|
+
|
|
203
|
+
readonly element: Element;
|
|
204
|
+
readonly readonly: boolean;
|
|
205
|
+
readonly gridSize: number;
|
|
206
|
+
|
|
207
|
+
// Selection
|
|
208
|
+
select(selection: { kind: 'node' | 'edge'; id: string } | null): void;
|
|
209
|
+
selectNode(nodeId: string): this;
|
|
210
|
+
selectEdge(edgeId: string): this;
|
|
211
|
+
deselect(): this;
|
|
212
|
+
|
|
213
|
+
// Events
|
|
214
|
+
on<K extends keyof FlowchartEventMap>(
|
|
215
|
+
event: K,
|
|
216
|
+
callback: (payload: FlowchartEventMap[K]) => void,
|
|
217
|
+
): this;
|
|
218
|
+
off<K extends keyof FlowchartEventMap>(
|
|
219
|
+
event: K,
|
|
220
|
+
callback: (payload: FlowchartEventMap[K]) => void,
|
|
221
|
+
): this;
|
|
222
|
+
|
|
223
|
+
// Nodes & edges
|
|
224
|
+
addNode(partialNode?: FlowchartNodeInput): FlowchartNode;
|
|
225
|
+
addChildNode(
|
|
226
|
+
parentId: string,
|
|
227
|
+
options?: AddChildNodeOptions,
|
|
228
|
+
): { node: FlowchartNode; edge: FlowchartEdge | null } | null;
|
|
229
|
+
updateNode(
|
|
230
|
+
nodeId: string,
|
|
231
|
+
patch?: Partial<FlowchartNodeInput>,
|
|
232
|
+
options?: MutationOptions,
|
|
233
|
+
): FlowchartNode | null;
|
|
234
|
+
removeNode(nodeId: string, options?: RemoveNodeOptions): boolean;
|
|
235
|
+
addEdge(partialEdge?: FlowchartEdgeInput): FlowchartEdge | null;
|
|
236
|
+
updateEdge(
|
|
237
|
+
edgeId: string,
|
|
238
|
+
patch?: FlowchartEdgeInput,
|
|
239
|
+
options?: MutationOptions,
|
|
240
|
+
): FlowchartEdge | null;
|
|
241
|
+
removeEdge(edgeId: string): boolean;
|
|
242
|
+
deleteSelection(): boolean;
|
|
243
|
+
|
|
244
|
+
// Layout
|
|
245
|
+
layout(mode?: LayoutMode, options?: LayoutOptions): this;
|
|
246
|
+
autoArrange(options?: LayoutOptions): this;
|
|
247
|
+
|
|
248
|
+
// History
|
|
249
|
+
undo(): this;
|
|
250
|
+
redo(): this;
|
|
251
|
+
canUndo(): boolean;
|
|
252
|
+
canRedo(): boolean;
|
|
253
|
+
clearHistory(): this;
|
|
254
|
+
|
|
255
|
+
// Viewport
|
|
256
|
+
setViewport(viewport: Partial<FlowchartViewport>): this;
|
|
257
|
+
zoomIn(): this;
|
|
258
|
+
zoomOut(): this;
|
|
259
|
+
resetView(): this;
|
|
260
|
+
fitView(): this;
|
|
261
|
+
|
|
262
|
+
// Document
|
|
263
|
+
clear(): this;
|
|
264
|
+
load(data: Partial<FlowchartDocument> | string, options?: LoadOptions): this;
|
|
265
|
+
toJSON(): FlowchartDocument;
|
|
266
|
+
|
|
267
|
+
// Text editing
|
|
268
|
+
startTextEdit(nodeId: string): boolean;
|
|
269
|
+
stopTextEdit(options?: { commit?: boolean }): void;
|
|
270
|
+
|
|
271
|
+
// Lifecycle
|
|
272
|
+
destroy(): void;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** Pure layout helper: computes node top-left positions without mutating input. */
|
|
276
|
+
export function computeLayout(
|
|
277
|
+
documentData: Partial<FlowchartDocument>,
|
|
278
|
+
mode?: LayoutMode,
|
|
279
|
+
options?: LayoutOptions,
|
|
280
|
+
): Map<string, { x: number; y: number }>;
|
|
281
|
+
|
|
282
|
+
export const LAYOUT_MODES: readonly LayoutMode[];
|
|
283
|
+
|
|
284
|
+
export const VD_FLOWCHART_VERSION: string;
|
|
285
|
+
export const FLOWCHART_NODE_TYPES: readonly FlowchartNodeType[];
|
|
286
|
+
export const FLOWCHART_PORTS: readonly FlowchartPort[];
|
|
287
|
+
export const FLOWCHART_EDGE_MARKERS: readonly FlowchartEdgeMarker[];
|
|
288
|
+
export const FLOWCHART_EDGE_ROUTES: readonly FlowchartEdgeRoute[];
|