@inpageedit/core 0.13.1 → 0.14.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/LICENSE +20 -20
- package/dist/{BasePlugin-Bf2UuIHF.js → BasePlugin-CU8beLYu.js} +17 -26
- package/dist/BasePlugin-CU8beLYu.js.map +1 -0
- package/dist/IconQuickEdit-CMCQncyj.js.map +1 -1
- package/dist/InputBox-nQKtiWtZ.js.map +1 -1
- package/dist/{PluginPrefSync-Dn1Xsiqz.js → PluginPrefSync-B-gPsC2n.js} +124 -128
- package/dist/PluginPrefSync-B-gPsC2n.js.map +1 -0
- package/dist/PluginStoreApp-CDteVCBG.js +453 -0
- package/dist/PluginStoreApp-CDteVCBG.js.map +1 -0
- package/dist/{endpoints-DgyuoRZd.js → Preferences-85Q9FAmb.js} +589 -565
- package/dist/Preferences-85Q9FAmb.js.map +1 -0
- package/dist/WatchlistAction-BbNAyryN.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/{index-DqA6EAM6.js → index-19CgGBI0.js} +1419 -921
- package/dist/index-19CgGBI0.js.map +1 -0
- package/dist/{index-B7c6jL9x.js → index-BKIf3i0I.js} +146 -137
- package/dist/index-BKIf3i0I.js.map +1 -0
- package/dist/{index-CCRMmnwk.js → index-BrtFJ-M0.js} +67 -66
- package/dist/index-BrtFJ-M0.js.map +1 -0
- package/dist/index-CG38LlAh.js.map +1 -1
- package/dist/index-CM_6yF2v.js.map +1 -1
- package/dist/index-CQr1DJ8n.js +173 -0
- package/dist/index-CQr1DJ8n.js.map +1 -0
- package/dist/{index-BQ-cHWkJ.js → index-CVTBg5O9.js} +66 -48
- package/dist/index-CVTBg5O9.js.map +1 -0
- package/dist/index-Ci82vLXg.js +179 -0
- package/dist/index-Ci82vLXg.js.map +1 -0
- package/dist/{index-BwdWyHLe.js → index-D3iZhRMJ.js} +93 -93
- package/dist/index-D3iZhRMJ.js.map +1 -0
- package/dist/index-DD5CVCfD.js.map +1 -1
- package/dist/{index-BJ7_Q1mB.js → index-DGtq21uW.js} +17 -16
- package/dist/index-DGtq21uW.js.map +1 -0
- package/dist/index-DXL7teb0.js +394 -0
- package/dist/index-DXL7teb0.js.map +1 -0
- package/dist/index-DjPpAyfE.js +116 -0
- package/dist/index-DjPpAyfE.js.map +1 -0
- package/dist/{index-eSlbrNqF.js → index-rpiO9fpc.js} +4 -5
- package/dist/{index-eSlbrNqF.js.map → index-rpiO9fpc.js.map} +1 -1
- package/dist/index.d.ts +318 -25
- package/dist/index.js +32 -26
- package/dist/index.js.map +1 -1
- package/dist/makeCallable-LDU0xZMJ.js.map +1 -1
- package/dist/models/index.js +174 -154
- package/dist/models/index.js.map +1 -1
- package/dist/noop-ClDc6zv4.js.map +1 -1
- package/dist/plugins/index.js +10 -10
- package/dist/services/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/vueHooks-l04s8cIl.js.map +1 -1
- package/lib/index.umd.js +20 -12
- package/lib/index.umd.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +4 -4
- package/dist/BasePlugin-Bf2UuIHF.js.map +0 -1
- package/dist/PluginPrefSync-Dn1Xsiqz.js.map +0 -1
- package/dist/PluginStoreApp-CpOLArL7.js +0 -452
- package/dist/PluginStoreApp-CpOLArL7.js.map +0 -1
- package/dist/Preferences-DS4-CFWe.js +0 -9
- package/dist/Preferences-DS4-CFWe.js.map +0 -1
- package/dist/endpoints-DgyuoRZd.js.map +0 -1
- package/dist/index-2RfILgXm.js +0 -180
- package/dist/index-2RfILgXm.js.map +0 -1
- package/dist/index-B7c6jL9x.js.map +0 -1
- package/dist/index-BJ7_Q1mB.js.map +0 -1
- package/dist/index-BNh95-x2.js +0 -115
- package/dist/index-BNh95-x2.js.map +0 -1
- package/dist/index-BQ-cHWkJ.js.map +0 -1
- package/dist/index-BwdWyHLe.js.map +0 -1
- package/dist/index-CCRMmnwk.js.map +0 -1
- package/dist/index-CnIpUF9x.js +0 -173
- package/dist/index-CnIpUF9x.js.map +0 -1
- package/dist/index-CyG7_IYz.js +0 -394
- package/dist/index-CyG7_IYz.js.map +0 -1
- package/dist/index-DqA6EAM6.js.map +0 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { j as a, P as S } from "./index-CM_6yF2v.js";
|
|
2
|
+
import { R as E, I as j, S as k } from "./Preferences-85Q9FAmb.js";
|
|
3
|
+
import { B as q } from "./BasePlugin-CU8beLYu.js";
|
|
4
|
+
import { T as F } from "./index-DD5CVCfD.js";
|
|
5
|
+
import { C as v, I } from "./InputBox-nQKtiWtZ.js";
|
|
6
|
+
var T = Object.create, p = Object.defineProperty, B = Object.getOwnPropertyDescriptor, b = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), _ = (t) => {
|
|
7
|
+
throw TypeError(t);
|
|
8
|
+
}, C = (t, e, o) => e in t ? p(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o, Q = (t, e) => p(t, "name", { value: e, configurable: !0 }), z = (t) => [, , , T(t?.[b("metadata")] ?? null)], D = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], x = (t) => t !== void 0 && typeof t != "function" ? _("Function expected") : t, N = (t, e, o, n, r) => ({ kind: D[t], name: e, metadata: n, addInitializer: (i) => o._ ? _("Already initialized") : r.push(x(i || null)) }), O = (t, e) => C(e, b("metadata"), t[3]), R = (t, e, o, n) => {
|
|
9
|
+
for (var r = 0, i = t[e >> 1], s = i && i.length; r < s; r++) i[r].call(o);
|
|
10
|
+
return n;
|
|
11
|
+
}, $ = (t, e, o, n, r, i) => {
|
|
12
|
+
var s, c, d, l = e & 7, f = !1, w = 0, y = t[w] || (t[w] = []), m = l && (r = r.prototype, l < 5 && (l > 3 || !f) && B(r, o));
|
|
13
|
+
Q(r, o);
|
|
14
|
+
for (var u = n.length - 1; u >= 0; u--)
|
|
15
|
+
d = N(l, o, c = {}, t[3], y), s = (0, n[u])(r, d), c._ = 1, x(s) && (r = s);
|
|
16
|
+
return O(t, r), m && p(r, o, m), f ? l ^ 4 ? i : m : r;
|
|
17
|
+
}, M, g, P;
|
|
18
|
+
M = [E(
|
|
19
|
+
k.object({
|
|
20
|
+
"quickMove.reason": k.string().default("[IPE-NEXT] Quick move")
|
|
21
|
+
}).description("Quick move options").extra("category", "editor")
|
|
22
|
+
), j(["modal", "wiki", "$"])];
|
|
23
|
+
class h extends (P = q) {
|
|
24
|
+
constructor(e) {
|
|
25
|
+
super(e, {}, "quick-move"), this.ctx = e, e.set("quickMove", this);
|
|
26
|
+
}
|
|
27
|
+
start() {
|
|
28
|
+
this.ctx.inject(["toolbox"], (e) => {
|
|
29
|
+
this.injectToolbox(e);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
injectToolbox(e) {
|
|
33
|
+
const o = e.$, n = window.mw?.config.get("wgPageName") || "", r = window.mw?.config.get("wgIsProbablyEditable");
|
|
34
|
+
e.toolbox.addButton({
|
|
35
|
+
id: "quick-move",
|
|
36
|
+
icon: /* @__PURE__ */ a(
|
|
37
|
+
"svg",
|
|
38
|
+
{
|
|
39
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
40
|
+
width: "24",
|
|
41
|
+
height: "24",
|
|
42
|
+
viewBox: "0 0 24 24",
|
|
43
|
+
fill: "none",
|
|
44
|
+
stroke: "currentColor",
|
|
45
|
+
"stroke-width": "2",
|
|
46
|
+
"stroke-linecap": "round",
|
|
47
|
+
"stroke-linejoin": "round",
|
|
48
|
+
class: "icon icon-tabler icons-tabler-outline icon-tabler-forms",
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ a("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
51
|
+
/* @__PURE__ */ a("path", { d: "M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3" }),
|
|
52
|
+
/* @__PURE__ */ a("path", { d: "M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3" }),
|
|
53
|
+
/* @__PURE__ */ a("path", { d: "M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7" }),
|
|
54
|
+
/* @__PURE__ */ a("path", { d: "M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1" }),
|
|
55
|
+
/* @__PURE__ */ a("path", { d: "M17 12h.01" }),
|
|
56
|
+
/* @__PURE__ */ a("path", { d: "M13 12h.01" })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
tooltip: o`Quick Move`,
|
|
61
|
+
group: "group1",
|
|
62
|
+
index: 1,
|
|
63
|
+
onClick: () => {
|
|
64
|
+
this.showModal(
|
|
65
|
+
r ? {
|
|
66
|
+
lockFromField: !0,
|
|
67
|
+
from: n
|
|
68
|
+
} : {}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
async showModal(e) {
|
|
74
|
+
const o = this.ctx.$, n = await this.ctx.preferences.get("quickMove.reason"), r = this.ctx.modal.createObject({
|
|
75
|
+
title: o`Quick Move`,
|
|
76
|
+
content: /* @__PURE__ */ a(S, {}),
|
|
77
|
+
className: "quick-move compact-buttons",
|
|
78
|
+
sizeClass: "smallToMedium",
|
|
79
|
+
center: !0
|
|
80
|
+
}).init();
|
|
81
|
+
let i = null;
|
|
82
|
+
return r.setContent(
|
|
83
|
+
/* @__PURE__ */ a(
|
|
84
|
+
"form",
|
|
85
|
+
{
|
|
86
|
+
ref: (s) => i = s,
|
|
87
|
+
style: {
|
|
88
|
+
display: "flex",
|
|
89
|
+
flexDirection: "column",
|
|
90
|
+
gap: "1rem"
|
|
91
|
+
},
|
|
92
|
+
onSubmit: (s) => {
|
|
93
|
+
if (s.preventDefault(), i?.checkValidity(), !i?.reportValidity())
|
|
94
|
+
return;
|
|
95
|
+
const c = new FormData(i), d = {
|
|
96
|
+
from: c.get("from")?.toString().trim(),
|
|
97
|
+
to: c.get("to")?.toString().trim(),
|
|
98
|
+
reason: c.get("reason") || "",
|
|
99
|
+
movetalk: c.get("movetalk") === "on",
|
|
100
|
+
movesubpages: c.get("movesubpages") === "on",
|
|
101
|
+
noredirect: c.get("noredirect") === "on"
|
|
102
|
+
};
|
|
103
|
+
if (!d.from || !d.to) {
|
|
104
|
+
this.ctx.modal.notify("error", {
|
|
105
|
+
title: o`Failed to move`,
|
|
106
|
+
content: "From and to are required."
|
|
107
|
+
});
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
this.ctx.emit("quick-move/submit", { ctx: this.ctx, modal: r, payload: d }), r.setLoadingState(!0), this.movePage(d).then(() => {
|
|
111
|
+
location.reload();
|
|
112
|
+
}).catch((l) => {
|
|
113
|
+
r.setLoadingState(!1), this.ctx.modal.notify("error", {
|
|
114
|
+
title: o`Failed to move`,
|
|
115
|
+
content: l instanceof Error ? l.message : String(l)
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ a(
|
|
121
|
+
F,
|
|
122
|
+
{
|
|
123
|
+
inputs: [
|
|
124
|
+
{
|
|
125
|
+
label: o`Move from`,
|
|
126
|
+
name: "from",
|
|
127
|
+
value: e?.from,
|
|
128
|
+
required: !0
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
label: o`Move to`,
|
|
132
|
+
name: "to",
|
|
133
|
+
value: e?.to,
|
|
134
|
+
required: !0
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
/* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(v, { name: "movetalk", id: "movetalk", checked: e?.movetalk, children: o`Move talk page` }) }),
|
|
140
|
+
/* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(v, { name: "movesubpages", id: "movesubpages", checked: e?.movesubpages, children: o`Move subpages (up to 100)` }) }),
|
|
141
|
+
this.ctx.wiki.hasRight("suppressredirect") && /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(v, { name: "noredirect", id: "noredirect", checked: e?.noredirect, children: o`Move without leaving a redirect` }) }),
|
|
142
|
+
/* @__PURE__ */ a(
|
|
143
|
+
I,
|
|
144
|
+
{
|
|
145
|
+
label: o`Reason`,
|
|
146
|
+
id: "reason",
|
|
147
|
+
name: "reason",
|
|
148
|
+
value: e?.reason ?? n ?? ""
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
), r.setButtons([
|
|
155
|
+
{
|
|
156
|
+
label: o`Move`,
|
|
157
|
+
className: "is-primary is-ghost",
|
|
158
|
+
method: () => {
|
|
159
|
+
i?.dispatchEvent(new Event("submit"));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
]), r.show();
|
|
163
|
+
}
|
|
164
|
+
async movePage(e) {
|
|
165
|
+
const { from: o, to: n, reason: r = "", ...i } = e;
|
|
166
|
+
if (!o || !n)
|
|
167
|
+
throw new Error("From and to titles are required.");
|
|
168
|
+
if (o === n)
|
|
169
|
+
throw new Error("From and to titles cannot be the same.");
|
|
170
|
+
return (await this.ctx.wikiPage.newFromTitle(o)).moveTo(n, r, i);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
g = z(P);
|
|
174
|
+
h = $(g, 0, "PluginQuickMove", M, h);
|
|
175
|
+
R(g, 1, h);
|
|
176
|
+
export {
|
|
177
|
+
h as PluginQuickMove
|
|
178
|
+
};
|
|
179
|
+
//# sourceMappingURL=index-Ci82vLXg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Ci82vLXg.js","sources":["../src/plugins/quick-move/index.tsx"],"sourcesContent":["import { Inject, InPageEdit, Schema } from '@/InPageEdit'\nimport { IPEModal } from '@inpageedit/modal'\n\ndeclare module '@/InPageEdit' {\n interface InPageEdit {\n quickMove: PluginQuickMove\n }\n interface Events {\n 'quick-move/init-options'(payload: {\n ctx: InPageEdit\n options: Partial<QuickMoveOptions>\n }): void\n 'quick-move/show-modal'(payload: { ctx: InPageEdit; modal: IPEModal }): void\n 'quick-move/submit'(payload: {\n ctx: InPageEdit\n modal: IPEModal\n payload: MovePageOptions\n }): void\n }\n interface PreferencesMap {\n 'quickMove.reason': string\n }\n}\n\nexport interface MovePageOptions {\n from: string\n to: string\n reason?: string\n movetalk?: boolean\n movesubpages?: boolean\n noredirect?: boolean\n}\nexport interface QuickMoveOptions extends Partial<MovePageOptions> {\n lockFromField?: boolean\n lockToField?: boolean\n}\n\n@RegisterPreferences(\n Schema.object({\n 'quickMove.reason': Schema.string().default('[IPE-NEXT] Quick move'),\n })\n .description('Quick move options')\n .extra('category', 'editor')\n)\n@Inject(['modal', 'wiki', '$'])\nexport class PluginQuickMove extends BasePlugin {\n constructor(public ctx: InPageEdit) {\n super(ctx, {}, 'quick-move')\n ctx.set('quickMove', this)\n }\n\n protected start(): Promise<void> | void {\n this.ctx.inject(['toolbox'], (ctx) => {\n this.injectToolbox(ctx)\n })\n }\n\n private injectToolbox(ctx: InPageEdit) {\n const $ = ctx.$\n const curPageName = window.mw?.config.get('wgPageName') || ''\n const canEdit = window.mw?.config.get('wgIsProbablyEditable')\n ctx.toolbox.addButton({\n id: 'quick-move',\n icon: (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"icon icon-tabler icons-tabler-outline icon-tabler-forms\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3\" />\n <path d=\"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3\" />\n <path d=\"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7\" />\n <path d=\"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1\" />\n <path d=\"M17 12h.01\" />\n <path d=\"M13 12h.01\" />\n </svg>\n ),\n tooltip: $`Quick Move`,\n group: 'group1',\n index: 1,\n onClick: () => {\n this.showModal(\n canEdit\n ? {\n lockFromField: true,\n from: curPageName,\n }\n : {}\n )\n },\n })\n }\n\n async showModal(options?: Partial<QuickMoveOptions>) {\n const $ = this.ctx.$\n const reason = await this.ctx.preferences.get('quickMove.reason')\n const modal = this.ctx.modal\n .createObject({\n title: $`Quick Move`,\n content: (<ProgressBar />) as HTMLElement,\n className: 'quick-move compact-buttons',\n sizeClass: 'smallToMedium',\n center: true,\n })\n .init()\n\n let formRef: HTMLFormElement | null = null\n modal.setContent(\n (\n <form\n ref={(el) => (formRef = el)}\n style={{\n display: 'flex',\n flexDirection: 'column',\n gap: '1rem',\n }}\n onSubmit={(e) => {\n e.preventDefault()\n formRef?.checkValidity()\n if (!formRef?.reportValidity()) {\n return\n }\n const formData = new FormData(formRef!)\n const options = {\n from: formData.get('from')?.toString().trim()!,\n to: formData.get('to')?.toString().trim()!,\n reason: (formData.get('reason') as string) || '',\n movetalk: formData.get('movetalk') === 'on',\n movesubpages: formData.get('movesubpages') === 'on',\n noredirect: formData.get('noredirect') === 'on',\n }\n if (!options.from || !options.to) {\n this.ctx.modal.notify('error', {\n title: $`Failed to move`,\n content: 'From and to are required.',\n })\n return\n }\n this.ctx.emit('quick-move/submit', { ctx: this.ctx, modal, payload: options })\n modal.setLoadingState(true)\n this.movePage(options)\n .then(() => {\n location.reload()\n })\n .catch((error) => {\n modal.setLoadingState(false)\n this.ctx.modal.notify('error', {\n title: $`Failed to move`,\n content: error instanceof Error ? error.message : String(error),\n })\n })\n }}\n >\n <TwinSwapInput\n inputs={[\n {\n label: $`Move from`,\n name: 'from',\n value: options?.from,\n required: true,\n },\n {\n label: $`Move to`,\n name: 'to',\n value: options?.to,\n required: true,\n },\n ]}\n />\n <div>\n <CheckBox name=\"movetalk\" id=\"movetalk\" checked={options?.movetalk}>\n {$`Move talk page`}\n </CheckBox>\n </div>\n <div>\n <CheckBox name=\"movesubpages\" id=\"movesubpages\" checked={options?.movesubpages}>\n {$`Move subpages (up to 100)`}\n </CheckBox>\n </div>\n {this.ctx.wiki.hasRight('suppressredirect') && (\n <div>\n <CheckBox name=\"noredirect\" id=\"noredirect\" checked={options?.noredirect}>\n {$`Move without leaving a redirect`}\n </CheckBox>\n </div>\n )}\n <InputBox\n label={$`Reason`}\n id=\"reason\"\n name=\"reason\"\n value={options?.reason ?? reason ?? ''}\n />\n </form>\n ) as HTMLElement\n )\n\n modal.setButtons([\n {\n label: $`Move`,\n className: 'is-primary is-ghost',\n method: () => {\n formRef?.dispatchEvent(new Event('submit'))\n },\n },\n ])\n\n return modal.show()\n }\n\n async movePage(options: MovePageOptions) {\n const { from, to, reason = '', ...rest } = options\n\n if (!from || !to) {\n throw new Error('From and to titles are required.')\n }\n if (from === to) {\n throw new Error('From and to titles cannot be the same.')\n }\n\n const wikiPage = await this.ctx.wikiPage.newFromTitle(from)\n return wikiPage.moveTo(to, reason, rest)\n }\n}\n"],"names":["_PluginQuickMove_decorators","_init","_a","RegisterPreferences","Schema","Inject","PluginQuickMove","BasePlugin","ctx","$","curPageName","canEdit","jsxs","jsx","options","reason","modal","ProgressBar","formRef","el","e","formData","error","TwinSwapInput","CheckBox","InputBox","from","to","rest","__decoratorStart","__decorateElement","__runInitializers"],"mappings":";;;;;;;;;;;;;;;;GAAAA,GAAAC,GAAAC;AAqCAF,IAAA,CAACG;AAAA,EACCC,EAAO,OAAO;AAAA,IACZ,oBAAoBA,EAAO,OAAA,EAAS,QAAQ,uBAAuB;AAAA,EAAA,CACpE,EACE,YAAY,oBAAoB,EAChC,MAAM,YAAY,QAAQ;AAC/B,GACCC,EAAO,CAAC,SAAS,QAAQ,GAAG,CAAC,CAAA;AACvB,MAAMC,WAAwBJ,IAAAK,GAAW;AAAA,EAC9C,YAAmBC,GAAiB;AAClC,UAAMA,GAAK,CAAA,GAAI,YAAY,GADV,KAAA,MAAAA,GAE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AAOK,GAAS,UAAUC,KAAU;AAAA,cAAA;AAAA,YAAA;AAAA,UACtC;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,GAIJC,EAAM,WAAW;AAAA,MACf;AAAA,QACE,OAAOP;AAAA,QACP,WAAW;AAAA,QACX,QAAQ,MAAM;AACZ,UAAAS,GAAS,cAAc,IAAI,MAAM,QAAQ,CAAC;AAAA,QAC5C;AAAA,MAAA;AAAA,IACF,CACD,GAEMF,EAAM,KAAA;AAAA,EACf;AAAA,EAEA,MAAM,SAASF,GAA0B;AACvC,UAAM,EAAE,MAAAY,GAAM,IAAAC,GAAI,QAAAZ,IAAS,IAAI,GAAGa,MAASd;AAE3C,QAAI,CAACY,KAAQ,CAACC;AACZ,YAAM,IAAI,MAAM,kCAAkC;AAEpD,QAAID,MAASC;AACX,YAAM,IAAI,MAAM,wCAAwC;AAI1D,YADiB,MAAM,KAAK,IAAI,SAAS,aAAaD,CAAI,GAC1C,OAAOC,GAAIZ,GAAQa,CAAI;AAAA,EACzC;AACF;AAzLO3B,IAAA4B,EAAA3B,CAAA;AAAMI,IAANwB,2BARP9B,GAQaM,CAAA;AAANyB,EAAA9B,GAAA,GAAMK,CAAA;"}
|
|
@@ -1,61 +1,61 @@
|
|
|
1
1
|
import { j as R } from "./index-CM_6yF2v.js";
|
|
2
|
-
import { S as
|
|
3
|
-
import { B as
|
|
4
|
-
import { c as
|
|
5
|
-
const
|
|
2
|
+
import { S as i, E as C, I as j } from "./Preferences-85Q9FAmb.js";
|
|
3
|
+
import { B as L } from "./BasePlugin-CU8beLYu.js";
|
|
4
|
+
import { c as O, d as F } from "./vueHooks-l04s8cIl.js";
|
|
5
|
+
const G = 1;
|
|
6
6
|
var m;
|
|
7
7
|
((n) => {
|
|
8
|
-
n.PackageLoader = new
|
|
9
|
-
|
|
10
|
-
kind:
|
|
11
|
-
entry:
|
|
12
|
-
styles:
|
|
13
|
-
main_export:
|
|
8
|
+
n.PackageLoader = new i(
|
|
9
|
+
i.object({
|
|
10
|
+
kind: i.union(["autoload", "module", "umd", "styles"]).required().default("autoload"),
|
|
11
|
+
entry: i.string(),
|
|
12
|
+
styles: i.array(i.string()),
|
|
13
|
+
main_export: i.string()
|
|
14
14
|
})
|
|
15
|
-
), n.Package = new
|
|
16
|
-
|
|
17
|
-
id:
|
|
18
|
-
name:
|
|
19
|
-
version:
|
|
20
|
-
description:
|
|
21
|
-
author:
|
|
22
|
-
license:
|
|
15
|
+
), n.Package = new i(
|
|
16
|
+
i.object({
|
|
17
|
+
id: i.string().required(),
|
|
18
|
+
name: i.string().required(),
|
|
19
|
+
version: i.string().required(),
|
|
20
|
+
description: i.string(),
|
|
21
|
+
author: i.string(),
|
|
22
|
+
license: i.string(),
|
|
23
23
|
loader: n.PackageLoader.required()
|
|
24
24
|
})
|
|
25
|
-
), n.RegistryMaintainer = new
|
|
26
|
-
|
|
27
|
-
name:
|
|
28
|
-
email:
|
|
25
|
+
), n.RegistryMaintainer = new i(
|
|
26
|
+
i.object({
|
|
27
|
+
name: i.string().required(),
|
|
28
|
+
email: i.string()
|
|
29
29
|
})
|
|
30
|
-
), n.RegistryRepository = new
|
|
31
|
-
|
|
32
|
-
type:
|
|
33
|
-
url:
|
|
30
|
+
), n.RegistryRepository = new i(
|
|
31
|
+
i.object({
|
|
32
|
+
type: i.union(["git"]).required().default("git"),
|
|
33
|
+
url: i.string().required()
|
|
34
34
|
})
|
|
35
|
-
), n.Registry = new
|
|
36
|
-
|
|
37
|
-
manifest_version:
|
|
38
|
-
name:
|
|
39
|
-
base_url:
|
|
40
|
-
homepage:
|
|
41
|
-
maintainers:
|
|
35
|
+
), n.Registry = new i(
|
|
36
|
+
i.object({
|
|
37
|
+
manifest_version: i.number().min(G).required(),
|
|
38
|
+
name: i.string().required(),
|
|
39
|
+
base_url: i.string().required(),
|
|
40
|
+
homepage: i.string(),
|
|
41
|
+
maintainers: i.array(n.RegistryMaintainer),
|
|
42
42
|
repository: n.RegistryRepository,
|
|
43
|
-
packages:
|
|
43
|
+
packages: i.array(n.Package).required()
|
|
44
44
|
})
|
|
45
45
|
);
|
|
46
46
|
})(m || (m = {}));
|
|
47
|
-
var
|
|
47
|
+
var B = Object.create, x = Object.defineProperty, M = Object.getOwnPropertyDescriptor, S = (n, e) => (e = Symbol[n]) ? e : Symbol.for("Symbol." + n), b = (n) => {
|
|
48
48
|
throw TypeError(n);
|
|
49
|
-
},
|
|
50
|
-
for (var
|
|
49
|
+
}, q = (n, e, t) => e in n ? x(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, N = (n, e) => x(n, "name", { value: e, configurable: !0 }), D = (n) => [, , , B(n?.[S("metadata")] ?? null)], U = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], k = (n) => n !== void 0 && typeof n != "function" ? b("Function expected") : n, Y = (n, e, t, r, s) => ({ kind: U[n], name: e, metadata: r, addInitializer: (a) => t._ ? b("Already initialized") : s.push(k(a || null)) }), z = (n, e) => q(e, S("metadata"), n[3]), Q = (n, e, t, r) => {
|
|
50
|
+
for (var s = 0, a = n[e >> 1], l = a && a.length; s < l; s++) a[s].call(t);
|
|
51
51
|
return r;
|
|
52
|
-
},
|
|
53
|
-
var l, f, h, g = e & 7, p = !1, c = 0, y = n[c] || (n[c] = []), d = g && (
|
|
54
|
-
|
|
52
|
+
}, H = (n, e, t, r, s, a) => {
|
|
53
|
+
var l, f, h, g = e & 7, p = !1, c = 0, y = n[c] || (n[c] = []), d = g && (s = s.prototype, g < 5 && (g > 3 || !p) && M(s, t));
|
|
54
|
+
N(s, t);
|
|
55
55
|
for (var o = r.length - 1; o >= 0; o--)
|
|
56
|
-
h =
|
|
57
|
-
return
|
|
58
|
-
},
|
|
56
|
+
h = Y(g, t, f = {}, n[3], y), l = (0, r[o])(s, h), f._ = 1, k(l) && (s = l);
|
|
57
|
+
return z(n, s), d && x(s, t, d), p ? g ^ 4 ? a : d : s;
|
|
58
|
+
}, A, I, T;
|
|
59
59
|
const P = (n) => {
|
|
60
60
|
if (!n) return null;
|
|
61
61
|
try {
|
|
@@ -70,17 +70,17 @@ const P = (n) => {
|
|
|
70
70
|
const l = r(e);
|
|
71
71
|
return new URL(n, l).href;
|
|
72
72
|
}
|
|
73
|
-
const
|
|
73
|
+
const s = (() => {
|
|
74
74
|
try {
|
|
75
75
|
return new URL(t).href;
|
|
76
76
|
} catch {
|
|
77
77
|
return new URL(t, location.origin).href;
|
|
78
78
|
}
|
|
79
|
-
})(), a = new URL(r(e),
|
|
79
|
+
})(), a = new URL(r(e), s).href;
|
|
80
80
|
return new URL(n, a).href;
|
|
81
81
|
};
|
|
82
|
-
|
|
83
|
-
let w = class v extends (
|
|
82
|
+
A = [j(["storage", "preferences", "resourceLoader", "$"])];
|
|
83
|
+
let w = class v extends (T = L) {
|
|
84
84
|
constructor(e) {
|
|
85
85
|
super(e, {}, "plugin-store"), this.ctx = e, this.regInfoDB = void 0, this._installedPlugins = /* @__PURE__ */ new Map(), this._onlineRegistryQueries = /* @__PURE__ */ new Map(), e.set("store", this), this.regInfoDB = e.storage.createDatabase(
|
|
86
86
|
v.REGISTRY_INFO_STORAGE_NAME,
|
|
@@ -111,44 +111,44 @@ let w = class v extends (A = j) {
|
|
|
111
111
|
this.install(t.registry, t.id, t.source);
|
|
112
112
|
}
|
|
113
113
|
async _createManagementApp() {
|
|
114
|
-
const e = await this.ctx.withInject(["store"]), t =
|
|
115
|
-
return
|
|
114
|
+
const e = await this.ctx.withInject(["store"]), t = F(() => import("./PluginStoreApp-CDteVCBG.js"));
|
|
115
|
+
return O(e, t);
|
|
116
116
|
}
|
|
117
117
|
async _injectPreferenceUI() {
|
|
118
|
-
const e = this.ctx
|
|
118
|
+
const e = this.ctx, t = e.$;
|
|
119
119
|
e.preferences.defineCategory({
|
|
120
120
|
name: "plugin-store",
|
|
121
|
-
label:
|
|
122
|
-
description:
|
|
121
|
+
label: t`Plugin Store`,
|
|
122
|
+
description: t`Plugin Store`,
|
|
123
123
|
index: 90,
|
|
124
124
|
autoGenerateForm: !1,
|
|
125
|
-
customRenderer: async ({ onUnmount:
|
|
126
|
-
const
|
|
127
|
-
return
|
|
128
|
-
|
|
129
|
-
}), /* @__PURE__ */ R("section", { children:
|
|
125
|
+
customRenderer: async ({ onUnmount: r }) => {
|
|
126
|
+
const s = /* @__PURE__ */ R("div", { id: "ipe-plugin-store-preferences-vue" }), a = await this._createManagementApp();
|
|
127
|
+
return a.mount(s), r(() => {
|
|
128
|
+
a.unmount(), this.ctx.logger.debug("Plugin Store preferences app unmounted");
|
|
129
|
+
}), /* @__PURE__ */ R("section", { children: s });
|
|
130
130
|
}
|
|
131
131
|
}), e.preferences.registerCustomConfig(
|
|
132
132
|
"plugin-store",
|
|
133
|
-
|
|
134
|
-
"pluginStore.registries":
|
|
135
|
-
|
|
136
|
-
]).description(
|
|
137
|
-
"pluginStore.cdnForNpm":
|
|
138
|
-
"pluginStore.plugins":
|
|
139
|
-
|
|
140
|
-
source:
|
|
141
|
-
registry:
|
|
142
|
-
id:
|
|
133
|
+
i.object({
|
|
134
|
+
"pluginStore.registries": i.array(i.string()).default([
|
|
135
|
+
C.PLUGIN_REGISTRY_URL
|
|
136
|
+
]).description(t`Registry URLs`).hidden(),
|
|
137
|
+
"pluginStore.cdnForNpm": i.string().description(t`CDN to install packages from npm`).default('https://cdn.jsdelivr.net/npm/{{ package }}{{ version ? "@" + version : "" }}').hidden(),
|
|
138
|
+
"pluginStore.plugins": i.array(
|
|
139
|
+
i.object({
|
|
140
|
+
source: i.union(["online_manifest", "npm"]).default("online_manifest"),
|
|
141
|
+
registry: i.string().required(),
|
|
142
|
+
id: i.string().required()
|
|
143
143
|
})
|
|
144
|
-
).description(
|
|
144
|
+
).description(t`Installed plugins`).default([]).hidden()
|
|
145
145
|
}),
|
|
146
146
|
"plugin-store"
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
149
|
async showModal() {
|
|
150
150
|
const e = this.ctx.modal.show({
|
|
151
|
-
title:
|
|
151
|
+
title: $`Plugin Store`,
|
|
152
152
|
sizeClass: "small"
|
|
153
153
|
}), t = /* @__PURE__ */ R("section", { id: "ipe-plugin-store-vue" });
|
|
154
154
|
e.setContent(t);
|
|
@@ -158,13 +158,13 @@ let w = class v extends (A = j) {
|
|
|
158
158
|
}), e;
|
|
159
159
|
}
|
|
160
160
|
async install(e, t, r = "online_manifest") {
|
|
161
|
-
const
|
|
162
|
-
if (!
|
|
161
|
+
const s = await this.getRegistryInfo(e, r);
|
|
162
|
+
if (!s)
|
|
163
163
|
return this.ctx.logger.warn(`Registry ${e} not found`), null;
|
|
164
164
|
const a = `${e}#${t}`;
|
|
165
165
|
if (this._installedPlugins.has(a))
|
|
166
166
|
return await this._installedPlugins.get(a) ?? null;
|
|
167
|
-
const l = this._installOneByRegistryInfo(e,
|
|
167
|
+
const l = this._installOneByRegistryInfo(e, s, t);
|
|
168
168
|
return this._installedPlugins.set(a, l), await l;
|
|
169
169
|
}
|
|
170
170
|
async uninstall(e, t) {
|
|
@@ -172,8 +172,8 @@ let w = class v extends (A = j) {
|
|
|
172
172
|
if (r === void 0)
|
|
173
173
|
return !0;
|
|
174
174
|
this._installedPlugins.delete(`${e}#${t}`);
|
|
175
|
-
const
|
|
176
|
-
return
|
|
175
|
+
const s = await r;
|
|
176
|
+
return s ? s.dispose?.() ?? !0 : !0;
|
|
177
177
|
}
|
|
178
178
|
async addToPreferences(e, t) {
|
|
179
179
|
let r = await this.ctx.preferences.get("pluginStore.plugins") || [];
|
|
@@ -181,7 +181,7 @@ let w = class v extends (A = j) {
|
|
|
181
181
|
}
|
|
182
182
|
async removeFromPreferences(e, t) {
|
|
183
183
|
let r = await this.ctx.preferences.get("pluginStore.plugins") || [];
|
|
184
|
-
return r = r.filter((
|
|
184
|
+
return r = r.filter((s) => s.registry !== e || s.id !== t), await this.ctx.preferences.set("pluginStore.plugins", r), !0;
|
|
185
185
|
}
|
|
186
186
|
async installAndSetPreference(e, t) {
|
|
187
187
|
return await this.addToPreferences(e, t), this.install(e, t);
|
|
@@ -191,7 +191,7 @@ let w = class v extends (A = j) {
|
|
|
191
191
|
}
|
|
192
192
|
// 3) 增加 registryUrl 参数
|
|
193
193
|
async _installOneByRegistryInfo(e, t, r) {
|
|
194
|
-
const
|
|
194
|
+
const s = t.base_url, a = t.packages.find((o) => o.id === r);
|
|
195
195
|
if (!a)
|
|
196
196
|
return this.ctx.logger.warn(`Package ${r} not found in registry ${e}`), null;
|
|
197
197
|
const l = a.loader, { kind: f, entry: h = "index.js", styles: g = [], main_export: p = null } = l;
|
|
@@ -200,10 +200,10 @@ let w = class v extends (A = j) {
|
|
|
200
200
|
if (!h)
|
|
201
201
|
return this.ctx.logger.warn(`Entry url missing for ${r}`, l), null;
|
|
202
202
|
try {
|
|
203
|
-
c = E(h,
|
|
203
|
+
c = E(h, s, e);
|
|
204
204
|
} catch (o) {
|
|
205
205
|
return this.ctx.logger.warn(
|
|
206
|
-
`Failed to resolve entry "${h}" with base "${
|
|
206
|
+
`Failed to resolve entry "${h}" with base "${s}" and registry "${e}"`,
|
|
207
207
|
o
|
|
208
208
|
), null;
|
|
209
209
|
}
|
|
@@ -256,7 +256,7 @@ let w = class v extends (A = j) {
|
|
|
256
256
|
if (g && g.length > 0) {
|
|
257
257
|
let o = [];
|
|
258
258
|
try {
|
|
259
|
-
o = g.map((u) => E(u,
|
|
259
|
+
o = g.map((u) => E(u, s, e)).filter(Boolean);
|
|
260
260
|
} catch (u) {
|
|
261
261
|
this.ctx.logger.warn(`Failed to resolve styles for ${r}`, g, u);
|
|
262
262
|
}
|
|
@@ -294,15 +294,15 @@ let w = class v extends (A = j) {
|
|
|
294
294
|
} catch (a) {
|
|
295
295
|
this.ctx.logger.warn("Failed to fetch registry info", a);
|
|
296
296
|
}
|
|
297
|
-
const
|
|
298
|
-
if (!
|
|
297
|
+
const s = await this.getRegistryCache(e);
|
|
298
|
+
if (!s)
|
|
299
299
|
throw new Error(`Failed to fetch registry info: ${e}`);
|
|
300
|
-
return
|
|
300
|
+
return s;
|
|
301
301
|
}
|
|
302
302
|
async _fetchOnlineRegistryInfo(e, t = !1) {
|
|
303
303
|
if (!t && this._onlineRegistryQueries.has(e))
|
|
304
304
|
return await this._onlineRegistryQueries.get(e);
|
|
305
|
-
const
|
|
305
|
+
const s = (async () => {
|
|
306
306
|
const a = {
|
|
307
307
|
method: "GET"
|
|
308
308
|
};
|
|
@@ -310,7 +310,7 @@ let w = class v extends (A = j) {
|
|
|
310
310
|
const f = await (await fetch(e, a)).json();
|
|
311
311
|
return this.validateRegistry(f);
|
|
312
312
|
})();
|
|
313
|
-
return this._onlineRegistryQueries.set(e,
|
|
313
|
+
return this._onlineRegistryQueries.set(e, s), await s;
|
|
314
314
|
}
|
|
315
315
|
async getRegistryCache(e) {
|
|
316
316
|
const t = await this.regInfoDB.get(e);
|
|
@@ -345,18 +345,18 @@ let w = class v extends (A = j) {
|
|
|
345
345
|
*/
|
|
346
346
|
async refreshAllRegistryCaches() {
|
|
347
347
|
const e = await this.ctx.preferences.get("pluginStore.registries") || [], t = await Promise.allSettled(
|
|
348
|
-
e.map((
|
|
348
|
+
e.map((s) => this.refreshRegistryCache(s))
|
|
349
349
|
), r = {};
|
|
350
|
-
for (const [
|
|
351
|
-
a.status === "fulfilled" ? r[e[
|
|
350
|
+
for (const [s, a] of t.entries())
|
|
351
|
+
a.status === "fulfilled" ? r[e[s]] = a.value : r[e[s]] = null;
|
|
352
352
|
return r;
|
|
353
353
|
}
|
|
354
354
|
};
|
|
355
|
-
I =
|
|
356
|
-
w =
|
|
357
|
-
|
|
358
|
-
let
|
|
355
|
+
I = D(T);
|
|
356
|
+
w = H(I, 0, "PluginPluginStore", A, w);
|
|
357
|
+
Q(I, 1, w);
|
|
358
|
+
let X = w;
|
|
359
359
|
export {
|
|
360
|
-
|
|
360
|
+
X as PluginPluginStore
|
|
361
361
|
};
|
|
362
|
-
//# sourceMappingURL=index-
|
|
362
|
+
//# sourceMappingURL=index-D3iZhRMJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-D3iZhRMJ.js","sources":["../src/plugins/plugin-store/schema.ts","../src/plugins/plugin-store/index.tsx"],"sourcesContent":["import Schema from 'schemastery'\n\nexport const PLUGIN_STORE_REGISTRY_MANIFEST_VERSION = 1\n\nexport interface PluginStoreRegistry {\n manifest_version: number\n name: string\n base_url: string\n homepage?: string\n maintainers?: PluginStoreRegistryMaintainer[]\n repository?: PluginStoreRegistryRepository\n packages: PluginStorePackage[]\n}\n\nexport interface PluginStoreRegistryMaintainer {\n name: string\n email?: string\n}\n\nexport interface PluginStoreRegistryRepository {\n type: 'git'\n url: string\n}\n\nexport interface PluginStorePackage {\n id: string\n name: string\n version: string\n description?: string\n author?: string\n license?: string\n loader: PluginStorePackageLoader\n}\n\nexport interface PluginStorePackageLoader {\n kind: 'autoload' | 'module' | 'umd' | 'styles'\n entry?: string\n styles?: string[]\n main_export?: string\n}\n\nexport namespace PluginStoreSchemas {\n export const PackageLoader = new Schema<PluginStorePackageLoader>(\n Schema.object({\n kind: Schema.union(['autoload', 'module', 'umd', 'styles']).required().default('autoload'),\n entry: Schema.string(),\n styles: Schema.array(Schema.string()),\n main_export: Schema.string(),\n })\n )\n\n export const Package = new Schema<PluginStorePackage>(\n Schema.object({\n id: Schema.string().required(),\n name: Schema.string().required(),\n version: Schema.string().required(),\n description: Schema.string(),\n author: Schema.string(),\n license: Schema.string(),\n loader: PackageLoader.required(),\n })\n )\n\n export const RegistryMaintainer = new Schema<PluginStoreRegistryMaintainer>(\n Schema.object({\n name: Schema.string().required(),\n email: Schema.string(),\n })\n )\n\n export const RegistryRepository = new Schema<PluginStoreRegistryRepository>(\n Schema.object({\n type: Schema.union(['git']).required().default('git'),\n url: Schema.string().required(),\n })\n )\n\n export const Registry = new Schema<PluginStoreRegistry>(\n Schema.object({\n manifest_version: Schema.number().min(PLUGIN_STORE_REGISTRY_MANIFEST_VERSION).required(),\n name: Schema.string().required(),\n base_url: Schema.string().required(),\n homepage: Schema.string(),\n maintainers: Schema.array(RegistryMaintainer),\n repository: RegistryRepository,\n packages: Schema.array(Package).required(),\n })\n )\n}\n","import { InPageEdit, Schema } from '@/InPageEdit'\nimport { ForkScope, Inject } from '@cordisjs/core'\nimport { defineAsyncComponent, type App as VueApp } from 'vue'\nimport { PluginStoreRegistry, PluginStoreSchemas } from './schema'\nimport { AbstractIPEStorageManager } from '@/services/storage/index.js'\n\ndeclare module '@/InPageEdit' {\n interface InPageEdit {\n store: PluginPluginStore\n }\n interface PreferencesMap {\n 'pluginStore.registries': string[]\n 'pluginStore.plugins': { source?: 'online_manifest' | 'npm'; registry: string; id: string }[]\n 'pluginStore.cdnForNpm': string\n }\n}\n\nexport type PluginStoreRegistrySource = 'online_manifest' | 'npm'\n\nconst tryGetGlobalPlugin = (main_export: string) => {\n if (!main_export) return null\n try {\n return main_export\n .split('.')\n .reduce<any>((acc, key) => (acc == null ? acc : acc[key]), globalThis as any)\n } catch {\n return null\n }\n}\n\n/**\n * 解析资源URL\n * @param resourcePath - entry或style路径,可能是相对路径或完整URL\n * @param baseUrl - registry中的base_url,可能是完整URL或相对路径\n * @param registryUrl - registry的URL(必须是绝对URL,作为相对baseUrl时的基准)\n * @returns 解析后的完整URL\n */\nconst resolveResourceUrl = (resourcePath: string, baseUrl: string, registryUrl: string): string => {\n // 完整URL:直接返回\n if (/^https?:\\/\\//i.test(resourcePath)) return resourcePath\n\n // 兜底:规范化一个“带尾斜杠”的 helper\n const ensureSlash = (s: string) => (s.endsWith('/') ? s : s + '/')\n\n // 如果 baseUrl 是完整URL:直接用它当基准(并确保目录语义)\n if (/^https?:\\/\\//i.test(baseUrl)) {\n const normalizedBase = ensureSlash(baseUrl)\n return new URL(resourcePath, normalizedBase).href\n }\n\n // baseUrl 是相对路径(如 './' 或 '/plugins')\n // 先把 baseUrl 相对于 registryUrl 解析成绝对URL\n // 注意:当 baseUrl 是 '/plugins' 这种根相对路径时,new URL 会以 registryUrl 的 origin 作为根。\n const registryAbs = (() => {\n try {\n return new URL(registryUrl).href\n } catch {\n // 极端情况(开发环境传了相对 registry),用页面 origin 兜底\n return new URL(registryUrl, location.origin).href\n }\n })()\n\n const resolvedBaseUrl = new URL(ensureSlash(baseUrl), registryAbs).href\n return new URL(resourcePath, resolvedBaseUrl).href\n}\n\n@Inject(['storage', 'preferences', 'resourceLoader', '$'])\nexport class PluginPluginStore extends BasePlugin {\n // re-export for external usage\n static readonly PluginStoreSchemas = PluginStoreSchemas\n static REGISTRY_INFO_CACHE_TTL = 1000 * 60 * 60 * 24 // 1 day\n static REGISTRY_INFO_STORAGE_NAME = 'plugin-store-registry'\n static REGISTRY_ETAG_STORAGE_NAME = 'psreg-etag'\n private regInfoDB: AbstractIPEStorageManager<PluginStoreRegistry>\n\n constructor(public ctx: InPageEdit) {\n super(ctx, {}, 'plugin-store')\n ctx.set('store', this)\n this.regInfoDB = ctx.storage.createDatabase<PluginStoreRegistry>(\n PluginPluginStore.REGISTRY_INFO_STORAGE_NAME,\n PluginPluginStore.REGISTRY_INFO_CACHE_TTL,\n 1,\n 'indexedDB'\n )\n }\n\n protected async start() {\n this._installUserPlugins()\n this._injectPreferenceUI()\n }\n\n private async _installUserPlugins() {\n const prefs = await this.ctx.preferences.get('pluginStore.plugins', [])\n if (!prefs?.length) {\n return\n }\n for (const pref of prefs) {\n this.install(pref.registry, pref.id, pref.source)\n }\n }\n\n private async _createManagementApp() {\n const ctx = await this.ctx.withInject(['store'])\n const PluginStoreApp = defineAsyncComponent(() => import('./components/PluginStoreApp.vue'))\n const app = createVueAppWithIPE(ctx, PluginStoreApp)\n return app\n }\n\n private async _injectPreferenceUI() {\n const ctx = this.ctx\n const $ = ctx.$\n\n ctx.preferences.defineCategory({\n name: 'plugin-store',\n label: $`Plugin Store`,\n description: $`Plugin Store`,\n index: 90,\n autoGenerateForm: false,\n customRenderer: async ({ onUnmount }) => {\n const container = <div id=\"ipe-plugin-store-preferences-vue\"></div>\n const app = await this._createManagementApp()\n app.mount(container)\n\n onUnmount(() => {\n app.unmount()\n this.ctx.logger.debug('Plugin Store preferences app unmounted')\n })\n\n return (\n <section>\n {container}\n {/* <div className=\"theme-ipe-prose\">\n <hr />\n <div style={{ textAlign: 'center', marginBottom: '1em', fontSize: '0.8em' }}>\n 🚫 DO NOT edit fields below manually 🚫\n </div>\n </div> */}\n </section>\n )\n },\n })\n\n ctx.preferences.registerCustomConfig(\n 'plugin-store',\n Schema.object({\n 'pluginStore.registries': Schema.array(Schema.string())\n .default([\n import.meta.env.PROD\n ? Endpoints.PLUGIN_REGISTRY_URL\n : import.meta.resolve('/src/__mock__/plugin-registry/index.json'),\n ])\n .description($`Registry URLs`)\n .hidden(),\n 'pluginStore.cdnForNpm': Schema.string()\n .description($`CDN to install packages from npm`)\n .default('https://cdn.jsdelivr.net/npm/{{ package }}{{ version ? \"@\" + version : \"\" }}')\n .hidden(),\n 'pluginStore.plugins': Schema.array(\n Schema.object({\n source: Schema.union(['online_manifest', 'npm']).default('online_manifest'),\n registry: Schema.string().required(),\n id: Schema.string().required(),\n })\n )\n .description($`Installed plugins`)\n .default([])\n .hidden(),\n }),\n 'plugin-store'\n )\n }\n\n async showModal() {\n const modal = this.ctx.modal.show({\n title: $`Plugin Store`,\n sizeClass: 'small',\n })\n const container = <section id=\"ipe-plugin-store-vue\"></section>\n modal.setContent(container)\n const app = await this._createManagementApp()\n app.mount(container)\n modal.on(modal.Event.Close, () => {\n app.unmount()\n })\n return modal\n }\n\n private _installedPlugins = new Map<string, Promise<ForkScope<InPageEdit> | null>>()\n async install(\n registry: string,\n id: string,\n source: PluginStoreRegistrySource = 'online_manifest'\n ): Promise<ForkScope<InPageEdit> | null> {\n const registryInfo = await this.getRegistryInfo(registry, source)\n if (!registryInfo) {\n this.ctx.logger.warn(`Registry ${registry} not found`)\n return null\n }\n const key = `${registry}#${id}`\n if (this._installedPlugins.has(key)) {\n return (await this._installedPlugins.get(key)) ?? null\n }\n // 2) 把 registry 原始 URL 传进去,供 URL 解析使用\n const scope = this._installOneByRegistryInfo(registry, registryInfo, id)\n this._installedPlugins.set(key, scope)\n return await scope\n }\n async uninstall(registry: string, id: string): Promise<boolean> {\n const promise = this._installedPlugins.get(`${registry}#${id}`)\n if (promise === void 0) {\n return true // not installed or already uninstalled\n }\n this._installedPlugins.delete(`${registry}#${id}`)\n const scope = await promise\n if (scope) {\n return scope.dispose?.() ?? true // disposed successfully\n }\n return true // not a plugin, just removed from the list\n }\n\n async addToPreferences(registry: string, id: string) {\n let prefs =\n (await this.ctx.preferences.get<{ registry: string; id: string }[]>('pluginStore.plugins')) ||\n []\n const existed = prefs.some((p) => p.registry === registry && p.id === id)\n if (existed) {\n return true\n }\n prefs.push({ registry, id })\n await this.ctx.preferences.set('pluginStore.plugins', prefs)\n return true\n }\n async removeFromPreferences(registry: string, id: string) {\n let prefs =\n (await this.ctx.preferences.get<{ registry: string; id: string }[]>('pluginStore.plugins')) ||\n []\n prefs = prefs.filter((p) => p.registry !== registry || p.id !== id)\n await this.ctx.preferences.set('pluginStore.plugins', prefs)\n return true\n }\n\n async installAndSetPreference(registry: string, id: string) {\n await this.addToPreferences(registry, id)\n return this.install(registry, id)\n }\n async uninstallAndRemovePreference(registry: string, id: string) {\n await this.removeFromPreferences(registry, id)\n return this.uninstall(registry, id)\n }\n\n // 3) 增加 registryUrl 参数\n private async _installOneByRegistryInfo(\n registryUrl: string,\n registryInfo: PluginStoreRegistry,\n id: string\n ): Promise<ForkScope<InPageEdit> | null> {\n const baseUrl = registryInfo.base_url\n const pkg = registryInfo.packages.find((p) => p.id === id)\n if (!pkg) {\n this.ctx.logger.warn(`Package ${id} not found in registry ${registryUrl}`)\n return null\n }\n\n const loader = pkg.loader\n const { kind, entry = 'index.js', styles = [], main_export = null } = loader\n\n // 4) 统一用 resolveResourceUrl 解析入口\n let entryUrl: string | null = null\n if (kind !== 'styles') {\n if (!entry) {\n this.ctx.logger.warn(`Entry url missing for ${id}`, loader)\n return null\n }\n try {\n entryUrl = resolveResourceUrl(entry, baseUrl, registryUrl)\n } catch (e) {\n this.ctx.logger.warn(\n `Failed to resolve entry \"${entry}\" with base \"${baseUrl}\" and registry \"${registryUrl}\"`,\n e\n )\n return null\n }\n }\n\n const datasets = {\n 'data-plugin-registry': registryUrl,\n 'data-plugin-id': id,\n }\n\n let fork: ForkScope<InPageEdit> | null = null\n\n switch (kind) {\n case 'autoload': {\n fork = this.ctx.plugin({\n inject: ['resourceLoader'],\n name: `plugin-store-${registryUrl}-${id}`,\n apply: (ctx) => {\n if (!entryUrl) return\n ctx.resourceLoader.loadScript(entryUrl, { ...datasets })\n },\n })\n break\n }\n case 'module': {\n if (!entryUrl) {\n this.ctx.logger.warn(`Entry url missing for module kind, package ${id}`)\n return null\n }\n const apply = await import(/* @vite-ignore */ entryUrl).then(\n (m) => (main_export ? m[main_export] : m.default) ?? m\n )\n if (!apply) {\n this.ctx.logger.warn(`Main export ${main_export} not found in module ${entryUrl}`)\n return null\n }\n fork = this.ctx.plugin(apply)\n break\n }\n case 'umd': {\n let apply = tryGetGlobalPlugin(main_export!)\n if (!apply) {\n if (!entryUrl) {\n this.ctx.logger.warn(`Entry url missing for umd kind, package ${id}`)\n return null\n }\n await this.ctx.resourceLoader.loadScript(entryUrl, { ...datasets })\n apply = tryGetGlobalPlugin(main_export!)\n }\n if (!apply) {\n this.ctx.logger.warn(\n `Main export ${main_export} not found on globalThis after loading ${entryUrl}`\n )\n return null\n }\n fork = this.ctx.plugin(apply)\n break\n }\n case 'styles': {\n // 没有脚本,仅样式。下面统一样式注入逻辑会覆盖\n break\n }\n }\n\n // 5) 统一解析并注入样式(兼容绝对URL与相对 + base_url 的组合)\n if (styles && styles.length > 0) {\n let urls: string[] = []\n try {\n urls = styles.map((u) => resolveResourceUrl(u, baseUrl, registryUrl)).filter(Boolean)\n } catch (e) {\n this.ctx.logger.warn(`Failed to resolve styles for ${id}`, styles, e)\n }\n\n // 确保存在父 fork\n fork ||= this.ctx.plugin({ name: `plugin-store-${registryUrl}-${id}`, apply() {} })\n\n // 在子插件里加载样式,并在卸载时清理\n fork.ctx.plugin({\n inject: ['resourceLoader'],\n name: `plugin-store-${registryUrl}-${id}-styles`,\n apply: (ctx) => {\n urls.forEach((u) => ctx.resourceLoader.loadStyle(u, { ...datasets }))\n ctx.on('dispose', () => {\n try {\n urls.forEach((u) => ctx.resourceLoader.removeStyle(u))\n } catch (e) {\n console.info('styles cleanup failed', e)\n }\n })\n },\n })\n }\n\n return fork\n }\n\n validateRegistry(data: any): PluginStoreRegistry {\n return PluginStoreSchemas.Registry(data)\n }\n\n async getRegistryInfo(\n registry: string,\n source: PluginStoreRegistrySource = 'online_manifest',\n noCache = false\n ): Promise<PluginStoreRegistry> {\n try {\n let info: PluginStoreRegistry\n switch (source) {\n case 'online_manifest': {\n info = await this._fetchOnlineRegistryInfo(registry, noCache)\n this.logger.debug('Fetched registry info from online manifest', info)\n this.setRegistryCache(registry, info)\n break\n }\n default: {\n throw new Error(`Unsupported registry source: ${source}`)\n }\n }\n\n return info\n } catch (e) {\n this.ctx.logger.warn('Failed to fetch registry info', e)\n }\n\n const info = await this.getRegistryCache(registry)\n if (!info) {\n throw new Error(`Failed to fetch registry info: ${registry}`)\n }\n return info\n }\n\n private _onlineRegistryQueries = new Map<string, Promise<PluginStoreRegistry>>()\n private async _fetchOnlineRegistryInfo(\n registry: string,\n noCache = false\n ): Promise<PluginStoreRegistry> {\n if (!noCache && this._onlineRegistryQueries.has(registry)) {\n return await this._onlineRegistryQueries.get(registry)!\n }\n const task = async () => {\n const payload: RequestInit = {\n method: 'GET',\n }\n if (noCache) {\n payload.cache = 'no-store'\n }\n const response = await fetch(registry, payload)\n const data = await response.json()\n const validated = this.validateRegistry(data)\n return validated\n }\n const promise = task()\n this._onlineRegistryQueries.set(registry, promise)\n return await promise\n }\n\n private async getRegistryCache(registry: string) {\n const data = await this.regInfoDB.get(registry)\n if (data) {\n try {\n const validated = this.validateRegistry(data)\n return validated\n } catch (e) {\n this.ctx.logger.warn('Invalid cached registry', e, data)\n this.regInfoDB.delete(registry)\n }\n }\n return null\n }\n private async setRegistryCache(registry: string, data: PluginStoreRegistry) {\n return this.regInfoDB.set(registry, data)\n }\n private async deleteRegistryCache(registry: string) {\n await this.regInfoDB.delete(registry)\n }\n async clearAllRegistryCaches() {\n await this.regInfoDB.clear()\n this.ctx.logger.debug('All registry caches cleared')\n }\n\n /**\n * 刷新指定 registry 的缓存(重新从网络获取)\n */\n async refreshRegistryCache(registry: string): Promise<PluginStoreRegistry> {\n const data = await this.getRegistryInfo(registry, 'online_manifest', true)\n if (!data) {\n throw new Error(`Failed to refresh registry cache: ${registry}`)\n }\n this.ctx.logger.debug('Registry cache refreshed:', registry)\n return data\n }\n\n /**\n * 刷新所有已配置的 registry 缓存\n */\n async refreshAllRegistryCaches(): Promise<Record<string, PluginStoreRegistry | null>> {\n const registryUrls = (await this.ctx.preferences.get('pluginStore.registries')) || []\n const responses = await Promise.allSettled(\n registryUrls.map((url) => this.refreshRegistryCache(url))\n )\n const results: Record<string, PluginStoreRegistry | null> = {}\n for (const [index, response] of responses.entries()) {\n if (response.status === 'fulfilled') {\n results[registryUrls[index]] = response.value\n } else {\n results[registryUrls[index]] = null\n }\n }\n return results\n }\n}\n"],"names":["PLUGIN_STORE_REGISTRY_MANIFEST_VERSION","PluginStoreSchemas","Schema","_PluginPluginStore_decorators","_init","_a","tryGetGlobalPlugin","main_export","acc","key","resolveResourceUrl","resourcePath","baseUrl","registryUrl","ensureSlash","s","normalizedBase","registryAbs","resolvedBaseUrl","Inject","_PluginPluginStore","BasePlugin","ctx","prefs","pref","PluginStoreApp","defineAsyncComponent","createVueAppWithIPE","$","onUnmount","container","jsx","app","Endpoints","modal","registry","id","source","registryInfo","scope","promise","p","pkg","loader","kind","entry","styles","entryUrl","e","datasets","fork","apply","m","urls","u","data","noCache","info","payload","registryUrls","responses","url","results","index","response","__decoratorStart","__decorateElement","__runInitializers","PluginPluginStore"],"mappings":";;;;AAEO,MAAMA,IAAyC;AAuC/C,IAAUC;AAAA,CAAV,CAAU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