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