@inpageedit/core 0.1.1 → 0.3.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 (67) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +55 -55
  3. package/dist/ActionButton-ByMKIthQ.js +24 -0
  4. package/dist/ActionButton-ByMKIthQ.js.map +1 -0
  5. package/dist/InPageEdit.d.ts +7 -2
  6. package/dist/{CheckBox-ROZZIK-t.js → InputBox-FIzJ-rPN.js} +11 -11
  7. package/dist/InputBox-FIzJ-rPN.js.map +1 -0
  8. package/dist/Preferences-Bg3J5Ur9.js.map +1 -1
  9. package/dist/{RadioBox-Bt5tAniV.js → RadioBox-BZFhTEo5.js} +2 -2
  10. package/dist/RadioBox-BZFhTEo5.js.map +1 -0
  11. package/dist/components/ActionButton.d.ts +6 -9
  12. package/dist/components/SchemaForm/index.d.ts +142 -0
  13. package/dist/components/index.d.ts +8 -0
  14. package/dist/components/index.js +79 -0
  15. package/dist/components/index.js.map +1 -0
  16. package/dist/{index-M4USLRId.js → index-BByzm2Fz.js} +169 -167
  17. package/dist/index-BByzm2Fz.js.map +1 -0
  18. package/dist/{index-BI0z4WfP.js → index-BPsDFq9U.js} +2 -2
  19. package/dist/index-BPsDFq9U.js.map +1 -0
  20. package/dist/{index-Bz9ciRCe.js → index-BsYzf3Yw.js} +9 -8
  21. package/dist/index-BsYzf3Yw.js.map +1 -0
  22. package/dist/{index-DIovbA02.js → index-CMqk2ovP.js} +14 -14
  23. package/dist/index-CMqk2ovP.js.map +1 -0
  24. package/dist/{index-DPXRKwGM.js → index-Ch5DJDZZ.js} +20 -19
  25. package/dist/index-Ch5DJDZZ.js.map +1 -0
  26. package/dist/index-Cq1Q9Xau.js +4635 -0
  27. package/dist/index-Cq1Q9Xau.js.map +1 -0
  28. package/dist/{index-01GVXg9H.js → index-Cq9xxVsu.js} +20 -30
  29. package/dist/index-Cq9xxVsu.js.map +1 -0
  30. package/dist/index-CvhkVj_L.js +361 -0
  31. package/dist/index-CvhkVj_L.js.map +1 -0
  32. package/dist/{index-jJ3Ut97G.js → index-HyxA2rYz.js} +20 -19
  33. package/dist/index-HyxA2rYz.js.map +1 -0
  34. package/dist/{index-BY3hO6sZ.js → index-X1X416tZ.js} +36 -34
  35. package/dist/index-X1X416tZ.js.map +1 -0
  36. package/dist/index.d.ts +16 -1
  37. package/dist/index.js +5187 -5
  38. package/dist/index.js.map +1 -1
  39. package/dist/plugins/BasePlugin.d.ts +2 -2
  40. package/dist/plugins/preferences/{PluginPreferencesUI.d.ts → ui/index.d.ts} +3 -2
  41. package/dist/sleep-DpyIipK-.js.map +1 -1
  42. package/dist/style.css +1 -1
  43. package/dist/{plugins/preferences/components/hooks.d.ts → utils/vueHooks.d.ts} +1 -1
  44. package/lib/index.umd.js +57 -2620
  45. package/lib/index.umd.js.map +1 -0
  46. package/lib/style.css +1 -1
  47. package/package.json +42 -4
  48. package/dist/ActionButton-B9JniHy6.js +0 -33
  49. package/dist/ActionButton-B9JniHy6.js.map +0 -1
  50. package/dist/CheckBox-ROZZIK-t.js.map +0 -1
  51. package/dist/PluginPreferencesUI-7u9JClgy.js +0 -33921
  52. package/dist/PluginPreferencesUI-7u9JClgy.js.map +0 -1
  53. package/dist/RadioBox-Bt5tAniV.js.map +0 -1
  54. package/dist/i18n/languages.json +0 -1527
  55. package/dist/index-01GVXg9H.js.map +0 -1
  56. package/dist/index-BI0z4WfP.js.map +0 -1
  57. package/dist/index-BY3hO6sZ.js.map +0 -1
  58. package/dist/index-Bz9ciRCe.js.map +0 -1
  59. package/dist/index-CGg-JS5d.js +0 -5466
  60. package/dist/index-CGg-JS5d.js.map +0 -1
  61. package/dist/index-DIovbA02.js.map +0 -1
  62. package/dist/index-DPXRKwGM.js.map +0 -1
  63. package/dist/index-M4USLRId.js.map +0 -1
  64. package/dist/index-jJ3Ut97G.js.map +0 -1
  65. package/dist/utils/schemaValidator.d.ts +0 -12
  66. package/lib/i18n/languages.json +0 -1527
  67. /package/dist/components/TabView/{TabView.d.ts → index.d.ts} +0 -0
@@ -1,16 +1,20 @@
1
- import { B as h, j as e, P as m } from "./index-CGg-JS5d.js";
2
- import { T as u } from "./index-BI0z4WfP.js";
3
- import { I as w, C as g } from "./CheckBox-ROZZIK-t.js";
4
- import { A as f } from "./ActionButton-B9JniHy6.js";
5
- const l = class l extends h {
1
+ import { j as e, P as l } from "./index-CvhkVj_L.js";
2
+ import { BasePlugin as d } from "./index.js";
3
+ import { T as h } from "./index-BPsDFq9U.js";
4
+ import { I as m, C as u } from "./InputBox-FIzJ-rPN.js";
5
+ import { A as g } from "./ActionButton-ByMKIthQ.js";
6
+ class b extends d {
6
7
  constructor(t) {
7
8
  super(t, {}, "quick-redirect"), this.ctx = t;
8
9
  }
10
+ static {
11
+ this.inject = ["api", "wikiPage", "modal"];
12
+ }
9
13
  start() {
10
14
  this.ctx.set("quickRedirect", this.quickRedirect.bind(this)), this.ctx.set("redirectPage", this.redirectPage.bind(this));
11
15
  const t = window.mw?.config.get("wgPageName") || "", r = window.mw?.config.get("wgIsProbablyEditable");
12
- this.ctx.inject(["toolbox"], (o) => {
13
- this.ctx = o, o.toolbox.addButton({
16
+ this.ctx.inject(["toolbox"], (i) => {
17
+ this.ctx = i, i.toolbox.addButton({
14
18
  id: "quick-redirect",
15
19
  icon: /* @__PURE__ */ e(
16
20
  "svg",
@@ -43,8 +47,8 @@ const l = class l extends h {
43
47
  } : {}
44
48
  );
45
49
  }
46
- }), this.addDisposeHandler((i) => {
47
- i.toolbox.removeButton("quick-redirect");
50
+ }), this.addDisposeHandler((o) => {
51
+ o.toolbox.removeButton("quick-redirect");
48
52
  });
49
53
  });
50
54
  }
@@ -53,45 +57,45 @@ const l = class l extends h {
53
57
  quickRedirect(t) {
54
58
  const r = this.ctx.modal.createObject({
55
59
  title: "Quick Redirect",
56
- content: /* @__PURE__ */ e(m, {}),
60
+ content: /* @__PURE__ */ e(l, {}),
57
61
  className: "quick-redirect",
58
62
  sizeClass: "medium",
59
63
  center: !0
60
64
  }).init();
61
- let o = null;
65
+ let i = null;
62
66
  return r.setContent(
63
67
  /* @__PURE__ */ e(
64
68
  "form",
65
69
  {
66
- ref: (i) => o = i,
70
+ ref: (o) => i = o,
67
71
  style: {
68
72
  display: "flex",
69
73
  flexDirection: "column",
70
74
  gap: "1rem"
71
75
  },
72
- onSubmit: (i) => {
73
- i.preventDefault();
74
- const a = new FormData(o), c = {
76
+ onSubmit: (o) => {
77
+ o.preventDefault();
78
+ const a = new FormData(i), c = {
75
79
  from: a.get("from"),
76
80
  to: a.get("to"),
77
81
  reason: a.get("reason") || "",
78
82
  overwrite: a.get("overwrite") === "on"
79
83
  };
80
- r.setLoadingState(!0), this.redirectPage(c).then((s) => {
84
+ r.setLoadingState(!0), this.redirectPage(c).then((n) => {
81
85
  r.close(), this.ctx.modal.notify("success", {
82
86
  title: "Redirect successful",
83
87
  content: "The redirect has been created."
84
88
  });
85
- }).catch((s) => {
89
+ }).catch((n) => {
86
90
  r.setLoadingState(!1), this.ctx.modal.notify("error", {
87
91
  title: "Failed to redirect",
88
- content: s instanceof Error ? s.message : String(s)
92
+ content: n instanceof Error ? n.message : String(n)
89
93
  });
90
94
  });
91
95
  },
92
96
  children: [
93
97
  /* @__PURE__ */ e(
94
- u,
98
+ h,
95
99
  {
96
100
  inputs: [
97
101
  {
@@ -107,34 +111,32 @@ const l = class l extends h {
107
111
  ]
108
112
  }
109
113
  ),
110
- /* @__PURE__ */ e(w, { label: "Reason", id: "reason", name: "reason", value: t?.reason }),
111
- /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(g, { name: "overwrite", id: "overwrite", checked: t?.overwrite, children: "Force create redirect even if the from page already exists" }) }),
112
- /* @__PURE__ */ e(f, { type: "primary", buttonProps: { style: { width: "100%" } }, children: "Create Redirect" })
114
+ /* @__PURE__ */ e(m, { label: "Reason", id: "reason", name: "reason", value: t?.reason }),
115
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(u, { name: "overwrite", id: "overwrite", checked: t?.overwrite, children: "Force create redirect even if the from page already exists" }) }),
116
+ /* @__PURE__ */ e(g, { type: "primary", style: { width: "100%" }, children: "Create Redirect" })
113
117
  ]
114
118
  }
115
119
  )
116
120
  ), r.show();
117
121
  }
118
122
  async redirectPage(t) {
119
- const { from: r, to: o, reason: i = "", overwrite: a = !1 } = t, c = await this.ctx.wikiPage.newBlankPage({
123
+ const { from: r, to: i, reason: o = "", overwrite: a = !1 } = t, c = await this.ctx.wikiPage.newBlankPage({
120
124
  title: r
121
- }), s = `#REDIRECT [[:${o}]]`, n = await c.edit(
125
+ }), n = `#REDIRECT [[:${i}]]`, s = await c.edit(
122
126
  {
123
- text: s,
124
- summary: i
127
+ text: n,
128
+ summary: o
125
129
  },
126
130
  {
127
131
  createonly: !a
128
132
  }
129
133
  );
130
- if (n.data?.errors)
131
- throw new Error(n.data.errors[0].text, { cause: n });
132
- return n;
134
+ if (s.data?.errors)
135
+ throw new Error(s.data.errors[0].text, { cause: s });
136
+ return s;
133
137
  }
134
- };
135
- l.inject = ["api", "wikiPage", "modal"];
136
- let d = l;
138
+ }
137
139
  export {
138
- d as PluginQuickRedirect
140
+ b as PluginQuickRedirect
139
141
  };
140
- //# sourceMappingURL=index-BY3hO6sZ.js.map
142
+ //# sourceMappingURL=index-X1X416tZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-X1X416tZ.js","sources":["../src/plugins/quick-redirect/index.tsx"],"sourcesContent":["import { InPageEdit } from '@/InPageEdit'\r\n\r\ndeclare module '@/InPageEdit' {\r\n interface InPageEdit {\r\n quickRedirect: PluginQuickRedirect['quickRedirect']\r\n redirectPage: PluginQuickRedirect['redirectPage']\r\n }\r\n}\r\n\r\nexport interface RedirectPageOptions {\r\n from: string\r\n to: string\r\n reason?: string\r\n overwrite?: boolean\r\n}\r\nexport interface QuickRedirectOptions extends Partial<RedirectPageOptions> {}\r\n\r\nexport class PluginQuickRedirect extends BasePlugin {\r\n static readonly inject = ['api', 'wikiPage', 'modal']\r\n\r\n constructor(public ctx: InPageEdit) {\r\n super(ctx, {}, 'quick-redirect')\r\n }\r\n\r\n protected start(): Promise<void> | void {\r\n this.ctx.set('quickRedirect', this.quickRedirect.bind(this))\r\n this.ctx.set('redirectPage', this.redirectPage.bind(this))\r\n\r\n const curPageName = window.mw?.config.get('wgPageName') || ''\r\n const canEdit = window.mw?.config.get('wgIsProbablyEditable')\r\n this.ctx.inject(['toolbox'], (ctx) => {\r\n this.ctx = ctx\r\n ctx.toolbox.addButton({\r\n id: 'quick-redirect',\r\n icon: (\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 class=\"icon icon-tabler icons-tabler-outline icon-tabler-file-symlink\"\r\n >\r\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\r\n <path d=\"M4 21v-4a3 3 0 0 1 3 -3h5\" />\r\n <path d=\"M9 17l3 -3l-3 -3\" />\r\n <path d=\"M14 3v4a1 1 0 0 0 1 1h4\" />\r\n <path d=\"M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5\" />\r\n </svg>\r\n ) as HTMLElement,\r\n tooltip: 'Quick Redirect',\r\n group: 'group1',\r\n onClick: () => {\r\n this.quickRedirect(\r\n canEdit\r\n ? {\r\n to: curPageName,\r\n }\r\n : {}\r\n )\r\n },\r\n })\r\n this.addDisposeHandler((ctx) => {\r\n ctx.toolbox.removeButton('quick-redirect')\r\n })\r\n })\r\n }\r\n\r\n protected stop(): Promise<void> | void {}\r\n\r\n quickRedirect(options?: Partial<QuickRedirectOptions>) {\r\n const modal = this.ctx.modal\r\n .createObject({\r\n title: 'Quick Redirect',\r\n content: (<ProgressBar />) as HTMLElement,\r\n className: 'quick-redirect',\r\n sizeClass: 'medium',\r\n center: true,\r\n })\r\n .init()\r\n\r\n let formRef: HTMLFormElement | null = null\r\n modal.setContent(\r\n (\r\n <form\r\n ref={(el) => (formRef = el)}\r\n style={{\r\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: '1rem',\r\n }}\r\n onSubmit={(e) => {\r\n e.preventDefault()\r\n const formData = new FormData(formRef!)\r\n const options = {\r\n from: formData.get('from') as string,\r\n to: formData.get('to') as string,\r\n reason: (formData.get('reason') as string) || '',\r\n overwrite: formData.get('overwrite') === 'on',\r\n }\r\n modal.setLoadingState(true)\r\n this.redirectPage(options)\r\n .then((res) => {\r\n modal.close()\r\n this.ctx.modal.notify('success', {\r\n title: 'Redirect successful',\r\n content: 'The redirect has been created.',\r\n })\r\n })\r\n .catch((error) => {\r\n modal.setLoadingState(false)\r\n this.ctx.modal.notify('error', {\r\n title: 'Failed to redirect',\r\n content: error instanceof Error ? error.message : String(error),\r\n })\r\n })\r\n }}\r\n >\r\n <TwinSwapInput\r\n inputs={[\r\n {\r\n label: 'From',\r\n name: 'from',\r\n value: options?.from,\r\n },\r\n {\r\n label: 'To',\r\n name: 'to',\r\n value: options?.to,\r\n },\r\n ]}\r\n />\r\n <InputBox label=\"Reason\" id=\"reason\" name=\"reason\" value={options?.reason} />\r\n <div>\r\n <CheckBox name=\"overwrite\" id=\"overwrite\" checked={options?.overwrite}>\r\n Force create redirect even if the from page already exists\r\n </CheckBox>\r\n </div>\r\n <ActionButton type=\"primary\" style={{ width: '100%' }}>\r\n Create Redirect\r\n </ActionButton>\r\n </form>\r\n ) as HTMLFormElement\r\n )\r\n\r\n return modal.show()\r\n }\r\n\r\n async redirectPage(options: RedirectPageOptions) {\r\n const { from, to, reason = '', overwrite = false } = options\r\n const wikiPage = await this.ctx.wikiPage.newBlankPage({\r\n title: from,\r\n })\r\n const content = `#REDIRECT [[:${to}]]`\r\n const res = await wikiPage.edit(\r\n {\r\n text: content,\r\n summary: reason,\r\n },\r\n {\r\n createonly: !overwrite,\r\n }\r\n )\r\n if (res.data?.errors) {\r\n throw new Error(res.data.errors[0].text, { cause: res })\r\n }\r\n return res\r\n }\r\n}\r\n"],"names":["PluginQuickRedirect","BasePlugin","ctx","curPageName","canEdit","jsxs","jsx","options","modal","ProgressBar","formRef","el","e","formData","res","error","TwinSwapInput","InputBox","CheckBox","ActionButton","from","to","reason","overwrite","wikiPage","content"],"mappings":";;;;;AAiBO,MAAMA,UAA4BC,EAAW;AAAA,EAGlD,YAAmBC,GAAiB;AAClC,UAAMA,GAAK,CAAA,GAAI,gBAAgB,GADd,KAAA,MAAAA;AAAA,EAEnB;AAAA,EAJA,OAAA;AAAA,SAAgB,SAAS,CAAC,OAAO,YAAY,OAAO;AAAA,EAAA;AAAA,EAM1C,QAA8B;AACtC,SAAK,IAAI,IAAI,iBAAiB,KAAK,cAAc,KAAK,IAAI,CAAC,GAC3D,KAAK,IAAI,IAAI,gBAAgB,KAAK,aAAa,KAAK,IAAI,CAAC;AAEzD,UAAMC,IAAc,OAAO,IAAI,OAAO,IAAI,YAAY,KAAK,IACrDC,IAAU,OAAO,IAAI,OAAO,IAAI,sBAAsB;AAC5D,SAAK,IAAI,OAAO,CAAC,SAAS,GAAG,CAACF,MAAQ;AACpC,WAAK,MAAMA,GACXA,EAAI,QAAQ,UAAU;AAAA,QACpB,IAAI;AAAA,QACJ,MACEG,gBAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAM;AAAA,YACN,OAAM;AAAA,YACN,QAAO;AAAA,YACP,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,QAAO;AAAA,YACP,gBAAa;AAAA,YACb,kBAAe;AAAA,YACf,mBAAgB;AAAA,YAChB,OAAM;AAAA,YAEN,UAAA;AAAA,cAAA,gBAAAC,EAAC,UAAK,QAAO,QAAO,GAAE,iBAAgB,MAAK,QAAO;AAAA,cAClD,gBAAAA,EAAC,QAAA,EAAK,GAAE,4BAAA,CAA4B;AAAA,cACpC,gBAAAA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/CiB,IAAW,MAAM,KAAK,IAAI,SAAS,aAAa;AAAA,MACpD,OAAOJ;AAAA,IAAA,CACR,GACKK,IAAU,gBAAgBJ,CAAE,MAC5BP,IAAM,MAAMU,EAAS;AAAA,MACzB;AAAA,QACE,MAAMC;AAAA,QACN,SAASH;AAAA,MAAA;AAAA,MAEX;AAAA,QACE,YAAY,CAACC;AAAA,MAAA;AAAA,IACf;AAEF,QAAIT,EAAI,MAAM;AACZ,YAAM,IAAI,MAAMA,EAAI,KAAK,OAAO,CAAC,EAAE,MAAM,EAAE,OAAOA,GAAK;AAEzD,WAAOA;AAAA,EACT;AACF;"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { InPageEdit as IPECore } from './InPageEdit';
2
- export { InPageEdit, Service, Schema } from './InPageEdit';
2
+ export * from './InPageEdit';
3
3
  export { default as BasePlugin } from './plugins/BasePlugin';
4
4
  declare global {
5
5
  const InPageEdit: typeof IPECore;
@@ -21,3 +21,18 @@ declare global {
21
21
  };
22
22
  }
23
23
  }
24
+ declare global {
25
+ namespace mw {
26
+ /**
27
+ * @see https://doc.wikimedia.org/mediawiki-core/master/js/Hook.html
28
+ * @see https://github.com/wikimedia-gadgets/types-mediawiki/blob/9b4e7c3b9034d64a44a0667229a6d9585fe09b30/mw/hook.d.ts
29
+ */
30
+ interface Hook<T extends any[] = any[]> {
31
+ add(...handler: Array<(...data: T) => any>): this;
32
+ deprecate(msg: string): this;
33
+ fire(...data: T): this;
34
+ remove(...handler: Array<(...data: T) => any>): this;
35
+ }
36
+ function hook(name: 'InPageEdit.ready'): Hook<[IPECore]>;
37
+ }
38
+ }