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