@green-on-grey/ui-kit 1.13.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Graph.d.ts +52 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +322 -164
- package/dist/index.js.map +1 -1
- package/dist/locales/index.d.ts +5 -0
- package/dist/locales.js +10 -5
- package/dist/locales.js.map +1 -1
- package/dist/manifest.json +5 -1
- package/dist/styles.css +37 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./ui-BrAaLui6.js";
|
|
2
2
|
import { n as f, t as p } from "./i18n-BJ8rsBp6.js";
|
|
3
|
-
import {
|
|
4
|
-
import { useCallback as
|
|
5
|
-
import { forceCenter as
|
|
3
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
4
|
+
import { useCallback as _, useEffect as v, useId as y, useMemo as b, useRef as x, useState as S } from "react";
|
|
5
|
+
import { forceCenter as C, forceCollide as w, forceLink as T, forceManyBody as E, forceSimulation as D } from "d3-force";
|
|
6
6
|
//#region src/components/Button.tsx
|
|
7
|
-
function
|
|
7
|
+
function O({ variant: e, size: t, className: n, type: r = "button", ...i }) {
|
|
8
8
|
let a = [
|
|
9
9
|
"btn",
|
|
10
10
|
e,
|
|
11
11
|
t,
|
|
12
12
|
n
|
|
13
13
|
].filter(Boolean).join(" ");
|
|
14
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ h("button", {
|
|
15
15
|
type: r,
|
|
16
16
|
className: a,
|
|
17
17
|
...i
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function k({ label: e, fill: t, on: n, className: r, type: i = "button", ...a }) {
|
|
21
21
|
let o = [
|
|
22
22
|
"iconbtn",
|
|
23
23
|
t && "fill",
|
|
24
24
|
n && "on",
|
|
25
25
|
r
|
|
26
26
|
].filter(Boolean).join(" ");
|
|
27
|
-
return /* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ h("button", {
|
|
28
28
|
type: i,
|
|
29
29
|
className: o,
|
|
30
30
|
"aria-label": e,
|
|
@@ -33,12 +33,12 @@ function O({ label: e, fill: t, on: n, className: r, type: i = "button", ...a })
|
|
|
33
33
|
}
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region src/components/Menu.tsx
|
|
36
|
-
function
|
|
36
|
+
function A({ onClose: e, label: t, className: n, children: r }) {
|
|
37
37
|
let i = l(!0, e);
|
|
38
|
-
return
|
|
38
|
+
return v(() => {
|
|
39
39
|
let e = document.activeElement;
|
|
40
40
|
return () => e?.focus?.();
|
|
41
|
-
}, []), /* @__PURE__ */
|
|
41
|
+
}, []), /* @__PURE__ */ h("div", {
|
|
42
42
|
className: `menu${n ? ` ${n}` : ""}`,
|
|
43
43
|
role: "dialog",
|
|
44
44
|
"aria-label": t,
|
|
@@ -48,52 +48,52 @@ function k({ onClose: e, label: t, className: n, children: r }) {
|
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/components/TopBar.tsx
|
|
51
|
-
function
|
|
52
|
-
let p = f(), [
|
|
51
|
+
function j({ logo: e, name: t, home: n = "/", sections: i, Link: a, center: o, actions: s, avatar: c, profileMenu: u, menu: d }) {
|
|
52
|
+
let p = f(), [m, v] = S(!1), [y, b] = S(!1), x = _(() => b(!1), []), C = _(() => v(!1), []), w = l(y, x), T = i.map((e) => /* @__PURE__ */ h(a, {
|
|
53
53
|
href: e.href,
|
|
54
54
|
className: e.active ? "on" : void 0,
|
|
55
55
|
"aria-current": e.active ? "page" : void 0,
|
|
56
|
-
onClick:
|
|
56
|
+
onClick: x,
|
|
57
57
|
children: e.label
|
|
58
58
|
}, e.key));
|
|
59
|
-
return /* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */ g("div", {
|
|
60
60
|
className: "topbar",
|
|
61
61
|
children: [
|
|
62
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ g(a, {
|
|
63
63
|
href: n,
|
|
64
64
|
className: "brand",
|
|
65
|
-
children: [/* @__PURE__ */
|
|
65
|
+
children: [/* @__PURE__ */ h("img", {
|
|
66
66
|
src: e,
|
|
67
67
|
alt: ""
|
|
68
|
-
}), /* @__PURE__ */
|
|
68
|
+
}), /* @__PURE__ */ h("span", {
|
|
69
69
|
className: "hide-m",
|
|
70
70
|
children: t
|
|
71
71
|
})]
|
|
72
72
|
}),
|
|
73
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ h("nav", {
|
|
74
74
|
className: "nav hide-m",
|
|
75
75
|
"aria-label": p("topbar.sections"),
|
|
76
76
|
children: T
|
|
77
77
|
}),
|
|
78
78
|
o,
|
|
79
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ g("div", {
|
|
80
80
|
className: "top-actions",
|
|
81
81
|
children: [
|
|
82
82
|
s,
|
|
83
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ h("button", {
|
|
84
84
|
className: "avatar",
|
|
85
|
-
style:
|
|
85
|
+
style: m ? { boxShadow: "0 0 0 2px var(--violet)" } : void 0,
|
|
86
86
|
onClick: () => {
|
|
87
87
|
b(!1), v((e) => !e);
|
|
88
88
|
},
|
|
89
89
|
"aria-label": p("topbar.profile"),
|
|
90
|
-
"aria-expanded":
|
|
90
|
+
"aria-expanded": m,
|
|
91
91
|
children: c
|
|
92
92
|
}),
|
|
93
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ g("div", {
|
|
94
94
|
className: "burger",
|
|
95
95
|
ref: w,
|
|
96
|
-
children: [/* @__PURE__ */
|
|
96
|
+
children: [/* @__PURE__ */ h("button", {
|
|
97
97
|
className: `iconbtn${y ? " on" : ""}`,
|
|
98
98
|
onClick: () => {
|
|
99
99
|
v(!1), b((e) => !e);
|
|
@@ -101,12 +101,12 @@ function A({ logo: e, name: t, home: n = "/", sections: i, Link: a, center: o, a
|
|
|
101
101
|
"aria-label": d?.label ?? p("topbar.sections"),
|
|
102
102
|
"aria-expanded": y,
|
|
103
103
|
"aria-controls": "nav-sections",
|
|
104
|
-
children: /* @__PURE__ */
|
|
105
|
-
}), y && (d ? /* @__PURE__ */
|
|
104
|
+
children: /* @__PURE__ */ h(r, { name: y ? "x" : "menu" })
|
|
105
|
+
}), y && (d ? /* @__PURE__ */ h("div", {
|
|
106
106
|
id: "nav-sections",
|
|
107
107
|
className: "navmenu",
|
|
108
|
-
children: d.render(
|
|
109
|
-
}) : /* @__PURE__ */
|
|
108
|
+
children: d.render(x)
|
|
109
|
+
}) : /* @__PURE__ */ h("nav", {
|
|
110
110
|
id: "nav-sections",
|
|
111
111
|
className: "navmenu",
|
|
112
112
|
"aria-label": p("topbar.sections"),
|
|
@@ -115,21 +115,21 @@ function A({ logo: e, name: t, home: n = "/", sections: i, Link: a, center: o, a
|
|
|
115
115
|
})
|
|
116
116
|
]
|
|
117
117
|
}),
|
|
118
|
-
|
|
118
|
+
m && u(C)
|
|
119
119
|
]
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
//#endregion
|
|
123
123
|
//#region src/components/Graph.tsx
|
|
124
|
-
var
|
|
125
|
-
let
|
|
124
|
+
var M = 760, N = 500, P = (e = 1) => 7 + Math.sqrt(e) * 3.2, F = (e, t, n) => {
|
|
125
|
+
let r = Math.max(.5, Math.min(4, e.k * t));
|
|
126
126
|
return {
|
|
127
|
-
k:
|
|
128
|
-
x:
|
|
129
|
-
y:
|
|
127
|
+
k: r,
|
|
128
|
+
x: n.w / 2 - (n.w / 2 - e.x) / e.k * r,
|
|
129
|
+
y: n.h / 2 - (n.h / 2 - e.y) / e.k * r
|
|
130
130
|
};
|
|
131
131
|
};
|
|
132
|
-
function
|
|
132
|
+
function I(e, t, n) {
|
|
133
133
|
let r = /* @__PURE__ */ new Set([t]), i = [t];
|
|
134
134
|
for (let t = 0; t < n; t++) {
|
|
135
135
|
let t = [];
|
|
@@ -141,194 +141,352 @@ function F(e, t, n) {
|
|
|
141
141
|
}
|
|
142
142
|
return r;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function L(e, t) {
|
|
145
145
|
let n = e.map((e) => ({
|
|
146
146
|
...e,
|
|
147
|
-
r:
|
|
147
|
+
r: P(e.size)
|
|
148
148
|
})), r = new Set(n.map((e) => e.id)), i = t.filter((e) => r.has(e.source) && r.has(e.target)).map((e) => ({
|
|
149
149
|
source: e.source,
|
|
150
150
|
target: e.target,
|
|
151
151
|
weight: e.weight ?? 1
|
|
152
|
-
})), a =
|
|
152
|
+
})), a = D(n).force("link", T(i).id((e) => e.id).distance(90).strength((e) => Math.min(1, .2 + e.weight * .08))).force("charge", E().strength(-260)).force("center", C(M / 2, N / 2)).force("collide", w().radius((e) => e.r + 14)).stop();
|
|
153
153
|
for (let e = 0; e < 260; e++) a.tick();
|
|
154
|
-
for (let e of n) e.x = Math.max(e.r + 30, Math.min(
|
|
154
|
+
for (let e of n) e.x = Math.max(e.r + 30, Math.min(M - e.r - 30, e.x ?? M / 2)), e.y = Math.max(e.r + 10, Math.min(N - e.r - 24, e.y ?? N / 2));
|
|
155
155
|
return n;
|
|
156
156
|
}
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
var R = 130, z = 104, B = 76;
|
|
158
|
+
function V(e, t) {
|
|
159
|
+
let n = new Map(t.map((e, t) => [e.id, t])), r = /* @__PURE__ */ new Map(), i = e.map((e) => ({
|
|
160
|
+
...e,
|
|
161
|
+
r: P(e.size)
|
|
162
|
+
}));
|
|
163
|
+
for (let e of i) {
|
|
164
|
+
let i = n.get(e.row ?? "") ?? t.length;
|
|
165
|
+
r.set(i, [...r.get(i) ?? [], e]);
|
|
166
|
+
}
|
|
167
|
+
let a = [...r.keys()].toSorted((e, t) => e - t), o = R + Math.max(1, ...a.map((e) => r.get(e).length)) * z, s = a.length * B, c = {
|
|
168
|
+
w: Math.max(M, o + 40),
|
|
169
|
+
h: Math.max(N, s + 40)
|
|
170
|
+
}, l = (c.w - o) / 2, u = (c.h - s) / 2;
|
|
171
|
+
return {
|
|
172
|
+
placed: i,
|
|
173
|
+
field: c,
|
|
174
|
+
rows: a.map((e, n) => {
|
|
175
|
+
let i = u + B * (n + .5) - 8;
|
|
176
|
+
return r.get(e).toSorted((e, t) => (e.order ?? Infinity) - (t.order ?? Infinity) || (e.id < t.id ? -1 : +(e.id > t.id))).forEach((e, t) => {
|
|
177
|
+
e.x = l + R + z * (t + .5), e.y = i;
|
|
178
|
+
}), {
|
|
179
|
+
id: t[e]?.id ?? "",
|
|
180
|
+
label: t[e]?.label ?? "",
|
|
181
|
+
y: i,
|
|
182
|
+
x: l + 8,
|
|
183
|
+
x2: l + o
|
|
184
|
+
};
|
|
185
|
+
})
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function H(e, t, n, r) {
|
|
189
|
+
let i = e.x ?? 0, a = e.y ?? 0, o = t.x ?? 0, s = t.y ?? 0, c = o, l = s, u = r && Math.abs(l - a) < 1 && i !== c, d = (i + c) / 2, f = a - Math.sign(c - i) * Math.min(B * .8, 14 + Math.abs(c - i) * .25);
|
|
190
|
+
if (n) {
|
|
191
|
+
let e = u ? d : i, n = u ? f : a, r = c - e, o = l - n, s = Math.hypot(r, o) || 1;
|
|
192
|
+
c -= r / s * (t.r + 2), l -= o / s * (t.r + 2);
|
|
193
|
+
}
|
|
194
|
+
return u ? {
|
|
195
|
+
d: `M${i},${a} Q${d},${f} ${c},${l}`,
|
|
196
|
+
hit: `M${i},${a} Q${d},${f} ${o},${s}`,
|
|
197
|
+
x1: i,
|
|
198
|
+
y1: a,
|
|
199
|
+
x2: c,
|
|
200
|
+
y2: l
|
|
201
|
+
} : {
|
|
202
|
+
x1: i,
|
|
203
|
+
y1: a,
|
|
204
|
+
x2: c,
|
|
205
|
+
y2: l
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function U({ nodes: e, edges: t, ariaLabel: n, selected: i, onSelect: a, focus: o, depth: s = 1, onOpen: c, legend: l, nodeLabel: u, rows: d, draggable: p }) {
|
|
209
|
+
let _ = f(), C = `g-arrow-${y().replace(/:/g, "")}`, [w, T] = S(null), [E, D] = S({
|
|
159
210
|
k: 1,
|
|
160
211
|
x: 0,
|
|
161
212
|
y: 0
|
|
162
|
-
}),
|
|
163
|
-
|
|
213
|
+
}), O = x(null), k = x(null), A = x(-Infinity), j = x(null), P = d ? void 0 : t, R = b(() => d ? V(e, d) : {
|
|
214
|
+
placed: L(e, P ?? []),
|
|
215
|
+
field: {
|
|
216
|
+
w: M,
|
|
217
|
+
h: N
|
|
218
|
+
}
|
|
219
|
+
}, [
|
|
220
|
+
e,
|
|
221
|
+
P,
|
|
222
|
+
d
|
|
223
|
+
]), { field: z } = R, [U, W] = S(null), G = U?.of === R ? U.at : void 0, { placed: K, byId: q } = b(() => {
|
|
224
|
+
let e = G ? R.placed.map((e) => G.has(e.id) ? {
|
|
225
|
+
...e,
|
|
226
|
+
...G.get(e.id)
|
|
227
|
+
} : e) : R.placed;
|
|
164
228
|
return {
|
|
165
|
-
placed:
|
|
166
|
-
byId: new Map(
|
|
229
|
+
placed: e,
|
|
230
|
+
byId: new Map(e.map((e) => [e.id, e]))
|
|
167
231
|
};
|
|
168
|
-
}, [
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
232
|
+
}, [R, G]), J = o !== void 0 && q.has(o) ? o : void 0, Y = w ?? (i?.kind === "node" ? i.id : null), X = b(() => i?.kind === "edge" && !w ? /* @__PURE__ */ new Set([i.source, i.target]) : Y ? I(t, Y, 1) : J ? I(t, J, s) : /* @__PURE__ */ new Set(), [
|
|
233
|
+
Y,
|
|
234
|
+
i,
|
|
235
|
+
w,
|
|
236
|
+
J,
|
|
237
|
+
s,
|
|
174
238
|
t
|
|
175
|
-
]),
|
|
239
|
+
]), ee = X.size > 0, te = (e) => i?.kind === "edge" && !w ? i.source === e.source && i.target === e.target : Y ? e.source === Y || e.target === Y : J !== void 0 && X.has(e.source) && X.has(e.target), Z = (e) => D((t) => F(t, e, z)), Q = (e, t) => a(t ? null : {
|
|
176
240
|
kind: "node",
|
|
177
241
|
id: e
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
|
|
242
|
+
}), $ = (e) => {
|
|
243
|
+
let t = e.getBoundingClientRect();
|
|
244
|
+
return 1 / (Math.min(t.width / z.w, t.height / z.h) || 1);
|
|
245
|
+
};
|
|
246
|
+
return v(() => {
|
|
247
|
+
let e = j.current;
|
|
181
248
|
if (!e) return;
|
|
182
249
|
let t = (e) => {
|
|
183
|
-
e.preventDefault(),
|
|
250
|
+
e.preventDefault(), D((t) => F(t, e.deltaY < 0 ? 1.15 : 1 / 1.15, z));
|
|
184
251
|
};
|
|
185
252
|
return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
|
|
186
|
-
}, []), /* @__PURE__ */
|
|
253
|
+
}, [z]), /* @__PURE__ */ g("div", {
|
|
187
254
|
className: "gwrap",
|
|
188
255
|
children: [
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
ref:
|
|
191
|
-
viewBox: `0 0 ${
|
|
256
|
+
/* @__PURE__ */ g("svg", {
|
|
257
|
+
ref: j,
|
|
258
|
+
viewBox: `0 0 ${z.w} ${z.h}`,
|
|
192
259
|
role: "group",
|
|
193
260
|
"aria-label": n,
|
|
194
|
-
className:
|
|
261
|
+
className: ee ? "dimmed" : void 0,
|
|
195
262
|
onPointerDown: (e) => {
|
|
196
|
-
e.target === e.currentTarget && (
|
|
263
|
+
e.target === e.currentTarget && (O.current = {
|
|
197
264
|
x: e.clientX,
|
|
198
265
|
y: e.clientY,
|
|
199
266
|
moved: !1
|
|
200
267
|
}, e.currentTarget.setPointerCapture(e.pointerId));
|
|
201
268
|
},
|
|
202
269
|
onPointerMove: (e) => {
|
|
203
|
-
if (!
|
|
204
|
-
let t = e.currentTarget
|
|
205
|
-
|
|
270
|
+
if (!O.current) return;
|
|
271
|
+
let t = $(e.currentTarget), n = (e.clientX - O.current.x) * t, r = (e.clientY - O.current.y) * t;
|
|
272
|
+
O.current = {
|
|
206
273
|
x: e.clientX,
|
|
207
274
|
y: e.clientY,
|
|
208
|
-
moved:
|
|
209
|
-
},
|
|
275
|
+
moved: O.current.moved || n !== 0 || r !== 0
|
|
276
|
+
}, D((e) => ({
|
|
210
277
|
...e,
|
|
211
278
|
x: e.x + n,
|
|
212
279
|
y: e.y + r
|
|
213
280
|
}));
|
|
214
281
|
},
|
|
215
282
|
onPointerUp: () => {
|
|
216
|
-
|
|
283
|
+
O.current?.moved || (O.current = null);
|
|
217
284
|
},
|
|
218
285
|
onClick: (e) => {
|
|
219
|
-
let t =
|
|
220
|
-
|
|
286
|
+
let t = O.current?.moved;
|
|
287
|
+
O.current = null, !t && e.target === e.currentTarget && a(null);
|
|
221
288
|
},
|
|
222
|
-
children: [t.some((e) => e.directed) && /* @__PURE__ */
|
|
223
|
-
id:
|
|
289
|
+
children: [t.some((e) => e.directed) && /* @__PURE__ */ h("defs", { children: /* @__PURE__ */ h("marker", {
|
|
290
|
+
id: C,
|
|
224
291
|
viewBox: "0 0 10 10",
|
|
225
292
|
refX: "10",
|
|
226
293
|
refY: "5",
|
|
227
294
|
markerWidth: "7",
|
|
228
295
|
markerHeight: "7",
|
|
229
296
|
orient: "auto-start-reverse",
|
|
230
|
-
children: /* @__PURE__ */
|
|
231
|
-
}) }), /* @__PURE__ */
|
|
232
|
-
transform: `translate(${
|
|
233
|
-
children: [
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
/* @__PURE__ */ m("line", {
|
|
258
|
-
className: "hit",
|
|
259
|
-
x1: n.x,
|
|
260
|
-
y1: n.y,
|
|
261
|
-
x2: r.x,
|
|
262
|
-
y2: r.y
|
|
263
|
-
}),
|
|
264
|
-
e.title && /* @__PURE__ */ m("title", { children: e.title })
|
|
265
|
-
]
|
|
266
|
-
}, `${e.source}\u0000${e.target}\u0000${t}`);
|
|
267
|
-
}), E.map((e) => {
|
|
268
|
-
let t = r?.kind === "node" && r.id === e.id, n = [
|
|
269
|
-
"g-n",
|
|
270
|
-
`g-c${e.group ?? 1}`,
|
|
271
|
-
e.hideLabel && "small",
|
|
272
|
-
e.dashed && "dashed",
|
|
273
|
-
e.muted && "muted",
|
|
274
|
-
A.has(e.id) && "hl",
|
|
275
|
-
t && "pin",
|
|
276
|
-
O === e.id && "focus"
|
|
277
|
-
].filter(Boolean).join(" ");
|
|
278
|
-
return /* @__PURE__ */ h("g", {
|
|
279
|
-
className: n,
|
|
280
|
-
tabIndex: 0,
|
|
281
|
-
role: "button",
|
|
282
|
-
"aria-pressed": t,
|
|
283
|
-
"aria-label": l ? l(e) : e.label,
|
|
284
|
-
onMouseEnter: () => g(e.id),
|
|
285
|
-
onMouseLeave: () => g(null),
|
|
286
|
-
onFocus: () => g(e.id),
|
|
287
|
-
onBlur: () => g(null),
|
|
288
|
-
onClick: () => z(e.id, t),
|
|
289
|
-
onDoubleClick: () => s?.(e.id),
|
|
290
|
-
onKeyDown: (n) => {
|
|
291
|
-
n.key === "Enter" && s ? (n.preventDefault(), s(e.id)) : (n.key === "Enter" || n.key === " ") && (n.preventDefault(), z(e.id, t));
|
|
292
|
-
},
|
|
293
|
-
children: [
|
|
294
|
-
/* @__PURE__ */ m("circle", {
|
|
295
|
-
cx: e.x,
|
|
296
|
-
cy: e.y,
|
|
297
|
-
r: e.r
|
|
298
|
-
}),
|
|
299
|
-
/* @__PURE__ */ m("text", {
|
|
300
|
-
x: e.x,
|
|
301
|
-
y: (e.y ?? 0) + e.r + 14,
|
|
302
|
-
children: e.label
|
|
297
|
+
children: /* @__PURE__ */ h("path", { d: "M0,0 L10,5 L0,10 z" })
|
|
298
|
+
}) }), /* @__PURE__ */ g("g", {
|
|
299
|
+
transform: `translate(${E.x} ${E.y}) scale(${E.k})`,
|
|
300
|
+
children: [
|
|
301
|
+
R.rows?.map((e, t) => /* @__PURE__ */ g("g", {
|
|
302
|
+
className: "g-row",
|
|
303
|
+
children: [t > 0 && /* @__PURE__ */ h("line", {
|
|
304
|
+
x1: e.x,
|
|
305
|
+
x2: e.x2,
|
|
306
|
+
y1: e.y - B / 2 + 8,
|
|
307
|
+
y2: e.y - B / 2 + 8
|
|
308
|
+
}), /* @__PURE__ */ h("text", {
|
|
309
|
+
x: e.x,
|
|
310
|
+
y: e.y,
|
|
311
|
+
children: e.label
|
|
312
|
+
})]
|
|
313
|
+
}, `${e.id}\u0000${t}`)),
|
|
314
|
+
t.map((e, t) => {
|
|
315
|
+
let n = q.get(e.source), r = q.get(e.target);
|
|
316
|
+
if (!n || !r) return null;
|
|
317
|
+
let i = H(n, r, !!e.directed, !!d), o = e.directed ? `url(#${C})` : void 0;
|
|
318
|
+
return /* @__PURE__ */ g("g", {
|
|
319
|
+
className: `g-e${e.dashed ? " dashed" : ""}${e.double ? " double" : ""}${te(e) ? " hl" : ""}`,
|
|
320
|
+
onClick: () => a({
|
|
321
|
+
kind: "edge",
|
|
322
|
+
source: e.source,
|
|
323
|
+
target: e.target
|
|
303
324
|
}),
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
325
|
+
children: [i.d ? /* @__PURE__ */ g(m, { children: [
|
|
326
|
+
/* @__PURE__ */ h("path", {
|
|
327
|
+
d: i.d,
|
|
328
|
+
strokeWidth: 1 + (e.weight ?? 1) * .5 + (e.double ? 3 : 0),
|
|
329
|
+
markerEnd: e.double ? void 0 : o
|
|
330
|
+
}),
|
|
331
|
+
e.double && /* @__PURE__ */ h("path", {
|
|
332
|
+
className: "inner",
|
|
333
|
+
d: i.d,
|
|
334
|
+
markerEnd: o
|
|
335
|
+
}),
|
|
336
|
+
/* @__PURE__ */ h("path", {
|
|
337
|
+
className: "hit",
|
|
338
|
+
d: i.hit
|
|
339
|
+
})
|
|
340
|
+
] }) : /* @__PURE__ */ g(m, { children: [
|
|
341
|
+
/* @__PURE__ */ h("line", {
|
|
342
|
+
x1: i.x1,
|
|
343
|
+
y1: i.y1,
|
|
344
|
+
x2: i.x2,
|
|
345
|
+
y2: i.y2,
|
|
346
|
+
strokeWidth: 1 + (e.weight ?? 1) * .5 + (e.double ? 3 : 0),
|
|
347
|
+
markerEnd: e.double ? void 0 : o
|
|
348
|
+
}),
|
|
349
|
+
e.double && /* @__PURE__ */ h("line", {
|
|
350
|
+
className: "inner",
|
|
351
|
+
x1: i.x1,
|
|
352
|
+
y1: i.y1,
|
|
353
|
+
x2: i.x2,
|
|
354
|
+
y2: i.y2,
|
|
355
|
+
markerEnd: o
|
|
356
|
+
}),
|
|
357
|
+
/* @__PURE__ */ h("line", {
|
|
358
|
+
className: "hit",
|
|
359
|
+
x1: n.x,
|
|
360
|
+
y1: n.y,
|
|
361
|
+
x2: r.x,
|
|
362
|
+
y2: r.y
|
|
363
|
+
})
|
|
364
|
+
] }), e.title && /* @__PURE__ */ h("title", { children: e.title })]
|
|
365
|
+
}, `${e.source}\u0000${e.target}\u0000${t}`);
|
|
366
|
+
}),
|
|
367
|
+
K.map((e) => {
|
|
368
|
+
let t = i?.kind === "node" && i.id === e.id, n = [
|
|
369
|
+
"g-n",
|
|
370
|
+
`g-c${e.group ?? 1}`,
|
|
371
|
+
e.hideLabel && "small",
|
|
372
|
+
e.dashed && "dashed",
|
|
373
|
+
e.muted && "muted",
|
|
374
|
+
X.has(e.id) && "hl",
|
|
375
|
+
t && "pin",
|
|
376
|
+
J === e.id && "focus"
|
|
377
|
+
].filter(Boolean).join(" ");
|
|
378
|
+
return /* @__PURE__ */ g("g", {
|
|
379
|
+
className: n,
|
|
380
|
+
tabIndex: 0,
|
|
381
|
+
role: "button",
|
|
382
|
+
"aria-pressed": t,
|
|
383
|
+
"aria-label": u ? u(e) : e.label,
|
|
384
|
+
onMouseEnter: () => T(e.id),
|
|
385
|
+
onMouseLeave: () => T(null),
|
|
386
|
+
onFocus: () => T(e.id),
|
|
387
|
+
onBlur: () => T(null),
|
|
388
|
+
onPointerDown: p ? (t) => {
|
|
389
|
+
t.button === 0 && (k.current = {
|
|
390
|
+
id: e.id,
|
|
391
|
+
x: t.clientX,
|
|
392
|
+
y: t.clientY,
|
|
393
|
+
moved: !1
|
|
394
|
+
}, t.currentTarget.setPointerCapture(t.pointerId));
|
|
395
|
+
} : void 0,
|
|
396
|
+
onPointerMove: p ? (t) => {
|
|
397
|
+
let n = k.current;
|
|
398
|
+
if (!n || n.id !== e.id || !n.moved && Math.hypot(t.clientX - n.x, t.clientY - n.y) < 4) return;
|
|
399
|
+
let r = j.current ? $(j.current) / E.k : 1, i = (t.clientX - n.x) * r, a = (t.clientY - n.y) * r;
|
|
400
|
+
k.current = {
|
|
401
|
+
id: e.id,
|
|
402
|
+
x: t.clientX,
|
|
403
|
+
y: t.clientY,
|
|
404
|
+
moved: !0
|
|
405
|
+
}, W((t) => {
|
|
406
|
+
let n = new Map(t?.of === R ? t.at : []), r = n.get(e.id) ?? {
|
|
407
|
+
x: e.x ?? 0,
|
|
408
|
+
y: e.y ?? 0
|
|
409
|
+
};
|
|
410
|
+
return n.set(e.id, {
|
|
411
|
+
x: r.x + i,
|
|
412
|
+
y: r.y + a
|
|
413
|
+
}), {
|
|
414
|
+
of: R,
|
|
415
|
+
at: n
|
|
416
|
+
};
|
|
417
|
+
});
|
|
418
|
+
} : void 0,
|
|
419
|
+
onPointerUp: p ? (e) => {
|
|
420
|
+
k.current?.moved && (A.current = e.timeStamp, setTimeout(() => {
|
|
421
|
+
k.current = null;
|
|
422
|
+
}, 0));
|
|
423
|
+
} : void 0,
|
|
424
|
+
onPointerCancel: p ? () => {
|
|
425
|
+
k.current = null;
|
|
426
|
+
} : void 0,
|
|
427
|
+
onClick: () => {
|
|
428
|
+
let n = k.current?.moved;
|
|
429
|
+
k.current = null, n || Q(e.id, t);
|
|
430
|
+
},
|
|
431
|
+
onDoubleClick: (t) => {
|
|
432
|
+
t.timeStamp - A.current > 600 && c?.(e.id);
|
|
433
|
+
},
|
|
434
|
+
onKeyDown: (n) => {
|
|
435
|
+
n.key === "Enter" && c ? (n.preventDefault(), c(e.id)) : (n.key === "Enter" || n.key === " ") && (n.preventDefault(), Q(e.id, t));
|
|
436
|
+
},
|
|
437
|
+
children: [
|
|
438
|
+
/* @__PURE__ */ h("circle", {
|
|
439
|
+
cx: e.x,
|
|
440
|
+
cy: e.y,
|
|
441
|
+
r: e.r
|
|
442
|
+
}),
|
|
443
|
+
/* @__PURE__ */ h("text", {
|
|
444
|
+
x: e.x,
|
|
445
|
+
y: (e.y ?? 0) + e.r + 14,
|
|
446
|
+
children: e.label
|
|
447
|
+
}),
|
|
448
|
+
e.title && /* @__PURE__ */ h("title", { children: e.title })
|
|
449
|
+
]
|
|
450
|
+
}, e.id);
|
|
451
|
+
})
|
|
452
|
+
]
|
|
308
453
|
})]
|
|
309
454
|
}),
|
|
310
|
-
|
|
455
|
+
l && l.length > 0 && /* @__PURE__ */ h("div", {
|
|
311
456
|
className: "gleg",
|
|
312
|
-
children:
|
|
457
|
+
children: l.map((e) => /* @__PURE__ */ g("span", { children: [/* @__PURE__ */ h("i", { className: `g-c${e.group}` }), e.label] }, e.group))
|
|
313
458
|
}),
|
|
314
|
-
/* @__PURE__ */
|
|
459
|
+
/* @__PURE__ */ g("div", {
|
|
315
460
|
className: "gzoom",
|
|
316
|
-
children: [
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
461
|
+
children: [
|
|
462
|
+
/* @__PURE__ */ h("button", {
|
|
463
|
+
type: "button",
|
|
464
|
+
onClick: () => Z(1.3),
|
|
465
|
+
"aria-label": _("graph.zoomIn"),
|
|
466
|
+
children: "+"
|
|
467
|
+
}),
|
|
468
|
+
/* @__PURE__ */ h("button", {
|
|
469
|
+
type: "button",
|
|
470
|
+
onClick: () => Z(1 / 1.3),
|
|
471
|
+
"aria-label": _("graph.zoomOut"),
|
|
472
|
+
children: "−"
|
|
473
|
+
}),
|
|
474
|
+
G && G.size > 0 && /* @__PURE__ */ h("button", {
|
|
475
|
+
type: "button",
|
|
476
|
+
onClick: () => W(null),
|
|
477
|
+
"aria-label": _("graph.resetLayout"),
|
|
478
|
+
title: _("graph.resetLayout"),
|
|
479
|
+
children: /* @__PURE__ */ h(r, {
|
|
480
|
+
name: "reset",
|
|
481
|
+
size: 14
|
|
482
|
+
})
|
|
483
|
+
})
|
|
484
|
+
]
|
|
327
485
|
})
|
|
328
486
|
]
|
|
329
487
|
});
|
|
330
488
|
}
|
|
331
489
|
//#endregion
|
|
332
|
-
export { u as Avatar,
|
|
490
|
+
export { u as Avatar, O as Button, o as Empty, n as GitHubIcon, U as Graph, r as Icon, k as IconButton, c as Loading, d as Markdown, A as Menu, i as Modal, e as Switch, a as Tabs, s as ToastProvider, j as TopBar, p as UIKIT_NS, I as neighbours, l as useOutside, t as useToast };
|
|
333
491
|
|
|
334
492
|
//# sourceMappingURL=index.js.map
|