@vanduo-oss/vd3-flowchart 1.6.0 → 1.6.1
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 +12 -0
- package/README.md +2 -2
- package/dist/index.cjs +173 -31
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +173 -31
- package/dist/index.js.map +2 -2
- package/dist/meta.json +11 -11
- package/dist/vue.d.ts +1 -0
- package/package.json +1 -1
- package/recipes/editor.vue +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@vanduo-oss/vd3-flowchart` are documented here.
|
|
4
4
|
|
|
5
|
+
## 1.6.1 — 2026-11-29
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Vue `@history` event forwarding** — `VdFlowchart` now forwards core `history` events in `FORWARDED_EVENTS` and `VdFlowchartEmits`.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **Locked node `cutSelection()` and `distributeNodes()`** — cutting locked nodes no longer overwrites the clipboard (and mixed selections cut only unlocked nodes); distributing nodes respects locked middle nodes' actual coordinates instead of advancing on phantom slots.
|
|
14
|
+
- **Dark-theme and animated `exportSvg()`** — `exportSvg({ background: 'theme' })` now resolves live computed theme surface and `--vd-flowchart-palette-*` variables (with dark fallbacks when dark mode is active), and inlines `@keyframes vd-flowchart-edge-flow` plus `prefers-reduced-motion` when animated edges are present.
|
|
15
|
+
- **Mid-drag `readonly` teardown, load rounding & cleanup** — switching to `readonly: true` mid-drag cleanly reverts uncommitted in-flight geometry and releases pointer capture; `normalizeNode` and `normalizeViewport` round coordinates to 2 decimal places; `destroy()` removes the delete button listener and cancels any pending readiness `requestAnimationFrame`.
|
|
16
|
+
|
|
5
17
|
## 1.6.0 — 2026-11-08
|
|
6
18
|
|
|
7
19
|
### Added
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
A Vue 3 node and edge editor with undo, layout, and a framework-agnostic core. Peer: `vue >=3.3.0`.
|
|
8
8
|
|
|
9
|
-
**Status: 1.6.
|
|
9
|
+
**Status: 1.6.1.** `VD_FLOWCHART_VERSION` is the package release. `FLOWCHART_DOCUMENT_VERSION` is `1.3.0`, the value `toJSON()` writes. Bump those independently only with a compatibility plan. Guides: [vd3.vanduo.dev](https://vd3.vanduo.dev/). Agents: [SKILL.md](./SKILL.md).
|
|
10
10
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
@@ -41,7 +41,7 @@ This repo is monitored with [Snyk](https://snyk.io/?utm_source=open-source&utm_m
|
|
|
41
41
|
|
|
42
42
|
| Export | Contents |
|
|
43
43
|
| --- | --- |
|
|
44
|
-
| `@vanduo-oss/vd3-flowchart` | `VdFlowchart`, `VdFlowchartCore`, layout, `FLOWCHART_
|
|
44
|
+
| `@vanduo-oss/vd3-flowchart` | `VdFlowchart`, `VdFlowchartCore`, layout, `FLOWCHART_*` (coloring, layer order, align/distribute, locking, `exportSvg`), `VD_FLOWCHART_VERSION`, `FLOWCHART_DOCUMENT_VERSION` |
|
|
45
45
|
| `@vanduo-oss/vd3-flowchart/css` | Stylesheet (`dist/vd3-flowchart.css`) |
|
|
46
46
|
|
|
47
47
|
## Development
|
package/dist/index.cjs
CHANGED
|
@@ -568,7 +568,7 @@ var EDGE_STROKE_PRESETS = [
|
|
|
568
568
|
{ id: "medium", label: "Medium", width: DEFAULT_EDGE_STROKE_WIDTH },
|
|
569
569
|
{ id: "bold", label: "Bold", width: 3.5 }
|
|
570
570
|
];
|
|
571
|
-
var VD_FLOWCHART_VERSION = "1.6.
|
|
571
|
+
var VD_FLOWCHART_VERSION = "1.6.1";
|
|
572
572
|
var FLOWCHART_DOCUMENT_VERSION = "1.3.0";
|
|
573
573
|
var FLOWCHART_NODE_TYPES = [
|
|
574
574
|
"rounded-rect",
|
|
@@ -628,6 +628,19 @@ var FLOWCHART_COLOR_PRESET_FALLBACKS = {
|
|
|
628
628
|
pink: { fill: "#fce7f3", stroke: "#db2777", text: "#831843", edge: "#db2777" },
|
|
629
629
|
neutral: { fill: "#f1f5f9", stroke: "#64748b", text: "#1e293b", edge: "#64748b" }
|
|
630
630
|
};
|
|
631
|
+
var FLOWCHART_COLOR_PRESET_DARK_FALLBACKS = {
|
|
632
|
+
primary: { fill: "#1e3a8a", stroke: "#60a5fa", text: "#dbeafe", edge: "#60a5fa" },
|
|
633
|
+
secondary: { fill: "#312e81", stroke: "#818cf8", text: "#e0e7ff", edge: "#818cf8" },
|
|
634
|
+
success: { fill: "#14532d", stroke: "#4ade80", text: "#dcfce7", edge: "#4ade80" },
|
|
635
|
+
warning: { fill: "#78350f", stroke: "#fbbf24", text: "#fef3c7", edge: "#fbbf24" },
|
|
636
|
+
danger: { fill: "#7f1d1d", stroke: "#f87171", text: "#fee2e2", edge: "#f87171" },
|
|
637
|
+
info: { fill: "#0c4a6e", stroke: "#38bdf8", text: "#e0f2fe", edge: "#38bdf8" },
|
|
638
|
+
violet: { fill: "#581c87", stroke: "#c084fc", text: "#f3e8ff", edge: "#c084fc" },
|
|
639
|
+
teal: { fill: "#134e4a", stroke: "#2dd4bf", text: "#ccfbf1", edge: "#2dd4bf" },
|
|
640
|
+
orange: { fill: "#7c2d12", stroke: "#fb923c", text: "#ffedd5", edge: "#fb923c" },
|
|
641
|
+
pink: { fill: "#831843", stroke: "#f472b6", text: "#fce7f3", edge: "#f472b6" },
|
|
642
|
+
neutral: { fill: "#1e293b", stroke: "#94a3b8", text: "#f1f5f9", edge: "#94a3b8" }
|
|
643
|
+
};
|
|
631
644
|
var FLOWCHART_EDGE_STROKE_STYLE_LABELS = {
|
|
632
645
|
solid: "Solid",
|
|
633
646
|
dashed: "Dashed",
|
|
@@ -920,8 +933,8 @@ function normalizeViewport(viewport, scaleBounds) {
|
|
|
920
933
|
const min = scaleBounds?.min ?? DEFAULT_MIN_SCALE;
|
|
921
934
|
const max = scaleBounds?.max ?? DEFAULT_MAX_SCALE;
|
|
922
935
|
return {
|
|
923
|
-
x: toFiniteNumber(viewport?.x, 0),
|
|
924
|
-
y: toFiniteNumber(viewport?.y, 0),
|
|
936
|
+
x: formatNumber(toFiniteNumber(viewport?.x, 0)),
|
|
937
|
+
y: formatNumber(toFiniteNumber(viewport?.y, 0)),
|
|
925
938
|
scale: clamp(formatScale(toFiniteNumber(viewport?.scale, 1)), min, max)
|
|
926
939
|
};
|
|
927
940
|
}
|
|
@@ -931,10 +944,10 @@ function normalizeNode(rawNode, index, usedIds, sizeBounds) {
|
|
|
931
944
|
const node = {
|
|
932
945
|
id: ensureUniqueId(rawNode?.id, "node", usedIds),
|
|
933
946
|
type,
|
|
934
|
-
x: toFiniteNumber(rawNode?.x, index * 28),
|
|
935
|
-
y: toFiniteNumber(rawNode?.y, index * 18),
|
|
936
|
-
width: clampNodeWidth(type, rawNode?.width, spec.width, sizeBounds),
|
|
937
|
-
height: clampNodeHeight(type, rawNode?.height, spec.height, sizeBounds),
|
|
947
|
+
x: formatNumber(toFiniteNumber(rawNode?.x, index * 28)),
|
|
948
|
+
y: formatNumber(toFiniteNumber(rawNode?.y, index * 18)),
|
|
949
|
+
width: formatNumber(clampNodeWidth(type, rawNode?.width, spec.width, sizeBounds)),
|
|
950
|
+
height: formatNumber(clampNodeHeight(type, rawNode?.height, spec.height, sizeBounds)),
|
|
938
951
|
text: rawNode?.text == null ? spec.text : String(rawNode.text),
|
|
939
952
|
data: isPlainObject(rawNode?.data) ? deepClone(rawNode.data) : {}
|
|
940
953
|
};
|
|
@@ -1936,8 +1949,19 @@ var VdFlowchart = class {
|
|
|
1936
1949
|
});
|
|
1937
1950
|
this.resizeObserver.observe(this.canvasEl);
|
|
1938
1951
|
}
|
|
1939
|
-
|
|
1940
|
-
|
|
1952
|
+
if (typeof requestAnimationFrame === "function") {
|
|
1953
|
+
this.readyFrameIsTimeout = false;
|
|
1954
|
+
this.readyFrame = requestAnimationFrame(() => {
|
|
1955
|
+
this.readyFrame = 0;
|
|
1956
|
+
tryEmit();
|
|
1957
|
+
});
|
|
1958
|
+
} else {
|
|
1959
|
+
this.readyFrameIsTimeout = true;
|
|
1960
|
+
this.readyFrame = setTimeout(() => {
|
|
1961
|
+
this.readyFrame = 0;
|
|
1962
|
+
tryEmit();
|
|
1963
|
+
}, 16);
|
|
1964
|
+
}
|
|
1941
1965
|
};
|
|
1942
1966
|
if (typeof queueMicrotask === "function") {
|
|
1943
1967
|
queueMicrotask(startObserving);
|
|
@@ -2318,10 +2342,11 @@ var VdFlowchart = class {
|
|
|
2318
2342
|
this.graphEditButton.disabled = this.readonly || nodes.length === 0;
|
|
2319
2343
|
}
|
|
2320
2344
|
bindEvents() {
|
|
2345
|
+
this.handleDeleteClick = () => this.deleteSelection();
|
|
2321
2346
|
this.toolbar.addEventListener("click", this.handleToolbarClick);
|
|
2322
2347
|
this.arrangeSelect.addEventListener("change", this.handleArrangeChange);
|
|
2323
2348
|
this.paletteGrid.addEventListener("click", this.handlePaletteClick);
|
|
2324
|
-
this.deleteButton.addEventListener("click",
|
|
2349
|
+
this.deleteButton.addEventListener("click", this.handleDeleteClick);
|
|
2325
2350
|
this.selectionFields.addEventListener("input", this.handleSelectionFieldInput);
|
|
2326
2351
|
this.selectionFields.addEventListener("change", this.handleSelectionFieldChange);
|
|
2327
2352
|
this.selectionFields.addEventListener("click", this.handleSelectionActionClick);
|
|
@@ -2343,6 +2368,14 @@ var VdFlowchart = class {
|
|
|
2343
2368
|
this.toolbar.removeEventListener("click", this.handleToolbarClick);
|
|
2344
2369
|
this.arrangeSelect.removeEventListener("change", this.handleArrangeChange);
|
|
2345
2370
|
this.paletteGrid.removeEventListener("click", this.handlePaletteClick);
|
|
2371
|
+
if (this.handleDeleteClick) {
|
|
2372
|
+
this.deleteButton.removeEventListener("click", this.handleDeleteClick);
|
|
2373
|
+
this.handleDeleteClick = null;
|
|
2374
|
+
}
|
|
2375
|
+
if (this.handleDeleteClick) {
|
|
2376
|
+
this.deleteButton.removeEventListener("click", this.handleDeleteClick);
|
|
2377
|
+
this.handleDeleteClick = null;
|
|
2378
|
+
}
|
|
2346
2379
|
this.selectionFields.removeEventListener("input", this.handleSelectionFieldInput);
|
|
2347
2380
|
this.selectionFields.removeEventListener("change", this.handleSelectionFieldChange);
|
|
2348
2381
|
this.selectionFields.removeEventListener("click", this.handleSelectionActionClick);
|
|
@@ -3169,6 +3202,23 @@ var VdFlowchart = class {
|
|
|
3169
3202
|
return snap?.node || snap?.edge || null;
|
|
3170
3203
|
}
|
|
3171
3204
|
cutSelection() {
|
|
3205
|
+
if (!this.selection || this.readonly) return false;
|
|
3206
|
+
if (this.hasMultiSelection()) {
|
|
3207
|
+
const unlockedIds = this.getSelectedNodeIds().filter((id) => {
|
|
3208
|
+
const node = this.findNode(id);
|
|
3209
|
+
return node && !node.locked;
|
|
3210
|
+
});
|
|
3211
|
+
if (!unlockedIds.length) return false;
|
|
3212
|
+
const unlockedSet = new Set(unlockedIds);
|
|
3213
|
+
const nodes = unlockedIds.map((id) => deepClone(this.findNode(id)));
|
|
3214
|
+
const edges = this.documentData.edges.filter((edge) => unlockedSet.has(edge.from.nodeId) && unlockedSet.has(edge.to.nodeId)).map((edge) => deepClone(edge));
|
|
3215
|
+
this.clipboard = { kind: "nodes", data: { nodes, edges } };
|
|
3216
|
+
return this.deleteSelection();
|
|
3217
|
+
}
|
|
3218
|
+
if (this.selection.kind === "node") {
|
|
3219
|
+
const node = this.findNode(this.selection.id);
|
|
3220
|
+
if (!node || node.locked) return false;
|
|
3221
|
+
}
|
|
3172
3222
|
if (!this.copySelection()) return false;
|
|
3173
3223
|
return this.deleteSelection();
|
|
3174
3224
|
}
|
|
@@ -6200,7 +6250,11 @@ var VdFlowchart = class {
|
|
|
6200
6250
|
const gap = Math.max(0, (totalSpan - totalSize) / (sorted.length - 1));
|
|
6201
6251
|
let cursor = first.x;
|
|
6202
6252
|
sorted.forEach((node, index) => {
|
|
6203
|
-
if (index > 0 && index < sorted.length - 1
|
|
6253
|
+
if (index > 0 && index < sorted.length - 1) {
|
|
6254
|
+
if (node.locked) {
|
|
6255
|
+
cursor = node.x + node.width + gap;
|
|
6256
|
+
return;
|
|
6257
|
+
}
|
|
6204
6258
|
const nextX = formatNumber(cursor);
|
|
6205
6259
|
if (nextX !== node.x) {
|
|
6206
6260
|
node.x = nextX;
|
|
@@ -6215,7 +6269,11 @@ var VdFlowchart = class {
|
|
|
6215
6269
|
const gap = Math.max(0, (totalSpan - totalSize) / (sorted.length - 1));
|
|
6216
6270
|
let cursor = first.y;
|
|
6217
6271
|
sorted.forEach((node, index) => {
|
|
6218
|
-
if (index > 0 && index < sorted.length - 1
|
|
6272
|
+
if (index > 0 && index < sorted.length - 1) {
|
|
6273
|
+
if (node.locked) {
|
|
6274
|
+
cursor = node.y + node.height + gap;
|
|
6275
|
+
return;
|
|
6276
|
+
}
|
|
6219
6277
|
const nextY = formatNumber(cursor);
|
|
6220
6278
|
if (nextY !== node.y) {
|
|
6221
6279
|
node.y = nextY;
|
|
@@ -6298,16 +6356,62 @@ var VdFlowchart = class {
|
|
|
6298
6356
|
height: viewHeight,
|
|
6299
6357
|
class: "vd-flowchart-export"
|
|
6300
6358
|
});
|
|
6359
|
+
const isDarkTheme = (() => {
|
|
6360
|
+
const explicitTheme = this.element?.closest?.("[data-theme]")?.getAttribute("data-theme") || document.documentElement?.getAttribute("data-theme");
|
|
6361
|
+
if (explicitTheme === "dark") return true;
|
|
6362
|
+
if (explicitTheme === "light") return false;
|
|
6363
|
+
return Boolean(window.matchMedia?.("(prefers-color-scheme: dark)")?.matches);
|
|
6364
|
+
})();
|
|
6365
|
+
const presetFallbacks = isDarkTheme ? FLOWCHART_COLOR_PRESET_DARK_FALLBACKS : FLOWCHART_COLOR_PRESET_FALLBACKS;
|
|
6366
|
+
const computedStyle = typeof window.getComputedStyle === "function" ? window.getComputedStyle(this.root || this.element) : null;
|
|
6367
|
+
const readCssVar = (name, fallback) => {
|
|
6368
|
+
const val = computedStyle?.getPropertyValue(name)?.trim();
|
|
6369
|
+
return val && !val.includes("var(") ? val : fallback;
|
|
6370
|
+
};
|
|
6371
|
+
const defaultSurface = readCssVar(
|
|
6372
|
+
"--vd-flowchart-surface",
|
|
6373
|
+
readCssVar("--vd-bg-primary", isDarkTheme ? "#0f172a" : "#ffffff")
|
|
6374
|
+
);
|
|
6375
|
+
const defaultNodeFill = readCssVar(
|
|
6376
|
+
"--vd-flowchart-node-fill",
|
|
6377
|
+
isDarkTheme ? "#1e293b" : "#ffffff"
|
|
6378
|
+
);
|
|
6379
|
+
const defaultNodeStroke = readCssVar(
|
|
6380
|
+
"--vd-flowchart-node-stroke",
|
|
6381
|
+
isDarkTheme ? "#94a3b8" : "#475569"
|
|
6382
|
+
);
|
|
6383
|
+
const defaultNodeText = readCssVar(
|
|
6384
|
+
"--vd-flowchart-node-text",
|
|
6385
|
+
isDarkTheme ? "#f1f5f9" : "#0f172a"
|
|
6386
|
+
);
|
|
6387
|
+
const defaultEdgeStroke = readCssVar(
|
|
6388
|
+
"--vd-flowchart-edge-stroke",
|
|
6389
|
+
isDarkTheme ? "#94a3b8" : "#475569"
|
|
6390
|
+
);
|
|
6391
|
+
const resolvePresetColor = (presetName, slot) => {
|
|
6392
|
+
const fallback = presetFallbacks[presetName]?.[slot];
|
|
6393
|
+
if (!fallback) return null;
|
|
6394
|
+
return readCssVar(`--vd-flowchart-palette-${presetName}-${slot}`, fallback);
|
|
6395
|
+
};
|
|
6396
|
+
const hasAnimatedEdge = this.documentData.edges.some((edge) => edge.strokeStyle === "animated");
|
|
6301
6397
|
const styleEl = svgEl("style");
|
|
6302
|
-
|
|
6398
|
+
const styleRules = [
|
|
6303
6399
|
'.vd-flowchart-export { font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }',
|
|
6304
|
-
|
|
6400
|
+
`.vd-flowchart-node-shape { fill: ${defaultNodeFill}; stroke: ${defaultNodeStroke}; stroke-width: 2px; }`,
|
|
6305
6401
|
".vd-flowchart-node--textbox .vd-flowchart-node-shape { stroke-dasharray: 6 4; }",
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
]
|
|
6402
|
+
`.vd-flowchart-node--junction .vd-flowchart-node-shape { fill: #2563eb; stroke: ${defaultNodeFill}; }`,
|
|
6403
|
+
`.vd-flowchart-node-text { fill: ${defaultNodeText}; font-size: 14px; font-weight: 600; dominant-baseline: middle; text-anchor: middle; }`,
|
|
6404
|
+
`.vd-flowchart-edge-path { fill: none; stroke: ${defaultEdgeStroke}; stroke-linecap: round; stroke-linejoin: round; }`,
|
|
6405
|
+
`.vd-flowchart-edge-label { fill: ${defaultNodeText}; font-size: 12px; font-weight: 600; paint-order: stroke; stroke: ${defaultSurface}; stroke-width: 5px; }`
|
|
6406
|
+
];
|
|
6407
|
+
if (hasAnimatedEdge) {
|
|
6408
|
+
styleRules.push(
|
|
6409
|
+
"@keyframes vd-flowchart-edge-flow { to { stroke-dashoffset: -26; } }",
|
|
6410
|
+
".vd-flowchart-edge.is-stroke-animated .vd-flowchart-edge-path { animation: vd-flowchart-edge-flow 900ms linear infinite; }",
|
|
6411
|
+
"@media (prefers-reduced-motion: reduce) { .vd-flowchart-edge.is-stroke-animated .vd-flowchart-edge-path { animation: none; } }"
|
|
6412
|
+
);
|
|
6413
|
+
}
|
|
6414
|
+
styleEl.textContent = styleRules.join("\n");
|
|
6311
6415
|
exportRoot.appendChild(styleEl);
|
|
6312
6416
|
if (this.markerDefs) {
|
|
6313
6417
|
const defsClone = this.markerDefs.cloneNode(true);
|
|
@@ -6315,18 +6419,18 @@ var VdFlowchart = class {
|
|
|
6315
6419
|
const fill = shape.getAttribute("fill") || "";
|
|
6316
6420
|
const preset = fill.match(/--vd-flowchart-palette-([a-z]+)-edge/);
|
|
6317
6421
|
if (preset) {
|
|
6318
|
-
const
|
|
6319
|
-
if (
|
|
6320
|
-
shape.setAttribute("fill",
|
|
6422
|
+
const resolved = resolvePresetColor(preset[1], "edge");
|
|
6423
|
+
if (resolved) {
|
|
6424
|
+
shape.setAttribute("fill", resolved);
|
|
6321
6425
|
return;
|
|
6322
6426
|
}
|
|
6323
6427
|
}
|
|
6324
|
-
if (fill.includes("var(")) shape.setAttribute("fill",
|
|
6428
|
+
if (fill.includes("var(")) shape.setAttribute("fill", defaultEdgeStroke);
|
|
6325
6429
|
});
|
|
6326
6430
|
exportRoot.appendChild(defsClone);
|
|
6327
6431
|
}
|
|
6328
6432
|
if (typeof options.background === "string" && options.background.trim() && options.background.trim() !== "transparent") {
|
|
6329
|
-
const bgColor = options.background.trim() === "theme" ?
|
|
6433
|
+
const bgColor = options.background.trim() === "theme" ? defaultSurface : sanitizeCssColor(options.background.trim()) || defaultSurface;
|
|
6330
6434
|
exportRoot.appendChild(
|
|
6331
6435
|
svgEl("rect", {
|
|
6332
6436
|
x: viewX,
|
|
@@ -6346,7 +6450,7 @@ var VdFlowchart = class {
|
|
|
6346
6450
|
const edge = this.findEdge(edgeId);
|
|
6347
6451
|
const pathEl = edgeGroup.querySelector(".vd-flowchart-edge-path");
|
|
6348
6452
|
if (edge && pathEl) {
|
|
6349
|
-
const stroke = edge.color ?
|
|
6453
|
+
const stroke = edge.color ? resolvePresetColor(edge.color, "edge") || edge.color : defaultEdgeStroke;
|
|
6350
6454
|
pathEl.setAttribute("stroke", stroke);
|
|
6351
6455
|
pathEl.style.stroke = stroke;
|
|
6352
6456
|
}
|
|
@@ -6362,17 +6466,19 @@ var VdFlowchart = class {
|
|
|
6362
6466
|
if (!node) return;
|
|
6363
6467
|
const shapeEl = nodeGroup.querySelector(".vd-flowchart-node-shape");
|
|
6364
6468
|
const labelEl = nodeGroup.querySelector(".vd-flowchart-node-text");
|
|
6365
|
-
const
|
|
6469
|
+
const presetFill = node.color ? resolvePresetColor(node.color, "fill") : null;
|
|
6470
|
+
const presetStroke = node.color ? resolvePresetColor(node.color, "stroke") : null;
|
|
6471
|
+
const presetText = node.color ? resolvePresetColor(node.color, "text") : null;
|
|
6366
6472
|
if (shapeEl) {
|
|
6367
|
-
const fill = node.fill ||
|
|
6368
|
-
const stroke = node.stroke ||
|
|
6473
|
+
const fill = node.fill || presetFill || (node.type === "junction" ? "#2563eb" : defaultNodeFill);
|
|
6474
|
+
const stroke = node.stroke || presetStroke || (node.type === "junction" ? defaultNodeFill : defaultNodeStroke);
|
|
6369
6475
|
shapeEl.setAttribute("fill", fill);
|
|
6370
6476
|
shapeEl.setAttribute("stroke", stroke);
|
|
6371
6477
|
shapeEl.style.fill = fill;
|
|
6372
6478
|
shapeEl.style.stroke = stroke;
|
|
6373
6479
|
}
|
|
6374
6480
|
if (labelEl) {
|
|
6375
|
-
const textColor = node.textColor ||
|
|
6481
|
+
const textColor = node.textColor || presetText || defaultNodeText;
|
|
6376
6482
|
labelEl.setAttribute("fill", textColor);
|
|
6377
6483
|
labelEl.style.fill = textColor;
|
|
6378
6484
|
}
|
|
@@ -6522,7 +6628,35 @@ var VdFlowchart = class {
|
|
|
6522
6628
|
if ("readonly" in options) {
|
|
6523
6629
|
if (options.readonly && !this.readonly) {
|
|
6524
6630
|
this.stopTextEdit({ commit: true });
|
|
6525
|
-
this.interaction
|
|
6631
|
+
if (this.interaction) {
|
|
6632
|
+
const active = this.interaction;
|
|
6633
|
+
if (active.kind === "drag-node" && active.origins) {
|
|
6634
|
+
active.origins.forEach((origin, id) => {
|
|
6635
|
+
const node = this.findNode(id);
|
|
6636
|
+
if (node) {
|
|
6637
|
+
node.x = origin.x;
|
|
6638
|
+
node.y = origin.y;
|
|
6639
|
+
}
|
|
6640
|
+
});
|
|
6641
|
+
} else if (active.kind === "resize-node" && active.original) {
|
|
6642
|
+
const node = this.findNode(active.nodeId);
|
|
6643
|
+
if (node) {
|
|
6644
|
+
node.x = active.original.x;
|
|
6645
|
+
node.y = active.original.y;
|
|
6646
|
+
node.width = active.original.width;
|
|
6647
|
+
node.height = active.original.height;
|
|
6648
|
+
}
|
|
6649
|
+
}
|
|
6650
|
+
if (active.pointerId != null && typeof this.canvasEl?.releasePointerCapture === "function") {
|
|
6651
|
+
try {
|
|
6652
|
+
this.canvasEl.releasePointerCapture(active.pointerId);
|
|
6653
|
+
} catch {
|
|
6654
|
+
}
|
|
6655
|
+
}
|
|
6656
|
+
this.renderGuides([]);
|
|
6657
|
+
this.interaction = null;
|
|
6658
|
+
this.render({ inspector: false, json: false });
|
|
6659
|
+
}
|
|
6526
6660
|
this.activeTool = null;
|
|
6527
6661
|
this.reconnectEdgeId = null;
|
|
6528
6662
|
}
|
|
@@ -6635,6 +6769,14 @@ var VdFlowchart = class {
|
|
|
6635
6769
|
cancelAnimationFrame(this.minimapFrame);
|
|
6636
6770
|
}
|
|
6637
6771
|
this.minimapFrame = 0;
|
|
6772
|
+
if (this.readyFrame) {
|
|
6773
|
+
if (this.readyFrameIsTimeout) {
|
|
6774
|
+
clearTimeout(this.readyFrame);
|
|
6775
|
+
} else if (typeof cancelAnimationFrame === "function") {
|
|
6776
|
+
cancelAnimationFrame(this.readyFrame);
|
|
6777
|
+
}
|
|
6778
|
+
this.readyFrame = 0;
|
|
6779
|
+
}
|
|
6638
6780
|
this.activeTool = null;
|
|
6639
6781
|
this.stopTextEdit({ commit: false });
|
|
6640
6782
|
this.resizeObserver?.disconnect();
|
|
@@ -6650,7 +6792,7 @@ var VdFlowchart = class {
|
|
|
6650
6792
|
};
|
|
6651
6793
|
|
|
6652
6794
|
// src/vue.js
|
|
6653
|
-
var FORWARDED_EVENTS = ["change", "select", "viewport", "connect", "ready"];
|
|
6795
|
+
var FORWARDED_EVENTS = ["change", "select", "viewport", "connect", "ready", "history"];
|
|
6654
6796
|
var EDITOR_OPTION_KEYS = [
|
|
6655
6797
|
"readonly",
|
|
6656
6798
|
"gridSize",
|