@ququ-jiaxk/dsh-plugin-center 0.1.50 → 0.1.51

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 (2) hide show
  1. package/lib/client.js +33 -15
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -36,7 +36,7 @@ var logo_default = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" v
36
36
 
37
37
  // src/client.tsx
38
38
  var import_jsx_runtime = require("react/jsx-runtime");
39
- var PLUGIN_VERSION = true ? "0.1.50" : "0.0.0";
39
+ var PLUGIN_VERSION = true ? "0.1.51" : "0.0.0";
40
40
  var PANEL_ID = "plugin-center";
41
41
  var inject = ["slots", "remote", "remote.pluginManager"];
42
42
  var hostCtx = null;
@@ -60,6 +60,9 @@ function localCategory(bundle) {
60
60
  if (bundle.availability === "installation") return "builtin";
61
61
  return "third";
62
62
  }
63
+ function isVisibleBundle(bundle) {
64
+ return (bundle.listedByDefault !== false || bundle.enabled || Boolean(bundle.installed)) && (Boolean(bundle.installed) || Boolean(bundle.official) || Boolean(bundle.error));
65
+ }
63
66
  var panelSnapshot = null;
64
67
  var selfUpdateTarget = null;
65
68
  var selfUpdatePolling = false;
@@ -428,6 +431,7 @@ function InstalledList({
428
431
  experimental ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pcx-badge", children: "\u5B9E\u9A8C\u6027" }) : null,
429
432
  bundle.optional ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pcx-badge", children: "\u53EF\u9009" }) : null,
430
433
  bundle.error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pcx-badge pcx-badge-danger", children: "\u8BFB\u53D6\u5F02\u5E38" }) : null,
434
+ isVisibleBundle(bundle) ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pcx-badge", children: "\u9690\u85CF" }),
431
435
  centerItems.length > 0 && !item ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pcx-badge", children: "\u672A\u4E0A\u67B6" }) : null
432
436
  ] }),
433
437
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "pcx-pkg", children: bundle.name })
@@ -519,6 +523,7 @@ function Panel() {
519
523
  const [total, setTotal] = (0, import_react.useState)(cached?.total ?? 0);
520
524
  const [scope, setScope] = (0, import_react.useState)(cached?.scope ?? "public");
521
525
  const [localFilter, setLocalFilter] = (0, import_react.useState)("all");
526
+ const [localShowHidden, setLocalShowHidden] = (0, import_react.useState)(false);
522
527
  const [category, setCategory] = (0, import_react.useState)(cached?.category ?? "");
523
528
  const [query, setQuery] = (0, import_react.useState)(cached?.query ?? "");
524
529
  const [draft, setDraft] = (0, import_react.useState)(cached?.draft ?? "");
@@ -1359,7 +1364,9 @@ function Panel() {
1359
1364
  )
1360
1365
  ] }),
1361
1366
  scope === "installed" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "pcx-chips", children: (() => {
1362
- const bundles = state?.bundles ?? [];
1367
+ const allBundles = state?.bundles ?? [];
1368
+ const bundles = localShowHidden ? allBundles : allBundles.filter(isVisibleBundle);
1369
+ const hiddenCount = allBundles.length - allBundles.filter(isVisibleBundle).length;
1363
1370
  const counts = {
1364
1371
  all: bundles.length,
1365
1372
  third: 0,
@@ -1382,21 +1389,32 @@ function Panel() {
1382
1389
  ["offered", "\u53EF\u5B89\u88C5"],
1383
1390
  ["disabled", "\u5DF2\u505C\u7528"]
1384
1391
  ];
1385
- return chips.map(
1386
- ([key, label]) => counts[key] ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1392
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1393
+ chips.map(
1394
+ ([key, label]) => counts[key] ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1395
+ "button",
1396
+ {
1397
+ className: `pcx-chip ${localFilter === key ? "pcx-chip-active" : ""}`,
1398
+ onClick: () => setLocalFilter(key),
1399
+ children: [
1400
+ label,
1401
+ " \xB7 ",
1402
+ counts[key]
1403
+ ]
1404
+ },
1405
+ key
1406
+ ) : null
1407
+ ),
1408
+ hiddenCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1387
1409
  "button",
1388
1410
  {
1389
- className: `pcx-chip ${localFilter === key ? "pcx-chip-active" : ""}`,
1390
- onClick: () => setLocalFilter(key),
1391
- children: [
1392
- label,
1393
- " \xB7 ",
1394
- counts[key]
1395
- ]
1396
- },
1397
- key
1411
+ className: `pcx-chip ${localShowHidden ? "pcx-chip-active" : ""}`,
1412
+ title: "DSH \u81EA\u5E26 Plugins \u9875\u9ED8\u8BA4\u4E0D\u663E\u793A\u7684\u5185\u90E8/\u9690\u85CF bundle",
1413
+ onClick: () => setLocalShowHidden((value) => !value),
1414
+ children: localShowHidden ? "\u9690\u85CF\u5185\u90E8\u9879" : `\u663E\u793A\u9690\u85CF\u9879 \xB7 ${hiddenCount}`
1415
+ }
1398
1416
  ) : null
1399
- );
1417
+ ] });
1400
1418
  })() }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pcx-chips", children: [
1401
1419
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: `pcx-chip ${!category ? "pcx-chip-active" : ""}`, onClick: () => applyFilters({ category: "" }), children: "\u5168\u90E8" }),
1402
1420
  CATEGORIES.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -1412,7 +1430,7 @@ function Panel() {
1412
1430
  scope === "installed" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1413
1431
  InstalledList,
1414
1432
  {
1415
- bundles: state?.bundles ?? state?.installed ?? [],
1433
+ bundles: localShowHidden ? state?.bundles ?? state?.installed ?? [] : (state?.bundles ?? state?.installed ?? []).filter(isVisibleBundle),
1416
1434
  centerItems: items,
1417
1435
  query,
1418
1436
  filter: localFilter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ququ-jiaxk/dsh-plugin-center",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
4
4
  "description": "小趣插件中心:浏览、安装、更新和发布远端插件中心的插件",
5
5
  "icon": "logo.svg",
6
6
  "type": "module",