@xrxs-ai/dsh-xrxs-plugins-store 0.2.6 → 0.2.8
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/lib/client.js +142 -80
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -30,10 +30,10 @@ __export(index_exports, {
|
|
|
30
30
|
inject: () => inject
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(index_exports);
|
|
33
|
-
var
|
|
33
|
+
var import_react13 = require("react");
|
|
34
34
|
|
|
35
35
|
// src/client/MarketplaceApp.tsx
|
|
36
|
-
var
|
|
36
|
+
var import_react10 = require("react");
|
|
37
37
|
|
|
38
38
|
// src/client/pages/DeveloperPage.tsx
|
|
39
39
|
var import_react4 = require("react");
|
|
@@ -933,14 +933,29 @@ var MARKET_CSS = `
|
|
|
933
933
|
font-size: 13px; line-height: 18px; color: var(--dsw-alias-label-tertiary, #8f959e);
|
|
934
934
|
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
935
935
|
}
|
|
936
|
+
/* \u884C\u5C3E\u5143\u4FE1\u606F\u6309\u56FA\u5B9A\u56DB\u5217\u6392(\u7248\u672C / \u4E0B\u8F7D\u91CF / \u517C\u5BB9\u6027 / \u64CD\u4F5C),\u9010\u5217\u4E0E\u4E0A\u4E0B\u884C\u5BF9\u9F50:
|
|
937
|
+
\u82E5\u7528\u53F3\u5BF9\u9F50 flex,\u672B\u5217(\u6309\u94AE\u6216\u300C\u5DF2\u5B89\u88C5\u300D\u5FBD\u6807)\u5BBD\u5EA6\u4E0D\u540C\u4F1A\u628A\u5DE6\u8FB9\u6240\u6709\u5217\u4E00\u8D77\u63A8\u7740\u5DE6\u53F3\u6D6E\u52A8\u3002
|
|
938
|
+
\u64CD\u4F5C\u5217 minmax(74px, max-content):\u5E38\u6001 74px \u5BF9\u9F50;\u70B9\u51FA\u300C\u786E\u8BA4\u5B89\u88C5 + \u53D6\u6D88\u300D\u5185\u8054\u786E\u8BA4\u65F6
|
|
939
|
+
\u8BE5\u5217\u4E34\u65F6\u53D8\u5BBD(\u53EA\u5F71\u54CD\u672C\u884C),\u907F\u514D\u786E\u8BA4\u6309\u94AE\u5411\u5DE6\u6EA2\u51FA\u538B\u4F4F\u517C\u5BB9\u6027\u5FBD\u6807 */
|
|
936
940
|
.xps-mk-row-meta {
|
|
937
|
-
flex: none;
|
|
941
|
+
flex: none;
|
|
942
|
+
display: grid;
|
|
943
|
+
grid-template-columns: 140px 56px minmax(64px, auto) minmax(74px, max-content);
|
|
944
|
+
align-items: center;
|
|
945
|
+
justify-items: end;
|
|
946
|
+
column-gap: 8px;
|
|
938
947
|
font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary, #8f959e);
|
|
939
948
|
}
|
|
949
|
+
.xps-mk-row-meta > * { min-width: 0; }
|
|
940
950
|
.xps-mk-row-version {
|
|
941
951
|
font-variant-numeric: tabular-nums;
|
|
942
952
|
font-family: var(--dsw-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
|
|
953
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
943
954
|
}
|
|
955
|
+
.xps-mk-row-downloads { font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
956
|
+
/* \u517C\u5BB9\u6027\u5FBD\u6807\u5217\u5BBD\u56FA\u5B9A:\u8D85\u957F compatRange \u7684\u4E0D\u6362\u884C\u5FBD\u6807\u5217\u5185\u53F3\u5BF9\u9F50,\u6EA2\u51FA\u65F6\u5411\u5DE6\u8BA9\u4F4D(\u4E0D\u628A\u5217\u6491\u5BBD) */
|
|
957
|
+
.xps-mk-row-compat { display: inline-flex; justify-content: flex-end; }
|
|
958
|
+
.xps-mk-row-action { display: inline-flex; justify-content: flex-end; }
|
|
944
959
|
/* \u56FE\u6807:r11;\u5F69\u8272\u6E10\u53D8\u7531 PluginIcon \u5185\u8054 gradient,\u65E0 hairline */
|
|
945
960
|
/* \u56FE\u6807:r10(\u4E0E\u5DF2\u88C5\u9875 .xps-row-icon \u7684 40px \u5706\u89D2\u4E00\u81F4) */
|
|
946
961
|
.xps-mk-icon {
|
|
@@ -1003,7 +1018,7 @@ var MARKET_CSS = `
|
|
|
1003
1018
|
font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary, #8f959e);
|
|
1004
1019
|
}
|
|
1005
1020
|
.xps-mk-install { flex: none; display: inline-flex; }
|
|
1006
|
-
.xps-mk-confirm { display: inline-flex; gap: 4px; align-items: center; }
|
|
1021
|
+
.xps-mk-confirm { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
|
|
1007
1022
|
|
|
1008
1023
|
/* \u8BE6\u60C5\u9875:\u8FD4\u56DE\u94FE\u63A5 12.5 tertiary,hover \u8F6C\u4E3B\u6587\u8272 */
|
|
1009
1024
|
.xps-mk-back { margin-bottom: 12px; }
|
|
@@ -1079,6 +1094,17 @@ var MARKET_CSS = `
|
|
|
1079
1094
|
cursor: pointer; text-decoration: none;
|
|
1080
1095
|
}
|
|
1081
1096
|
.xps-md-link:hover { text-decoration: underline; }
|
|
1097
|
+
/* README \u56FE\u7247:\u4E0D\u8D85\u51FA\u6B63\u6587\u5BBD(\u5FBD\u6807\u7C7B\u5C0F\u56FE\u4FDD\u6301\u539F\u59CB\u5C3A\u5BF8);\u52A0\u8F7D\u5931\u8D25\u964D\u7EA7\u4E3A\u7070\u8272\u6587\u672C */
|
|
1098
|
+
.xps-md-img {
|
|
1099
|
+
max-width: 100%; height: auto;
|
|
1100
|
+
border-radius: 6px; vertical-align: middle;
|
|
1101
|
+
}
|
|
1102
|
+
.xps-md-img-fallback {
|
|
1103
|
+
display: inline-block; padding: 0 4px;
|
|
1104
|
+
font-size: 12px; color: var(--dsw-alias-label-tertiary, #8f959e);
|
|
1105
|
+
background: var(--dsw-alias-bg-layer-2, #f5f6f7);
|
|
1106
|
+
border-radius: 4px;
|
|
1107
|
+
}
|
|
1082
1108
|
.xps-md-table-wrap { margin: 8px 0; overflow-x: auto; }
|
|
1083
1109
|
.xps-md-table {
|
|
1084
1110
|
border-collapse: collapse; width: 100%; font-size: 12px; line-height: 1.6;
|
|
@@ -1791,7 +1817,7 @@ function UploadForm(props) {
|
|
|
1791
1817
|
] }),
|
|
1792
1818
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("li", { children: [
|
|
1793
1819
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("b", { children: "README \u8BF7\u5C3D\u91CF\u5199\u6E05\u695A:" }),
|
|
1794
|
-
"README \u662F\u5E02\u573A\u8BE6\u60C5\u9875\u7684\u5168\u90E8\u5C55\u793A\u5185\u5BB9,\u652F\u6301\u6807\u51C6 markdown(\u6807\u9898\u3001\u5217\u8868\u3001\u8868\u683C\u3001\u4EE3\u7801\u5757\u3001\u94FE\u63A5)\u3002\u5EFA\u8BAE\u5305\u542B:\u63D2\u4EF6\u89E3\u51B3\u4EC0\u4E48\u95EE\u9898\u3001\u5982\u4F55\u5B89\u88C5\u542F\u7528\u3001\u5404\u529F\u80FD\u600E\u4E48\u7528\u3001\u6709\u54EA\u4E9B\u914D\u7F6E\u9879\u4E0E\u6CE8\u610F\u4E8B\u9879 \u2014\u2014 \u8BF4\u660E\u8D8A\u5B8C\u6574,\u8D8A\u5BB9\u6613\u901A\u8FC7\u5BA1\u6838,\u4E5F\u8D8A\u5BB9\u6613\u88AB\u4F7F\u7528\u3002"
|
|
1820
|
+
"README \u662F\u5E02\u573A\u8BE6\u60C5\u9875\u7684\u5168\u90E8\u5C55\u793A\u5185\u5BB9,\u652F\u6301\u6807\u51C6 markdown(\u6807\u9898\u3001\u5217\u8868\u3001\u8868\u683C\u3001\u4EE3\u7801\u5757\u3001\u94FE\u63A5\u3001\u56FE\u7247 \u2014\u2014 \u56FE\u7247\u4EC5\u652F\u6301 http/https \u5916\u94FE,\u4E0D\u652F\u6301\u76F8\u5BF9\u8DEF\u5F84)\u3002\u5EFA\u8BAE\u5305\u542B:\u63D2\u4EF6\u89E3\u51B3\u4EC0\u4E48\u95EE\u9898\u3001\u5982\u4F55\u5B89\u88C5\u542F\u7528\u3001\u5404\u529F\u80FD\u600E\u4E48\u7528\u3001\u6709\u54EA\u4E9B\u914D\u7F6E\u9879\u4E0E\u6CE8\u610F\u4E8B\u9879 \u2014\u2014 \u8BF4\u660E\u8D8A\u5B8C\u6574,\u8D8A\u5BB9\u6613\u901A\u8FC7\u5BA1\u6838,\u4E5F\u8D8A\u5BB9\u6613\u88AB\u4F7F\u7528\u3002"
|
|
1795
1821
|
] }),
|
|
1796
1822
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("li", { children: [
|
|
1797
1823
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("b", { children: "\u4EA7\u7269\u5305(*.tgz):" }),
|
|
@@ -2701,6 +2727,8 @@ function PluginRow(props) {
|
|
|
2701
2727
|
const compat = checkCompat(p.compatRange, props.dshVersion);
|
|
2702
2728
|
const installed = props.installed;
|
|
2703
2729
|
const upToDate = installed !== void 0 && !installed.updateAvailable;
|
|
2730
|
+
const versionLabel = installed !== void 0 && installed.updateAvailable ? `v${installed.version} \u2192 v${p.version}` : `v${p.version}`;
|
|
2731
|
+
const versionTitle = installed !== void 0 && installed.updateAvailable ? `\u672C\u673A\u5DF2\u5B89\u88C5 v${installed.version},\u53EF\u66F4\u65B0\u5230\u5E02\u573A\u6700\u65B0 v${p.version}` : `\u5E02\u573A\u6700\u65B0\u7248\u672C v${p.version}`;
|
|
2704
2732
|
const open = () => props.onOpen?.(p.id);
|
|
2705
2733
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2706
2734
|
"div",
|
|
@@ -2724,23 +2752,16 @@ function PluginRow(props) {
|
|
|
2724
2752
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "xps-mk-row-summary", children: p.summary })
|
|
2725
2753
|
] }),
|
|
2726
2754
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "xps-mk-row-meta", children: [
|
|
2727
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.
|
|
2728
|
-
|
|
2729
|
-
p.version
|
|
2730
|
-
] }),
|
|
2731
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { title: `\u4E0B\u8F7D\u91CF ${p.downloads}`, children: [
|
|
2755
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "xps-mk-row-version", title: versionTitle, children: versionLabel }),
|
|
2756
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "xps-mk-row-downloads", title: `\u4E0B\u8F7D\u91CF ${p.downloads}`, children: [
|
|
2732
2757
|
"\u2B07 ",
|
|
2733
2758
|
formatDownloads(p.downloads)
|
|
2734
2759
|
] }),
|
|
2735
|
-
compat.ok === null ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Badge, { children: "? \u517C\u5BB9\u6027\u672A\u77E5" }) : compat.ok ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Badge, { tone: "success", children: "\u2714 \u517C\u5BB9\u672C\u673A" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Badge, { tone: "warning", children: [
|
|
2760
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "xps-mk-row-compat", children: compat.ok === null ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Badge, { children: "? \u517C\u5BB9\u6027\u672A\u77E5" }) : compat.ok ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Badge, { tone: "success", children: "\u2714 \u517C\u5BB9\u672C\u673A" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Badge, { tone: "warning", children: [
|
|
2736
2761
|
"\u26A0 \u9700 dsh ",
|
|
2737
2762
|
p.compatRange
|
|
2738
|
-
] }),
|
|
2739
|
-
|
|
2740
|
-
"\u2191 \u53EF\u66F4\u65B0 v",
|
|
2741
|
-
installed.version
|
|
2742
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Badge, { tone: "success", children: "\u2713 \u5DF2\u5B89\u88C5" })),
|
|
2743
|
-
!upToDate && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2763
|
+
] }) }),
|
|
2764
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "xps-mk-row-action", children: upToDate ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Badge, { tone: "success", children: "\u2713 \u5DF2\u5B89\u88C5" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2744
2765
|
InstallButton,
|
|
2745
2766
|
{
|
|
2746
2767
|
pluginName: p.name,
|
|
@@ -2753,7 +2774,7 @@ function PluginRow(props) {
|
|
|
2753
2774
|
size: "small",
|
|
2754
2775
|
onToast: props.onToast
|
|
2755
2776
|
}
|
|
2756
|
-
)
|
|
2777
|
+
) })
|
|
2757
2778
|
] })
|
|
2758
2779
|
]
|
|
2759
2780
|
}
|
|
@@ -3011,9 +3032,10 @@ function MarketPage(props) {
|
|
|
3011
3032
|
}
|
|
3012
3033
|
|
|
3013
3034
|
// src/client/pages/PluginDetailPage.tsx
|
|
3014
|
-
var
|
|
3035
|
+
var import_react9 = require("react");
|
|
3015
3036
|
|
|
3016
3037
|
// src/client/pages/market/Markdown.tsx
|
|
3038
|
+
var import_react8 = require("react");
|
|
3017
3039
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3018
3040
|
function Markdown(props) {
|
|
3019
3041
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "xps-md", children: renderBlocks(props.text) });
|
|
@@ -3151,16 +3173,80 @@ function renderBlocks(text, depth = 0) {
|
|
|
3151
3173
|
}
|
|
3152
3174
|
return blocks;
|
|
3153
3175
|
}
|
|
3176
|
+
function MarkdownImage(props) {
|
|
3177
|
+
const [failed, setFailed] = (0, import_react8.useState)(false);
|
|
3178
|
+
(0, import_react8.useEffect)(() => setFailed(false), [props.src]);
|
|
3179
|
+
if (failed) {
|
|
3180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "xps-md-img-fallback", title: props.alt, children: props.alt === "" ? "[\u56FE\u7247\u52A0\u8F7D\u5931\u8D25]" : `[\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:${props.alt}]` });
|
|
3181
|
+
}
|
|
3182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3183
|
+
"img",
|
|
3184
|
+
{
|
|
3185
|
+
className: "xps-md-img",
|
|
3186
|
+
src: props.src,
|
|
3187
|
+
alt: props.alt,
|
|
3188
|
+
loading: "lazy",
|
|
3189
|
+
referrerPolicy: "no-referrer",
|
|
3190
|
+
onError: () => setFailed(true)
|
|
3191
|
+
}
|
|
3192
|
+
);
|
|
3193
|
+
}
|
|
3194
|
+
function renderLink(url, content, key) {
|
|
3195
|
+
if (!/^https?:\/\//.test(url)) return null;
|
|
3196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3197
|
+
"span",
|
|
3198
|
+
{
|
|
3199
|
+
className: "xps-md-link",
|
|
3200
|
+
role: "link",
|
|
3201
|
+
tabIndex: 0,
|
|
3202
|
+
onClick: () => void window.open(url, "_blank", "noopener,noreferrer"),
|
|
3203
|
+
onKeyDown: (event) => {
|
|
3204
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
3205
|
+
event.preventDefault();
|
|
3206
|
+
void window.open(url, "_blank", "noopener,noreferrer");
|
|
3207
|
+
}
|
|
3208
|
+
},
|
|
3209
|
+
children: content
|
|
3210
|
+
},
|
|
3211
|
+
key
|
|
3212
|
+
);
|
|
3213
|
+
}
|
|
3154
3214
|
function renderInline(text, keyPrefix) {
|
|
3155
3215
|
const nodes = [];
|
|
3156
|
-
const pattern = /(
|
|
3216
|
+
const pattern = /(\[!\[[^\]]*\]\(\s*[^()\s]*(?:\([^()\s]*\)[^()\s]*)?\s*\)\]\(\s*[^()\s]*(?:\([^()\s]*\)[^()\s]*)?\s*\)|!\[[^\]]*\]\(\s*[^()\s]*(?:\([^()\s]*\)[^()\s]*)?\s*\)|\*\*[^*]+\*\*|~~[^~]+~~|`[^`]+`|\[[^\]]*\]\(\s*[^()\s]*(?:\([^()\s]*\)[^()\s]*)?\s*\))/g;
|
|
3157
3217
|
let last = 0;
|
|
3158
3218
|
let seq = 0;
|
|
3159
3219
|
let m;
|
|
3160
3220
|
while ((m = pattern.exec(text)) !== null) {
|
|
3161
3221
|
if (m.index > last) nodes.push(text.slice(last, m.index));
|
|
3162
3222
|
const token = m[0];
|
|
3163
|
-
if (token.startsWith("
|
|
3223
|
+
if (token.startsWith("[;
|
|
3225
|
+
const inner = token.slice(1, split);
|
|
3226
|
+
const href = token.slice(split + 2, -1).trim();
|
|
3227
|
+
const image = /^!\[([^\]]*)\]\(([\s\S]*)\)$/.exec(inner);
|
|
3228
|
+
if (image === null) {
|
|
3229
|
+
nodes.push(token);
|
|
3230
|
+
} else {
|
|
3231
|
+
const [, alt = "", rawSrc = ""] = image;
|
|
3232
|
+
const src = rawSrc.trim();
|
|
3233
|
+
const picture = /^https?:\/\//.test(src) ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MarkdownImage, { src, alt }, `${keyPrefix}-nimg${seq}`) : alt === "" ? token : alt;
|
|
3234
|
+
nodes.push(renderLink(href, picture, `${keyPrefix}-na${seq}`) ?? picture);
|
|
3235
|
+
}
|
|
3236
|
+
} else if (token.startsWith("![")) {
|
|
3237
|
+
const image = /^!\[([^\]]*)\]\((.+)\)$/.exec(token);
|
|
3238
|
+
if (image === null) {
|
|
3239
|
+
nodes.push(token);
|
|
3240
|
+
} else {
|
|
3241
|
+
const [, alt = "", rawSrc = ""] = image;
|
|
3242
|
+
const src = rawSrc.trim();
|
|
3243
|
+
if (/^https?:\/\//.test(src)) {
|
|
3244
|
+
nodes.push(/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MarkdownImage, { src, alt }, `${keyPrefix}-img${seq}`));
|
|
3245
|
+
} else {
|
|
3246
|
+
nodes.push(token);
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
} else if (token.startsWith("**")) {
|
|
3164
3250
|
nodes.push(
|
|
3165
3251
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("strong", { children: renderInline(token.slice(2, -2), `${keyPrefix}-b${seq}`) }, `${keyPrefix}-b${seq}`)
|
|
3166
3252
|
);
|
|
@@ -3178,32 +3264,8 @@ function renderInline(text, keyPrefix) {
|
|
|
3178
3264
|
nodes.push(token);
|
|
3179
3265
|
} else {
|
|
3180
3266
|
const [, label = "", rawUrl = ""] = link;
|
|
3181
|
-
const isImage = label.startsWith("!");
|
|
3182
|
-
const text2 = isImage ? label.slice(1) : label;
|
|
3183
3267
|
const url = rawUrl.trim();
|
|
3184
|
-
|
|
3185
|
-
nodes.push(
|
|
3186
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3187
|
-
"span",
|
|
3188
|
-
{
|
|
3189
|
-
className: "xps-md-link",
|
|
3190
|
-
role: "link",
|
|
3191
|
-
tabIndex: 0,
|
|
3192
|
-
onClick: () => void window.open(url, "_blank", "noopener,noreferrer"),
|
|
3193
|
-
onKeyDown: (event) => {
|
|
3194
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
3195
|
-
event.preventDefault();
|
|
3196
|
-
void window.open(url, "_blank", "noopener,noreferrer");
|
|
3197
|
-
}
|
|
3198
|
-
},
|
|
3199
|
-
children: text2 === "" ? url : text2
|
|
3200
|
-
},
|
|
3201
|
-
`${keyPrefix}-a${seq}`
|
|
3202
|
-
)
|
|
3203
|
-
);
|
|
3204
|
-
} else {
|
|
3205
|
-
nodes.push(isImage ? label : token);
|
|
3206
|
-
}
|
|
3268
|
+
nodes.push(renderLink(url, label === "" ? url : label, `${keyPrefix}-a${seq}`) ?? token);
|
|
3207
3269
|
}
|
|
3208
3270
|
}
|
|
3209
3271
|
last = m.index + token.length;
|
|
@@ -3235,15 +3297,15 @@ var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
|
3235
3297
|
function PluginDetailPage(props) {
|
|
3236
3298
|
ensureMarketStyles();
|
|
3237
3299
|
const pluginId = props.pluginId ?? "";
|
|
3238
|
-
const [detail, setDetail] = (0,
|
|
3239
|
-
const [status, setStatus] = (0,
|
|
3240
|
-
const [selectedVersion, setSelectedVersion] = (0,
|
|
3241
|
-
const [reloadFlag, setReloadFlag] = (0,
|
|
3242
|
-
const [dshVersion, setDshVersion] = (0,
|
|
3243
|
-
const [installed, setInstalled] = (0,
|
|
3300
|
+
const [detail, setDetail] = (0, import_react9.useState)(null);
|
|
3301
|
+
const [status, setStatus] = (0, import_react9.useState)("loading");
|
|
3302
|
+
const [selectedVersion, setSelectedVersion] = (0, import_react9.useState)(null);
|
|
3303
|
+
const [reloadFlag, setReloadFlag] = (0, import_react9.useState)(0);
|
|
3304
|
+
const [dshVersion, setDshVersion] = (0, import_react9.useState)(null);
|
|
3305
|
+
const [installed, setInstalled] = (0, import_react9.useState)(null);
|
|
3244
3306
|
const toasts = useToasts();
|
|
3245
|
-
const installedSeq = (0,
|
|
3246
|
-
const loadInstalled = (0,
|
|
3307
|
+
const installedSeq = (0, import_react9.useRef)(0);
|
|
3308
|
+
const loadInstalled = (0, import_react9.useCallback)(
|
|
3247
3309
|
(...names) => {
|
|
3248
3310
|
const seq = ++installedSeq.current;
|
|
3249
3311
|
getInstalled().then((list) => {
|
|
@@ -3260,7 +3322,7 @@ function PluginDetailPage(props) {
|
|
|
3260
3322
|
setSelectedVersion(version);
|
|
3261
3323
|
if (detail !== null) loadInstalled(pluginId, detail.name);
|
|
3262
3324
|
};
|
|
3263
|
-
(0,
|
|
3325
|
+
(0, import_react9.useEffect)(() => {
|
|
3264
3326
|
if (detail === null) return;
|
|
3265
3327
|
const onVisible = () => {
|
|
3266
3328
|
if (document.visibilityState === "visible") loadInstalled(pluginId, detail.name);
|
|
@@ -3268,7 +3330,7 @@ function PluginDetailPage(props) {
|
|
|
3268
3330
|
document.addEventListener("visibilitychange", onVisible);
|
|
3269
3331
|
return () => document.removeEventListener("visibilitychange", onVisible);
|
|
3270
3332
|
}, [detail, pluginId, loadInstalled]);
|
|
3271
|
-
(0,
|
|
3333
|
+
(0, import_react9.useEffect)(() => {
|
|
3272
3334
|
let alive = true;
|
|
3273
3335
|
getHostInfo().then((info) => {
|
|
3274
3336
|
if (alive) setDshVersion(info.dshVersion);
|
|
@@ -3278,7 +3340,7 @@ function PluginDetailPage(props) {
|
|
|
3278
3340
|
alive = false;
|
|
3279
3341
|
};
|
|
3280
3342
|
}, []);
|
|
3281
|
-
(0,
|
|
3343
|
+
(0, import_react9.useEffect)(() => {
|
|
3282
3344
|
let alive = true;
|
|
3283
3345
|
setStatus("loading");
|
|
3284
3346
|
setDetail(null);
|
|
@@ -3416,7 +3478,7 @@ function PluginDetailPage(props) {
|
|
|
3416
3478
|
value: displayVersion,
|
|
3417
3479
|
title: "\u5207\u6362\u7248\u672C",
|
|
3418
3480
|
onChange: (e) => selectVersion(e.target.value),
|
|
3419
|
-
children: detail.versions.map((v) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("option", { value: v.version, children: [
|
|
3481
|
+
children: [...detail.versions].sort((a, b) => compareVersions(b.version, a.version)).map((v) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("option", { value: v.version, children: [
|
|
3420
3482
|
"v",
|
|
3421
3483
|
v.version,
|
|
3422
3484
|
" \xB7 ",
|
|
@@ -3470,8 +3532,8 @@ var NAV_ITEMS = [
|
|
|
3470
3532
|
{ key: "developer", label: "\u6211\u7684" }
|
|
3471
3533
|
];
|
|
3472
3534
|
function MarketplaceApp() {
|
|
3473
|
-
const [nav, setNav] = (0,
|
|
3474
|
-
const [detailId, setDetailId] = (0,
|
|
3535
|
+
const [nav, setNav] = (0, import_react10.useState)("market");
|
|
3536
|
+
const [detailId, setDetailId] = (0, import_react10.useState)(null);
|
|
3475
3537
|
ensureThemeStyles();
|
|
3476
3538
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "xps-app", children: [
|
|
3477
3539
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("nav", { className: "xps-nav", children: NAV_ITEMS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
@@ -3499,7 +3561,7 @@ function MarketplaceApp() {
|
|
|
3499
3561
|
}
|
|
3500
3562
|
|
|
3501
3563
|
// src/client/settings/GeneralTokenRow.tsx
|
|
3502
|
-
var
|
|
3564
|
+
var import_react11 = require("react");
|
|
3503
3565
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3504
3566
|
var rowStyle = {
|
|
3505
3567
|
display: "flex",
|
|
@@ -3556,12 +3618,12 @@ function messageOf2(error, fallback) {
|
|
|
3556
3618
|
return error instanceof Error && error.message !== "" ? error.message : fallback;
|
|
3557
3619
|
}
|
|
3558
3620
|
function GeneralTokenRow() {
|
|
3559
|
-
const [loading, setLoading] = (0,
|
|
3560
|
-
const [auth, setAuth] = (0,
|
|
3561
|
-
const [token, setToken] = (0,
|
|
3562
|
-
const [pending, setPending] = (0,
|
|
3563
|
-
const [error, setError] = (0,
|
|
3564
|
-
(0,
|
|
3621
|
+
const [loading, setLoading] = (0, import_react11.useState)(true);
|
|
3622
|
+
const [auth, setAuth] = (0, import_react11.useState)(null);
|
|
3623
|
+
const [token, setToken] = (0, import_react11.useState)("");
|
|
3624
|
+
const [pending, setPending] = (0, import_react11.useState)(false);
|
|
3625
|
+
const [error, setError] = (0, import_react11.useState)("");
|
|
3626
|
+
(0, import_react11.useEffect)(() => {
|
|
3565
3627
|
let alive = true;
|
|
3566
3628
|
void getAuthState().then((state) => {
|
|
3567
3629
|
if (alive) setAuth(state);
|
|
@@ -3635,7 +3697,7 @@ function GeneralTokenRow() {
|
|
|
3635
3697
|
}
|
|
3636
3698
|
|
|
3637
3699
|
// src/client/settings/GeneralUpdateRow.tsx
|
|
3638
|
-
var
|
|
3700
|
+
var import_react12 = require("react");
|
|
3639
3701
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3640
3702
|
var rowStyle2 = {
|
|
3641
3703
|
display: "flex",
|
|
@@ -3720,11 +3782,11 @@ function versionAtLeast(current, target) {
|
|
|
3720
3782
|
return true;
|
|
3721
3783
|
}
|
|
3722
3784
|
function GeneralUpdateRow() {
|
|
3723
|
-
const [phase, setPhase] = (0,
|
|
3785
|
+
const [phase, setPhase] = (0, import_react12.useState)(() => {
|
|
3724
3786
|
const pending = readPendingUpdate();
|
|
3725
3787
|
return pending !== null ? { kind: "updated", version: pending } : { kind: "checking" };
|
|
3726
3788
|
});
|
|
3727
|
-
const [error, setError] = (0,
|
|
3789
|
+
const [error, setError] = (0, import_react12.useState)("");
|
|
3728
3790
|
const check = () => {
|
|
3729
3791
|
setPhase({ kind: "checking" });
|
|
3730
3792
|
setError("");
|
|
@@ -3741,7 +3803,7 @@ function GeneralUpdateRow() {
|
|
|
3741
3803
|
setError(messageOf3(err, "\u68C0\u67E5\u66F4\u65B0\u5931\u8D25"));
|
|
3742
3804
|
});
|
|
3743
3805
|
};
|
|
3744
|
-
(0,
|
|
3806
|
+
(0, import_react12.useEffect)(() => {
|
|
3745
3807
|
if (readPendingUpdate() !== null) {
|
|
3746
3808
|
void checkSelfUpdate().then((result) => {
|
|
3747
3809
|
const pending = readPendingUpdate();
|
|
@@ -3828,7 +3890,7 @@ function injectTheme() {
|
|
|
3828
3890
|
function StoreIcon(props) {
|
|
3829
3891
|
const active = props.active === true;
|
|
3830
3892
|
const size = typeof props.size === "number" ? props.size : 20;
|
|
3831
|
-
return (0,
|
|
3893
|
+
return (0, import_react13.createElement)(
|
|
3832
3894
|
"svg",
|
|
3833
3895
|
{
|
|
3834
3896
|
width: size,
|
|
@@ -3839,13 +3901,13 @@ function StoreIcon(props) {
|
|
|
3839
3901
|
color: active ? "var(--dsw-alias-brand-primary, #3861fb)" : "var(--dsw-alias-label-secondary, #646a73)"
|
|
3840
3902
|
}
|
|
3841
3903
|
},
|
|
3842
|
-
(0,
|
|
3904
|
+
(0, import_react13.createElement)("path", {
|
|
3843
3905
|
d: "M4 7h16l-1.2-3.2A1 1 0 0 0 17.85 3H6.15a1 1 0 0 0-.95.8L4 7Zm0 0v12a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V7",
|
|
3844
3906
|
stroke: "currentColor",
|
|
3845
3907
|
strokeWidth: 1.6,
|
|
3846
3908
|
strokeLinejoin: "round"
|
|
3847
3909
|
}),
|
|
3848
|
-
(0,
|
|
3910
|
+
(0, import_react13.createElement)("path", {
|
|
3849
3911
|
d: "M9 11a3 3 0 0 0 6 0",
|
|
3850
3912
|
stroke: "currentColor",
|
|
3851
3913
|
strokeWidth: 1.6,
|
|
@@ -3855,13 +3917,13 @@ function StoreIcon(props) {
|
|
|
3855
3917
|
}
|
|
3856
3918
|
function BundleConfigSeat(props) {
|
|
3857
3919
|
if (props.view === "page") {
|
|
3858
|
-
return (0,
|
|
3920
|
+
return (0, import_react13.createElement)(
|
|
3859
3921
|
"div",
|
|
3860
3922
|
{ className: "xps-page-placeholder" },
|
|
3861
3923
|
"\u85AA\u4EBA\u85AA\u4E8B\u5E02\u573A\u914D\u7F6E(\u5360\u4F4D):serviceBaseUrl / cacheDir / requestTimeout / cachePolicy"
|
|
3862
3924
|
);
|
|
3863
3925
|
}
|
|
3864
|
-
return (0,
|
|
3926
|
+
return (0, import_react13.createElement)("div", null, "\u85AA\u4EBA\u85AA\u4E8B\u5E02\u573A:\u79C1\u6709\u63D2\u4EF6\u6D4F\u89C8\u3001\u5B89\u88C5\u4E0E\u5F00\u53D1\u8005\u4E0A\u4F20");
|
|
3865
3927
|
}
|
|
3866
3928
|
function apply(ctx) {
|
|
3867
3929
|
const slots = ctx.get("slots");
|
|
@@ -3894,7 +3956,7 @@ function apply(ctx) {
|
|
|
3894
3956
|
"main",
|
|
3895
3957
|
() => safe(
|
|
3896
3958
|
"main",
|
|
3897
|
-
() => slots.register({ name: "main", key: "xrxs-plugins-store" }, () => (0,
|
|
3959
|
+
() => slots.register({ name: "main", key: "xrxs-plugins-store" }, () => (0, import_react13.createElement)(MarketplaceApp))
|
|
3898
3960
|
)
|
|
3899
3961
|
),
|
|
3900
3962
|
"xrxs-plugins-store.main"
|
|
@@ -3906,7 +3968,7 @@ function apply(ctx) {
|
|
|
3906
3968
|
"settings.general.item",
|
|
3907
3969
|
() => slots.register(
|
|
3908
3970
|
{ name: "settings.general.item", id: "xrxs-plugins-store-token", order: 50 },
|
|
3909
|
-
() => (0,
|
|
3971
|
+
() => (0, import_react13.createElement)(GeneralTokenRow)
|
|
3910
3972
|
)
|
|
3911
3973
|
)
|
|
3912
3974
|
),
|
|
@@ -3919,7 +3981,7 @@ function apply(ctx) {
|
|
|
3919
3981
|
"settings.general.item",
|
|
3920
3982
|
() => slots.register(
|
|
3921
3983
|
{ name: "settings.general.item", id: "xrxs-plugins-store-update", order: 51 },
|
|
3922
|
-
() => (0,
|
|
3984
|
+
() => (0, import_react13.createElement)(GeneralUpdateRow)
|
|
3923
3985
|
)
|
|
3924
3986
|
)
|
|
3925
3987
|
),
|
|
@@ -3932,7 +3994,7 @@ function apply(ctx) {
|
|
|
3932
3994
|
"plugins.bundle.config",
|
|
3933
3995
|
() => slots.register(
|
|
3934
3996
|
{ name: "plugins.bundle.config", key: "@xrxs-ai/dsh-xrxs-plugins-store" },
|
|
3935
|
-
(props) => (0,
|
|
3997
|
+
(props) => (0, import_react13.createElement)(BundleConfigSeat, props)
|
|
3936
3998
|
)
|
|
3937
3999
|
)
|
|
3938
4000
|
),
|