@lincyaw/aegis-ui 0.13.0 → 0.14.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/ui/CommitGraph.cjs +1 -1
- package/dist/components/ui/CommitGraph.cjs.map +1 -1
- package/dist/components/ui/CommitGraph.d.ts +23 -5
- package/dist/components/ui/CommitGraph.js +236 -200
- package/dist/components/ui/CommitGraph.js.map +1 -1
- package/dist/components/ui/DetailBeside.cjs +1 -1
- package/dist/components/ui/DetailBeside.cjs.map +1 -1
- package/dist/components/ui/DetailBeside.d.ts +31 -9
- package/dist/components/ui/DetailBeside.js +75 -71
- package/dist/components/ui/DetailBeside.js.map +1 -1
- package/dist/components/ui/ServiceMap.cjs +1 -1
- package/dist/components/ui/ServiceMap.cjs.map +1 -1
- package/dist/components/ui/ServiceMap.js +230 -222
- package/dist/components/ui/ServiceMap.js.map +1 -1
- package/dist/components/ui/TraceTree.cjs.map +1 -1
- package/dist/components/ui/TraceTree.d.ts +2 -1
- package/dist/components/ui/TraceTree.js.map +1 -1
- package/dist/components/ui/index.d.ts +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
import { jsx as u, jsxs as H, Fragment as
|
|
2
|
-
import { useId as
|
|
3
|
-
import { graphlib as
|
|
4
|
-
import { ReactFlowProvider as
|
|
5
|
-
import { useIsomorphicLayoutEffect as
|
|
6
|
-
import { useMediaQuery as
|
|
1
|
+
import { jsx as u, jsxs as H, Fragment as me } from "react/jsx-runtime";
|
|
2
|
+
import { useId as ne, useState as Y, useMemo as D, useCallback as z, useContext as fe, useEffect as he } from "react";
|
|
3
|
+
import { graphlib as ve, layout as be } from "@dagrejs/dagre";
|
|
4
|
+
import { ReactFlowProvider as _e, Position as A, useReactFlow as Q, ReactFlow as we, Background as ye, BackgroundVariant as xe, Controls as Se, MiniMap as Ne, useStoreApi as Me, useStore as X, getViewportForBounds as te, Handle as oe, useInternalNode as Ee } from "@xyflow/react";
|
|
5
|
+
import { useIsomorphicLayoutEffect as J } from "../../hooks/useIsomorphicLayoutEffect.js";
|
|
6
|
+
import { useMediaQuery as Re } from "../../hooks/useMediaQuery.js";
|
|
7
7
|
/* empty css */
|
|
8
|
-
import { StatusDot as
|
|
9
|
-
import { SelectedRowDetailContext as
|
|
10
|
-
import { useStrings as
|
|
11
|
-
const
|
|
12
|
-
"--aegis-service-map-node-w": `${String(
|
|
13
|
-
"--aegis-service-map-node-h": `${String(
|
|
14
|
-
"--aegis-service-map-node-max-w": `${String(
|
|
15
|
-
"--aegis-service-map-group-label-h": `${String(
|
|
16
|
-
},
|
|
17
|
-
function
|
|
18
|
-
const
|
|
8
|
+
import { StatusDot as Oe } from "./StatusDot.js";
|
|
9
|
+
import { SelectedRowDetailContext as Le } from "./selectedRowDetail.js";
|
|
10
|
+
import { useStrings as Te } from "../../locale/useStrings.js";
|
|
11
|
+
const q = 180, ee = 64, $e = 320, ae = 28, De = 64, Ae = {
|
|
12
|
+
"--aegis-service-map-node-w": `${String(q)}px`,
|
|
13
|
+
"--aegis-service-map-node-h": `${String(ee)}px`,
|
|
14
|
+
"--aegis-service-map-node-max-w": `${String($e)}px`,
|
|
15
|
+
"--aegis-service-map-group-label-h": `${String(ae)}px`
|
|
16
|
+
}, He = { width: q, height: ee };
|
|
17
|
+
function Ie(e, n, i, a) {
|
|
18
|
+
const r = e.map((o) => o.id), p = new Set(r);
|
|
19
19
|
return {
|
|
20
|
-
direction:
|
|
21
|
-
ids:
|
|
22
|
-
links:
|
|
23
|
-
groups:
|
|
20
|
+
direction: a,
|
|
21
|
+
ids: r,
|
|
22
|
+
links: n.filter((o) => p.has(o.source) && p.has(o.target)).map((o) => [o.source, o.target]),
|
|
23
|
+
groups: i
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const
|
|
26
|
+
function Pe(e, n) {
|
|
27
|
+
const i = new Set(e), a = /* @__PURE__ */ new Set(), r = n.map((o) => {
|
|
28
28
|
const l = [...new Set(o.nodeIds)].filter(
|
|
29
|
-
(s) =>
|
|
29
|
+
(s) => i.has(s) && !a.has(s)
|
|
30
30
|
);
|
|
31
|
-
return l.forEach((s) =>
|
|
32
|
-
}), p =
|
|
33
|
-
return [...
|
|
31
|
+
return l.forEach((s) => a.add(s)), { group: o, ids: l };
|
|
32
|
+
}), p = e.filter((o) => !a.has(o));
|
|
33
|
+
return [...r, { ids: p }].filter((o) => o.ids.length > 0);
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
rankdir:
|
|
35
|
+
function Fe(e, n, i, a) {
|
|
36
|
+
const r = new ve.Graph();
|
|
37
|
+
r.setDefaultEdgeLabel(() => ({})), r.setGraph({
|
|
38
|
+
rankdir: i,
|
|
39
39
|
nodesep: 40,
|
|
40
40
|
ranksep: 80,
|
|
41
41
|
marginx: 16,
|
|
42
42
|
marginy: 16
|
|
43
43
|
});
|
|
44
|
-
for (const s of
|
|
45
|
-
|
|
46
|
-
for (const [s,
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
for (const s of e)
|
|
45
|
+
r.setNode(s, { ...a(s) });
|
|
46
|
+
for (const [s, t] of n)
|
|
47
|
+
r.hasNode(s) && r.hasNode(t) && r.setEdge(s, t);
|
|
48
|
+
be(r);
|
|
49
49
|
const p = new Map(
|
|
50
|
-
|
|
51
|
-
const { x:
|
|
52
|
-
return [s, { x:
|
|
50
|
+
e.map((s) => {
|
|
51
|
+
const { x: t = 0, y: d = 0 } = r.node(s), m = a(s);
|
|
52
|
+
return [s, { x: t - m.width / 2, y: d - m.height / 2 }];
|
|
53
53
|
})
|
|
54
|
-
), { width: o = 0, height: l = 0 } =
|
|
54
|
+
), { width: o = 0, height: l = 0 } = r.graph();
|
|
55
55
|
return { positions: p, width: o, height: l };
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
const
|
|
59
|
-
const
|
|
57
|
+
function ze(e, n, i) {
|
|
58
|
+
const a = (t) => `${i}-group-${String(e.groups.indexOf(t))}`, r = e.direction === "LR", p = Pe(e.ids, e.groups).map((t) => {
|
|
59
|
+
const d = Fe(t.ids, e.links, e.direction, (f) => n.get(f) ?? He), m = t.group === void 0 ? 0 : ae;
|
|
60
60
|
return {
|
|
61
|
-
...
|
|
62
|
-
...
|
|
61
|
+
...t,
|
|
62
|
+
...d,
|
|
63
63
|
labelHeight: m,
|
|
64
|
-
boxHeight:
|
|
64
|
+
boxHeight: d.height + m
|
|
65
65
|
};
|
|
66
66
|
}), o = Math.max(
|
|
67
67
|
0,
|
|
68
|
-
...p.map((
|
|
68
|
+
...p.map((t) => r ? t.boxHeight : t.width)
|
|
69
69
|
);
|
|
70
70
|
let l = 0;
|
|
71
|
-
const s = p.map((
|
|
72
|
-
const
|
|
73
|
-
return l += (
|
|
71
|
+
const s = p.map((t) => {
|
|
72
|
+
const d = r ? { x: l, y: (o - t.boxHeight) / 2 } : { x: (o - t.width) / 2, y: l };
|
|
73
|
+
return l += (r ? t.width : t.boxHeight) + De, { ...t, origin: d };
|
|
74
74
|
});
|
|
75
75
|
return {
|
|
76
76
|
groups: s.flatMap(
|
|
77
|
-
(
|
|
77
|
+
(t) => t.group === void 0 ? [] : [
|
|
78
78
|
{
|
|
79
79
|
// Prefixed, so a group may share an id with a node.
|
|
80
|
-
id: `group:${
|
|
80
|
+
id: `group:${t.group.id}`,
|
|
81
81
|
type: "serviceGroup",
|
|
82
|
-
position:
|
|
83
|
-
width:
|
|
84
|
-
height:
|
|
82
|
+
position: t.origin,
|
|
83
|
+
width: t.width,
|
|
84
|
+
height: t.boxHeight,
|
|
85
85
|
data: {
|
|
86
|
-
label:
|
|
87
|
-
labelId:
|
|
86
|
+
label: t.group.label,
|
|
87
|
+
labelId: a(t.group)
|
|
88
88
|
},
|
|
89
89
|
// Not a group for assistive technology: the box contains no
|
|
90
90
|
// nodes in the DOM, so its label is plain text, which its
|
|
@@ -108,50 +108,50 @@ function Pe(t, i, r) {
|
|
|
108
108
|
),
|
|
109
109
|
positions: new Map(
|
|
110
110
|
s.flatMap(
|
|
111
|
-
(
|
|
112
|
-
|
|
111
|
+
(t) => [...t.positions].map(([d, m]) => [
|
|
112
|
+
d,
|
|
113
113
|
{
|
|
114
|
-
x:
|
|
115
|
-
y:
|
|
114
|
+
x: t.origin.x + m.x,
|
|
115
|
+
y: t.origin.y + t.labelHeight + m.y
|
|
116
116
|
}
|
|
117
117
|
])
|
|
118
118
|
)
|
|
119
119
|
),
|
|
120
120
|
groupLabels: new Map(
|
|
121
|
-
s.flatMap((
|
|
122
|
-
const { group:
|
|
123
|
-
return
|
|
121
|
+
s.flatMap((t) => {
|
|
122
|
+
const { group: d } = t;
|
|
123
|
+
return d === void 0 ? [] : t.ids.map((m) => [m, a(d)]);
|
|
124
124
|
})
|
|
125
125
|
)
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
data:
|
|
128
|
+
function Be({
|
|
129
|
+
data: e
|
|
130
130
|
}) {
|
|
131
|
-
return /* @__PURE__ */ u("div", { className: "aegis-service-map__group", children: /* @__PURE__ */ u("span", { id:
|
|
131
|
+
return /* @__PURE__ */ u("div", { className: "aegis-service-map__group", children: /* @__PURE__ */ u("span", { id: e.labelId, className: "aegis-service-map__group-label", children: e.label }) });
|
|
132
132
|
}
|
|
133
|
-
const
|
|
133
|
+
const Ge = {
|
|
134
134
|
ok: "ink",
|
|
135
135
|
active: "ink",
|
|
136
136
|
warn: "caution",
|
|
137
137
|
error: "warning",
|
|
138
138
|
muted: "muted"
|
|
139
139
|
};
|
|
140
|
-
function
|
|
141
|
-
data:
|
|
140
|
+
function ke({
|
|
141
|
+
data: e
|
|
142
142
|
}) {
|
|
143
|
-
const { node:
|
|
143
|
+
const { node: n, selected: i } = e, a = n.status ?? "ok", r = Ge[a];
|
|
144
144
|
return /* @__PURE__ */ H(
|
|
145
145
|
"div",
|
|
146
146
|
{
|
|
147
147
|
className: [
|
|
148
148
|
"aegis-service-map__node",
|
|
149
|
-
`aegis-service-map__node--${
|
|
150
|
-
|
|
149
|
+
`aegis-service-map__node--${a}`,
|
|
150
|
+
i ? "aegis-service-map__node--selected" : ""
|
|
151
151
|
].filter(Boolean).join(" "),
|
|
152
152
|
children: [
|
|
153
153
|
/* @__PURE__ */ u(
|
|
154
|
-
|
|
154
|
+
oe,
|
|
155
155
|
{
|
|
156
156
|
type: "target",
|
|
157
157
|
position: A.Left,
|
|
@@ -161,25 +161,25 @@ function Be({
|
|
|
161
161
|
/* @__PURE__ */ H("div", { className: "aegis-service-map__node-body", children: [
|
|
162
162
|
/* @__PURE__ */ H("div", { className: "aegis-service-map__node-label", children: [
|
|
163
163
|
/* @__PURE__ */ u(
|
|
164
|
-
|
|
164
|
+
Oe,
|
|
165
165
|
{
|
|
166
|
-
pulse:
|
|
167
|
-
tone:
|
|
166
|
+
pulse: a === "active",
|
|
167
|
+
tone: i && r === "ink" ? "inverted" : r
|
|
168
168
|
}
|
|
169
169
|
),
|
|
170
|
-
/* @__PURE__ */ u("span", { className: "aegis-service-map__node-label-text", children:
|
|
170
|
+
/* @__PURE__ */ u("span", { className: "aegis-service-map__node-label-text", children: n.label })
|
|
171
171
|
] }),
|
|
172
|
-
|
|
172
|
+
n.sublabel !== void 0 && /* @__PURE__ */ u("div", { className: "aegis-service-map__node-sublabel", children: n.sublabel })
|
|
173
173
|
] }),
|
|
174
|
-
|
|
174
|
+
n.badge !== void 0 && n.badge !== "" && /* @__PURE__ */ u(
|
|
175
175
|
"span",
|
|
176
176
|
{
|
|
177
|
-
className: `aegis-service-map__node-badge aegis-service-map__node-badge--${
|
|
178
|
-
children:
|
|
177
|
+
className: `aegis-service-map__node-badge aegis-service-map__node-badge--${a}`,
|
|
178
|
+
children: n.badge
|
|
179
179
|
}
|
|
180
180
|
),
|
|
181
181
|
/* @__PURE__ */ u(
|
|
182
|
-
|
|
182
|
+
oe,
|
|
183
183
|
{
|
|
184
184
|
type: "source",
|
|
185
185
|
position: A.Right,
|
|
@@ -190,15 +190,15 @@ function Be({
|
|
|
190
190
|
}
|
|
191
191
|
);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
const { sourceX:
|
|
195
|
-
return /* @__PURE__ */ H(
|
|
196
|
-
/* @__PURE__ */ u("path", { d
|
|
193
|
+
function Ce(e) {
|
|
194
|
+
const { sourceX: n, sourceY: i, targetX: a, targetY: r, label: p, markerEnd: o, style: l } = e, s = ne(), t = (n + a) / 2, d = `M${n},${i} C${t},${i} ${t},${r} ${a},${r}`;
|
|
195
|
+
return /* @__PURE__ */ H(me, { children: [
|
|
196
|
+
/* @__PURE__ */ u("path", { d, className: "aegis-service-map__edge-focus", fill: "none" }),
|
|
197
197
|
/* @__PURE__ */ u(
|
|
198
198
|
"path",
|
|
199
199
|
{
|
|
200
200
|
id: s,
|
|
201
|
-
d
|
|
201
|
+
d,
|
|
202
202
|
className: "aegis-service-map__edge-path",
|
|
203
203
|
markerEnd: o,
|
|
204
204
|
style: l,
|
|
@@ -208,51 +208,51 @@ function Ge(t) {
|
|
|
208
208
|
p !== void 0 && p !== "" && /* @__PURE__ */ u("text", { className: "aegis-service-map__edge-label", children: /* @__PURE__ */ u("textPath", { href: `#${s}`, startOffset: "50%", textAnchor: "middle", children: p }) })
|
|
209
209
|
] });
|
|
210
210
|
}
|
|
211
|
-
const
|
|
212
|
-
function
|
|
211
|
+
const Ze = { service: ke, serviceGroup: Be }, Ve = { service: Ce }, je = "(max-width: 768px)", E = 24, K = 0.1, Z = 1, ie = 11 / 13, W = 15, se = 28, re = 200, V = (e) => `${e}px`;
|
|
212
|
+
function Ue(e, n) {
|
|
213
213
|
return [
|
|
214
214
|
.../* @__PURE__ */ new Set([
|
|
215
|
-
|
|
216
|
-
...
|
|
217
|
-
...
|
|
215
|
+
e,
|
|
216
|
+
...n.filter(([i]) => i === e).map(([, i]) => i),
|
|
217
|
+
...n.filter(([, i]) => i === e).map(([i]) => i)
|
|
218
218
|
])
|
|
219
219
|
];
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
return
|
|
221
|
+
function We(e) {
|
|
222
|
+
return e.type === "serviceGroup" ? "aegis-service-map__minimap-group" : "";
|
|
223
223
|
}
|
|
224
|
-
function
|
|
225
|
-
const { fitView: o, getNodes: l, getNodesBounds: s, setViewport:
|
|
226
|
-
() =>
|
|
227
|
-
[
|
|
228
|
-
), [x, I] =
|
|
229
|
-
return
|
|
230
|
-
if (m &&
|
|
224
|
+
function Ye(e, n, i, a, r, p) {
|
|
225
|
+
const { fitView: o, getNodes: l, getNodesBounds: s, setViewport: t } = Q(), d = Me(), m = X((b) => b.width > 0 && b.height > 0), f = D(
|
|
226
|
+
() => a !== void 0 && e.ids.includes(a) ? { id: a, near: Ue(a, e.links) } : void 0,
|
|
227
|
+
[a, e]
|
|
228
|
+
), [x, I] = Y();
|
|
229
|
+
return he(() => {
|
|
230
|
+
if (m && i) {
|
|
231
231
|
const b = () => {
|
|
232
232
|
I(f?.id ?? null);
|
|
233
233
|
}, _ = {
|
|
234
|
-
top:
|
|
235
|
-
bottom:
|
|
236
|
-
left:
|
|
237
|
-
right:
|
|
238
|
-
|
|
234
|
+
top: V(E),
|
|
235
|
+
bottom: V(E),
|
|
236
|
+
left: V(W + se + E),
|
|
237
|
+
right: V(
|
|
238
|
+
r ? W + re + E : E
|
|
239
239
|
)
|
|
240
|
-
}, { width: S, height: y } =
|
|
240
|
+
}, { width: S, height: y } = d.getState();
|
|
241
241
|
if (f === void 0) {
|
|
242
|
-
const R = l(), N = s(R), O =
|
|
242
|
+
const R = l(), N = s(R), O = te(
|
|
243
243
|
N,
|
|
244
244
|
S,
|
|
245
245
|
y,
|
|
246
|
-
|
|
246
|
+
K,
|
|
247
247
|
1,
|
|
248
248
|
_
|
|
249
249
|
);
|
|
250
|
-
if (p && O.zoom <
|
|
251
|
-
const v =
|
|
252
|
-
|
|
250
|
+
if (p && O.zoom < ie) {
|
|
251
|
+
const v = ie, L = e.direction === "LR", B = (w) => L ? w.position.x : w.position.y, P = R.filter((w) => w.type === "service").reduce((w, F) => B(F) < B(w) ? F : w), { width: G = q, height: j = ee } = P.measured ?? {};
|
|
252
|
+
t(
|
|
253
253
|
L ? {
|
|
254
|
-
x:
|
|
255
|
-
y: y / 2 - (P.position.y +
|
|
254
|
+
x: W + se + E - N.x * v,
|
|
255
|
+
y: y / 2 - (P.position.y + j / 2) * v,
|
|
256
256
|
zoom: v
|
|
257
257
|
} : {
|
|
258
258
|
x: S / 2 - (P.position.x + G / 2) * v,
|
|
@@ -263,137 +263,138 @@ function Ue(t, i, r, n, a, p) {
|
|
|
263
263
|
} else
|
|
264
264
|
o({ maxZoom: 1, padding: _ }).then(b);
|
|
265
265
|
} else {
|
|
266
|
-
const R =
|
|
266
|
+
const R = te(
|
|
267
267
|
s(f.near),
|
|
268
268
|
S,
|
|
269
269
|
y,
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
K,
|
|
271
|
+
Z,
|
|
272
272
|
_
|
|
273
|
-
).zoom >=
|
|
273
|
+
).zoom >= Z;
|
|
274
274
|
o({
|
|
275
275
|
nodes: (R ? f.near : [f.id]).map((N) => ({ id: N })),
|
|
276
|
-
minZoom:
|
|
277
|
-
maxZoom:
|
|
276
|
+
minZoom: Z,
|
|
277
|
+
maxZoom: Z,
|
|
278
278
|
padding: _
|
|
279
279
|
}).then(b);
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
}, [
|
|
283
283
|
m,
|
|
284
|
-
r,
|
|
285
284
|
i,
|
|
285
|
+
n,
|
|
286
286
|
f,
|
|
287
|
-
|
|
287
|
+
r,
|
|
288
288
|
p,
|
|
289
|
-
|
|
290
|
-
|
|
289
|
+
e.direction,
|
|
290
|
+
d,
|
|
291
291
|
o,
|
|
292
292
|
l,
|
|
293
293
|
s,
|
|
294
|
-
|
|
294
|
+
t
|
|
295
295
|
]), x === (f?.id ?? null);
|
|
296
296
|
}
|
|
297
|
-
function
|
|
298
|
-
nodeId:
|
|
297
|
+
function Xe({
|
|
298
|
+
nodeId: e,
|
|
299
|
+
fitted: n,
|
|
299
300
|
selection: i
|
|
300
301
|
}) {
|
|
301
|
-
const
|
|
302
|
-
|
|
302
|
+
const a = X((d) => d.transform), r = X((d) => d.domNode), p = Ee(e);
|
|
303
|
+
J(
|
|
303
304
|
() => () => {
|
|
304
305
|
i.placeRow(null);
|
|
305
306
|
},
|
|
306
307
|
[i]
|
|
307
|
-
),
|
|
308
|
-
const
|
|
309
|
-
`.react-flow__node[data-id="${CSS.escape(
|
|
308
|
+
), J(() => {
|
|
309
|
+
const d = r?.querySelector(
|
|
310
|
+
`.react-flow__node[data-id="${CSS.escape(e)}"]`
|
|
310
311
|
);
|
|
311
|
-
|
|
312
|
-
}, [i,
|
|
313
|
-
const
|
|
314
|
-
if (i.inline === null ||
|
|
312
|
+
n && d instanceof HTMLElement && i.placeRow(d);
|
|
313
|
+
}, [i, r, e, a, n]);
|
|
314
|
+
const o = p?.measured.height;
|
|
315
|
+
if (i.inline === null || p === void 0 || o === void 0)
|
|
315
316
|
return null;
|
|
316
|
-
const [,
|
|
317
|
+
const [, l, s] = a, t = (p.internals.positionAbsolute.y + o) * s + l;
|
|
317
318
|
return /* @__PURE__ */ u(
|
|
318
319
|
"div",
|
|
319
320
|
{
|
|
320
321
|
className: "aegis-service-map__detail",
|
|
321
|
-
style: { marginTop: Math.max(
|
|
322
|
+
style: { marginTop: Math.max(t, 0) },
|
|
322
323
|
children: i.inline
|
|
323
324
|
}
|
|
324
325
|
);
|
|
325
326
|
}
|
|
326
|
-
function
|
|
327
|
-
const { getViewport:
|
|
327
|
+
function Je() {
|
|
328
|
+
const { getViewport: e, setViewport: n } = Q();
|
|
328
329
|
return z(
|
|
329
|
-
(
|
|
330
|
-
const
|
|
331
|
-
if (!(
|
|
330
|
+
(i) => {
|
|
331
|
+
const a = i.target;
|
|
332
|
+
if (!(a instanceof Element) || !a.matches(
|
|
332
333
|
".react-flow__node:focus-visible, .react-flow__edge:focus-visible"
|
|
333
334
|
))
|
|
334
335
|
return;
|
|
335
|
-
const { scrollLeft:
|
|
336
|
-
if (s >= 0 &&
|
|
336
|
+
const { scrollLeft: r, scrollTop: p } = i.currentTarget, o = i.currentTarget.getBoundingClientRect(), l = a.getBoundingClientRect(), s = l.left - o.left + r, t = l.top - o.top + p;
|
|
337
|
+
if (s >= 0 && t >= 0 && s + l.width <= o.width && t + l.height <= o.height)
|
|
337
338
|
return;
|
|
338
|
-
const { x:
|
|
339
|
-
|
|
340
|
-
x:
|
|
341
|
-
y: m + o.height / 2 - (
|
|
339
|
+
const { x: d, y: m, zoom: f } = e();
|
|
340
|
+
n({
|
|
341
|
+
x: d + o.width / 2 - (s + l.width / 2),
|
|
342
|
+
y: m + o.height / 2 - (t + l.height / 2),
|
|
342
343
|
zoom: f
|
|
343
344
|
});
|
|
344
345
|
},
|
|
345
|
-
[
|
|
346
|
+
[e, n]
|
|
346
347
|
);
|
|
347
348
|
}
|
|
348
|
-
function
|
|
349
|
-
nodes:
|
|
350
|
-
edges:
|
|
351
|
-
groups:
|
|
352
|
-
direction:
|
|
353
|
-
height:
|
|
349
|
+
function Ke({
|
|
350
|
+
nodes: e,
|
|
351
|
+
edges: n,
|
|
352
|
+
groups: i = [],
|
|
353
|
+
direction: a = "LR",
|
|
354
|
+
height: r,
|
|
354
355
|
fillViewport: p = !1,
|
|
355
356
|
onNodeClick: o,
|
|
356
357
|
onEdgeClick: l,
|
|
357
358
|
selectedNodeId: s,
|
|
358
|
-
focusNodeId:
|
|
359
|
-
minimap:
|
|
359
|
+
focusNodeId: t,
|
|
360
|
+
minimap: d = t === void 0,
|
|
360
361
|
ariaLabel: m,
|
|
361
362
|
className: f
|
|
362
363
|
}) {
|
|
363
|
-
const x =
|
|
364
|
+
const x = Te(), I = ne(), b = `aegis-service-map${I.replace(/:/g, "-")}`, _ = o !== void 0, S = l !== void 0, [y, R] = Y(
|
|
364
365
|
() => /* @__PURE__ */ new Map()
|
|
365
366
|
), N = D(
|
|
366
|
-
() => JSON.stringify(
|
|
367
|
-
[
|
|
367
|
+
() => JSON.stringify(Ie(e, n, i, a)),
|
|
368
|
+
[e, n, i, a]
|
|
368
369
|
), O = D(() => JSON.parse(N), [N]), v = D(
|
|
369
|
-
() =>
|
|
370
|
+
() => ze(O, y, I),
|
|
370
371
|
[O, y, I]
|
|
371
|
-
), L =
|
|
372
|
+
), L = a === "LR", B = D(
|
|
372
373
|
() => [
|
|
373
374
|
...v.groups,
|
|
374
|
-
...
|
|
375
|
+
...e.map((g) => {
|
|
375
376
|
const c = [
|
|
376
|
-
v.groupLabels.get(
|
|
377
|
+
v.groupLabels.get(g.id),
|
|
377
378
|
_ ? `react-flow__node-desc-${b}` : void 0
|
|
378
379
|
].filter(Boolean).join(" ");
|
|
379
380
|
return {
|
|
380
|
-
id:
|
|
381
|
+
id: g.id,
|
|
381
382
|
type: "service",
|
|
382
|
-
position: v.positions.get(
|
|
383
|
+
position: v.positions.get(g.id) ?? { x: 0, y: 0 },
|
|
383
384
|
// Handed back as applyNodeChanges would, so React Flow keeps the
|
|
384
385
|
// size it measured instead of measuring the node again.
|
|
385
|
-
measured: y.get(
|
|
386
|
-
ariaLabel:
|
|
386
|
+
measured: y.get(g.id),
|
|
387
|
+
ariaLabel: g.label,
|
|
387
388
|
// React Flow gives only a focusable node a role, and the role
|
|
388
389
|
// description below needs one.
|
|
389
390
|
ariaRole: "group",
|
|
390
391
|
domAttributes: {
|
|
391
392
|
"aria-roledescription": x.serviceMapNodeRole,
|
|
392
393
|
// A group takes no aria-selected.
|
|
393
|
-
"aria-current": s ===
|
|
394
|
+
"aria-current": s === g.id ? !0 : void 0,
|
|
394
395
|
"aria-describedby": c === "" ? void 0 : c
|
|
395
396
|
},
|
|
396
|
-
data: { node:
|
|
397
|
+
data: { node: g, selected: s === g.id },
|
|
397
398
|
sourcePosition: L ? A.Right : A.Bottom,
|
|
398
399
|
targetPosition: L ? A.Left : A.Top,
|
|
399
400
|
draggable: !1,
|
|
@@ -405,7 +406,7 @@ function Xe({
|
|
|
405
406
|
],
|
|
406
407
|
[
|
|
407
408
|
v,
|
|
408
|
-
|
|
409
|
+
e,
|
|
409
410
|
y,
|
|
410
411
|
s,
|
|
411
412
|
L,
|
|
@@ -414,14 +415,14 @@ function Xe({
|
|
|
414
415
|
x
|
|
415
416
|
]
|
|
416
417
|
), P = D(() => {
|
|
417
|
-
const
|
|
418
|
-
return
|
|
418
|
+
const g = new Map(e.map((c) => [c.id, c.label]));
|
|
419
|
+
return n.map((c) => ({
|
|
419
420
|
id: c.id,
|
|
420
421
|
source: c.source,
|
|
421
422
|
target: c.target,
|
|
422
423
|
ariaLabel: x.serviceMapEdgeName(
|
|
423
|
-
|
|
424
|
-
|
|
424
|
+
g.get(c.source) ?? c.source,
|
|
425
|
+
g.get(c.target) ?? c.target
|
|
425
426
|
),
|
|
426
427
|
// React Flow makes an unfocusable edge an img; aria-roledescription needs a group.
|
|
427
428
|
ariaRole: "group",
|
|
@@ -433,9 +434,9 @@ function Xe({
|
|
|
433
434
|
focusable: S,
|
|
434
435
|
className: `aegis-service-map__edge aegis-service-map__edge--${c.status ?? "ok"}`
|
|
435
436
|
}));
|
|
436
|
-
}, [
|
|
437
|
-
(
|
|
438
|
-
const c =
|
|
437
|
+
}, [e, n, S, x]), { getNode: G } = Q(), j = z(
|
|
438
|
+
(g) => {
|
|
439
|
+
const c = g.flatMap(
|
|
439
440
|
(h) => h.type === "dimensions" && h.dimensions !== void 0 && G(h.id)?.type === "service" ? [[h.id, h.dimensions]] : []
|
|
440
441
|
);
|
|
441
442
|
R(
|
|
@@ -445,50 +446,50 @@ function Xe({
|
|
|
445
446
|
);
|
|
446
447
|
},
|
|
447
448
|
[G]
|
|
448
|
-
), w =
|
|
449
|
+
), w = Re(je), F = d && !w, T = fe(Le), k = Ye(
|
|
449
450
|
O,
|
|
450
451
|
v,
|
|
451
|
-
|
|
452
|
-
|
|
452
|
+
e.every((g) => y.has(g.id)),
|
|
453
|
+
t,
|
|
453
454
|
F,
|
|
454
455
|
w
|
|
455
|
-
),
|
|
456
|
-
|
|
457
|
-
if (!(T === null ||
|
|
456
|
+
), C = s !== void 0 && O.ids.includes(s) ? s : void 0, [U, ce] = Y();
|
|
457
|
+
k && U !== C && ce(C), J(() => {
|
|
458
|
+
if (!(T === null || C === void 0 || k))
|
|
458
459
|
return T.awaitRow(), () => {
|
|
459
460
|
T.placeRow(null);
|
|
460
461
|
};
|
|
461
|
-
}, [T,
|
|
462
|
-
const
|
|
463
|
-
(
|
|
462
|
+
}, [T, C, k]);
|
|
463
|
+
const le = Je(), de = z(
|
|
464
|
+
(g, c) => {
|
|
464
465
|
c.type === "service" && o?.(c.data.node);
|
|
465
466
|
},
|
|
466
467
|
[o]
|
|
467
|
-
),
|
|
468
|
-
(
|
|
468
|
+
), pe = z(
|
|
469
|
+
(g, c) => {
|
|
469
470
|
c.data && l?.(c.data.edge);
|
|
470
471
|
},
|
|
471
472
|
[l]
|
|
472
|
-
),
|
|
473
|
-
(
|
|
474
|
-
if (
|
|
473
|
+
), ge = z(
|
|
474
|
+
(g) => {
|
|
475
|
+
if (g.key !== "Enter" && g.key !== " " || g.repeat)
|
|
475
476
|
return;
|
|
476
|
-
const c =
|
|
477
|
+
const c = g.target;
|
|
477
478
|
if (!(c instanceof Element))
|
|
478
479
|
return;
|
|
479
480
|
const h = c.getAttribute("data-id");
|
|
480
481
|
if (c.classList.contains("react-flow__node")) {
|
|
481
|
-
const M =
|
|
482
|
-
M && o && (
|
|
482
|
+
const M = e.find(($) => $.id === h);
|
|
483
|
+
M && o && (g.preventDefault(), o(M));
|
|
483
484
|
} else if (c.classList.contains("react-flow__edge")) {
|
|
484
|
-
const M =
|
|
485
|
-
M && l && (
|
|
485
|
+
const M = n.find(($) => $.id === h);
|
|
486
|
+
M && l && (g.preventDefault(), l(M));
|
|
486
487
|
}
|
|
487
488
|
},
|
|
488
|
-
[
|
|
489
|
-
),
|
|
490
|
-
|
|
491
|
-
height:
|
|
489
|
+
[e, n, o, l]
|
|
490
|
+
), ue = {
|
|
491
|
+
...Ae,
|
|
492
|
+
height: r === void 0 ? void 0 : `${String(r)}px`
|
|
492
493
|
};
|
|
493
494
|
return /* @__PURE__ */ H(
|
|
494
495
|
"div",
|
|
@@ -498,18 +499,18 @@ function Xe({
|
|
|
498
499
|
p ? "aegis-service-map--fill-viewport" : "",
|
|
499
500
|
f
|
|
500
501
|
].filter(Boolean).join(" "),
|
|
501
|
-
style:
|
|
502
|
+
style: ue,
|
|
502
503
|
children: [
|
|
503
504
|
/* @__PURE__ */ u("div", { className: "aegis-service-map__pane", children: /* @__PURE__ */ H(
|
|
504
|
-
|
|
505
|
+
we,
|
|
505
506
|
{
|
|
506
507
|
id: b,
|
|
507
508
|
"aria-label": m,
|
|
508
509
|
nodes: B,
|
|
509
510
|
edges: P,
|
|
510
|
-
nodeTypes:
|
|
511
|
-
edgeTypes:
|
|
512
|
-
minZoom:
|
|
511
|
+
nodeTypes: Ze,
|
|
512
|
+
edgeTypes: Ve,
|
|
513
|
+
minZoom: K,
|
|
513
514
|
nodesDraggable: !1,
|
|
514
515
|
nodesConnectable: !1,
|
|
515
516
|
autoPanOnNodeFocus: !1,
|
|
@@ -517,36 +518,43 @@ function Xe({
|
|
|
517
518
|
zoomOnScroll: !0,
|
|
518
519
|
proOptions: { hideAttribution: !0 },
|
|
519
520
|
ariaLabelConfig: x.serviceMapAriaLabels,
|
|
520
|
-
onNodesChange:
|
|
521
|
-
onNodeClick: _ ?
|
|
522
|
-
onEdgeClick: S ?
|
|
523
|
-
onKeyDown:
|
|
524
|
-
onFocus:
|
|
521
|
+
onNodesChange: j,
|
|
522
|
+
onNodeClick: _ ? de : void 0,
|
|
523
|
+
onEdgeClick: S ? pe : void 0,
|
|
524
|
+
onKeyDown: ge,
|
|
525
|
+
onFocus: le,
|
|
525
526
|
children: [
|
|
526
|
-
/* @__PURE__ */ u(
|
|
527
|
-
/* @__PURE__ */ u(
|
|
527
|
+
/* @__PURE__ */ u(ye, { variant: xe.Dots, gap: 16, size: 1 }),
|
|
528
|
+
/* @__PURE__ */ u(Se, { showInteractive: !1, position: "top-left" }),
|
|
528
529
|
F && /* @__PURE__ */ u(
|
|
529
|
-
|
|
530
|
+
Ne,
|
|
530
531
|
{
|
|
531
532
|
pannable: !0,
|
|
532
533
|
zoomable: !0,
|
|
533
534
|
position: "bottom-right",
|
|
534
|
-
style: { width:
|
|
535
|
-
nodeClassName:
|
|
535
|
+
style: { width: re },
|
|
536
|
+
nodeClassName: We
|
|
536
537
|
}
|
|
537
538
|
)
|
|
538
539
|
]
|
|
539
540
|
}
|
|
540
541
|
) }),
|
|
541
|
-
T !== null &&
|
|
542
|
+
T !== null && U !== void 0 && /* @__PURE__ */ u(
|
|
543
|
+
Xe,
|
|
544
|
+
{
|
|
545
|
+
nodeId: U,
|
|
546
|
+
fitted: k,
|
|
547
|
+
selection: T
|
|
548
|
+
}
|
|
549
|
+
)
|
|
542
550
|
]
|
|
543
551
|
}
|
|
544
552
|
);
|
|
545
553
|
}
|
|
546
|
-
function
|
|
547
|
-
return /* @__PURE__ */ u(
|
|
554
|
+
function ct(e) {
|
|
555
|
+
return /* @__PURE__ */ u(_e, { children: /* @__PURE__ */ u(Ke, { ...e }) });
|
|
548
556
|
}
|
|
549
557
|
export {
|
|
550
|
-
|
|
558
|
+
ct as ServiceMap
|
|
551
559
|
};
|
|
552
560
|
//# sourceMappingURL=ServiceMap.js.map
|