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