@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
@@ -26,19 +26,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var GraphItem_exports = {};
30
- __export(GraphItem_exports, {
31
- default: () => GraphItem_default
29
+ var DependencyGraphItem_exports = {};
30
+ __export(DependencyGraphItem_exports, {
31
+ default: () => DependencyGraphItem_default
32
32
  });
33
- module.exports = __toCommonJS(GraphItem_exports);
33
+ module.exports = __toCommonJS(DependencyGraphItem_exports);
34
34
  var import_jsx_runtime = require("react/jsx-runtime");
35
35
  var import_react = require("react");
36
36
  var import_reactflow = require("reactflow");
37
+ var import_react_i18next = require("react-i18next");
37
38
  var import_index = __toESM(require("./index.module"));
38
39
  var import_style = require("reactflow/dist/style.css");
39
40
  const GraphItem = (props) => {
40
41
  const [shareds, setShareds] = (0, import_react.useState)([]);
41
42
  const [exposes, setExposes] = (0, import_react.useState)([]);
43
+ const { t } = (0, import_react_i18next.useTranslation)();
42
44
  let name;
43
45
  let version;
44
46
  const { info = "", color, remote } = props.data;
@@ -56,12 +58,17 @@ const GraphItem = (props) => {
56
58
  let shareds2;
57
59
  if (isEntryType) {
58
60
  fetch(version).then((response) => response.json()).then((json) => {
59
- exposes2 = json.exposes.map((expose) => expose.path) || [];
60
- shareds2 = json.shared.map(
61
+ const exposeList = Array.isArray(json == null ? void 0 : json.exposes) ? json.exposes : [];
62
+ const sharedList = Array.isArray(json == null ? void 0 : json.shared) ? json.shared : [];
63
+ exposes2 = exposeList.map((expose) => expose.path) || [];
64
+ shareds2 = sharedList.map(
61
65
  (share) => `${share.name}:${share.version}`
62
66
  ) || [];
63
67
  setExposes(exposes2);
64
68
  setShareds(shareds2);
69
+ }).catch(() => {
70
+ setExposes([]);
71
+ setShareds([]);
65
72
  });
66
73
  } else {
67
74
  exposes2 = ((_a = remote == null ? void 0 : remote.modules) == null ? void 0 : _a.map(
@@ -73,26 +80,30 @@ const GraphItem = (props) => {
73
80
  setExposes(exposes2);
74
81
  setShareds(shareds2);
75
82
  }
76
- }, []);
77
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { background: color }, className: import_index.default.Wrapper, children: [
83
+ }, [isEntryType, remote, version]);
84
+ const accentColor = color || "rgba(99, 102, 241, 0.45)";
85
+ const style = {
86
+ ["--mf-accent"]: accentColor
87
+ };
88
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style, className: import_index.default.Wrapper, children: [
78
89
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_reactflow.Handle, { type: "target", position: import_reactflow.Position.Top }),
79
90
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.container, children: [
80
91
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.group, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.name, children: name }) }),
81
92
  version && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.info, children: [
82
93
  exposes.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default["expose-container"], children: [
83
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.type, children: "Expose" }),
94
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.type, children: t("graphItem.expose") }),
84
95
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: exposes.map((expose, index) => {
85
96
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.item, children: expose }, index);
86
97
  }) })
87
98
  ] }) : null,
88
99
  shareds.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default["expose-container"], children: [
89
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.type, children: "Shared" }),
100
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.type, children: t("graphItem.shared") }),
90
101
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: shareds.map((shared, index) => {
91
102
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.item, children: shared }, index);
92
103
  }) })
93
104
  ] }) : null,
94
105
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.message, children: [
95
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.type, children: isEntryType ? "Entry" : "Version" }),
106
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.type, children: isEntryType ? t("graphItem.entry") : t("graphItem.version") }),
96
107
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.item, children: version })
97
108
  ] })
98
109
  ] })
@@ -100,4 +111,4 @@ const GraphItem = (props) => {
100
111
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_reactflow.Handle, { type: "source", position: import_reactflow.Position.Bottom, id: "source" })
101
112
  ] });
102
113
  };
103
- var GraphItem_default = GraphItem;
114
+ var DependencyGraphItem_default = GraphItem;
@@ -22,4 +22,4 @@ __export(index_module_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(index_module_exports);
24
24
  var import_index_module = require("./index_module.css");
25
- var index_module_default = { "depWrapper": "depWrapper_613b1", "table": "table_613b1", "graph": "graph_613b1" };
25
+ 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" };
@@ -0,0 +1,95 @@
1
+ .Wrapper_d8079 {
2
+ display: flex;
3
+ width: 320px;
4
+ border-radius: 18px;
5
+ border: 1px solid var(--color-border-1, rgba(96, 165, 250, 0.3));
6
+ overflow: hidden;
7
+ box-shadow: 0 18px 32px rgba(8, 11, 25, 0.35);
8
+ background: linear-gradient(140deg, var(--mf-accent, rgba(243, 244, 246, 0.9)) 0%, rgba(229, 231, 235, 0.7) 45%, rgba(255, 255, 255, 0.95) 100%), var(--color-bg-2, rgba(255, 255, 255, 0.9));
9
+ color: var(--color-text-1, #1f2937);
10
+ backdrop-filter: blur(4px);
11
+ }
12
+ .Wrapper_d8079 .react-flow__handle {
13
+ width: 10px;
14
+ height: 10px;
15
+ border-radius: 50%;
16
+ border: 2px solid rgba(96, 165, 250, 0.3);
17
+ background: rgba(243, 244, 246, 0.9);
18
+ box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2);
19
+ }
20
+ .Wrapper_d8079 .container_d8079 {
21
+ display: flex;
22
+ flex-direction: column;
23
+ width: 100%;
24
+ padding-bottom: 8px;
25
+ }
26
+ .Wrapper_d8079 .group_d8079 {
27
+ display: flex;
28
+ align-items: center;
29
+ justify-content: center;
30
+ padding: 12px;
31
+ background: var(--mf-accent, rgba(243, 244, 246, 0.9));
32
+ }
33
+ .Wrapper_d8079 .name_d8079 {
34
+ font-size: 15px;
35
+ font-weight: 600;
36
+ letter-spacing: 0.02em;
37
+ color: white;
38
+ }
39
+ .Wrapper_d8079 .info_d8079 {
40
+ display: flex;
41
+ flex-direction: column;
42
+ gap: 10px;
43
+ margin: 0 12px;
44
+ padding: 12px;
45
+ border-radius: 14px;
46
+ background: rgba(243, 244, 246, 0.4);
47
+ border: 1px solid rgba(96, 165, 250, 0.3);
48
+ font-size: 11px;
49
+ }
50
+ .Wrapper_d8079 .expose-container_d8079 {
51
+ display: flex;
52
+ flex-direction: column;
53
+ gap: 6px;
54
+ }
55
+ .Wrapper_d8079 .expose-container_d8079 div {
56
+ display: flex;
57
+ flex-wrap: wrap;
58
+ gap: 6px;
59
+ }
60
+ .Wrapper_d8079 .type_d8079 {
61
+ font-size: 12px;
62
+ font-weight: 600;
63
+ text-transform: uppercase;
64
+ letter-spacing: 0.04em;
65
+ color: var(--color-text-2, #4b5563);
66
+ }
67
+ .Wrapper_d8079 .item_d8079 {
68
+ display: inline-flex;
69
+ align-items: center;
70
+ padding: 4px 8px;
71
+ border-radius: 999px;
72
+ background: rgba(243, 244, 246, 0.6);
73
+ color: var(--color-text-1, #1f2937);
74
+ font-size: 10px;
75
+ font-weight: 500;
76
+ margin-right: 6px;
77
+ max-width: 100%;
78
+ white-space: nowrap;
79
+ text-overflow: ellipsis;
80
+ overflow: hidden;
81
+ box-shadow: 0 4px 10px rgba(8, 11, 25, 0.45);
82
+ }
83
+ .Wrapper_d8079 .message_d8079 {
84
+ display: flex;
85
+ align-items: center;
86
+ gap: 6px;
87
+ font-size: 11px;
88
+ color: var(--color-text-2, #4b5563);
89
+ }
90
+ .Wrapper_d8079 .message_d8079 .item_d8079 {
91
+ margin-right: 0;
92
+ padding: 4px 10px;
93
+ background: rgba(243, 244, 246, 0.6);
94
+ color: var(--color-text-1, #1f2937);
95
+ }
@@ -53,8 +53,8 @@ __export(Form_exports, {
53
53
  module.exports = __toCommonJS(Form_exports);
54
54
  var import_jsx_runtime = require("react/jsx-runtime");
55
55
  var import_react = require("react");
56
- var import_react_dom = require("react-dom");
57
56
  var import_web_react = require("@arco-design/web-react");
57
+ var import_react_i18next = require("react-i18next");
58
58
  var import_icon = require("@arco-design/web-react/icon");
59
59
  var import_constant = require("../../template/constant");
60
60
  var import_utils = require("../../utils");
@@ -74,13 +74,20 @@ const FormComponent = (props) => {
74
74
  versionList,
75
75
  setVersionList,
76
76
  getVersion,
77
- customValueValidate
77
+ customValueValidate,
78
+ enableClip,
79
+ onClipChange
78
80
  } = props;
79
- const { moduleInfo } = window.__FEDERATION__;
81
+ const { t } = (0, import_react_i18next.useTranslation)();
82
+ const federation = window.__FEDERATION__ || {
83
+ moduleInfo: {},
84
+ originModuleInfo: {}
85
+ };
86
+ const { moduleInfo } = federation;
80
87
  let { producer } = (0, import_utils.separateType)(moduleInfo);
81
88
  const filterDupMap = /* @__PURE__ */ new Map();
82
- producer = producer.filter((t) => {
83
- const [typeOrName, name] = t.split(":");
89
+ producer = producer.filter((tItem) => {
90
+ const [typeOrName, name] = tItem.split(":");
84
91
  const marked = filterDupMap.get(name || typeOrName);
85
92
  filterDupMap.set(name || typeOrName, true);
86
93
  return !marked;
@@ -127,12 +134,17 @@ const FormComponent = (props) => {
127
134
  }
128
135
  if (key) {
129
136
  statusSet[index].keyStatus = true;
130
- (0, import_react_dom.flushSync)(() => setFormStatus(statusSet));
131
- return callback();
137
+ setTimeout(() => {
138
+ setFormStatus(statusSet);
139
+ callback();
140
+ }, 0);
141
+ return;
132
142
  }
133
143
  statusSet[index].keyStatus = false;
134
- (0, import_react_dom.flushSync)(() => setFormStatus(statusSet));
135
- return callback("Module name can not be empty");
144
+ setTimeout(() => {
145
+ setFormStatus(statusSet);
146
+ }, 0);
147
+ return callback(t("form.validation.moduleNameRequired"));
136
148
  };
137
149
  const validateValue = (value, callback, index) => {
138
150
  const status = getCheckStatus(index);
@@ -148,14 +160,17 @@ const FormComponent = (props) => {
148
160
  }
149
161
  if ((0, import_utils.validateCustom)(value) || (0, import_utils.validateSemver)(value) || (0, import_utils.validatePort)(value) || (customValueValidate == null ? void 0 : customValueValidate(value))) {
150
162
  statusSet[index].valueStatus = true;
151
- (0, import_react_dom.flushSync)(() => setFormStatus(statusSet));
152
- return callback();
163
+ setTimeout(() => {
164
+ setFormStatus(statusSet);
165
+ callback();
166
+ }, 0);
167
+ return;
153
168
  }
154
169
  statusSet[index].valueStatus = false;
155
- (0, import_react_dom.flushSync)(() => setFormStatus(statusSet));
156
- return callback(
157
- "The module information format is incorrect, check the format in the upper left corner"
158
- );
170
+ setTimeout(() => {
171
+ setFormStatus(statusSet);
172
+ }, 0);
173
+ return callback(t("form.validation.moduleInfoInvalid"));
159
174
  };
160
175
  const onAdd = (add) => {
161
176
  add(import_constant.defaultDataItem);
@@ -172,6 +187,9 @@ const FormComponent = (props) => {
172
187
  const hmrChange = (on) => {
173
188
  onHMRChange(on);
174
189
  };
190
+ const handleSwitchChange = (on) => {
191
+ onClipChange(on);
192
+ };
175
193
  const onKeyChange = (key, index) => __async(void 0, null, function* () {
176
194
  const version = yield getVersion == null ? void 0 : getVersion(key);
177
195
  if (version) {
@@ -180,120 +198,176 @@ const FormComponent = (props) => {
180
198
  setVersionList == null ? void 0 : setVersionList(list);
181
199
  }
182
200
  });
183
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormList, { field: import_constant.proxyFormField, children: (fields, { add, remove }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
184
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.header, children: [
185
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
186
- import_web_react.Tooltip,
187
- {
188
- content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "Example: Customize the remote module address, which should end with 「.json」, for example key: @module-federation/button, value: http://localhost:3000/mf-manifest.json" }),
189
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconInfoCircle, {})
190
- }
191
- ),
192
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.title, children: "Module Proxy" }),
193
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
194
- import_web_react.Button,
195
- {
196
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconPlus, {}),
197
- shape: "circle",
198
- className: import_index.default.add,
199
- onClick: () => onAdd(add),
200
- "data-set-e2e": "e2eAdd"
201
- }
202
- ),
203
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.status, children: [
204
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Badge, { color: condition.color, className: import_index.default.badge }),
205
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.message, children: condition.message }),
206
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: import_index.default.headerSlot, children: [
201
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormList, { field: import_constant.proxyFormField, children: (fields, { add, remove }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.wrapper, children: [
202
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.sectionHeader, children: [
203
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.heading, children: [
204
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.titleRow, children: [
205
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Tooltip, { content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: t("form.tooltip.proxyExample") }), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconInfoCircle, {}) }),
206
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.title, children: t("form.title") }),
207
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
208
+ "span",
209
+ {
210
+ className: import_index.default.statusMessage,
211
+ style: { marginLeft: 8 },
212
+ children: [
213
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Badge, { color: condition.color, className: import_index.default.badge }),
214
+ condition.message
215
+ ]
216
+ }
217
+ )
218
+ ] }),
219
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.subtitle, children: t("form.subtitle") })
220
+ ] }),
221
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.headerActions, children: [
222
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: import_index.default.hmrArea, children: [
207
223
  props.headerSlot,
224
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
225
+ import_web_react.Switch,
226
+ {
227
+ checked: enableClip,
228
+ checkedText: t("form.clip.enable"),
229
+ uncheckedText: t("form.clip.disable"),
230
+ onChange: handleSwitchChange,
231
+ className: import_index.default.switch
232
+ }
233
+ ),
234
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Tooltip, { content: t("form.clip.tooltip"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
235
+ import_icon.IconQuestionCircle,
236
+ {
237
+ style: { marginLeft: 5, cursor: "pointer" }
238
+ }
239
+ ) }),
240
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.divider }),
208
241
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
209
242
  import_web_react.Switch,
210
243
  {
211
244
  checked: enableHMR === "enable",
212
- checkedText: "Enable HMR",
213
- uncheckedText: "Disable HMR",
245
+ checkedText: t("form.hmr.enable"),
246
+ uncheckedText: t("form.hmr.disable"),
214
247
  onChange: hmrChange,
215
248
  className: import_index.default.switch
216
249
  }
217
250
  )
218
- ] })
251
+ ] }),
252
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
253
+ import_web_react.Button,
254
+ {
255
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconPlus, {}),
256
+ shape: "circle",
257
+ className: import_index.default.add,
258
+ onClick: () => onAdd(add),
259
+ "data-set-e2e": "e2eAdd"
260
+ }
261
+ )
219
262
  ] })
220
263
  ] }),
221
- fields.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: fields.map((item, index) => {
264
+ fields.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.rules, children: fields.map((item, index) => {
222
265
  var _a, _b;
223
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
224
- "div",
225
- {
226
- className: import_index.default.container,
227
- "data-set-e2e": "e2eProxyItem",
228
- children: [
229
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
230
- FormItem,
231
- {
232
- field: `${item.field}.checked`,
233
- triggerPropName: "checked",
234
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Checkbox, { className: import_index.default.checkBox })
235
- }
236
- ) }),
237
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.input, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
238
- FormItem,
239
- {
240
- field: `${item.field}.key`,
241
- rules: [
242
- {
243
- validator: (value, cb) => validateKey(value, cb, index)
244
- }
245
- ],
246
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
247
- import_web_react.Select,
248
- {
249
- "data-set-e2e": "e2eProxyKey",
250
- placeholder: "Module Name",
251
- onChange: (key) => onKeyChange(key, index),
252
- allowClear: true,
253
- showSearch: true,
254
- children: formatProducer.map((item2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Option, { value: item2.value, children: item2.label }, item2.value))
255
- }
256
- )
257
- }
258
- ) }),
259
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.input, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
260
- FormItem,
261
- {
262
- field: `${item.field}.value`,
263
- rules: [
264
- {
265
- validator: (value, cb) => validateValue(value, cb, index)
266
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.ruleCard, children: [
267
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.ruleHeader, children: [
268
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
269
+ FormItem,
270
+ {
271
+ field: `${item.field}.checked`,
272
+ triggerPropName: "checked",
273
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Checkbox, { className: import_index.default.toggle })
274
+ }
275
+ ),
276
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
277
+ import_web_react.Button,
278
+ {
279
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconDelete, {}),
280
+ shape: "circle",
281
+ status: "danger",
282
+ className: import_index.default.delete,
283
+ "data-set-e2e": "e2eDelete",
284
+ onClick: () => onRemove(remove, index)
285
+ }
286
+ )
287
+ ] }),
288
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.inputs, "data-set-e2e": "e2eProxyItem", children: [
289
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
290
+ FormItem,
291
+ {
292
+ field: `${item.field}.key`,
293
+ rules: [
294
+ {
295
+ validator: (value, cb) => {
296
+ const isValid = Boolean(value);
297
+ if (isValid) {
298
+ cb();
299
+ validateKey(value, () => {
300
+ }, index);
301
+ } else {
302
+ cb(t("form.validation.moduleNameRequired"));
303
+ validateKey(value, () => {
304
+ }, index);
305
+ }
266
306
  }
267
- ],
268
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
269
- import_web_react.Select,
270
- {
271
- "data-set-e2e": "e2eProxyValue",
272
- placeholder: "Custom Manifest URL",
273
- allowClear: true,
274
- showSearch: true,
275
- allowCreate: true,
276
- children: (_b = (_a = versionList || []) == null ? void 0 : _a[index]) == null ? void 0 : _b.map((version) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Option, { value: version, children: version }, version))
307
+ }
308
+ ],
309
+ className: import_index.default.field,
310
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
311
+ import_web_react.Select,
312
+ {
313
+ "data-set-e2e": "e2eProxyKey",
314
+ placeholder: t("form.fields.moduleName.placeholder"),
315
+ onChange: (key) => onKeyChange(key, index),
316
+ allowClear: true,
317
+ showSearch: true,
318
+ dropdownMenuClassName: import_index.default.dropdown,
319
+ children: formatProducer.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Option, { value: option.value, children: option.label }, option.value))
320
+ }
321
+ )
322
+ }
323
+ ),
324
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
325
+ FormItem,
326
+ {
327
+ field: `${item.field}.value`,
328
+ rules: [
329
+ {
330
+ validator: (value, cb) => {
331
+ const isValid = (0, import_utils.validateCustom)(value) || (0, import_utils.validateSemver)(value) || (0, import_utils.validatePort)(value) || (customValueValidate == null ? void 0 : customValueValidate(value));
332
+ if (isValid) {
333
+ cb();
334
+ validateValue(value, () => {
335
+ }, index);
336
+ } else {
337
+ cb(t("form.validation.moduleInfoInvalid"));
338
+ validateValue(value, () => {
339
+ }, index);
340
+ }
277
341
  }
278
- )
279
- }
280
- ) }),
281
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
282
- import_web_react.Button,
283
- {
284
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconDelete, {}),
285
- shape: "circle",
286
- status: "danger",
287
- className: import_index.default.delete,
288
- "data-set-e2e": "e2eDelete",
289
- onClick: () => onRemove(remove, index)
290
- }
291
- )
292
- ]
293
- },
294
- item.field
295
- );
296
- }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Empty, {})
342
+ }
343
+ ],
344
+ className: import_index.default.field,
345
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
346
+ import_web_react.Select,
347
+ {
348
+ "data-set-e2e": "e2eProxyValue",
349
+ placeholder: t(
350
+ "form.fields.customManifest.placeholder"
351
+ ),
352
+ allowClear: true,
353
+ showSearch: true,
354
+ allowCreate: true,
355
+ dropdownMenuClassName: import_index.default.dropdown,
356
+ children: (_b = (_a = versionList || []) == null ? void 0 : _a[index]) == null ? void 0 : _b.map((version) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Option, { value: version, children: version }, version))
357
+ }
358
+ )
359
+ }
360
+ )
361
+ ] })
362
+ ] }, item.field);
363
+ }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.emptyWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
364
+ import_web_react.Empty,
365
+ {
366
+ description: t("form.empty.description"),
367
+ className: import_index.default.empty
368
+ }
369
+ ) }),
370
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.footerHint, children: t("form.footer.hint") })
297
371
  ] }) });
298
372
  };
299
373
  var Form_default = FormComponent;
@@ -22,4 +22,4 @@ __export(index_module_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(index_module_exports);
24
24
  var import_index_module = require("./index_module.css");
25
- var index_module_default = { "container": "container_20b79", "checkBox": "checkBox_20b79", "input": "input_20b79", "delete": "delete_20b79", "header": "header_20b79", "add": "add_20b79", "title": "title_20b79", "status": "status_20b79", "message": "message_20b79", "switch": "switch_20b79", "headerSlot": "headerSlot_20b79", "badge": "badge_20b79" };
25
+ var index_module_default = { "wrapper": "wrapper_20b79", "sectionHeader": "sectionHeader_20b79", "heading": "heading_20b79", "titleRow": "titleRow_20b79", "title": "title_20b79", "subtitle": "subtitle_20b79", "headerActions": "headerActions_20b79", "badge": "badge_20b79", "statusMessage": "statusMessage_20b79", "divider": "divider_20b79", "hmrArea": "hmrArea_20b79", "switch": "switch_20b79", "rules": "rules_20b79", "ruleCard": "ruleCard_20b79", "ruleHeader": "ruleHeader_20b79", "toggle": "toggle_20b79", "inputs": "inputs_20b79", "field": "field_20b79", "dropdown": "dropdown_20b79", "delete": "delete_20b79", "emptyWrapper": "emptyWrapper_20b79", "empty": "empty_20b79", "footerHint": "footerHint_20b79" };