@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.
Files changed (44) hide show
  1. package/dist/components/ui/CommitGraph.cjs +1 -1
  2. package/dist/components/ui/CommitGraph.cjs.map +1 -1
  3. package/dist/components/ui/CommitGraph.d.ts +23 -5
  4. package/dist/components/ui/CommitGraph.js +236 -200
  5. package/dist/components/ui/CommitGraph.js.map +1 -1
  6. package/dist/components/ui/DetailBeside.cjs +1 -1
  7. package/dist/components/ui/DetailBeside.cjs.map +1 -1
  8. package/dist/components/ui/DetailBeside.d.ts +31 -9
  9. package/dist/components/ui/DetailBeside.js +75 -71
  10. package/dist/components/ui/DetailBeside.js.map +1 -1
  11. package/dist/components/ui/RegionMap.cjs +2 -0
  12. package/dist/components/ui/RegionMap.cjs.map +1 -0
  13. package/dist/components/ui/RegionMap.d.ts +53 -0
  14. package/dist/components/ui/RegionMap.js +173 -0
  15. package/dist/components/ui/RegionMap.js.map +1 -0
  16. package/dist/components/ui/RollingValue.cjs.map +1 -1
  17. package/dist/components/ui/RollingValue.d.ts +1 -2
  18. package/dist/components/ui/RollingValue.js.map +1 -1
  19. package/dist/components/ui/ServiceMap.cjs +1 -1
  20. package/dist/components/ui/ServiceMap.cjs.map +1 -1
  21. package/dist/components/ui/ServiceMap.d.ts +2 -1
  22. package/dist/components/ui/ServiceMap.js +233 -237
  23. package/dist/components/ui/ServiceMap.js.map +1 -1
  24. package/dist/components/ui/Timeline.cjs +1 -1
  25. package/dist/components/ui/Timeline.cjs.map +1 -1
  26. package/dist/components/ui/Timeline.d.ts +16 -1
  27. package/dist/components/ui/Timeline.js +115 -45
  28. package/dist/components/ui/Timeline.js.map +1 -1
  29. package/dist/components/ui/TraceTree.cjs +1 -1
  30. package/dist/components/ui/TraceTree.cjs.map +1 -1
  31. package/dist/components/ui/TraceTree.d.ts +8 -1
  32. package/dist/components/ui/TraceTree.js +198 -175
  33. package/dist/components/ui/TraceTree.js.map +1 -1
  34. package/dist/components/ui/index.d.ts +5 -1
  35. package/dist/components/ui/workStatus.cjs +2 -0
  36. package/dist/components/ui/workStatus.cjs.map +1 -0
  37. package/dist/components/ui/workStatus.d.ts +15 -0
  38. package/dist/components/ui/workStatus.js +18 -0
  39. package/dist/components/ui/workStatus.js.map +1 -0
  40. package/dist/index.cjs +1 -1
  41. package/dist/index.js +175 -171
  42. package/dist/index.js.map +1 -1
  43. package/dist/style.css +1 -1
  44. package/package.json +1 -1
@@ -1,90 +1,91 @@
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";
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 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);
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: n,
21
- ids: a,
22
- links: i.filter((o) => p.has(o.source) && p.has(o.target)).map((o) => [o.source, o.target]),
23
- groups: r
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 He(t, i) {
27
- const r = new Set(t), n = /* @__PURE__ */ new Set(), a = i.map((o) => {
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) => r.has(s) && !n.has(s)
30
+ (s) => i.has(s) && !a.has(s)
30
31
  );
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
+ 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 Ie(t, i, r, n) {
36
- const a = new fe.Graph();
37
- a.setDefaultEdgeLabel(() => ({})), a.setGraph({
38
- rankdir: r,
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 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);
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
- 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
+ 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 } = a.graph();
55
+ ), { width: o = 0, height: l = 0 } = r.graph();
55
56
  return { positions: p, width: o, height: l };
56
57
  }
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
+ 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
- ...e,
62
- ...g,
62
+ ...t,
63
+ ...d,
63
64
  labelHeight: m,
64
- boxHeight: g.height + m
65
+ boxHeight: d.height + m
65
66
  };
66
67
  }), o = Math.max(
67
68
  0,
68
- ...p.map((e) => a ? e.boxHeight : e.width)
69
+ ...p.map((t) => r ? t.boxHeight : t.width)
69
70
  );
70
71
  let l = 0;
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
+ 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
- (e) => e.group === void 0 ? [] : [
78
+ (t) => t.group === void 0 ? [] : [
78
79
  {
79
80
  // Prefixed, so a group may share an id with a node.
80
- id: `group:${e.group.id}`,
81
+ id: `group:${t.group.id}`,
81
82
  type: "serviceGroup",
82
- position: e.origin,
83
- width: e.width,
84
- height: e.boxHeight,
83
+ position: t.origin,
84
+ width: t.width,
85
+ height: t.boxHeight,
85
86
  data: {
86
- label: e.group.label,
87
- labelId: n(e.group)
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
- (e) => [...e.positions].map(([g, m]) => [
112
- g,
112
+ (t) => [...t.positions].map(([d, m]) => [
113
+ d,
113
114
  {
114
- x: e.origin.x + m.x,
115
- y: e.origin.y + e.labelHeight + m.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((e) => {
122
- const { group: g } = e;
123
- return g === void 0 ? [] : e.ids.map((m) => [m, n(g)]);
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 Fe({
129
- data: t
129
+ function Ge({
130
+ data: e
130
131
  }) {
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 }) });
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
- const ze = {
134
- ok: "ink",
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: i, selected: r } = t, n = i.status ?? "ok", a = ze[n];
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--${n}`,
150
- r ? "aegis-service-map__node--selected" : ""
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
- ee,
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
- Ee,
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
- i.sublabel !== void 0 && /* @__PURE__ */ u("div", { className: "aegis-service-map__node-sublabel", children: i.sublabel })
160
+ n.sublabel !== void 0 && /* @__PURE__ */ u("div", { className: "aegis-service-map__node-sublabel", children: n.sublabel })
173
161
  ] }),
174
- i.badge !== void 0 && i.badge !== "" && /* @__PURE__ */ u(
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--${n}`,
178
- children: i.badge
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
- ee,
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 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: [
196
- /* @__PURE__ */ u("path", { d: g, className: "aegis-service-map__edge-focus", fill: "none" }),
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: g,
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: 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) {
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
- t,
216
- ...i.filter(([r]) => r === t).map(([, r]) => r),
217
- ...i.filter(([, r]) => r === t).map(([r]) => r)
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 je(t) {
222
- return t.type === "serviceGroup" ? "aegis-service-map__minimap-group" : "";
209
+ function We(e) {
210
+ return e.type === "serviceGroup" ? "aegis-service-map__minimap-group" : "";
223
211
  }
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(() => {
230
- if (m && r) {
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: Z(E),
235
- bottom: Z(E),
236
- left: Z(U + oe + E),
237
- right: Z(
238
- a ? U + ae + E : E
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 } = g.getState();
228
+ }, { width: S, height: y } = d.getState();
241
229
  if (f === void 0) {
242
- const R = l(), N = s(R), O = q(
230
+ const R = l(), N = s(R), O = te(
243
231
  N,
244
232
  S,
245
233
  y,
246
- X,
234
+ K,
247
235
  1,
248
236
  _
249
237
  );
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(
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: U + oe + E - N.x * v,
255
- y: y / 2 - (P.position.y + V / 2) * v,
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 = q(
254
+ const R = te(
267
255
  s(f.near),
268
256
  S,
269
257
  y,
270
- X,
271
- C,
258
+ K,
259
+ k,
272
260
  _
273
- ).zoom >= C;
261
+ ).zoom >= k;
274
262
  o({
275
263
  nodes: (R ? f.near : [f.id]).map((N) => ({ id: N })),
276
- minZoom: C,
277
- maxZoom: C,
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
- a,
275
+ r,
288
276
  p,
289
- t.direction,
290
- g,
277
+ e.direction,
278
+ d,
291
279
  o,
292
280
  l,
293
281
  s,
294
- e
282
+ t
295
283
  ]), x === (f?.id ?? null);
296
284
  }
297
- function We({
298
- nodeId: t,
285
+ function Xe({
286
+ nodeId: e,
287
+ fitted: n,
299
288
  selection: i
300
289
  }) {
301
- const r = W((e) => e.transform), n = W((e) => e.domNode), a = Ne(t);
302
- Y(
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
- ), Y(() => {
308
- const e = n?.querySelector(
309
- `.react-flow__node[data-id="${CSS.escape(t)}"]`
296
+ ), J(() => {
297
+ const d = r?.querySelector(
298
+ `.react-flow__node[data-id="${CSS.escape(e)}"]`
310
299
  );
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)
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 [, o, l] = r, s = (a.internals.positionAbsolute.y + p) * l + o;
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(s, 0) },
310
+ style: { marginTop: Math.max(t, 0) },
322
311
  children: i.inline
323
312
  }
324
313
  );
325
314
  }
326
- function Ye() {
327
- const { getViewport: t, setViewport: i } = J();
315
+ function Je() {
316
+ const { getViewport: e, setViewport: n } = Q();
328
317
  return z(
329
- (r) => {
330
- const n = r.target;
331
- if (!(n instanceof Element) || !n.matches(
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: 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)
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: g, y: m, zoom: f } = t();
339
- i({
340
- x: g + o.width / 2 - (s + l.width / 2),
341
- y: m + o.height / 2 - (e + l.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
- [t, i]
334
+ [e, n]
346
335
  );
347
336
  }
348
- function Xe({
349
- nodes: t,
350
- edges: i,
351
- groups: r = [],
352
- direction: n = "LR",
353
- height: a,
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: e,
359
- minimap: g = e === void 0,
347
+ focusNodeId: t,
348
+ minimap: d = t === void 0,
360
349
  ariaLabel: m,
361
350
  className: f
362
351
  }) {
363
- const x = Oe(), I = ie(), b = `aegis-service-map${I.replace(/:/g, "-")}`, _ = o !== void 0, S = l !== void 0, [y, R] = se(
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 = 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),
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 = n === "LR", B = D(
360
+ ), L = a === "LR", B = T(
372
361
  () => [
373
362
  ...v.groups,
374
- ...t.map((d) => {
363
+ ...e.map((g) => {
375
364
  const c = [
376
- v.groupLabels.get(d.id),
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: d.id,
369
+ id: g.id,
381
370
  type: "service",
382
- position: v.positions.get(d.id) ?? { x: 0, y: 0 },
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(d.id),
386
- ariaLabel: d.label,
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 === d.id ? !0 : void 0,
382
+ "aria-current": s === g.id ? !0 : void 0,
394
383
  "aria-describedby": c === "" ? void 0 : c
395
384
  },
396
- data: { node: d, selected: s === d.id },
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
- t,
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 = D(() => {
417
- const d = new Map(t.map((c) => [c.id, c.label]));
418
- return i.map((c) => ({
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
- d.get(c.source) ?? c.source,
424
- d.get(c.target) ?? c.target
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
- }, [t, i, S, x]), { getNode: G } = J(), V = z(
437
- (d) => {
438
- const c = d.flatMap(
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, $]) => h.get(M)?.width === $.width && h.get(M)?.height === $.height
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 = Me(Ze), F = g && !w, T = ue(Re), j = Ue(
437
+ ), w = Re(je), F = d && !w, $ = fe(Le), C = Ye(
449
438
  O,
450
439
  v,
451
- t.every((d) => y.has(d.id)),
452
- e,
440
+ e.every((g) => y.has(g.id)),
441
+ t,
453
442
  F,
454
443
  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);
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
- }, [T, k, j]);
462
- const re = Ye(), ce = z(
463
- (d, c) => {
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
- ), le = z(
468
- (d, c) => {
456
+ ), pe = z(
457
+ (g, c) => {
469
458
  c.data && l?.(c.data.edge);
470
459
  },
471
460
  [l]
472
- ), de = z(
473
- (d) => {
474
- if (d.key !== "Enter" && d.key !== " " || d.repeat)
461
+ ), ge = z(
462
+ (g) => {
463
+ if (g.key !== "Enter" && g.key !== " " || g.repeat)
475
464
  return;
476
- const c = d.target;
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 = t.find(($) => $.id === h);
482
- M && o && (d.preventDefault(), o(M));
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 = i.find(($) => $.id === h);
485
- M && l && (d.preventDefault(), l(M));
473
+ const M = n.find((D) => D.id === h);
474
+ M && l && (g.preventDefault(), l(M));
486
475
  }
487
476
  },
488
- [t, i, o, l]
489
- ), pe = {
490
- ...$e,
491
- height: a === void 0 ? void 0 : `${String(a)}px`
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: pe,
490
+ style: ue,
502
491
  children: [
503
492
  /* @__PURE__ */ u("div", { className: "aegis-service-map__pane", children: /* @__PURE__ */ H(
504
- be,
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: Ce,
512
- minZoom: X,
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: V,
521
- onNodeClick: _ ? ce : void 0,
522
- onEdgeClick: S ? le : void 0,
523
- onKeyDown: de,
524
- onFocus: re,
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(_e, { variant: we.Dots, gap: 16, size: 1 }),
527
- /* @__PURE__ */ u(ye, { showInteractive: !1, position: "top-left" }),
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
- xe,
518
+ Ne,
530
519
  {
531
520
  pannable: !0,
532
521
  zoomable: !0,
533
522
  position: "bottom-right",
534
- style: { width: ae },
535
- nodeClassName: je
523
+ style: { width: re },
524
+ nodeClassName: We
536
525
  }
537
526
  )
538
527
  ]
539
528
  }
540
529
  ) }),
541
- T !== null && j && k !== void 0 && /* @__PURE__ */ u(We, { nodeId: k, selection: T })
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 at(t) {
547
- return /* @__PURE__ */ u(ve, { children: /* @__PURE__ */ u(Xe, { ...t }) });
542
+ function lt(e) {
543
+ return /* @__PURE__ */ u(_e, { children: /* @__PURE__ */ u(Ke, { ...e }) });
548
544
  }
549
545
  export {
550
- at as ServiceMap
546
+ lt as ServiceMap
551
547
  };
552
548
  //# sourceMappingURL=ServiceMap.js.map