@dou-ui/flow 0.1.0-alpha.3 → 0.1.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/collaboration/index.js +114 -6
- package/dist/collaboration/index.js.map +1 -1
- package/dist/comments.js +257 -0
- package/dist/comments.js.map +1 -0
- package/dist/components/default-node.js.map +1 -1
- package/dist/components/default-node.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/default-node.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/flow-comments.js +6 -0
- package/dist/components/flow-comments.js.map +1 -0
- package/dist/components/flow-comments.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/components/flow-comments.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/flow-port.js.map +1 -1
- package/dist/components/flow-port.vue_vue_type_script_setup_true_lang.js +7 -42
- package/dist/components/flow-port.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/flow-toolbar.js.map +1 -1
- package/dist/components/flow-toolbar.vue_vue_type_script_setup_true_lang.js +300 -9
- package/dist/components/flow-toolbar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/node-view.js.map +1 -1
- package/dist/components/node-view.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/node-view.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/port-view.js +6 -0
- package/dist/components/port-view.js.map +1 -0
- package/dist/components/port-view.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/components/port-view.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/context.js.map +1 -1
- package/dist/core/extension.js.map +1 -1
- package/dist/core/history.js +26 -0
- package/dist/core/history.js.map +1 -1
- package/dist/core/model.js.map +1 -1
- package/dist/core/node-types.js +39 -1
- package/dist/core/node-types.js.map +1 -1
- package/dist/core/transaction.js +5 -4
- package/dist/core/transaction.js.map +1 -1
- package/dist/document.js +1 -1
- package/dist/export/color.js +49 -6
- package/dist/export/color.js.map +1 -1
- package/dist/export/context.js +16 -9
- package/dist/export/context.js.map +1 -1
- package/dist/export/draw.js +6 -5
- package/dist/export/draw.js.map +1 -1
- package/dist/export/render.js +78 -0
- package/dist/export/render.js.map +1 -0
- package/dist/flow-editor.js.map +1 -1
- package/dist/flow-editor.vue_vue_type_script_setup_true_lang.js +757 -129
- package/dist/flow-editor.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/kit.js +1 -1
- package/dist/locale.js +102 -3
- package/dist/locale.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/style.js +2 -1
- package/dist/types/collaboration/index.d.ts +32 -4
- package/dist/types/comments.d.ts +73 -0
- package/dist/types/components/flow-comments.vue.d.ts +35 -0
- package/dist/types/components/flow-port.vue.d.ts +8 -2
- package/dist/types/components/port-view.vue.d.ts +10 -0
- package/dist/types/components/port.d.ts +2 -2
- package/dist/types/context.d.ts +48 -1
- package/dist/types/core/extension.d.ts +9 -1
- package/dist/types/core/history.d.ts +10 -0
- package/dist/types/core/menu.d.ts +60 -0
- package/dist/types/core/model.d.ts +22 -0
- package/dist/types/core/node-types.d.ts +18 -2
- package/dist/types/core/transaction.d.ts +2 -1
- package/dist/types/export/color.d.ts +6 -1
- package/dist/types/export/render.d.ts +27 -0
- package/dist/types/flow-editor.vue.d.ts +11 -1
- package/dist/types/index.d.ts +36 -7
- package/dist/types/locale.d.ts +27 -1
- package/dist/types/whiteboard/board-node.vue.d.ts +5 -0
- package/dist/types/whiteboard/colors.d.ts +36 -0
- package/dist/types/whiteboard/index.d.ts +2 -2
- package/dist/types/whiteboard/model.d.ts +24 -14
- package/dist/types/whiteboard/state.d.ts +2 -0
- package/dist/types/whiteboard/toolbar.d.ts +46 -0
- package/dist/whiteboard/board-node.js.map +1 -1
- package/dist/whiteboard/board-node.vue_vue_type_script_setup_true_lang.js +76 -20
- package/dist/whiteboard/board-node.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/whiteboard/colors.js +84 -0
- package/dist/whiteboard/colors.js.map +1 -0
- package/dist/whiteboard/connector.js +47 -13
- package/dist/whiteboard/connector.js.map +1 -1
- package/dist/whiteboard/draw.js +26 -9
- package/dist/whiteboard/draw.js.map +1 -1
- package/dist/whiteboard/index.js +2 -1
- package/dist/whiteboard/kit.js +65 -8
- package/dist/whiteboard/kit.js.map +1 -1
- package/dist/whiteboard/model.js +5 -31
- package/dist/whiteboard/model.js.map +1 -1
- package/dist/whiteboard/state.js +6 -1
- package/dist/whiteboard/state.js.map +1 -1
- package/dist/whiteboard/toolbar.js +296 -0
- package/dist/whiteboard/toolbar.js.map +1 -0
- package/dist/whiteboard/whiteboard-toolbar.js.map +1 -1
- package/dist/whiteboard/whiteboard-toolbar.vue_vue_type_script_setup_true_lang.js +14 -7
- package/dist/whiteboard/whiteboard-toolbar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { flowEditorKey } from "./context.js";
|
|
2
|
-
import { boundsOf, clampPan, intersects, intersectsTurned, rectFrom, snapBox } from "./core/geometry.js";
|
|
3
|
-
import { labelOf, nodeBounds, portsOf, resizeOf } from "./core/node-types.js";
|
|
2
|
+
import { boundsOf, clampPan, intersects, intersectsTurned, rectFrom, snapBox, turn } from "./core/geometry.js";
|
|
3
|
+
import { labelOf, nodeBounds, portSide, portsOf, resizeOf, warnUnknownNodeType } from "./core/node-types.js";
|
|
4
4
|
import node_view_default from "./components/node-view.js";
|
|
5
5
|
import flow_menu_default from "./components/flow-menu.js";
|
|
6
|
+
import { format, useFlowMessages } from "./locale.js";
|
|
7
|
+
import flow_comments_default from "./components/flow-comments.js";
|
|
8
|
+
import { resolveFlowExtensions } from "./core/extension.js";
|
|
9
|
+
import { useFlowComments } from "./comments.js";
|
|
6
10
|
import flow_quick_add_default from "./components/flow-quick-add.js";
|
|
7
11
|
import flow_toolbar_default from "./components/flow-toolbar.js";
|
|
8
12
|
import { drawTools } from "./export/context.js";
|
|
@@ -13,8 +17,6 @@ import { canJoin, displacedEdges, joinRefusal, primaryType, typesMatch } from ".
|
|
|
13
17
|
import { FlowTransaction } from "./core/transaction.js";
|
|
14
18
|
import { FlowHistory } from "./core/history.js";
|
|
15
19
|
import { flowOrder } from "./core/order.js";
|
|
16
|
-
import { resolveFlowExtensions } from "./core/extension.js";
|
|
17
|
-
import { format, useFlowMessages } from "./locale.js";
|
|
18
20
|
import { flowKit } from "./kit.js";
|
|
19
21
|
import { readClipboard, writeClipboard } from "./core/clipboard.js";
|
|
20
22
|
import { createId, emptyDocument, emptySelection } from "./core/model.js";
|
|
@@ -42,39 +44,42 @@ var _hoisted_5 = ["data-edge-id", "data-edge-type"];
|
|
|
42
44
|
var _hoisted_6 = ["d"];
|
|
43
45
|
var _hoisted_7 = ["d"];
|
|
44
46
|
var _hoisted_8 = ["d"];
|
|
45
|
-
var _hoisted_9 = ["
|
|
46
|
-
var _hoisted_10 = ["
|
|
47
|
-
var _hoisted_11 = ["
|
|
48
|
-
var _hoisted_12 = [
|
|
47
|
+
var _hoisted_9 = ["data-edge-type"];
|
|
48
|
+
var _hoisted_10 = ["d"];
|
|
49
|
+
var _hoisted_11 = ["d"];
|
|
50
|
+
var _hoisted_12 = ["data-edge-id", "data-value"];
|
|
51
|
+
var _hoisted_13 = ["aria-label"];
|
|
52
|
+
var _hoisted_14 = [
|
|
49
53
|
"data-node-id",
|
|
50
54
|
"aria-roledescription",
|
|
51
55
|
"aria-label"
|
|
52
56
|
];
|
|
53
|
-
var
|
|
57
|
+
var _hoisted_15 = {
|
|
54
58
|
key: 0,
|
|
55
59
|
class: "dou-flow-editor__simple-label"
|
|
56
60
|
};
|
|
57
|
-
var
|
|
58
|
-
|
|
61
|
+
var _hoisted_16 = ["data-edge-id", "data-edge-end"];
|
|
62
|
+
var _hoisted_17 = {
|
|
63
|
+
key: 3,
|
|
59
64
|
class: "dou-flow-editor__guides",
|
|
60
65
|
"aria-hidden": "true"
|
|
61
66
|
};
|
|
62
|
-
var
|
|
67
|
+
var _hoisted_18 = [
|
|
63
68
|
"x1",
|
|
64
69
|
"y1",
|
|
65
70
|
"x2",
|
|
66
71
|
"y2"
|
|
67
72
|
];
|
|
68
|
-
var
|
|
69
|
-
var
|
|
73
|
+
var _hoisted_19 = { class: "dou-flow-editor__ghost-card" };
|
|
74
|
+
var _hoisted_20 = {
|
|
70
75
|
key: 0,
|
|
71
76
|
class: "dou-flow-editor__ghost-icon"
|
|
72
77
|
};
|
|
73
|
-
var
|
|
78
|
+
var _hoisted_21 = {
|
|
74
79
|
class: "dou-flow-editor__live",
|
|
75
80
|
"aria-live": "polite"
|
|
76
81
|
};
|
|
77
|
-
var
|
|
82
|
+
var _hoisted_22 = {
|
|
78
83
|
key: 1,
|
|
79
84
|
class: "dou-flow-editor__notice",
|
|
80
85
|
"aria-hidden": "true"
|
|
@@ -93,12 +98,24 @@ var FIT_PADDING = 40;
|
|
|
93
98
|
* that; what still doesn't fit starts at the top left, to be panned to.
|
|
94
99
|
*/
|
|
95
100
|
var PANEL_GAP = 16;
|
|
101
|
+
var TIDY_NEAR = 24;
|
|
96
102
|
var FIELDS = "input, textarea, [contenteditable]:not([contenteditable=\"false\"]), [data-dou-nodrag]";
|
|
97
103
|
var MAGNET = 24;
|
|
104
|
+
/** The topmost non-container node under the pointer, if any. */
|
|
98
105
|
var FIND_INSET = 12;
|
|
99
106
|
var DRAW_MARGIN = 200;
|
|
100
107
|
/** The part of the canvas that is drawn: the view and a margin around it. */
|
|
101
108
|
var TINY = .2;
|
|
109
|
+
var EDGE_LABEL_HALF = 10;
|
|
110
|
+
/** How far above an edge's label its marker sits, in screen px; a finger's target adds 8 (style.css). */
|
|
111
|
+
var EDGE_MARKER_LIFT = 14;
|
|
112
|
+
/** A marker's size, and how far apart two markers' middles keep, so a finger's 40px targets don't overlap. */
|
|
113
|
+
var MARKER_SIZE = 24;
|
|
114
|
+
var MARKER_GAP = 32;
|
|
115
|
+
/**
|
|
116
|
+
* A marker's middle, in px within the editor: a node's sits off its top
|
|
117
|
+
* right corner, a pin's bottom left corner is on its point (style.css).
|
|
118
|
+
*/
|
|
102
119
|
var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
103
120
|
name: "DouFlowEditor",
|
|
104
121
|
__name: "flow-editor",
|
|
@@ -141,7 +158,14 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
141
158
|
default: true
|
|
142
159
|
},
|
|
143
160
|
ariaLabel: {},
|
|
144
|
-
messages: {}
|
|
161
|
+
messages: {},
|
|
162
|
+
comments: { default: void 0 },
|
|
163
|
+
author: { default: void 0 },
|
|
164
|
+
activeComment: { default: void 0 },
|
|
165
|
+
commentable: {
|
|
166
|
+
type: Boolean,
|
|
167
|
+
default: true
|
|
168
|
+
}
|
|
145
169
|
}, {
|
|
146
170
|
"modelValue": { default: emptyDocument },
|
|
147
171
|
"modelModifiers": {},
|
|
@@ -157,6 +181,9 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
157
181
|
emits: /*@__PURE__*/ mergeModels([
|
|
158
182
|
"transaction",
|
|
159
183
|
"transactionCancel",
|
|
184
|
+
"update:comments",
|
|
185
|
+
"update:activeComment",
|
|
186
|
+
"commentAction",
|
|
160
187
|
"nodeClick",
|
|
161
188
|
"nodeDblclick",
|
|
162
189
|
"nodeContextmenu",
|
|
@@ -195,7 +222,30 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
195
222
|
/** The axis that levels two ports on this side. */
|
|
196
223
|
const level = (side) => side === "left" || side === "right" ? "y" : "x";
|
|
197
224
|
const same = (a, b) => a.length === b.length && a.every((id, i) => id === b[i]);
|
|
198
|
-
|
|
225
|
+
let latest = null;
|
|
226
|
+
const docOf = () => latest ?? toRaw(doc.value);
|
|
227
|
+
/** The document as extensions and comments see it: the latest commit, even before `v-model` catches up. */
|
|
228
|
+
const currentDoc = customRef(() => ({
|
|
229
|
+
get: () => {
|
|
230
|
+
const value = doc.value;
|
|
231
|
+
return latest ?? value;
|
|
232
|
+
},
|
|
233
|
+
set: (value) => doc.value = value
|
|
234
|
+
}));
|
|
235
|
+
const { comments, extension: commentsExtension, anchors: getCommentAnchors, anchorOf: commentAnchorOf } = useFlowComments({
|
|
236
|
+
props,
|
|
237
|
+
emit,
|
|
238
|
+
doc: currentDoc,
|
|
239
|
+
selection,
|
|
240
|
+
messages,
|
|
241
|
+
transact,
|
|
242
|
+
carry: (on, patch) => !customHistory && history.carry(on, patch),
|
|
243
|
+
shownOn: (on) => commentSpots.value.find((spot) => spot.key === spotKey(on))?.threads
|
|
244
|
+
});
|
|
245
|
+
const resolved = computed(() => {
|
|
246
|
+
const own = props.extensions ?? flowKit();
|
|
247
|
+
return resolveFlowExtensions(comments.enabled.value ? [...own, commentsExtension] : own);
|
|
248
|
+
});
|
|
199
249
|
const types = computed(() => {
|
|
200
250
|
const map = new Map(resolved.value.nodeTypes);
|
|
201
251
|
for (const spec of props.nodeTypes ?? []) map.set(spec.type, spec);
|
|
@@ -213,6 +263,9 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
213
263
|
/** The type of edges without one: the prop, else the extensions', else bezier. */
|
|
214
264
|
const defaultEdgeType = computed(() => props.edgeType ?? resolved.value.edgeType ?? "bezier");
|
|
215
265
|
const edgeTypeOf = (type) => edgeTypes.value.get(type ?? defaultEdgeType.value) ?? edgeTypes.value.get(defaultEdgeType.value) ?? bezierEdge;
|
|
266
|
+
if (process.env.NODE_ENV !== "production") watch(() => [doc.value.nodes, types.value], ([nodes, map]) => {
|
|
267
|
+
for (const node of nodes) if (node.type && !map.has(node.type)) warnUnknownNodeType(node.type);
|
|
268
|
+
}, { immediate: true });
|
|
216
269
|
const specOf = (node) => types.value.get(node.type ?? "default") ?? types.value.get("default") ?? defaultNode;
|
|
217
270
|
/** Each node's ports by id, worked out once per change rather than per edge. */
|
|
218
271
|
const portsByNode = computed(() => {
|
|
@@ -260,16 +313,6 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
260
313
|
edges: sel.edges.filter((id) => edges.has(id))
|
|
261
314
|
};
|
|
262
315
|
}
|
|
263
|
-
let latest = null;
|
|
264
|
-
const docOf = () => latest ?? toRaw(doc.value);
|
|
265
|
-
/** The document as extensions see it: the latest commit, even before `v-model` catches up. */
|
|
266
|
-
const currentDoc = customRef(() => ({
|
|
267
|
-
get: () => {
|
|
268
|
-
const value = doc.value;
|
|
269
|
-
return latest ?? value;
|
|
270
|
-
},
|
|
271
|
-
set: (value) => doc.value = value
|
|
272
|
-
}));
|
|
273
316
|
/** Runs the extensions' `transaction` hooks; `false` when one cancelled the change. */
|
|
274
317
|
function check(tr) {
|
|
275
318
|
for (const hook of resolved.value.transactions) {
|
|
@@ -545,6 +588,12 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
545
588
|
out.push({
|
|
546
589
|
edge,
|
|
547
590
|
route: edgeTypeOf(edge.type).route(a, b, edge),
|
|
591
|
+
source: a,
|
|
592
|
+
target: b,
|
|
593
|
+
folded: {
|
|
594
|
+
source: from !== edge.source,
|
|
595
|
+
target: to !== edge.target
|
|
596
|
+
},
|
|
548
597
|
box: {
|
|
549
598
|
x: x - EDGE_REACH,
|
|
550
599
|
y: y - EDGE_REACH,
|
|
@@ -592,6 +641,7 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
592
641
|
const bend = computed(() => {
|
|
593
642
|
const { nodes, edges } = selection.value;
|
|
594
643
|
if (props.readonly || nodes.length || edges.length !== 1) return null;
|
|
644
|
+
if (connecting.value?.edge === edges[0]) return null;
|
|
595
645
|
const item = edgeRoutes.value.find((e) => e.edge.id === edges[0]);
|
|
596
646
|
const handle = item?.route.handle;
|
|
597
647
|
return handle && item ? {
|
|
@@ -599,6 +649,28 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
599
649
|
handle
|
|
600
650
|
} : null;
|
|
601
651
|
});
|
|
652
|
+
/** The draggable endpoint handles at both ends of the one selected edge. */
|
|
653
|
+
const edgeHandles = computed(() => {
|
|
654
|
+
const { nodes, edges } = selection.value;
|
|
655
|
+
if (props.readonly || simple.value || nodes.length || edges.length !== 1) return null;
|
|
656
|
+
const id = edges[0];
|
|
657
|
+
if (editingLabel.value === id || connecting.value?.edge === id) return null;
|
|
658
|
+
const item = edgeRoutes.value.find((e) => e.edge.id === id);
|
|
659
|
+
if (!item) return null;
|
|
660
|
+
const ends = [];
|
|
661
|
+
if (!item.folded.source && resolvedPortEnd(item.edge.target, "target")) ends.push({
|
|
662
|
+
end: "source",
|
|
663
|
+
at: item.source
|
|
664
|
+
});
|
|
665
|
+
if (!item.folded.target && resolvedPortEnd(item.edge.source, "source")) ends.push({
|
|
666
|
+
end: "target",
|
|
667
|
+
at: item.target
|
|
668
|
+
});
|
|
669
|
+
return ends.length ? {
|
|
670
|
+
edge: item.edge,
|
|
671
|
+
ends
|
|
672
|
+
} : null;
|
|
673
|
+
});
|
|
602
674
|
/** The node whose edges `E` goes through, and the one last selected. */
|
|
603
675
|
let edgeCycle = null;
|
|
604
676
|
/**
|
|
@@ -765,10 +837,11 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
765
837
|
}
|
|
766
838
|
/** Point on the screen relative to the editor's top left corner. */
|
|
767
839
|
function local(clientX, clientY) {
|
|
768
|
-
const
|
|
840
|
+
const el = root.value;
|
|
841
|
+
const rect = el.getBoundingClientRect();
|
|
769
842
|
return {
|
|
770
|
-
x: clientX - rect.left,
|
|
771
|
-
y: clientY - rect.top
|
|
843
|
+
x: clientX - rect.left - el.clientLeft,
|
|
844
|
+
y: clientY - rect.top - el.clientTop
|
|
772
845
|
};
|
|
773
846
|
}
|
|
774
847
|
function toCanvas(point) {
|
|
@@ -818,7 +891,7 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
818
891
|
left: FIT_PADDING,
|
|
819
892
|
right: FIT_PADDING
|
|
820
893
|
};
|
|
821
|
-
for (const panel of root.value.querySelectorAll(".dou-flow-editor__panels > :not(.dou-flow-toolbar)")) {
|
|
894
|
+
for (const panel of root.value.querySelectorAll(".dou-flow-editor__panels > :not(.dou-flow-toolbar, .dou-flow-editor__comments, .dou-flow-editor__comment-card)")) {
|
|
822
895
|
const rect = panel.getBoundingClientRect();
|
|
823
896
|
if (!rect.height) continue;
|
|
824
897
|
const upper = rect.top + rect.height / 2 < box.top + box.height / 2;
|
|
@@ -849,7 +922,7 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
849
922
|
zoom
|
|
850
923
|
}, animate);
|
|
851
924
|
}
|
|
852
|
-
/**
|
|
925
|
+
/** How near a note on a board is to a node, in px, to move along with it when tidying. */
|
|
853
926
|
const TIDY_GAP = {
|
|
854
927
|
horizontal: {
|
|
855
928
|
rank: 80,
|
|
@@ -861,6 +934,50 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
861
934
|
}
|
|
862
935
|
};
|
|
863
936
|
/**
|
|
937
|
+
* Which way tidying runs: the flow's `direction`, unless most edges between
|
|
938
|
+
* nodes with `ports: 'sides'` leave their nodes by the other
|
|
939
|
+
* sides, e.g. a whiteboard drawn top to bottom. Laying that out the other
|
|
940
|
+
* way would undo how it was drawn. Fixed ports say nothing about it.
|
|
941
|
+
*/
|
|
942
|
+
function tidiesVertically(blocks, blockOf) {
|
|
943
|
+
const vertical = props.direction === "vertical";
|
|
944
|
+
let along = 0;
|
|
945
|
+
let across = 0;
|
|
946
|
+
for (const edge of doc.value.edges) {
|
|
947
|
+
const from = blockOf(edge.source.node);
|
|
948
|
+
const to = blockOf(edge.target.node);
|
|
949
|
+
if (!from || !to || from === to || !blocks.has(from) || !blocks.has(to)) continue;
|
|
950
|
+
const port = portSpec(edge.source);
|
|
951
|
+
const node = nodeById.value.get(edge.source.node);
|
|
952
|
+
if (!port || !node || specOf(node).ports !== "sides" || specOf(node).rotation?.(node)) continue;
|
|
953
|
+
const side = portSide(port);
|
|
954
|
+
if ((side === "top" || side === "bottom") === vertical) along++;
|
|
955
|
+
else across++;
|
|
956
|
+
}
|
|
957
|
+
return across > along ? !vertical : vertical;
|
|
958
|
+
}
|
|
959
|
+
const OPPOSITE = {
|
|
960
|
+
top: "bottom",
|
|
961
|
+
bottom: "top",
|
|
962
|
+
left: "right",
|
|
963
|
+
right: "left"
|
|
964
|
+
};
|
|
965
|
+
/**
|
|
966
|
+
* The port an edge end moves to when tidying, on a node whose ports are
|
|
967
|
+
* `ports: 'sides'`: on the side facing the other end along the flow.
|
|
968
|
+
*/
|
|
969
|
+
function anchorFor(end, kind, side) {
|
|
970
|
+
const node = nodeById.value.get(end.node);
|
|
971
|
+
if (!node) return void 0;
|
|
972
|
+
const spec = specOf(node);
|
|
973
|
+
if (spec.ports !== "sides" || spec.rotation?.(node)) return void 0;
|
|
974
|
+
const port = portsOf(spec, node).find((p) => p.kind === kind && portSide(p) === side);
|
|
975
|
+
return port && port.id !== end.port ? {
|
|
976
|
+
...end,
|
|
977
|
+
port: port.id
|
|
978
|
+
} : void 0;
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
864
981
|
* Lays the given nodes, or the selected ones when two or more are selected,
|
|
865
982
|
* or all, out in ranks along their edges in the flow's `direction`, as one
|
|
866
983
|
* undo step. The group keeps its top left corner; locked nodes stay put.
|
|
@@ -875,12 +992,26 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
875
992
|
return at;
|
|
876
993
|
};
|
|
877
994
|
const blocks = new Set([...chosen].flatMap((id) => blockOf(id) ?? []));
|
|
878
|
-
const
|
|
995
|
+
const board = [...blocks].some((id) => {
|
|
996
|
+
const node = nodeById.value.get(id);
|
|
997
|
+
return node && specOf(node).ports === "sides";
|
|
998
|
+
});
|
|
999
|
+
const linked = /* @__PURE__ */ new Set();
|
|
1000
|
+
if (board) for (const edge of doc.value.edges) {
|
|
1001
|
+
const a = blockOf(edge.source.node);
|
|
1002
|
+
const b = blockOf(edge.target.node);
|
|
1003
|
+
if (!a || !b || a === b || !blocks.has(a) || !blocks.has(b)) continue;
|
|
1004
|
+
linked.add(a);
|
|
1005
|
+
linked.add(b);
|
|
1006
|
+
}
|
|
1007
|
+
const loose = board ? doc.value.nodes.filter((n) => blocks.has(n.id) && !linked.has(n.id)) : [];
|
|
1008
|
+
const nodes = doc.value.nodes.filter((node) => blocks.has(node.id) && (!board || linked.has(node.id)));
|
|
879
1009
|
const bounds = boundsOf(nodes.map(rectOf));
|
|
880
1010
|
if (!bounds || nodes.length < 2) return;
|
|
881
|
-
const vertical =
|
|
1011
|
+
const vertical = tidiesVertically(blocks, blockOf);
|
|
882
1012
|
const gap = TIDY_GAP[vertical ? "vertical" : "horizontal"];
|
|
883
1013
|
const across = vertical ? ["top", "bottom"] : ["left", "right"];
|
|
1014
|
+
const anchors = /* @__PURE__ */ new Map();
|
|
884
1015
|
const layout = layoutGraph(nodes.map((node) => {
|
|
885
1016
|
const m = metrics.get(node.id);
|
|
886
1017
|
const { width, height } = rectOf(node);
|
|
@@ -889,6 +1020,8 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
889
1020
|
offset = vertical ? port.x : port.y;
|
|
890
1021
|
break;
|
|
891
1022
|
}
|
|
1023
|
+
offset = Math.round(offset);
|
|
1024
|
+
anchors.set(node.id, offset);
|
|
892
1025
|
return {
|
|
893
1026
|
id: node.id,
|
|
894
1027
|
width,
|
|
@@ -903,7 +1036,7 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
903
1036
|
to
|
|
904
1037
|
}] : [];
|
|
905
1038
|
}), {
|
|
906
|
-
direction:
|
|
1039
|
+
direction: vertical ? "vertical" : "horizontal",
|
|
907
1040
|
rankGap: gap.rank,
|
|
908
1041
|
laneGap: gap.row,
|
|
909
1042
|
equalWidth: false,
|
|
@@ -923,12 +1056,42 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
923
1056
|
for (const node of nodes) {
|
|
924
1057
|
const placed = layout.nodes.get(node.id);
|
|
925
1058
|
if (!placed || node.locked) continue;
|
|
926
|
-
const
|
|
927
|
-
|
|
1059
|
+
const offset = anchors.get(node.id) ?? 0;
|
|
1060
|
+
const to = vertical ? {
|
|
1061
|
+
x: origin.x + snap(placed.x + offset) - offset,
|
|
928
1062
|
y: origin.y + snap(placed.y)
|
|
1063
|
+
} : {
|
|
1064
|
+
x: origin.x + snap(placed.x),
|
|
1065
|
+
y: origin.y + snap(placed.y + offset) - offset
|
|
929
1066
|
};
|
|
930
1067
|
if (to.x !== node.x || to.y !== node.y) moved.set(node.id, to);
|
|
931
1068
|
}
|
|
1069
|
+
for (const note of loose) {
|
|
1070
|
+
if (note.locked) continue;
|
|
1071
|
+
const rect = rectOf(note);
|
|
1072
|
+
let host;
|
|
1073
|
+
let best = Infinity;
|
|
1074
|
+
for (const node of nodes) {
|
|
1075
|
+
const other = rectOf(node);
|
|
1076
|
+
const apart = Math.max(other.x - (rect.x + rect.width), rect.x - (other.x + other.width), other.y - (rect.y + rect.height), rect.y - (other.y + other.height), 0);
|
|
1077
|
+
if (apart > TIDY_NEAR) continue;
|
|
1078
|
+
const score = apart * 1e6 + Math.hypot(other.x + other.width / 2 - (rect.x + rect.width / 2), other.y + other.height / 2 - (rect.y + rect.height / 2));
|
|
1079
|
+
if (score < best) {
|
|
1080
|
+
best = score;
|
|
1081
|
+
host = node;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
const to = host && moved.get(host.id);
|
|
1085
|
+
if (!host || !to) continue;
|
|
1086
|
+
from.set(note.id, {
|
|
1087
|
+
x: note.x,
|
|
1088
|
+
y: note.y
|
|
1089
|
+
});
|
|
1090
|
+
moved.set(note.id, {
|
|
1091
|
+
x: note.x + to.x - host.x,
|
|
1092
|
+
y: note.y + to.y - host.y
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
932
1095
|
const through = new Map(layout.edges.map((e) => [`${e.from}\u0000${e.to}`, e.points]));
|
|
933
1096
|
const locked = new Set(nodes.filter((node) => node.locked).map((node) => node.id));
|
|
934
1097
|
const routes = /* @__PURE__ */ new Map();
|
|
@@ -952,10 +1115,53 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
952
1115
|
routes.set(edge.id, next);
|
|
953
1116
|
});
|
|
954
1117
|
}
|
|
955
|
-
const
|
|
1118
|
+
const rankOf = new Map(layout.ranks.flatMap((rank, i) => rank.map((id) => [id, i])));
|
|
1119
|
+
const centre = (id) => {
|
|
1120
|
+
const rect = rectOf(nodeById.value.get(id));
|
|
1121
|
+
const block = blockOf(id);
|
|
1122
|
+
const to = moved.get(block);
|
|
1123
|
+
const was = from.get(block);
|
|
1124
|
+
const dx = to ? to.x - was.x : 0;
|
|
1125
|
+
const dy = to ? to.y - was.y : 0;
|
|
1126
|
+
return {
|
|
1127
|
+
x: rect.x + dx + rect.width / 2,
|
|
1128
|
+
y: rect.y + dy + rect.height / 2
|
|
1129
|
+
};
|
|
1130
|
+
};
|
|
1131
|
+
const ends = /* @__PURE__ */ new Map();
|
|
1132
|
+
const joined = /* @__PURE__ */ new Set();
|
|
1133
|
+
for (const edge of doc.value.edges) {
|
|
1134
|
+
const a = blockOf(edge.source.node);
|
|
1135
|
+
const b = blockOf(edge.target.node);
|
|
1136
|
+
if (a && b) joined.add(`${a}\u0000${b}`);
|
|
1137
|
+
}
|
|
1138
|
+
const middle = (vertical ? origin.x + layout.width / 2 : origin.y + layout.height / 2) - .5;
|
|
1139
|
+
for (const edge of doc.value.edges) {
|
|
1140
|
+
const a = blockOf(edge.source.node);
|
|
1141
|
+
const b = blockOf(edge.target.node);
|
|
1142
|
+
if (!a || !b || a === b || !blocks.has(a) || !blocks.has(b)) continue;
|
|
1143
|
+
const s = centre(edge.source.node);
|
|
1144
|
+
const t = centre(edge.target.node);
|
|
1145
|
+
const along = !locked.has(a) && !locked.has(b) ? (rankOf.get(b) ?? 0) - (rankOf.get(a) ?? 0) : Math.round(vertical ? t.y - s.y : t.x - s.x);
|
|
1146
|
+
const aside = vertical ? t.x - s.x : t.y - s.y;
|
|
1147
|
+
const out = along ? vertical ? along > 0 ? "bottom" : "top" : along > 0 ? "right" : "left" : vertical ? aside >= 0 ? "right" : "left" : aside >= 0 ? "bottom" : "top";
|
|
1148
|
+
const round = along < 0 && (along < -1 || joined.has(`${b}\u0000${a}`));
|
|
1149
|
+
const outer = vertical ? (s.x + t.x) / 2 >= middle ? "right" : "left" : (s.y + t.y) / 2 >= middle ? "bottom" : "top";
|
|
1150
|
+
const source = anchorFor(edge.source, "output", round ? outer : out);
|
|
1151
|
+
const target = anchorFor(edge.target, "input", round ? outer : OPPOSITE[out]);
|
|
1152
|
+
if (source || target) ends.set(edge.id, {
|
|
1153
|
+
source: source ?? edge.source,
|
|
1154
|
+
target: target ?? edge.target
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
const rerouted = ends.size > 0 || doc.value.edges.some((edge) => routes.has(edge.id) && JSON.stringify(routes.get(edge.id)) !== JSON.stringify(edge.points));
|
|
956
1158
|
if (!moved.size && !rerouted) return;
|
|
957
|
-
const
|
|
958
|
-
|
|
1159
|
+
const edgesBefore = new Map(doc.value.edges.map((e) => [e.id, e]));
|
|
1160
|
+
const count = (/* @__PURE__ */ new Set([...[...moved.keys()].filter((id) => !linked.size || linked.has(id)), ...[...ends].flatMap(([id, end]) => {
|
|
1161
|
+
const was = edgesBefore.get(id);
|
|
1162
|
+
return [...was?.source.port !== end.source.port ? [end.source.node] : [], ...was?.target.port !== end.target.port ? [end.target.node] : []];
|
|
1163
|
+
})])).size;
|
|
1164
|
+
for (const { id } of [...nodes, ...loose]) {
|
|
959
1165
|
const to = moved.get(id);
|
|
960
1166
|
if (!to) continue;
|
|
961
1167
|
const block = from.get(id);
|
|
@@ -974,13 +1180,17 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
974
1180
|
}
|
|
975
1181
|
transact((tr) => {
|
|
976
1182
|
for (const [id, to] of moved) tr.moveNode(id, to.x, to.y);
|
|
1183
|
+
for (const [id, end] of ends) tr.updateEdge(id, end);
|
|
977
1184
|
for (const [id, points] of routes) if (JSON.stringify(points) !== JSON.stringify(tr.getEdge(id)?.points)) tr.updateEdge(id, { points });
|
|
978
1185
|
});
|
|
979
1186
|
announce(format(messages.value.tidied, { count }));
|
|
980
1187
|
animateTidy(from, moved);
|
|
981
|
-
const after = boundsOf(nodes.map((node) => ({
|
|
1188
|
+
const after = boundsOf([...nodes, ...loose].map((node) => ({
|
|
982
1189
|
...rectOf(node),
|
|
983
|
-
...moved.get(node.id) ??
|
|
1190
|
+
...moved.get(node.id) ?? {
|
|
1191
|
+
x: node.x,
|
|
1192
|
+
y: node.y
|
|
1193
|
+
}
|
|
984
1194
|
})));
|
|
985
1195
|
const { x, y, zoom } = viewport.value;
|
|
986
1196
|
const { width, height } = size.value;
|
|
@@ -1025,7 +1235,11 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1025
1235
|
/** Keeps a node in view, e.g. when it gets keyboard focus. */
|
|
1026
1236
|
function reveal(id) {
|
|
1027
1237
|
const rect = getNodeRect(id);
|
|
1028
|
-
if (
|
|
1238
|
+
if (rect) revealRect(rect);
|
|
1239
|
+
}
|
|
1240
|
+
/** Pans the least that brings `rect`, in canvas coordinates, into view. */
|
|
1241
|
+
function revealRect(rect) {
|
|
1242
|
+
if (!root.value) return;
|
|
1029
1243
|
const { x, y, zoom } = viewport.value;
|
|
1030
1244
|
const pad = 16;
|
|
1031
1245
|
const left = rect.x * zoom + x;
|
|
@@ -1105,6 +1319,28 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1105
1319
|
clearTimeout(pressTimer);
|
|
1106
1320
|
pressTimer = 0;
|
|
1107
1321
|
}
|
|
1322
|
+
/**
|
|
1323
|
+
* A touch browser may hand a press to a clickable element near the finger
|
|
1324
|
+
* instead of the one under it. That suits most of the board, where a finger
|
|
1325
|
+
* a little off a node or a port still means it, but not a handle drawn on
|
|
1326
|
+
* screen (`data-flow-handle`): on a small node an anchor beside a corner
|
|
1327
|
+
* handle would take the press, and connect instead of resize. A press whose
|
|
1328
|
+
* finger is on such a handle is stopped and sent again to the handle.
|
|
1329
|
+
*
|
|
1330
|
+
* It listens on the window, first among the editor's listeners there, so the
|
|
1331
|
+
* listeners further on (the document's, the editor's own) hear only the press
|
|
1332
|
+
* sent again; a window listener added earlier hears both. A handler that
|
|
1333
|
+
* cancels the press sent again cancels the browser's own one too.
|
|
1334
|
+
*/
|
|
1335
|
+
function onTouchPress(event) {
|
|
1336
|
+
if (event.pointerType !== "touch" || !root.value) return;
|
|
1337
|
+
const handle = (root.value.getRootNode().elementFromPoint?.(event.clientX, event.clientY))?.closest("[data-flow-handle]");
|
|
1338
|
+
if (!handle || !root.value.contains(handle)) return;
|
|
1339
|
+
const target = event.target;
|
|
1340
|
+
if (handle === target || handle.contains(target)) return;
|
|
1341
|
+
event.stopImmediatePropagation();
|
|
1342
|
+
if (!handle.dispatchEvent(new PointerEvent("pointerdown", event))) event.preventDefault();
|
|
1343
|
+
}
|
|
1108
1344
|
function onPointerDown(event) {
|
|
1109
1345
|
const target = event.target;
|
|
1110
1346
|
if (inPanels(target)) return;
|
|
@@ -1141,7 +1377,7 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1141
1377
|
}
|
|
1142
1378
|
if (event.button !== 0) return;
|
|
1143
1379
|
if (target.closest(".dou-flow-editor__label-input")) return;
|
|
1144
|
-
if (resolved.value.presses.length && !
|
|
1380
|
+
if (resolved.value.presses.length && !isInteractive(target)) {
|
|
1145
1381
|
const pressedId = target.closest("[data-node-id]")?.dataset.nodeId;
|
|
1146
1382
|
const press = {
|
|
1147
1383
|
point: toCanvas(client),
|
|
@@ -1207,6 +1443,27 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1207
1443
|
};
|
|
1208
1444
|
return;
|
|
1209
1445
|
}
|
|
1446
|
+
const edgeEndEl = target.closest(".dou-flow-editor__edge-end");
|
|
1447
|
+
if (edgeEndEl && !props.readonly) {
|
|
1448
|
+
const edge = doc.value.edges.find((e) => e.id === edgeEndEl.dataset.edgeId);
|
|
1449
|
+
const end = edgeEndEl.dataset.edgeEnd;
|
|
1450
|
+
const link = edge && (end === "source" || end === "target") ? linkFromEdge(edge, end) : null;
|
|
1451
|
+
if (link) {
|
|
1452
|
+
gesture.value = {
|
|
1453
|
+
kind: "connect",
|
|
1454
|
+
id: event.pointerId,
|
|
1455
|
+
touch,
|
|
1456
|
+
node: null,
|
|
1457
|
+
start: client,
|
|
1458
|
+
client,
|
|
1459
|
+
started: false,
|
|
1460
|
+
link
|
|
1461
|
+
};
|
|
1462
|
+
capture(event.pointerId);
|
|
1463
|
+
root.value.focus({ preventScroll: true });
|
|
1464
|
+
return;
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1210
1467
|
const portEl = target.closest(".dou-flow-port");
|
|
1211
1468
|
if (nodeEl && portEl && !props.readonly) {
|
|
1212
1469
|
const link = linkFrom({
|
|
@@ -1588,8 +1845,74 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1588
1845
|
const connectOptions = () => ({
|
|
1589
1846
|
portTypes: portTypes.value,
|
|
1590
1847
|
acyclic: props.acyclic,
|
|
1591
|
-
canConnect: canConnect.value
|
|
1848
|
+
canConnect: canConnect.value ? (connection) => canConnect.value(connection, toRaw(doc.value)) : void 0
|
|
1592
1849
|
});
|
|
1850
|
+
const sameEnd = (a, b) => a.node === b.node && a.port === b.port;
|
|
1851
|
+
/** Resolves an omitted `port` to the node's matching side port when available. */
|
|
1852
|
+
function resolveEndpoint(end, role) {
|
|
1853
|
+
if (end.port != null) return end;
|
|
1854
|
+
const node = nodeById.value.get(end.node);
|
|
1855
|
+
if (!node) return end;
|
|
1856
|
+
const kind = role === "source" ? "output" : "input";
|
|
1857
|
+
const side = role === "source" ? "right" : "left";
|
|
1858
|
+
const ports = portsOf(specOf(node), node).filter((p) => p.kind === kind);
|
|
1859
|
+
const match = ports.find((p) => portSide(p) === side) ?? ports[0];
|
|
1860
|
+
return match ? {
|
|
1861
|
+
node: end.node,
|
|
1862
|
+
port: match.id
|
|
1863
|
+
} : end;
|
|
1864
|
+
}
|
|
1865
|
+
/** Resolves an endpoint to a concrete port that currently exists with the matching direction. */
|
|
1866
|
+
function resolvedPortEnd(end, role) {
|
|
1867
|
+
const next = resolveEndpoint(end, role);
|
|
1868
|
+
if (next.port == null) return null;
|
|
1869
|
+
const spec = portSpec(next);
|
|
1870
|
+
if (!spec || spec.kind !== (role === "source" ? "output" : "input")) return null;
|
|
1871
|
+
return next;
|
|
1872
|
+
}
|
|
1873
|
+
/** Document view with omitted edge ports resolved to concrete side ports for join checks. */
|
|
1874
|
+
function connectDoc() {
|
|
1875
|
+
const raw = toRaw(doc.value);
|
|
1876
|
+
if (raw.edges.every((e) => e.source.port != null && e.target.port != null)) return raw;
|
|
1877
|
+
return {
|
|
1878
|
+
...raw,
|
|
1879
|
+
edges: raw.edges.map((e) => {
|
|
1880
|
+
const source = resolveEndpoint(e.source, "source");
|
|
1881
|
+
const target = resolveEndpoint(e.target, "target");
|
|
1882
|
+
return source === e.source && target === e.target ? e : {
|
|
1883
|
+
...e,
|
|
1884
|
+
source,
|
|
1885
|
+
target
|
|
1886
|
+
};
|
|
1887
|
+
})
|
|
1888
|
+
};
|
|
1889
|
+
}
|
|
1890
|
+
/** Picks up either end of an existing edge so it can be reconnected or disconnected. */
|
|
1891
|
+
function linkFromEdge(edge, moving) {
|
|
1892
|
+
const fixedRole = moving === "target" ? "source" : "target";
|
|
1893
|
+
const rawFixed = edge[fixedRole];
|
|
1894
|
+
const rawMoving = edge[moving];
|
|
1895
|
+
const fixed = resolvedPortEnd(rawFixed, fixedRole);
|
|
1896
|
+
if (!fixed) return null;
|
|
1897
|
+
const point = anchorOf(edgeEnd(rawMoving), moving);
|
|
1898
|
+
if (!point) return null;
|
|
1899
|
+
const base = {
|
|
1900
|
+
fixed,
|
|
1901
|
+
fixedRaw: rawFixed.port == null ? rawFixed : void 0,
|
|
1902
|
+
moving,
|
|
1903
|
+
edge: edge.id,
|
|
1904
|
+
point,
|
|
1905
|
+
candidate: null
|
|
1906
|
+
};
|
|
1907
|
+
const valid = validEnds(base);
|
|
1908
|
+
const resolvedMoving = resolveEndpoint(rawMoving, moving);
|
|
1909
|
+
const candidate = resolvedMoving.port != null && valid.get(resolvedMoving.node)?.has(resolvedMoving.port) ? resolvedMoving : null;
|
|
1910
|
+
return {
|
|
1911
|
+
...base,
|
|
1912
|
+
candidate,
|
|
1913
|
+
valid
|
|
1914
|
+
};
|
|
1915
|
+
}
|
|
1593
1916
|
/**
|
|
1594
1917
|
* Starts an edge at a port. From an output, or an empty input, it draws a
|
|
1595
1918
|
* new edge; from an input that has an edge, it picks that edge up.
|
|
@@ -1602,8 +1925,9 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1602
1925
|
if (port.kind === "input") {
|
|
1603
1926
|
for (const e of doc.value.edges) if (e.target.node === at.node && e.target.port === at.port) taken = e;
|
|
1604
1927
|
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1928
|
+
const fixed = taken && taken.source.port != null ? resolvedPortEnd(taken.source, "source") : null;
|
|
1929
|
+
if (taken && fixed) link = {
|
|
1930
|
+
fixed,
|
|
1607
1931
|
moving: "target",
|
|
1608
1932
|
edge: taken.id,
|
|
1609
1933
|
point: anchorOf(at, "target") ?? {
|
|
@@ -1637,11 +1961,16 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1637
1961
|
const valid = /* @__PURE__ */ new Map();
|
|
1638
1962
|
const fixedPort = portSpec(link.fixed);
|
|
1639
1963
|
if (!fixedPort) return valid;
|
|
1964
|
+
const fixed = link.fixed;
|
|
1965
|
+
const normalized = connectDoc();
|
|
1640
1966
|
const options = connectOptions();
|
|
1641
1967
|
for (const node of doc.value.nodes) {
|
|
1642
1968
|
const ids = /* @__PURE__ */ new Set();
|
|
1643
1969
|
for (const port of portsOf(specOf(node), node)) {
|
|
1644
|
-
const connection = connectionOf(
|
|
1970
|
+
const connection = connectionOf({
|
|
1971
|
+
fixed,
|
|
1972
|
+
moving: link.moving
|
|
1973
|
+
}, {
|
|
1645
1974
|
node: node.id,
|
|
1646
1975
|
port: port.id
|
|
1647
1976
|
});
|
|
@@ -1652,13 +1981,33 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1652
1981
|
source: port,
|
|
1653
1982
|
target: fixedPort
|
|
1654
1983
|
};
|
|
1655
|
-
if (canJoin(
|
|
1984
|
+
if (canJoin(normalized, connection, ports, options, link.edge)) ids.add(port.id);
|
|
1656
1985
|
}
|
|
1657
1986
|
if (ids.size) valid.set(node.id, ids);
|
|
1658
1987
|
}
|
|
1659
1988
|
return valid;
|
|
1660
1989
|
}
|
|
1661
1990
|
/** How close, in screen px, the pointer must come to a port to snap to it. */
|
|
1991
|
+
function nodeUnderLink(point, client) {
|
|
1992
|
+
const under = (root.value?.getRootNode())?.elementFromPoint?.(client.x, client.y);
|
|
1993
|
+
const hit = under && root.value?.contains(under) ? under.closest("[data-node-id]")?.dataset.nodeId : void 0;
|
|
1994
|
+
if (hit) {
|
|
1995
|
+
const node = nodeById.value.get(hit);
|
|
1996
|
+
if (node && !isContainer(node) && !hiddenIn.value.has(node.id)) return node.id;
|
|
1997
|
+
}
|
|
1998
|
+
for (let i = doc.value.nodes.length - 1; i >= 0; i--) {
|
|
1999
|
+
const node = doc.value.nodes[i];
|
|
2000
|
+
if (isContainer(node) || hiddenIn.value.has(node.id)) continue;
|
|
2001
|
+
const r = rectOf(node);
|
|
2002
|
+
const rot = nodeRotation(node.id);
|
|
2003
|
+
const p = rot ? turn(point, {
|
|
2004
|
+
x: r.x + r.width / 2,
|
|
2005
|
+
y: r.y + r.height / 2
|
|
2006
|
+
}, -rot) : point;
|
|
2007
|
+
if (p.x >= r.x && p.x <= r.x + r.width && p.y >= r.y && p.y <= r.y + r.height) return node.id;
|
|
2008
|
+
}
|
|
2009
|
+
return null;
|
|
2010
|
+
}
|
|
1662
2011
|
function updateLink(g) {
|
|
1663
2012
|
const link = g.link;
|
|
1664
2013
|
const point = toCanvas(g.client);
|
|
@@ -1680,37 +2029,51 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1680
2029
|
};
|
|
1681
2030
|
};
|
|
1682
2031
|
for (const [node, ports] of link.valid) for (const port of ports) consider(node, port, radius);
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
for (const port of over && link.valid.get(over) || []) consider(over, port, Infinity);
|
|
1686
|
-
}
|
|
2032
|
+
const over = nodeUnderLink(point, g.client);
|
|
2033
|
+
if (!best && over) for (const port of link.valid.get(over) || []) consider(over, port, Infinity);
|
|
1687
2034
|
const candidate = best?.end ?? null;
|
|
1688
2035
|
g.link = {
|
|
1689
2036
|
...link,
|
|
1690
2037
|
point,
|
|
1691
2038
|
candidate,
|
|
1692
|
-
|
|
2039
|
+
over: candidate ? null : over,
|
|
2040
|
+
refused: candidate ? null : refusedAt(link, point, radius, over)
|
|
1693
2041
|
};
|
|
1694
2042
|
gesture.value = { ...g };
|
|
1695
2043
|
}
|
|
1696
|
-
/** The nearest port within `radius`
|
|
1697
|
-
function refusedAt(link, point, radius) {
|
|
2044
|
+
/** The nearest port within `radius` (or on the hovered node) that the link can't land on, and why. */
|
|
2045
|
+
function refusedAt(link, point, radius, over) {
|
|
1698
2046
|
const fixedPort = portSpec(link.fixed);
|
|
1699
2047
|
if (!fixedPort) return null;
|
|
2048
|
+
const fixed = link.fixed;
|
|
2049
|
+
const wantedKind = link.moving === "target" ? "input" : "output";
|
|
1700
2050
|
let best = null;
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
2051
|
+
const checkNode = (node, limit) => {
|
|
2052
|
+
for (const port of portsOf(specOf(node), node)) {
|
|
2053
|
+
if (link.valid.get(node.id)?.has(port.id)) continue;
|
|
2054
|
+
const end = {
|
|
2055
|
+
node: node.id,
|
|
2056
|
+
port: port.id
|
|
2057
|
+
};
|
|
2058
|
+
if (end.node === fixed.node && end.port === fixed.port) continue;
|
|
2059
|
+
const at = anchorOf(end, link.moving);
|
|
2060
|
+
const d = at ? Math.hypot(at.x - point.x, at.y - point.y) : Infinity;
|
|
2061
|
+
if (d > limit) continue;
|
|
2062
|
+
const matchKind = port.kind === wantedKind;
|
|
2063
|
+
if (!best || matchKind && !best.matchKind || matchKind === best.matchKind && d < best.d) best = {
|
|
2064
|
+
end,
|
|
2065
|
+
d,
|
|
2066
|
+
matchKind
|
|
2067
|
+
};
|
|
2068
|
+
}
|
|
2069
|
+
};
|
|
2070
|
+
for (const node of doc.value.nodes) {
|
|
2071
|
+
if (hiddenIn.value.has(node.id)) continue;
|
|
2072
|
+
checkNode(node, radius);
|
|
2073
|
+
}
|
|
2074
|
+
if (!best && over) {
|
|
2075
|
+
const node = nodeById.value.get(over);
|
|
2076
|
+
if (node && !isContainer(node) && !hiddenIn.value.has(node.id)) checkNode(node, Infinity);
|
|
1714
2077
|
}
|
|
1715
2078
|
if (!best) return null;
|
|
1716
2079
|
const { end } = best;
|
|
@@ -1722,7 +2085,10 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1722
2085
|
source: port,
|
|
1723
2086
|
target: fixedPort
|
|
1724
2087
|
};
|
|
1725
|
-
const refusal = joinRefusal(
|
|
2088
|
+
const refusal = joinRefusal(connectDoc(), connectionOf({
|
|
2089
|
+
fixed,
|
|
2090
|
+
moving: link.moving
|
|
2091
|
+
}, end), ports, connectOptions(), link.edge);
|
|
1726
2092
|
return refusal && {
|
|
1727
2093
|
end,
|
|
1728
2094
|
refusal
|
|
@@ -1733,26 +2099,18 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1733
2099
|
if (refusal.reason === "custom") return refusal.message ?? messages.value.refused.custom;
|
|
1734
2100
|
return messages.value.refused[refusal.reason];
|
|
1735
2101
|
}
|
|
1736
|
-
/**
|
|
1737
|
-
function overNode(link) {
|
|
1738
|
-
const { x, y } = link.point;
|
|
1739
|
-
return doc.value.nodes.some((node) => {
|
|
1740
|
-
if (node.id === link.fixed.node || isContainer(node)) return false;
|
|
1741
|
-
const r = rectOf(node);
|
|
1742
|
-
return x >= r.x && x <= r.x + r.width && y >= r.y && y <= r.y + r.height;
|
|
1743
|
-
});
|
|
1744
|
-
}
|
|
1745
|
-
/** Adds the edge a link describes, replacing what it must. */
|
|
2102
|
+
/** Adds or updates the edge a link describes, replacing what it must. */
|
|
1746
2103
|
function finishLink(link, event) {
|
|
1747
2104
|
const { candidate } = link;
|
|
1748
2105
|
if (!candidate) {
|
|
1749
2106
|
if (link.refused) announce(refusalText(link.refused.refusal));
|
|
1750
|
-
else if (
|
|
2107
|
+
else if (link.over) announce(link.over === link.fixed.node ? messages.value.refused.self : messages.value.noTarget);
|
|
1751
2108
|
else if (link.edge) {
|
|
1752
2109
|
const id = link.edge;
|
|
1753
|
-
transact((
|
|
2110
|
+
if (transact((t) => t.removeEdge(id)).changed) announce(format(messages.value.deleted, { count: 1 }));
|
|
1754
2111
|
} else if (event) {
|
|
1755
|
-
|
|
2112
|
+
const from = link.fixed;
|
|
2113
|
+
emit("connectToCanvas", from, link.point, event);
|
|
1756
2114
|
if (!event.defaultPrevented && paletteTypes.value.length) quickAdd.value = {
|
|
1757
2115
|
link,
|
|
1758
2116
|
at: link.point,
|
|
@@ -1760,31 +2118,56 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1760
2118
|
x: event.clientX,
|
|
1761
2119
|
y: event.clientY
|
|
1762
2120
|
},
|
|
1763
|
-
types: typesTaking(
|
|
2121
|
+
types: typesTaking(from),
|
|
1764
2122
|
touch: event.pointerType === "touch"
|
|
1765
2123
|
};
|
|
1766
2124
|
}
|
|
1767
2125
|
return;
|
|
1768
2126
|
}
|
|
1769
|
-
const
|
|
2127
|
+
const fixed = link.fixed;
|
|
2128
|
+
const connection = connectionOf({
|
|
2129
|
+
fixed,
|
|
2130
|
+
moving: link.moving
|
|
2131
|
+
}, candidate);
|
|
1770
2132
|
const source = portSpec(connection.source);
|
|
1771
2133
|
const target = portSpec(connection.target);
|
|
2134
|
+
const displaced = source && target ? displacedEdges(connectDoc(), connection, {
|
|
2135
|
+
source,
|
|
2136
|
+
target
|
|
2137
|
+
}, link.edge) : [];
|
|
2138
|
+
if (link.edge) {
|
|
2139
|
+
const existing = doc.value.edges.find((e) => e.id === link.edge);
|
|
2140
|
+
if (!existing) return;
|
|
2141
|
+
const originalSource = resolveEndpoint(existing.source, "source");
|
|
2142
|
+
const originalTarget = resolveEndpoint(existing.target, "target");
|
|
2143
|
+
if (sameEnd(originalSource, connection.source) && sameEnd(originalTarget, connection.target)) return;
|
|
2144
|
+
const patch = {
|
|
2145
|
+
...link.moving === "source" ? { source: candidate } : { target: candidate },
|
|
2146
|
+
...existing.points ? { points: void 0 } : {}
|
|
2147
|
+
};
|
|
2148
|
+
const tr = transact((t) => {
|
|
2149
|
+
for (const id of displaced) t.removeEdge(id);
|
|
2150
|
+
t.updateEdge(existing.id, patch);
|
|
2151
|
+
});
|
|
2152
|
+
const updated = tr.doc.edges.find((e) => e.id === existing.id);
|
|
2153
|
+
if (tr.changed && updated) {
|
|
2154
|
+
emit("connect", updated);
|
|
2155
|
+
announce(messages.value.connected);
|
|
2156
|
+
}
|
|
2157
|
+
return;
|
|
2158
|
+
}
|
|
1772
2159
|
const edge = {
|
|
1773
2160
|
id: createId("e"),
|
|
1774
2161
|
source: connection.source,
|
|
1775
2162
|
target: connection.target
|
|
1776
2163
|
};
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
}
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
tr.addEdge(edge);
|
|
1785
|
-
});
|
|
1786
|
-
emit("connect", edge);
|
|
1787
|
-
announce(messages.value.connected);
|
|
2164
|
+
if (transact((t) => {
|
|
2165
|
+
for (const id of displaced) t.removeEdge(id);
|
|
2166
|
+
t.addEdge(edge);
|
|
2167
|
+
}).changed) {
|
|
2168
|
+
emit("connect", edge);
|
|
2169
|
+
announce(messages.value.connected);
|
|
2170
|
+
}
|
|
1788
2171
|
}
|
|
1789
2172
|
/** What the canvas shows while an edge is being drawn, by mouse, touch or keyboard. */
|
|
1790
2173
|
const connecting = computed(() => {
|
|
@@ -1792,11 +2175,11 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1792
2175
|
if (g?.kind === "connect" && g.started) return g.link;
|
|
1793
2176
|
return keyLink.value;
|
|
1794
2177
|
});
|
|
1795
|
-
const
|
|
2178
|
+
const previewEdge = computed(() => {
|
|
1796
2179
|
const link = connecting.value ?? quickAdd.value?.link;
|
|
1797
2180
|
if (!link) return null;
|
|
1798
2181
|
const fixedRole = link.moving === "target" ? "source" : "target";
|
|
1799
|
-
const a = anchorOf(link.fixed, fixedRole);
|
|
2182
|
+
const a = anchorOf(edgeEnd(link.fixedRaw ?? link.fixed), fixedRole);
|
|
1800
2183
|
if (!a) return null;
|
|
1801
2184
|
const c = link.candidate && anchorOf(link.candidate, link.moving);
|
|
1802
2185
|
const opposite = {
|
|
@@ -1809,10 +2192,27 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1809
2192
|
...link.point,
|
|
1810
2193
|
side: opposite[a.side]
|
|
1811
2194
|
};
|
|
1812
|
-
const
|
|
1813
|
-
const
|
|
1814
|
-
|
|
2195
|
+
const existing = link.edge ? doc.value.edges.find((e) => e.id === link.edge) : void 0;
|
|
2196
|
+
const moved = existing?.points ? {
|
|
2197
|
+
...existing,
|
|
2198
|
+
points: void 0
|
|
2199
|
+
} : existing;
|
|
2200
|
+
const spec = edgeTypeOf(moved?.type);
|
|
2201
|
+
const route = link.moving === "target" ? spec.route(a, b, moved) : spec.route(b, a, moved);
|
|
2202
|
+
return {
|
|
2203
|
+
type: spec.type,
|
|
2204
|
+
route,
|
|
2205
|
+
style: moved ? edgeStyle(moved) : void 0,
|
|
2206
|
+
reconnecting: !!link.edge,
|
|
2207
|
+
detaching: !!link.edge && !link.candidate && !link.refused && !link.over,
|
|
2208
|
+
snapped: !!link.edge && !!link.candidate,
|
|
2209
|
+
end: {
|
|
2210
|
+
x: b.x,
|
|
2211
|
+
y: b.y
|
|
2212
|
+
}
|
|
2213
|
+
};
|
|
1815
2214
|
});
|
|
2215
|
+
const previewPath = computed(() => previewEdge.value?.route.path ?? null);
|
|
1816
2216
|
/** How each port looks while connecting: by node, then port. */
|
|
1817
2217
|
const portStates = computed(() => {
|
|
1818
2218
|
const link = connecting.value;
|
|
@@ -1833,7 +2233,6 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1833
2233
|
return states;
|
|
1834
2234
|
});
|
|
1835
2235
|
const keyLink = shallowRef(null);
|
|
1836
|
-
/** Valid ends of a link, nearest first. */
|
|
1837
2236
|
/** A port's anchor; nodes not measured yet fall back to their corner. */
|
|
1838
2237
|
function place(end, role) {
|
|
1839
2238
|
return anchorOf(end, role) ?? nodeById.value.get(end.node) ?? {
|
|
@@ -1841,6 +2240,7 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1841
2240
|
y: 0
|
|
1842
2241
|
};
|
|
1843
2242
|
}
|
|
2243
|
+
/** Valid ends of a link, nearest first. */
|
|
1844
2244
|
function rankEnds(link) {
|
|
1845
2245
|
const at = place(link.fixed, link.moving === "target" ? "source" : "target");
|
|
1846
2246
|
const ends = [];
|
|
@@ -1989,6 +2389,8 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
1989
2389
|
x,
|
|
1990
2390
|
y,
|
|
1991
2391
|
locked: void 0,
|
|
2392
|
+
comments: void 0,
|
|
2393
|
+
commentPins: void 0,
|
|
1992
2394
|
parent: copied ?? containerAt(centre, containers)
|
|
1993
2395
|
};
|
|
1994
2396
|
});
|
|
@@ -2005,6 +2407,7 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
2005
2407
|
y: p.y + shift.y
|
|
2006
2408
|
})),
|
|
2007
2409
|
id: createId("e"),
|
|
2410
|
+
comments: void 0,
|
|
2008
2411
|
source: {
|
|
2009
2412
|
...edge.source,
|
|
2010
2413
|
node: source
|
|
@@ -2249,21 +2652,27 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
2249
2652
|
return true;
|
|
2250
2653
|
}
|
|
2251
2654
|
onMounted(() => {
|
|
2655
|
+
window.addEventListener("pointerdown", onTouchPress, true);
|
|
2252
2656
|
window.addEventListener("pointerdown", onMenuPress, true);
|
|
2253
2657
|
window.addEventListener("click", onMenuClick);
|
|
2254
2658
|
});
|
|
2255
2659
|
onBeforeUnmount(() => {
|
|
2660
|
+
window.removeEventListener("pointerdown", onTouchPress, true);
|
|
2256
2661
|
window.removeEventListener("pointerdown", onMenuPress, true);
|
|
2257
2662
|
window.removeEventListener("click", onMenuClick);
|
|
2258
2663
|
});
|
|
2664
|
+
/** The toolbar's groups with something in; while read-only, only what is offered then too, such as comments. */
|
|
2665
|
+
function offeredItems(lists, readonly) {
|
|
2666
|
+
return lists.map((list) => readonly ? list.filter((item) => item.showWhenReadonly) : list).filter((list) => list.length);
|
|
2667
|
+
}
|
|
2259
2668
|
const toolbarItems = computed(() => {
|
|
2260
|
-
if (
|
|
2669
|
+
if (gesture.value || keyLink.value || quickAdd.value) return [];
|
|
2261
2670
|
const nodes = selection.value.nodes.flatMap((id) => nodeById.value.get(id) ?? []);
|
|
2262
|
-
if (nodes.length) return resolved.value.toolbars.map((fn) => fn(context, nodes))
|
|
2671
|
+
if (nodes.length) return offeredItems(resolved.value.toolbars.map((fn) => fn(context, nodes)), props.readonly);
|
|
2263
2672
|
const ids = new Set(selection.value.edges);
|
|
2264
2673
|
const edges = doc.value.edges.filter((edge) => ids.has(edge.id));
|
|
2265
2674
|
if (!edges.length) return [];
|
|
2266
|
-
return resolved.value.edgeToolbars.map((fn) => fn(context, edges))
|
|
2675
|
+
return offeredItems(resolved.value.edgeToolbars.map((fn) => fn(context, edges)), props.readonly);
|
|
2267
2676
|
});
|
|
2268
2677
|
/** Where the toolbar floats: above the selected nodes, in screen px within the editor. */
|
|
2269
2678
|
const toolbarAnchor = computed(() => {
|
|
@@ -2294,9 +2703,12 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
2294
2703
|
height: bounds.height + reach * 2
|
|
2295
2704
|
};
|
|
2296
2705
|
const avoid = nodes.length ? void 0 : shownNodes.value.filter((node) => !hiddenIn.value.has(node.id) && !isContainer(node)).map((node) => rectOf(node)).filter((rect) => intersects(rect, band)).map(screen);
|
|
2706
|
+
const keys = /* @__PURE__ */ new Set([...nodes.map((id) => `n:${id}`), ...edges.map((id) => `e:${id}`)]);
|
|
2707
|
+
const marked = commentMarkers.value.filter((marker) => keys.has(marker.key));
|
|
2708
|
+
const top = Math.min(bounds.y * zoom + y, ...marked.map(markerTop));
|
|
2297
2709
|
return {
|
|
2298
2710
|
x: (bounds.x + bounds.width / 2) * zoom + x,
|
|
2299
|
-
top
|
|
2711
|
+
top,
|
|
2300
2712
|
bottom: (bounds.y + bounds.height) * zoom + y,
|
|
2301
2713
|
avoid
|
|
2302
2714
|
};
|
|
@@ -2306,7 +2718,7 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
2306
2718
|
const pendingAdd = quickAdd.value;
|
|
2307
2719
|
quickAdd.value = null;
|
|
2308
2720
|
if (!pendingAdd) return;
|
|
2309
|
-
if (type) insertNode(type, {
|
|
2721
|
+
if (type && pendingAdd.link.fixed.port != null) insertNode(type, {
|
|
2310
2722
|
at: pendingAdd.at,
|
|
2311
2723
|
from: pendingAdd.link.fixed
|
|
2312
2724
|
});
|
|
@@ -2460,7 +2872,7 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
2460
2872
|
return;
|
|
2461
2873
|
} else if (g.kind === "connect") {
|
|
2462
2874
|
if (g.started) finishLink(g.link, event);
|
|
2463
|
-
else setSelection({
|
|
2875
|
+
else if (g.node) setSelection({
|
|
2464
2876
|
nodes: [g.node],
|
|
2465
2877
|
edges: []
|
|
2466
2878
|
});
|
|
@@ -2489,8 +2901,10 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
2489
2901
|
clearPress();
|
|
2490
2902
|
cancelAnimationFrame(autoPanFrame);
|
|
2491
2903
|
if (g && root.value?.hasPointerCapture(g.id)) root.value.releasePointerCapture(g.id);
|
|
2492
|
-
if ((g?.kind === "drag" || g?.kind === "bend") && g.started)
|
|
2493
|
-
|
|
2904
|
+
if ((g?.kind === "drag" || g?.kind === "bend") && g.started || g?.kind === "resize") {
|
|
2905
|
+
if (customHistory) customHistory.close?.();
|
|
2906
|
+
else history.close();
|
|
2907
|
+
}
|
|
2494
2908
|
gesture.value = null;
|
|
2495
2909
|
guides.value = [];
|
|
2496
2910
|
dropTarget.value = null;
|
|
@@ -2504,7 +2918,8 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
2504
2918
|
if (g.kind === "bend") tr.updateEdge(g.edge, { data: g.origin });
|
|
2505
2919
|
else for (const [id, o] of g.origins) tr.moveNode(id, o.x, o.y);
|
|
2506
2920
|
if (tr.changed) commit(tr);
|
|
2507
|
-
|
|
2921
|
+
if (customHistory) customHistory.drop?.(g.group);
|
|
2922
|
+
else history.drop(g.group);
|
|
2508
2923
|
syncHistory();
|
|
2509
2924
|
endGesture();
|
|
2510
2925
|
return true;
|
|
@@ -2553,11 +2968,13 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
2553
2968
|
return false;
|
|
2554
2969
|
}
|
|
2555
2970
|
function onDblclick(event) {
|
|
2556
|
-
const
|
|
2971
|
+
const target = event.target;
|
|
2972
|
+
if (target.closest(".dou-flow-editor__edge-end")) return;
|
|
2973
|
+
const nodeEl = target.closest("[data-node-id]");
|
|
2557
2974
|
const node = nodeEl && nodeById.value.get(nodeEl.dataset.nodeId);
|
|
2558
2975
|
if (node) emit("nodeDblclick", node, event);
|
|
2559
2976
|
else {
|
|
2560
|
-
const edgeEl =
|
|
2977
|
+
const edgeEl = target.closest("[data-edge-id]");
|
|
2561
2978
|
if (edgeEl) editLabel(edgeEl.getAttribute("data-edge-id"));
|
|
2562
2979
|
}
|
|
2563
2980
|
}
|
|
@@ -2818,8 +3235,9 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
2818
3235
|
const nodeEl = target.closest("[data-node-id]");
|
|
2819
3236
|
if (nodeEl && nodeEl !== target) return;
|
|
2820
3237
|
if (keyLink.value) return onKeyLink(event);
|
|
2821
|
-
if (event.key === "Escape" && gesture.value?.kind === "press") {
|
|
3238
|
+
if (event.key === "Escape" && (gesture.value?.kind === "press" || gesture.value?.kind === "connect")) {
|
|
2822
3239
|
event.preventDefault();
|
|
3240
|
+
event.stopPropagation();
|
|
2823
3241
|
endGesture();
|
|
2824
3242
|
return;
|
|
2825
3243
|
}
|
|
@@ -3204,7 +3622,7 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3204
3622
|
"is-space": spaceHeld.value,
|
|
3205
3623
|
"is-dragging": !!dragging.value,
|
|
3206
3624
|
"is-connecting": !!connecting.value,
|
|
3207
|
-
"is-refused": !!connecting.value
|
|
3625
|
+
"is-refused": !!connecting.value && (!!connecting.value.refused || !connecting.value.candidate && !!connecting.value.over),
|
|
3208
3626
|
"is-bordered": props.bordered
|
|
3209
3627
|
}));
|
|
3210
3628
|
const context = {
|
|
@@ -3230,6 +3648,8 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3230
3648
|
portTypeOf,
|
|
3231
3649
|
colorOf,
|
|
3232
3650
|
getNodeRect,
|
|
3651
|
+
comment: (on, options) => comments.start(on, options?.focus ?? true),
|
|
3652
|
+
canComment: comments.writable,
|
|
3233
3653
|
tidy,
|
|
3234
3654
|
centerNode,
|
|
3235
3655
|
announce,
|
|
@@ -3419,6 +3839,170 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3419
3839
|
...PNG_SOURCE
|
|
3420
3840
|
});
|
|
3421
3841
|
}
|
|
3842
|
+
/** Half an edge label's height, in canvas px. */
|
|
3843
|
+
const markerCenter = (marker) => marker.number !== void 0 ? {
|
|
3844
|
+
x: marker.x + MARKER_SIZE / 2,
|
|
3845
|
+
y: marker.y - MARKER_SIZE / 2
|
|
3846
|
+
} : "node" in marker.anchor ? {
|
|
3847
|
+
x: marker.x + 6 + MARKER_SIZE / 2,
|
|
3848
|
+
y: marker.y - 6 - MARKER_SIZE / 2
|
|
3849
|
+
} : {
|
|
3850
|
+
x: marker.x,
|
|
3851
|
+
y: marker.y
|
|
3852
|
+
};
|
|
3853
|
+
/** A marker's key: one per node and edge, and one per pin (`thread`; a pin being started has none). */
|
|
3854
|
+
const spotKey = (on, thread) => "edge" in on ? `e:${on.edge}` : on.at ? `p:${thread ?? ""}` : `n:${on.node}`;
|
|
3855
|
+
/** The top of a marker with a finger's target around it, in px within the editor. */
|
|
3856
|
+
const markerTop = (marker) => markerCenter(marker).y - MARKER_SIZE / 2 - 8 - (marker.lifted ? 8 : 0);
|
|
3857
|
+
/** Where a node or edge shows its comments: a collapsed container hiding it shows them instead. */
|
|
3858
|
+
function commentSpotOf(on) {
|
|
3859
|
+
const hidden = hiddenIn.value;
|
|
3860
|
+
if ("node" in on) {
|
|
3861
|
+
if (!nodeById.value.has(on.node)) return null;
|
|
3862
|
+
const outer = hidden.get(on.node);
|
|
3863
|
+
return outer ? { node: outer } : on;
|
|
3864
|
+
}
|
|
3865
|
+
if (edgeRouteById.value.has(on.edge)) return on;
|
|
3866
|
+
const edge = doc.value.edges.find((e) => e.id === on.edge);
|
|
3867
|
+
const outer = edge && (hidden.get(edge.source.node) ?? hidden.get(edge.target.node));
|
|
3868
|
+
return outer ? { node: outer } : null;
|
|
3869
|
+
}
|
|
3870
|
+
const edgeRouteById = computed(() => new Map(edgeRoutes.value.map((item) => [item.edge.id, item])));
|
|
3871
|
+
/**
|
|
3872
|
+
* The markers, in canvas px: one at the top right of each node and on each
|
|
3873
|
+
* edge's middle with open threads. Worked out as the document changes; the
|
|
3874
|
+
* view only moves them, below.
|
|
3875
|
+
*/
|
|
3876
|
+
const commentSpots = computed(() => {
|
|
3877
|
+
if (!comments.enabled.value) return [];
|
|
3878
|
+
const { nodes, edges, pins } = comments.openOn.value;
|
|
3879
|
+
const spots = /* @__PURE__ */ new Map();
|
|
3880
|
+
const add = (on, threads, extra = {}) => {
|
|
3881
|
+
const spot = commentSpotOf(on);
|
|
3882
|
+
if (!spot) return;
|
|
3883
|
+
const key = spotKey(spot, extra.thread);
|
|
3884
|
+
const had = spots.get(key);
|
|
3885
|
+
if (had) {
|
|
3886
|
+
for (const id of threads) if (!had.threads.includes(id)) had.threads.push(id);
|
|
3887
|
+
if (extra.pending) had.pending = true;
|
|
3888
|
+
return;
|
|
3889
|
+
}
|
|
3890
|
+
let at;
|
|
3891
|
+
let lift = 0;
|
|
3892
|
+
if ("node" in spot && spot.at) {
|
|
3893
|
+
const node = nodeById.value.get(spot.node);
|
|
3894
|
+
const rect = rectOf(node);
|
|
3895
|
+
const point = {
|
|
3896
|
+
x: rect.x + spot.at.x * rect.width,
|
|
3897
|
+
y: rect.y + spot.at.y * rect.height
|
|
3898
|
+
};
|
|
3899
|
+
const centre = {
|
|
3900
|
+
x: rect.x + rect.width / 2,
|
|
3901
|
+
y: rect.y + rect.height / 2
|
|
3902
|
+
};
|
|
3903
|
+
at = turn(point, centre, nodeRotation(node.id));
|
|
3904
|
+
} else if ("node" in spot) {
|
|
3905
|
+
const node = nodeById.value.get(spot.node);
|
|
3906
|
+
const box = nodeBounds(specOf(node), node, rectOf(node));
|
|
3907
|
+
at = {
|
|
3908
|
+
x: box.x + box.width,
|
|
3909
|
+
y: box.y
|
|
3910
|
+
};
|
|
3911
|
+
} else {
|
|
3912
|
+
const item = edgeRouteById.value.get(spot.edge);
|
|
3913
|
+
at = item.route.label;
|
|
3914
|
+
if (item.edge.label) {
|
|
3915
|
+
at = {
|
|
3916
|
+
x: at.x,
|
|
3917
|
+
y: at.y - EDGE_LABEL_HALF
|
|
3918
|
+
};
|
|
3919
|
+
lift = EDGE_MARKER_LIFT;
|
|
3920
|
+
}
|
|
3921
|
+
}
|
|
3922
|
+
spots.set(key, {
|
|
3923
|
+
key,
|
|
3924
|
+
anchor: spot,
|
|
3925
|
+
threads: [...threads],
|
|
3926
|
+
shown: [],
|
|
3927
|
+
pending: !!extra.pending,
|
|
3928
|
+
number: "node" in spot && spot.at ? extra.number ?? spot.number ?? 0 : void 0,
|
|
3929
|
+
node: "node" in spot ? nodeName(spot.node) : void 0,
|
|
3930
|
+
...at,
|
|
3931
|
+
lift
|
|
3932
|
+
});
|
|
3933
|
+
};
|
|
3934
|
+
for (const [id, threads] of nodes) add({ node: id }, threads);
|
|
3935
|
+
for (const pin of pins) add({
|
|
3936
|
+
node: pin.node,
|
|
3937
|
+
at: pin.at
|
|
3938
|
+
}, [pin.thread], {
|
|
3939
|
+
number: pin.number,
|
|
3940
|
+
thread: pin.thread
|
|
3941
|
+
});
|
|
3942
|
+
for (const [id, threads] of edges) add({ edge: id }, threads);
|
|
3943
|
+
const starting = comments.pending.value;
|
|
3944
|
+
if (starting) add(starting, [], { pending: true });
|
|
3945
|
+
const list = [...spots.values()];
|
|
3946
|
+
const active = comments.active.value;
|
|
3947
|
+
const where = active ? commentAnchorOf(active) : null;
|
|
3948
|
+
for (const spot of list) spot.shown = spot.threads;
|
|
3949
|
+
if (active && where) {
|
|
3950
|
+
const spot = commentSpotOf(where);
|
|
3951
|
+
const key = spot && spotKey(spot, active);
|
|
3952
|
+
const there = key && spots.get(key);
|
|
3953
|
+
if (there && !there.threads.includes(active)) there.shown = [...there.threads, active];
|
|
3954
|
+
else if (!there) {
|
|
3955
|
+
add(where, [], { thread: active });
|
|
3956
|
+
const added = key && spots.get(key);
|
|
3957
|
+
if (added) {
|
|
3958
|
+
added.shown = [active];
|
|
3959
|
+
list.push(added);
|
|
3960
|
+
}
|
|
3961
|
+
}
|
|
3962
|
+
}
|
|
3963
|
+
return list;
|
|
3964
|
+
});
|
|
3965
|
+
/**
|
|
3966
|
+
* The markers in px within the editor: only this follows the view as it
|
|
3967
|
+
* pans and zooms. An edge's marker that would sit on another one moves
|
|
3968
|
+
* aside, so each can be tapped.
|
|
3969
|
+
*/
|
|
3970
|
+
const commentMarkers = computed(() => {
|
|
3971
|
+
const { x: vx, y: vy, zoom } = viewport.value;
|
|
3972
|
+
const markers = commentSpots.value.map(({ x, y, lift, ...spot }) => ({
|
|
3973
|
+
...spot,
|
|
3974
|
+
x: x * zoom + vx,
|
|
3975
|
+
y: y * zoom + vy - lift,
|
|
3976
|
+
lifted: lift > 0
|
|
3977
|
+
}));
|
|
3978
|
+
const placed = markers.filter((marker) => "node" in marker.anchor).map(markerCenter);
|
|
3979
|
+
for (const marker of markers) {
|
|
3980
|
+
if ("node" in marker.anchor) continue;
|
|
3981
|
+
for (let tries = 0; tries < 8; tries++) {
|
|
3982
|
+
const other = placed.find((p) => Math.abs(p.x - marker.x) < MARKER_GAP && Math.abs(p.y - marker.y) < MARKER_GAP);
|
|
3983
|
+
if (!other) break;
|
|
3984
|
+
marker.x = other.x + (marker.x < other.x ? -32 : MARKER_GAP);
|
|
3985
|
+
}
|
|
3986
|
+
placed.push(markerCenter(marker));
|
|
3987
|
+
}
|
|
3988
|
+
return markers;
|
|
3989
|
+
});
|
|
3990
|
+
watch(() => props.activeComment, (id) => {
|
|
3991
|
+
const at = id && !comments.openedHere(id) ? commentAnchorOf(id) : null;
|
|
3992
|
+
const on = at && commentSpotOf(at);
|
|
3993
|
+
if (!on) return;
|
|
3994
|
+
if ("node" in on) return reveal(on.node);
|
|
3995
|
+
const label = edgeRouteById.value.get(on.edge)?.route.label;
|
|
3996
|
+
if (label) revealRect({
|
|
3997
|
+
x: label.x - 16,
|
|
3998
|
+
y: label.y - 16,
|
|
3999
|
+
width: 32,
|
|
4000
|
+
height: 32
|
|
4001
|
+
});
|
|
4002
|
+
});
|
|
4003
|
+
function restoreCommentFocus(on) {
|
|
4004
|
+
((on && "node" in on ? root.value?.querySelector(`[data-node-id="${CSS.escape(on.node)}"]`) : null) ?? root.value)?.focus({ preventScroll: true });
|
|
4005
|
+
}
|
|
3422
4006
|
__expose({
|
|
3423
4007
|
setViewport,
|
|
3424
4008
|
openSearch,
|
|
@@ -3447,6 +4031,8 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3447
4031
|
return [...staleEdges.value];
|
|
3448
4032
|
},
|
|
3449
4033
|
removeStaleEdges,
|
|
4034
|
+
comment: (on, options) => comments.start(on, options?.focus ?? true),
|
|
4035
|
+
getCommentAnchors,
|
|
3450
4036
|
insertNode,
|
|
3451
4037
|
startInsertDrag,
|
|
3452
4038
|
editLabel,
|
|
@@ -3572,11 +4158,25 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3572
4158
|
d: item.route.marks
|
|
3573
4159
|
}, null, 14, _hoisted_8)) : createCommentVNode("", true)
|
|
3574
4160
|
], 8, _hoisted_5);
|
|
3575
|
-
}), 128)),
|
|
4161
|
+
}), 128)), previewEdge.value ? (openBlock(), createElementBlock("g", {
|
|
4162
|
+
key: 0,
|
|
4163
|
+
"data-edge-type": previewEdge.value.type
|
|
4164
|
+
}, [createElementVNode("path", {
|
|
4165
|
+
class: normalizeClass(["dou-flow-editor__edge is-preview", {
|
|
4166
|
+
"is-detaching": previewEdge.value.detaching,
|
|
4167
|
+
"is-snapped": previewEdge.value.snapped
|
|
4168
|
+
}]),
|
|
4169
|
+
style: normalizeStyle(previewEdge.value.snapped ? previewEdge.value.style : void 0),
|
|
4170
|
+
d: previewEdge.value.route.path
|
|
4171
|
+
}, null, 14, _hoisted_10), previewEdge.value.route.marks ? (openBlock(), createElementBlock("path", {
|
|
3576
4172
|
key: 0,
|
|
3577
|
-
class: "dou-flow-editor__edge is-preview",
|
|
3578
|
-
|
|
3579
|
-
|
|
4173
|
+
class: normalizeClass(["dou-flow-editor__edge is-preview is-mark", {
|
|
4174
|
+
"is-detaching": previewEdge.value.detaching,
|
|
4175
|
+
"is-snapped": previewEdge.value.snapped
|
|
4176
|
+
}]),
|
|
4177
|
+
style: normalizeStyle(previewEdge.value.snapped ? previewEdge.value.style : void 0),
|
|
4178
|
+
d: previewEdge.value.route.marks
|
|
4179
|
+
}, null, 14, _hoisted_11)) : createCommentVNode("", true)], 8, _hoisted_9)) : createCommentVNode("", true)])),
|
|
3580
4180
|
(openBlock(true), createElementBlock(Fragment, null, renderList(edgeLabels.value, (item) => {
|
|
3581
4181
|
return openBlock(), createElementBlock("div", {
|
|
3582
4182
|
key: item.edge.id,
|
|
@@ -3594,7 +4194,7 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3594
4194
|
"aria-label": unref(messages).label,
|
|
3595
4195
|
onKeydown: onLabelKeydown,
|
|
3596
4196
|
onBlur: _cache[1] || (_cache[1] = ($event) => finishLabel(true))
|
|
3597
|
-
}, null, 40,
|
|
4197
|
+
}, null, 40, _hoisted_13)), [[vModelText, labelDraft.value]]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(item.edge.label), 1)], 64))], 14, _hoisted_12);
|
|
3598
4198
|
}), 128)),
|
|
3599
4199
|
bend.value && !bend.value.edge.label && editingLabel.value !== bend.value.edge.id ? (openBlock(), createElementBlock("div", {
|
|
3600
4200
|
key: 0,
|
|
@@ -3619,7 +4219,7 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3619
4219
|
"aria-roledescription": roleOf(node),
|
|
3620
4220
|
"aria-label": nameOf(node),
|
|
3621
4221
|
tabindex: "-1"
|
|
3622
|
-
}, [renderSlot(_ctx.$slots, "simple", { node }, () => [viewport.value.zoom >= TINY ? (openBlock(), createElementBlock("span",
|
|
4222
|
+
}, [renderSlot(_ctx.$slots, "simple", { node }, () => [viewport.value.zoom >= TINY ? (openBlock(), createElementBlock("span", _hoisted_15, toDisplayString(unref(labelOf)(specOf(node), node, unref(messages))), 1)) : createCommentVNode("", true)])], 14, _hoisted_14)) : (openBlock(), createBlock(node_view_default, {
|
|
3623
4223
|
key: 1,
|
|
3624
4224
|
node,
|
|
3625
4225
|
spec: specOf(node),
|
|
@@ -3648,17 +4248,34 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3648
4248
|
"drop-target"
|
|
3649
4249
|
]))], 64);
|
|
3650
4250
|
}), 128)),
|
|
4251
|
+
edgeHandles.value ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(edgeHandles.value.ends, (item) => {
|
|
4252
|
+
return openBlock(), createElementBlock("div", {
|
|
4253
|
+
key: `${edgeHandles.value.edge.id}-${item.end}`,
|
|
4254
|
+
class: normalizeClass(["dou-flow-editor__edge-end", `is-${item.end}`]),
|
|
4255
|
+
style: normalizeStyle({ translate: `calc(${item.at.x}px - 50%) calc(${item.at.y}px - 50%)` }),
|
|
4256
|
+
"data-edge-id": edgeHandles.value.edge.id,
|
|
4257
|
+
"data-edge-end": item.end,
|
|
4258
|
+
"data-flow-handle": "",
|
|
4259
|
+
"aria-hidden": "true"
|
|
4260
|
+
}, null, 14, _hoisted_16);
|
|
4261
|
+
}), 128)) : createCommentVNode("", true),
|
|
4262
|
+
previewEdge.value?.reconnecting && !previewEdge.value.snapped ? (openBlock(), createElementBlock("div", {
|
|
4263
|
+
key: 2,
|
|
4264
|
+
class: normalizeClass(["dou-flow-editor__edge-end is-dragging", { "is-detaching": previewEdge.value.detaching }]),
|
|
4265
|
+
style: normalizeStyle({ translate: `calc(${previewEdge.value.end.x}px - 50%) calc(${previewEdge.value.end.y}px - 50%)` }),
|
|
4266
|
+
"aria-hidden": "true"
|
|
4267
|
+
}, null, 6)) : createCommentVNode("", true),
|
|
3651
4268
|
(openBlock(true), createElementBlock(Fragment, null, renderList(resolved.value.above, (layer, i) => {
|
|
3652
4269
|
return openBlock(), createBlock(resolveDynamicComponent(layer), { key: `above-${i}` });
|
|
3653
4270
|
}), 128)),
|
|
3654
|
-
guides.value.length ? (openBlock(), createElementBlock("svg",
|
|
4271
|
+
guides.value.length ? (openBlock(), createElementBlock("svg", _hoisted_17, [(openBlock(true), createElementBlock(Fragment, null, renderList(guides.value, (guide, i) => {
|
|
3655
4272
|
return openBlock(), createElementBlock("line", {
|
|
3656
4273
|
key: i,
|
|
3657
4274
|
x1: guide.axis === "x" ? guide.at : guide.from,
|
|
3658
4275
|
y1: guide.axis === "x" ? guide.from : guide.at,
|
|
3659
4276
|
x2: guide.axis === "x" ? guide.at : guide.to,
|
|
3660
4277
|
y2: guide.axis === "x" ? guide.to : guide.at
|
|
3661
|
-
}, null, 8,
|
|
4278
|
+
}, null, 8, _hoisted_18);
|
|
3662
4279
|
}), 128))])) : createCommentVNode("", true)
|
|
3663
4280
|
], 4),
|
|
3664
4281
|
marquee.value ? (openBlock(), createElementBlock("div", {
|
|
@@ -3675,8 +4292,19 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3675
4292
|
(openBlock(true), createElementBlock(Fragment, null, renderList(resolved.value.overlays, (overlay, i) => {
|
|
3676
4293
|
return openBlock(), createBlock(resolveDynamicComponent(overlay), { key: i });
|
|
3677
4294
|
}), 128)),
|
|
3678
|
-
|
|
4295
|
+
unref(comments).enabled.value ? (openBlock(), createBlock(flow_comments_default, {
|
|
3679
4296
|
key: 0,
|
|
4297
|
+
comments: unref(comments),
|
|
4298
|
+
markers: commentMarkers.value,
|
|
4299
|
+
messages: unref(messages),
|
|
4300
|
+
restore: restoreCommentFocus
|
|
4301
|
+
}, null, 8, [
|
|
4302
|
+
"comments",
|
|
4303
|
+
"markers",
|
|
4304
|
+
"messages"
|
|
4305
|
+
])) : createCommentVNode("", true),
|
|
4306
|
+
toolbarItems.value.length && toolbarAnchor.value ? (openBlock(), createBlock(flow_toolbar_default, {
|
|
4307
|
+
key: 1,
|
|
3680
4308
|
groups: toolbarItems.value,
|
|
3681
4309
|
anchor: toolbarAnchor.value,
|
|
3682
4310
|
size: size.value
|
|
@@ -3686,7 +4314,7 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3686
4314
|
"size"
|
|
3687
4315
|
])) : createCommentVNode("", true),
|
|
3688
4316
|
findOpen.value ? (openBlock(), createElementBlock("div", {
|
|
3689
|
-
key:
|
|
4317
|
+
key: 2,
|
|
3690
4318
|
ref_key: "findBox",
|
|
3691
4319
|
ref: findBox,
|
|
3692
4320
|
class: "dou-flow-editor__find",
|
|
@@ -3751,15 +4379,15 @@ var flow_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3751
4379
|
}, [renderSlot(_ctx.$slots, "ghost", {
|
|
3752
4380
|
spec: insertDrag.value.spec,
|
|
3753
4381
|
over: insertDrag.value.over
|
|
3754
|
-
}, () => [createElementVNode("span",
|
|
4382
|
+
}, () => [createElementVNode("span", _hoisted_19, [insertDrag.value.spec.palette?.icon ? (openBlock(), createElementBlock("span", _hoisted_20, [(openBlock(), createBlock(resolveDynamicComponent(insertDrag.value.spec.palette.icon)))])) : createCommentVNode("", true), createTextVNode(" " + toDisplayString(insertDrag.value.spec.palette?.label ?? insertDrag.value.spec.type), 1)])])], 6)) : createCommentVNode("", true)])),
|
|
3755
4383
|
createElementVNode("span", {
|
|
3756
4384
|
ref_key: "end",
|
|
3757
4385
|
ref: end,
|
|
3758
4386
|
class: "dou-flow-editor__end",
|
|
3759
4387
|
tabindex: "-1"
|
|
3760
4388
|
}, null, 512),
|
|
3761
|
-
createElementVNode("div",
|
|
3762
|
-
notice.value ? (openBlock(), createElementBlock("div",
|
|
4389
|
+
createElementVNode("div", _hoisted_21, toDisplayString(live.value), 1),
|
|
4390
|
+
notice.value ? (openBlock(), createElementBlock("div", _hoisted_22, toDisplayString(notice.value), 1)) : createCommentVNode("", true)
|
|
3763
4391
|
], 46, _hoisted_1);
|
|
3764
4392
|
};
|
|
3765
4393
|
}
|