@module-federation/devtools 0.22.0 → 0.23.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 (116) hide show
  1. package/dist/es/App.css +13 -0
  2. package/dist/es/App.js +461 -21
  3. package/dist/es/App.module.js +1 -1
  4. package/dist/es/App_module.css +293 -5
  5. package/dist/es/component/DependencyGraph/index.js +204 -0
  6. package/dist/es/component/DependencyGraph/index.module.js +5 -0
  7. package/dist/es/component/DependencyGraph/index_module.css +100 -0
  8. package/dist/es/component/{GraphItem → DependencyGraphItem}/index.js +20 -9
  9. package/dist/es/component/DependencyGraphItem/index.module.js +5 -0
  10. package/dist/es/component/DependencyGraphItem/index_module.css +95 -0
  11. package/dist/es/component/Form/index.js +192 -117
  12. package/dist/es/component/Form/index.module.js +1 -1
  13. package/dist/es/component/Form/index_module.css +176 -25
  14. package/dist/es/component/LanguageSwitch.js +50 -0
  15. package/dist/es/component/Layout/index.js +296 -49
  16. package/dist/es/component/Layout/index.module.js +1 -1
  17. package/dist/es/component/Layout/index_module.css +52 -32
  18. package/dist/es/component/ModuleInfo/index.js +313 -0
  19. package/dist/es/component/ModuleInfo/index.module.js +5 -0
  20. package/dist/es/component/ModuleInfo/index_module.css +184 -0
  21. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.js +35 -0
  22. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.module.js +5 -0
  23. package/dist/es/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
  24. package/dist/es/component/SharedDepsExplorer/index.js +495 -0
  25. package/dist/es/component/SharedDepsExplorer/index.module.js +5 -0
  26. package/dist/es/component/SharedDepsExplorer/index_module.css +467 -0
  27. package/dist/es/component/SharedDepsExplorer/share-utils.js +206 -0
  28. package/dist/es/component/ThemeToggle.js +19 -0
  29. package/dist/es/component/ThemeToggle.module.js +5 -0
  30. package/dist/es/component/ThemeToggle_module.css +12 -0
  31. package/dist/es/hooks/useDevtoolsTheme.js +77 -0
  32. package/dist/es/i18n/index.js +506 -0
  33. package/dist/es/template/constant.js +3 -19
  34. package/dist/es/utils/chrome/index.js +91 -38
  35. package/dist/es/utils/chrome/messages.js +6 -0
  36. package/dist/es/utils/chrome/override-remote.js +42 -0
  37. package/dist/es/utils/chrome/post-message-listener.js +2 -1
  38. package/dist/es/utils/chrome/post-message-start.js +10 -2
  39. package/dist/es/utils/chrome/storage.js +6 -1
  40. package/dist/es/utils/sdk/graph.js +25 -4
  41. package/dist/es/utils/sdk/index.js +9 -0
  42. package/dist/es/worker/index.js +168 -1
  43. package/dist/lib/App.css +13 -0
  44. package/dist/lib/App.js +451 -18
  45. package/dist/lib/App.module.js +1 -1
  46. package/dist/lib/App_module.css +293 -5
  47. package/dist/lib/component/DependencyGraph/index.js +226 -0
  48. package/dist/lib/component/{GraphItem → DependencyGraph}/index.module.js +1 -1
  49. package/dist/lib/component/DependencyGraph/index_module.css +100 -0
  50. package/dist/lib/component/{GraphItem → DependencyGraphItem}/index.js +23 -12
  51. package/dist/lib/component/{Graph → DependencyGraphItem}/index.module.js +1 -1
  52. package/dist/lib/component/DependencyGraphItem/index_module.css +95 -0
  53. package/dist/lib/component/Form/index.js +189 -115
  54. package/dist/lib/component/Form/index.module.js +1 -1
  55. package/dist/lib/component/Form/index_module.css +176 -25
  56. package/dist/lib/component/LanguageSwitch.js +80 -0
  57. package/dist/lib/component/Layout/index.js +290 -47
  58. package/dist/lib/component/Layout/index.module.js +1 -1
  59. package/dist/lib/component/Layout/index_module.css +52 -32
  60. package/dist/lib/component/ModuleInfo/index.js +343 -0
  61. package/dist/lib/component/ModuleInfo/index.module.js +25 -0
  62. package/dist/lib/component/ModuleInfo/index_module.css +184 -0
  63. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.js +65 -0
  64. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.module.js +25 -0
  65. package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay_module.css +45 -0
  66. package/dist/lib/component/SharedDepsExplorer/index.js +502 -0
  67. package/dist/lib/component/SharedDepsExplorer/index.module.js +25 -0
  68. package/dist/lib/component/SharedDepsExplorer/index_module.css +467 -0
  69. package/dist/lib/component/SharedDepsExplorer/share-utils.js +237 -0
  70. package/dist/lib/component/ThemeToggle.js +49 -0
  71. package/dist/lib/component/ThemeToggle.module.js +25 -0
  72. package/dist/lib/component/ThemeToggle_module.css +12 -0
  73. package/dist/lib/hooks/useDevtoolsTheme.js +101 -0
  74. package/dist/lib/i18n/index.js +540 -0
  75. package/dist/lib/template/constant.js +4 -17
  76. package/dist/lib/utils/chrome/index.js +94 -38
  77. package/dist/lib/utils/chrome/messages.js +31 -0
  78. package/dist/lib/utils/chrome/override-remote.js +65 -0
  79. package/dist/lib/utils/chrome/post-message-listener.js +2 -1
  80. package/dist/lib/utils/chrome/post-message-start.js +10 -2
  81. package/dist/lib/utils/chrome/storage.js +5 -0
  82. package/dist/lib/utils/sdk/graph.js +25 -4
  83. package/dist/lib/utils/sdk/index.js +10 -0
  84. package/dist/lib/worker/index.js +156 -1
  85. package/dist/types/src/App.d.ts +2 -1
  86. package/dist/types/src/component/{Graph → DependencyGraph}/index.d.ts +0 -1
  87. package/dist/types/src/component/{GraphItem → DependencyGraphItem}/index.d.ts +0 -1
  88. package/dist/types/src/component/Form/index.d.ts +2 -0
  89. package/dist/types/src/component/LanguageSwitch.d.ts +2 -0
  90. package/dist/types/src/component/Layout/index.d.ts +0 -1
  91. package/dist/types/src/component/ModuleInfo/index.d.ts +8 -0
  92. package/dist/types/src/component/SharedDepsExplorer/FocusResultDisplay.d.ts +15 -0
  93. package/dist/types/src/component/SharedDepsExplorer/index.d.ts +6 -0
  94. package/dist/types/src/component/SharedDepsExplorer/share-utils.d.ts +44 -0
  95. package/dist/types/src/component/ThemeToggle.d.ts +8 -0
  96. package/dist/types/src/hooks/useDevtoolsTheme.d.ts +2 -0
  97. package/dist/types/src/i18n/index.d.ts +5 -0
  98. package/dist/types/src/init.d.ts +0 -1
  99. package/dist/types/src/template/constant.d.ts +2 -5
  100. package/dist/types/src/utils/chrome/index.d.ts +5 -3
  101. package/dist/types/src/utils/chrome/messages.d.ts +2 -0
  102. package/dist/types/src/utils/chrome/override-remote.d.ts +1 -0
  103. package/dist/types/src/utils/chrome/storage.d.ts +5 -4
  104. package/dist/types/src/utils/sdk/graph.d.ts +2 -1
  105. package/dist/types/src/utils/sdk/index.d.ts +1 -0
  106. package/dist/types/src/utils/types/common.d.ts +4 -0
  107. package/dist/types/src/worker/index.d.ts +1 -0
  108. package/package.json +18 -14
  109. package/dist/es/component/Graph/index.js +0 -127
  110. package/dist/es/component/Graph/index.module.js +0 -5
  111. package/dist/es/component/Graph/index_module.css +0 -12
  112. package/dist/es/component/GraphItem/index.module.js +0 -5
  113. package/dist/es/component/GraphItem/index_module.css +0 -61
  114. package/dist/lib/component/Graph/index.js +0 -149
  115. package/dist/lib/component/Graph/index_module.css +0 -12
  116. package/dist/lib/component/GraphItem/index_module.css +0 -61
@@ -3,17 +3,305 @@
3
3
  }
4
4
  .arco-form-layout-horizontal {
5
5
  flex: 1 1;
6
- margin: 0 1vw 0 0;
6
+ margin: 0;
7
7
  }
8
8
  .arco-form-item-wrapper {
9
9
  width: 100%;
10
10
  flex: 1 1;
11
11
  }
12
+ .arco-empty {
13
+ color: var(--color-text-2, #4b5563);
14
+ }
15
+ .arco-select, .arco-input {
16
+ background: transparent;
17
+ }
18
+ .arco-tag-color-arcoblue {
19
+ background: rgba(34, 197, 94, 0.18);
20
+ border: 1px solid rgba(34, 197, 94, 0.35);
21
+ color: #4b5563;
22
+ }
23
+ body {
24
+ --form-control-alpha: 0.9;
25
+ }
26
+ body[arco-theme=dark] {
27
+ --form-control-alpha: 0.1;
28
+ }
12
29
 
13
- .layout_ae2ee {
30
+ .shell_ae2ee {
31
+ width: 100%;
32
+ min-height: 100vh;
33
+ display: flex;
34
+ align-items: stretch;
35
+ justify-content: center;
36
+ gap: clamp(18px, 3vw, 36px);
37
+ padding: 28px clamp(16px, 4vw, 48px);
38
+ box-sizing: border-box;
39
+ background: radial-gradient(circle at 10% 20%, rgba(229, 231, 235, 0.8) 0%, rgba(243, 244, 246, 0.9) 55%), linear-gradient(135deg, #ffffff 0%, #f9fafb 40%, #f3f4f6 100%);
40
+ }
41
+
42
+ .sidebar_ae2ee {
43
+ width: clamp(160px, 18vw, 220px);
44
+ min-width: 150px;
45
+ display: flex;
46
+ flex-direction: column;
47
+ gap: 12px;
48
+ padding: clamp(18px, 2.5vw, 24px) clamp(14px, 2vw, 18px);
49
+ border-radius: 22px;
50
+ border: 1px solid var(--color-border-1, rgba(148, 163, 184, 0.18));
51
+ background: var(--color-bg-2, rgba(255, 255, 255, 0.95));
52
+ box-shadow: 0 18px 48px rgba(0, 0, 0, 0.08), 0 1px 0 rgba(0, 0, 0, 0.05) inset;
53
+ box-sizing: border-box;
54
+ }
55
+
56
+ .tabItem_ae2ee {
57
+ display: flex;
58
+ align-items: center;
59
+ justify-content: flex-start;
60
+ border: 1px solid transparent;
61
+ border-radius: 12px;
62
+ padding: 10px 12px;
63
+ background: var(--color-bg-2, rgba(249, 250, 251, 0.8));
64
+ color: var(--color-text-2, rgba(55, 65, 81, 0.9));
65
+ font-size: 13px;
66
+ letter-spacing: 0.04em;
67
+ text-transform: uppercase;
68
+ cursor: pointer;
69
+ transition: all 0.15s ease;
70
+ white-space: nowrap;
71
+ }
72
+
73
+ .tabItem_ae2ee:hover {
74
+ border-color: rgba(37, 49, 48, 0.45);
75
+ color: var(--color-text-1, #1e293b);
76
+ }
77
+
78
+ .activeTab_ae2ee {
79
+ border-color: rgba(99, 102, 241, 0.65);
80
+ background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.1));
81
+ color: var(--color-text-1, #1e293b);
82
+ box-shadow: 0 12px 28px rgba(30, 64, 175, 0.25);
83
+ }
84
+
85
+ .panel_ae2ee {
86
+ flex: 1 1;
87
+ min-width: 0;
14
88
  width: 100%;
15
- height: 100vh;
89
+ max-width: 1120px;
90
+ min-height: calc(100vh - 56px);
91
+ background: var(--color-bg-1, rgba(255, 255, 255, 0.98));
92
+ border: 1px solid var(--color-border-2, rgba(0, 0, 0, 0.08));
93
+ box-shadow: 0 24px 64px rgba(0, 0, 0, 0.06), 0 2px 0 rgba(0, 0, 0, 0.04) inset;
94
+ border-radius: 22px;
95
+ padding: clamp(20px, 3vw, 32px);
96
+ display: flex;
97
+ flex-direction: column;
98
+ gap: 28px;
99
+ box-sizing: border-box;
100
+ color: var(--color-text-1, #1f2937);
101
+ }
102
+
103
+ .header_ae2ee {
104
+ display: flex;
105
+ flex-direction: column;
106
+ gap: 18px;
107
+ }
108
+
109
+ .headerTop_ae2ee {
110
+ display: flex;
111
+ align-items: center;
112
+ justify-content: space-between;
113
+ gap: 14px;
114
+ }
115
+
116
+ .branding_ae2ee {
117
+ display: flex;
118
+ flex-direction: column;
119
+ gap: 4px;
120
+ }
121
+
122
+ .logo_ae2ee {
123
+ font-size: 20px;
124
+ font-weight: 600;
125
+ letter-spacing: 0.02em;
126
+ color: var(--color-text-1, #1e293b);
127
+ }
128
+
129
+ .subtitle_ae2ee {
130
+ font-size: 12px;
131
+ font-weight: 500;
132
+ color: var(--color-text-2, rgba(75, 85, 99, 0.8));
133
+ text-transform: uppercase;
134
+ letter-spacing: 0.12em;
135
+ }
136
+
137
+ .meta_ae2ee {
138
+ display: flex;
139
+ align-items: stretch;
140
+ justify-content: space-between;
141
+ gap: 18px;
142
+ flex-wrap: wrap;
143
+ }
144
+
145
+ .scope_ae2ee {
146
+ display: flex;
147
+ flex-direction: column;
148
+ gap: 8px;
149
+ flex: 1 1 160px;
150
+ }
151
+
152
+ .scopeLabel_ae2ee {
153
+ font-size: 12px;
154
+ color: var(--color-text-2, rgba(75, 85, 99, 0.85));
155
+ text-transform: uppercase;
156
+ letter-spacing: 0.08em;
157
+ }
158
+
159
+ .stats_ae2ee {
160
+ display: flex;
161
+ align-items: center;
162
+ gap: 14px;
163
+ flex-wrap: wrap;
164
+ }
165
+
166
+ .statBlock_ae2ee {
167
+ display: flex;
168
+ flex-direction: column;
169
+ gap: 2px;
170
+ min-width: 80px;
171
+ padding: 12px 14px;
172
+ border-radius: 14px;
173
+ background: linear-gradient(140deg, rgba(243, 244, 246, 0) 0%, rgba(229, 231, 235, 0.1) 100%);
174
+ border: 1px solid rgba(203, 213, 225, 0.4);
175
+ box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
176
+ }
177
+
178
+ .statValue_ae2ee {
179
+ font-size: 22px;
180
+ font-weight: 600;
181
+ color: var(--color-text-1, #1e293b);
182
+ line-height: 1.1;
183
+ }
184
+
185
+ .statLabel_ae2ee {
186
+ font-size: 11px;
187
+ color: var(--color-text-2, rgba(75, 85, 99, 0.88));
188
+ letter-spacing: 0.04em;
189
+ text-transform: uppercase;
190
+ }
191
+
192
+ .body_ae2ee {
193
+ flex: 1 1;
194
+ display: flex;
195
+ flex-direction: column;
196
+ min-height: 0;
197
+ overflow: hidden;
198
+ }
199
+
200
+ .content_ae2ee {
201
+ flex: 1 1;
202
+ display: flex;
203
+ flex-direction: column;
204
+ min-height: 0;
205
+ overflow: auto;
206
+ gap: 16px;
207
+ }
208
+
209
+ @media (max-width: 980px) {
210
+ .shell_ae2ee {
211
+ flex-direction: column;
212
+ align-items: stretch;
213
+ }
214
+ .sidebar_ae2ee {
215
+ width: 100%;
216
+ flex-direction: row;
217
+ align-items: center;
218
+ justify-content: flex-start;
219
+ overflow-x: auto;
220
+ padding: 16px 12px;
221
+ gap: 10px;
222
+ }
223
+ .tabItem_ae2ee {
224
+ flex: 1 0 auto;
225
+ justify-content: center;
226
+ padding: 10px 14px;
227
+ }
228
+ .panel_ae2ee {
229
+ max-width: none;
230
+ min-height: auto;
231
+ }
232
+ }
233
+ @media (max-width: 640px) {
234
+ .panel_ae2ee {
235
+ padding: 20px;
236
+ }
237
+ .meta_ae2ee {
238
+ gap: 12px;
239
+ }
240
+ .stats_ae2ee {
241
+ width: 100%;
242
+ justify-content: space-between;
243
+ }
244
+ }
245
+ .emptyState_ae2ee {
246
+ flex: 1 1;
247
+ display: flex;
248
+ align-items: center;
249
+ justify-content: center;
250
+ border-radius: 18px;
251
+ border: 1px dashed rgba(203, 213, 225, 0.4);
252
+ background: var(--color-bg-2, rgba(255, 255, 255, 0.8));
253
+ padding: 32px;
254
+ }
255
+
256
+ .empty_ae2ee .arco-empty-image > svg path {
257
+ fill: rgba(75, 85, 99, 0.5);
258
+ }
259
+
260
+ .placeholder_ae2ee {
261
+ flex: 1 1;
262
+ display: flex;
263
+ align-items: center;
264
+ justify-content: center;
265
+ border-radius: 18px;
266
+ border: 1px dashed rgba(203, 213, 225, 0.4);
267
+ background: var(--color-bg-2, rgba(255, 255, 255, 0.8));
268
+ color: var(--color-text-2, rgba(75, 85, 99, 0.75));
269
+ font-size: 14px;
270
+ letter-spacing: 0.08em;
271
+ text-transform: uppercase;
272
+ }
273
+
274
+ .overrideArco_ae2ee .arco-input-inner-wrapper,
275
+ .overrideArco_ae2ee .arco-select-view {
276
+ background-color: var(--color-bg-1, #fff) !important;
277
+ border-color: var(--color-border-2, rgba(228, 228, 231, 0.5)) !important;
278
+ }
279
+ .overrideArco_ae2ee .arco-input-inner-wrapper:hover,
280
+ .overrideArco_ae2ee .arco-select-view:hover {
281
+ background-color: var(--color-bg-1, #fff) !important;
282
+ border-color: var(--color-border-2, rgba(228, 228, 231, 0.5)) !important;
16
283
  }
17
- .layout_ae2ee .content_ae2ee {
18
- margin: 0 0.5vw 0 2vw;
284
+ .overrideArco_ae2ee .arco-input-inner-wrapper:focus-within,
285
+ .overrideArco_ae2ee .arco-select-view-focus {
286
+ background-color: var(--color-bg-1, #fff) !important;
287
+ border-color: var(--color-border-2, rgba(228, 228, 231, 0.5)) !important;
288
+ }
289
+ .overrideArco_ae2ee .arco-collapse-item .arco-collapse-item-icon-hover {
290
+ top: 25% !important;
291
+ }
292
+ .overrideArco_ae2ee .arco-tabs-content {
293
+ padding-top: 0px !important;
294
+ }
295
+
296
+ .arco-table-th {
297
+ background-color: var(--color-bg-2, rgb(250 250 250/var(--tw-bg-opacity))) !important;
298
+ border-bottom-color: var(--color-border-2, rgb(228 228 231/var(--tw-border-opacity))) !important;
299
+ }
300
+
301
+ .arco-table-td {
302
+ border-bottom-color: var(--color-border-2, rgba(228, 228, 231, 0.5)) !important;
303
+ }
304
+
305
+ .shell_ae2ee.arco-theme-dark {
306
+ background: radial-gradient(circle at 10% 20%, rgba(15, 23, 42, 0.9) 0%, rgba(15, 23, 42, 0.98) 55%), linear-gradient(135deg, var(--color-bg-1, #020617) 0%, var(--color-bg-2, #020617) 100%);
19
307
  }
@@ -0,0 +1,204 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import { jsx, jsxs } from "react/jsx-runtime";
21
+ import { useCallback, useEffect, useState } from "react";
22
+ import ReactFlow, {
23
+ addEdge,
24
+ ConnectionLineType,
25
+ useNodesState,
26
+ useEdgesState,
27
+ Controls
28
+ } from "reactflow";
29
+ import dagre from "dagre";
30
+ import { Select } from "@arco-design/web-react";
31
+ import { useTranslation } from "react-i18next";
32
+ import { DependencyGraph } from "../../utils/sdk/graph";
33
+ import GraphItem from "../DependencyGraphItem";
34
+ import { separateType } from "../../utils";
35
+ import styles from "./index.module";
36
+ import "reactflow/dist/style.css";
37
+ const nodeWidth = 360;
38
+ const nodeHeight = 420;
39
+ const nodeTypes = { graphItem: GraphItem };
40
+ const { Option } = Select;
41
+ const Graph = (props) => {
42
+ const { t } = useTranslation();
43
+ const [nodes, setNodes, onNodesChange] = useNodesState([]);
44
+ const [edges, setEdges, onEdgesChange] = useEdgesState([]);
45
+ const { snapshot } = props;
46
+ const federation = window.__FEDERATION__ || {
47
+ moduleInfo: {},
48
+ originModuleInfo: {}
49
+ };
50
+ const { moduleInfo } = federation;
51
+ const { consumers } = separateType(moduleInfo);
52
+ const [selectedConsumer, setSelectedConsumer] = useState("All");
53
+ const [maxDepth, setMaxDepth] = useState(Infinity);
54
+ const [availableDepth, setAvailableDepth] = useState(1);
55
+ useEffect(() => {
56
+ const targetConsumers = selectedConsumer === "All" ? Object.keys(consumers) : [selectedConsumer].filter((c) => consumers[c]);
57
+ let maxD = 0;
58
+ for (const consumer of targetConsumers) {
59
+ const moduleGraph = new DependencyGraph(snapshot, consumer);
60
+ moduleGraph.createGraph();
61
+ const depth = moduleGraph.calculateDepth();
62
+ if (depth > maxD) {
63
+ maxD = depth;
64
+ }
65
+ }
66
+ setAvailableDepth(maxD || 1);
67
+ }, [snapshot, selectedConsumer, consumers]);
68
+ useEffect(() => {
69
+ const dagreGraph = new dagre.graphlib.Graph();
70
+ dagreGraph.setDefaultEdgeLabel(() => ({}));
71
+ const getLayoutedElements = (nodes2, edges2, direction = "TB") => {
72
+ dagreGraph.setGraph({ rankdir: direction });
73
+ nodes2.forEach((node) => {
74
+ dagreGraph.setNode(node.id, { width: nodeWidth, height: nodeHeight });
75
+ });
76
+ edges2.forEach((edge) => {
77
+ dagreGraph.setEdge(edge.source, edge.target);
78
+ });
79
+ dagre.layout(dagreGraph);
80
+ nodes2.forEach((node) => {
81
+ const nodeWithPosition = dagreGraph.node(node.id);
82
+ node.position = {
83
+ x: nodeWithPosition.x - nodeWidth / 2,
84
+ y: nodeWithPosition.y - nodeHeight / 2
85
+ };
86
+ });
87
+ return { nodes: nodes2, edges: edges2 };
88
+ };
89
+ let nodeSet = [];
90
+ let edgeSet = [];
91
+ const targetConsumers = selectedConsumer === "All" ? Object.keys(consumers) : [selectedConsumer].filter((c) => consumers[c]);
92
+ for (const consumer of targetConsumers) {
93
+ const moduleGraph = new DependencyGraph(snapshot, consumer);
94
+ moduleGraph.createGraph();
95
+ moduleGraph.run(
96
+ moduleGraph.graph,
97
+ consumer,
98
+ "graphItem",
99
+ consumer,
100
+ 0,
101
+ maxDepth
102
+ );
103
+ nodeSet = [...nodeSet, ...moduleGraph.node];
104
+ edgeSet = [...edgeSet, ...moduleGraph.edge];
105
+ }
106
+ if (!nodeSet.length) {
107
+ nodeSet.push({
108
+ id: "1",
109
+ type: "graphItem",
110
+ position: {
111
+ x: 0,
112
+ y: 0
113
+ },
114
+ data: {
115
+ color: "lightgreen"
116
+ }
117
+ });
118
+ }
119
+ const { nodes: layoutedNodes, edges: layoutedEdges } = getLayoutedElements(
120
+ nodeSet,
121
+ edgeSet
122
+ );
123
+ setNodes(layoutedNodes);
124
+ setEdges(layoutedEdges);
125
+ setTimeout(() => {
126
+ const element = document.getElementsByClassName(
127
+ "react-flow__controls-fitview"
128
+ )[0];
129
+ element == null ? void 0 : element.click();
130
+ }, 50);
131
+ }, [snapshot, selectedConsumer, maxDepth]);
132
+ const onConnect = useCallback(
133
+ (params) => setEdges(
134
+ (eds) => addEdge(
135
+ __spreadProps(__spreadValues({}, params), { type: ConnectionLineType.SmoothStep, animated: true }),
136
+ eds
137
+ )
138
+ ),
139
+ []
140
+ );
141
+ return /* @__PURE__ */ jsxs("div", { className: styles.depWrapper, children: [
142
+ /* @__PURE__ */ jsxs("div", { className: styles.header, children: [
143
+ /* @__PURE__ */ jsxs("div", { className: styles.titleBlock, children: [
144
+ /* @__PURE__ */ jsx("span", { className: styles.title, children: t("dependencyGraph.title") }),
145
+ /* @__PURE__ */ jsx("span", { className: styles.subtitle, children: t("dependencyGraph.subtitle") })
146
+ ] }),
147
+ /* @__PURE__ */ jsxs("div", { className: styles.filterBlock, children: [
148
+ /* @__PURE__ */ jsxs(
149
+ Select,
150
+ {
151
+ showSearch: true,
152
+ placeholder: t("dependencyGraph.filters.consumerPlaceholder"),
153
+ style: { width: 200 },
154
+ value: selectedConsumer,
155
+ onChange: setSelectedConsumer,
156
+ children: [
157
+ /* @__PURE__ */ jsx(Option, { value: "All", children: t("dependencyGraph.filters.consumerAll") }),
158
+ Object.keys(consumers).map((key) => /* @__PURE__ */ jsx(Option, { value: key, children: key }, key))
159
+ ]
160
+ }
161
+ ),
162
+ /* @__PURE__ */ jsxs(
163
+ Select,
164
+ {
165
+ showSearch: true,
166
+ placeholder: t("dependencyGraph.filters.depthPlaceholder"),
167
+ style: { width: 120 },
168
+ value: maxDepth === Infinity ? "All" : maxDepth,
169
+ onChange: (val) => setMaxDepth(val === "All" ? Infinity : val),
170
+ children: [
171
+ /* @__PURE__ */ jsx(Option, { value: "All", children: t("dependencyGraph.filters.depthAll") }),
172
+ Array.from({ length: availableDepth }, (_, i) => i + 1).map(
173
+ (depth) => /* @__PURE__ */ jsx(Option, { value: depth, children: t("dependencyGraph.filters.depthOption", { depth }) }, depth)
174
+ )
175
+ ]
176
+ }
177
+ )
178
+ ] }),
179
+ /* @__PURE__ */ jsxs("div", { className: styles.meta, children: [
180
+ /* @__PURE__ */ jsx("span", { className: styles.metaBadge, children: nodes.length }),
181
+ /* @__PURE__ */ jsx("span", { className: styles.metaLabel, children: nodes.length === 1 ? t("dependencyGraph.meta.singleNode") : t("dependencyGraph.meta.multiNodes") })
182
+ ] })
183
+ ] }),
184
+ /* @__PURE__ */ jsx("div", { className: styles.canvas, children: /* @__PURE__ */ jsx(
185
+ ReactFlow,
186
+ {
187
+ className: styles.graph,
188
+ nodes,
189
+ edges,
190
+ onNodesChange,
191
+ onEdgesChange,
192
+ onConnect,
193
+ nodeTypes,
194
+ proOptions: { hideAttribution: true },
195
+ fitView: true,
196
+ children: /* @__PURE__ */ jsx(Controls, { className: styles.controls })
197
+ }
198
+ ) })
199
+ ] });
200
+ };
201
+ var DependencyGraph_default = Graph;
202
+ export {
203
+ DependencyGraph_default as default
204
+ };
@@ -0,0 +1,5 @@
1
+ import "./index_module.css";
2
+ var index_module_default = { "depWrapper": "depWrapper_5e584", "header": "header_5e584", "titleBlock": "titleBlock_5e584", "title": "title_5e584", "subtitle": "subtitle_5e584", "meta": "meta_5e584", "metaBadge": "metaBadge_5e584", "metaLabel": "metaLabel_5e584", "filterBlock": "filterBlock_5e584", "canvas": "canvas_5e584", "graph": "graph_5e584", "controls": "controls_5e584" };
3
+ export {
4
+ index_module_default as default
5
+ };
@@ -0,0 +1,100 @@
1
+ .depWrapper_5e584 {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 16px;
5
+ min-height: 340px;
6
+ color: var(--color-text-1, #1f2937);
7
+ }
8
+
9
+ .header_5e584 {
10
+ display: flex;
11
+ justify-content: space-between;
12
+ align-items: flex-start;
13
+ gap: 18px;
14
+ padding: 0 6px 6px;
15
+ border-bottom: 1px solid var(--color-border-2, rgba(96, 165, 250, 0.3));
16
+ }
17
+
18
+ .titleBlock_5e584 {
19
+ display: flex;
20
+ flex-direction: column;
21
+ gap: 6px;
22
+ }
23
+
24
+ .title_5e584 {
25
+ font-size: 16px;
26
+ font-weight: 600;
27
+ color: var(--color-text-1, #1f2937);
28
+ }
29
+
30
+ .subtitle_5e584 {
31
+ font-size: 12px;
32
+ color: var(--color-text-2, #4b5563);
33
+ max-width: 260px;
34
+ line-height: 1.5;
35
+ }
36
+
37
+ .meta_5e584 {
38
+ display: flex;
39
+ align-items: center;
40
+ gap: 10px;
41
+ background: var(--color-bg-2, rgba(228, 228, 231, 0.5));
42
+ padding: 4px 12px;
43
+ border-radius: 999px;
44
+ border: 1px solid var(--color-border-2, rgba(96, 165, 250, 0.3));
45
+ }
46
+
47
+ .metaBadge_5e584 {
48
+ font-size: 16px;
49
+ font-weight: 600;
50
+ color: var(--color-text-1, #1f2937);
51
+ }
52
+
53
+ .metaLabel_5e584 {
54
+ font-size: 12px;
55
+ color: var(--color-text-2, #4b5563);
56
+ }
57
+
58
+ .filterBlock_5e584 {
59
+ display: flex;
60
+ align-items: center;
61
+ gap: 12px;
62
+ }
63
+
64
+ .canvas_5e584 {
65
+ flex: 1 1;
66
+ padding: 12px;
67
+ border-radius: 16px;
68
+ border: 1px solid var(--color-border-1, rgba(96, 165, 250, 0.3));
69
+ background: var(--color-bg-2, rgba(228, 228, 231, 0.5));
70
+ backdrop-filter: blur(4px);
71
+ }
72
+ .canvas_5e584 .react-flow__handle {
73
+ width: 10px;
74
+ height: 10px;
75
+ border-radius: 50%;
76
+ border: 2px solid var(--color-border-1, rgba(96, 165, 250, 0.3));
77
+ background: var(--color-bg-1, rgba(243, 244, 246, 0.9));
78
+ }
79
+ .canvas_5e584 .react-flow__controls-button:hover {
80
+ background: var(--color-bg-1, rgba(243, 244, 246, 0.9));
81
+ }
82
+
83
+ .graph_5e584 {
84
+ width: 100%;
85
+ height: 58vh !important;
86
+ min-height: 280px;
87
+ border-radius: 12px;
88
+ }
89
+
90
+ .controls_5e584 .react-flow__controls-button {
91
+ background: var(--color-bg-2, rgba(243, 244, 246, 0.3));
92
+ border-color: var(--color-border-1, rgba(96, 165, 250, 0.3));
93
+ color: var(--color-text-1, #1f2937);
94
+ }
95
+ .controls_5e584 .react-flow__controls-button:hover {
96
+ background: var(--color-bg-1, #ffffff);
97
+ }
98
+ .arco-theme-dark .controls_5e584 .react-flow__controls-button {
99
+ background: var(--color-bg-white);
100
+ }
@@ -1,11 +1,13 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from "react";
3
3
  import { Handle, Position } from "reactflow";
4
+ import { useTranslation } from "react-i18next";
4
5
  import styles from "./index.module";
5
6
  import "reactflow/dist/style.css";
6
7
  const GraphItem = (props) => {
7
8
  const [shareds, setShareds] = useState([]);
8
9
  const [exposes, setExposes] = useState([]);
10
+ const { t } = useTranslation();
9
11
  let name;
10
12
  let version;
11
13
  const { info = "", color, remote } = props.data;
@@ -23,12 +25,17 @@ const GraphItem = (props) => {
23
25
  let shareds2;
24
26
  if (isEntryType) {
25
27
  fetch(version).then((response) => response.json()).then((json) => {
26
- exposes2 = json.exposes.map((expose) => expose.path) || [];
27
- shareds2 = json.shared.map(
28
+ const exposeList = Array.isArray(json == null ? void 0 : json.exposes) ? json.exposes : [];
29
+ const sharedList = Array.isArray(json == null ? void 0 : json.shared) ? json.shared : [];
30
+ exposes2 = exposeList.map((expose) => expose.path) || [];
31
+ shareds2 = sharedList.map(
28
32
  (share) => `${share.name}:${share.version}`
29
33
  ) || [];
30
34
  setExposes(exposes2);
31
35
  setShareds(shareds2);
36
+ }).catch(() => {
37
+ setExposes([]);
38
+ setShareds([]);
32
39
  });
33
40
  } else {
34
41
  exposes2 = ((_a = remote == null ? void 0 : remote.modules) == null ? void 0 : _a.map(
@@ -40,26 +47,30 @@ const GraphItem = (props) => {
40
47
  setExposes(exposes2);
41
48
  setShareds(shareds2);
42
49
  }
43
- }, []);
44
- return /* @__PURE__ */ jsxs("div", { style: { background: color }, className: styles.Wrapper, children: [
50
+ }, [isEntryType, remote, version]);
51
+ const accentColor = color || "rgba(99, 102, 241, 0.45)";
52
+ const style = {
53
+ ["--mf-accent"]: accentColor
54
+ };
55
+ return /* @__PURE__ */ jsxs("div", { style, className: styles.Wrapper, children: [
45
56
  /* @__PURE__ */ jsx(Handle, { type: "target", position: Position.Top }),
46
57
  /* @__PURE__ */ jsxs("div", { className: styles.container, children: [
47
58
  /* @__PURE__ */ jsx("div", { className: styles.group, children: /* @__PURE__ */ jsx("div", { className: styles.name, children: name }) }),
48
59
  version && /* @__PURE__ */ jsxs("div", { className: styles.info, children: [
49
60
  exposes.length > 0 ? /* @__PURE__ */ jsxs("div", { className: styles["expose-container"], children: [
50
- /* @__PURE__ */ jsx("span", { className: styles.type, children: "Expose" }),
61
+ /* @__PURE__ */ jsx("span", { className: styles.type, children: t("graphItem.expose") }),
51
62
  /* @__PURE__ */ jsx("div", { children: exposes.map((expose, index) => {
52
63
  return /* @__PURE__ */ jsx("span", { className: styles.item, children: expose }, index);
53
64
  }) })
54
65
  ] }) : null,
55
66
  shareds.length > 0 ? /* @__PURE__ */ jsxs("div", { className: styles["expose-container"], children: [
56
- /* @__PURE__ */ jsx("span", { className: styles.type, children: "Shared" }),
67
+ /* @__PURE__ */ jsx("span", { className: styles.type, children: t("graphItem.shared") }),
57
68
  /* @__PURE__ */ jsx("div", { children: shareds.map((shared, index) => {
58
69
  return /* @__PURE__ */ jsx("span", { className: styles.item, children: shared }, index);
59
70
  }) })
60
71
  ] }) : null,
61
72
  /* @__PURE__ */ jsxs("div", { className: styles.message, children: [
62
- /* @__PURE__ */ jsx("span", { className: styles.type, children: isEntryType ? "Entry" : "Version" }),
73
+ /* @__PURE__ */ jsx("span", { className: styles.type, children: isEntryType ? t("graphItem.entry") : t("graphItem.version") }),
63
74
  /* @__PURE__ */ jsx("span", { className: styles.item, children: version })
64
75
  ] })
65
76
  ] })
@@ -67,7 +78,7 @@ const GraphItem = (props) => {
67
78
  /* @__PURE__ */ jsx(Handle, { type: "source", position: Position.Bottom, id: "source" })
68
79
  ] });
69
80
  };
70
- var GraphItem_default = GraphItem;
81
+ var DependencyGraphItem_default = GraphItem;
71
82
  export {
72
- GraphItem_default as default
83
+ DependencyGraphItem_default as default
73
84
  };
@@ -0,0 +1,5 @@
1
+ import "./index_module.css";
2
+ var index_module_default = { "Wrapper": "Wrapper_d8079", "container": "container_d8079", "group": "group_d8079", "name": "name_d8079", "info": "info_d8079", "expose-container": "expose-container_d8079", "type": "type_d8079", "item": "item_d8079", "message": "message_d8079" };
3
+ export {
4
+ index_module_default as default
5
+ };