@module-federation/devtools 0.22.1 → 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.
- package/dist/es/App.css +6 -5
- package/dist/es/App.js +191 -59
- package/dist/es/App.module.js +1 -1
- package/dist/es/App_module.css +38 -36
- package/dist/es/component/DependencyGraph/index.js +10 -11
- package/dist/es/component/DependencyGraph/index_module.css +20 -17
- package/dist/es/component/DependencyGraphItem/index.js +5 -3
- package/dist/es/component/DependencyGraphItem/index_module.css +7 -7
- package/dist/es/component/Form/index.js +24 -31
- package/dist/es/component/Form/index.module.js +1 -1
- package/dist/es/component/Form/index_module.css +22 -25
- package/dist/es/component/LanguageSwitch.js +50 -0
- package/dist/es/component/Layout/index.js +6 -10
- package/dist/es/component/Layout/index_module.css +7 -7
- package/dist/es/component/ModuleInfo/index.js +65 -41
- package/dist/es/component/ModuleInfo/index_module.css +12 -11
- package/dist/es/component/SharedDepsExplorer/FocusResultDisplay.js +5 -3
- package/dist/es/component/SharedDepsExplorer/FocusResultDisplay_module.css +5 -5
- package/dist/es/component/SharedDepsExplorer/index.js +64 -75
- package/dist/es/component/SharedDepsExplorer/index_module.css +12 -2
- package/dist/es/component/ThemeToggle.js +19 -0
- package/dist/es/component/ThemeToggle.module.js +5 -0
- package/dist/es/component/ThemeToggle_module.css +12 -0
- package/dist/es/hooks/useDevtoolsTheme.js +77 -0
- package/dist/es/i18n/index.js +506 -0
- package/dist/lib/App.css +6 -5
- package/dist/lib/App.js +189 -59
- package/dist/lib/App.module.js +1 -1
- package/dist/lib/App_module.css +38 -36
- package/dist/lib/component/DependencyGraph/index.js +10 -11
- package/dist/lib/component/DependencyGraph/index_module.css +20 -17
- package/dist/lib/component/DependencyGraphItem/index.js +5 -3
- package/dist/lib/component/DependencyGraphItem/index_module.css +7 -7
- package/dist/lib/component/Form/index.js +24 -31
- package/dist/lib/component/Form/index.module.js +1 -1
- package/dist/lib/component/Form/index_module.css +22 -25
- package/dist/lib/component/LanguageSwitch.js +80 -0
- package/dist/lib/component/Layout/index.js +6 -10
- package/dist/lib/component/Layout/index_module.css +7 -7
- package/dist/lib/component/ModuleInfo/index.js +65 -41
- package/dist/lib/component/ModuleInfo/index_module.css +12 -11
- package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay.js +5 -3
- package/dist/lib/component/SharedDepsExplorer/FocusResultDisplay_module.css +5 -5
- package/dist/lib/component/SharedDepsExplorer/index.js +64 -75
- package/dist/lib/component/SharedDepsExplorer/index_module.css +12 -2
- package/dist/lib/component/ThemeToggle.js +49 -0
- package/dist/lib/component/ThemeToggle.module.js +25 -0
- package/dist/lib/component/ThemeToggle_module.css +12 -0
- package/dist/lib/hooks/useDevtoolsTheme.js +101 -0
- package/dist/lib/i18n/index.js +540 -0
- package/dist/types/src/component/LanguageSwitch.d.ts +2 -0
- package/dist/types/src/component/ThemeToggle.d.ts +8 -0
- package/dist/types/src/hooks/useDevtoolsTheme.d.ts +2 -0
- package/dist/types/src/i18n/index.d.ts +5 -0
- package/package.json +10 -8
|
@@ -55,25 +55,27 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
55
55
|
var import_react = require("react");
|
|
56
56
|
var import_lucide_react = require("lucide-react");
|
|
57
57
|
var import_web_react = require("@arco-design/web-react");
|
|
58
|
+
var import_react_i18next = require("react-i18next");
|
|
58
59
|
var import_share_utils = require("./share-utils");
|
|
59
60
|
var import_FocusResultDisplay = __toESM(require("./FocusResultDisplay"));
|
|
60
61
|
var import_index = __toESM(require("./index.module"));
|
|
61
62
|
const ALL_VALUE = "__all__";
|
|
62
|
-
function loadedStatusLabel(status) {
|
|
63
|
-
if (status === "loaded") {
|
|
64
|
-
return "Loaded";
|
|
65
|
-
}
|
|
66
|
-
if (status === "loading") {
|
|
67
|
-
return "Loading";
|
|
68
|
-
}
|
|
69
|
-
return "Not Loaded";
|
|
70
|
-
}
|
|
71
63
|
function SharedDepsExplorer({
|
|
72
64
|
shareData: shareDataProp
|
|
73
65
|
}) {
|
|
66
|
+
const { t } = (0, import_react_i18next.useTranslation)();
|
|
74
67
|
const [normalized, setNormalized] = (0, import_react.useState)([]);
|
|
75
68
|
const [loadingState, setLoadingState] = (0, import_react.useState)("idle");
|
|
76
69
|
const [errorMessage, setErrorMessage] = (0, import_react.useState)(null);
|
|
70
|
+
const loadedStatusLabelLocal = (status) => {
|
|
71
|
+
if (status === "loaded") {
|
|
72
|
+
return t("sharedDeps.status.loaded");
|
|
73
|
+
}
|
|
74
|
+
if (status === "loading") {
|
|
75
|
+
return t("sharedDeps.status.loading");
|
|
76
|
+
}
|
|
77
|
+
return t("sharedDeps.status.notLoaded");
|
|
78
|
+
};
|
|
77
79
|
const [selectedProvider, setSelectedProvider] = (0, import_react.useState)("");
|
|
78
80
|
const [selectedPackage, setSelectedPackage] = (0, import_react.useState)("");
|
|
79
81
|
const [selectedVersion, setSelectedVersion] = (0, import_react.useState)("");
|
|
@@ -188,7 +190,7 @@ function SharedDepsExplorer({
|
|
|
188
190
|
const hasData = normalized.length > 0;
|
|
189
191
|
const columns = [
|
|
190
192
|
{
|
|
191
|
-
title: "
|
|
193
|
+
title: t("sharedDeps.table.columns.packageVersion"),
|
|
192
194
|
width: "28%",
|
|
193
195
|
render: (_, item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.cellCol, children: [
|
|
194
196
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.packageName, children: item.packageName }),
|
|
@@ -199,21 +201,15 @@ function SharedDepsExplorer({
|
|
|
199
201
|
] })
|
|
200
202
|
},
|
|
201
203
|
{
|
|
202
|
-
title: "
|
|
204
|
+
title: t("sharedDeps.table.columns.providerScope"),
|
|
203
205
|
width: "20%",
|
|
204
206
|
render: (_, item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.cellColGap, children: [
|
|
205
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
206
|
-
|
|
207
|
-
item.from
|
|
208
|
-
] }),
|
|
209
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: import_index.default.scopeText, children: [
|
|
210
|
-
"scope: ",
|
|
211
|
-
item.scope
|
|
212
|
-
] })
|
|
207
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.truncate, title: item.from, children: t("sharedDeps.table.providerPrefix", { name: item.from }) }),
|
|
208
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.scopeText, children: t("sharedDeps.table.scopePrefix", { scope: item.scope }) })
|
|
213
209
|
] })
|
|
214
210
|
},
|
|
215
211
|
{
|
|
216
|
-
title: "
|
|
212
|
+
title: t("sharedDeps.table.columns.status"),
|
|
217
213
|
width: "22%",
|
|
218
214
|
render: (_, item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.cellColGap, children: [
|
|
219
215
|
["loaded", "loading"].includes(item.loadedStatus) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -221,7 +217,7 @@ function SharedDepsExplorer({
|
|
|
221
217
|
{
|
|
222
218
|
size: "small",
|
|
223
219
|
className: `${import_index.default.tagContainer} loaded-status-tag`,
|
|
224
|
-
children:
|
|
220
|
+
children: loadedStatusLabelLocal(item.loadedStatus)
|
|
225
221
|
}
|
|
226
222
|
) : null,
|
|
227
223
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.configTags, children: [
|
|
@@ -236,7 +232,7 @@ function SharedDepsExplorer({
|
|
|
236
232
|
] })
|
|
237
233
|
},
|
|
238
234
|
{
|
|
239
|
-
title: "
|
|
235
|
+
title: t("sharedDeps.table.columns.consumers"),
|
|
240
236
|
width: "18%",
|
|
241
237
|
render: (_, item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
242
238
|
import_web_react.Popover,
|
|
@@ -244,70 +240,71 @@ function SharedDepsExplorer({
|
|
|
244
240
|
trigger: "click",
|
|
245
241
|
position: "right",
|
|
246
242
|
content: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.popoverContent, children: [
|
|
247
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.popoverTitle, children: "
|
|
248
|
-
item.useIn.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: import_index.default.scopeText, children: "
|
|
243
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.popoverTitle, children: t("sharedDeps.consumersPopover.title") }),
|
|
244
|
+
item.useIn.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: import_index.default.scopeText, children: t("sharedDeps.consumersPopover.empty") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: import_index.default.consumerList, children: item.useIn.map((c) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: import_index.default.consumerItem, children: [
|
|
249
245
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.dot }),
|
|
250
246
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.packageName, children: c })
|
|
251
247
|
] }, c)) })
|
|
252
248
|
] }),
|
|
253
249
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Button, { size: "mini", type: "secondary", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.btnContent, children: [
|
|
254
250
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Network, { className: import_index.default.mr1, size: 12 }),
|
|
255
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
256
|
-
item.useIn.length || 0
|
|
257
|
-
|
|
258
|
-
] })
|
|
251
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("sharedDeps.consumersPopover.button", {
|
|
252
|
+
count: item.useIn.length || 0
|
|
253
|
+
}) })
|
|
259
254
|
] }) })
|
|
260
255
|
}
|
|
261
256
|
)
|
|
262
257
|
},
|
|
263
258
|
{
|
|
264
|
-
title: "
|
|
259
|
+
title: t("sharedDeps.table.columns.strategy"),
|
|
265
260
|
width: "12%",
|
|
266
261
|
render: (_, item) => {
|
|
267
262
|
var _a;
|
|
268
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Tag, { size: "small", color: "gray", children: (_a = item.strategy) != null ? _a : "
|
|
263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Tag, { size: "small", color: "gray", children: (_a = item.strategy) != null ? _a : t("sharedDeps.table.strategyFallback") });
|
|
269
264
|
}
|
|
270
265
|
}
|
|
271
266
|
];
|
|
272
267
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.container, children: [
|
|
273
268
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: import_index.default.heroSection, children: [
|
|
274
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: import_index.default.heroSubtitle, children: "
|
|
275
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: import_index.default.heroTitle, children: "
|
|
269
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: import_index.default.heroSubtitle, children: t("sharedDeps.hero.subtitle") }),
|
|
270
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: import_index.default.heroTitle, children: t("sharedDeps.hero.title") })
|
|
276
271
|
] }),
|
|
277
272
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.statsGrid, children: [
|
|
278
273
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_web_react.Card, { className: import_index.default.cardWithPadding, children: [
|
|
279
274
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.cardHeader, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.statSpace, children: [
|
|
280
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.statLabel, children: "
|
|
275
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.statLabel, children: t("sharedDeps.stats.providers.title") }),
|
|
281
276
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.statValue, children: [
|
|
282
277
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Server, { className: import_index.default.icon }),
|
|
283
278
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: stats.totalProviders })
|
|
284
279
|
] })
|
|
285
280
|
] }) }),
|
|
286
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: import_index.default.statDescription, children: "
|
|
281
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: import_index.default.statDescription, children: t("sharedDeps.stats.providers.description") })
|
|
287
282
|
] }),
|
|
288
283
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_web_react.Card, { className: import_index.default.cardWithPadding, children: [
|
|
289
284
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.cardHeader, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.statSpace, children: [
|
|
290
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.statLabel, children: "
|
|
285
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.statLabel, children: t("sharedDeps.stats.scopes.title") }),
|
|
291
286
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.statValue, children: [
|
|
292
287
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Layers, { className: import_index.default.icon }),
|
|
293
288
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: stats.totalScopes }),
|
|
294
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.statSubtext, children: "
|
|
289
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.statSubtext, children: t("sharedDeps.stats.scopes.badge") })
|
|
295
290
|
] })
|
|
296
291
|
] }) }),
|
|
297
292
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.cardFooter, children: [
|
|
298
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${import_index.default.truncate} ${import_index.default.mr2}`, children: "
|
|
293
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${import_index.default.truncate} ${import_index.default.mr2}`, children: t("sharedDeps.stats.scopes.description") }),
|
|
299
294
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: import_index.default.badgeGroup, children: [
|
|
300
295
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Box, { className: import_index.default.iconSmall }),
|
|
301
296
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
302
297
|
stats.totalPackages,
|
|
303
|
-
"
|
|
298
|
+
t("sharedDeps.stats.scopes.packagesBadge", {
|
|
299
|
+
count: stats.totalPackages
|
|
300
|
+
})
|
|
304
301
|
] })
|
|
305
302
|
] })
|
|
306
303
|
] })
|
|
307
304
|
] }),
|
|
308
305
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_web_react.Card, { className: import_index.default.cardWithPadding, children: [
|
|
309
306
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.cardHeader, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.statSpace, children: [
|
|
310
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.statLabel, children: "
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.statLabel, children: t("sharedDeps.stats.versions.title") }),
|
|
311
308
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.statValue, children: [
|
|
312
309
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Package2, { className: import_index.default.icon }),
|
|
313
310
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: stats.totalVersions })
|
|
@@ -316,12 +313,12 @@ function SharedDepsExplorer({
|
|
|
316
313
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.statusTags, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.tagRow, children: [
|
|
317
314
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Tag, { className: `${import_index.default.tagContent} loaded-status-tag`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.tagContent, children: [
|
|
318
315
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Network, { className: `${import_index.default.iconSmall} ${import_index.default.mr1}` }),
|
|
319
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "
|
|
316
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("sharedDeps.stats.versions.loadedLabel") }),
|
|
320
317
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.tagValue, children: stats.loadedCount })
|
|
321
318
|
] }) }),
|
|
322
319
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Tag, { className: `${import_index.default.tagContent} reused-status-tag`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.tagContent, children: [
|
|
323
320
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Repeat, { className: `${import_index.default.iconSmall} ${import_index.default.mr1}` }),
|
|
324
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "
|
|
321
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("sharedDeps.stats.versions.reusedLabel") }) }),
|
|
325
322
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.tagValue, children: stats.reusedCount })
|
|
326
323
|
] }) })
|
|
327
324
|
] }) })
|
|
@@ -333,14 +330,12 @@ function SharedDepsExplorer({
|
|
|
333
330
|
className: import_index.default.card,
|
|
334
331
|
title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.cardTitle, children: [
|
|
335
332
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Box, { className: import_index.default.iconMedium }),
|
|
336
|
-
"
|
|
337
|
-
focusPackage,
|
|
338
|
-
"'?"
|
|
333
|
+
t("sharedDeps.focusPanel.title", { package: focusPackage })
|
|
339
334
|
] }),
|
|
340
335
|
children: [
|
|
341
336
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.controlsGrid, children: [
|
|
342
337
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.inputGroup, children: [
|
|
343
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.inputLabel, children: "
|
|
338
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.inputLabel, children: t("sharedDeps.focusPanel.packageLabel") }),
|
|
344
339
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
345
340
|
import_web_react.Select,
|
|
346
341
|
{
|
|
@@ -350,24 +345,24 @@ function SharedDepsExplorer({
|
|
|
350
345
|
setFocusPackage(value);
|
|
351
346
|
setFocusVersion("");
|
|
352
347
|
},
|
|
353
|
-
placeholder: "
|
|
348
|
+
placeholder: t("sharedDeps.focusPanel.packagePlaceholder"),
|
|
354
349
|
className: import_index.default.fullWidth,
|
|
355
350
|
children: filterOptions.packages.map((name) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Select.Option, { value: name, children: name }, name))
|
|
356
351
|
}
|
|
357
352
|
)
|
|
358
353
|
] }),
|
|
359
354
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.inputGroup, children: [
|
|
360
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.inputLabel, children: "
|
|
355
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.inputLabel, children: t("sharedDeps.focusPanel.versionLabel") }),
|
|
361
356
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
362
357
|
import_web_react.Select,
|
|
363
358
|
{
|
|
364
359
|
showSearch: true,
|
|
365
360
|
value: focusVersion || ALL_VALUE,
|
|
366
361
|
onChange: (value) => setFocusVersion(value === ALL_VALUE ? "" : value),
|
|
367
|
-
placeholder: "
|
|
362
|
+
placeholder: t("sharedDeps.focusPanel.versionPlaceholder"),
|
|
368
363
|
className: import_index.default.fullWidth,
|
|
369
364
|
children: [
|
|
370
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Select.Option, { value: ALL_VALUE, children: "
|
|
365
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Select.Option, { value: ALL_VALUE, children: t("sharedDeps.focusPanel.versionAllOption") }),
|
|
371
366
|
focusVersionsForPackage.map((v) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Select.Option, { value: v, children: v }, v))
|
|
372
367
|
]
|
|
373
368
|
}
|
|
@@ -379,7 +374,7 @@ function SharedDepsExplorer({
|
|
|
379
374
|
{
|
|
380
375
|
focusResult,
|
|
381
376
|
hasData,
|
|
382
|
-
loadedStatusLabel
|
|
377
|
+
loadedStatusLabel: loadedStatusLabelLocal
|
|
383
378
|
}
|
|
384
379
|
) })
|
|
385
380
|
]
|
|
@@ -391,18 +386,18 @@ function SharedDepsExplorer({
|
|
|
391
386
|
className: import_index.default.card,
|
|
392
387
|
title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.cardTitle, children: [
|
|
393
388
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Search, { className: import_index.default.iconMedium }),
|
|
394
|
-
"
|
|
389
|
+
t("sharedDeps.filters.cardTitle")
|
|
395
390
|
] }),
|
|
396
391
|
children: [
|
|
397
392
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.filterGrid, children: [
|
|
398
393
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `${import_index.default.inputGroup} ${import_index.default.padding2}`, children: [
|
|
399
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.inputLabel, children: "
|
|
394
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.inputLabel, children: t("sharedDeps.filters.providerLabel") }),
|
|
400
395
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
401
396
|
import_web_react.Select,
|
|
402
397
|
{
|
|
403
398
|
value: selectedProvider || void 0,
|
|
404
399
|
onChange: (value) => setSelectedProvider(value === ALL_VALUE ? "" : value),
|
|
405
|
-
placeholder: "
|
|
400
|
+
placeholder: t("sharedDeps.filters.providerPlaceholder"),
|
|
406
401
|
className: import_index.default.fullWidth,
|
|
407
402
|
allowClear: true,
|
|
408
403
|
children: filterOptions.providers.map((p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Select.Option, { value: p, children: p }, p))
|
|
@@ -410,13 +405,13 @@ function SharedDepsExplorer({
|
|
|
410
405
|
)
|
|
411
406
|
] }),
|
|
412
407
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `${import_index.default.inputGroup} ${import_index.default.padding2}`, children: [
|
|
413
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.inputLabel, children: "
|
|
408
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.inputLabel, children: t("sharedDeps.filters.packageLabel") }),
|
|
414
409
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
415
410
|
import_web_react.Select,
|
|
416
411
|
{
|
|
417
412
|
value: selectedPackage || void 0,
|
|
418
413
|
onChange: (value) => setSelectedPackage(value === ALL_VALUE ? "" : value),
|
|
419
|
-
placeholder: "
|
|
414
|
+
placeholder: t("sharedDeps.filters.packagePlaceholder"),
|
|
420
415
|
className: import_index.default.fullWidth,
|
|
421
416
|
allowClear: true,
|
|
422
417
|
children: filterOptions.packages.map((name) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Select.Option, { value: name, children: name }, name))
|
|
@@ -424,13 +419,13 @@ function SharedDepsExplorer({
|
|
|
424
419
|
)
|
|
425
420
|
] }),
|
|
426
421
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `${import_index.default.inputGroup} ${import_index.default.padding2}`, children: [
|
|
427
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.inputLabel, children: "
|
|
422
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.inputLabel, children: t("sharedDeps.filters.versionLabel") }),
|
|
428
423
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
429
424
|
import_web_react.Select,
|
|
430
425
|
{
|
|
431
426
|
value: selectedVersion || void 0,
|
|
432
427
|
onChange: (value) => setSelectedVersion(value === ALL_VALUE ? "" : value),
|
|
433
|
-
placeholder: "
|
|
428
|
+
placeholder: t("sharedDeps.filters.versionPlaceholder"),
|
|
434
429
|
className: import_index.default.fullWidth,
|
|
435
430
|
disabled: !selectedPackage,
|
|
436
431
|
allowClear: true,
|
|
@@ -441,30 +436,26 @@ function SharedDepsExplorer({
|
|
|
441
436
|
] }),
|
|
442
437
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.searchGrid, children: [
|
|
443
438
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.inputGroup, children: [
|
|
444
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.inputLabel, children: "
|
|
439
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.inputLabel, children: t("sharedDeps.filters.keywordLabel") }),
|
|
445
440
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
446
441
|
import_web_react.Input,
|
|
447
442
|
{
|
|
448
443
|
prefix: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Search, { className: import_index.default.iconMedium }),
|
|
449
444
|
className: import_index.default.searchInput,
|
|
450
|
-
placeholder: "
|
|
445
|
+
placeholder: t("sharedDeps.filters.keywordPlaceholder"),
|
|
451
446
|
value: searchText,
|
|
452
447
|
onChange: (val) => setSearchText(val)
|
|
453
448
|
}
|
|
454
449
|
)
|
|
455
450
|
] }),
|
|
456
451
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.matchCount, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
457
|
-
"
|
|
452
|
+
t("sharedDeps.filters.matchCountLabel"),
|
|
458
453
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: import_index.default.matchValue, children: filteredVersions.length })
|
|
459
454
|
] }) })
|
|
460
455
|
] }),
|
|
461
|
-
!hasData && loadingState === "loading" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.loadingText, children: "
|
|
462
|
-
loadingState === "error" && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
463
|
-
|
|
464
|
-
" ",
|
|
465
|
-
errorMessage != null ? errorMessage : "Unknown Error"
|
|
466
|
-
] }),
|
|
467
|
-
hasData && Object.keys(tree).length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.noMatchText, children: "No matching shared dependency versions under current filter conditions, try relaxing the filter conditions." }),
|
|
456
|
+
!hasData && loadingState === "loading" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.loadingText, children: t("sharedDeps.messages.loading") }),
|
|
457
|
+
loadingState === "error" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.errorText, children: errorMessage ? t("sharedDeps.messages.error", { message: errorMessage }) : t("sharedDeps.messages.errorUnknown") }),
|
|
458
|
+
hasData && Object.keys(tree).length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.noMatchText, children: t("sharedDeps.messages.noMatch") }),
|
|
468
459
|
hasData && Object.keys(tree).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.treeContainer, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.collapseWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_web_react.Collapse, { children: Object.entries(tree).map(([provider, scopes]) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
469
460
|
import_web_react.Collapse.Item,
|
|
470
461
|
{
|
|
@@ -474,20 +465,18 @@ function SharedDepsExplorer({
|
|
|
474
465
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Server, { className: import_index.default.iconMedium }),
|
|
475
466
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: provider })
|
|
476
467
|
] }),
|
|
477
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.providerMeta, children: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
] }) })
|
|
468
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.providerMeta, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("sharedDeps.filters.scopeCount", {
|
|
469
|
+
count: Object.keys(scopes).length
|
|
470
|
+
}) }) })
|
|
481
471
|
] }),
|
|
482
472
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.scopeList, children: Object.entries(scopes).map(([scopeName, packages]) => {
|
|
483
473
|
const list = Object.values(packages).flat();
|
|
484
474
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.scopeItem, children: [
|
|
485
475
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: import_index.default.scopeHeader, children: [
|
|
486
476
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Layers, { className: import_index.default.iconSmall }),
|
|
487
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
] })
|
|
477
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("sharedDeps.filters.scopePrefix", {
|
|
478
|
+
name: scopeName
|
|
479
|
+
}) })
|
|
491
480
|
] }),
|
|
492
481
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: import_index.default.tableContainer, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
493
482
|
import_web_react.Table,
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
.resultBox_967de {
|
|
228
228
|
border-radius: 6px;
|
|
229
229
|
border: 1px dashed #e4e4e7;
|
|
230
|
-
background-color: #f9fafb;
|
|
230
|
+
background-color: var(--color-bg-1, #f9fafb) !important;
|
|
231
231
|
padding: 8px 12px;
|
|
232
232
|
font-size: 12px;
|
|
233
233
|
}
|
|
@@ -366,6 +366,16 @@
|
|
|
366
366
|
border: 1px solid #e4e4e7;
|
|
367
367
|
background-color: rgba(249, 250, 251, 0.4);
|
|
368
368
|
}
|
|
369
|
+
.tableContainer_967de .arco-table-hover .arco-table-tr:not(.arco-table-empty-row):hover .arco-table-td:not(.arco-table-col-fixed-left):not(.arco-table-col-fixed-right) {
|
|
370
|
+
background-color: var(--color-fill-2, #f2f3f5) !important;
|
|
371
|
+
}
|
|
372
|
+
.arco-theme-dark .tableContainer_967de .arco-table-hover
|
|
373
|
+
.arco-table-tr:not(.arco-table-empty-row):hover
|
|
374
|
+
.arco-table-td:not(.arco-table-col-fixed-left):not(
|
|
375
|
+
.arco-table-col-fixed-right
|
|
376
|
+
) {
|
|
377
|
+
background-color: var(--color-bg-4) !important;
|
|
378
|
+
}
|
|
369
379
|
|
|
370
380
|
.cellCol_967de {
|
|
371
381
|
display: flex;
|
|
@@ -376,7 +386,7 @@
|
|
|
376
386
|
word-break: break-all;
|
|
377
387
|
font-family: monospace;
|
|
378
388
|
font-size: 11px;
|
|
379
|
-
color: #27272a;
|
|
389
|
+
color: var(--color-neutral-10, #27272a) !important;
|
|
380
390
|
}
|
|
381
391
|
|
|
382
392
|
.version_967de {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var ThemeToggle_exports = {};
|
|
30
|
+
__export(ThemeToggle_exports, {
|
|
31
|
+
default: () => ThemeToggle_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(ThemeToggle_exports);
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var import_web_react = require("@arco-design/web-react");
|
|
36
|
+
var import_icon = require("@arco-design/web-react/icon");
|
|
37
|
+
var import_ThemeToggle = __toESM(require("./ThemeToggle.module"));
|
|
38
|
+
const ThemeToggle = ({ theme, onToggle }) => {
|
|
39
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
40
|
+
import_web_react.Button,
|
|
41
|
+
{
|
|
42
|
+
className: import_ThemeToggle.default.themeToggle,
|
|
43
|
+
size: "default",
|
|
44
|
+
onClick: onToggle,
|
|
45
|
+
icon: theme === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconSun, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.IconMoon, {})
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
var ThemeToggle_default = ThemeToggle;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var ThemeToggle_module_exports = {};
|
|
20
|
+
__export(ThemeToggle_module_exports, {
|
|
21
|
+
default: () => ThemeToggle_module_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(ThemeToggle_module_exports);
|
|
24
|
+
var import_ThemeToggle_module = require("./ThemeToggle_module.css");
|
|
25
|
+
var ThemeToggle_module_default = { "themeToggle": "themeToggle_2452c" };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
.themeToggle_2452c {
|
|
2
|
+
background-color: transparent !important;
|
|
3
|
+
border-color: transparent !important;
|
|
4
|
+
margin: 0 6px !important;
|
|
5
|
+
padding: 0 !important;
|
|
6
|
+
}
|
|
7
|
+
.themeToggle_2452c:hover {
|
|
8
|
+
background-color: var(--color-fill-3, #fafafa) !important;
|
|
9
|
+
}
|
|
10
|
+
.arco-theme-dark .themeToggle_2452c :hover {
|
|
11
|
+
background-color: var(--color-bg-1) !important;
|
|
12
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var useDevtoolsTheme_exports = {};
|
|
20
|
+
__export(useDevtoolsTheme_exports, {
|
|
21
|
+
useDevtoolsTheme: () => useDevtoolsTheme
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useDevtoolsTheme_exports);
|
|
24
|
+
var import_react = require("react");
|
|
25
|
+
const DARK_MEDIA_QUERY = "(prefers-color-scheme: dark)";
|
|
26
|
+
function resolveThemeFromDevtools() {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
if (typeof window === "undefined") {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const devtools = (_a = window.chrome) == null ? void 0 : _a.devtools;
|
|
32
|
+
const themeName = (_b = devtools == null ? void 0 : devtools.panels) == null ? void 0 : _b.themeName;
|
|
33
|
+
if (typeof themeName === "string") {
|
|
34
|
+
return themeName.toLowerCase().includes("dark") ? "dark" : "light";
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
function resolveThemeFromMedia() {
|
|
39
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return window.matchMedia(DARK_MEDIA_QUERY).matches ? "dark" : "light";
|
|
43
|
+
}
|
|
44
|
+
function getInitialTheme() {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
return (_b = (_a = resolveThemeFromDevtools()) != null ? _a : resolveThemeFromMedia()) != null ? _b : "light";
|
|
47
|
+
}
|
|
48
|
+
const useDevtoolsTheme = () => {
|
|
49
|
+
const [theme, setTheme] = (0, import_react.useState)(() => getInitialTheme());
|
|
50
|
+
(0, import_react.useEffect)(() => {
|
|
51
|
+
var _a;
|
|
52
|
+
if (typeof window === "undefined") {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const devtools = (_a = window.chrome) == null ? void 0 : _a.devtools;
|
|
56
|
+
const panels = devtools == null ? void 0 : devtools.panels;
|
|
57
|
+
const onThemeChanged = panels == null ? void 0 : panels.onThemeChanged;
|
|
58
|
+
const handleThemeChange = (newThemeName) => {
|
|
59
|
+
if (typeof newThemeName !== "string") {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const next = newThemeName.toLowerCase().includes("dark") ? "dark" : "light";
|
|
63
|
+
setTheme(next);
|
|
64
|
+
};
|
|
65
|
+
const fromDevtools = resolveThemeFromDevtools();
|
|
66
|
+
if (fromDevtools) {
|
|
67
|
+
setTheme(fromDevtools);
|
|
68
|
+
}
|
|
69
|
+
let mediaQuery = null;
|
|
70
|
+
const handleMediaQueryChange = (event) => {
|
|
71
|
+
setTheme(event.matches ? "dark" : "light");
|
|
72
|
+
};
|
|
73
|
+
if (onThemeChanged && typeof onThemeChanged.addListener === "function") {
|
|
74
|
+
onThemeChanged.addListener(handleThemeChange);
|
|
75
|
+
} else if (typeof window.matchMedia === "function") {
|
|
76
|
+
mediaQuery = window.matchMedia(DARK_MEDIA_QUERY);
|
|
77
|
+
if (typeof mediaQuery.addEventListener === "function") {
|
|
78
|
+
mediaQuery.addEventListener("change", handleMediaQueryChange);
|
|
79
|
+
} else if (typeof mediaQuery.addListener === "function") {
|
|
80
|
+
mediaQuery.addListener(handleMediaQueryChange);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return () => {
|
|
84
|
+
if (onThemeChanged && typeof onThemeChanged.removeListener === "function") {
|
|
85
|
+
onThemeChanged.removeListener(handleThemeChange);
|
|
86
|
+
}
|
|
87
|
+
if (mediaQuery) {
|
|
88
|
+
if (typeof mediaQuery.removeEventListener === "function") {
|
|
89
|
+
mediaQuery.removeEventListener("change", handleMediaQueryChange);
|
|
90
|
+
} else if (typeof mediaQuery.removeListener === "function") {
|
|
91
|
+
mediaQuery.removeListener(handleMediaQueryChange);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}, []);
|
|
96
|
+
return theme;
|
|
97
|
+
};
|
|
98
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
99
|
+
0 && (module.exports = {
|
|
100
|
+
useDevtoolsTheme
|
|
101
|
+
});
|