@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
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 dragon-fish
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2025 dragon-fish
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/README.md CHANGED
@@ -47,9 +47,18 @@ document.body.append(
47
47
 
48
48
  ## Supported languages
49
49
 
50
- > [!NOTE]
51
- >
52
- > Currently only English is supported. We're working on i18n support.
50
+ - **English (en)**
51
+ - العربية (ar)
52
+ - Français (fr)
53
+ - Hindī (hi)
54
+ - 日本語 (ja)
55
+ - Nederlands (nl)
56
+ - Polski (pl)
57
+ - Português do Brasil (pt_BR)
58
+ - **中文(简体) (zh-Hans)**
59
+ - 中文(繁體) (zh-Hant)
60
+
61
+ [Help us translate](https://crowdin.com/project/inpageedit)
53
62
 
54
63
  ---
55
64
 
@@ -59,4 +68,4 @@ document.body.append(
59
68
  >
60
69
  > InPageEdit-NEXT Copyright © 2025-present dragon-fish
61
70
 
62
- See more: [GitHub](https://github.com/inpageedit/inpageedit-next) | [Change Logs](https://www.ipe.wiki/changelogs/) | [File Issues](https://github.com/inpageedit/inpageedit-next/issues)
71
+ See more: [GitHub](https://github.com/inpageedit/inpageedit-next) | [Change Logs](https://www.ipe.wiki/changelogs/) | [File Issues](https://github.com/inpageedit/inpageedit-next/issues) | [Plugin Registry](https://github.com/inpageedit/plugin-registry) | [Translate (Crowdin)](https://crowdin.com/project/inpageedit)
@@ -1,36 +1,28 @@
1
- function c(t) {
2
- return t.charAt(0).toLowerCase() + t.slice(1);
3
- }
4
- function p(t) {
5
- return c(t).replace(/_/g, "-").replace(/.[A-Z]+/g, (e) => e[0] + "-" + e.slice(1).toLowerCase());
6
- }
7
- function l(t) {
8
- return c(t).replace(/-/g, "_").replace(/.[A-Z]+/g, (e) => e[0] + "_" + e.slice(1).toLowerCase());
9
- }
10
- class d {
11
- constructor(e, r = void 0, h) {
12
- this.ctx = e, this.disposeHandlers = [], this.name = h || "", this.config = r || {};
13
- const { promise: i, resolve: o, reject: a } = Promise.withResolvers();
1
+ import { f as n } from "./Preferences-BF2fcXrn.js";
2
+ class l {
3
+ constructor(e, t = void 0, h) {
4
+ this.ctx = e, this.disposeHandlers = [], this.name = h || "", this.config = t || {};
5
+ const { promise: r, resolve: i, reject: o } = Promise.withResolvers();
14
6
  queueMicrotask(() => {
15
7
  this.name || (this.name = this.constructor.name);
16
8
  try {
17
9
  const s = this.start();
18
- s && typeof s.then == "function" ? s.then(() => o()).catch((n) => {
19
- this.logger.error("start() returns a rejected promise", n), a(n);
20
- }) : o();
10
+ s && typeof s.then == "function" ? s.then(() => i()).catch((a) => {
11
+ this.logger.error("start() returns a rejected promise", a), o(a);
12
+ }) : i();
21
13
  } catch (s) {
22
- this.logger.error("start() threw synchronously", s), a(s);
14
+ this.logger.error("start() threw synchronously", s), o(s);
23
15
  }
24
- i.then(() => {
16
+ r.then(() => {
25
17
  this.logger.debug("started");
26
- }), i.catch((s) => {
18
+ }), r.catch((s) => {
27
19
  this.logger.error("start failed", s), this.ctx.scope.dispose();
28
20
  });
29
21
  }), this.ctx.once("dispose", () => {
30
22
  this.disposeHandlers.forEach((s) => s(this.ctx)), this.stop(), this.logger.debug("disposed");
31
23
  });
32
24
  }
33
- #e;
25
+ #s;
34
26
  static {
35
27
  this.inject = [];
36
28
  }
@@ -45,20 +37,19 @@ class d {
45
37
  this.disposeHandlers.push(e);
46
38
  }
47
39
  removeDisposeHandler(e) {
48
- this.disposeHandlers = this.disposeHandlers.filter((r) => r !== e);
40
+ this.disposeHandlers = this.disposeHandlers.filter((t) => t !== e);
49
41
  }
50
42
  set name(e) {
51
- this.#e = l(e).toUpperCase();
43
+ this.#s = n(e).toUpperCase();
52
44
  }
53
45
  get name() {
54
- return this.#e;
46
+ return this.#s;
55
47
  }
56
48
  get logger() {
57
49
  return this.ctx.logger(this.name);
58
50
  }
59
51
  }
60
52
  export {
61
- d as B,
62
- p
53
+ l as B
63
54
  };
64
- //# sourceMappingURL=BasePlugin-Bf2UuIHF.js.map
55
+ //# sourceMappingURL=BasePlugin-YOi2_vUo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BasePlugin-YOi2_vUo.js","sources":["../src/plugins/BasePlugin.ts"],"sourcesContent":["import { Inject, InPageEdit, Schema } from '@/InPageEdit'\nimport type { Logger } from '@inpageedit/logger'\nimport { snakeCase } from '@/utils/string'\n\ninterface DisposeHandler {\n (ctx: InPageEdit): Promise<void> | void\n}\n\nexport default class BasePlugin<ConfigType extends unknown = any> {\n #name!: string\n public config: ConfigType\n private disposeHandlers: DisposeHandler[] = []\n /** 依赖注入 */\n static inject?: Inject = []\n /** 可重用? */\n static reusable = false\n /** 插件的偏好设置模式 */\n static PreferencesSchema?: Schema\n\n constructor(\n public ctx: InPageEdit,\n config: ConfigType = undefined as unknown as ConfigType,\n name?: string\n ) {\n this.name = name || ''\n this.config = config || ({} as ConfigType)\n const { promise, resolve, reject } = Promise.withResolvers<void>()\n queueMicrotask(() => {\n if (!this.name) {\n this.name = this.constructor.name\n }\n try {\n const ret = this.start()\n if (ret && typeof (ret as Promise<unknown>).then === 'function') {\n ;(ret as Promise<unknown>)\n .then(() => resolve())\n .catch((err) => {\n this.logger.error('start() returns a rejected promise', err)\n reject(err)\n })\n } else {\n resolve()\n }\n } catch (err) {\n this.logger.error('start() threw synchronously', err)\n reject(err)\n }\n\n promise.then(() => {\n this.logger.debug('started')\n })\n promise.catch((e) => {\n this.logger.error('start failed', e)\n this.ctx.scope.dispose()\n })\n })\n this.ctx.once('dispose', () => {\n this.disposeHandlers.forEach((fn) => fn(this.ctx))\n this.stop()\n this.logger.debug('disposed')\n })\n }\n\n protected start(): Promise<void> | void {}\n protected stop(): Promise<void> | void {}\n protected addDisposeHandler(fn: DisposeHandler): void {\n this.disposeHandlers.push(fn)\n }\n protected removeDisposeHandler(fn: DisposeHandler): void {\n this.disposeHandlers = this.disposeHandlers.filter((f) => f !== fn)\n }\n\n set name(name: string) {\n this.#name = snakeCase(name).toUpperCase()\n }\n get name(): string {\n return this.#name\n }\n\n get logger(): Logger {\n return this.ctx.logger(this.name)\n }\n}\n"],"names":["BasePlugin","ctx","config","name","promise","resolve","reject","ret","err","e","fn","#name","f","snakeCase"],"mappings":";AAQA,MAAqBA,EAA6C;AAAA,EAWhE,YACSC,GACPC,IAAqB,QACrBC,GACA;AAHO,SAAA,MAAAF,GATT,KAAQ,kBAAoC,CAAA,GAa1C,KAAK,OAAOE,KAAQ,IACpB,KAAK,SAASD,KAAW,CAAA;AACzB,UAAM,EAAE,SAAAE,GAAS,SAAAC,GAAS,QAAAC,EAAA,IAAW,QAAQ,cAAA;AAC7C,mBAAe,MAAM;AACnB,MAAK,KAAK,SACR,KAAK,OAAO,KAAK,YAAY;AAE/B,UAAI;AACF,cAAMC,IAAM,KAAK,MAAA;AACjB,QAAIA,KAAO,OAAQA,EAAyB,QAAS,aACjDA,EACC,KAAK,MAAMF,EAAA,CAAS,EACpB,MAAM,CAACG,MAAQ;AACd,eAAK,OAAO,MAAM,sCAAsCA,CAAG,GAC3DF,EAAOE,CAAG;AAAA,QACZ,CAAC,IAEHH,EAAA;AAAA,MAEJ,SAASG,GAAK;AACZ,aAAK,OAAO,MAAM,+BAA+BA,CAAG,GACpDF,EAAOE,CAAG;AAAA,MACZ;AAEA,MAAAJ,EAAQ,KAAK,MAAM;AACjB,aAAK,OAAO,MAAM,SAAS;AAAA,MAC7B,CAAC,GACDA,EAAQ,MAAM,CAACK,MAAM;AACnB,aAAK,OAAO,MAAM,gBAAgBA,CAAC,GACnC,KAAK,IAAI,MAAM,QAAA;AAAA,MACjB,CAAC;AAAA,IACH,CAAC,GACD,KAAK,IAAI,KAAK,WAAW,MAAM;AAC7B,WAAK,gBAAgB,QAAQ,CAACC,MAAOA,EAAG,KAAK,GAAG,CAAC,GACjD,KAAK,KAAA,GACL,KAAK,OAAO,MAAM,UAAU;AAAA,IAC9B,CAAC;AAAA,EACH;AAAA,EApDAC;AAAA,EAIA,OAAA;AAAA,SAAO,SAAkB,CAAA;AAAA,EAAC;AAAA,EAE1B,OAAA;AAAA,SAAO,WAAW;AAAA,EAAA;AAAA,EAgDR,QAA8B;AAAA,EAAC;AAAA,EAC/B,OAA6B;AAAA,EAAC;AAAA,EAC9B,kBAAkBD,GAA0B;AACpD,SAAK,gBAAgB,KAAKA,CAAE;AAAA,EAC9B;AAAA,EACU,qBAAqBA,GAA0B;AACvD,SAAK,kBAAkB,KAAK,gBAAgB,OAAO,CAACE,MAAMA,MAAMF,CAAE;AAAA,EACpE;AAAA,EAEA,IAAI,KAAKP,GAAc;AACrB,SAAKQ,KAAQE,EAAUV,CAAI,EAAE,YAAA;AAAA,EAC/B;AAAA,EACA,IAAI,OAAe;AACjB,WAAO,KAAKQ;AAAA,EACd;AAAA,EAEA,IAAI,SAAiB;AACnB,WAAO,KAAK,IAAI,OAAO,KAAK,IAAI;AAAA,EAClC;AACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"IconQuickEdit-CMCQncyj.js","sources":["../src/components/Icon/IconQuickEdit.tsx"],"sourcesContent":["import { SVGProps } from 'jsx-dom'\r\n\r\nexport const IconQuickEdit = (props: SVGProps<SVGSVGElement>) => (\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"24\"\r\n height=\"24\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n {...props}\r\n class={`icon icon-tabler icons-tabler-outline icon-tabler-pencil-bolt ${props.className || ''}`}\r\n >\r\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\r\n <path d=\"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4\" />\r\n <path d=\"M13.5 6.5l4 4\" />\r\n <path d=\"M19 16l-2 3h4l-2 3\" />\r\n </svg>\r\n)\r\n"],"names":["IconQuickEdit","props","jsxs","jsx"],"mappings":";AAEO,MAAMA,IAAgB,CAACC,MAC5BC,gBAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,gBAAa;AAAA,IACb,kBAAe;AAAA,IACf,mBAAgB;AAAA,IACf,GAAGD;AAAA,IACJ,OAAO,iEAAiEA,EAAM,aAAa,EAAE;AAAA,IAE7F,UAAA;AAAA,MAAA,gBAAAE,EAAC,UAAK,QAAO,QAAO,GAAE,iBAAgB,MAAK,QAAO;AAAA,MAClD,gBAAAA,EAAC,QAAA,EAAK,GAAE,0DAAA,CAA0D;AAAA,MAClE,gBAAAA,EAAC,QAAA,EAAK,GAAE,gBAAA,CAAgB;AAAA,MACxB,gBAAAA,EAAC,QAAA,EAAK,GAAE,qBAAA,CAAqB;AAAA,IAAA;AAAA,EAAA;AAC/B;"}
1
+ {"version":3,"file":"IconQuickEdit-CMCQncyj.js","sources":["../src/components/Icon/IconQuickEdit.tsx"],"sourcesContent":["import { SVGProps } from 'jsx-dom'\n\nexport const IconQuickEdit = (props: SVGProps<SVGSVGElement>) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n {...props}\n class={`icon icon-tabler icons-tabler-outline icon-tabler-pencil-bolt ${props.className || ''}`}\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4\" />\n <path d=\"M13.5 6.5l4 4\" />\n <path d=\"M19 16l-2 3h4l-2 3\" />\n </svg>\n)\n"],"names":["IconQuickEdit","props","jsxs","jsx"],"mappings":";AAEO,MAAMA,IAAgB,CAACC,MAC5BC,gBAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,gBAAa;AAAA,IACb,kBAAe;AAAA,IACf,mBAAgB;AAAA,IACf,GAAGD;AAAA,IACJ,OAAO,iEAAiEA,EAAM,aAAa,EAAE;AAAA,IAE7F,UAAA;AAAA,MAAA,gBAAAE,EAAC,UAAK,QAAO,QAAO,GAAE,iBAAgB,MAAK,QAAO;AAAA,MAClD,gBAAAA,EAAC,QAAA,EAAK,GAAE,0DAAA,CAA0D;AAAA,MAClE,gBAAAA,EAAC,QAAA,EAAK,GAAE,gBAAA,CAAgB;AAAA,MACxB,gBAAAA,EAAC,QAAA,EAAK,GAAE,qBAAA,CAAqB;AAAA,IAAA;AAAA,EAAA;AAC/B;"}
@@ -1 +1 @@
1
- {"version":3,"file":"InputBox-nQKtiWtZ.js","sources":["../src/components/CheckBox.tsx","../src/components/InputBox.tsx"],"sourcesContent":["import { JSX } from 'jsx-dom'\n\nexport type CheckBoxProps = {\n id?: string\n name: string\n label?: string | HTMLElement\n checked?: boolean\n inputProps?: JSX.IntrinsicElements['input']\n labelProps?: JSX.IntrinsicElements['span']\n} & JSX.IntrinsicElements['label']\n\nexport const CheckBox = (props: CheckBoxProps) => {\n const { id, name, label, checked, inputProps, labelProps, children, ...rest } = props\n return (\n <label className=\"theme-ipe ipe-checkbox\" {...rest}>\n <input type=\"checkbox\" id={id} name={name} checked={checked} {...inputProps} />\n <span className=\"ipe-checkbox-box\"></span>\n <span {...labelProps}>{label || children}</span>\n </label>\n )\n}\n","import { JSX } from 'jsx-dom'\r\n\r\nexport type InputBoxProps = {\r\n label: string\r\n id?: string\r\n name: string\r\n value?: string\r\n disabled?: boolean\r\n labelProps?: JSX.IntrinsicElements['label']\r\n inputProps?: JSX.IntrinsicElements['input']\r\n} & JSX.IntrinsicElements['div']\r\n\r\nexport const InputBox = (props: InputBoxProps) => {\r\n const { label, id, name, value, disabled, labelProps, inputProps, ...rest } = props\r\n return (\r\n <div className=\"theme-ipe ipe-input-box\" {...rest}>\r\n <label htmlFor={id} style={{ display: 'block' }} {...labelProps}>\r\n {label}\r\n </label>\r\n <input\r\n id={id}\r\n name={name}\r\n value={value}\r\n disabled={disabled}\r\n style={{ width: '100%' }}\r\n {...inputProps}\r\n />\r\n </div>\r\n )\r\n}\r\n"],"names":["CheckBox","props","id","name","label","checked","inputProps","labelProps","children","rest","jsxs","jsx","InputBox","value","disabled"],"mappings":";AAWO,MAAMA,IAAW,CAACC,MAAyB;AAChD,QAAM,EAAE,IAAAC,GAAI,MAAAC,GAAM,OAAAC,GAAO,SAAAC,GAAS,YAAAC,GAAY,YAAAC,GAAY,UAAAC,GAAU,GAAGC,EAAA,IAASR;AAChF,SACES,gBAAAA,EAAC,SAAA,EAAM,WAAU,0BAA0B,GAAGD,GAC5C,UAAA;AAAA,IAAA,gBAAAE,EAAC,WAAM,MAAK,YAAW,IAAAT,GAAQ,MAAAC,GAAY,SAAAE,GAAmB,GAAGC,GAAY;AAAA,IAC7E,gBAAAK,EAAC,QAAA,EAAK,WAAU,mBAAA,CAAmB;AAAA,IACnC,gBAAAA,EAAC,QAAA,EAAM,GAAGJ,GAAa,eAASC,EAAA,CAAS;AAAA,EAAA,GAC3C;AAEJ,GCRaI,IAAW,CAACX,MAAyB;AAChD,QAAM,EAAE,OAAAG,GAAO,IAAAF,GAAI,MAAAC,GAAM,OAAAU,GAAO,UAAAC,GAAU,YAAAP,GAAY,YAAAD,GAAY,GAAGG,EAAA,IAASR;AAC9E,SACES,gBAAAA,EAAC,OAAA,EAAI,WAAU,2BAA2B,GAAGD,GAC3C,UAAA;AAAA,IAAA,gBAAAE,EAAC,SAAA,EAAM,SAAST,GAAI,OAAO,EAAE,SAAS,QAAA,GAAY,GAAGK,GAClD,UAAAH,EAAA,CACH;AAAA,IACA,gBAAAO;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAAT;AAAA,QACA,MAAAC;AAAA,QACA,OAAAU;AAAA,QACA,UAAAC;AAAA,QACA,OAAO,EAAE,OAAO,OAAA;AAAA,QACf,GAAGR;AAAA,MAAA;AAAA,IAAA;AAAA,EACN,GACF;AAEJ;"}
1
+ {"version":3,"file":"InputBox-nQKtiWtZ.js","sources":["../src/components/CheckBox.tsx","../src/components/InputBox.tsx"],"sourcesContent":["import { JSX } from 'jsx-dom'\n\nexport type CheckBoxProps = {\n id?: string\n name: string\n label?: string | HTMLElement\n checked?: boolean\n inputProps?: JSX.IntrinsicElements['input']\n labelProps?: JSX.IntrinsicElements['span']\n} & JSX.IntrinsicElements['label']\n\nexport const CheckBox = (props: CheckBoxProps) => {\n const { id, name, label, checked, inputProps, labelProps, children, ...rest } = props\n return (\n <label className=\"theme-ipe ipe-checkbox\" {...rest}>\n <input type=\"checkbox\" id={id} name={name} checked={checked} {...inputProps} />\n <span className=\"ipe-checkbox-box\"></span>\n <span {...labelProps}>{label || children}</span>\n </label>\n )\n}\n","import { JSX } from 'jsx-dom'\n\nexport type InputBoxProps = {\n label: string\n id?: string\n name: string\n value?: string\n disabled?: boolean\n labelProps?: JSX.IntrinsicElements['label']\n inputProps?: JSX.IntrinsicElements['input']\n} & JSX.IntrinsicElements['div']\n\nexport const InputBox = (props: InputBoxProps) => {\n const { label, id, name, value, disabled, labelProps, inputProps, ...rest } = props\n return (\n <div className=\"theme-ipe ipe-input-box\" {...rest}>\n <label htmlFor={id} style={{ display: 'block' }} {...labelProps}>\n {label}\n </label>\n <input\n id={id}\n name={name}\n value={value}\n disabled={disabled}\n style={{ width: '100%' }}\n {...inputProps}\n />\n </div>\n )\n}\n"],"names":["CheckBox","props","id","name","label","checked","inputProps","labelProps","children","rest","jsxs","jsx","InputBox","value","disabled"],"mappings":";AAWO,MAAMA,IAAW,CAACC,MAAyB;AAChD,QAAM,EAAE,IAAAC,GAAI,MAAAC,GAAM,OAAAC,GAAO,SAAAC,GAAS,YAAAC,GAAY,YAAAC,GAAY,UAAAC,GAAU,GAAGC,EAAA,IAASR;AAChF,SACES,gBAAAA,EAAC,SAAA,EAAM,WAAU,0BAA0B,GAAGD,GAC5C,UAAA;AAAA,IAAA,gBAAAE,EAAC,WAAM,MAAK,YAAW,IAAAT,GAAQ,MAAAC,GAAY,SAAAE,GAAmB,GAAGC,GAAY;AAAA,IAC7E,gBAAAK,EAAC,QAAA,EAAK,WAAU,mBAAA,CAAmB;AAAA,IACnC,gBAAAA,EAAC,QAAA,EAAM,GAAGJ,GAAa,eAASC,EAAA,CAAS;AAAA,EAAA,GAC3C;AAEJ,GCRaI,IAAW,CAACX,MAAyB;AAChD,QAAM,EAAE,OAAAG,GAAO,IAAAF,GAAI,MAAAC,GAAM,OAAAU,GAAO,UAAAC,GAAU,YAAAP,GAAY,YAAAD,GAAY,GAAGG,EAAA,IAASR;AAC9E,SACES,gBAAAA,EAAC,OAAA,EAAI,WAAU,2BAA2B,GAAGD,GAC3C,UAAA;AAAA,IAAA,gBAAAE,EAAC,SAAA,EAAM,SAAST,GAAI,OAAO,EAAE,SAAS,QAAA,GAAY,GAAGK,GAClD,UAAAH,EAAA,CACH;AAAA,IACA,gBAAAO;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAAT;AAAA,QACA,MAAAC;AAAA,QACA,OAAAU;AAAA,QACA,UAAAC;AAAA,QACA,OAAO,EAAE,OAAO,OAAA;AAAA,QACf,GAAGR;AAAA,MAAA;AAAA,IAAA;AAAA,EACN,GACF;AAEJ;"}
@@ -1,63 +1,63 @@
1
1
  import { j as r } from "./index-CM_6yF2v.js";
2
2
  import { W as k } from "./WatchlistAction-BbNAyryN.js";
3
- import { B as I } from "./BasePlugin-Bf2UuIHF.js";
4
- import { A as p } from "./ActionButton-CRjo_l3y.js";
5
- import { I as U } from "./endpoints-DgyuoRZd.js";
6
- var L = Object.create, m = Object.defineProperty, C = Object.getOwnPropertyDescriptor, v = (a, e) => (e = Symbol[a]) ? e : Symbol.for("Symbol." + a), x = (a) => {
7
- throw TypeError(a);
8
- }, E = (a, e, n) => e in a ? m(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n, F = (a, e) => m(a, "name", { value: e, configurable: !0 }), T = (a) => [, , , L(a?.[v("metadata")] ?? null)], j = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], S = (a) => a !== void 0 && typeof a != "function" ? x("Function expected") : a, M = (a, e, n, o, t) => ({ kind: j[a], name: e, metadata: o, addInitializer: (i) => n._ ? x("Already initialized") : t.push(S(i || null)) }), D = (a, e) => E(e, v("metadata"), a[3]), O = (a, e, n, o) => {
9
- for (var t = 0, i = a[e >> 1], s = i && i.length; t < s; t++) i[t].call(n);
10
- return o;
11
- }, R = (a, e, n, o, t, i) => {
12
- var s, l, c, d = e & 7, f = !1, w = 0, P = a[w] || (a[w] = []), h = d && (t = t.prototype, d < 5 && (d > 3 || !f) && C(t, n));
13
- F(t, n);
14
- for (var u = o.length - 1; u >= 0; u--)
15
- c = M(d, n, l = {}, a[3], P), s = (0, o[u])(t, c), l._ = 1, S(s) && (t = s);
16
- return D(a, t), h && m(t, n, h), f ? d ^ 4 ? i : h : t;
3
+ import { B as I } from "./BasePlugin-YOi2_vUo.js";
4
+ import { A as f } from "./ActionButton-CRjo_l3y.js";
5
+ import { I as U } from "./Preferences-BF2fcXrn.js";
6
+ var L = Object.create, w = Object.defineProperty, C = Object.getOwnPropertyDescriptor, v = (i, e) => (e = Symbol[i]) ? e : Symbol.for("Symbol." + i), x = (i) => {
7
+ throw TypeError(i);
8
+ }, E = (i, e, t) => e in i ? w(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, F = (i, e) => w(i, "name", { value: e, configurable: !0 }), T = (i) => [, , , L(i?.[v("metadata")] ?? null)], j = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], S = (i) => i !== void 0 && typeof i != "function" ? x("Function expected") : i, M = (i, e, t, s, n) => ({ kind: j[i], name: e, metadata: s, addInitializer: (o) => t._ ? x("Already initialized") : n.push(S(o || null)) }), D = (i, e) => E(e, v("metadata"), i[3]), O = (i, e, t, s) => {
9
+ for (var n = 0, o = i[e >> 1], a = o && o.length; n < a; n++) o[n].call(t);
10
+ return s;
11
+ }, R = (i, e, t, s, n, o) => {
12
+ var a, l, d, c = e & 7, p = !1, h = 0, P = i[h] || (i[h] = []), u = c && (n = n.prototype, c < 5 && (c > 3 || !p) && C(n, t));
13
+ F(n, t);
14
+ for (var g = s.length - 1; g >= 0; g--)
15
+ d = M(c, t, l = {}, i[3], P), a = (0, s[g])(n, d), l._ = 1, S(a) && (n = a);
16
+ return D(i, n), u && w(n, t, u), p ? c ^ 4 ? o : u : n;
17
17
  }, b, y, _;
18
- b = [U(["preferences", "wikiPage", "wikiTitle", "modal", "preferencesUI"])];
19
- class g extends (_ = I) {
18
+ b = [U(["preferences", "wiki", "wikiPage", "wikiTitle", "modal", "preferencesUI", "$"])];
19
+ class m extends (_ = I) {
20
20
  constructor(e) {
21
21
  super(e, {}, "pref-sync"), this.ctx = e, e.set("prefSync", this);
22
22
  }
23
23
  start() {
24
- const e = this.ctx;
24
+ const e = this.ctx, t = e.$;
25
25
  e.preferences.defineCategory({
26
26
  name: "pref-sync",
27
- label: "Sync",
28
- description: "Import and export preferences",
27
+ label: t`Sync`,
28
+ description: t`Import and export preferences`,
29
29
  index: 98,
30
30
  customRenderer: () => {
31
- const n = this.getUserPrefsPageTitle();
31
+ const s = this.getUserPrefsPageTitle();
32
32
  return /* @__PURE__ */ r("div", { className: "theme-ipe-prose", children: [
33
- n && /* @__PURE__ */ r("section", { children: [
34
- /* @__PURE__ */ r("h3", { children: "Backup your preferences via user page" }),
35
- /* @__PURE__ */ r("p", { children: /* @__PURE__ */ r("a", { href: n?.getURL().toString(), target: "_blank", children: [
36
- n?.getPrefixedText(),
33
+ s && /* @__PURE__ */ r("section", { children: [
34
+ /* @__PURE__ */ r("h3", { children: t`Backup your preferences via user page` }),
35
+ /* @__PURE__ */ r("p", { children: /* @__PURE__ */ r("a", { href: s?.getURL().toString(), target: "_blank", children: [
36
+ s?.getPrefixedText(),
37
37
  " →"
38
38
  ] }) }),
39
39
  /* @__PURE__ */ r("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
40
40
  /* @__PURE__ */ r(
41
- p,
41
+ f,
42
42
  {
43
43
  type: "primary",
44
- onClick: (o) => {
45
- o.preventDefault();
46
- const t = o.target;
47
- t.disabled = !0;
48
- const i = e.preferencesUI.getCurrentModal();
49
- i?.setLoadingState(!0), this.exportToUserPage().then((s) => {
44
+ onClick: (n) => {
45
+ n.preventDefault();
46
+ const o = n.target;
47
+ o.disabled = !0;
48
+ const a = e.preferencesUI.getCurrentModal();
49
+ a?.setLoadingState(!0), this.exportToUserPage().then((l) => {
50
50
  e.modal.notify("success", {
51
- title: "Preferences Exported",
51
+ title: t`Preferences Exported`,
52
52
  content: /* @__PURE__ */ r("p", { children: [
53
53
  "Your preferences have been exported to",
54
54
  " ",
55
- /* @__PURE__ */ r("a", { href: s.getURL().toString(), target: "_blank", children: s.getPrefixedText() }),
55
+ /* @__PURE__ */ r("a", { href: l.getURL().toString(), target: "_blank", children: l.getPrefixedText() }),
56
56
  "."
57
57
  ] })
58
58
  });
59
59
  }).finally(() => {
60
- t.disabled = !1, i?.setLoadingState(!1);
60
+ o.disabled = !1, a?.setLoadingState(!1);
61
61
  });
62
62
  },
63
63
  children: [
@@ -83,20 +83,20 @@ class g extends (_ = I) {
83
83
  }
84
84
  ),
85
85
  " ",
86
- "Backup"
86
+ t`Backup`
87
87
  ]
88
88
  }
89
89
  ),
90
90
  /* @__PURE__ */ r(
91
- p,
91
+ f,
92
92
  {
93
- onClick: (o) => {
94
- o.preventDefault();
95
- const t = e.preferencesUI.getCurrentModal(), i = o.target;
96
- i.disabled = !0, t?.setLoadingState(!0), this.importFromUserPage().then((s) => {
97
- this.notifyImportSuccess(s);
93
+ onClick: (n) => {
94
+ n.preventDefault();
95
+ const o = e.preferencesUI.getCurrentModal(), a = n.target;
96
+ a.disabled = !0, o?.setLoadingState(!0), this.importFromUserPage().then((l) => {
97
+ this.notifyImportSuccess(l);
98
98
  }).finally(() => {
99
- i.disabled = !1, t?.setLoadingState(!1);
99
+ a.disabled = !1, o?.setLoadingState(!1);
100
100
  });
101
101
  },
102
102
  children: [
@@ -122,69 +122,69 @@ class g extends (_ = I) {
122
122
  }
123
123
  ),
124
124
  " ",
125
- "Restore"
125
+ t`Restore`
126
126
  ]
127
127
  }
128
128
  )
129
129
  ] })
130
130
  ] }),
131
131
  /* @__PURE__ */ r("section", { children: [
132
- /* @__PURE__ */ r("h3", { children: "Import and export preferences" }),
132
+ /* @__PURE__ */ r("h3", { children: t`Import and export preferences` }),
133
133
  /* @__PURE__ */ r("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
134
134
  /* @__PURE__ */ r(
135
- p,
135
+ f,
136
136
  {
137
- onClick: (o) => {
138
- o.preventDefault();
139
- const t = e.preferencesUI.getCurrentModal();
140
- t?.setLoadingState(!0);
141
- const i = document.createElement("input");
142
- i.type = "file", i.accept = "application/json";
143
- let s = !1;
144
- const l = () => {
145
- s || t?.setLoadingState(!1), window.removeEventListener("focus", l);
137
+ onClick: (n) => {
138
+ n.preventDefault();
139
+ const o = e.preferencesUI.getCurrentModal();
140
+ o?.setLoadingState(!0);
141
+ const a = document.createElement("input");
142
+ a.type = "file", a.accept = "application/json";
143
+ let l = !1;
144
+ const d = () => {
145
+ l || o?.setLoadingState(!1), window.removeEventListener("focus", d);
146
146
  };
147
- window.addEventListener("focus", l, { once: !0 }), i.addEventListener("change", async (c) => {
148
- s = !0;
147
+ window.addEventListener("focus", d, { once: !0 }), a.addEventListener("change", async (c) => {
148
+ l = !0;
149
149
  try {
150
- const d = c.target.files?.[0];
151
- if (!d)
150
+ const p = c.target.files?.[0];
151
+ if (!p)
152
152
  return;
153
- const f = await this.importFromFile(d);
154
- this.notifyImportSuccess(f);
155
- } catch (d) {
153
+ const h = await this.importFromFile(p);
154
+ this.notifyImportSuccess(h);
155
+ } catch (p) {
156
156
  e.modal.notify("error", {
157
157
  title: "Import failed",
158
- content: d instanceof Error ? d.message : String(d)
158
+ content: p instanceof Error ? p.message : String(p)
159
159
  });
160
160
  } finally {
161
- t?.setLoadingState(!1);
161
+ o?.setLoadingState(!1);
162
162
  }
163
- }), i.click();
163
+ }), a.click();
164
164
  },
165
- children: "Import from file"
165
+ children: t`Import from file`
166
166
  }
167
167
  ),
168
168
  /* @__PURE__ */ r(
169
- p,
169
+ f,
170
170
  {
171
- onClick: (o) => {
172
- o.preventDefault();
173
- const t = /* @__PURE__ */ r("input", { type: "url" }), i = e.preferencesUI.getCurrentModal();
171
+ onClick: (n) => {
172
+ n.preventDefault();
173
+ const o = /* @__PURE__ */ r("input", { type: "url", style: { width: "100%" } }), a = e.preferencesUI.getCurrentModal();
174
174
  e.modal.confirm(
175
175
  {
176
- title: "Import Preferences from URL",
177
- content: /* @__PURE__ */ r("div", { children: [
178
- /* @__PURE__ */ r("label", { htmlFor: "url-input", children: "Enter the URL of the preferences JSON file:" }),
179
- t
176
+ title: t`Import from URL`,
177
+ content: /* @__PURE__ */ r("div", { className: "ipe-input-box", children: [
178
+ /* @__PURE__ */ r("label", { htmlFor: "url-input", children: t`Enter the URL of the preferences JSON file:` }),
179
+ o
180
180
  ] })
181
181
  },
182
- async (s) => {
183
- const l = t.value.trim();
184
- if (!(!s || !l))
182
+ async (l) => {
183
+ const d = o.value.trim();
184
+ if (!(!l || !d))
185
185
  try {
186
- i?.setLoadingState(!0);
187
- const c = await this.importFromUrl(l);
186
+ a?.setLoadingState(!0);
187
+ const c = await this.importFromUrl(d);
188
188
  this.notifyImportSuccess(c);
189
189
  } catch (c) {
190
190
  e.modal.notify("error", {
@@ -192,32 +192,32 @@ class g extends (_ = I) {
192
192
  content: c instanceof Error ? c.message : String(c)
193
193
  });
194
194
  } finally {
195
- i?.setLoadingState(!1);
195
+ a?.setLoadingState(!1);
196
196
  }
197
197
  }
198
198
  );
199
199
  },
200
- children: "Import from URL"
200
+ children: t`Import from URL`
201
201
  }
202
202
  ),
203
203
  /* @__PURE__ */ r(
204
- p,
204
+ f,
205
205
  {
206
- onClick: async (o) => {
207
- o.preventDefault(), await e.preferencesUI.dispatchFormSave();
208
- const t = await e.preferences.getExportableRecord(), i = JSON.stringify(t, null, 2);
206
+ onClick: async (n) => {
207
+ n.preventDefault(), await e.preferencesUI.dispatchFormSave();
208
+ const o = await e.preferences.getExportableRecord(), a = JSON.stringify(o, null, 2);
209
209
  e.modal.dialog(
210
210
  {
211
- title: "Save to file",
211
+ title: t`Save to file`,
212
212
  content: /* @__PURE__ */ r("div", { children: [
213
- /* @__PURE__ */ r("label", { htmlFor: "data", children: "Your InPageEdit preferences:" }),
213
+ /* @__PURE__ */ r("label", { htmlFor: "data", children: t`Your InPageEdit preferences:` }),
214
214
  /* @__PURE__ */ r(
215
215
  "textarea",
216
216
  {
217
217
  name: "data",
218
218
  id: "data",
219
219
  rows: 10,
220
- value: i,
220
+ value: a,
221
221
  readOnly: !0,
222
222
  style: { width: "100%" }
223
223
  }
@@ -226,17 +226,17 @@ class g extends (_ = I) {
226
226
  buttons: [
227
227
  {
228
228
  label: "Copy",
229
- method: (s, l) => {
230
- navigator.clipboard.writeText(i), e.modal.notify("success", {
231
- content: "Copied to clipboard"
232
- }), l.close();
229
+ method: (l, d) => {
230
+ navigator.clipboard.writeText(a), e.modal.notify("success", {
231
+ content: t`Copied to clipboard`
232
+ }), d.close();
233
233
  }
234
234
  },
235
235
  {
236
- label: "Download",
237
- method: (s, l) => {
236
+ label: t`Download`,
237
+ method: (l, d) => {
238
238
  const c = document.createElement("a");
239
- c.href = `data:text/json;charset=utf-8,${encodeURIComponent(i)}`, c.download = `ipe-prefs-${(/* @__PURE__ */ new Date()).toISOString()}.json`, c.click(), l.close();
239
+ c.href = `data:text/json;charset=utf-8,${encodeURIComponent(a)}`, c.download = `ipe-prefs-${(/* @__PURE__ */ new Date()).toISOString()}.json`, c.click(), d.close();
240
240
  }
241
241
  }
242
242
  ]
@@ -245,7 +245,7 @@ class g extends (_ = I) {
245
245
  }
246
246
  );
247
247
  },
248
- children: "Save as file"
248
+ children: t`Save as file`
249
249
  }
250
250
  )
251
251
  ] })
@@ -275,67 +275,63 @@ class g extends (_ = I) {
275
275
  if (!e)
276
276
  return this.logger.debug("Cannot get user page title, skipping load"), {};
277
277
  try {
278
- const n = e.getURL({ action: "raw", ctype: "application/json" }), o = await this.importFromUrl(n.toString());
279
- return this.logger.info("Loaded preferences from user page:", e), o;
280
- } catch (n) {
281
- return this.logger.error("Failed to load preferences from user page:", n), {};
278
+ const t = e.getURL({ action: "raw", ctype: "application/json" }), s = await this.importFromUrl(t.toString());
279
+ return this.logger.info("Loaded preferences from user page:", e), s;
280
+ } catch (t) {
281
+ return this.logger.error("Failed to load preferences from user page:", t), {};
282
282
  }
283
283
  }
284
284
  /**
285
285
  * 导出配置到用户页
286
286
  */
287
287
  async exportToUserPage() {
288
- const e = this.ctx, n = this.getUserPrefsPageTitle();
289
- if (!n)
288
+ const e = this.ctx, t = this.getUserPrefsPageTitle();
289
+ if (!t)
290
290
  throw new Error("Cannot get user page title");
291
291
  await e.preferencesUI.dispatchFormSave();
292
- const o = await e.preferences.getExportableRecord(), t = JSON.stringify(o, null, 2);
292
+ const s = await e.preferences.getExportableRecord(), n = JSON.stringify(s, null, 2);
293
293
  try {
294
294
  return await this.ctx.wikiPage.newBlankPage({
295
- title: n.toString(),
295
+ title: t.toString(),
296
296
  ns: 2
297
297
  // User namespace
298
298
  }).edit({
299
- text: t,
299
+ text: n,
300
300
  summary: "Update InPageEdit preferences",
301
301
  watchlist: k.nochange
302
- }), this.logger.info("Exported preferences to user page:", n), n;
303
- } catch (i) {
304
- throw this.logger.error("Failed to export preferences to user page:", i), i;
302
+ }), this.logger.info("Exported preferences to user page:", t), t;
303
+ } catch (o) {
304
+ throw this.logger.error("Failed to export preferences to user page:", o), o;
305
305
  }
306
306
  }
307
307
  async importFromUrl(e) {
308
- const n = await fetch(e);
309
- if (!n.ok)
310
- throw new Error(`HTTP ${n.status}: ${n.statusText}`);
311
- const o = await n.blob();
312
- return await this.importFromFile(o);
308
+ const t = await fetch(e);
309
+ if (!t.ok)
310
+ throw new Error(`HTTP ${t.status}: ${t.statusText}`);
311
+ const s = await t.blob();
312
+ return await this.importFromFile(s);
313
313
  }
314
314
  async importFromFile(e) {
315
- const n = await e.text(), o = JSON.parse(n);
316
- return await this.ctx.preferences.setMany(o);
315
+ const t = await e.text(), s = JSON.parse(t);
316
+ return await this.ctx.preferences.setMany(s);
317
317
  }
318
318
  notifyImportSuccess(e) {
319
- const n = Object.keys(e ?? {}), o = n.length;
319
+ const t = this.ctx.$, s = Object.keys(e ?? {}), n = s.length;
320
320
  return this.ctx.modal.notify("success", {
321
- title: "Preferences Imported",
321
+ title: t`Preferences Imported`,
322
322
  content: /* @__PURE__ */ r("section", { children: [
323
- /* @__PURE__ */ r("p", { children: [
324
- "Successfully imported ",
325
- o || "",
326
- " ",
327
- o !== 1 ? "settings" : "setting",
328
- ":"
329
- ] }),
330
- /* @__PURE__ */ r("ol", { style: { listStyle: "auto", paddingLeft: "1em" }, children: n.map((t) => /* @__PURE__ */ r("li", { children: t }, t)) })
323
+ /* @__PURE__ */ r("p", { children: t({
324
+ count: n
325
+ })`Successfully imported {{ count }} {{ count > 1 ? "settings" : "setting" }}:` }),
326
+ /* @__PURE__ */ r("ol", { style: { listStyle: "auto", paddingLeft: "1em" }, children: s.map((o) => /* @__PURE__ */ r("li", { children: o }, o)) })
331
327
  ] })
332
328
  });
333
329
  }
334
330
  }
335
331
  y = T(_);
336
- g = R(y, 0, "PluginPrefSync", b, g);
337
- O(y, 1, g);
332
+ m = R(y, 0, "PluginPrefSync", b, m);
333
+ O(y, 1, m);
338
334
  export {
339
- g as PluginPrefSync
335
+ m as PluginPrefSync
340
336
  };
341
- //# sourceMappingURL=PluginPrefSync-Dn1Xsiqz.js.map
337
+ //# sourceMappingURL=PluginPrefSync-jTNlRQE-.js.map