@floegence/floe-webapp-core 0.101.23 → 0.101.29
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/assets/layout-worker-CsLsdMKZ.js +1956 -0
- package/dist/components/graph/GraphCanvas.d.ts +2 -0
- package/dist/components/graph/GraphCanvas.js +228 -180
- package/dist/components/graph/engine.js +14 -14
- package/dist/components/graph/layout-motion.d.ts +10 -0
- package/dist/components/graph/layout-motion.js +88 -0
- package/dist/components/graph/routing.d.ts +1 -1
- package/dist/components/graph/types.d.ts +3 -1
- package/dist/graph.css +18 -0
- package/package.json +1 -1
- package/dist/assets/layout-worker-CFMp3t5w.js +0 -1952
|
@@ -8,6 +8,8 @@ export interface GraphNodeRenderContext {
|
|
|
8
8
|
}
|
|
9
9
|
export interface GraphCanvasProps {
|
|
10
10
|
layout: GraphLayout;
|
|
11
|
+
/** Animate layout changes with one geometry clock. Reduced motion settles immediately. */
|
|
12
|
+
animateLayout?: boolean;
|
|
11
13
|
viewport: GraphViewport;
|
|
12
14
|
onViewportChange: (viewport: GraphViewport) => void;
|
|
13
15
|
ariaLabel: string;
|
|
@@ -1,111 +1,159 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createUniqueId as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
1
|
+
import { insert as A, createComponent as P, setAttribute as s, effect as p, setStyleProperty as L, memo as Me, className as le, template as z, use as ke, delegateEvents as Ce } from "solid-js/web";
|
|
2
|
+
import { createUniqueId as $e, createSignal as X, onMount as de, onCleanup as Z, createEffect as Le, untrack as Y, createMemo as x, For as ce, Show as _ } from "solid-js";
|
|
3
|
+
import { createStore as Ee, reconcile as q, unwrap as Se } from "solid-js/store";
|
|
4
|
+
import { createGraphLayoutTransition as Ie } from "./layout-motion.js";
|
|
5
|
+
import { InfiniteCanvas as Ae } from "../ui/InfiniteCanvas.js";
|
|
6
|
+
import { resolveSurfaceInteractionTargetRole as Pe } from "../ui/localInteractionSurface.js";
|
|
7
|
+
import { graphRelatedEdges as se, graphEdgeLabelPosition as Te, graphSectionPath as Fe } from "./geometry.js";
|
|
8
|
+
import { GraphMinimap as Ge } from "./GraphMinimap.js";
|
|
9
|
+
var Re = /* @__PURE__ */ z("<div data-floe-canvas-pan-surface=true role=group tabindex=0>"), pe = /* @__PURE__ */ z("<div role=region tabindex=0>"), ze = /* @__PURE__ */ z('<svg class=floe-graph__edges><defs><marker viewBox="0 0 8 8"refX=7 refY=4 markerWidth=7 markerHeight=7 orient=auto-start-reverse><path d="M1 1 L7 4 L1 7"fill=none stroke=context-stroke stroke-width=1.2>'), Be = /* @__PURE__ */ z("<svg><g><path class=floe-graph__edge></path><path class=floe-graph__edge-target tabindex=0 role=button data-floe-canvas-pan-surface=true></svg>", !1, !0, !1), He = /* @__PURE__ */ z("<svg><text class=floe-graph__edge-label aria-hidden=true></svg>", !1, !0, !1);
|
|
10
|
+
function Ke(i) {
|
|
11
|
+
const ee = `graph-arrow-${$e()}`;
|
|
12
|
+
let b;
|
|
13
|
+
const [V, ue] = X(null), [te, he] = X({
|
|
12
14
|
width: 0,
|
|
13
15
|
height: 0
|
|
14
|
-
}),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
}), ne = () => i.highlight === void 0 ? V() : i.highlight, [j, B] = Ee({
|
|
17
|
+
nodes: [],
|
|
18
|
+
edges: [],
|
|
19
|
+
bounds: {
|
|
20
|
+
x: 0,
|
|
21
|
+
y: 0,
|
|
22
|
+
width: 0,
|
|
23
|
+
height: 0
|
|
24
|
+
}
|
|
25
|
+
}), [M, H] = X(!1), [ge, ve] = X(!1);
|
|
26
|
+
let D = 0, re, ae = 0;
|
|
27
|
+
de(() => {
|
|
28
|
+
const e = window.matchMedia("(prefers-reduced-motion: reduce)"), t = () => ve(e.matches);
|
|
29
|
+
t(), e.addEventListener("change", t), Z(() => e.removeEventListener("change", t));
|
|
30
|
+
}), Le(() => {
|
|
31
|
+
const e = i.layout, t = ge() || typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, n = re !== e.nodes;
|
|
32
|
+
if (re = e.nodes, cancelAnimationFrame(D), !i.animateLayout) {
|
|
33
|
+
H(!1);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (!n && !Y(M) && Y(() => j.nodes.length)) {
|
|
37
|
+
B("edges", q(structuredClone(e.edges)));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const o = Y(() => structuredClone(Se(j)));
|
|
41
|
+
if (t || !o.nodes.length || !n && !Y(M)) {
|
|
42
|
+
B(q(structuredClone(e))), H(!1);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const a = Ie(o, structuredClone(e)), r = performance.now();
|
|
46
|
+
n && (ae = r + 280);
|
|
47
|
+
const l = Math.max(1, ae - r);
|
|
48
|
+
H(!0), B(q(a(0)));
|
|
49
|
+
const f = (y) => {
|
|
50
|
+
const d = Math.min(1, (y - r) / l);
|
|
51
|
+
B(q(a(1 - Math.pow(1 - d, 3)))), d < 1 ? D = requestAnimationFrame(f) : H(!1);
|
|
52
|
+
};
|
|
53
|
+
D = requestAnimationFrame(f);
|
|
54
|
+
}), Z(() => cancelAnimationFrame(D));
|
|
55
|
+
const E = () => i.animateLayout ? j : i.layout, W = x(() => E().nodes), oe = x(() => new Map(W().map((e) => [e.id, e]))), fe = x(() => {
|
|
56
|
+
const e = ne();
|
|
57
|
+
return e?.kind === "node" ? se(E(), e.id) : new Set(e ? [e.id] : []);
|
|
58
|
+
}), ie = x(() => {
|
|
59
|
+
const e = ne();
|
|
60
|
+
if (e?.kind !== "node") return null;
|
|
61
|
+
const t = oe().get(e.id), n = t?.kind === "group" ? t.id : t?.parentId;
|
|
62
|
+
return n ? se(E(), n) : null;
|
|
63
|
+
}), K = (e) => i.selected?.kind === e.kind && i.selected.id === e.id, O = (e) => {
|
|
23
64
|
const {
|
|
24
|
-
width:
|
|
25
|
-
height:
|
|
26
|
-
} =
|
|
27
|
-
if (!
|
|
28
|
-
const
|
|
65
|
+
width: t,
|
|
66
|
+
height: n
|
|
67
|
+
} = te();
|
|
68
|
+
if (!t || !n) return;
|
|
69
|
+
const o = -e.x / e.scale - 240, a = -e.y / e.scale - 240, r = o + t / e.scale + 480, l = a + n / e.scale + 480;
|
|
29
70
|
return {
|
|
30
|
-
left:
|
|
71
|
+
left: o,
|
|
31
72
|
top: a,
|
|
32
|
-
right:
|
|
33
|
-
bottom:
|
|
73
|
+
right: r,
|
|
74
|
+
bottom: l
|
|
34
75
|
};
|
|
35
|
-
},
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
76
|
+
}, me = (e) => {
|
|
77
|
+
const t = O(e);
|
|
78
|
+
if (!t) return W();
|
|
38
79
|
const {
|
|
39
|
-
left:
|
|
40
|
-
top:
|
|
80
|
+
left: n,
|
|
81
|
+
top: o,
|
|
41
82
|
right: a,
|
|
42
|
-
bottom:
|
|
43
|
-
} =
|
|
44
|
-
return
|
|
45
|
-
},
|
|
46
|
-
edge:
|
|
47
|
-
path:
|
|
48
|
-
label:
|
|
49
|
-
segments:
|
|
50
|
-
left: Math.min(
|
|
51
|
-
right: Math.max(
|
|
52
|
-
top: Math.min(
|
|
53
|
-
bottom: Math.max(
|
|
83
|
+
bottom: r
|
|
84
|
+
} = t;
|
|
85
|
+
return W().filter((l) => l.id === i.selected?.id || l.x + l.width >= n && l.x <= a && l.y + l.height >= o && l.y <= r);
|
|
86
|
+
}, U = x(() => E().edges.map((e) => ({
|
|
87
|
+
edge: e,
|
|
88
|
+
path: e.sections.map(Fe).join(" "),
|
|
89
|
+
label: Te(e.sections),
|
|
90
|
+
segments: e.sections.flatMap((t) => t.slice(1).map((n, o) => ({
|
|
91
|
+
left: Math.min(n.x, t[o].x),
|
|
92
|
+
right: Math.max(n.x, t[o].x),
|
|
93
|
+
top: Math.min(n.y, t[o].y),
|
|
94
|
+
bottom: Math.max(n.y, t[o].y)
|
|
54
95
|
})))
|
|
55
|
-
}))),
|
|
56
|
-
const
|
|
57
|
-
return
|
|
58
|
-
edge:
|
|
59
|
-
segments:
|
|
60
|
-
}) =>
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
|
|
96
|
+
}))), xe = x(() => new Map(U().map((e) => [e.edge.id, e]))), be = (e) => {
|
|
97
|
+
const t = O(e);
|
|
98
|
+
return t ? U().filter(({
|
|
99
|
+
edge: n,
|
|
100
|
+
segments: o
|
|
101
|
+
}) => n.id === i.selected?.id || o.some((a) => a.left <= t.right && a.right >= t.left && a.top <= t.bottom && a.bottom >= t.top)) : U();
|
|
102
|
+
}, k = (e) => {
|
|
103
|
+
ue(e), i.onHover?.(e);
|
|
104
|
+
}, N = (e) => {
|
|
105
|
+
!M() && (V()?.kind !== e.kind || V()?.id !== e.id) && k(e);
|
|
106
|
+
}, S = (e, t, n) => {
|
|
107
|
+
const o = t.getBoundingClientRect();
|
|
65
108
|
return {
|
|
66
|
-
object:
|
|
67
|
-
owner:
|
|
68
|
-
position:
|
|
69
|
-
x:
|
|
70
|
-
y:
|
|
109
|
+
object: e,
|
|
110
|
+
owner: t,
|
|
111
|
+
position: n && (n.clientX !== 0 || n.clientY !== 0) ? {
|
|
112
|
+
x: n.clientX,
|
|
113
|
+
y: n.clientY
|
|
71
114
|
} : {
|
|
72
|
-
x:
|
|
73
|
-
y:
|
|
115
|
+
x: o.left + o.width / 2,
|
|
116
|
+
y: o.top + Math.min(32, o.height / 2)
|
|
74
117
|
}
|
|
75
118
|
};
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
|
|
119
|
+
}, J = (e, t) => {
|
|
120
|
+
i.onContextMenu && (t.preventDefault(), t.stopPropagation(), i.onContextMenu(S(e, t.currentTarget, t)));
|
|
121
|
+
}, Q = (e, t) => {
|
|
122
|
+
t.target === t.currentTarget && (t.key === "ContextMenu" || t.shiftKey && t.key === "F10" ? (t.preventDefault(), t.stopPropagation(), i.onContextMenu?.(S(e, t.currentTarget))) : t.key === "Enter" ? (t.preventDefault(), t.stopPropagation(), i.onActivate?.(S(e, t.currentTarget))) : t.key === "Escape" && (k(null), i.onActivate?.(S(null, b))));
|
|
80
123
|
};
|
|
81
|
-
|
|
82
|
-
if (!
|
|
83
|
-
const
|
|
84
|
-
width:
|
|
85
|
-
height:
|
|
124
|
+
de(() => {
|
|
125
|
+
if (!b) return;
|
|
126
|
+
const e = () => he({
|
|
127
|
+
width: b.clientWidth,
|
|
128
|
+
height: b.clientHeight
|
|
86
129
|
});
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
130
|
+
e();
|
|
131
|
+
const t = new ResizeObserver(e);
|
|
132
|
+
t.observe(b), Z(() => t.disconnect());
|
|
90
133
|
});
|
|
91
|
-
const
|
|
92
|
-
|
|
134
|
+
const ye = (e) => {
|
|
135
|
+
if (!M() || !e.parentId) return;
|
|
136
|
+
const t = oe().get(e.parentId);
|
|
137
|
+
if (!t) return;
|
|
138
|
+
const n = Math.max(0, t.y - e.y), o = Math.max(0, t.x - e.x), a = Math.max(0, e.x + e.width - t.x - t.width), r = Math.max(0, e.y + e.height - t.y - t.height);
|
|
139
|
+
return n || o || a || r ? `inset(${n}px ${a}px ${r}px ${o}px)` : void 0;
|
|
140
|
+
}, we = (e) => {
|
|
141
|
+
const t = {
|
|
93
142
|
kind: "node",
|
|
94
|
-
id:
|
|
95
|
-
},
|
|
96
|
-
selected: () =>
|
|
97
|
-
openMenu: (
|
|
98
|
-
};
|
|
143
|
+
id: e.id
|
|
144
|
+
}, n = {
|
|
145
|
+
selected: () => K(t),
|
|
146
|
+
openMenu: (a) => J(t, a)
|
|
147
|
+
}, o = x(() => e.kind === "group" && i.renderGroup ? i.renderGroup : i.renderNode);
|
|
99
148
|
return (() => {
|
|
100
|
-
var
|
|
101
|
-
return
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return y !== a.e && J(n, a.e = y), s !== a.t && c(n, "data-graph-object", a.t = s), G !== a.a && c(n, "data-selected", a.a = G), d !== a.o && L(n, "left", a.o = d), C !== a.i && L(n, "top", a.i = C), M !== a.n && L(n, "width", a.n = M), l !== a.s && L(n, "height", a.s = l), u !== a.h && c(n, "aria-label", a.h = u), a;
|
|
149
|
+
var a = Re();
|
|
150
|
+
return a.$$keydown = (r) => Q(t, r), a.$$contextmenu = (r) => J(t, r), a.$$click = (r) => {
|
|
151
|
+
r.target.closest("button, a, input, select, textarea, [data-floe-canvas-interactive]") || (r.stopPropagation(), i.onActivate?.(S(t, r.currentTarget, r)));
|
|
152
|
+
}, a.$$focusout = () => k(null), a.$$focusin = () => k(t), a.addEventListener("pointerleave", () => {
|
|
153
|
+
M() || k(null);
|
|
154
|
+
}), a.$$pointermove = () => N(t), a.addEventListener("pointerenter", () => N(t)), A(a, () => o()(e, n)), p((r) => {
|
|
155
|
+
var l = e.kind === "group" ? "floe-graph__group" : "floe-graph__node", f = e.id, y = K(t), d = `${e.x}px`, v = `${e.y}px`, w = `${e.width}px`, h = `${e.height}px`, C = e.opacity ?? 1, I = ye(e), g = e.exiting || void 0, T = e.exiting || void 0, u = e.label;
|
|
156
|
+
return l !== r.e && le(a, r.e = l), f !== r.t && s(a, "data-graph-object", r.t = f), y !== r.a && s(a, "data-selected", r.a = y), d !== r.o && L(a, "left", r.o = d), v !== r.i && L(a, "top", r.i = v), w !== r.n && L(a, "width", r.n = w), h !== r.s && L(a, "height", r.s = h), C !== r.h && L(a, "opacity", r.h = C), I !== r.r && L(a, "clip-path", r.r = I), g !== r.d && (a.inert = r.d = g), T !== r.l && s(a, "aria-hidden", r.l = T), u !== r.u && s(a, "aria-label", r.u = u), r;
|
|
109
157
|
}, {
|
|
110
158
|
e: void 0,
|
|
111
159
|
t: void 0,
|
|
@@ -114,114 +162,112 @@ function It(o) {
|
|
|
114
162
|
i: void 0,
|
|
115
163
|
n: void 0,
|
|
116
164
|
s: void 0,
|
|
117
|
-
h: void 0
|
|
118
|
-
|
|
165
|
+
h: void 0,
|
|
166
|
+
r: void 0,
|
|
167
|
+
d: void 0,
|
|
168
|
+
l: void 0,
|
|
169
|
+
u: void 0
|
|
170
|
+
}), a;
|
|
119
171
|
})();
|
|
120
172
|
};
|
|
121
173
|
return (() => {
|
|
122
|
-
var
|
|
123
|
-
|
|
124
|
-
var
|
|
125
|
-
return typeof
|
|
174
|
+
var e = pe();
|
|
175
|
+
e.$$keydown = (n) => Q(null, n);
|
|
176
|
+
var t = b;
|
|
177
|
+
return typeof t == "function" ? ke(t, e) : b = e, A(e, P(Ae, {
|
|
126
178
|
get viewport() {
|
|
127
|
-
return
|
|
179
|
+
return i.viewport;
|
|
128
180
|
},
|
|
129
181
|
minScale: 0.1,
|
|
130
182
|
maxScale: 3,
|
|
131
183
|
get ariaLabel() {
|
|
132
|
-
return
|
|
184
|
+
return i.ariaLabel;
|
|
133
185
|
},
|
|
134
186
|
get onViewportChange() {
|
|
135
|
-
return
|
|
187
|
+
return i.onViewportChange;
|
|
136
188
|
},
|
|
137
|
-
onViewportInteractionStart: () =>
|
|
138
|
-
resolveTargetRole: (
|
|
139
|
-
onCanvasPointerDown: (
|
|
140
|
-
!(
|
|
189
|
+
onViewportInteractionStart: () => i.onInteractionStart?.(),
|
|
190
|
+
resolveTargetRole: (n) => (n.target instanceof Element ? n.target : null)?.closest('button, a, input, select, textarea, [data-floe-canvas-interactive="true"]') ? "local_surface" : Pe(n),
|
|
191
|
+
onCanvasPointerDown: (n) => {
|
|
192
|
+
!(n.target instanceof Element) || n.target.closest("[data-graph-object]") || i.onActivate?.(S(null, b, n));
|
|
141
193
|
},
|
|
142
|
-
onCanvasContextMenu: (
|
|
194
|
+
onCanvasContextMenu: (n) => i.onContextMenu?.({
|
|
143
195
|
object: null,
|
|
144
|
-
owner:
|
|
196
|
+
owner: b,
|
|
145
197
|
position: {
|
|
146
|
-
x:
|
|
147
|
-
y:
|
|
198
|
+
x: n.clientX,
|
|
199
|
+
y: n.clientY
|
|
148
200
|
}
|
|
149
201
|
}),
|
|
150
|
-
children: (
|
|
151
|
-
const
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
202
|
+
children: (n) => {
|
|
203
|
+
const o = x(() => {
|
|
204
|
+
const l = O(n());
|
|
205
|
+
if (l) return l;
|
|
154
206
|
const {
|
|
155
|
-
x:
|
|
156
|
-
y
|
|
157
|
-
width:
|
|
158
|
-
height:
|
|
159
|
-
} =
|
|
207
|
+
x: f,
|
|
208
|
+
y,
|
|
209
|
+
width: d,
|
|
210
|
+
height: v
|
|
211
|
+
} = E().bounds;
|
|
160
212
|
return {
|
|
161
|
-
left:
|
|
162
|
-
top:
|
|
163
|
-
right:
|
|
164
|
-
bottom:
|
|
213
|
+
left: f - 240,
|
|
214
|
+
top: y - 240,
|
|
215
|
+
right: f + d + 240,
|
|
216
|
+
bottom: y + v + 240
|
|
165
217
|
};
|
|
166
|
-
}), a =
|
|
167
|
-
return [
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
},
|
|
171
|
-
children: O
|
|
172
|
-
}), (() => {
|
|
173
|
-
var d = yt(), C = d.firstChild, M = C.firstChild;
|
|
174
|
-
return c(M, "id", V), S(d, w(_, {
|
|
218
|
+
}), a = x(() => me(n())), r = x(() => be(n()).map((l) => l.edge.id));
|
|
219
|
+
return [(() => {
|
|
220
|
+
var l = ze(), f = l.firstChild, y = f.firstChild;
|
|
221
|
+
return s(y, "id", ee), A(l, P(ce, {
|
|
175
222
|
get each() {
|
|
176
|
-
return
|
|
223
|
+
return r();
|
|
177
224
|
},
|
|
178
|
-
children: (
|
|
179
|
-
const {
|
|
180
|
-
edge: u
|
|
181
|
-
} = l, b = {
|
|
225
|
+
children: (d) => {
|
|
226
|
+
const v = () => xe().get(d), w = () => v().edge, h = {
|
|
182
227
|
kind: "edge",
|
|
183
|
-
id:
|
|
184
|
-
},
|
|
185
|
-
return
|
|
228
|
+
id: d
|
|
229
|
+
}, C = () => v().path, I = () => v().label;
|
|
230
|
+
return P(_, {
|
|
186
231
|
get when() {
|
|
187
|
-
return !
|
|
232
|
+
return !ie() || ie().has(d);
|
|
188
233
|
},
|
|
189
234
|
get children() {
|
|
190
|
-
var
|
|
191
|
-
return
|
|
235
|
+
var g = Be(), T = g.firstChild, u = T.nextSibling;
|
|
236
|
+
return s(g, "data-graph-object", d), s(T, "marker-end", `url(#${ee})`), A(g, P(_, {
|
|
192
237
|
get when() {
|
|
193
|
-
return
|
|
238
|
+
return I();
|
|
194
239
|
},
|
|
195
|
-
children: (
|
|
196
|
-
var
|
|
197
|
-
return
|
|
198
|
-
var
|
|
199
|
-
return
|
|
240
|
+
children: (c) => (() => {
|
|
241
|
+
var $ = He();
|
|
242
|
+
return A($, () => w().label), p((m) => {
|
|
243
|
+
var F = /^\d+$/.test(w().label), G = c().x, R = c().y - 6;
|
|
244
|
+
return F !== m.e && s($, "data-count", m.e = F), G !== m.t && s($, "x", m.t = G), R !== m.a && s($, "y", m.a = R), m;
|
|
200
245
|
}, {
|
|
201
246
|
e: void 0,
|
|
202
247
|
t: void 0,
|
|
203
248
|
a: void 0
|
|
204
|
-
}),
|
|
249
|
+
}), $;
|
|
205
250
|
})()
|
|
206
|
-
}),
|
|
207
|
-
|
|
208
|
-
},
|
|
209
|
-
|
|
210
|
-
|
|
251
|
+
}), u), u.$$keydown = (c) => Q(h, c), u.$$contextmenu = (c) => J(h, c), u.$$click = (c) => {
|
|
252
|
+
c.stopPropagation(), i.onActivate?.(S(h, c.currentTarget, c));
|
|
253
|
+
}, u.addEventListener("blur", () => k(null)), u.addEventListener("focus", () => k(h)), u.addEventListener("pointerleave", () => {
|
|
254
|
+
M() || k(null);
|
|
255
|
+
}), u.$$pointermove = () => N(h), u.addEventListener("pointerenter", () => N(h)), p((c) => {
|
|
256
|
+
var $ = fe().has(d), m = K(h), F = C(), G = C(), R = w().label;
|
|
257
|
+
return $ !== c.e && s(g, "data-emphasized", c.e = $), m !== c.t && s(g, "data-selected", c.t = m), F !== c.a && s(T, "d", c.a = F), G !== c.o && s(u, "d", c.o = G), R !== c.i && s(u, "aria-label", c.i = R), c;
|
|
211
258
|
}, {
|
|
212
259
|
e: void 0,
|
|
213
260
|
t: void 0,
|
|
214
261
|
a: void 0,
|
|
215
262
|
o: void 0,
|
|
216
|
-
i: void 0
|
|
217
|
-
|
|
218
|
-
}), x;
|
|
263
|
+
i: void 0
|
|
264
|
+
}), g;
|
|
219
265
|
}
|
|
220
266
|
});
|
|
221
267
|
}
|
|
222
|
-
}), null),
|
|
223
|
-
var
|
|
224
|
-
return
|
|
268
|
+
}), null), p((d) => {
|
|
269
|
+
var v = o().right - o().left, w = o().bottom - o().top, h = `${o().left} ${o().top} ${o().right - o().left} ${o().bottom - o().top}`, C = `${o().left}px`, I = `${o().top}px`, g = i.ariaLabel;
|
|
270
|
+
return v !== d.e && s(l, "width", d.e = v), w !== d.t && s(l, "height", d.t = w), h !== d.a && s(l, "viewBox", d.a = h), C !== d.o && L(l, "left", d.o = C), I !== d.i && L(l, "top", d.i = I), g !== d.n && s(l, "aria-label", d.n = g), d;
|
|
225
271
|
}, {
|
|
226
272
|
e: void 0,
|
|
227
273
|
t: void 0,
|
|
@@ -229,54 +275,56 @@ function It(o) {
|
|
|
229
275
|
o: void 0,
|
|
230
276
|
i: void 0,
|
|
231
277
|
n: void 0
|
|
232
|
-
}),
|
|
233
|
-
})(),
|
|
278
|
+
}), l;
|
|
279
|
+
})(), P(ce, {
|
|
234
280
|
get each() {
|
|
235
|
-
return
|
|
281
|
+
return a();
|
|
236
282
|
},
|
|
237
|
-
children:
|
|
283
|
+
children: we
|
|
238
284
|
})];
|
|
239
285
|
}
|
|
240
|
-
}), null),
|
|
286
|
+
}), null), A(e, P(_, {
|
|
241
287
|
get when() {
|
|
242
|
-
return
|
|
288
|
+
return i.minimap;
|
|
243
289
|
},
|
|
244
|
-
children: (
|
|
290
|
+
children: (n) => P(Ge, {
|
|
245
291
|
get layout() {
|
|
246
|
-
return
|
|
292
|
+
return E();
|
|
247
293
|
},
|
|
248
294
|
get viewport() {
|
|
249
|
-
return
|
|
295
|
+
return i.viewport;
|
|
250
296
|
},
|
|
251
297
|
get size() {
|
|
252
|
-
return
|
|
298
|
+
return te();
|
|
253
299
|
},
|
|
254
300
|
get onViewportChange() {
|
|
255
|
-
return
|
|
301
|
+
return i.onViewportChange;
|
|
256
302
|
},
|
|
257
303
|
get onInteractionStart() {
|
|
258
|
-
return
|
|
304
|
+
return i.onInteractionStart;
|
|
259
305
|
},
|
|
260
306
|
get ariaLabel() {
|
|
261
|
-
return
|
|
307
|
+
return n().ariaLabel;
|
|
262
308
|
},
|
|
263
309
|
get nodeStyle() {
|
|
264
|
-
return
|
|
310
|
+
return n().nodeStyle;
|
|
265
311
|
},
|
|
266
312
|
get edges() {
|
|
267
|
-
return
|
|
313
|
+
return Me(() => !!M())() ? E().edges : n().edges;
|
|
268
314
|
}
|
|
269
315
|
})
|
|
270
|
-
}), null),
|
|
271
|
-
var
|
|
272
|
-
return
|
|
316
|
+
}), null), A(e, () => i.overlay, null), p((n) => {
|
|
317
|
+
var o = `floe-graph ${i.class ?? ""}`, a = M() || void 0, r = i.animateLayout || void 0, l = i.ariaLabel;
|
|
318
|
+
return o !== n.e && le(e, n.e = o), a !== n.t && s(e, "data-layout-moving", n.t = a), r !== n.a && s(e, "data-animate-layout", n.a = r), l !== n.o && s(e, "aria-label", n.o = l), n;
|
|
273
319
|
}, {
|
|
274
320
|
e: void 0,
|
|
275
|
-
t: void 0
|
|
276
|
-
|
|
321
|
+
t: void 0,
|
|
322
|
+
a: void 0,
|
|
323
|
+
o: void 0
|
|
324
|
+
}), e;
|
|
277
325
|
})();
|
|
278
326
|
}
|
|
279
|
-
|
|
327
|
+
Ce(["pointermove", "focusin", "focusout", "click", "contextmenu", "keydown"]);
|
|
280
328
|
export {
|
|
281
|
-
|
|
329
|
+
Ke as GraphCanvas
|
|
282
330
|
};
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
function w() {
|
|
2
|
-
const
|
|
2
|
+
const t = new Worker(new URL("../../assets/layout-worker-CsLsdMKZ.js", import.meta.url), { type: "module" });
|
|
3
3
|
let a, d = 0;
|
|
4
|
-
const
|
|
5
|
-
a = e,
|
|
6
|
-
for (const r of
|
|
4
|
+
const o = /* @__PURE__ */ new Map(), n = (e) => {
|
|
5
|
+
a = e, t.terminate();
|
|
6
|
+
for (const r of o.values())
|
|
7
7
|
r.cleanup(), r.reject(e);
|
|
8
|
-
|
|
8
|
+
o.clear();
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
t.addEventListener(
|
|
11
11
|
"error",
|
|
12
12
|
(e) => n(new Error(e.message || "Graph layout worker failed"))
|
|
13
|
-
),
|
|
13
|
+
), t.addEventListener(
|
|
14
14
|
"messageerror",
|
|
15
15
|
() => n(new Error("Invalid graph layout worker response"))
|
|
16
|
-
),
|
|
16
|
+
), t.addEventListener("message", ({ data: e }) => {
|
|
17
17
|
if (!e || !Number.isInteger(e.id)) {
|
|
18
18
|
n(new Error("Invalid graph layout worker response"));
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
const r =
|
|
21
|
+
const r = o.get(e.id);
|
|
22
22
|
if (r) {
|
|
23
23
|
if (!e.error && (r.kind === "layout" ? !e.layout : !Array.isArray(e.edges))) {
|
|
24
24
|
n(new Error("Invalid graph layout worker response"));
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
o.delete(e.id), r.cleanup(), e.error ? r.reject(new Error(e.error)) : r.resolve(r.kind === "layout" ? e.layout : e.edges);
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
const p = (e, r) => a ? Promise.reject(a) : r?.aborted ? Promise.reject(new DOMException("Graph routing canceled", "AbortError")) : new Promise((l, s) => {
|
|
31
31
|
const i = ++d, u = () => {
|
|
32
|
-
|
|
32
|
+
o.delete(i) && (r?.removeEventListener("abort", u), t.postMessage({ id: i, cancel: !0 }), s(new DOMException("Graph routing canceled", "AbortError")));
|
|
33
33
|
};
|
|
34
|
-
|
|
34
|
+
o.set(i, {
|
|
35
35
|
kind: e.kind,
|
|
36
36
|
resolve: (c) => l(c),
|
|
37
37
|
reject: s,
|
|
38
38
|
cleanup: () => r?.removeEventListener("abort", u)
|
|
39
39
|
}), r?.addEventListener("abort", u, { once: !0 });
|
|
40
40
|
try {
|
|
41
|
-
|
|
41
|
+
t.postMessage({ id: i, ...e });
|
|
42
42
|
} catch (c) {
|
|
43
|
-
|
|
43
|
+
o.delete(i), r?.removeEventListener("abort", u), s(c);
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
return {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GraphLayout, GraphLayoutNode } from './types';
|
|
2
|
+
export type MotionNode = GraphLayoutNode & {
|
|
3
|
+
opacity?: number;
|
|
4
|
+
exiting?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type MotionLayout = Omit<GraphLayout, 'nodes'> & {
|
|
7
|
+
nodes: readonly MotionNode[];
|
|
8
|
+
};
|
|
9
|
+
/** Presentation only: one clock moves boxes and routes; final worker geometry stays exact. */
|
|
10
|
+
export declare function createGraphLayoutTransition(from: MotionLayout, to: GraphLayout): (progress: number) => MotionLayout;
|