@inpageedit/core 0.13.1 → 0.14.1

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 (77) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +13 -4
  3. package/dist/{BasePlugin-Bf2UuIHF.js → BasePlugin-YOi2_vUo.js} +17 -26
  4. package/dist/BasePlugin-YOi2_vUo.js.map +1 -0
  5. package/dist/IconQuickEdit-CMCQncyj.js.map +1 -1
  6. package/dist/InputBox-nQKtiWtZ.js.map +1 -1
  7. package/dist/{PluginPrefSync-Dn1Xsiqz.js → PluginPrefSync-jTNlRQE-.js} +124 -128
  8. package/dist/PluginPrefSync-jTNlRQE-.js.map +1 -0
  9. package/dist/PluginStoreApp-CGNxKXAN.js +453 -0
  10. package/dist/PluginStoreApp-CGNxKXAN.js.map +1 -0
  11. package/dist/{endpoints-DgyuoRZd.js → Preferences-BF2fcXrn.js} +608 -576
  12. package/dist/Preferences-BF2fcXrn.js.map +1 -0
  13. package/dist/WatchlistAction-BbNAyryN.js.map +1 -1
  14. package/dist/components/index.js.map +1 -1
  15. package/dist/index-3NZkG2a3.js +116 -0
  16. package/dist/index-3NZkG2a3.js.map +1 -0
  17. package/dist/{index-BJ7_Q1mB.js → index-BBNseJXG.js} +17 -16
  18. package/dist/index-BBNseJXG.js.map +1 -0
  19. package/dist/{index-BQ-cHWkJ.js → index-Bb0FiU2c.js} +66 -48
  20. package/dist/index-Bb0FiU2c.js.map +1 -0
  21. package/dist/{index-DqA6EAM6.js → index-BgkZW91u.js} +1429 -928
  22. package/dist/index-BgkZW91u.js.map +1 -0
  23. package/dist/index-BrYKe18j.js +179 -0
  24. package/dist/index-BrYKe18j.js.map +1 -0
  25. package/dist/index-CG38LlAh.js.map +1 -1
  26. package/dist/index-CM_6yF2v.js.map +1 -1
  27. package/dist/index-D-fW3ESK.js +195 -0
  28. package/dist/index-D-fW3ESK.js.map +1 -0
  29. package/dist/index-D6zFqL2u.js +173 -0
  30. package/dist/index-D6zFqL2u.js.map +1 -0
  31. package/dist/{index-CCRMmnwk.js → index-D97lUU3h.js} +67 -66
  32. package/dist/index-D97lUU3h.js.map +1 -0
  33. package/dist/index-DD5CVCfD.js.map +1 -1
  34. package/dist/{index-B7c6jL9x.js → index-DELHsLHS.js} +146 -137
  35. package/dist/index-DELHsLHS.js.map +1 -0
  36. package/dist/{index-BwdWyHLe.js → index-DTHY5rAO.js} +93 -93
  37. package/dist/index-DTHY5rAO.js.map +1 -0
  38. package/dist/index-DmLoihN1.js +394 -0
  39. package/dist/index-DmLoihN1.js.map +1 -0
  40. package/dist/index.d.ts +362 -43
  41. package/dist/index.js +32 -26
  42. package/dist/index.js.map +1 -1
  43. package/dist/makeCallable-LDU0xZMJ.js.map +1 -1
  44. package/dist/models/index.js +174 -154
  45. package/dist/models/index.js.map +1 -1
  46. package/dist/noop-ClDc6zv4.js.map +1 -1
  47. package/dist/plugins/index.js +10 -10
  48. package/dist/services/index.js +1 -1
  49. package/dist/style.css +1 -1
  50. package/dist/vueHooks-l04s8cIl.js.map +1 -1
  51. package/lib/index.umd.js +20 -12
  52. package/lib/index.umd.js.map +1 -1
  53. package/lib/style.css +1 -1
  54. package/package.json +4 -4
  55. package/dist/BasePlugin-Bf2UuIHF.js.map +0 -1
  56. package/dist/PluginPrefSync-Dn1Xsiqz.js.map +0 -1
  57. package/dist/PluginStoreApp-CpOLArL7.js +0 -452
  58. package/dist/PluginStoreApp-CpOLArL7.js.map +0 -1
  59. package/dist/Preferences-DS4-CFWe.js +0 -9
  60. package/dist/Preferences-DS4-CFWe.js.map +0 -1
  61. package/dist/endpoints-DgyuoRZd.js.map +0 -1
  62. package/dist/index-2RfILgXm.js +0 -180
  63. package/dist/index-2RfILgXm.js.map +0 -1
  64. package/dist/index-B7c6jL9x.js.map +0 -1
  65. package/dist/index-BJ7_Q1mB.js.map +0 -1
  66. package/dist/index-BNh95-x2.js +0 -115
  67. package/dist/index-BNh95-x2.js.map +0 -1
  68. package/dist/index-BQ-cHWkJ.js.map +0 -1
  69. package/dist/index-BwdWyHLe.js.map +0 -1
  70. package/dist/index-CCRMmnwk.js.map +0 -1
  71. package/dist/index-CnIpUF9x.js +0 -173
  72. package/dist/index-CnIpUF9x.js.map +0 -1
  73. package/dist/index-CyG7_IYz.js +0 -394
  74. package/dist/index-CyG7_IYz.js.map +0 -1
  75. package/dist/index-DqA6EAM6.js.map +0 -1
  76. package/dist/index-eSlbrNqF.js +0 -146
  77. package/dist/index-eSlbrNqF.js.map +0 -1
@@ -1,452 +0,0 @@
1
- import { a as D, l as P, e as d, h as g, y as w, C as X, k as O, r as R, f as j, q as r, D as S, E as z, G, H as T, I as E, z as y, F as q, x as Y, v as L, g as Z } from "./vueHooks-l04s8cIl.js";
2
- import { c as N } from "./index-CM_6yF2v.js";
3
- import { E as ee } from "./endpoints-DgyuoRZd.js";
4
- import { _ as H } from "./_plugin-vue_export-helper-CHgC5LLL.js";
5
- const V = /* @__PURE__ */ D({
6
- __name: "UIBaseButton",
7
- props: {
8
- variant: { default: "neutral" },
9
- active: { type: Boolean, default: !1 }
10
- },
11
- setup(I) {
12
- const t = I, c = P(() => ({
13
- "is-active": t.active,
14
- "is-danger": t.variant === "danger",
15
- "is-primary": t.variant === "primary",
16
- "is-ghost": t.variant === "ghost",
17
- "is-accent": t.variant === "accent"
18
- }));
19
- return (v, m) => (g(), d("button", {
20
- class: w(["ipeps-button", c.value])
21
- }, [
22
- X(v.$slots, "default")
23
- ], 2));
24
- }
25
- }), se = { id: "ipe-registry-manager" }, te = { class: "ipeps-header" }, ie = { class: "ipeps-input-wrapper" }, re = ["disabled"], ne = {
26
- key: 0,
27
- class: "ipeps-list"
28
- }, ae = { class: "registry-info" }, oe = { class: "item-name" }, le = { class: "item-desc" }, ce = { class: "homepage" }, de = ["href"], ge = { class: "url" }, ue = { class: "item-meta" }, ye = { class: "ipeps-actions" }, pe = {
29
- key: 1,
30
- class: "ipeps-empty"
31
- }, ve = { class: "description" }, fe = /* @__PURE__ */ D({
32
- __name: "RegistryManager",
33
- setup(I) {
34
- const t = O(), c = R([]), v = R(""), m = R(!1), h = (o) => {
35
- try {
36
- return new URL(o).hostname;
37
- } catch {
38
- return o;
39
- }
40
- };
41
- async function _() {
42
- const o = await t.preferences.get("pluginStore.registries") || [], n = await Promise.allSettled(
43
- o.map(async (i) => {
44
- const u = await t.store.getRegistryInfo(i);
45
- return {
46
- registryUrl: i,
47
- label: h(i),
48
- ...u
49
- };
50
- })
51
- );
52
- c.value = n.filter((i) => i.status === "fulfilled").map((i) => i.value);
53
- }
54
- async function x() {
55
- const o = v.value.trim();
56
- if (o) {
57
- if (c.value.some((n) => n.registryUrl === o)) {
58
- t.modal.notify("info", { content: "Registry already exists." });
59
- return;
60
- }
61
- m.value = !0;
62
- try {
63
- const n = await t.store.getRegistryInfo(o, "online_manifest", !0);
64
- if (!n)
65
- throw new Error("Invalid registry or unreachable");
66
- const i = await t.preferences.get("pluginStore.registries") || [];
67
- i.push(o), await t.preferences.set("pluginStore.registries", i), c.value.push({
68
- registryUrl: o,
69
- label: h(o),
70
- ...n
71
- }), v.value = "", t.modal.notify("success", { content: "Registry added." });
72
- } catch (n) {
73
- t.modal.notify("error", {
74
- content: n instanceof Error ? n.message : String(n)
75
- });
76
- } finally {
77
- m.value = !1;
78
- }
79
- }
80
- }
81
- async function f(o) {
82
- const i = (await t.preferences.get("pluginStore.registries") || []).filter((u) => u !== o);
83
- await t.preferences.set("pluginStore.registries", i), c.value = c.value.filter((u) => u.registryUrl !== o);
84
- }
85
- async function A(o) {
86
- const i = (await t.preferences.get("pluginStore.plugins") || []).filter((u) => u.registry === o);
87
- if (i.length === 0) {
88
- t.modal.confirm(
89
- {
90
- title: "Remove registry",
91
- content: `Remove registry:
92
- ${o}`,
93
- cancelBtn: {
94
- label: "Cancel",
95
- className: "is-ghost"
96
- },
97
- okBtn: {
98
- label: "Remove",
99
- className: "is-danger"
100
- }
101
- },
102
- async (u) => {
103
- u && (await f(o), t.modal.notify("success", { content: "Registry removed." }));
104
- }
105
- );
106
- return;
107
- }
108
- t.modal.dialog(
109
- {
110
- title: "Remove registry",
111
- // content: `There ${installedOfReg.length === 1 ? 'is' : 'are'} ${installedOfReg.length} installed plugin${installedOfReg.length === 1 ? '' : 's'} from this registry:\n${installedOfReg.map((p) => p.id).join('\n')}`,
112
- content: N("div", { class: "theme-ipe-prose" }, [
113
- N(
114
- "p",
115
- {},
116
- `There ${i.length === 1 ? "is" : "are"} ${i.length} installed plugin${i.length === 1 ? "" : "s"} from this registry:`
117
- ),
118
- N(
119
- "ul",
120
- {},
121
- i.map((u) => N("li", {}, u.id))
122
- )
123
- ]),
124
- buttons: [
125
- {
126
- label: "Remove only",
127
- className: "is-danger is-ghost",
128
- method: async (u, C) => {
129
- await f(o), t.modal.notify("success", { content: "Registry removed." }), C.close();
130
- }
131
- },
132
- {
133
- label: "Remove and uninstall plugins",
134
- className: "is-danger",
135
- method: async (u, C) => {
136
- await f(o);
137
- for (const $ of i)
138
- try {
139
- await t.store.uninstallAndRemovePreference($.registry, $.id);
140
- } catch (M) {
141
- t.modal.notify("error", {
142
- content: M instanceof Error ? `Failed to uninstall ${$.id}: ${M.message}` : `Failed to uninstall ${$.id}`
143
- });
144
- }
145
- t.modal.notify("success", {
146
- content: `Registry removed and ${i.length} ${i.length === 1 ? "plugin" : "plugins"} uninstalled.`
147
- }), C.close();
148
- }
149
- }
150
- ]
151
- },
152
- () => {
153
- }
154
- );
155
- }
156
- function U(o) {
157
- const n = o.changes["pluginStore.registries"];
158
- Array.isArray(n) && _();
159
- }
160
- function B() {
161
- const o = ee.PLUGIN_REGISTRY_URL;
162
- v.value = o, x();
163
- }
164
- return j(() => {
165
- _(), t.on("preferences/changed", U);
166
- }), (o, n) => (g(), d("div", se, [
167
- r("div", te, [
168
- n[2] || (n[2] = r("div", { class: "ipeps-header-title" }, "Registries", -1)),
169
- r("div", ie, [
170
- z(r("input", {
171
- class: "ipeps-input with-icon",
172
- "onUpdate:modelValue": n[0] || (n[0] = (i) => v.value = i),
173
- type: "url",
174
- placeholder: "Add registry URL (https://...)",
175
- disabled: m.value
176
- }, null, 8, re), [
177
- [
178
- G,
179
- v.value,
180
- void 0,
181
- { trim: !0 }
182
- ]
183
- ]),
184
- n[1] || (n[1] = r("div", { class: "ipeps-input-icon" }, "📦", -1))
185
- ]),
186
- S(V, {
187
- onClick: x,
188
- disabled: m.value || !v.value,
189
- variant: "primary"
190
- }, {
191
- default: T(() => [
192
- E(y(m.value ? "Adding..." : "Add"), 1)
193
- ]),
194
- _: 1
195
- }, 8, ["disabled"])
196
- ]),
197
- c.value.length ? (g(), d("div", ne, [
198
- (g(!0), d(q, null, Y(c.value, (i) => (g(), d("div", {
199
- class: "ipeps-item",
200
- key: i.registryUrl
201
- }, [
202
- r("div", ae, [
203
- r("div", oe, y(i.label), 1),
204
- r("div", le, [
205
- r("div", ce, [
206
- i.homepage ? (g(), d("a", {
207
- key: 0,
208
- href: i.homepage,
209
- target: "_blank"
210
- }, y(i.homepage), 9, de)) : L("", !0)
211
- ]),
212
- r("div", ge, y(i.registryUrl), 1)
213
- ]),
214
- r("div", ue, y(i.packages.length) + " packages", 1)
215
- ]),
216
- r("div", ye, [
217
- S(V, {
218
- onClick: (u) => A(i.registryUrl),
219
- variant: "danger"
220
- }, {
221
- default: T(() => [...n[3] || (n[3] = [
222
- E("Remove", -1)
223
- ])]),
224
- _: 1
225
- }, 8, ["onClick"])
226
- ])
227
- ]))), 128))
228
- ])) : (g(), d("div", pe, [
229
- n[5] || (n[5] = r("div", { class: "icon" }, "🗂️", -1)),
230
- n[6] || (n[6] = r("div", { class: "text" }, "No registries configured", -1)),
231
- r("div", ve, [
232
- S(V, {
233
- onClick: B,
234
- variant: "primary",
235
- style: { padding: "0.25rem 0.5rem" }
236
- }, {
237
- default: T(() => [...n[4] || (n[4] = [
238
- E("setup default registry", -1)
239
- ])]),
240
- _: 1
241
- })
242
- ])
243
- ]))
244
- ]));
245
- }
246
- }), me = /* @__PURE__ */ H(fe, [["__scopeId", "data-v-132e6dc8"]]), he = { id: "ipe-plugin-install-manager" }, _e = { class: "ipeps-header" }, ke = { class: "ipeps-input-wrapper" }, Re = ["disabled"], be = ["disabled"], we = {
247
- key: 0,
248
- class: "ipeps-loading"
249
- }, $e = {
250
- key: 1,
251
- class: "ipeps-list"
252
- }, Se = { class: "plugin-info" }, Ue = { class: "plugin-header" }, Ce = { class: "item-name" }, Pe = { class: "ipeps-tags" }, Le = ["href", "title"], Ie = ["title"], xe = { class: "plugin-meta" }, Ae = {
253
- key: 0,
254
- class: "version"
255
- }, Be = {
256
- key: 1,
257
- class: "author"
258
- }, Me = {
259
- key: 2,
260
- class: "license"
261
- }, Ne = {
262
- key: 2,
263
- class: "ipeps-empty"
264
- }, Te = /* @__PURE__ */ D({
265
- __name: "PluginInstallManager",
266
- setup(I) {
267
- const t = O(), c = R([]), v = R([]), m = R(""), h = R(!1), _ = (s, a) => `${s}
268
- ${a}`, x = P(
269
- () => new Set(v.value.map((s) => _(s.registry, s.id)))
270
- ), f = (s) => x.value.has(s), A = (s) => {
271
- try {
272
- return new URL(s).hostname;
273
- } catch {
274
- return s;
275
- }
276
- }, U = R(!1), B = P(() => c.value.length > 0), o = P(() => {
277
- const s = m.value.trim().toLowerCase(), a = c.value.flatMap(
278
- (l) => (l.packages || []).map((p) => ({
279
- ...p,
280
- _key: _(l.registryUrl, p.id),
281
- registry: l.registryUrl,
282
- registryHomepage: l.homepage,
283
- registryLabel: A(l.registryUrl),
284
- isBroken: !1,
285
- isRegistryMissing: !1
286
- }))
287
- ), e = new Set(a.map((l) => l._key)), k = new Set(c.value.map((l) => l.registryUrl)), b = v.value.filter((l) => !e.has(_(l.registry, l.id))).map((l) => {
288
- const p = c.value.find((W) => W.registryUrl === l.registry);
289
- return {
290
- id: l.id,
291
- name: void 0,
292
- description: void 0,
293
- version: void 0,
294
- author: void 0,
295
- license: void 0,
296
- _key: _(l.registry, l.id),
297
- registry: l.registry,
298
- registryHomepage: p?.homepage,
299
- registryLabel: A(l.registry),
300
- isBroken: !0,
301
- isRegistryMissing: !k.has(l.registry)
302
- };
303
- }), F = (l) => s ? l.filter(
304
- (p) => p.name && p.name.toLowerCase().includes(s) || p.id && p.id.toLowerCase().includes(s) || p.description && p.description.toLowerCase().includes(s) || p.author && p.author.toLowerCase().includes(s) || p.registry && p.registry.toLowerCase().includes(s)
305
- ) : l;
306
- return [...F(b), ...F(a)];
307
- }), n = P(() => o.value), i = (s) => s.description ? s.description : s.isBroken ? s.isRegistryMissing ? "[Recommend to uninstall] The registry is unavailable. Try refreshing or re-adding the registry to fix this issue." : "[Recommend to uninstall] This plugin was removed from the registry. Try refreshing the registry to confirm." : "", u = async (s, a) => {
308
- t.store.installAndSetPreference(s, a);
309
- }, C = async (s, a) => {
310
- t.store.uninstallAndRemovePreference(s, a);
311
- }, $ = (s, a) => f(_(s, a)) ? C(s, a) : u(s, a), M = (s) => $(s.registry, s.id), J = async () => {
312
- if (h.value) return;
313
- if (c.value.length === 0) {
314
- t.modal.notify("info", {
315
- content: "No registry configured. Please add a registry first."
316
- });
317
- return;
318
- }
319
- h.value = !0;
320
- const s = await t.store.refreshAllRegistryCaches(), a = Object.entries(s).filter(([k, b]) => b !== null);
321
- c.value = a.map(([k, b]) => ({
322
- ...b,
323
- registryUrl: k
324
- }));
325
- const e = Object.entries(s).filter(([k, b]) => b === null).map(([k]) => k);
326
- h.value = !1, a.length === 0 ? t.modal.notify("error", {
327
- content: "All registries failed to refresh"
328
- }) : (t.modal.notify("success", {
329
- content: `${a.length} ${a.length === 1 ? "registry" : "registries"} refreshed successfully.`
330
- }), e.length > 0 && t.modal.notify("warning", {
331
- content: `${e.length} ${e.length === 1 ? "registry" : "registries"} failed to refresh:
332
- ${e.join(`
333
- `)}`
334
- }));
335
- }, K = async () => {
336
- U.value = !1;
337
- const s = await t.store.ctx.preferences.get("pluginStore.registries") || [], a = await Promise.allSettled(
338
- s.map(async (e) => ({
339
- ...await t.store.getRegistryInfo(e),
340
- registryUrl: e
341
- }))
342
- );
343
- c.value = a.filter((e) => e.status === "fulfilled").map((e) => e.value), v.value = await t.preferences.get("pluginStore.plugins") || [], U.value = !0;
344
- };
345
- function Q(s) {
346
- const a = s.changes["pluginStore.registries"], e = s.changes["pluginStore.plugins"];
347
- Array.isArray(e) && (v.value = e), Array.isArray(a) && K();
348
- }
349
- return j(() => {
350
- K(), t.on("preferences/changed", Q);
351
- }), Z(() => {
352
- }), (s, a) => (g(), d("div", he, [
353
- r("div", _e, [
354
- a[2] || (a[2] = r("div", { class: "ipeps-header-title" }, "Plugins", -1)),
355
- r("div", ke, [
356
- z(r("input", {
357
- class: "ipeps-input with-icon",
358
- "onUpdate:modelValue": a[0] || (a[0] = (e) => m.value = e),
359
- type: "text",
360
- placeholder: "Search plugins...",
361
- disabled: !n.value.length
362
- }, null, 8, Re), [
363
- [
364
- G,
365
- m.value,
366
- void 0,
367
- { trim: !0 }
368
- ]
369
- ]),
370
- a[1] || (a[1] = r("div", { class: "ipeps-input-icon" }, "🔍", -1))
371
- ]),
372
- r("button", {
373
- class: w(["ipeps-button", { refreshing: h.value }]),
374
- onClick: J,
375
- disabled: h.value || !B.value,
376
- variant: "primary"
377
- }, y(h.value ? "Refreshing..." : "Refresh"), 11, be)
378
- ]),
379
- !B.value && !U.value ? (g(), d("div", we, [...a[3] || (a[3] = [
380
- r("div", { class: "loading-spinner" }, null, -1),
381
- r("div", { class: "loading-text" }, "Loading...", -1)
382
- ])])) : n.value.length ? (g(), d("div", $e, [
383
- (g(!0), d(q, null, Y(n.value, (e) => (g(), d("div", {
384
- class: w(["ipeps-item", { installed: f(e._key), broken: e.isBroken }]),
385
- key: e._key
386
- }, [
387
- r("div", Se, [
388
- r("div", Ue, [
389
- r("div", Ce, y(e.name || e.id), 1),
390
- f(e._key) || e.isBroken ? (g(), d("span", {
391
- key: 0,
392
- class: w(["ipeps-badge", { "is-installed": f(e._key), "is-broken": e.isBroken }])
393
- }, y(e.isBroken ? "⚠️ broken" : "✓"), 3)) : L("", !0)
394
- ]),
395
- r("div", Pe, [
396
- e.registryHomepage && !e.isRegistryMissing ? (g(), d("a", {
397
- key: 0,
398
- class: "ipeps-tag registry-tag",
399
- href: e.registryHomepage,
400
- target: "_blank",
401
- title: e.registryLabel
402
- }, y(e.registryLabel), 9, Le)) : (g(), d("span", {
403
- key: 1,
404
- class: w(["ipeps-tag registry-tag", { broken: e.isRegistryMissing }]),
405
- title: e.registryLabel
406
- }, y(e.registryLabel), 11, Ie)),
407
- r("div", {
408
- class: w(["plugin-id ipeps-tag", { broken: e.isBroken && !e.isRegistryMissing }])
409
- }, y(e.id), 3)
410
- ]),
411
- r("div", {
412
- class: w(["plugin-desc", { "broken-desc": e.isBroken }])
413
- }, y(i(e)), 3),
414
- r("div", xe, [
415
- e.version ? (g(), d("span", Ae, "v" + y(e.version), 1)) : L("", !0),
416
- e.author ? (g(), d("span", Be, "👤 " + y(e.author), 1)) : L("", !0),
417
- e.license ? (g(), d("span", Me, "📜 " + y(e.license), 1)) : L("", !0)
418
- ])
419
- ]),
420
- S(V, {
421
- active: f(e._key),
422
- variant: f(e._key) ? "danger" : "primary",
423
- onClick: (k) => M(e)
424
- }, {
425
- default: T(() => [
426
- E(y(f(e._key) ? "Remove" : "Install"), 1)
427
- ]),
428
- _: 2
429
- }, 1032, ["active", "variant", "onClick"])
430
- ], 2))), 128))
431
- ])) : (g(), d("div", Ne, [...a[4] || (a[4] = [
432
- r("div", { class: "plugin-empty-icon" }, "📦", -1),
433
- r("div", { class: "plugin-empty-text" }, "No matching plugins found", -1)
434
- ])]))
435
- ]));
436
- }
437
- }), Ee = /* @__PURE__ */ H(Te, [["__scopeId", "data-v-d61d6310"]]), Ve = { id: "ipe-plugin-store-app" }, De = /* @__PURE__ */ D({
438
- __name: "PluginStoreApp",
439
- setup(I) {
440
- return (t, c) => (g(), d("div", Ve, [
441
- S(Ee),
442
- c[0] || (c[0] = r("div", { class: "divider-wrapper" }, [
443
- r("hr", { class: "divider" })
444
- ], -1)),
445
- S(me)
446
- ]));
447
- }
448
- }), je = /* @__PURE__ */ H(De, [["__scopeId", "data-v-1b3d0d80"]]);
449
- export {
450
- je as default
451
- };
452
- //# sourceMappingURL=PluginStoreApp-CpOLArL7.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PluginStoreApp-CpOLArL7.js","sources":["../src/plugins/plugin-store/components/ui/UIBaseButton.vue","../src/plugins/plugin-store/components/RegistryManager.vue","../src/plugins/plugin-store/components/PluginInstallManager.vue"],"sourcesContent":["<template lang=\"pug\">\nbutton.ipeps-button(:class='buttonClass')\n slot\n</template>\n\n<script setup lang=\"ts\" vapor>\nimport { computed } from 'vue'\n\nconst props = withDefaults(\n defineProps<{\n variant?: 'neutral' | 'primary' | 'danger' | 'ghost' | 'accent'\n active?: boolean\n }>(),\n {\n variant: 'neutral',\n active: false,\n }\n)\n\nconst buttonClass = computed(() => ({\n 'is-active': props.active,\n 'is-danger': props.variant === 'danger',\n 'is-primary': props.variant === 'primary',\n 'is-ghost': props.variant === 'ghost',\n 'is-accent': props.variant === 'accent',\n}))\n</script>\n","<template lang=\"pug\">\n#ipe-registry-manager\n .ipeps-header\n .ipeps-header-title Registries\n .ipeps-input-wrapper\n input.ipeps-input.with-icon(\n v-model.trim='inputValue',\n type='url',\n placeholder='Add registry URL (https://...)',\n :disabled='isAdding'\n )\n .ipeps-input-icon 📦\n UIBaseButton(@click='onAddRegistry', :disabled='isAdding || !inputValue', variant='primary') {{ isAdding ? 'Adding...' : 'Add' }}\n\n .ipeps-list(v-if='registries.length')\n .ipeps-item(v-for='reg in registries', :key='reg.registryUrl')\n .registry-info\n .item-name {{ reg.label }}\n .item-desc\n .homepage: a(v-if='reg.homepage', :href='reg.homepage', target='_blank') {{ reg.homepage }}\n .url {{ reg.registryUrl }}\n .item-meta {{ reg.packages.length }} packages\n .ipeps-actions\n UIBaseButton(@click='onRemoveRegistry(reg.registryUrl)', variant='danger') Remove\n .ipeps-empty(v-else)\n .icon 🗂️\n .text No registries configured\n .description\n UIBaseButton(\n @click='onAddOfficialRegistry',\n variant='primary',\n style='padding: 0.25rem 0.5rem'\n ) setup default registry\n</template>\n\n<script setup lang=\"ts\" vapor>\nimport { onMounted, ref } from 'vue'\nimport { h as $ } from 'jsx-dom'\nimport type { PluginStoreRegistry } from '../schema.js'\nimport UIBaseButton from './ui/UIBaseButton.vue'\n\nconst ctx = useIPE()\n\ninterface RegistryViewModel extends PluginStoreRegistry {\n registryUrl: string\n label: string\n}\n\nconst registries = ref<RegistryViewModel[]>([])\nconst inputValue = ref('')\nconst isAdding = ref(false)\n\nconst urlToLabel = (u: string) => {\n try {\n return new URL(u).hostname\n } catch {\n return u\n }\n}\n\nasync function loadRegistries() {\n const urls = (await ctx.preferences.get<string[]>('pluginStore.registries')) || []\n const results = await Promise.allSettled(\n urls.map(async (url) => {\n const info = await ctx.store.getRegistryInfo(url)\n return {\n registryUrl: url,\n label: urlToLabel(url),\n ...info,\n } as RegistryViewModel\n })\n )\n registries.value = results\n .filter((r) => r.status === 'fulfilled')\n .map((r) => (r as PromiseFulfilledResult<RegistryViewModel>).value)\n}\n\nasync function onAddRegistry() {\n const url = inputValue.value.trim()\n if (!url) return\n if (registries.value.some((r) => r.registryUrl === url)) {\n ctx.modal.notify('info', { content: 'Registry already exists.' })\n return\n }\n isAdding.value = true\n try {\n // try load immediately\n const info = await ctx.store.getRegistryInfo(url, 'online_manifest', true)\n if (!info) {\n throw new Error('Invalid registry or unreachable')\n }\n const current = (await ctx.preferences.get<string[]>('pluginStore.registries')) || []\n current.push(url)\n await ctx.preferences.set('pluginStore.registries', current)\n registries.value.push({\n registryUrl: url,\n label: urlToLabel(url),\n ...info,\n })\n inputValue.value = ''\n ctx.modal.notify('success', { content: 'Registry added.' })\n } catch (e) {\n ctx.modal.notify('error', {\n content: e instanceof Error ? e.message : String(e),\n })\n } finally {\n isAdding.value = false\n }\n}\n\nasync function removeRegistryUrl(url: string) {\n const current = (await ctx.preferences.get<string[]>('pluginStore.registries')) || []\n const next = current.filter((u) => u !== url)\n await ctx.preferences.set('pluginStore.registries', next)\n registries.value = registries.value.filter((r) => r.registryUrl !== url)\n}\n\nasync function onRemoveRegistry(url: string) {\n const installed =\n (await ctx.preferences.get<{ registry: string; id: string }[]>('pluginStore.plugins')) || []\n const installedOfReg = installed.filter((p) => p.registry === url)\n if (installedOfReg.length === 0) {\n ctx.modal.confirm(\n {\n title: 'Remove registry',\n content: `Remove registry:\\n${url}`,\n cancelBtn: {\n label: 'Cancel',\n className: 'is-ghost',\n },\n okBtn: {\n label: 'Remove',\n className: 'is-danger',\n },\n },\n async (ok) => {\n if (!ok) return\n await removeRegistryUrl(url)\n ctx.modal.notify('success', { content: 'Registry removed.' })\n }\n )\n return\n }\n\n ctx.modal.dialog(\n {\n title: 'Remove registry',\n // content: `There ${installedOfReg.length === 1 ? 'is' : 'are'} ${installedOfReg.length} installed plugin${installedOfReg.length === 1 ? '' : 's'} from this registry:\\n${installedOfReg.map((p) => p.id).join('\\n')}`,\n content: $('div', { class: 'theme-ipe-prose' }, [\n $(\n 'p',\n {},\n `There ${installedOfReg.length === 1 ? 'is' : 'are'} ${installedOfReg.length} installed plugin${installedOfReg.length === 1 ? '' : 's'} from this registry:`\n ),\n $(\n 'ul',\n {},\n installedOfReg.map((p) => $('li', {}, p.id))\n ),\n ]),\n buttons: [\n {\n label: 'Remove only',\n className: 'is-danger is-ghost',\n method: async (_, m) => {\n await removeRegistryUrl(url)\n ctx.modal.notify('success', { content: 'Registry removed.' })\n m.close()\n },\n },\n {\n label: 'Remove and uninstall plugins',\n className: 'is-danger',\n method: async (_, m) => {\n await removeRegistryUrl(url)\n for (const p of installedOfReg) {\n try {\n await ctx.store.uninstallAndRemovePreference(p.registry, p.id)\n } catch (e) {\n // best-effort; notify but continue\n ctx.modal.notify('error', {\n content:\n e instanceof Error\n ? `Failed to uninstall ${p.id}: ${e.message}`\n : `Failed to uninstall ${p.id}`,\n })\n }\n }\n ctx.modal.notify('success', {\n content: `Registry removed and ${installedOfReg.length} ${installedOfReg.length === 1 ? 'plugin' : 'plugins'} uninstalled.`,\n })\n m.close()\n },\n },\n ],\n },\n () => {}\n )\n}\n\nfunction onPreferencesChanged(payload: { changes: Record<string, unknown> }) {\n const regs = payload.changes['pluginStore.registries'] as string[]\n if (Array.isArray(regs)) {\n loadRegistries()\n }\n}\n\nfunction onAddOfficialRegistry() {\n const url = Endpoints.PLUGIN_REGISTRY_URL\n inputValue.value = url\n onAddRegistry()\n}\n\nonMounted(() => {\n loadRegistries()\n ctx.on('preferences/changed', onPreferencesChanged)\n})\n</script>\n\n<style scoped lang=\"scss\">\n@use './style.scss' as *;\n\n.registry-info {\n flex: 1;\n min-width: 0;\n .homepage {\n margin-top: 0.25rem;\n a {\n color: var(--ipe-modal-accent);\n text-decoration: none;\n font-size: 0.8125rem;\n transition: all 0.2s ease;\n &:hover {\n color: color-mix(in srgb, var(--ipe-modal-accent) 80%, var(--ipe-modal-text));\n text-decoration: underline;\n }\n }\n }\n .url {\n font-family: monospace;\n font-size: 0.75rem;\n color: var(--ipe-modal-muted);\n margin-top: 0.125rem;\n word-break: break-all;\n }\n}\n</style>\n","<template lang=\"pug\">\n#ipe-plugin-install-manager\n .ipeps-header\n .ipeps-header-title Plugins\n .ipeps-input-wrapper\n input.ipeps-input.with-icon(\n v-model.trim='searchInput',\n type='text',\n placeholder='Search plugins...',\n :disabled='!allPluginsToDisplay.length'\n )\n .ipeps-input-icon 🔍\n button.ipeps-button(\n @click='refreshRegistries',\n :disabled='isRefreshing || !hasRegistries',\n :class='{ refreshing: isRefreshing }',\n variant='primary'\n ) {{ isRefreshing ? 'Refreshing...' : 'Refresh' }}\n\n .ipeps-loading(v-if='!hasRegistries && !firstInit')\n .loading-spinner\n .loading-text Loading...\n\n .ipeps-list(v-else-if='allPluginsToDisplay.length')\n .ipeps-item(\n v-for='plugin in allPluginsToDisplay',\n :key='plugin._key',\n :class='{ installed: isInstalledKey(plugin._key), broken: plugin.isBroken }'\n )\n .plugin-info\n .plugin-header\n .item-name {{ plugin.name || plugin.id }}\n span.ipeps-badge(\n v-if='isInstalledKey(plugin._key) || plugin.isBroken',\n :class='{ \"is-installed\": isInstalledKey(plugin._key), \"is-broken\": plugin.isBroken }'\n ) {{ plugin.isBroken ? '⚠️ broken' : '✓' }}\n .ipeps-tags\n a.ipeps-tag.registry-tag(\n v-if='plugin.registryHomepage && !plugin.isRegistryMissing',\n :href='plugin.registryHomepage',\n target='_blank',\n :title='plugin.registryLabel'\n ) {{ plugin.registryLabel }}\n span.ipeps-tag.registry-tag(\n v-else,\n :title='plugin.registryLabel',\n :class='{ broken: plugin.isRegistryMissing }'\n ) {{ plugin.registryLabel }}\n .plugin-id.ipeps-tag(:class='{ broken: plugin.isBroken && !plugin.isRegistryMissing }') {{ plugin.id }}\n .plugin-desc(:class='{ \"broken-desc\": plugin.isBroken }') {{ getDesc(plugin) }}\n .plugin-meta\n span.version(v-if='plugin.version') v{{ plugin.version }}\n span.author(v-if='plugin.author') 👤 {{ plugin.author }}\n span.license(v-if='plugin.license') 📜 {{ plugin.license }}\n UIBaseButton(\n :active='isInstalledKey(plugin._key)',\n :variant='isInstalledKey(plugin._key) ? \"danger\" : \"primary\"',\n @click='togglePluginByKey(plugin)'\n ) {{ isInstalledKey(plugin._key) ? 'Remove' : 'Install' }}\n\n .ipeps-empty(v-else)\n .plugin-empty-icon 📦\n .plugin-empty-text No matching plugins found\n</template>\n\n<script setup lang=\"ts\" vapor>\nimport { computed, onBeforeUnmount, onMounted, ref } from 'vue'\nimport type { PluginStoreRegistry } from '../schema.js'\nimport UIBaseButton from './ui/UIBaseButton.vue'\n\ninterface RegistryWithUrl extends PluginStoreRegistry {\n registryUrl: string\n}\ninterface PluginIdentifier {\n registry: string\n id: string\n}\n\n// --- state ---\nconst ctx = useIPE()\nconst registryInfos = ref<RegistryWithUrl[]>([])\nconst installedPlugins = ref<PluginIdentifier[]>([])\nconst searchInput = ref('')\nconst isRefreshing = ref(false)\n\n// helpers\nconst makeKey = (r: string, id: string) => `${r}\\n${id}` // stable + O(1)\n\nconst installedKeySet = computed(\n () => new Set(installedPlugins.value.map((p) => makeKey(p.registry, p.id)))\n)\nconst isInstalledKey = (key: string) => installedKeySet.value.has(key)\n\nconst urlToLabel = (registryUrl: string) => {\n try {\n return new URL(registryUrl).hostname\n } catch {\n return registryUrl\n }\n}\n\nconst firstInit = ref(false)\nconst hasRegistries = computed(() => registryInfos.value.length > 0)\n\n// merge normal + broken, and normalize once here\nconst normalizedPlugins = computed(() => {\n const q = searchInput.value.trim().toLowerCase()\n\n const all: Array<any> = registryInfos.value.flatMap((reg) =>\n (reg.packages || []).map((pkg) => ({\n ...pkg,\n _key: makeKey(reg.registryUrl, pkg.id),\n registry: reg.registryUrl,\n registryHomepage: reg.homepage,\n registryLabel: urlToLabel(reg.registryUrl),\n isBroken: false,\n isRegistryMissing: false,\n }))\n )\n\n // broken installed plugins (installed but not available now)\n const availableKeys = new Set(all.map((p) => p._key))\n const availableRegs = new Set(registryInfos.value.map((r) => r.registryUrl))\n\n const broken = installedPlugins.value\n .filter((p) => !availableKeys.has(makeKey(p.registry, p.id)))\n .map((p) => {\n const regInfo = registryInfos.value.find((r) => r.registryUrl === p.registry)\n return {\n id: p.id,\n name: undefined,\n description: undefined,\n version: undefined,\n author: undefined,\n license: undefined,\n _key: makeKey(p.registry, p.id),\n registry: p.registry,\n registryHomepage: regInfo?.homepage,\n registryLabel: urlToLabel(p.registry),\n isBroken: true,\n isRegistryMissing: !availableRegs.has(p.registry),\n }\n })\n\n const filtered = (list: any[]) => {\n if (!q) return list\n return list.filter(\n (p) =>\n (p.name && p.name.toLowerCase().includes(q)) ||\n (p.id && p.id.toLowerCase().includes(q)) ||\n (p.description && p.description.toLowerCase().includes(q)) ||\n (p.author && p.author.toLowerCase().includes(q)) ||\n (p.registry && p.registry.toLowerCase().includes(q))\n )\n }\n\n // broken on top\n return [...filtered(broken), ...filtered(all)]\n})\n\nconst allPluginsToDisplay = computed(() => normalizedPlugins.value)\n\nconst getDesc = (p: any) => {\n if (p.description) return p.description\n if (!p.isBroken) return ''\n return p.isRegistryMissing\n ? '[Recommend to uninstall] The registry is unavailable. Try refreshing or re-adding the registry to fix this issue.'\n : '[Recommend to uninstall] This plugin was removed from the registry. Try refreshing the registry to confirm.'\n}\n\n// actions\nconst enablePlugin = async (registry: string, id: string) => {\n ctx.store.installAndSetPreference(registry, id)\n}\nconst disablePlugin = async (registry: string, id: string) => {\n ctx.store.uninstallAndRemovePreference(registry, id)\n}\nconst togglePlugin = (registry: string, id: string) =>\n isInstalledKey(makeKey(registry, id)) ? disablePlugin(registry, id) : enablePlugin(registry, id)\nconst togglePluginByKey = (p: any) => togglePlugin(p.registry, p.id)\n\nconst refreshRegistries = async () => {\n if (isRefreshing.value) return\n if (registryInfos.value.length === 0) {\n ctx.modal.notify('info', {\n content: 'No registry configured. Please add a registry first.',\n })\n return\n }\n\n isRefreshing.value = true\n const results = await ctx.store.refreshAllRegistryCaches()\n const okResults = Object.entries(results).filter(([_, r]) => r !== null)\n registryInfos.value = okResults.map(([url, r]) => ({\n ...r!,\n registryUrl: url,\n }))\n const failedUrls = Object.entries(results)\n .filter(([_, r]) => r === null)\n .map(([url]) => url)\n isRefreshing.value = false\n\n if (okResults.length === 0) {\n ctx.modal.notify('error', {\n content: 'All registries failed to refresh',\n })\n } else {\n ctx.modal.notify('success', {\n content: `${okResults.length} ${okResults.length === 1 ? 'registry' : 'registries'} refreshed successfully.`,\n })\n if (failedUrls.length > 0) {\n ctx.modal.notify('warning', {\n content: `${failedUrls.length} ${failedUrls.length === 1 ? 'registry' : 'registries'} failed to refresh:\\n${failedUrls.join('\\n')}`,\n })\n }\n }\n}\n\n// init\nconst init = async () => {\n firstInit.value = false\n const urls = (await ctx.store.ctx.preferences.get('pluginStore.registries')) || []\n const regResults = await Promise.allSettled(\n urls.map(async (url: string) => ({\n ...(await ctx.store.getRegistryInfo(url)),\n registryUrl: url,\n }))\n )\n registryInfos.value = regResults\n .filter((r) => r.status === 'fulfilled')\n .map((r) => (r as PromiseFulfilledResult<RegistryWithUrl>).value)\n\n installedPlugins.value = (await ctx.preferences.get('pluginStore.plugins')) || []\n\n firstInit.value = true\n}\n\nfunction onPreferencesChanged(payload: { changes: Record<string, unknown> }) {\n const regs = payload.changes['pluginStore.registries'] as string[]\n const plugins = payload.changes['pluginStore.plugins'] as PluginIdentifier[]\n if (Array.isArray(plugins)) installedPlugins.value = plugins\n if (Array.isArray(regs)) {\n init()\n }\n}\n\nonMounted(() => {\n init()\n ctx.on('preferences/changed', onPreferencesChanged)\n})\nonBeforeUnmount(() => {})\n</script>\n\n<style scoped lang=\"scss\">\n@use './style.scss' as *;\n\n.plugin-info {\n flex: 1;\n min-width: 0;\n}\n.plugin-header {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin-bottom: 0.375rem;\n}\n.registry-tag {\n color: var(--ipe-modal-accent);\n background: color-mix(in srgb, var(--ipe-modal-accent) 8%, transparent);\n border: 1px solid color-mix(in srgb, var(--ipe-modal-accent) 18%, transparent);\n text-decoration: none;\n transition: all 0.2s ease;\n &:hover {\n background: color-mix(in srgb, var(--ipe-modal-accent) 12%, transparent);\n border-color: color-mix(in srgb, var(--ipe-modal-accent) 30%, transparent);\n }\n &.broken {\n text-decoration: line-through;\n opacity: 0.65;\n cursor: not-allowed;\n }\n}\n.plugin-id {\n &.broken {\n opacity: 0.65;\n text-decoration: line-through;\n }\n}\n.plugin-desc {\n font-size: 0.8125rem;\n color: var(--ipe-modal-muted);\n margin-bottom: 0.5rem;\n line-height: 1.6;\n &.broken-desc {\n color: color-mix(in srgb, var(--ipe-modal-warning) 80%, var(--ipe-modal-text));\n font-style: italic;\n }\n}\n.plugin-meta {\n font-size: 0.75rem;\n color: var(--ipe-modal-muted);\n display: flex;\n gap: 1rem;\n align-items: center;\n .version {\n font-family: monospace;\n font-weight: 500;\n color: color-mix(in srgb, var(--ipe-modal-text) 80%, var(--ipe-modal-muted));\n }\n .author {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n }\n .license {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n }\n}\n</style>\n"],"names":["props","__props","buttonClass","computed","ctx","useIPE","registries","ref","inputValue","isAdding","urlToLabel","u","loadRegistries","urls","results","url","info","r","onAddRegistry","current","e","removeRegistryUrl","next","onRemoveRegistry","installedOfReg","p","ok","$","_","m","onPreferencesChanged","payload","regs","onAddOfficialRegistry","Endpoints","onMounted","registryInfos","installedPlugins","searchInput","isRefreshing","makeKey","id","installedKeySet","isInstalledKey","key","registryUrl","firstInit","hasRegistries","normalizedPlugins","q","all","reg","pkg","availableKeys","availableRegs","broken","regInfo","filtered","list","allPluginsToDisplay","getDesc","enablePlugin","registry","disablePlugin","togglePlugin","togglePluginByKey","refreshRegistries","okResults","failedUrls","init","regResults","plugins","onBeforeUnmount"],"mappings":";;;;;;;;;;;AAQA,UAAMA,IAAQC,GAWRC,IAAcC,EAAS,OAAO;AAAA,MAClC,aAAaH,EAAM;AAAA,MACnB,aAAaA,EAAM,YAAY;AAAA,MAC/B,cAAcA,EAAM,YAAY;AAAA,MAChC,YAAYA,EAAM,YAAY;AAAA,MAC9B,aAAaA,EAAM,YAAY;AAAA,IAAA,EAC/B;;;;;;;;;;;;;;;;ACgBF,UAAMI,IAAMC,EAAA,GAONC,IAAaC,EAAyB,EAAE,GACxCC,IAAaD,EAAI,EAAE,GACnBE,IAAWF,EAAI,EAAK,GAEpBG,IAAa,CAACC,MAAc;AAChC,UAAI;AACF,eAAO,IAAI,IAAIA,CAAC,EAAE;AAAA,MACpB,QAAQ;AACN,eAAOA;AAAA,MACT;AAAA,IACF;AAEA,mBAAeC,IAAiB;AAC9B,YAAMC,IAAQ,MAAMT,EAAI,YAAY,IAAc,wBAAwB,KAAM,CAAA,GAC1EU,IAAU,MAAM,QAAQ;AAAA,QAC5BD,EAAK,IAAI,OAAOE,MAAQ;AACtB,gBAAMC,IAAO,MAAMZ,EAAI,MAAM,gBAAgBW,CA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- function n(r) {
2
- return function(e) {
3
- return e.PreferencesSchema = r, e;
4
- };
5
- }
6
- export {
7
- n as R
8
- };
9
- //# sourceMappingURL=Preferences-DS4-CFWe.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Preferences-DS4-CFWe.js","sources":["../src/decorators/Preferences.ts"],"sourcesContent":["import type Schema from 'schemastery'\r\n\r\ntype AnyConstructor<T = any> = new (...args: any[]) => T\r\n\r\nexport type PreferenceAugmented<D, C extends AnyConstructor> = C & {\r\n PreferencesSchema: Schema<D>\r\n}\r\n\r\n/**\r\n * Decorator for registering preferences\r\n *\r\n * ```ts\r\n * @RegisterPreferences(\r\n * Schema.object({\r\n * foo: Schema.string().description('Foo description'),\r\n * }),\r\n * {\r\n * foo: 'default foo value',\r\n * }\r\n * )\r\n * class Foo {}\r\n * ```\r\n *\r\n * same as:\r\n *\r\n * ```ts\r\n * class Foo {\r\n * static ConfigSchema = Schema.object({\r\n * foo: Schema.string().description('Foo description')\r\n * })\r\n * static ConfigDefaults = {\r\n * foo: 'default foo value'\r\n * }\r\n * }\r\n * ```\r\n */\r\nexport function RegisterPreferences<D extends Record<string, any>>(schema: Schema<D>) {\r\n return function <T extends AnyConstructor>(target: T): PreferenceAugmented<D, T> {\r\n ;(target as any).PreferencesSchema = schema\r\n return target as PreferenceAugmented<D, T>\r\n }\r\n}\r\n"],"names":["RegisterPreferences","schema","target"],"mappings":"AAoCO,SAASA,EAAmDC,GAAmB;AACpF,SAAO,SAAoCC,GAAsC;AAC7E,WAAAA,EAAe,oBAAoBD,GAC9BC;AAAA,EACT;AACF;"}