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