@m3ui-vue/m3ui-vue 1.3.3 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/API.md +77 -5
- package/dist/api.json +1 -1
- package/dist/components/MFlow.vue.d.ts +45 -6
- package/dist/components/MFlowHandle.vue.d.ts +3 -2
- package/dist/composables/flowPaths.d.ts +20 -1
- package/dist/composables/useFlow.d.ts +47 -1
- package/dist/flow.d.ts +2 -2
- package/dist/flow.js +1358 -1060
- package/dist/flow.js.map +1 -1
- package/dist/flowPaths-DzW-aiET.js +204 -0
- package/dist/flowPaths-DzW-aiET.js.map +1 -0
- package/dist/gantt.js +1 -1
- package/package.json +1 -1
- package/src/__tests__/MFlow.test.ts +139 -2
- package/src/components/MFlow.vue +268 -33
- package/src/components/MFlowHandle.vue +5 -3
- package/src/components/_MFlowEdge.vue +73 -1
- package/src/composables/flowPaths.ts +77 -7
- package/src/composables/useFlow.ts +39 -1
- package/src/flow.ts +2 -1
- package/dist/flowPaths-CUc6X373.js +0 -161
- package/dist/flowPaths-CUc6X373.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
// One edge on MFlow's canvas, inside its shared <svg>: a wide invisible stroke to hit, the path (or an
|
|
3
3
|
// `#edge-<type>` slot), arrowheads, and once selected the ends to drag elsewhere. Gestures are MFlow's, found
|
|
4
|
-
// through `data-flow-edge` / `data-flow-reconnect`.
|
|
4
|
+
// through `data-flow-edge` / `data-flow-reconnect` / `data-flow-segment`.
|
|
5
5
|
import { computed, inject, type Slot } from 'vue'
|
|
6
6
|
import { FLOW_KEY, type FlowEdge, type FlowMarker } from '../composables/useFlow'
|
|
7
7
|
import { arrowPath } from '../composables/flowPaths'
|
|
@@ -18,6 +18,64 @@ const selected = computed(() => flow.selectedEdges.value.has(props.edge.id))
|
|
|
18
18
|
const highlighted = computed(() => flow.insertEdge.value === props.edge.id)
|
|
19
19
|
const selectable = computed(() => props.edge.selectable !== false && !flow.locked.value)
|
|
20
20
|
const reconnectable = computed(() => selected.value && flow.isReconnectable(props.edge))
|
|
21
|
+
// The label chip and delete button over the path's middle (see _MFlowEdgeLabel), as half sizes with their hit area
|
|
22
|
+
function labelBox() {
|
|
23
|
+
const g = geo.value
|
|
24
|
+
if (!g) return null
|
|
25
|
+
const deletable = props.edge.deletable !== false && !flow.locked.value
|
|
26
|
+
const chip = props.edge.label ? props.edge.label.length * 7 + 16 : 0
|
|
27
|
+
const w = chip + (deletable ? 24 + (chip ? 4 : 0) : 0)
|
|
28
|
+
if (!w) return null
|
|
29
|
+
return { x: g.labelX, y: g.labelY, hw: w / 2 + (deletable ? 8 : 2), hh: deletable ? 20 : 12 }
|
|
30
|
+
}
|
|
31
|
+
// A selected orthogonal edge's segments, each with a grip to drag it sideways (edgesReroutable)
|
|
32
|
+
const segments = computed(() => {
|
|
33
|
+
if (!selected.value || !flow.isReroutable(props.edge)) return []
|
|
34
|
+
geo.value
|
|
35
|
+
const pts = flow.edgeCorners(props.edge) ?? []
|
|
36
|
+
const out: { i: number; x: number; y: number; horizontal: boolean }[] = []
|
|
37
|
+
// The label and the delete button sit over the path's middle, in a layer above the edges: each grip slides along
|
|
38
|
+
// its segment to the free spot nearest the segment's middle (the farthest one from them when there's none)
|
|
39
|
+
const box = labelBox()
|
|
40
|
+
for (let i = 0; i < pts.length - 1; i++) {
|
|
41
|
+
const [ax, ay] = pts[i]!
|
|
42
|
+
const [bx, by] = pts[i + 1]!
|
|
43
|
+
const len = Math.hypot(bx - ax, by - ay)
|
|
44
|
+
if (len < 16) continue
|
|
45
|
+
const horizontal = Math.abs(ay - by) < 0.01
|
|
46
|
+
const ux = (bx - ax) / len
|
|
47
|
+
const uy = (by - ay) / len
|
|
48
|
+
const at = (d: number) => ({ x: ax + ux * d, y: ay + uy * d })
|
|
49
|
+
// How far a grip at this point is from the label box (negative: overlapping)
|
|
50
|
+
const clear = (p: { x: number; y: number }) => {
|
|
51
|
+
if (!box) return Infinity
|
|
52
|
+
const gw = horizontal ? 9 : 4
|
|
53
|
+
const gh = horizontal ? 4 : 9
|
|
54
|
+
return Math.max(Math.abs(p.x - box.x) - box.hw - gw, Math.abs(p.y - box.y) - box.hh - gh)
|
|
55
|
+
}
|
|
56
|
+
let best = at(len / 2)
|
|
57
|
+
if (clear(best) < 6) {
|
|
58
|
+
let bestClear = clear(best)
|
|
59
|
+
for (let off = 4; off <= len / 2 - 8; off += 4) {
|
|
60
|
+
const found = [at(len / 2 - off), at(len / 2 + off)].find((p) => clear(p) >= 6)
|
|
61
|
+
if (found) {
|
|
62
|
+
best = found
|
|
63
|
+
bestClear = Infinity
|
|
64
|
+
break
|
|
65
|
+
}
|
|
66
|
+
for (const p of [at(len / 2 - off), at(len / 2 + off)]) {
|
|
67
|
+
const c = clear(p)
|
|
68
|
+
if (c > bestClear) {
|
|
69
|
+
bestClear = c
|
|
70
|
+
best = p
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
out.push({ i, x: best.x, y: best.y, horizontal })
|
|
76
|
+
}
|
|
77
|
+
return out
|
|
78
|
+
})
|
|
21
79
|
|
|
22
80
|
function marker(kind: FlowMarker | undefined, x: number, y: number, angle: number, inset: number) {
|
|
23
81
|
if (!kind || kind === 'none') return ''
|
|
@@ -83,6 +141,20 @@ const scope = computed(() => ({ edge: props.edge, selected: selected.value, high
|
|
|
83
141
|
:style="{ stroke, fill: (i === 0 ? edge.markerEnd ?? 'arrow-closed' : edge.markerStart) === 'arrow-closed' ? stroke : 'none' }"
|
|
84
142
|
/>
|
|
85
143
|
</template>
|
|
144
|
+
<rect
|
|
145
|
+
v-for="sg in segments"
|
|
146
|
+
:key="`s${sg.i}`"
|
|
147
|
+
:data-flow-segment="sg.i"
|
|
148
|
+
:x="sg.x - (sg.horizontal ? 9 : 4)"
|
|
149
|
+
:y="sg.y - (sg.horizontal ? 4 : 9)"
|
|
150
|
+
:width="sg.horizontal ? 18 : 8"
|
|
151
|
+
:height="sg.horizontal ? 8 : 18"
|
|
152
|
+
rx="4"
|
|
153
|
+
stroke-width="2"
|
|
154
|
+
class="fill-surface stroke-primary"
|
|
155
|
+
:class="sg.horizontal ? 'cursor-row-resize' : 'cursor-col-resize'"
|
|
156
|
+
:style="{ pointerEvents: 'all', touchAction: 'none' }"
|
|
157
|
+
/>
|
|
86
158
|
<template v-if="reconnectable">
|
|
87
159
|
<circle
|
|
88
160
|
v-for="end in (['source', 'target'] as const)"
|
|
@@ -125,8 +125,11 @@ export function smoothStepPoints(p: FlowEdgePathParams & { offset?: number }): P
|
|
|
125
125
|
if ((ty - sy) * nsy >= off && (tx - sx) * -ntx >= off) mid = [[sx, ty]]
|
|
126
126
|
else mid = [s1, [t1[0], s1[1]], t1]
|
|
127
127
|
}
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
return cleanPoints([[sx, sy], ...mid, [tx, ty]])
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Drops repeated and collinear points from an orthogonal polyline */
|
|
132
|
+
function cleanPoints(pts: Pt[]): Pt[] {
|
|
130
133
|
const out: Pt[] = []
|
|
131
134
|
for (const q of pts) {
|
|
132
135
|
const a = out[out.length - 1]
|
|
@@ -155,10 +158,76 @@ function midpointAlong(pts: Pt[]): Pt {
|
|
|
155
158
|
return pts[0] ?? [0, 0]
|
|
156
159
|
}
|
|
157
160
|
|
|
161
|
+
/**
|
|
162
|
+
* The corners of an orthogonal edge routed through `route`: the positions of its segments after the first, alternately
|
|
163
|
+
* x and y, starting with where the leg leaving the source ends (an x when the source's side is left or right). The
|
|
164
|
+
* legs at the ends stretch to wherever the nodes are, and a corner is added before the target when it's needed to
|
|
165
|
+
* arrive square to its side, so the route stays orthogonal as the nodes move.
|
|
166
|
+
*/
|
|
167
|
+
export function routePoints(p: FlowEdgePathParams & { route: number[] }): Pt[] {
|
|
168
|
+
const { sourceX: sx, sourceY: sy, targetX: tx, targetY: ty } = p
|
|
169
|
+
const sp = p.sourcePosition ?? 'bottom'
|
|
170
|
+
const tp = p.targetPosition ?? 'top'
|
|
171
|
+
let horizontal = NORMAL[sp][0] !== 0
|
|
172
|
+
const tH = NORMAL[tp][0] !== 0
|
|
173
|
+
let cur: Pt = [sx, sy]
|
|
174
|
+
const pts: Pt[] = [cur]
|
|
175
|
+
for (const c of p.route) {
|
|
176
|
+
cur = horizontal ? [c, cur[1]] : [cur[0], c]
|
|
177
|
+
pts.push(cur)
|
|
178
|
+
horizontal = !horizontal
|
|
179
|
+
}
|
|
180
|
+
if (horizontal === tH) {
|
|
181
|
+
// The next leg runs the target's way: straight in when it's level with it, else a jog halfway
|
|
182
|
+
if (Math.abs(tH ? cur[1] - ty : cur[0] - tx) > 0.01) {
|
|
183
|
+
if (tH) {
|
|
184
|
+
const mx = (cur[0] + tx) / 2
|
|
185
|
+
pts.push([mx, cur[1]], [mx, ty])
|
|
186
|
+
} else {
|
|
187
|
+
const my = (cur[1] + ty) / 2
|
|
188
|
+
pts.push([cur[0], my], [tx, my])
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
} else pts.push(tH ? [cur[0], ty] : [tx, cur[1]])
|
|
192
|
+
pts.push([tx, ty])
|
|
193
|
+
return cleanPoints(pts)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** The other way round: the `route` that runs an orthogonal edge through these corners (its ends first and last) */
|
|
197
|
+
export function pointsToRoute(points: Pt[], sourcePosition: FlowPosition = 'bottom', targetPosition?: FlowPosition): number[] {
|
|
198
|
+
const pts = cleanPoints(points)
|
|
199
|
+
const route: number[] = []
|
|
200
|
+
let horizontal = NORMAL[sourcePosition][0] !== 0
|
|
201
|
+
let cur = pts[0]
|
|
202
|
+
if (!cur) return route
|
|
203
|
+
for (let i = 1; i < pts.length - 1; i++) {
|
|
204
|
+
const q = pts[i]!
|
|
205
|
+
const segH = Math.abs(q[1] - cur[1]) < 0.01
|
|
206
|
+
// A leg the other way first: a zero-length one keeps the axes alternating
|
|
207
|
+
if (segH !== horizontal) {
|
|
208
|
+
route.push(horizontal ? cur[0] : cur[1])
|
|
209
|
+
horizontal = !horizontal
|
|
210
|
+
}
|
|
211
|
+
// The last corner follows the target (when the last leg arrives square to its side), so it isn't kept
|
|
212
|
+
if (i === pts.length - 2 && targetPosition && (NORMAL[targetPosition][0] !== 0) === !horizontal) break
|
|
213
|
+
route.push(horizontal ? q[0] : q[1])
|
|
214
|
+
horizontal = !horizontal
|
|
215
|
+
cur = q
|
|
216
|
+
}
|
|
217
|
+
return route
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** Right-angled steps through `route` (see `routePoints`), rounded like `getSmoothStepPath` */
|
|
221
|
+
export function getRoutedPath(p: FlowEdgePathParams & { route: number[]; borderRadius?: number }): FlowEdgePath {
|
|
222
|
+
return roundedPath(routePoints(p), p.borderRadius ?? 8)
|
|
223
|
+
}
|
|
224
|
+
|
|
158
225
|
/** Right-angled steps with rounded corners (`borderRadius`, default 8; 0 gives sharp steps). `offset` (default 20) is how far it leaves a node before turning */
|
|
159
226
|
export function getSmoothStepPath(p: FlowEdgePathParams & { borderRadius?: number; offset?: number }): FlowEdgePath {
|
|
160
|
-
|
|
161
|
-
|
|
227
|
+
return roundedPath(smoothStepPoints(p), p.borderRadius ?? 8)
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function roundedPath(pts: Pt[], radius: number): FlowEdgePath {
|
|
162
231
|
let d = `M${r(pts[0]![0])},${r(pts[0]![1])}`
|
|
163
232
|
for (let i = 1; i < pts.length; i++) {
|
|
164
233
|
const [x, y] = pts[i]!
|
|
@@ -187,7 +256,8 @@ export function getSmoothStepPath(p: FlowEdgePathParams & { borderRadius?: numbe
|
|
|
187
256
|
* Points along an edge's path, close enough together to measure how far something is from it (bezier curves are
|
|
188
257
|
* sampled; step paths are their corners)
|
|
189
258
|
*/
|
|
190
|
-
export function edgePathPoints(type: string | undefined, p: FlowEdgePathParams): [number, number][] {
|
|
259
|
+
export function edgePathPoints(type: string | undefined, p: FlowEdgePathParams & { route?: number[] }): [number, number][] {
|
|
260
|
+
if (p.route && (type === 'smoothstep' || type === 'step')) return routePoints({ ...p, route: p.route })
|
|
191
261
|
if (type === 'straight') return [[p.sourceX, p.sourceY], [p.targetX, p.targetY]]
|
|
192
262
|
if (type === 'smoothstep' || type === 'step') return smoothStepPoints(p)
|
|
193
263
|
const sp = p.sourcePosition ?? 'bottom'
|
|
@@ -222,8 +292,8 @@ export function distanceToPoints(x: number, y: number, pts: [number, number][]):
|
|
|
222
292
|
}
|
|
223
293
|
|
|
224
294
|
/** `getSmoothStepPath` with sharp corners */
|
|
225
|
-
export function getStepPath(p: FlowEdgePathParams & { offset?: number }): FlowEdgePath {
|
|
226
|
-
return getSmoothStepPath({ ...p, borderRadius: 0 })
|
|
295
|
+
export function getStepPath(p: FlowEdgePathParams & { offset?: number; route?: number[] }): FlowEdgePath {
|
|
296
|
+
return p.route ? getRoutedPath({ ...p, route: p.route, borderRadius: 0 }) : getSmoothStepPath({ ...p, borderRadius: 0 })
|
|
227
297
|
}
|
|
228
298
|
|
|
229
299
|
/** An arrowhead's path at (x, y) pointing along `angle`: open (two strokes) or closed (a filled triangle's outline) */
|
|
@@ -40,6 +40,11 @@ export interface FlowNode<D = any> {
|
|
|
40
40
|
deletable?: boolean
|
|
41
41
|
/** `false` keeps it from splicing into an edge when dropped onto one */
|
|
42
42
|
insertable?: boolean
|
|
43
|
+
/**
|
|
44
|
+
* With snapToGrid, what lands on the grid is its position plus this (default its corner): `{ x: w / 2, y: h / 2 }`
|
|
45
|
+
* puts its middle on the grid, e.g. a junction dot whose wires run along the grid lines
|
|
46
|
+
*/
|
|
47
|
+
gridOffset?: FlowXY
|
|
43
48
|
class?: string
|
|
44
49
|
}
|
|
45
50
|
|
|
@@ -92,9 +97,29 @@ export interface FlowEdge<D = any> {
|
|
|
92
97
|
deletable?: boolean
|
|
93
98
|
/** Its ends can be dragged to other handles once selected; default MFlow's `edgesReconnectable` */
|
|
94
99
|
reconnectable?: boolean
|
|
100
|
+
/**
|
|
101
|
+
* A `smoothstep`/`step` edge's own route: where its segments after the first run, alternately x and y (see
|
|
102
|
+
* `routePoints`). Dragging a selected edge's segments writes it (MFlow's `edgesReroutable`); without one it's
|
|
103
|
+
* routed automatically
|
|
104
|
+
*/
|
|
105
|
+
route?: number[]
|
|
106
|
+
/** Its segments can be dragged once selected; default MFlow's `edgesReroutable` */
|
|
107
|
+
reroutable?: boolean
|
|
108
|
+
/** The side it leaves an `'auto'` handle by (default the side facing its other end) */
|
|
109
|
+
sourcePosition?: FlowPosition
|
|
110
|
+
/** The side it arrives at an `'auto'` handle by (default the side facing its other end) */
|
|
111
|
+
targetPosition?: FlowPosition
|
|
95
112
|
class?: string
|
|
96
113
|
}
|
|
97
114
|
|
|
115
|
+
/** An edge found under a point (`getEdgeAt`) */
|
|
116
|
+
export interface FlowEdgeHit {
|
|
117
|
+
edge: FlowEdge
|
|
118
|
+
position: FlowXY
|
|
119
|
+
direction: FlowPosition
|
|
120
|
+
routes?: { before: number[]; after: number[] }
|
|
121
|
+
}
|
|
122
|
+
|
|
98
123
|
/** The view: `x`/`y` in px, where the flow's origin is on the canvas, and the zoom */
|
|
99
124
|
export interface FlowViewport { x: number; y: number; zoom: number }
|
|
100
125
|
|
|
@@ -112,7 +137,8 @@ export interface FlowSelection { nodes: string[]; edges: string[] }
|
|
|
112
137
|
export interface FlowHandleBounds {
|
|
113
138
|
id: string | null
|
|
114
139
|
type: 'source' | 'target'
|
|
115
|
-
|
|
140
|
+
/** 'auto': each edge leaves or arrives on the side that faces its other end */
|
|
141
|
+
position: FlowPosition | 'auto'
|
|
116
142
|
x: number
|
|
117
143
|
y: number
|
|
118
144
|
connectable: boolean
|
|
@@ -148,6 +174,13 @@ export interface FlowContext {
|
|
|
148
174
|
getSize(id: string): { width: number; height: number }
|
|
149
175
|
/** Nodes overlapping this one (or a rectangle in flow coordinates), groups and its own family left out */
|
|
150
176
|
getIntersectingNodes(node: string | { x: number; y: number; width: number; height: number }): FlowNode[]
|
|
177
|
+
/**
|
|
178
|
+
* The edge passing within `radius` (flow units, default 8) of a flow point, nearest first, skipping the ones
|
|
179
|
+
* `ignore` returns true for: where on it the point falls (on the grid along it with snapToGrid), the way it runs
|
|
180
|
+
* there toward its target, and for an edge with its own route, the routes that keep each half's shape if it's split
|
|
181
|
+
* there (as the `branch` event gives). For dropping something onto an edge, e.g. a junction
|
|
182
|
+
*/
|
|
183
|
+
getEdgeAt(p: FlowXY, opts?: { radius?: number; ignore?: (e: FlowEdge) => boolean }): FlowEdgeHit | null
|
|
151
184
|
/** Page (client) coordinates → flow coordinates */
|
|
152
185
|
screenToFlow(p: { x: number; y: number }): FlowXY
|
|
153
186
|
flowToScreen(p: FlowXY): { x: number; y: number }
|
|
@@ -160,6 +193,8 @@ export interface FlowContext {
|
|
|
160
193
|
zoomTo(zoom: number, opts?: { animate?: boolean }): void
|
|
161
194
|
addNodes(nodes: FlowNode | FlowNode[]): void
|
|
162
195
|
addEdges(edges: FlowEdge | FlowEdge[]): void
|
|
196
|
+
/** Several changes as one undoable step (nodes and edges added, changed or removed together): each list given replaces the current one */
|
|
197
|
+
change(next: { nodes?: FlowNode[]; edges?: FlowEdge[] }): void
|
|
163
198
|
updateNode(id: string, patch: Partial<FlowNode> | ((n: FlowNode) => FlowNode)): void
|
|
164
199
|
updateEdge(id: string, patch: Partial<FlowEdge> | ((e: FlowEdge) => FlowEdge)): void
|
|
165
200
|
/** Deletes nodes (with their edges and children) and edges by id */
|
|
@@ -205,6 +240,9 @@ export interface FlowInternals extends FlowContext {
|
|
|
205
240
|
zIndexOf(id: string): number
|
|
206
241
|
edgeGeometry(e: FlowEdge): FlowEdgeGeometry | null
|
|
207
242
|
isReconnectable(e: FlowEdge): boolean
|
|
243
|
+
isReroutable(e: FlowEdge): boolean
|
|
244
|
+
/** The corners of an orthogonal edge (its ends first and last), or null for a curve or a straight line */
|
|
245
|
+
edgeCorners(e: FlowEdge): [number, number][] | null
|
|
208
246
|
sidePositions(n: FlowNode): { source: FlowPosition; target: FlowPosition }
|
|
209
247
|
onNodeKey(e: KeyboardEvent, id: string): void
|
|
210
248
|
onEdgeKey(e: KeyboardEvent, id: string): void
|
package/src/flow.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type {
|
|
|
9
9
|
FlowConnection,
|
|
10
10
|
FlowContext,
|
|
11
11
|
FlowEdge,
|
|
12
|
+
FlowEdgeHit,
|
|
12
13
|
FlowFitOptions,
|
|
13
14
|
FlowHandleBounds,
|
|
14
15
|
FlowMarker,
|
|
@@ -17,7 +18,7 @@ export type {
|
|
|
17
18
|
FlowViewport,
|
|
18
19
|
FlowXY,
|
|
19
20
|
} from './composables/useFlow'
|
|
20
|
-
export { getBezierPath, getSmoothStepPath, getStepPath, getStraightPath, smoothStepPoints, arrowPath } from './composables/flowPaths'
|
|
21
|
+
export { getBezierPath, getSmoothStepPath, getStepPath, getStraightPath, smoothStepPoints, routePoints, pointsToRoute, getRoutedPath, arrowPath } from './composables/flowPaths'
|
|
21
22
|
export type { FlowEdgePath, FlowEdgePathParams, FlowPosition } from './composables/flowPaths'
|
|
22
23
|
export { layoutTree, layoutLayered } from './composables/flowLayout'
|
|
23
24
|
export type { FlowLayout, FlowLayoutDirection, FlowLayoutOptions, FlowLayoutResult } from './composables/flowLayout'
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
//#region src/composables/flowPaths.ts
|
|
2
|
-
var e = {
|
|
3
|
-
top: [0, -1],
|
|
4
|
-
right: [1, 0],
|
|
5
|
-
bottom: [0, 1],
|
|
6
|
-
left: [-1, 0]
|
|
7
|
-
}, t = (e, t) => Math.atan2(t, e), n = (e) => Math.round(e * 100) / 100;
|
|
8
|
-
function r(e) {
|
|
9
|
-
let { sourceX: r, sourceY: i, targetX: a, targetY: o } = e, s = t(a - r, o - i);
|
|
10
|
-
return {
|
|
11
|
-
path: `M${n(r)},${n(i)} L${n(a)},${n(o)}`,
|
|
12
|
-
labelX: (r + a) / 2,
|
|
13
|
-
labelY: (i + o) / 2,
|
|
14
|
-
sourceAngle: s,
|
|
15
|
-
targetAngle: s
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function i(e, t) {
|
|
19
|
-
return e >= 0 ? .5 * e : t * 25 * Math.sqrt(-e);
|
|
20
|
-
}
|
|
21
|
-
function a(e, t, n, r, a, o) {
|
|
22
|
-
switch (e) {
|
|
23
|
-
case "left": return [t - i(t - r, o), n];
|
|
24
|
-
case "right": return [t + i(r - t, o), n];
|
|
25
|
-
case "top": return [t, n - i(n - a, o)];
|
|
26
|
-
default: return [t, n + i(a - n, o)];
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function o(r) {
|
|
30
|
-
let { sourceX: i, sourceY: o, targetX: s, targetY: c } = r, l = r.sourcePosition ?? "bottom", u = r.targetPosition ?? "top", d = r.curvature ?? .25, [f, p] = a(l, i, o, s, c, d), [m, h] = a(u, s, c, i, o, d), g = .125 * i + .375 * f + .375 * m + .125 * s, _ = .125 * o + .375 * p + .375 * h + .125 * c;
|
|
31
|
-
return {
|
|
32
|
-
path: `M${n(i)},${n(o)} C${n(f)},${n(p)} ${n(m)},${n(h)} ${n(s)},${n(c)}`,
|
|
33
|
-
labelX: g,
|
|
34
|
-
labelY: _,
|
|
35
|
-
sourceAngle: t(...e[l]),
|
|
36
|
-
targetAngle: t(-e[u][0], -e[u][1])
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function s(t) {
|
|
40
|
-
let { sourceX: n, sourceY: r, targetX: i, targetY: a } = t, o = t.sourcePosition ?? "bottom", s = t.targetPosition ?? "top", c = t.offset ?? 20, [l, u] = e[o], [d, f] = e[s], p = [n + l * c, r + u * c], m = [i + d * c, a + f * c], h = l !== 0, g = d !== 0, _;
|
|
41
|
-
if (h && g) {
|
|
42
|
-
if (l === -d && (i - n) * l >= 2 * c) {
|
|
43
|
-
let e = (n + i) / 2;
|
|
44
|
-
_ = [[e, r], [e, a]];
|
|
45
|
-
} else if (l === d) {
|
|
46
|
-
let e = l > 0 ? Math.max(p[0], m[0]) : Math.min(p[0], m[0]);
|
|
47
|
-
_ = [[e, r], [e, a]];
|
|
48
|
-
} else {
|
|
49
|
-
let e = (r + a) / 2;
|
|
50
|
-
_ = [
|
|
51
|
-
p,
|
|
52
|
-
[p[0], e],
|
|
53
|
-
[m[0], e],
|
|
54
|
-
m
|
|
55
|
-
];
|
|
56
|
-
}
|
|
57
|
-
} else if (!h && !g) {
|
|
58
|
-
if (u === -f && (a - r) * u >= 2 * c) {
|
|
59
|
-
let e = (r + a) / 2;
|
|
60
|
-
_ = [[n, e], [i, e]];
|
|
61
|
-
} else if (u === f) {
|
|
62
|
-
let e = u > 0 ? Math.max(p[1], m[1]) : Math.min(p[1], m[1]);
|
|
63
|
-
_ = [[n, e], [i, e]];
|
|
64
|
-
} else {
|
|
65
|
-
let e = (n + i) / 2;
|
|
66
|
-
_ = [
|
|
67
|
-
p,
|
|
68
|
-
[e, p[1]],
|
|
69
|
-
[e, m[1]],
|
|
70
|
-
m
|
|
71
|
-
];
|
|
72
|
-
}
|
|
73
|
-
} else _ = h ? (i - n) * l >= c && (a - r) * -f >= c ? [[i, r]] : [
|
|
74
|
-
p,
|
|
75
|
-
[p[0], m[1]],
|
|
76
|
-
m
|
|
77
|
-
] : (a - r) * u >= c && (i - n) * -d >= c ? [[n, a]] : [
|
|
78
|
-
p,
|
|
79
|
-
[m[0], p[1]],
|
|
80
|
-
m
|
|
81
|
-
];
|
|
82
|
-
let v = [
|
|
83
|
-
[n, r],
|
|
84
|
-
..._,
|
|
85
|
-
[i, a]
|
|
86
|
-
], y = [];
|
|
87
|
-
for (let e of v) {
|
|
88
|
-
let t = y[y.length - 1];
|
|
89
|
-
if (t && Math.abs(t[0] - e[0]) < .01 && Math.abs(t[1] - e[1]) < .01) continue;
|
|
90
|
-
let n = y[y.length - 2];
|
|
91
|
-
if (t && n && (Math.abs(n[0] - t[0]) < .01 && Math.abs(t[0] - e[0]) < .01 || Math.abs(n[1] - t[1]) < .01 && Math.abs(t[1] - e[1]) < .01)) {
|
|
92
|
-
y[y.length - 1] = e;
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
y.push(e);
|
|
96
|
-
}
|
|
97
|
-
return y;
|
|
98
|
-
}
|
|
99
|
-
function c(e) {
|
|
100
|
-
let t = 0;
|
|
101
|
-
for (let n = 1; n < e.length; n++) t += Math.hypot(e[n][0] - e[n - 1][0], e[n][1] - e[n - 1][1]);
|
|
102
|
-
let n = t / 2;
|
|
103
|
-
for (let t = 1; t < e.length; t++) {
|
|
104
|
-
let [r, i] = e[t - 1], [a, o] = e[t], s = Math.hypot(a - r, o - i);
|
|
105
|
-
if (n <= s && s > 0) return [r + (a - r) * n / s, i + (o - i) * n / s];
|
|
106
|
-
n -= s;
|
|
107
|
-
}
|
|
108
|
-
return e[0] ?? [0, 0];
|
|
109
|
-
}
|
|
110
|
-
function l(e) {
|
|
111
|
-
let r = s(e), i = e.borderRadius ?? 8, a = `M${n(r[0][0])},${n(r[0][1])}`;
|
|
112
|
-
for (let e = 1; e < r.length; e++) {
|
|
113
|
-
let [t, o] = r[e], s = r[e + 1];
|
|
114
|
-
if (!s || i <= 0) {
|
|
115
|
-
a += ` L${n(t)},${n(o)}`;
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
let [c, l] = r[e - 1], u = Math.min(i, Math.hypot(t - c, o - l) / 2, Math.hypot(s[0] - t, s[1] - o) / 2), d = Math.sign(t - c), f = Math.sign(o - l), p = Math.sign(s[0] - t), m = Math.sign(s[1] - o);
|
|
119
|
-
a += ` L${n(t - d * u)},${n(o - f * u)} Q${n(t)},${n(o)} ${n(t + p * u)},${n(o + m * u)}`;
|
|
120
|
-
}
|
|
121
|
-
let [o, l] = c(r), u = r[0], d = r[1] ?? u, f = r[r.length - 2] ?? u, p = r[r.length - 1];
|
|
122
|
-
return {
|
|
123
|
-
path: a,
|
|
124
|
-
labelX: o,
|
|
125
|
-
labelY: l,
|
|
126
|
-
sourceAngle: t(d[0] - u[0], d[1] - u[1]),
|
|
127
|
-
targetAngle: t(p[0] - f[0], p[1] - f[1])
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
function u(e, t) {
|
|
131
|
-
if (e === "straight") return [[t.sourceX, t.sourceY], [t.targetX, t.targetY]];
|
|
132
|
-
if (e === "smoothstep" || e === "step") return s(t);
|
|
133
|
-
let n = t.sourcePosition ?? "bottom", r = t.targetPosition ?? "top", [i, o] = a(n, t.sourceX, t.sourceY, t.targetX, t.targetY, .25), [c, l] = a(r, t.targetX, t.targetY, t.sourceX, t.sourceY, .25), u = [];
|
|
134
|
-
for (let e = 0; e <= 24; e++) {
|
|
135
|
-
let n = e / 24, r = 1 - n;
|
|
136
|
-
u.push([r * r * r * t.sourceX + 3 * r * r * n * i + 3 * r * n * n * c + n * n * n * t.targetX, r * r * r * t.sourceY + 3 * r * r * n * o + 3 * r * n * n * l + n * n * n * t.targetY]);
|
|
137
|
-
}
|
|
138
|
-
return u;
|
|
139
|
-
}
|
|
140
|
-
function d(e, t, n) {
|
|
141
|
-
let r = Infinity;
|
|
142
|
-
for (let i = 1; i < n.length; i++) {
|
|
143
|
-
let [a, o] = n[i - 1], [s, c] = n[i], l = s - a, u = c - o, d = l * l + u * u, f = d ? Math.max(0, Math.min(1, ((e - a) * l + (t - o) * u) / d)) : 0;
|
|
144
|
-
r = Math.min(r, Math.hypot(a + f * l - e, o + f * u - t));
|
|
145
|
-
}
|
|
146
|
-
return r;
|
|
147
|
-
}
|
|
148
|
-
function f(e) {
|
|
149
|
-
return l({
|
|
150
|
-
...e,
|
|
151
|
-
borderRadius: 0
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
function p(e, t, r, i = 10, a = !1) {
|
|
155
|
-
let o = .45, s = e - i * Math.cos(r - o), c = t - i * Math.sin(r - o), l = e - i * Math.cos(r + o), u = t - i * Math.sin(r + o);
|
|
156
|
-
return a ? `M${n(e)},${n(t)} L${n(s)},${n(c)} L${n(l)},${n(u)} Z` : `M${n(s)},${n(c)} L${n(e)},${n(t)} L${n(l)},${n(u)}`;
|
|
157
|
-
}
|
|
158
|
-
//#endregion
|
|
159
|
-
export { l as a, s as c, o as i, d as n, f as o, u as r, r as s, p as t };
|
|
160
|
-
|
|
161
|
-
//# sourceMappingURL=flowPaths-CUc6X373.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flowPaths-CUc6X373.js","names":[],"sources":["../src/composables/flowPaths.ts"],"sourcesContent":["// Edge paths for MFlow, also exported for edges of your own (`#edge-<type>` slots). Every function takes the two\n// ends in flow coordinates plus the side of its node each end leaves from, and returns an SVG path, the point\n// where a label sits and the direction the path arrives in (for an arrowhead).\n\n/** A side of a node: where a handle sits and the direction an edge leaves it in */\nexport type FlowPosition = 'top' | 'right' | 'bottom' | 'left'\n\nexport interface FlowEdgePathParams {\n sourceX: number\n sourceY: number\n /** Default 'bottom' */\n sourcePosition?: FlowPosition\n targetX: number\n targetY: number\n /** Default 'top' */\n targetPosition?: FlowPosition\n}\n\nexport interface FlowEdgePath {\n /** The SVG path (`d`) */\n path: string\n /** Where the label goes: the path's middle */\n labelX: number\n labelY: number\n /** The direction the path leaves the source in, in radians (0 = right, π/2 = down) */\n sourceAngle: number\n /** The direction the path arrives at the target in, in radians: the way an arrowhead points */\n targetAngle: number\n}\n\nconst NORMAL: Record<FlowPosition, [number, number]> = {\n top: [0, -1],\n right: [1, 0],\n bottom: [0, 1],\n left: [-1, 0],\n}\nconst angleOf = (x: number, y: number) => Math.atan2(y, x)\nconst r = (n: number) => Math.round(n * 100) / 100\n\n/** A straight line between the ends */\nexport function getStraightPath(p: FlowEdgePathParams): FlowEdgePath {\n const { sourceX: sx, sourceY: sy, targetX: tx, targetY: ty } = p\n const a = angleOf(tx - sx, ty - sy)\n return { path: `M${r(sx)},${r(sy)} L${r(tx)},${r(ty)}`, labelX: (sx + tx) / 2, labelY: (sy + ty) / 2, sourceAngle: a, targetAngle: a }\n}\n\n// React Flow's control point distance: half the distance along the side's direction, or a curve that grows with\n// the square root of how far behind the node the other end is\nfunction controlOffset(distance: number, curvature: number) {\n return distance >= 0 ? 0.5 * distance : curvature * 25 * Math.sqrt(-distance)\n}\nfunction controlPoint(pos: FlowPosition, x1: number, y1: number, x2: number, y2: number, c: number): [number, number] {\n switch (pos) {\n case 'left': return [x1 - controlOffset(x1 - x2, c), y1]\n case 'right': return [x1 + controlOffset(x2 - x1, c), y1]\n case 'top': return [x1, y1 - controlOffset(y1 - y2, c)]\n default: return [x1, y1 + controlOffset(y2 - y1, c)]\n }\n}\n\n/** A cubic curve that leaves and arrives square to the nodes' sides. `curvature` (default 0.25) bends it more when the target is behind the source */\nexport function getBezierPath(p: FlowEdgePathParams & { curvature?: number }): FlowEdgePath {\n const { sourceX: sx, sourceY: sy, targetX: tx, targetY: ty } = p\n const sp = p.sourcePosition ?? 'bottom'\n const tp = p.targetPosition ?? 'top'\n const c = p.curvature ?? 0.25\n const [c1x, c1y] = controlPoint(sp, sx, sy, tx, ty, c)\n const [c2x, c2y] = controlPoint(tp, tx, ty, sx, sy, c)\n const labelX = 0.125 * sx + 0.375 * c1x + 0.375 * c2x + 0.125 * tx\n const labelY = 0.125 * sy + 0.375 * c1y + 0.375 * c2y + 0.125 * ty\n return {\n path: `M${r(sx)},${r(sy)} C${r(c1x)},${r(c1y)} ${r(c2x)},${r(c2y)} ${r(tx)},${r(ty)}`,\n labelX,\n labelY,\n sourceAngle: angleOf(...NORMAL[sp]),\n targetAngle: angleOf(-NORMAL[tp][0], -NORMAL[tp][1]),\n }\n}\n\ntype Pt = [number, number]\n\n/** The corners of an orthogonal route between the ends, leaving and arriving square to the sides */\nexport function smoothStepPoints(p: FlowEdgePathParams & { offset?: number }): Pt[] {\n const { sourceX: sx, sourceY: sy, targetX: tx, targetY: ty } = p\n const sp = p.sourcePosition ?? 'bottom'\n const tp = p.targetPosition ?? 'top'\n const off = p.offset ?? 20\n const [nsx, nsy] = NORMAL[sp]\n const [ntx, nty] = NORMAL[tp]\n const s1: Pt = [sx + nsx * off, sy + nsy * off]\n const t1: Pt = [tx + ntx * off, ty + nty * off]\n const sH = nsx !== 0\n const tH = ntx !== 0\n let mid: Pt[]\n if (sH && tH) {\n if (nsx === -ntx && (tx - sx) * nsx >= 2 * off) {\n // Facing each other with room: one vertical run halfway\n const mx = (sx + tx) / 2\n mid = [[mx, sy], [mx, ty]]\n } else if (nsx === ntx) {\n // Both sides look the same way: go round past the farther one\n const x = nsx > 0 ? Math.max(s1[0], t1[0]) : Math.min(s1[0], t1[0])\n mid = [[x, sy], [x, ty]]\n } else {\n // Behind: out, across halfway between the ends, and back in\n const my = (sy + ty) / 2\n mid = [s1, [s1[0], my], [t1[0], my], t1]\n }\n } else if (!sH && !tH) {\n if (nsy === -nty && (ty - sy) * nsy >= 2 * off) {\n const my = (sy + ty) / 2\n mid = [[sx, my], [tx, my]]\n } else if (nsy === nty) {\n const y = nsy > 0 ? Math.max(s1[1], t1[1]) : Math.min(s1[1], t1[1])\n mid = [[sx, y], [tx, y]]\n } else {\n const mx = (sx + tx) / 2\n mid = [s1, [mx, s1[1]], [mx, t1[1]], t1]\n }\n } else if (sH) {\n // Leaves sideways, arrives from above or below: one corner when both legs go the right way\n if ((tx - sx) * nsx >= off && (ty - sy) * -nty >= off) mid = [[tx, sy]]\n else mid = [s1, [s1[0], t1[1]], t1]\n } else {\n if ((ty - sy) * nsy >= off && (tx - sx) * -ntx >= off) mid = [[sx, ty]]\n else mid = [s1, [t1[0], s1[1]], t1]\n }\n const pts: Pt[] = [[sx, sy], ...mid, [tx, ty]]\n // Drop repeated and collinear points\n const out: Pt[] = []\n for (const q of pts) {\n const a = out[out.length - 1]\n if (a && Math.abs(a[0] - q[0]) < 0.01 && Math.abs(a[1] - q[1]) < 0.01) continue\n const b = out[out.length - 2]\n if (a && b && ((Math.abs(b[0] - a[0]) < 0.01 && Math.abs(a[0] - q[0]) < 0.01) || (Math.abs(b[1] - a[1]) < 0.01 && Math.abs(a[1] - q[1]) < 0.01))) {\n out[out.length - 1] = q\n continue\n }\n out.push(q)\n }\n return out\n}\n\nfunction midpointAlong(pts: Pt[]): Pt {\n let total = 0\n for (let i = 1; i < pts.length; i++) total += Math.hypot(pts[i]![0] - pts[i - 1]![0], pts[i]![1] - pts[i - 1]![1])\n let left = total / 2\n for (let i = 1; i < pts.length; i++) {\n const [ax, ay] = pts[i - 1]!\n const [bx, by] = pts[i]!\n const len = Math.hypot(bx - ax, by - ay)\n if (left <= len && len > 0) return [ax + ((bx - ax) * left) / len, ay + ((by - ay) * left) / len]\n left -= len\n }\n return pts[0] ?? [0, 0]\n}\n\n/** Right-angled steps with rounded corners (`borderRadius`, default 8; 0 gives sharp steps). `offset` (default 20) is how far it leaves a node before turning */\nexport function getSmoothStepPath(p: FlowEdgePathParams & { borderRadius?: number; offset?: number }): FlowEdgePath {\n const pts = smoothStepPoints(p)\n const radius = p.borderRadius ?? 8\n let d = `M${r(pts[0]![0])},${r(pts[0]![1])}`\n for (let i = 1; i < pts.length; i++) {\n const [x, y] = pts[i]!\n const next = pts[i + 1]\n if (!next || radius <= 0) {\n d += ` L${r(x)},${r(y)}`\n continue\n }\n const [px, py] = pts[i - 1]!\n const rad = Math.min(radius, Math.hypot(x - px, y - py) / 2, Math.hypot(next[0] - x, next[1] - y) / 2)\n const ux = Math.sign(x - px)\n const uy = Math.sign(y - py)\n const vx = Math.sign(next[0] - x)\n const vy = Math.sign(next[1] - y)\n d += ` L${r(x - ux * rad)},${r(y - uy * rad)} Q${r(x)},${r(y)} ${r(x + vx * rad)},${r(y + vy * rad)}`\n }\n const [labelX, labelY] = midpointAlong(pts)\n const a = pts[0]!\n const b = pts[1] ?? a\n const y = pts[pts.length - 2] ?? a\n const z = pts[pts.length - 1]!\n return { path: d, labelX, labelY, sourceAngle: angleOf(b[0] - a[0], b[1] - a[1]), targetAngle: angleOf(z[0] - y[0], z[1] - y[1]) }\n}\n\n/**\n * Points along an edge's path, close enough together to measure how far something is from it (bezier curves are\n * sampled; step paths are their corners)\n */\nexport function edgePathPoints(type: string | undefined, p: FlowEdgePathParams): [number, number][] {\n if (type === 'straight') return [[p.sourceX, p.sourceY], [p.targetX, p.targetY]]\n if (type === 'smoothstep' || type === 'step') return smoothStepPoints(p)\n const sp = p.sourcePosition ?? 'bottom'\n const tp = p.targetPosition ?? 'top'\n const [c1x, c1y] = controlPoint(sp, p.sourceX, p.sourceY, p.targetX, p.targetY, 0.25)\n const [c2x, c2y] = controlPoint(tp, p.targetX, p.targetY, p.sourceX, p.sourceY, 0.25)\n const out: [number, number][] = []\n for (let i = 0; i <= 24; i++) {\n const t = i / 24\n const u = 1 - t\n out.push([\n u * u * u * p.sourceX + 3 * u * u * t * c1x + 3 * u * t * t * c2x + t * t * t * p.targetX,\n u * u * u * p.sourceY + 3 * u * u * t * c1y + 3 * u * t * t * c2y + t * t * t * p.targetY,\n ])\n }\n return out\n}\n\n/** The distance from a point to a polyline */\nexport function distanceToPoints(x: number, y: number, pts: [number, number][]): number {\n let best = Infinity\n for (let i = 1; i < pts.length; i++) {\n const [ax, ay] = pts[i - 1]!\n const [bx, by] = pts[i]!\n const dx = bx - ax\n const dy = by - ay\n const len = dx * dx + dy * dy\n const t = len ? Math.max(0, Math.min(1, ((x - ax) * dx + (y - ay) * dy) / len)) : 0\n best = Math.min(best, Math.hypot(ax + t * dx - x, ay + t * dy - y))\n }\n return best\n}\n\n/** `getSmoothStepPath` with sharp corners */\nexport function getStepPath(p: FlowEdgePathParams & { offset?: number }): FlowEdgePath {\n return getSmoothStepPath({ ...p, borderRadius: 0 })\n}\n\n/** An arrowhead's path at (x, y) pointing along `angle`: open (two strokes) or closed (a filled triangle's outline) */\nexport function arrowPath(x: number, y: number, angle: number, size = 10, closed = false): string {\n const spread = 0.45\n const ax = x - size * Math.cos(angle - spread)\n const ay = y - size * Math.sin(angle - spread)\n const bx = x - size * Math.cos(angle + spread)\n const by = y - size * Math.sin(angle + spread)\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