@vanduo-oss/vd3-flowchart 1.3.0 → 1.5.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 +93 -0
- package/README.md +75 -8
- package/SKILL.md +32 -3
- package/dist/core.d.ts +105 -2
- package/dist/index.cjs +1937 -265
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1937 -265
- package/dist/index.js.map +4 -4
- package/dist/meta.json +29 -12
- package/dist/vd3-flowchart.css +190 -12
- package/dist/vue.d.ts +18 -0
- package/package.json +5 -2
- package/recipes/editor.vue +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,99 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@vanduo-oss/vd3-flowchart` are documented here.
|
|
4
4
|
|
|
5
|
+
## 1.5.0 — 2026-10-25
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Opt-in `minScale` and `maxScale` (default `0.35` and `3`) and `minNodeSize`
|
|
10
|
+
and `maxNodeSize` (default `56` and `420`). Junctions stay fixed-size.
|
|
11
|
+
Hosts that need a closer and wider view, including Oolaflow, can pass
|
|
12
|
+
`0.05`–`20` and `6`–`4800`.
|
|
13
|
+
- Viewport scale is stored to four decimal places, so a zoom step still moves
|
|
14
|
+
near 5%. Other geometry stays at two decimal places.
|
|
15
|
+
- Nodes smaller than their default size scale text, wrapping, radius, stroke,
|
|
16
|
+
markers, curve arms, orthogonal routes, labels, and inline editors in
|
|
17
|
+
proportion. Larger nodes do not grow that chrome.
|
|
18
|
+
- A wider camera range uses a 240,000-unit grid with spacing that stays
|
|
19
|
+
readable at 5% and 2000%. The default range keeps the 12,000-unit grid.
|
|
20
|
+
- `fitNode(nodeId, padding?)` frames one visible node. Unknown and hidden
|
|
21
|
+
nodes do nothing.
|
|
22
|
+
|
|
23
|
+
### Compatibility
|
|
24
|
+
|
|
25
|
+
- No methods were removed. Omitting the new options keeps 1.4.0 camera and
|
|
26
|
+
node limits.
|
|
27
|
+
- `FLOWCHART_DOCUMENT_VERSION` stays `1.3.0`. Older 1.x documents still load.
|
|
28
|
+
A 1.5.0 document still loads in 1.4.0, where the old clamps apply.
|
|
29
|
+
- This release does not add nested containers, suggestion overlays, floating
|
|
30
|
+
panels, or an export API.
|
|
31
|
+
|
|
32
|
+
## 1.4.0 — 2026-10-03
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- **Behavior change:** with the new default `keyboardShortcuts: 'mindmap'`,
|
|
37
|
+
Enter on a selected node adds a sibling; F2, Space, or typing edits the
|
|
38
|
+
label. While editing, Enter saves (Shift+Enter: new line; textbox nodes keep
|
|
39
|
+
Enter for a new line). Use `keyboardShortcuts: 'basic'` for the 1.3.0 keys.
|
|
40
|
+
- Arrow keys select the nearest node in that direction instead of cycling
|
|
41
|
+
through document order.
|
|
42
|
+
- Selected nodes no longer draw side resize dots; sides resize by dragging the
|
|
43
|
+
edge. Corner handles are squares on a slightly outset frame.
|
|
44
|
+
- Connection handles sit outside each side, appear on hover as well as on
|
|
45
|
+
selection, and no longer shift on hover (the scale transform used the node
|
|
46
|
+
origin).
|
|
47
|
+
- **Document format 1.3.0:** nodes may carry `collapsed: true` (written only
|
|
48
|
+
on collapsed nodes). Every 1.x document through 1.3.0 still loads; packages
|
|
49
|
+
older than 1.4.0 reject 1.3.0 files as a future version.
|
|
50
|
+
- Double-clicking a connection edits its label instead of entering reconnect
|
|
51
|
+
mode (a single click already shows the reconnect endpoints).
|
|
52
|
+
- The `select` event payload adds `nodeIds`; `selection` keeps its shape.
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
|
|
56
|
+
- `keyboardShortcuts` option and Vue prop (`'mindmap' | 'basic'`) with
|
|
57
|
+
`FLOWCHART_KEYBOARD_SHORTCUTS`. Mind-map keys: Tab adds a child, Enter /
|
|
58
|
+
Shift+Enter add a sibling below / above, Tab while editing saves and adds a
|
|
59
|
+
child. All modes: Alt+Arrow nudge (Shift for 1 px), Cmd/Ctrl+D duplicate,
|
|
60
|
+
Cmd/Ctrl + `=` / `-` / `0` zoom, Shift+1 fit, staged Esc, and a `?` overlay
|
|
61
|
+
(also on the toolbar). Shift+Tab is never captured.
|
|
62
|
+
- Clicking a connection handle adds a connected node in that direction and
|
|
63
|
+
opens it for editing; dragging still connects.
|
|
64
|
+
- `insertBranchNode()`, `insertSiblingNode()`, `navigateSelection()`,
|
|
65
|
+
`nudgeNode()`, `duplicateSelection()`, `zoomTo()`, `revealNode()`, and
|
|
66
|
+
`toggleShortcutsHelp()`; `startTextEdit()` accepts `{ initialText }`.
|
|
67
|
+
- Dashed selection frame for circle, diamond, and label nodes.
|
|
68
|
+
- Multi-select: Shift+click toggles, Shift+drag on empty canvas draws a
|
|
69
|
+
marquee, Cmd/Ctrl+A selects all. Groups drag, nudge, copy, cut, paste,
|
|
70
|
+
duplicate (with internal connections), and delete as one undo step each.
|
|
71
|
+
`selectNodes()`, `toggleNodeSelection()`, `getSelectedNodeIds()`,
|
|
72
|
+
`isNodeSelected()`, `nudgeNodes()`.
|
|
73
|
+
- Collapsible branches with a "+N" badge, a "−" toggle on a selected parent,
|
|
74
|
+
and Cmd/Ctrl+/; hidden nodes are skipped by navigation, fit, minimap,
|
|
75
|
+
guides, connection targets, and selection. `setCollapsed()`,
|
|
76
|
+
`toggleCollapsed()`, `getVisibleNodes()`, `isNodeHidden()`.
|
|
77
|
+
- Connection labels from the keyboard: Shift+Arrow selects a node's connection
|
|
78
|
+
on that side (repeat to cycle); Enter, F2, or typing edits inline; arrows
|
|
79
|
+
move to the end nodes. `startEdgeLabelEdit()`, `selectSideEdge()`.
|
|
80
|
+
- Alignment guides while dragging, with Alt to bypass; `snapGuides` option.
|
|
81
|
+
- Minimap with click/drag panning, a toolbar toggle, and the `minimap` option;
|
|
82
|
+
it hides on canvases narrower than 480px. `setMinimapEnabled()`,
|
|
83
|
+
`centerViewOn()`.
|
|
84
|
+
- `autoLayout` option: re-run the current tree or radial layout after
|
|
85
|
+
keyboard or handle insertions, in the same undo step.
|
|
86
|
+
|
|
87
|
+
### Fixed
|
|
88
|
+
|
|
89
|
+
- A node and its edge from `addChildNode()`, a handle click, or the keyboard
|
|
90
|
+
undo in one step; naming a just-inserted node joins that step. New branch
|
|
91
|
+
edges copy the sibling's or parent's edge style.
|
|
92
|
+
- Deleting a node from the keyboard selects its parent.
|
|
93
|
+
- The palette "Shapes" title no longer wraps mid-word in narrow columns.
|
|
94
|
+
- Inserted sibling connections keep sibling order for tree and radial layouts.
|
|
95
|
+
- The label editor no longer re-selects text that the user has already
|
|
96
|
+
started typing.
|
|
97
|
+
|
|
5
98
|
## 1.3.0 — 2026-09-17
|
|
6
99
|
|
|
7
100
|
### Added
|
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@ Vanduo **flowchart** for Vue 3: a node/edge editor with undo/redo, layout
|
|
|
6
6
|
modes, and a framework-agnostic core. Extracted 1-to-1 from
|
|
7
7
|
`@vanduo-oss/vd3-cbun` flowchart **1.2.0**.
|
|
8
8
|
|
|
9
|
-
**Status: 1.
|
|
10
|
-
`FLOWCHART_DOCUMENT_VERSION` (currently `1.
|
|
9
|
+
**Status: 1.5.0.** `VD_FLOWCHART_VERSION` tracks the package release.
|
|
10
|
+
`FLOWCHART_DOCUMENT_VERSION` (currently `1.3.0`) is the value `toJSON()`
|
|
11
11
|
writes. Do not reset either independently without a compatibility plan.
|
|
12
12
|
|
|
13
13
|
## Install
|
|
@@ -40,7 +40,8 @@ Named exports only — no default export. `VdFlowchart` is the Vue wrapper; the
|
|
|
40
40
|
editor class is re-exported as `VdFlowchartCore` (same class name upstream).
|
|
41
41
|
`computeLayout`, `LAYOUT_MODES`, and the `FLOWCHART_*` tables
|
|
42
42
|
(`FLOWCHART_NODE_TYPES`, `FLOWCHART_PORTS`, `FLOWCHART_EDGE_MARKERS`,
|
|
43
|
-
`FLOWCHART_EDGE_ROUTES`) ship alongside. The
|
|
43
|
+
`FLOWCHART_EDGE_ROUTES`, `FLOWCHART_KEYBOARD_SHORTCUTS`) ship alongside. The
|
|
44
|
+
core does not import Vue.
|
|
44
45
|
|
|
45
46
|
`vue` is never bundled — it stays external in both the esm and cjs outputs.
|
|
46
47
|
The build emits `dist/meta.json` and **fails** if any input leaves `src/` or
|
|
@@ -49,15 +50,79 @@ if anything but `vue` is externalized. The package declares
|
|
|
49
50
|
|
|
50
51
|
## Version policy
|
|
51
52
|
|
|
52
|
-
`package.json` version **is** `VD_FLOWCHART_VERSION` (`1.
|
|
53
|
+
`package.json` version **is** `VD_FLOWCHART_VERSION` (`1.5.0`). Bump those
|
|
53
54
|
together for a package release. Keep `FLOWCHART_DOCUMENT_VERSION` unchanged
|
|
54
55
|
unless the serialized schema changes; add fixtures and explicit compatibility
|
|
55
|
-
rules for a format change. Unversioned 1.x documents through 1.
|
|
56
|
+
rules for a format change. Unversioned 1.x documents through 1.3.0 still load;
|
|
57
|
+
1.3.0 added the optional node field `collapsed: true`, written only on
|
|
58
|
+
collapsed nodes.
|
|
56
59
|
Malformed JSON and unsupported future versions throw before the active
|
|
57
60
|
document, selection, or history change. This continues the old-line
|
|
58
61
|
`@vanduo-oss/flowchart` lineage (never reset to `1.0.0`). Do not reuse the
|
|
59
62
|
retired npm name `@vanduo-oss/flowchart`.
|
|
60
63
|
|
|
64
|
+
## Editing and keyboard
|
|
65
|
+
|
|
66
|
+
Hover or select a node to show a connection handle outside each side. Drag a
|
|
67
|
+
handle to connect; click it to add a connected node in that direction. Resize
|
|
68
|
+
from the corner squares or by dragging a side. Dragged nodes snap to other
|
|
69
|
+
nodes' edges and centres (hold Alt to bypass; `snapGuides: false` turns it
|
|
70
|
+
off). Shift+click or Shift+drag on empty canvas selects several nodes, which
|
|
71
|
+
then move, nudge, copy, duplicate, and delete together. A collapsed branch
|
|
72
|
+
shows a "+N" badge; click it or press Cmd/Ctrl+/ to toggle. The minimap in
|
|
73
|
+
the canvas corner pans the view (`minimap: false` or the toolbar toggle hides
|
|
74
|
+
it). Double-click a connection to edit its label. Set `autoLayout: true` to
|
|
75
|
+
re-run the current tree or radial layout after each keyboard or handle
|
|
76
|
+
insertion.
|
|
77
|
+
|
|
78
|
+
With the canvas focused, the default `keyboardShortcuts: 'mindmap'` mode
|
|
79
|
+
follows mind-map tools such as XMind and MindNode:
|
|
80
|
+
|
|
81
|
+
| Keys | Action |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| Arrow keys | Select the nearest node in that direction |
|
|
84
|
+
| Shift+Arrow | Select a connection on that side (repeat to cycle) |
|
|
85
|
+
| Enter, F2, or typing on a connection | Edit its label |
|
|
86
|
+
| Cmd/Ctrl+A | Select all nodes |
|
|
87
|
+
| Cmd/Ctrl+/ | Collapse or expand the branch |
|
|
88
|
+
| Tab | Add a child node and edit it |
|
|
89
|
+
| Enter / Shift+Enter | Add a sibling below / above and edit it |
|
|
90
|
+
| F2, Space, or typing | Edit the label |
|
|
91
|
+
| Enter / Tab while editing | Save / save and add a child (Shift+Enter: new line) |
|
|
92
|
+
| Alt+Arrow (Shift for 1 px) | Nudge the node by one grid step |
|
|
93
|
+
| Cmd/Ctrl+D | Duplicate the node |
|
|
94
|
+
| Cmd/Ctrl + `=` / `-` / `0`, Shift+1 | Zoom in, out, 100%, fit |
|
|
95
|
+
| Esc | Cancel editing, then the tool, then deselect |
|
|
96
|
+
| Shift+Tab, or Esc then Tab | Leave the canvas |
|
|
97
|
+
| `?` | Show all shortcuts |
|
|
98
|
+
|
|
99
|
+
`keyboardShortcuts: 'basic'` keeps Tab for focus movement; Enter or F2 edits and
|
|
100
|
+
Ctrl/Cmd+Enter saves. A node plus its edge is one undo step, and naming a
|
|
101
|
+
just-inserted node joins that step.
|
|
102
|
+
|
|
103
|
+
## Camera and node bounds
|
|
104
|
+
|
|
105
|
+
`minScale` / `maxScale` default to `0.35` / `3`, and `minNodeSize` /
|
|
106
|
+
`maxNodeSize` default to `56` / `420`. Pass a finite pair to widen either
|
|
107
|
+
range; an invalid pair falls back to those defaults. Junctions stay 28×28.
|
|
108
|
+
`fitNode(id, padding)` frames one visible node. Padding is screen pixels.
|
|
109
|
+
Scale is stored to four decimal places. Nodes smaller than their default size
|
|
110
|
+
scale their text, markers, and routes down with them. The default grid stays
|
|
111
|
+
12,000 units; a wider camera uses a 240,000-unit grid.
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
new VdFlowchartCore({
|
|
115
|
+
element: '#editor',
|
|
116
|
+
minScale: 0.05,
|
|
117
|
+
maxScale: 20,
|
|
118
|
+
minNodeSize: 6,
|
|
119
|
+
maxNodeSize: 4800,
|
|
120
|
+
});
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The same four names are Vue props. The document format is unchanged: scale and
|
|
124
|
+
size remain plain numbers.
|
|
125
|
+
|
|
61
126
|
## Theming
|
|
62
127
|
|
|
63
128
|
Flowchart chrome renders against Vanduo `--vd-*` design tokens — the same
|
|
@@ -127,9 +192,11 @@ pnpm test:e2e # Playwright Chromium (needs dist/)
|
|
|
127
192
|
`pnpm build` first**. Chromium must be installed once:
|
|
128
193
|
`pnpm exec playwright install chromium`.
|
|
129
194
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
195
|
+
Node 24 LTS is the supported development and CI runtime; run `nvm use` to select
|
|
196
|
+
it for this repository from `.nvmrc`. The existing `engines.node >=20.19.0`
|
|
197
|
+
range remains a temporary consumer compatibility floor, tested on a best-effort
|
|
198
|
+
basis until the next major release; it is not the recommended development
|
|
199
|
+
runtime.
|
|
133
200
|
|
|
134
201
|
## Documentation
|
|
135
202
|
|
package/SKILL.md
CHANGED
|
@@ -27,12 +27,41 @@ future versions and malformed JSON are rejected before changing current work.
|
|
|
27
27
|
`FLOWCHART_DOCUMENT_VERSION` describes saved JSON; `VD_FLOWCHART_VERSION`
|
|
28
28
|
describes the package release. Do not replace document versions with app versions.
|
|
29
29
|
|
|
30
|
+
## Keyboard
|
|
31
|
+
|
|
32
|
+
`keyboardShortcuts` defaults to `'mindmap'`: with a node selected on the focused
|
|
33
|
+
canvas, Tab adds a child, Enter adds a sibling (Shift+Enter above), and F2, Space,
|
|
34
|
+
or typing edits the label. While editing, Enter saves and Tab saves and adds a
|
|
35
|
+
child. Arrows select the nearest node in that direction; Alt+Arrow nudges.
|
|
36
|
+
Shift+Tab, or Esc then Tab, leaves the canvas. `?` lists every shortcut. Use
|
|
37
|
+
`'basic'` when Tab must always move focus; Enter then edits and Ctrl/Cmd+Enter
|
|
38
|
+
saves. A node plus its edge, and naming a just-inserted node, undo in one step.
|
|
39
|
+
Shift+Arrow selects a connection on that side; Enter, F2, or typing edits its
|
|
40
|
+
label. Shift+click, Shift+drag, and Cmd/Ctrl+A select several nodes (the
|
|
41
|
+
`select` event lists them in `nodeIds`). Cmd/Ctrl+/ collapses a branch.
|
|
42
|
+
|
|
43
|
+
## Canvas options
|
|
44
|
+
|
|
45
|
+
`snapGuides` (default true) snaps drags to alignment guides; `minimap`
|
|
46
|
+
(default true) shows the overview; `autoLayout` (default false) re-runs the
|
|
47
|
+
current tree or radial layout after insertions. Saved JSON uses document
|
|
48
|
+
format 1.3.0, which adds `collapsed: true` on collapsed nodes only.
|
|
49
|
+
|
|
50
|
+
## Deep zoom
|
|
51
|
+
|
|
52
|
+
`minScale` and `maxScale` default to `0.35` and `3`. `minNodeSize` and
|
|
53
|
+
`maxNodeSize` default to `56` and `420`. Pass both ends of a pair to opt into
|
|
54
|
+
a wider camera or smaller and larger nodes. Junctions stay fixed-size.
|
|
55
|
+
`getInstance().fitNode(id, padding)` frames one visible node. A node smaller
|
|
56
|
+
than its default size scales its text, markers, and connectors with it. Saved
|
|
57
|
+
JSON stays document format 1.3.0.
|
|
58
|
+
|
|
30
59
|
## Verification
|
|
31
60
|
|
|
32
61
|
Add a node, toggle read-only, and confirm the edit remains. Undo/redo, save/reload,
|
|
33
|
-
and echo a change back through `data`. With only the keyboard,
|
|
34
|
-
|
|
35
|
-
|
|
62
|
+
and echo a change back through `data`. With only the keyboard, build a small map
|
|
63
|
+
with Tab, typing, and Enter, move with arrows, and use Graph outline to read
|
|
64
|
+
relationships and connect nodes. Check the consumer's screen reader.
|
|
36
65
|
|
|
37
66
|
Use [Vue declarations](dist/vue.d.ts) for component props/events/exposed methods
|
|
38
67
|
and [core declarations](dist/core.d.ts) for document types and editor methods.
|
package/dist/core.d.ts
CHANGED
|
@@ -11,6 +11,11 @@ export type FlowchartEdgeRoute = 'curve' | 'straight' | 'orthogonal';
|
|
|
11
11
|
export type FlowchartEdgeKind = 'line' | 'arrow';
|
|
12
12
|
export type FlowchartDirection = 'right' | 'left' | 'up' | 'down';
|
|
13
13
|
export type LayoutMode = 'tree' | 'radial' | 'grid';
|
|
14
|
+
/**
|
|
15
|
+
* `'mindmap'` (default): Tab adds a child, Enter adds a sibling, F2/Space or
|
|
16
|
+
* typing edits. `'basic'`: Enter edits and Tab moves focus as usual.
|
|
17
|
+
*/
|
|
18
|
+
export type FlowchartKeyboardShortcuts = 'mindmap' | 'basic';
|
|
14
19
|
|
|
15
20
|
export interface FlowchartViewport {
|
|
16
21
|
x: number;
|
|
@@ -27,6 +32,8 @@ export interface FlowchartNode {
|
|
|
27
32
|
height: number;
|
|
28
33
|
text: string;
|
|
29
34
|
data: Record<string, unknown>;
|
|
35
|
+
/** Present (and true) only on collapsed nodes; document format 1.3.0. */
|
|
36
|
+
collapsed?: true;
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
export interface FlowchartEndpoint {
|
|
@@ -79,6 +86,7 @@ export interface FlowchartNodeInput {
|
|
|
79
86
|
height?: number;
|
|
80
87
|
text?: string;
|
|
81
88
|
data?: Record<string, unknown>;
|
|
89
|
+
collapsed?: boolean;
|
|
82
90
|
/** Place relative to another node instead of at the viewport center. */
|
|
83
91
|
relativeTo?: string | FlowchartRelativeTo;
|
|
84
92
|
}
|
|
@@ -111,6 +119,27 @@ export interface AddChildNodeOptions extends FlowchartNodeInput {
|
|
|
111
119
|
edge?: FlowchartEdgeInput;
|
|
112
120
|
}
|
|
113
121
|
|
|
122
|
+
export interface InsertBranchNodeOptions {
|
|
123
|
+
/** Side of the parent to grow on; defaults to the branch's growth direction. */
|
|
124
|
+
direction?: FlowchartDirection;
|
|
125
|
+
/** Sibling to stack next to; defaults to the last sibling on that side. */
|
|
126
|
+
anchorId?: string;
|
|
127
|
+
/** Place before `anchorId` instead of after it. */
|
|
128
|
+
before?: boolean;
|
|
129
|
+
/** Open the label editor on the new node. */
|
|
130
|
+
edit?: boolean;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface InsertSiblingNodeOptions {
|
|
134
|
+
before?: boolean;
|
|
135
|
+
edit?: boolean;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface StartTextEditOptions {
|
|
139
|
+
/** Replace the label with this text and place the caret at the end. */
|
|
140
|
+
initialText?: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
114
143
|
export interface LayoutOptions {
|
|
115
144
|
/** Force a specific root node id; defaults to nodes with no incoming edges. */
|
|
116
145
|
root?: string;
|
|
@@ -156,7 +185,10 @@ export interface FlowchartChangeEvent {
|
|
|
156
185
|
}
|
|
157
186
|
|
|
158
187
|
export interface FlowchartSelectEvent {
|
|
188
|
+
/** Primary item; keeps its single-item shape when several nodes are selected. */
|
|
159
189
|
selection: FlowchartSelection | null;
|
|
190
|
+
/** Every selected node id, the primary node included. */
|
|
191
|
+
nodeIds: string[];
|
|
160
192
|
}
|
|
161
193
|
|
|
162
194
|
export interface FlowchartViewportEvent {
|
|
@@ -197,6 +229,22 @@ export interface VdFlowchartOptions {
|
|
|
197
229
|
history?: boolean;
|
|
198
230
|
/** Maximum retained history entries (default 100). */
|
|
199
231
|
historyLimit?: number;
|
|
232
|
+
/** Keyboard model on the focused canvas (default `'mindmap'`). */
|
|
233
|
+
keyboardShortcuts?: FlowchartKeyboardShortcuts;
|
|
234
|
+
/** Snap dragged nodes to other nodes' edges and centres; Alt bypasses (default true). */
|
|
235
|
+
snapGuides?: boolean;
|
|
236
|
+
/** Show the overview minimap; it hides on canvases narrower than 480px (default true). */
|
|
237
|
+
minimap?: boolean;
|
|
238
|
+
/** Re-run the current tree or radial layout after insertions, in the same undo step (default false). */
|
|
239
|
+
autoLayout?: boolean;
|
|
240
|
+
/** Lowest camera scale. Default `0.35`. Pair with `maxScale`. */
|
|
241
|
+
minScale?: number;
|
|
242
|
+
/** Highest camera scale. Default `3`. Pair with `minScale`. */
|
|
243
|
+
maxScale?: number;
|
|
244
|
+
/** Smallest resizable-node side. Default `56`. Junctions stay fixed. Pair with `maxNodeSize`. */
|
|
245
|
+
minNodeSize?: number;
|
|
246
|
+
/** Largest resizable-node side. Default `420`. Pair with `minNodeSize`. */
|
|
247
|
+
maxNodeSize?: number;
|
|
200
248
|
}
|
|
201
249
|
|
|
202
250
|
export class VdFlowchart {
|
|
@@ -211,6 +259,11 @@ export class VdFlowchart {
|
|
|
211
259
|
selectNode(nodeId: string): this;
|
|
212
260
|
selectEdge(edgeId: string): this;
|
|
213
261
|
deselect(): this;
|
|
262
|
+
/** Select several nodes; `primary` (default: the last id) drives single-node UI. */
|
|
263
|
+
selectNodes(nodeIds: string[], options?: { primary?: string }): this;
|
|
264
|
+
toggleNodeSelection(nodeId: string): this;
|
|
265
|
+
getSelectedNodeIds(): string[];
|
|
266
|
+
isNodeSelected(nodeId: string): boolean;
|
|
214
267
|
|
|
215
268
|
// Events
|
|
216
269
|
on<K extends keyof FlowchartEventMap>(
|
|
@@ -228,6 +281,27 @@ export class VdFlowchart {
|
|
|
228
281
|
parentId: string,
|
|
229
282
|
options?: AddChildNodeOptions,
|
|
230
283
|
): { node: FlowchartNode; edge: FlowchartEdge | null } | null;
|
|
284
|
+
/** Add a connected node on a side of the parent; node and edge undo as one step. */
|
|
285
|
+
insertBranchNode(
|
|
286
|
+
parentId: string,
|
|
287
|
+
options?: InsertBranchNodeOptions,
|
|
288
|
+
): { node: FlowchartNode; edge: FlowchartEdge | null } | null;
|
|
289
|
+
/** Add a sibling next to a node (a child when the node has no parent). */
|
|
290
|
+
insertSiblingNode(
|
|
291
|
+
nodeId: string,
|
|
292
|
+
options?: InsertSiblingNodeOptions,
|
|
293
|
+
): { node: FlowchartNode; edge: FlowchartEdge | null } | null;
|
|
294
|
+
duplicateSelection(): FlowchartNode | FlowchartNode[] | null;
|
|
295
|
+
/** Collapse or expand a node's branch; undoable, reason `node:collapse`. */
|
|
296
|
+
setCollapsed(nodeId: string, collapsed: boolean): boolean;
|
|
297
|
+
toggleCollapsed(nodeId: string): boolean;
|
|
298
|
+
/** Nodes not hidden inside a collapsed branch. */
|
|
299
|
+
getVisibleNodes(): FlowchartNode[];
|
|
300
|
+
isNodeHidden(nodeId: string): boolean;
|
|
301
|
+
nudgeNode(nodeId: string, direction: FlowchartDirection, distance: number): FlowchartNode | null;
|
|
302
|
+
nudgeNodes(nodeIds: string[], direction: FlowchartDirection, distance: number): FlowchartNode[];
|
|
303
|
+
/** Select the nearest node in a direction (spatial keyboard navigation). */
|
|
304
|
+
navigateSelection(direction: FlowchartDirection): boolean;
|
|
231
305
|
updateNode(
|
|
232
306
|
nodeId: string,
|
|
233
307
|
patch?: Partial<FlowchartNodeInput>,
|
|
@@ -260,6 +334,18 @@ export class VdFlowchart {
|
|
|
260
334
|
zoomOut(): this;
|
|
261
335
|
resetView(): this;
|
|
262
336
|
fitView(): this;
|
|
337
|
+
/** Zoom around the view centre to an absolute scale (clamped). */
|
|
338
|
+
zoomTo(scale: number): this;
|
|
339
|
+
/** Pan just enough to bring a node into view. */
|
|
340
|
+
revealNode(nodeId: string): void;
|
|
341
|
+
/** Centre and frame one visible node. Padding is screen pixels. */
|
|
342
|
+
fitNode(nodeId: string, padding?: number): this;
|
|
343
|
+
/** Show or hide the minimap. */
|
|
344
|
+
setMinimapEnabled(enabled: boolean): this;
|
|
345
|
+
/** Pan so a world point is at the centre of the view. */
|
|
346
|
+
centerViewOn(worldX: number, worldY: number): this;
|
|
347
|
+
/** Open, close, or toggle the keyboard shortcuts overlay. */
|
|
348
|
+
toggleShortcutsHelp(force?: boolean): this;
|
|
263
349
|
|
|
264
350
|
// Document
|
|
265
351
|
clear(): this;
|
|
@@ -267,7 +353,11 @@ export class VdFlowchart {
|
|
|
267
353
|
toJSON(): FlowchartDocument;
|
|
268
354
|
|
|
269
355
|
// Text editing
|
|
270
|
-
startTextEdit(nodeId: string): boolean;
|
|
356
|
+
startTextEdit(nodeId: string, options?: StartTextEditOptions): boolean;
|
|
357
|
+
/** Open the inline label editor on a connection. */
|
|
358
|
+
startEdgeLabelEdit(edgeId: string, options?: StartTextEditOptions): boolean;
|
|
359
|
+
/** Select a connection on one side of a node; repeated calls cycle. */
|
|
360
|
+
selectSideEdge(nodeId: string, direction: FlowchartDirection): boolean;
|
|
271
361
|
stopTextEdit(options?: { commit?: boolean }): void;
|
|
272
362
|
|
|
273
363
|
// Lifecycle
|
|
@@ -275,7 +365,19 @@ export class VdFlowchart {
|
|
|
275
365
|
updateOptions(
|
|
276
366
|
options: Pick<
|
|
277
367
|
VdFlowchartOptions,
|
|
278
|
-
|
|
368
|
+
| 'readonly'
|
|
369
|
+
| 'gridSize'
|
|
370
|
+
| 'autoFit'
|
|
371
|
+
| 'history'
|
|
372
|
+
| 'historyLimit'
|
|
373
|
+
| 'keyboardShortcuts'
|
|
374
|
+
| 'snapGuides'
|
|
375
|
+
| 'minimap'
|
|
376
|
+
| 'autoLayout'
|
|
377
|
+
| 'minScale'
|
|
378
|
+
| 'maxScale'
|
|
379
|
+
| 'minNodeSize'
|
|
380
|
+
| 'maxNodeSize'
|
|
279
381
|
>,
|
|
280
382
|
): this;
|
|
281
383
|
destroy(): void;
|
|
@@ -297,3 +399,4 @@ export const FLOWCHART_NODE_TYPES: readonly FlowchartNodeType[];
|
|
|
297
399
|
export const FLOWCHART_PORTS: readonly FlowchartPort[];
|
|
298
400
|
export const FLOWCHART_EDGE_MARKERS: readonly FlowchartEdgeMarker[];
|
|
299
401
|
export const FLOWCHART_EDGE_ROUTES: readonly FlowchartEdgeRoute[];
|
|
402
|
+
export const FLOWCHART_KEYBOARD_SHORTCUTS: readonly FlowchartKeyboardShortcuts[];
|