@inpageedit/core 0.15.0 → 0.16.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.
Files changed (100) hide show
  1. package/dist/{ActionButton-CRjo_l3y.js → ActionButton-B6OUgtHx.js} +2 -2
  2. package/dist/{ActionButton-CRjo_l3y.js.map → ActionButton-B6OUgtHx.js.map} +1 -1
  3. package/dist/CheckBox-Dx3r3LQz.js +13 -0
  4. package/dist/CheckBox-Dx3r3LQz.js.map +1 -0
  5. package/dist/IconQuickDiff-BkbxyY-d.js +29 -0
  6. package/dist/IconQuickDiff-BkbxyY-d.js.map +1 -0
  7. package/dist/IconQuickEdit-BiRYADU_.js +68 -0
  8. package/dist/IconQuickEdit-BiRYADU_.js.map +1 -0
  9. package/dist/IconUpload-Bz4BW_nc.js +27 -0
  10. package/dist/IconUpload-Bz4BW_nc.js.map +1 -0
  11. package/dist/InPageEdit.js +20 -0
  12. package/dist/InPageEdit.js.map +1 -0
  13. package/dist/InputBox-D2ZRTMFP.js +42 -0
  14. package/dist/InputBox-D2ZRTMFP.js.map +1 -0
  15. package/dist/{PluginImagesUsed-Bq_C_rgg.js → PluginImagesUsed-BVyvFA1_.js} +7 -7
  16. package/dist/{PluginImagesUsed-Bq_C_rgg.js.map → PluginImagesUsed-BVyvFA1_.js.map} +1 -1
  17. package/dist/{PluginPrefSync-DP5NyPnI.js → PluginPrefSync-CUKkx4Qk.js} +10 -10
  18. package/dist/{PluginPrefSync-DP5NyPnI.js.map → PluginPrefSync-CUKkx4Qk.js.map} +1 -1
  19. package/dist/{PluginStoreApp-_YWpLgfs.js → PluginStoreApp-CoOAw1fr.js} +4 -4
  20. package/dist/{PluginStoreApp-_YWpLgfs.js.map → PluginStoreApp-CoOAw1fr.js.map} +1 -1
  21. package/dist/{PluginTemplatesUsed-DS_rHctR.js → PluginTemplatesUsed-CdjT1wR4.js} +12 -12
  22. package/dist/{PluginTemplatesUsed-DS_rHctR.js.map → PluginTemplatesUsed-CdjT1wR4.js.map} +1 -1
  23. package/dist/{index-CM_6yF2v.js → Promise.withResolvers-C4chhLB1.js} +17 -11
  24. package/dist/Promise.withResolvers-C4chhLB1.js.map +1 -0
  25. package/dist/{RadioBox-0UuxlcWZ.js → RadioBox-B0z9YHQg.js} +2 -2
  26. package/dist/{RadioBox-0UuxlcWZ.js.map → RadioBox-B0z9YHQg.js.map} +1 -1
  27. package/dist/components/index.js +75 -46
  28. package/dist/components/index.js.map +1 -1
  29. package/dist/{BasePlugin-BCVSn9QJ.js → core.js} +28 -10
  30. package/dist/core.js.map +1 -0
  31. package/dist/{index-n5KKWE9v.js → index-1tsXE6ax.js} +9 -8
  32. package/dist/{index-n5KKWE9v.js.map → index-1tsXE6ax.js.map} +1 -1
  33. package/dist/{index-CS1kidKF.js → index-B32tFyLB.js} +57 -57
  34. package/dist/{index-CS1kidKF.js.map → index-B32tFyLB.js.map} +1 -1
  35. package/dist/{index-Cq8xPcEY.js → index-BPTMltVf.js} +35 -35
  36. package/dist/index-BPTMltVf.js.map +1 -0
  37. package/dist/{index-rKL4D_7I.js → index-BYlcHc-O.js} +22 -24
  38. package/dist/index-BYlcHc-O.js.map +1 -0
  39. package/dist/{index-DjyjqpeO.js → index-C4qm_X_A.js} +11 -11
  40. package/dist/{index-DjyjqpeO.js.map → index-C4qm_X_A.js.map} +1 -1
  41. package/dist/index-CAtPo7xJ.js +793 -0
  42. package/dist/index-CAtPo7xJ.js.map +1 -0
  43. package/dist/{index-DPA1ptYq.js → index-CVCy0wPP.js} +8 -7
  44. package/dist/{index-DPA1ptYq.js.map → index-CVCy0wPP.js.map} +1 -1
  45. package/dist/index-CYfkwXRf.js +1631 -0
  46. package/dist/index-CYfkwXRf.js.map +1 -0
  47. package/dist/{index-mFwJhDwE.js → index-DZa9mxN4.js} +11 -11
  48. package/dist/{index-mFwJhDwE.js.map → index-DZa9mxN4.js.map} +1 -1
  49. package/dist/{index-B9VO3swL.js → index-Dm2vgYkZ.js} +58 -81
  50. package/dist/index-Dm2vgYkZ.js.map +1 -0
  51. package/dist/{index-C3t-Xj3e.js → index-NWWeW3tX.js} +10 -10
  52. package/dist/{index-C3t-Xj3e.js.map → index-NWWeW3tX.js.map} +1 -1
  53. package/dist/index-QnWieXQc.js +4932 -0
  54. package/dist/index-QnWieXQc.js.map +1 -0
  55. package/dist/{index-CbdkXGs7.js → index-bQ0CVu3l.js} +13 -17
  56. package/dist/{index-CbdkXGs7.js.map → index-bQ0CVu3l.js.map} +1 -1
  57. package/dist/{index-Cb2_vqBl.js → index-ygc4AMy4.js} +10 -10
  58. package/dist/{index-Cb2_vqBl.js.map → index-ygc4AMy4.js.map} +1 -1
  59. package/dist/{index-DD5CVCfD.js → index-z_qDGCMT.js} +2 -2
  60. package/dist/{index-DD5CVCfD.js.map → index-z_qDGCMT.js.map} +1 -1
  61. package/dist/index.d.ts +98 -36
  62. package/dist/index.js +24 -26
  63. package/dist/index.js.map +1 -1
  64. package/dist/{makeCallable-LDU0xZMJ.js → makeCallable-Cg4zUG4c.js} +2 -2
  65. package/dist/{makeCallable-LDU0xZMJ.js.map → makeCallable-Cg4zUG4c.js.map} +1 -1
  66. package/dist/models/index.js +7 -7
  67. package/dist/models/index.js.map +1 -1
  68. package/dist/plugins/index.js +12 -12
  69. package/dist/services/index.js +5 -4
  70. package/dist/style.css +1 -1
  71. package/dist/{vueHooks-l04s8cIl.js → vueHooks-Bs93iP61.js} +1519 -1492
  72. package/dist/vueHooks-Bs93iP61.js.map +1 -0
  73. package/lib/index.umd.js +19 -15
  74. package/lib/index.umd.js.map +1 -1
  75. package/lib/style.css +1 -1
  76. package/package.json +36 -27
  77. package/dist/BasePlugin-BCVSn9QJ.js.map +0 -1
  78. package/dist/IconQuickEdit-CMCQncyj.js +0 -27
  79. package/dist/IconQuickEdit-CMCQncyj.js.map +0 -1
  80. package/dist/InputBox-CZ1v4_l3.js +0 -50
  81. package/dist/InputBox-CZ1v4_l3.js.map +0 -1
  82. package/dist/Preferences-DqtjY7XU.js +0 -1541
  83. package/dist/Preferences-DqtjY7XU.js.map +0 -1
  84. package/dist/WatchlistAction-BbNAyryN.js +0 -5
  85. package/dist/WatchlistAction-BbNAyryN.js.map +0 -1
  86. package/dist/browser-DR-yCqVg.js +0 -1160
  87. package/dist/browser-DR-yCqVg.js.map +0 -1
  88. package/dist/index-B9VO3swL.js.map +0 -1
  89. package/dist/index-CG38LlAh.js +0 -46
  90. package/dist/index-CG38LlAh.js.map +0 -1
  91. package/dist/index-CM_6yF2v.js.map +0 -1
  92. package/dist/index-CcAmmXbb.js +0 -3290
  93. package/dist/index-CcAmmXbb.js.map +0 -1
  94. package/dist/index-Cq8xPcEY.js.map +0 -1
  95. package/dist/index-DVvsTsLI.js +0 -505
  96. package/dist/index-DVvsTsLI.js.map +0 -1
  97. package/dist/index-FvMu0Ka0.js +0 -342
  98. package/dist/index-FvMu0Ka0.js.map +0 -1
  99. package/dist/index-rKL4D_7I.js.map +0 -1
  100. package/dist/vueHooks-l04s8cIl.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { j as R } from "./index-CM_6yF2v.js";
2
- import { S as s, E as C, I as j } from "./Preferences-DqtjY7XU.js";
3
- import { B as L } from "./BasePlugin-BCVSn9QJ.js";
4
- import { c as O, d as F } from "./vueHooks-l04s8cIl.js";
1
+ import { j as R } from "./Promise.withResolvers-C4chhLB1.js";
2
+ import { S as s, E as C, a as j } from "./index-QnWieXQc.js";
3
+ import { BasePlugin as L } from "./core.js";
4
+ import { c as O, d as F } from "./vueHooks-Bs93iP61.js";
5
5
  const G = 1;
6
6
  var m;
7
7
  ((n) => {
@@ -44,13 +44,13 @@ var m;
44
44
  })
45
45
  );
46
46
  })(m || (m = {}));
47
- var B = Object.create, v = Object.defineProperty, M = Object.getOwnPropertyDescriptor, S = (n, e) => (e = Symbol[n]) ? e : Symbol.for("Symbol." + n), b = (n) => {
47
+ var M = Object.create, v = Object.defineProperty, q = Object.getOwnPropertyDescriptor, S = (n, e) => (e = Symbol[n]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + n), b = (n) => {
48
48
  throw TypeError(n);
49
- }, q = (n, e, t) => e in n ? v(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, N = (n, e) => v(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, i) => ({ kind: U[n], name: e, metadata: r, addInitializer: (a) => t._ ? b("Already initialized") : i.push(k(a || null)) }), z = (n, e) => q(e, S("metadata"), n[3]), Q = (n, e, t, r) => {
49
+ }, B = (n, e, t) => e in n ? v(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, N = (n, e) => v(n, "name", { value: e, configurable: !0 }), D = (n) => [, , , M(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, i) => ({ kind: U[n], name: e, metadata: r, addInitializer: (a) => t._ ? b("Already initialized") : i.push(k(a || null)) }), z = (n, e) => B(e, S("metadata"), n[3]), Q = (n, e, t, r) => {
50
50
  for (var i = 0, a = n[e >> 1], o = a && a.length; i < o; i++) a[i].call(t);
51
51
  return r;
52
52
  }, H = (n, e, t, r, i, a) => {
53
- var o, d, c, p = e & 7, f = !1, u = 0, y = n[u] || (n[u] = []), h = p && (i = i.prototype, p < 5 && (p > 3 || !f) && M(i, t));
53
+ var o, d, c, p = e & 7, f = !1, u = 0, y = n[u] || (n[u] = []), h = p && (i = i.prototype, p < 5 && (p > 3 || !f) && q(i, t));
54
54
  N(i, t);
55
55
  for (var l = r.length - 1; l >= 0; l--)
56
56
  c = Y(p, t, d = {}, n[3], y), o = (0, r[l])(i, c), d._ = 1, k(o) && (i = o);
@@ -111,7 +111,7 @@ let w = class x extends (T = L) {
111
111
  this.install(t.registry, t.id, t.source, "user-preference");
112
112
  }
113
113
  async _createManagementApp() {
114
- const e = await this.ctx.withInject(["store"]), t = F(() => import("./PluginStoreApp-_YWpLgfs.js"));
114
+ const e = await this.ctx.withInject(["store"]), t = F(() => import("./PluginStoreApp-CoOAw1fr.js"));
115
115
  return O(e, t);
116
116
  }
117
117
  async _injectPreferenceUI() {
@@ -302,14 +302,10 @@ let w = class x extends (T = L) {
302
302
  async getRegistryInfo(e, t = "online_manifest", r = !1) {
303
303
  try {
304
304
  let a;
305
- switch (t) {
306
- case "online_manifest": {
307
- a = await this._fetchOnlineRegistryInfo(e, r), this.logger.debug("Fetched registry info from online manifest", a), this.setRegistryCache(e, a);
308
- break;
309
- }
310
- default:
311
- throw new Error(`Unsupported registry source: ${t}`);
312
- }
305
+ if (t === "online_manifest")
306
+ a = await this._fetchOnlineRegistryInfo(e, r), this.logger.debug("Fetched registry info from online manifest", a), this.setRegistryCache(e, a);
307
+ else
308
+ throw new Error(`Unsupported registry source: ${t}`);
313
309
  return a;
314
310
  } catch (a) {
315
311
  this.ctx.logger.warn("Failed to fetch registry info", a);
@@ -388,4 +384,4 @@ let X = w;
388
384
  export {
389
385
  X as PluginPluginStore
390
386
  };
391
- //# sourceMappingURL=index-CbdkXGs7.js.map
387
+ //# sourceMappingURL=index-bQ0CVu3l.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-CbdkXGs7.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: string\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.string().required(),\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 interface Events {\n 'plugin-store/registry-fetched'(payload: {\n ctx: InPageEdit\n registry: PluginStoreRegistry\n }): void\n 'plugin-store/registry-not-found'(payload: { ctx: InPageEdit; registryUrl: string }): void\n 'plugin-store/registry-removed'(payload: { ctx: InPageEdit; registryUrl: string }): void\n 'plugin-store/plugin-installed'(payload: {\n ctx: InPageEdit\n registry: PluginStoreRegistry\n id: string\n // 新安装 or 通过用户配置加载\n by: 'new-added' | 'user-preference'\n }): void\n 'plugin-store/plugin-uninstalled'(payload: {\n ctx: InPageEdit\n registry: PluginStoreRegistry\n id: string\n }): void\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, 'user-preference')\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 _by: 'new-added' | 'user-preference' = 'new-added'\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 const fork = await scope\n if (fork) {\n this.ctx.emit('plugin-store/plugin-installed', {\n ctx: this.ctx,\n registry: registryInfo,\n id,\n by: _by,\n })\n }\n return fork\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 const disposed = scope.dispose?.() ?? true // disposed successfully\n try {\n const registryInfo =\n (await this.getRegistryCache(registry)) ||\n (await this.getRegistryInfo(registry).catch(() => null))\n if (registryInfo) {\n this.ctx.emit('plugin-store/plugin-uninstalled', {\n ctx: this.ctx,\n registry: registryInfo,\n id,\n })\n }\n } catch {}\n return disposed\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, 'online_manifest', 'new-added')\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 this.ctx.emit('plugin-store/registry-not-found', {\n ctx: this.ctx,\n registryUrl: registry,\n })\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 // 成功在线获取并校验后触发事件\n this.ctx.emit('plugin-store/registry-fetched', {\n ctx: this.ctx,\n registry: validated,\n })\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 this.ctx.emit('plugin-store/registry-removed', {\n ctx: this.ctx,\n registryUrl: registry,\n })\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","_by","registryInfo","scope","fork","promise","disposed","p","pkg","loader","kind","entry","styles","entryUrl","e","datasets","apply","m","urls","u","data","noCache","info","payload","validated","registryUrls","responses","url","results","index","response","__decoratorStart","__decorateElement","__runInitializers","PluginPluginStore"],"mappings":";;;;AAEO,MAAMA,IAAyC;AAuC/C,IAAUC;AAAA,CAAV,CAAUA,MAAV;AACQA,EAAAA,EAAA,gBAAgB,IAAIC;AAAA,IAC/BA,EAAO,OAAO;AAAA,MACZ,MAAMA,EAAO,MAAM,CAAC,YAAY,UAAU,OAAO,QAAQ,CAAC,EAAE,WAAW,QAAQ,UAAU;AAAA,MACzF,OAAOA,EAAO,OAAA;AAAA,MACd,QAAQA,EAAO,MAAMA,EAAO,QAAQ;AAAA,MACpC,aAAaA,EAAO,OAAA;AAAA,IAAO,CAC5B;AAAA,EAAA,GAGUD,EAAA,UAAU,IAAIC;AAAA,IACzBA,EAAO,OAAO;AAAA,MACZ,IAAIA,EAAO,OAAA,EAAS,SAAA;AAAA,MACpB,MAAMA,EAAO,OAAA,EAAS,SAAA;AAAA,MACtB,SAASA,EAAO,OAAA,EAAS,SAAA;AAAA,MACzB,aAAaA,EAAO,OAAA;AAAA,MACpB,QAAQA,EAAO,OAAA;AAAA,MACf,SAASA,EAAO,OAAA;AAAA,MAChB,QAAQD,EAAA,cAAc,SAAA;AAAA,IAAS,CAChC;AAAA,EAAA,GAGUA,EAAA,qBAAqB,IAAIC;AAAA,IACpCA,EAAO,OAAO;AAAA,MACZ,MAAMA,EAAO,OA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AAK,UAAU,MAAA,GACrB,KAAK,IAAI,OAAO,MAAM,6BAA6B;AAAA,EACrD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,qBAAqBA,GAAgD;AACzE,UAAMsB,IAAO,MAAM,KAAK,gBAAgBtB,GAAU,mBAAmB,EAAI;AACzE,QAAI,CAACsB;AACH,YAAM,IAAI,MAAM,qCAAqCtB,CAAQ,EAAE;AAEjE,gBAAK,IAAI,OAAO,MAAM,6BAA6BA,CAAQ,GACpDsB;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,2BAAgF;AACpF,UAAMK,IAAgB,MAAM,KAAK,IAAI,YAAY,IAAI,wBAAwB,KAAM,CAAA,GAC7EC,IAAY,MAAM,QAAQ;AAAA,MAC9BD,EAAa,IAAI,CAACE,MAAQ,KAAK,qBAAqBA,CAAG,CAAC;AAAA,IAAA,GAEpDC,IAAsD,CAAA;AAC5D,eAAW,CAACC,GAAOC,CAAQ,KAAKJ,EAAU;AACxC,MAAII,EAAS,WAAW,cACtBF,EAAQH,EAAaI,CAAK,CAAC,IAAIC,EAAS,QAExCF,EAAQH,EAAaI,CAAK,CAAC,IAAI;AAGnC,WAAOD;AAAA,EACT;AACF;AA1cO7D,IAAAgE,EAAA/D,CAAA;AAAMe,IAANiD,6BADPlE,GACaiB,CAAA;AAANkD,EAAAlE,GAAA,GAAMgB,CAAA;AAAN,IAAMmD,IAANnD;"}
1
+ {"version":3,"file":"index-bQ0CVu3l.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: string\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.string().required(),\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 interface Events {\n 'plugin-store/registry-fetched'(payload: {\n ctx: InPageEdit\n registry: PluginStoreRegistry\n }): void\n 'plugin-store/registry-not-found'(payload: { ctx: InPageEdit; registryUrl: string }): void\n 'plugin-store/registry-removed'(payload: { ctx: InPageEdit; registryUrl: string }): void\n 'plugin-store/plugin-installed'(payload: {\n ctx: InPageEdit\n registry: PluginStoreRegistry\n id: string\n // 新安装 or 通过用户配置加载\n by: 'new-added' | 'user-preference'\n }): void\n 'plugin-store/plugin-uninstalled'(payload: {\n ctx: InPageEdit\n registry: PluginStoreRegistry\n id: string\n }): void\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, 'user-preference')\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 _by: 'new-added' | 'user-preference' = 'new-added'\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 const fork = await scope\n if (fork) {\n this.ctx.emit('plugin-store/plugin-installed', {\n ctx: this.ctx,\n registry: registryInfo,\n id,\n by: _by,\n })\n }\n return fork\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 const disposed = scope.dispose?.() ?? true // disposed successfully\n try {\n const registryInfo =\n (await this.getRegistryCache(registry)) ||\n (await this.getRegistryInfo(registry).catch(() => null))\n if (registryInfo) {\n this.ctx.emit('plugin-store/plugin-uninstalled', {\n ctx: this.ctx,\n registry: registryInfo,\n id,\n })\n }\n } catch {}\n return disposed\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, 'online_manifest', 'new-added')\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 this.ctx.emit('plugin-store/registry-not-found', {\n ctx: this.ctx,\n registryUrl: registry,\n })\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 // 成功在线获取并校验后触发事件\n this.ctx.emit('plugin-store/registry-fetched', {\n ctx: this.ctx,\n registry: validated,\n })\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 this.ctx.emit('plugin-store/registry-removed', {\n ctx: this.ctx,\n registryUrl: registry,\n })\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","_by","registryInfo","scope","fork","promise","disposed","p","pkg","loader","kind","entry","styles","entryUrl","e","datasets","apply","m","urls","u","data","noCache","info","payload","validated","registryUrls","responses","url","results","index","response","__decoratorStart","__decorateElement","__runInitializers","PluginPluginStore"],"mappings":";;;;AAEO,MAAMA,IAAyC;AAuC/C,IAAUC;AAAA,CAAV,CAAUA,MAAV;AACQA,EAAAA,EAAA,gBAAgB,IAAIC;AAAA,IAC/BA,EAAO,OAAO;AAAA,MACZ,MAAMA,EAAO,MAAM,CAAC,YAAY,UAAU,OAAO,QAAQ,CAAC,EAAE,WAAW,QAAQ,UAAU;AAAA,MACzF,OAAOA,EAAO,OAAA;AAAA,MACd,QAAQA,EAAO,MAAMA,EAAO,QAAQ;AAAA,MACpC,aAAaA,EAAO,OAAA;AAAA,IAAO,CAC5B;AAAA,EAAA,GAGUD,EAAA,UAAU,IAAIC;AAAA,IACzBA,EAAO,OAAO;AAAA,MACZ,IAAIA,EAAO,OAAA,EAAS,SAAA;AAAA,MACpB,MAAMA,EAAO,OAAA,EAAS,SAAA;AAAA,MACtB,SAASA,EAAO,OAAA,EAAS,SAAA;AAAA,MACzB,aAAaA,EAAO,OAAA;AAAA,MACpB,QAAQA,EAAO,OAAA;AAAA,MACf,SAASA,EAAO,OAAA;AAAA,MAChB,QAAQD,EAAA,cAAc,SAAA;AAAA,IAAS,CAChC;AAAA,EAAA,GAGUA,EAAA,qBAAqB,IAAIC;AAAA,IACpCA,E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,KAAK,IAAI,OAAO,MAAM,6BAA6B;AAAA,EACrD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,qBAAqBA,GAAgD;AACzE,UAAMsB,IAAO,MAAM,KAAK,gBAAgBtB,GAAU,mBAAmB,EAAI;AACzE,QAAI,CAACsB;AACH,YAAM,IAAI,MAAM,qCAAqCtB,CAAQ,EAAE;AAEjE,gBAAK,IAAI,OAAO,MAAM,6BAA6BA,CAAQ,GACpDsB;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,2BAAgF;AACpF,UAAMK,IAAgB,MAAM,KAAK,IAAI,YAAY,IAAI,wBAAwB,KAAM,CAAA,GAC7EC,IAAY,MAAM,QAAQ;AAAA,MAC9BD,EAAa,IAAI,CAACE,MAAQ,KAAK,qBAAqBA,CAAG,CAAC;AAAA,IAAA,GAEpDC,IAAsD,CAAA;AAC5D,eAAW,CAACC,GAAOC,CAAQ,KAAKJ,EAAU;AACxC,MAAII,EAAS,WAAW,cACtBF,EAAQH,EAAaI,CAAK,CAAC,IAAIC,EAAS,QAExCF,EAAQH,EAAaI,CAAK,CAAC,IAAI;AAGnC,WAAOD;AAAA,EACT;AACF;AA1cO7D,IAAAgE,EAAA/D,CAAA;AAAMe,IAANiD,6BADPlE,GACaiB,CAAA;AAANkD,EAAAlE,GAAA,GAAMgB,CAAA;AAAN,IAAMmD,IAANnD;"}
@@ -1,26 +1,26 @@
1
- import { j as i } from "./index-CM_6yF2v.js";
2
- import { B as s } from "./BasePlugin-BCVSn9QJ.js";
3
- class o extends s {
1
+ import { j as i } from "./Promise.withResolvers-C4chhLB1.js";
2
+ import { BasePlugin as p } from "./core.js";
3
+ class o extends p {
4
4
  constructor(e) {
5
5
  super(e, {}, "quick-usage"), this.ctx = e, e.set("quickUsage", this);
6
6
  }
7
7
  async start() {
8
- import("./PluginTemplatesUsed-DS_rHctR.js").then(
8
+ import("./PluginTemplatesUsed-CdjT1wR4.js").then(
9
9
  ({ PluginTemplatesUsed: e }) => this.ctx.plugin(e)
10
- ), import("./PluginImagesUsed-Bq_C_rgg.js").then(
10
+ ), import("./PluginImagesUsed-BVyvFA1_.js").then(
11
11
  ({ PluginImagesUsed: e }) => this.ctx.plugin(e)
12
12
  ), this.ctx.inject(["quickUpload", "$"], (e) => {
13
13
  e.on("quick-edit/wiki-page", ({ modal: t }) => {
14
- const { $: a } = e;
14
+ const { $: r } = e;
15
15
  this.getWrapperForQuickEdit(t).appendChild(
16
16
  /* @__PURE__ */ i(
17
17
  "a",
18
18
  {
19
19
  href: "#ipe:quick-upload",
20
- onClick: (r) => {
21
- r.preventDefault(), e.quickUpload.showModal(), e.emit("analytics/event", { feature: "quick-usage", subtype: "quick-upload" });
20
+ onClick: (a) => {
21
+ a.preventDefault(), e.quickUpload.showModal(), e.emit("analytics/event", { feature: "quick-usage", subtype: "quick-upload" });
22
22
  },
23
- children: a`Quick Upload`
23
+ children: r`Quick Upload`
24
24
  }
25
25
  )
26
26
  );
@@ -41,4 +41,4 @@ class o extends s {
41
41
  export {
42
42
  o as PluginQuickUsage
43
43
  };
44
- //# sourceMappingURL=index-Cb2_vqBl.js.map
44
+ //# sourceMappingURL=index-ygc4AMy4.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-Cb2_vqBl.js","sources":["../src/plugins/quick-usage/index.tsx"],"sourcesContent":["import { InPageEdit } from '@/InPageEdit'\nimport { IPEModal } from '@inpageedit/modal'\n\ndeclare module '@/InPageEdit' {\n interface InPageEdit {\n quickUsage: PluginQuickUsage\n }\n}\n\nexport class PluginQuickUsage extends BasePlugin {\n constructor(public ctx: InPageEdit) {\n super(ctx, {}, 'quick-usage')\n ctx.set('quickUsage', this)\n }\n protected async start() {\n import('./PluginTemplatesUsed.js').then(({ PluginTemplatesUsed }) =>\n this.ctx.plugin(PluginTemplatesUsed)\n )\n import('./PluginImagesUsed.js').then(({ PluginImagesUsed }) =>\n this.ctx.plugin(PluginImagesUsed)\n )\n this.ctx.inject(['quickUpload', '$'], (ctx) => {\n ctx.on('quick-edit/wiki-page', ({ modal }) => {\n const { $ } = ctx\n const wrapper = this.getWrapperForQuickEdit(modal)\n wrapper.appendChild(\n <a\n href=\"#ipe:quick-upload\"\n onClick={(e) => {\n e.preventDefault()\n ctx.quickUpload.showModal()\n ctx.emit('analytics/event', { feature: 'quick-usage', subtype: 'quick-upload' })\n }}\n >{$`Quick Upload`}</a>\n )\n })\n })\n }\n getWrapperForQuickEdit(modal: IPEModal) {\n const wrapper = modal.get$content().querySelector('.ipe-quickEdit__usages') || (\n <div\n className=\"ipe-quickEdit__usages\"\n style={{ display: 'flex', gap: '1em', flexWrap: 'wrap' }}\n ></div>\n )\n modal\n .get$content()\n .querySelector('.ipe-quickEdit__content')\n ?.insertAdjacentElement('afterend', wrapper)\n return wrapper\n }\n}\n"],"names":["PluginQuickUsage","BasePlugin","ctx","PluginTemplatesUsed","PluginImagesUsed","modal","$","jsx","e","wrapper"],"mappings":";;AASO,MAAMA,UAAyBC,EAAW;AAAA,EAC/C,YAAmBC,GAAiB;AAClC,UAAMA,GAAK,CAAA,GAAI,aAAa,GADX,KAAA,MAAAA,GAEjBA,EAAI,IAAI,cAAc,IAAI;AAAA,EAC5B;AAAA,EACA,MAAgB,QAAQ;AACtB,WAAO,mCAA0B,EAAE;AAAA,MAAK,CAAC,EAAE,qBAAAC,EAAA,MACzC,KAAK,IAAI,OAAOA,CAAmB;AAAA,IAAA,GAErC,OAAO,gCAAuB,EAAE;AAAA,MAAK,CAAC,EAAE,kBAAAC,EAAA,MACtC,KAAK,IAAI,OAAOA,CAAgB;AAAA,IAAA,GAElC,KAAK,IAAI,OAAO,CAAC,eAAe,GAAG,GAAG,CAACF,MAAQ;AAC7C,MAAAA,EAAI,GAAG,wBAAwB,CAAC,EAAE,OAAAG,QAAY;AAC5C,cAAM,EAAE,GAAAC,MAAMJ;AAEd,QADgB,KAAK,uBAAuBG,CAAK,EACzC;AAAA,UACN,gBAAAE;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAS,CAACC,MAAM;AACd,gBAAAA,EAAE,eAAA,GACFN,EAAI,YAAY,UAAA,GAChBA,EAAI,KAAK,mBAAmB,EAAE,SAAS,eAAe,SAAS,gBAAgB;AAAA,cACjF;AAAA,cACA,UAAAI;AAAA,YAAA;AAAA,UAAA;AAAA,QAAgB;AAAA,MAEtB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAAA,EACA,uBAAuBD,GAAiB;AACtC,UAAMI,IAAUJ,EAAM,YAAA,EAAc,cAAc,wBAAwB,KACxE,gBAAAE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,OAAO,EAAE,SAAS,QAAQ,KAAK,OAAO,UAAU,OAAA;AAAA,MAAO;AAAA,IAAA;AAG3D,WAAAF,EACG,cACA,cAAc,yBAAyB,GACtC,sBAAsB,YAAYI,CAAO,GACtCA;AAAA,EACT;AACF;"}
1
+ {"version":3,"file":"index-ygc4AMy4.js","sources":["../src/plugins/quick-usage/index.tsx"],"sourcesContent":["import { InPageEdit } from '@/InPageEdit'\nimport { IPEModal } from '@inpageedit/modal'\n\ndeclare module '@/InPageEdit' {\n interface InPageEdit {\n quickUsage: PluginQuickUsage\n }\n}\n\nexport class PluginQuickUsage extends BasePlugin {\n constructor(public ctx: InPageEdit) {\n super(ctx, {}, 'quick-usage')\n ctx.set('quickUsage', this)\n }\n protected async start() {\n import('./PluginTemplatesUsed.js').then(({ PluginTemplatesUsed }) =>\n this.ctx.plugin(PluginTemplatesUsed)\n )\n import('./PluginImagesUsed.js').then(({ PluginImagesUsed }) =>\n this.ctx.plugin(PluginImagesUsed)\n )\n this.ctx.inject(['quickUpload', '$'], (ctx) => {\n ctx.on('quick-edit/wiki-page', ({ modal }) => {\n const { $ } = ctx\n const wrapper = this.getWrapperForQuickEdit(modal)\n wrapper.appendChild(\n <a\n href=\"#ipe:quick-upload\"\n onClick={(e) => {\n e.preventDefault()\n ctx.quickUpload.showModal()\n ctx.emit('analytics/event', { feature: 'quick-usage', subtype: 'quick-upload' })\n }}\n >{$`Quick Upload`}</a>\n )\n })\n })\n }\n getWrapperForQuickEdit(modal: IPEModal) {\n const wrapper = modal.get$content().querySelector('.ipe-quickEdit__usages') || (\n <div\n className=\"ipe-quickEdit__usages\"\n style={{ display: 'flex', gap: '1em', flexWrap: 'wrap' }}\n ></div>\n )\n modal\n .get$content()\n .querySelector('.ipe-quickEdit__content')\n ?.insertAdjacentElement('afterend', wrapper)\n return wrapper\n }\n}\n"],"names":["PluginQuickUsage","BasePlugin","ctx","PluginTemplatesUsed","PluginImagesUsed","modal","$","jsx","e","wrapper"],"mappings":";;AASO,MAAMA,UAAyBC,EAAW;AAAA,EAC/C,YAAmBC,GAAiB;AAClC,UAAMA,GAAK,CAAA,GAAI,aAAa,GADX,KAAA,MAAAA,GAEjBA,EAAI,IAAI,cAAc,IAAI;AAAA,EAC5B;AAAA,EACA,MAAgB,QAAQ;AACtB,WAAO,mCAA0B,EAAE;AAAA,MAAK,CAAC,EAAE,qBAAAC,EAAA,MACzC,KAAK,IAAI,OAAOA,CAAmB;AAAA,IAAA,GAErC,OAAO,gCAAuB,EAAE;AAAA,MAAK,CAAC,EAAE,kBAAAC,EAAA,MACtC,KAAK,IAAI,OAAOA,CAAgB;AAAA,IAAA,GAElC,KAAK,IAAI,OAAO,CAAC,eAAe,GAAG,GAAG,CAACF,MAAQ;AAC7C,MAAAA,EAAI,GAAG,wBAAwB,CAAC,EAAE,OAAAG,QAAY;AAC5C,cAAM,EAAE,GAAAC,MAAMJ;AAEd,QADgB,KAAK,uBAAuBG,CAAK,EACzC;AAAA,UACN,gBAAAE;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAS,CAACC,MAAM;AACd,gBAAAA,EAAE,eAAA,GACFN,EAAI,YAAY,UAAA,GAChBA,EAAI,KAAK,mBAAmB,EAAE,SAAS,eAAe,SAAS,gBAAgB;AAAA,cACjF;AAAA,cACA,UAAAI;AAAA,YAAA;AAAA,UAAA;AAAA,QAAgB;AAAA,MAEtB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAAA,EACA,uBAAuBD,GAAiB;AACtC,UAAMI,IAAUJ,EAAM,YAAA,EAAc,cAAc,wBAAwB,KACxE,gBAAAE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,OAAO,EAAE,SAAS,QAAQ,KAAK,OAAO,UAAU,OAAA;AAAA,MAAO;AAAA,IAAA;AAG3D,WAAAF,EACG,cACA,cAAc,yBAAyB,GACtC,sBAAsB,YAAYI,CAAO,GACtCA;AAAA,EACT;AACF;"}
@@ -1,4 +1,4 @@
1
- import { j as n } from "./index-CM_6yF2v.js";
1
+ import { j as n } from "./Promise.withResolvers-C4chhLB1.js";
2
2
  const y = "_twinSwapInput_1gdgl_9", L = "_inputWrapper_1gdgl_23", W = "_inputLeft_1gdgl_27", $ = "_inputRight_1gdgl_30", j = "_swapButton_1gdgl_46", i = {
3
3
  twinSwapInput: y,
4
4
  inputWrapper: L,
@@ -81,4 +81,4 @@ const y = "_twinSwapInput_1gdgl_9", L = "_inputWrapper_1gdgl_23", W = "_inputLef
81
81
  export {
82
82
  M as T
83
83
  };
84
- //# sourceMappingURL=index-DD5CVCfD.js.map
84
+ //# sourceMappingURL=index-z_qDGCMT.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-DD5CVCfD.js","sources":["../src/components/TwinSwapInput/index.tsx"],"sourcesContent":["import { JSX } from 'jsx-dom/jsx-runtime'\nimport styles from './styles.module.sass'\n\nexport type TwinSwapInputProps = {\n inputs: [TwinSwapInputInput, TwinSwapInputInput]\n enableSwap?: boolean\n} & JSX.IntrinsicElements['div']\n\nexport interface TwinSwapInputInput {\n label?: string\n id?: string\n name: string\n value?: string\n disabled?: boolean\n required?: boolean\n inputProps?: Omit<JSX.IntrinsicElements['input'], 'name' | 'value'>\n}\n\nexport type TwinSwapElement = HTMLDivElement & {\n swap: () => void\n toggleEnableSwap: (enable?: boolean) => void\n}\n\nexport const TwinSwapInput = (props: TwinSwapInputProps) => {\n const { inputs, enableSwap = true, ...rest } = props\n\n const normalizedInputs =\n inputs?.length === 2\n ? inputs\n : ([inputs?.[0] ?? {}, inputs?.[1] ?? {}] as [TwinSwapInputInput, TwinSwapInputInput])\n\n // 内部稳定引用\n const inputRefs: [HTMLInputElement | null, HTMLInputElement | null] = [null, null]\n\n let swapCount = 0\n let swapBtnRef: HTMLButtonElement | null = null\n let svgRef: SVGElement | null = null\n\n const checkIfInputDisabled = () => inputRefs.some((el) => el && el.disabled)\n\n const swap = () => {\n if (!inputRefs[0] || !inputRefs[1]) return\n if (checkIfInputDisabled()) return\n\n const a = inputRefs[0]\n const b = inputRefs[1]\n const va = a.value\n const vb = b.value\n a.value = vb\n b.value = va\n\n // 与原实现一致:派发 change(不冒泡)\n a.dispatchEvent(new Event('change'))\n b.dispatchEvent(new Event('change'))\n\n swapCount++\n if (svgRef) {\n svgRef.style.transform = `rotateY(${swapCount * -180}deg)`\n svgRef.style.transition = 'transform 200ms ease'\n }\n }\n\n const toggleEnableSwap = (enable?: boolean) => {\n if (!swapBtnRef) return\n const next = enable ?? !swapBtnRef.disabled\n swapBtnRef.disabled = !next\n if (next) {\n // 与原实现一致:开启时把 inputs 解禁\n inputRefs.forEach((el) => {\n if (el) el.disabled = false\n })\n }\n }\n\n const swapButton = (\n <button\n type=\"button\"\n aria-label=\"Swap values\"\n onClick={swap}\n disabled={checkIfInputDisabled() || !enableSwap}\n ref={(el) => (swapBtnRef = el as HTMLButtonElement)}\n >\n <svg\n ref={(el) => (svgRef = el as unknown as SVGElement)}\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-tabler icons-tabler-outline icon-tabler-transfer\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M20 10h-16l5.5 -6\" />\n <path d=\"M4 14h16l-5.5 6\" />\n </svg>\n </button>\n ) as HTMLButtonElement\n\n const container = (\n <div className={`twin-swap-input ${styles.twinSwapInput}`} {...rest}>\n {normalizedInputs.map((input, index) => {\n const { label, id, name, value, disabled, required, inputProps } = input\n const isLeft = index === 0\n const inputId = id || name\n\n return (\n <div\n className={`${styles.inputWrapper} ${isLeft ? styles.inputLeft : styles.inputRight}`}\n >\n {label && <label htmlFor={inputId}>{label}</label>}\n <input\n ref={(el) => (inputRefs[index] = el as HTMLInputElement)}\n type=\"text\"\n id={inputId}\n name={name}\n value={value}\n disabled={disabled}\n required={required}\n {...inputProps}\n />\n </div>\n )\n })}\n\n <div className={styles.swapButton}>{swapButton}</div>\n </div>\n ) as TwinSwapElement\n\n container.swap = swap\n container.toggleEnableSwap = toggleEnableSwap\n\n return container\n}\n"],"names":["TwinSwapInput","props","inputs","enableSwap","rest","normalizedInputs","inputRefs","swapCount","swapBtnRef","svgRef","checkIfInputDisabled","el","swap","a","b","va","vb","toggleEnableSwap","enable","next","swapButton","jsx","jsxs","container","styles","input","index","label","id","name","value","disabled","required","inputProps","isLeft","inputId"],"mappings":";;;;;;;GAuBaA,IAAgB,CAACC,MAA8B;AAC1D,QAAM,EAAE,QAAAC,GAAQ,YAAAC,IAAa,IAAM,GAAGC,MAASH,GAEzCI,IACJH,GAAQ,WAAW,IACfA,IACC,CAACA,IAAS,CAAC,KAAK,CAAA,GAAIA,IAAS,CAAC,KAAK,CAAA,CAAE,GAGtCI,IAAgE,CAAC,MAAM,IAAI;AAEjF,MAAIC,IAAY,GACZC,IAAuC,MACvCC,IAA4B;AAEhC,QAAMC,IAAuB,MAAMJ,EAAU,KAAK,CAACK,MAAOA,KAAMA,EAAG,QAAQ,GAErEC,IAAO,MAAM;AAEjB,QADI,CAACN,EAAU,CAAC,KAAK,CAACA,EAAU,CAAC,KAC7BI,IAAwB;AAE5B,UAAMG,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AAA,EAAA,GAIEE,sBACH,OAAA,EAAI,WAAW,mBAAmBC,EAAO,aAAa,IAAK,GAAGpB,GAC5D,UAAA;AAAA,IAAAC,EAAiB,IAAI,CAACoB,GAAOC,MAAU;AACtC,YAAM,EAAE,OAAAC,GAAO,IAAAC,GAAI,MAAAC,GAAM,OAAAC,GAAO,UAAAC,GAAU,UAAAC,GAAU,YAAAC,MAAeR,GAC7DS,IAASR,MAAU,GACnBS,IAAUP,KAAMC;AAEtB,aACEP,gBAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAW,GAAGE,EAAO,YAAY,IAAIU,IAASV,EAAO,YAAYA,EAAO,UAAU;AAAA,UAEjF,UAAA;AAAA,YAAAG,KAAS,gBAAAN,EAAC,SAAA,EAAM,SAASc,GAAU,UAAAR,GAAM;AAAA,YAC1C,gBAAAN;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,KAAK,CAACV,MAAQL,EAAUoB,CAAK,IAAIf;AAAA,gBACjC,MAAK;AAAA,gBACL,IAAIwB;AAAA,gBACJ,MAAAN;AAAA,gBACA,OAAAC;AAAA,gBACA,UAAAC;AAAA,gBACA,UAAAC;AAAA,gBACC,GAAGC;AAAA,cAAA;AAAA,YAAA;AAAA,UACN;AAAA,QAAA;AAAA,MAAA;AAAA,IAGN,CAAC;AAAA,IAED,gBAAAZ,EAAC,OAAA,EAAI,WAAWG,EAAO,YAAa,UAAAJ,EAAA,CAAW;AAAA,EAAA,GACjD;AAGF,SAAAG,EAAU,OAAOX,GACjBW,EAAU,mBAAmBN,GAEtBM;AACT;"}
1
+ {"version":3,"file":"index-z_qDGCMT.js","sources":["../src/components/TwinSwapInput/index.tsx"],"sourcesContent":["import { JSX } from 'jsx-dom/jsx-runtime'\nimport styles from './styles.module.sass'\n\nexport type TwinSwapInputProps = {\n inputs: [TwinSwapInputInput, TwinSwapInputInput]\n enableSwap?: boolean\n} & JSX.IntrinsicElements['div']\n\nexport interface TwinSwapInputInput {\n label?: string\n id?: string\n name: string\n value?: string\n disabled?: boolean\n required?: boolean\n inputProps?: Omit<JSX.IntrinsicElements['input'], 'name' | 'value'>\n}\n\nexport type TwinSwapElement = HTMLDivElement & {\n swap: () => void\n toggleEnableSwap: (enable?: boolean) => void\n}\n\nexport const TwinSwapInput = (props: TwinSwapInputProps) => {\n const { inputs, enableSwap = true, ...rest } = props\n\n const normalizedInputs =\n inputs?.length === 2\n ? inputs\n : ([inputs?.[0] ?? {}, inputs?.[1] ?? {}] as [TwinSwapInputInput, TwinSwapInputInput])\n\n // 内部稳定引用\n const inputRefs: [HTMLInputElement | null, HTMLInputElement | null] = [null, null]\n\n let swapCount = 0\n let swapBtnRef: HTMLButtonElement | null = null\n let svgRef: SVGElement | null = null\n\n const checkIfInputDisabled = () => inputRefs.some((el) => el && el.disabled)\n\n const swap = () => {\n if (!inputRefs[0] || !inputRefs[1]) return\n if (checkIfInputDisabled()) return\n\n const a = inputRefs[0]\n const b = inputRefs[1]\n const va = a.value\n const vb = b.value\n a.value = vb\n b.value = va\n\n // 与原实现一致:派发 change(不冒泡)\n a.dispatchEvent(new Event('change'))\n b.dispatchEvent(new Event('change'))\n\n swapCount++\n if (svgRef) {\n svgRef.style.transform = `rotateY(${swapCount * -180}deg)`\n svgRef.style.transition = 'transform 200ms ease'\n }\n }\n\n const toggleEnableSwap = (enable?: boolean) => {\n if (!swapBtnRef) return\n const next = enable ?? !swapBtnRef.disabled\n swapBtnRef.disabled = !next\n if (next) {\n // 与原实现一致:开启时把 inputs 解禁\n inputRefs.forEach((el) => {\n if (el) el.disabled = false\n })\n }\n }\n\n const swapButton = (\n <button\n type=\"button\"\n aria-label=\"Swap values\"\n onClick={swap}\n disabled={checkIfInputDisabled() || !enableSwap}\n ref={(el) => (swapBtnRef = el as HTMLButtonElement)}\n >\n <svg\n ref={(el) => (svgRef = el as unknown as SVGElement)}\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-tabler icons-tabler-outline icon-tabler-transfer\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M20 10h-16l5.5 -6\" />\n <path d=\"M4 14h16l-5.5 6\" />\n </svg>\n </button>\n ) as HTMLButtonElement\n\n const container = (\n <div className={`twin-swap-input ${styles.twinSwapInput}`} {...rest}>\n {normalizedInputs.map((input, index) => {\n const { label, id, name, value, disabled, required, inputProps } = input\n const isLeft = index === 0\n const inputId = id || name\n\n return (\n <div\n className={`${styles.inputWrapper} ${isLeft ? styles.inputLeft : styles.inputRight}`}\n >\n {label && <label htmlFor={inputId}>{label}</label>}\n <input\n ref={(el) => (inputRefs[index] = el as HTMLInputElement)}\n type=\"text\"\n id={inputId}\n name={name}\n value={value}\n disabled={disabled}\n required={required}\n {...inputProps}\n />\n </div>\n )\n })}\n\n <div className={styles.swapButton}>{swapButton}</div>\n </div>\n ) as TwinSwapElement\n\n container.swap = swap\n container.toggleEnableSwap = toggleEnableSwap\n\n return container\n}\n"],"names":["TwinSwapInput","props","inputs","enableSwap","rest","normalizedInputs","inputRefs","swapCount","swapBtnRef","svgRef","checkIfInputDisabled","el","swap","a","b","va","vb","toggleEnableSwap","enable","next","swapButton","jsx","jsxs","container","styles","input","index","label","id","name","value","disabled","required","inputProps","isLeft","inputId"],"mappings":";;;;;;;GAuBaA,IAAgB,CAACC,MAA8B;AAC1D,QAAM,EAAE,QAAAC,GAAQ,YAAAC,IAAa,IAAM,GAAGC,MAASH,GAEzCI,IACJH,GAAQ,WAAW,IACfA,IACC,CAACA,IAAS,CAAC,KAAK,CAAA,GAAIA,IAAS,CAAC,KAAK,CAAA,CAAE,GAGtCI,IAAgE,CAAC,MAAM,IAAI;AAEjF,MAAIC,IAAY,GACZC,IAAuC,MACvCC,IAA4B;AAEhC,QAAMC,IAAuB,MAAMJ,EAAU,K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
11
  import Schema, { default as Schema$1 } from "schemastery";
12
- import * as jsx_dom1 from "jsx-dom";
13
- import { JSX, ReactElement, ReactNode } from "jsx-dom";
12
+ import * as jsx_dom0 from "jsx-dom";
13
+ import { JSX, ReactElement, ReactNode, SVGProps } from "jsx-dom";
14
14
  import { JSX as JSX$1 } from "jsx-dom/jsx-runtime";
15
15
  import { JSX as JSX$2 } from "vue/jsx-runtime";
16
16
  import * as vue0 from "vue";
@@ -564,6 +564,42 @@ interface AbstractIPEStorageManager<T = unknown> {
564
564
  clear(): Promise<this>;
565
565
  }
566
566
  //#endregion
567
+ //#region src/services/ThemeService.d.ts
568
+ type ThemePreference = 'light' | 'dark' | 'auto' | 'fandom';
569
+ type ThemeMode = 'light' | 'dark';
570
+ // ↓ '@/InPageEdit'
571
+ declare module '.' {
572
+ interface InPageEdit {
573
+ theme: ThemeService;
574
+ }
575
+ interface Events {
576
+ 'theme/changed'(payload: {
577
+ ctx: InPageEdit;
578
+ theme: ThemeMode;
579
+ }): void;
580
+ }
581
+ interface PreferencesMap {
582
+ theme: ThemePreference;
583
+ }
584
+ }
585
+ declare class ThemeService extends Service {
586
+ ctx: InPageEdit;
587
+ private _mediaQueryList;
588
+ private _observer;
589
+ private readonly _handleSystemThemeChange;
590
+ private readonly _handleBodyClassChange;
591
+ constructor(ctx: InPageEdit);
592
+ protected start(): Promise<void>;
593
+ protected stop(): void;
594
+ private _onSystemThemeChange;
595
+ private _onBodyClassChange;
596
+ applyTheme(): Promise<void>;
597
+ private updateFandomObserver;
598
+ private getTheme;
599
+ private applyThemeClass;
600
+ get currentTheme(): ThemeMode;
601
+ }
602
+ //#endregion
567
603
  //#region src/models/WikiPage/types/PageInfo.d.ts
568
604
  /**
569
605
  * @url https://www.mediawiki.org/wiki/Content_handlers
@@ -905,16 +941,16 @@ declare class PreferencesService extends Service {
905
941
  * @tips 你可以通过重载 PreferencesMap 来定义你的配置项类型,以自动获得类型推导
906
942
  */
907
943
  get(): Promise<PreferencesMap>;
908
- get<K extends keyof PreferencesMap>(key: K, fallback?: ComputeAble<PreferencesMap[K]>): Promise<PreferencesMap[K] | null>;
944
+ get<K$1 extends keyof PreferencesMap>(key: K$1, fallback?: ComputeAble<PreferencesMap[K$1]>): Promise<PreferencesMap[K$1] | null>;
909
945
  get<U = unknown>(key: string, fallback?: ComputeAble<U>): Promise<U | null>;
910
946
  /**
911
947
  * 获取全部注册的配置项以及最终生效的值
912
948
  * 未保存的配置项将使用默认值
913
949
  */
914
950
  getAll(): Promise<PreferencesMap>;
915
- set<K extends keyof PreferencesMap>(key: K, value: PreferencesMap[K] | undefined | null): Promise<PreferencesMap[K] | void>;
951
+ set<K$1 extends keyof PreferencesMap>(key: K$1, value: PreferencesMap[K$1] | undefined | null): Promise<PreferencesMap[K$1] | void>;
916
952
  set<U = unknown>(key: string, value: U | undefined | null): Promise<U | void>;
917
- setMany(input: { [K in keyof PreferencesMap]?: PreferencesMap[K] | undefined | null }): Promise<{ [K in keyof PreferencesMap]?: PreferencesMap[K] | undefined | null }>;
953
+ setMany(input: { [K in keyof PreferencesMap]?: PreferencesMap[K$1] | undefined | null }): Promise<{ [K in keyof PreferencesMap]?: PreferencesMap[K$1] | undefined | null }>;
918
954
  setMany<U = unknown>(input: Record<string, U | undefined | null>): Promise<Record<string, U | undefined | null>>;
919
955
  defaultOf<T extends keyof PreferencesMap>(key: T): PreferencesMap[T] | undefined;
920
956
  defaultOf<U = unknown>(key: string): U | undefined;
@@ -1371,20 +1407,6 @@ interface InPageEdit {
1371
1407
  [InPageEdit.events]: Events<this>;
1372
1408
  }
1373
1409
  //#endregion
1374
- //#region src/constants/endpoints.d.ts
1375
- declare enum Endpoints {
1376
- ANALYTICS_API_BASE = "https://analytics.ipe.wiki/api/v6",
1377
- ANALYTICS_DASH_URL = "https://analytics.ipe.wiki",
1378
- GITHUB_URL = "https://github.com/inpageedit/inpageedit-next",
1379
- GITHUB_OWNER = "inpageedit",
1380
- GITHUB_REPO = "inpageedit-next",
1381
- HOME_URL = "https://www.ipe.wiki/",
1382
- UPDATE_LOGS_URL = "https://www.ipe.wiki/changelogs/",
1383
- PLUGIN_REGISTRY_URL = "https://registry.ipe.wiki/registry.v1.json",
1384
- I18N_INDEX_URL = "https://registry.ipe.wiki/i18n/index.json",
1385
- QQ_GROUP_ID = "1026023666",
1386
- }
1387
- //#endregion
1388
1410
  //#region src/plugins/BasePlugin.d.ts
1389
1411
  interface DisposeHandler {
1390
1412
  (ctx: InPageEdit): Promise<void> | void;
@@ -1410,6 +1432,20 @@ declare class BasePlugin<ConfigType extends unknown = any> {
1410
1432
  get logger(): Logger;
1411
1433
  }
1412
1434
  //#endregion
1435
+ //#region src/constants/endpoints.d.ts
1436
+ declare enum Endpoints {
1437
+ ANALYTICS_API_BASE = "https://analytics.ipe.wiki/api/v6",
1438
+ ANALYTICS_DASH_URL = "https://analytics.ipe.wiki",
1439
+ GITHUB_URL = "https://github.com/inpageedit/inpageedit-next",
1440
+ GITHUB_OWNER = "inpageedit",
1441
+ GITHUB_REPO = "inpageedit-next",
1442
+ HOME_URL = "https://www.ipe.wiki/",
1443
+ UPDATE_LOGS_URL = "https://www.ipe.wiki/changelogs/",
1444
+ PLUGIN_REGISTRY_URL = "https://registry.ipe.wiki/registry.v1.json",
1445
+ I18N_INDEX_URL = "https://registry.ipe.wiki/i18n/index.json",
1446
+ QQ_GROUP_ID = "1026023666",
1447
+ }
1448
+ //#endregion
1413
1449
  //#region src/decorators/Preferences.d.ts
1414
1450
  type AnyConstructor<T = any> = new (...args: any[]) => T;
1415
1451
  type PreferenceAugmented<D, C extends AnyConstructor> = C & {
@@ -1474,21 +1510,21 @@ declare function TabView({
1474
1510
  content: ReactNode;
1475
1511
  })[];
1476
1512
  defaultActiveIndex?: number;
1477
- }): jsx_dom1.ReactElement;
1513
+ }): jsx_dom0.ReactElement;
1478
1514
  declare function TabLabel({
1479
1515
  name,
1480
1516
  children
1481
1517
  }: {
1482
1518
  name: string;
1483
1519
  children: ReactNode;
1484
- }): jsx_dom1.ReactElement;
1520
+ }): jsx_dom0.ReactElement;
1485
1521
  declare function TabContent({
1486
1522
  name,
1487
1523
  children
1488
1524
  }: {
1489
1525
  name: string;
1490
1526
  children: ReactNode;
1491
- }): jsx_dom1.ReactElement;
1527
+ }): jsx_dom0.ReactElement;
1492
1528
  //#endregion
1493
1529
  //#region src/components/TwinSwapInput/index.d.ts
1494
1530
  type TwinSwapInputProps = {
@@ -1533,7 +1569,7 @@ type CheckBoxProps = {
1533
1569
  inputProps?: JSX.IntrinsicElements['input'];
1534
1570
  labelProps?: JSX.IntrinsicElements['span'];
1535
1571
  } & JSX.IntrinsicElements['label'];
1536
- declare const CheckBox: (props: CheckBoxProps) => jsx_dom1.ReactElement;
1572
+ declare const CheckBox: (props: CheckBoxProps) => jsx_dom0.ReactElement;
1537
1573
  //#endregion
1538
1574
  //#region src/components/InputBox.d.ts
1539
1575
  type InputBoxProps = {
@@ -1547,7 +1583,7 @@ type InputBoxProps = {
1547
1583
  labelProps?: JSX.IntrinsicElements['label'];
1548
1584
  inputProps?: JSX.IntrinsicElements['input'];
1549
1585
  } & JSX.IntrinsicElements['div'];
1550
- declare const InputBox: (props: InputBoxProps) => jsx_dom1.ReactElement;
1586
+ declare const InputBox: (props: InputBoxProps) => jsx_dom0.ReactElement;
1551
1587
  //#endregion
1552
1588
  //#region src/components/RadioBox.d.ts
1553
1589
  type RadioBoxProps = {
@@ -1558,7 +1594,19 @@ type RadioBoxProps = {
1558
1594
  inputProps?: JSX.IntrinsicElements['input'];
1559
1595
  labelProps?: JSX.IntrinsicElements['span'];
1560
1596
  } & JSX.IntrinsicElements['label'];
1561
- declare const RadioBox: (props: RadioBoxProps) => jsx_dom1.ReactElement;
1597
+ declare const RadioBox: (props: RadioBoxProps) => jsx_dom0.ReactElement;
1598
+ //#endregion
1599
+ //#region src/components/Icon/IconEdit.d.ts
1600
+ declare const IconEdit: (props: SVGProps<SVGSVGElement>) => jsx_dom0.ReactElement;
1601
+ //#endregion
1602
+ //#region src/components/Icon/IconQuickDiff.d.ts
1603
+ declare const IconQuickDiff: (props: SVGProps<SVGSVGElement>) => jsx_dom0.ReactElement;
1604
+ //#endregion
1605
+ //#region src/components/Icon/IconQuickEdit.d.ts
1606
+ declare const IconQuickEdit: (props: SVGProps<SVGSVGElement>) => jsx_dom0.ReactElement;
1607
+ //#endregion
1608
+ //#region src/components/Icon/IconUpload.d.ts
1609
+ declare const IconUpload: (props: SVGProps<SVGSVGElement>) => jsx_dom0.ReactElement;
1562
1610
  //#endregion
1563
1611
  //#region src/plugins/analytics/index.d.ts
1564
1612
  // ↓ '@/InPageEdit'
@@ -1779,12 +1827,23 @@ declare class PluginPluginStore extends BasePlugin {
1779
1827
  }
1780
1828
  //#endregion
1781
1829
  //#region src/plugins/preferences-ui/components/PreferencesApp.vue.d.ts
1782
- declare const __VLS_export: vue0.DefineComponent<{}, {
1783
- getValue(): any;
1784
- mergeValue(details: Record<string, unknown>): void;
1785
- selectTab(name: string): void;
1786
- }, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, true, {}, any>;
1830
+ declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
1831
+ props: vue0.PublicProps & (typeof globalThis extends {
1832
+ __VLS_PROPS_FALLBACK: infer P;
1833
+ } ? P : {});
1834
+ expose: (exposed: vue0.ShallowUnwrapRef<{
1835
+ getValue(): any;
1836
+ mergeValue(details: Record<string, unknown>): void;
1837
+ selectTab(name: string): void;
1838
+ }>) => void;
1839
+ attrs: any;
1840
+ slots: {};
1841
+ emit: {};
1842
+ }>) => vue0.VNode & {
1843
+ __ctx?: Awaited<typeof __VLS_setup>;
1844
+ };
1787
1845
  declare const _default: typeof __VLS_export;
1846
+ type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K] } : { [K in keyof T as K]: T[K] }) & {};
1788
1847
  //#endregion
1789
1848
  //#region src/plugins/preferences-ui/index.d.ts
1790
1849
  // ↓ '@/InPageEdit'
@@ -2089,7 +2148,7 @@ declare class PluginQuickPreview extends BasePlugin {
2089
2148
  previewFile(fileOrUrl: File | string, alt?: string): Promise<CustomIPEModal | undefined>;
2090
2149
  private _objectUrls;
2091
2150
  private getObjectUrl;
2092
- getPreviewElement(fileOrUrl: File | string, alt?: string): Promise<jsx_dom1.ReactElement | null>;
2151
+ getPreviewElement(fileOrUrl: File | string, alt?: string): Promise<jsx_dom0.ReactElement | null>;
2093
2152
  previewWikiPage(title: string): void;
2094
2153
  }
2095
2154
  //#endregion
@@ -2156,11 +2215,11 @@ declare class PluginQuickUpload extends BasePlugin {
2156
2215
  constructor(ctx: InPageEdit);
2157
2216
  protected start(): Promise<void>;
2158
2217
  protected stop(): Promise<void>;
2159
- private injectQuickEdit;
2160
2218
  private injectToolbox;
2161
2219
  private formatFileSize;
2162
- private getDefaultPreviewPlaceholder;
2163
2220
  private isFileAccepted;
2221
+ private getDefaultPreviewPlaceholder;
2222
+ private safeId;
2164
2223
  showModal(): Promise<CustomIPEModal>;
2165
2224
  }
2166
2225
  //#endregion
@@ -2253,10 +2312,13 @@ declare class PluginToolbox extends Service {
2253
2312
  toggle(force?: boolean): void;
2254
2313
  }
2255
2314
  declare namespace index_d_exports$1 {
2256
- export { AbstractIPEStorageManager, ApiService, ApiServiceOptions, CurrentPageService, CustomIPEModal, InPageEditPreferenceUICategory, InPageEditPreferenceUIRegistryItem, ModalService, PreferencesService, ResourceLoaderService, StorageService, StorageServiceConfig, TypedStorageEntry, UploadFileParams, UploadFileResult, WikiFileService, WikiImageInfo, WikiLinkMetadata, WikiMetadataService, WikiPageService, WikiTitleService };
2315
+ export { AbstractIPEStorageManager, ApiService, ApiServiceOptions, CurrentPageService, CustomIPEModal, InPageEditPreferenceUICategory, InPageEditPreferenceUIRegistryItem, ModalService, PreferencesService, ResourceLoaderService, StorageService, StorageServiceConfig, ThemeService, TypedStorageEntry, UploadFileParams, UploadFileResult, WikiFileService, WikiImageInfo, WikiLinkMetadata, WikiMetadataService, WikiPageService, WikiTitleService };
2316
+ }
2317
+ declare namespace core_d_exports {
2318
+ export { AbstractIPEStorageManager, ActionButton, ActionButtonProps, ApiService, ApiServiceOptions, BasePlugin, CheckBox, CheckBoxProps, CompareApiRequestOptions, CompareApiResponse, ContentModelMap, CordisError, CordisSymbols, CurrentPageService, CustomIPEModal, EffectScope, Endpoints, Events, ForkScope, IPEBeaconPayload, IPEBeaconUsage, IPEPlugin, IPERegistry, IWikiPage, IWikiTitle, IconEdit, IconQuickDiff, IconQuickEdit, IconUpload, InArticleWikiAnchorMetadata, InPageEdit, InPageEditCoreConfig, InPageEditPreferenceUICategory, InPageEditPreferenceUIRegistryItem, Inject, InputBox, InputBoxProps, Lifecycle, MBox, MBoxElement, MBoxProps, MainScope, MemoryStorage, ModalService, MovePageOptions, PageInfo, PageParseData, PluginAnalytics, PluginInArticleLinks, PluginPluginStore, PluginPreferencesUI, PluginQuickDiff, PluginQuickEdit, PluginQuickMove, PluginQuickPreview, PluginQuickRedirect, PluginQuickUpload, PluginQuickUsage, PluginStoreRegistrySource, PluginToolbox, PreferencesMap, PreferencesService, ProgressBar, QuickEditEventPayload, QuickEditOptions, QuickEditSubmitPayload, QuickMoveOptions, QuickRedirectOptions, RadioBox, RadioBoxProps, RedirectPageOptions, RegisterPreferences, ResourceLoaderService, Schema, ScopeStatus, Service, StorageService, StorageServiceConfig, TabContent, TabLabel, TabView, TabViewLabelOptions, ThemeService, TwinSwapElement, TwinSwapInput, TwinSwapInputInput, TwinSwapInputProps, TypedStorageEntry, UploadFileParams, UploadFileResult, WatchlistAction, WikiFileRepo, WikiFileService, WikiImageInfo, WikiLinkMetadata, WikiMagicWord, WikiMetadataService, WikiNameSpaceAlias, WikiNamespace, WikiPageConstructor, WikiPageService, WikiSiteGeneralInfo, WikiSiteInfo, WikiSpecialPageAlias, WikiTitleConstructor, WikiTitleService, WikiUserBlockInfo, WikiUserInfo, WikiUserOptions, createWikiPageModel, createWikiTitleModel, useMemoryStorage };
2257
2319
  }
2258
2320
  declare namespace index_d_exports {
2259
- export { AbstractIPEStorageManager, ActionButton, ActionButtonProps, ApiService, ApiServiceOptions, BasePlugin, CheckBox, CheckBoxProps, CompareApiRequestOptions, CompareApiResponse, ContentModelMap, CordisError, CordisSymbols, CurrentPageService, CustomIPEModal, EffectScope, Endpoints, Events, ForkScope, IPEBeaconPayload, IPEBeaconUsage, IPEPlugin, IPERegistry, IWikiPage, IWikiTitle, InArticleWikiAnchorMetadata, InPageEdit, InPageEditCoreConfig, InPageEditPreferenceUICategory, InPageEditPreferenceUIRegistryItem, Inject, InputBox, InputBoxProps, Lifecycle, MBox, MBoxElement, MBoxProps, MainScope, MemoryStorage, ModalService, MovePageOptions, PageInfo, PageParseData, PluginAnalytics, PluginInArticleLinks, PluginPluginStore, PluginPreferencesUI, PluginQuickDiff, PluginQuickEdit, PluginQuickMove, PluginQuickPreview, PluginQuickRedirect, PluginQuickUpload, PluginQuickUsage, PluginStoreRegistrySource, PluginToolbox, PreferencesMap, PreferencesService, ProgressBar, QuickEditEventPayload, QuickEditOptions, QuickEditSubmitPayload, QuickMoveOptions, QuickRedirectOptions, RadioBox, RadioBoxProps, RedirectPageOptions, RegisterPreferences, ResourceLoaderService, Schema, ScopeStatus, Service, StorageService, StorageServiceConfig, TabContent, TabLabel, TabView, TabViewLabelOptions, TwinSwapElement, TwinSwapInput, TwinSwapInputInput, TwinSwapInputProps, TypedStorageEntry, UploadFileParams, UploadFileResult, WatchlistAction, WikiFileRepo, WikiFileService, WikiImageInfo, WikiLinkMetadata, WikiMagicWord, WikiMetadataService, WikiNameSpaceAlias, WikiNamespace, WikiPageConstructor, WikiPageService, WikiSiteGeneralInfo, WikiSiteInfo, WikiSpecialPageAlias, WikiTitleConstructor, WikiTitleService, WikiUserBlockInfo, WikiUserInfo, WikiUserOptions, createWikiPageModel, createWikiTitleModel, useMemoryStorage };
2321
+ export { AbstractIPEStorageManager, ActionButton, ActionButtonProps, ApiService, ApiServiceOptions, BasePlugin, CheckBox, CheckBoxProps, CompareApiRequestOptions, CompareApiResponse, ContentModelMap, CordisError, CordisSymbols, CurrentPageService, CustomIPEModal, EffectScope, Endpoints, Events, ForkScope, IPEBeaconPayload, IPEBeaconUsage, IPEPlugin, IPERegistry, IWikiPage, IWikiTitle, IconEdit, IconQuickDiff, IconQuickEdit, IconUpload, InArticleWikiAnchorMetadata, InPageEdit, InPageEditCoreConfig, InPageEditPreferenceUICategory, InPageEditPreferenceUIRegistryItem, Inject, InputBox, InputBoxProps, Lifecycle, MBox, MBoxElement, MBoxProps, MainScope, MemoryStorage, ModalService, MovePageOptions, PageInfo, PageParseData, PluginAnalytics, PluginInArticleLinks, PluginPluginStore, PluginPreferencesUI, PluginQuickDiff, PluginQuickEdit, PluginQuickMove, PluginQuickPreview, PluginQuickRedirect, PluginQuickUpload, PluginQuickUsage, PluginStoreRegistrySource, PluginToolbox, PreferencesMap, PreferencesService, ProgressBar, QuickEditEventPayload, QuickEditOptions, QuickEditSubmitPayload, QuickMoveOptions, QuickRedirectOptions, RadioBox, RadioBoxProps, RedirectPageOptions, RegisterPreferences, ResourceLoaderService, Schema, ScopeStatus, Service, StorageService, StorageServiceConfig, TabContent, TabLabel, TabView, TabViewLabelOptions, ThemeService, TwinSwapElement, TwinSwapInput, TwinSwapInputInput, TwinSwapInputProps, TypedStorageEntry, UploadFileParams, UploadFileResult, WatchlistAction, WikiFileRepo, WikiFileService, WikiImageInfo, WikiLinkMetadata, WikiMagicWord, WikiMetadataService, WikiNameSpaceAlias, WikiNamespace, WikiPageConstructor, WikiPageService, WikiSiteGeneralInfo, WikiSiteInfo, WikiSpecialPageAlias, WikiTitleConstructor, WikiTitleService, WikiUserBlockInfo, WikiUserInfo, WikiUserOptions, createWikiPageModel, createWikiTitleModel, useMemoryStorage };
2260
2322
  }
2261
2323
  declare global {
2262
2324
  const ipe: InPageEdit;
@@ -2292,4 +2354,4 @@ declare global {
2292
2354
  }
2293
2355
  }
2294
2356
  //#endregion
2295
- export { AbstractIPEStorageManager, ActionButton, ActionButtonProps, ApiService, ApiServiceOptions, BasePlugin, CheckBox, CheckBoxProps, CompareApiRequestOptions, CompareApiResponse, ContentModelMap, CordisError, CordisSymbols, CurrentPageService, CustomIPEModal, EffectScope, Endpoints, Events, ForkScope, IPEBeaconPayload, IPEBeaconUsage, IPEPlugin, IPERegistry, IWikiPage, IWikiTitle, InArticleWikiAnchorMetadata, InPageEdit, InPageEditCoreConfig, InPageEditPreferenceUICategory, InPageEditPreferenceUIRegistryItem, Inject, InputBox, InputBoxProps, Lifecycle, MBox, MBoxElement, MBoxProps, MainScope, MemoryStorage, ModalService, MovePageOptions, PageInfo, PageParseData, PluginAnalytics, PluginInArticleLinks, PluginPluginStore, PluginPreferencesUI, PluginQuickDiff, PluginQuickEdit, PluginQuickMove, PluginQuickPreview, PluginQuickRedirect, PluginQuickUpload, PluginQuickUsage, PluginStoreRegistrySource, PluginToolbox, PreferencesMap, PreferencesService, ProgressBar, QuickEditEventPayload, QuickEditOptions, QuickEditSubmitPayload, QuickMoveOptions, QuickRedirectOptions, RadioBox, RadioBoxProps, RedirectPageOptions, RegisterPreferences, ResourceLoaderService, Schema, ScopeStatus, Service, StorageService, StorageServiceConfig, TabContent, TabLabel, TabView, TabViewLabelOptions, TwinSwapElement, TwinSwapInput, TwinSwapInputInput, TwinSwapInputProps, TypedStorageEntry, UploadFileParams, UploadFileResult, WatchlistAction, WikiFileRepo, WikiFileService, WikiImageInfo, WikiLinkMetadata, WikiMagicWord, WikiMetadataService, WikiNameSpaceAlias, WikiNamespace, WikiPageConstructor, WikiPageService, WikiSiteGeneralInfo, WikiSiteInfo, WikiSpecialPageAlias, WikiTitleConstructor, WikiTitleService, WikiUserBlockInfo, WikiUserInfo, WikiUserOptions, createWikiPageModel, createWikiTitleModel, useMemoryStorage };
2357
+ export { AbstractIPEStorageManager, ActionButton, ActionButtonProps, ApiService, ApiServiceOptions, BasePlugin, CheckBox, CheckBoxProps, CompareApiRequestOptions, CompareApiResponse, ContentModelMap, CordisError, CordisSymbols, CurrentPageService, CustomIPEModal, EffectScope, Endpoints, Events, ForkScope, IPEBeaconPayload, IPEBeaconUsage, IPEPlugin, IPERegistry, IWikiPage, IWikiTitle, IconEdit, IconQuickDiff, IconQuickEdit, IconUpload, InArticleWikiAnchorMetadata, InPageEdit, InPageEditCoreConfig, InPageEditPreferenceUICategory, InPageEditPreferenceUIRegistryItem, Inject, InputBox, InputBoxProps, Lifecycle, MBox, MBoxElement, MBoxProps, MainScope, MemoryStorage, ModalService, MovePageOptions, PageInfo, PageParseData, PluginAnalytics, PluginInArticleLinks, PluginPluginStore, PluginPreferencesUI, PluginQuickDiff, PluginQuickEdit, PluginQuickMove, PluginQuickPreview, PluginQuickRedirect, PluginQuickUpload, PluginQuickUsage, PluginStoreRegistrySource, PluginToolbox, PreferencesMap, PreferencesService, ProgressBar, QuickEditEventPayload, QuickEditOptions, QuickEditSubmitPayload, QuickMoveOptions, QuickRedirectOptions, RadioBox, RadioBoxProps, RedirectPageOptions, RegisterPreferences, ResourceLoaderService, Schema, ScopeStatus, Service, StorageService, StorageServiceConfig, TabContent, TabLabel, TabView, TabViewLabelOptions, ThemeService, TwinSwapElement, TwinSwapInput, TwinSwapInputInput, TwinSwapInputProps, TypedStorageEntry, UploadFileParams, UploadFileResult, WatchlistAction, WikiFileRepo, WikiFileService, WikiImageInfo, WikiLinkMetadata, WikiMagicWord, WikiMetadataService, WikiNameSpaceAlias, WikiNamespace, WikiPageConstructor, WikiPageService, WikiSiteGeneralInfo, WikiSiteInfo, WikiSpecialPageAlias, WikiTitleConstructor, WikiTitleService, WikiUserBlockInfo, WikiUserInfo, WikiUserOptions, createWikiPageModel, createWikiTitleModel, useMemoryStorage };