@inpageedit/core 0.1.0 → 0.1.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 (37) hide show
  1. package/README.md +1 -1
  2. package/dist/{ActionButton-BhcZX7rl.js → ActionButton-B9JniHy6.js} +2 -2
  3. package/dist/{ActionButton-BhcZX7rl.js.map → ActionButton-B9JniHy6.js.map} +1 -1
  4. package/dist/{CheckBox-B7zLOm55.js → CheckBox-ROZZIK-t.js} +2 -2
  5. package/dist/{CheckBox-B7zLOm55.js.map → CheckBox-ROZZIK-t.js.map} +1 -1
  6. package/dist/InPageEdit.d.ts +1 -1
  7. package/dist/{PluginPreferencesUI-CqQKXQkn.js → PluginPreferencesUI-7u9JClgy.js} +2 -2
  8. package/dist/{PluginPreferencesUI-CqQKXQkn.js.map → PluginPreferencesUI-7u9JClgy.js.map} +1 -1
  9. package/dist/{RadioBox-Dl-VRoW0.js → RadioBox-Bt5tAniV.js} +2 -2
  10. package/dist/{RadioBox-Dl-VRoW0.js.map → RadioBox-Bt5tAniV.js.map} +1 -1
  11. package/dist/{index-Hed2P8uH.js → index-01GVXg9H.js} +5 -5
  12. package/dist/{index-Hed2P8uH.js.map → index-01GVXg9H.js.map} +1 -1
  13. package/dist/{index-Bi1eJIjL.js → index-BI0z4WfP.js} +2 -2
  14. package/dist/{index-Bi1eJIjL.js.map → index-BI0z4WfP.js.map} +1 -1
  15. package/dist/{index-sORwn1Vt.js → index-BY3hO6sZ.js} +5 -5
  16. package/dist/{index-sORwn1Vt.js.map → index-BY3hO6sZ.js.map} +1 -1
  17. package/dist/{index-DA5i7w02.js → index-Bz9ciRCe.js} +2 -2
  18. package/dist/{index-DA5i7w02.js.map → index-Bz9ciRCe.js.map} +1 -1
  19. package/dist/{index-CuEf9G7f.js → index-CGg-JS5d.js} +18 -11
  20. package/dist/index-CGg-JS5d.js.map +1 -0
  21. package/dist/{index-CL0NhE5n.js → index-DIovbA02.js} +4 -4
  22. package/dist/{index-CL0NhE5n.js.map → index-DIovbA02.js.map} +1 -1
  23. package/dist/{index-LoZLvK3o.js → index-DPXRKwGM.js} +4 -4
  24. package/dist/{index-LoZLvK3o.js.map → index-DPXRKwGM.js.map} +1 -1
  25. package/dist/{index-Bz4cBa1Z.js → index-M4USLRId.js} +3 -3
  26. package/dist/{index-Bz4cBa1Z.js.map → index-M4USLRId.js.map} +1 -1
  27. package/dist/{index-BEDkPsz1.js → index-jJ3Ut97G.js} +2 -2
  28. package/dist/{index-BEDkPsz1.js.map → index-jJ3Ut97G.js.map} +1 -1
  29. package/dist/index.js +1 -1
  30. package/dist/services/ApiService.d.ts +1 -1
  31. package/dist/services/ResourceLoaderService.d.ts +3 -2
  32. package/dist/services/SiteMetadataService.d.ts +1 -1
  33. package/lib/i18n/languages.json +1527 -0
  34. package/lib/index.umd.js +2666 -0
  35. package/lib/style.css +1 -0
  36. package/package.json +21 -9
  37. package/dist/index-CuEf9G7f.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { j as e } from "./index-CuEf9G7f.js";
1
+ import { j as e } from "./index-CGg-JS5d.js";
2
2
  const f = "_mbox_v5fz5_1", u = "_title_v5fz5_12", v = "_content_v5fz5_19", _ = "_close_v5fz5_27", s = {
3
3
  mbox: f,
4
4
  title: u,
@@ -51,4 +51,4 @@ export {
51
51
  P as M,
52
52
  g as R
53
53
  };
54
- //# sourceMappingURL=RadioBox-Dl-VRoW0.js.map
54
+ //# sourceMappingURL=RadioBox-Bt5tAniV.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioBox-Dl-VRoW0.js","sources":["../src/components/MBox/index.tsx","../src/components/RadioBox.tsx"],"sourcesContent":["import { ReactNode } from 'jsx-dom'\nimport { JSX } from 'jsx-dom/jsx-runtime'\nimport styles from './styles.module.sass'\n\nexport type MBoxProps = {\n type?:\n | ''\n | 'default'\n | 'note'\n | 'info'\n | 'tip'\n | 'success'\n | 'important'\n | 'done'\n | 'warning'\n | 'caution'\n | 'error'\n title?: ReactNode\n content?: ReactNode\n closeable?: boolean\n titleProps?: JSX.IntrinsicElements['div']\n contentProps?: JSX.IntrinsicElements['div']\n} & JSX.IntrinsicElements['div']\n\nexport type MBoxElement = HTMLElement & {\n close: () => Promise<void>\n}\n\nexport const MBox = (props: MBoxProps) => {\n const {\n type = 'default',\n title,\n content,\n closeable = true,\n titleProps,\n contentProps,\n children,\n ...rest\n } = props\n let titleContent = title\n if (typeof title === 'undefined' && type !== 'default') {\n titleContent = type[0].toUpperCase() + type.slice(1).toLowerCase()\n }\n\n const close = async () => {\n if (!box) {\n return Promise.resolve()\n }\n const { promise, resolve } = Promise.withResolvers<void>()\n\n const animation = box.animate(\n [\n { opacity: '1', height: box.clientHeight + 'px' },\n { opacity: '0', height: '0px', margin: '0px' },\n ],\n {\n duration: 300,\n easing: 'ease',\n }\n )\n\n animation.addEventListener('finish', () => {\n box.remove()\n resolve()\n })\n\n return promise\n }\n\n const box = (\n <div className={`theme-ipe ipe-mbox mbox-type-${type || 'default'} ${styles.mbox}`} {...rest}>\n {titleContent && (\n <div className={`ipe-mbox-title ${styles.title}`} {...titleProps}>\n {titleContent}\n </div>\n )}\n <div className={`ipe-mbox-content ${styles.content}`} {...contentProps}>\n {children || content}\n </div>\n {closeable && (\n <a onClick={close} className={`ipe-mbox-close ${styles.close}`}>\n ×\n </a>\n )}\n </div>\n ) as MBoxElement\n box.close = close\n return box\n}\n","import { JSX, ReactNode } from 'jsx-dom'\n\nexport type RadioBoxProps = {\n id?: string\n name: string\n value: string\n label?: string | HTMLElement\n inputProps?: JSX.IntrinsicElements['input']\n labelProps?: JSX.IntrinsicElements['span']\n} & JSX.IntrinsicElements['label']\n\nexport const RadioBox = (props: RadioBoxProps) => {\n const { id, name, value, label, inputProps, labelProps, children, ...rest } = props\n return (\n <label className=\"theme-ipe ipe-radio-box\" {...rest}>\n <input type=\"radio\" id={id} name={name} value={value} {...inputProps} />\n <span className=\"ipe-checkbox-box\"></span>\n <span {...labelProps}>{label || children}</span>\n </label>\n )\n}\n"],"names":["MBox","props","type","title","content","closeable","titleProps","contentProps","children","rest","titleContent","close","box","promise","resolve","jsxs","styles","jsx","RadioBox","id","name","value","label","inputProps","labelProps"],"mappings":";;;;;;GA4BaA,IAAO,CAACC,MAAqB;AACxC,QAAM;AAAA,IACJ,MAAAC,IAAO;AAAA,IACP,OAAAC;AAAA,IACA,SAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDR;AACJ,MAAIS,IAAeP;AACnB,EAAI,OAAOA,IAAU,OAAeD,MAAS,cAC3CQ,IAAeR,EAAK,CAAC,EAAE,YAAA,IAAgBA,EAAK,MAAM,CAAC,EAAE,YAAA;AAGvD,QAAMS,IAAQ,YAAY;AACxB,QAAI,CAACC;AACH,aAAO,QAAQ,QAAA;AAEjB,UAAM,EAAE,SAAAC,GAAS,SAAAC,MAAY,QAAQ,cAAA;AAarC,WAXkBF,EAAI;AAAA,MACpB;AAAA,QACE,EAAE,SAAS,KAAK,QAAQA,EAAI,eAAe,KAAA;AAAA,QAC3C,EAAE,SAAS,KAAK,QAAQ,OAAO,QAAQ,MAAA;AAAA,MAAM;AAAA,MAE/C;AAAA,QACE,UAAU;AAAA,QACV,QAAQ;AAAA,MAAA;AAAA,IACV,EAGQ,iBAAiB,UAAU,MAAM;AACzC,MAAAA,EAAI,OAAA,GACJE,EAAA;AAAA,IACF,CAAC,GAEMD;AAAA,EACT,GAEMD,IACJG,gBAAAA,EAAC,OAAA,EAAI,WAAW,gCAAgCb,KAAQ,SAAS,IAAIc,EAAO,IAAI,IAAK,GAAGP,GACrF,UAAA;AAAA,IAAAC,KACC,gBAAAO,EAAC,SAAI,WAAW,kBAAkBD,EAAO,KAAK,IAAK,GAAGV,GACnD,UAAAI,EAAA,CACH;AAAA,IAEF,gBAAAO,EAAC,OAAA,EAAI,WAAW,oBAAoBD,EAAO,OAAO,IAAK,GAAGT,GACvD,UAAAC,KAAYJ,EAAA,CACf;AAAA,IACCC,KACC,gBAAAY,EAAC,KAAA,EAAE,SAASN,GAAO,WAAW,kBAAkBK,EAAO,KAAK,IAAI,UAAA,IAAA,CAEhE;AAAA,EAAA,GAEJ;AAEF,SAAAJ,EAAI,QAAQD,GACLC;AACT,GC7EaM,IAAW,CAACjB,MAAyB;AAChD,QAAM,EAAE,IAAAkB,GAAI,MAAAC,GAAM,OAAAC,GAAO,OAAAC,GAAO,YAAAC,GAAY,YAAAC,GAAY,UAAAhB,GAAU,GAAGC,EAAA,IAASR;AAC9E,SACEc,gBAAAA,EAAC,SAAA,EAAM,WAAU,2BAA2B,GAAGN,GAC7C,UAAA;AAAA,IAAA,gBAAAQ,EAAC,WAAM,MAAK,SAAQ,IAAAE,GAAQ,MAAAC,GAAY,OAAAC,GAAe,GAAGE,GAAY;AAAA,IACtE,gBAAAN,EAAC,QAAA,EAAK,WAAU,mBAAA,CAAmB;AAAA,IACnC,gBAAAA,EAAC,QAAA,EAAM,GAAGO,GAAa,eAAShB,EAAA,CAAS;AAAA,EAAA,GAC3C;AAEJ;"}
1
+ {"version":3,"file":"RadioBox-Bt5tAniV.js","sources":["../src/components/MBox/index.tsx","../src/components/RadioBox.tsx"],"sourcesContent":["import { ReactNode } from 'jsx-dom'\nimport { JSX } from 'jsx-dom/jsx-runtime'\nimport styles from './styles.module.sass'\n\nexport type MBoxProps = {\n type?:\n | ''\n | 'default'\n | 'note'\n | 'info'\n | 'tip'\n | 'success'\n | 'important'\n | 'done'\n | 'warning'\n | 'caution'\n | 'error'\n title?: ReactNode\n content?: ReactNode\n closeable?: boolean\n titleProps?: JSX.IntrinsicElements['div']\n contentProps?: JSX.IntrinsicElements['div']\n} & JSX.IntrinsicElements['div']\n\nexport type MBoxElement = HTMLElement & {\n close: () => Promise<void>\n}\n\nexport const MBox = (props: MBoxProps) => {\n const {\n type = 'default',\n title,\n content,\n closeable = true,\n titleProps,\n contentProps,\n children,\n ...rest\n } = props\n let titleContent = title\n if (typeof title === 'undefined' && type !== 'default') {\n titleContent = type[0].toUpperCase() + type.slice(1).toLowerCase()\n }\n\n const close = async () => {\n if (!box) {\n return Promise.resolve()\n }\n const { promise, resolve } = Promise.withResolvers<void>()\n\n const animation = box.animate(\n [\n { opacity: '1', height: box.clientHeight + 'px' },\n { opacity: '0', height: '0px', margin: '0px' },\n ],\n {\n duration: 300,\n easing: 'ease',\n }\n )\n\n animation.addEventListener('finish', () => {\n box.remove()\n resolve()\n })\n\n return promise\n }\n\n const box = (\n <div className={`theme-ipe ipe-mbox mbox-type-${type || 'default'} ${styles.mbox}`} {...rest}>\n {titleContent && (\n <div className={`ipe-mbox-title ${styles.title}`} {...titleProps}>\n {titleContent}\n </div>\n )}\n <div className={`ipe-mbox-content ${styles.content}`} {...contentProps}>\n {children || content}\n </div>\n {closeable && (\n <a onClick={close} className={`ipe-mbox-close ${styles.close}`}>\n ×\n </a>\n )}\n </div>\n ) as MBoxElement\n box.close = close\n return box\n}\n","import { JSX, ReactNode } from 'jsx-dom'\n\nexport type RadioBoxProps = {\n id?: string\n name: string\n value: string\n label?: string | HTMLElement\n inputProps?: JSX.IntrinsicElements['input']\n labelProps?: JSX.IntrinsicElements['span']\n} & JSX.IntrinsicElements['label']\n\nexport const RadioBox = (props: RadioBoxProps) => {\n const { id, name, value, label, inputProps, labelProps, children, ...rest } = props\n return (\n <label className=\"theme-ipe ipe-radio-box\" {...rest}>\n <input type=\"radio\" id={id} name={name} value={value} {...inputProps} />\n <span className=\"ipe-checkbox-box\"></span>\n <span {...labelProps}>{label || children}</span>\n </label>\n )\n}\n"],"names":["MBox","props","type","title","content","closeable","titleProps","contentProps","children","rest","titleContent","close","box","promise","resolve","jsxs","styles","jsx","RadioBox","id","name","value","label","inputProps","labelProps"],"mappings":";;;;;;GA4BaA,IAAO,CAACC,MAAqB;AACxC,QAAM;AAAA,IACJ,MAAAC,IAAO;AAAA,IACP,OAAAC;AAAA,IACA,SA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AAyB;AAChD,QAAM,EAAE,IAAAkB,GAAI,MAAAC,GAAM,OAAAC,GAAO,OAAAC,GAAO,YAAAC,GAAY,YAAAC,GAAY,UAAAhB,GAAU,GAAGC,EAAA,IAASR;AAC9E,SACEc,gBAAAA,EAAC,SAAA,EAAM,WAAU,2BAA2B,GAAGN,GAC7C,UAAA;AAAA,IAAA,gBAAAQ,EAAC,WAAM,MAAK,SAAQ,IAAAE,GAAQ,MAAAC,GAAY,OAAAC,GAAe,GAAGE,GAAY;AAAA,IACtE,gBAAAN,EAAC,QAAA,EAAK,WAAU,mBAAA,CAAmB;AAAA,IACnC,gBAAAA,EAAC,QAAA,EAAM,GAAGO,GAAa,eAAShB,EAAA,CAAS;AAAA,EAAA,GAC3C;AAEJ;"}
@@ -1,7 +1,7 @@
1
- import { B as y, j as a, P as S, a as j } from "./index-CuEf9G7f.js";
2
- import { T as F } from "./index-Bi1eJIjL.js";
3
- import { C as v, I as q } from "./CheckBox-B7zLOm55.js";
4
- import { A as B } from "./ActionButton-BhcZX7rl.js";
1
+ import { B as y, j as a, P as S, a as j } from "./index-CGg-JS5d.js";
2
+ import { T as F } from "./index-BI0z4WfP.js";
3
+ import { C as v, I as q } from "./CheckBox-ROZZIK-t.js";
4
+ import { A as B } from "./ActionButton-B9JniHy6.js";
5
5
  var E = Object.create, h = Object.defineProperty, I = Object.getOwnPropertyDescriptor, _ = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), b = (t) => {
6
6
  throw TypeError(t);
7
7
  }, C = (t, e, o) => e in t ? h(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o, T = (t, e) => h(t, "name", { value: e, configurable: !0 }), z = (t) => [, , , E(t?.[_("metadata")] ?? null)], D = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], k = (t) => t !== void 0 && typeof t != "function" ? b("Function expected") : t, O = (t, e, o, n, r) => ({ kind: D[t], name: e, metadata: n, addInitializer: (i) => o._ ? b("Already initialized") : r.push(k(i || null)) }), Q = (t, e) => C(e, _("metadata"), t[3]), N = (t, e, o, n) => {
@@ -156,4 +156,4 @@ N(p, 1, u);
156
156
  export {
157
157
  u as PluginQuickMove
158
158
  };
159
- //# sourceMappingURL=index-Hed2P8uH.js.map
159
+ //# sourceMappingURL=index-01GVXg9H.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-Hed2P8uH.js","sources":["../src/plugins/quick-move/index.tsx"],"sourcesContent":["import { Inject, InPageEdit } from '@/InPageEdit'\n\ndeclare module '@/InPageEdit' {\n interface InPageEdit {\n quickMove: PluginQuickMove['quickMove']\n movePage: PluginQuickMove['movePage']\n }\n}\n\nexport interface MovePageOptions {\n from: string\n to: string\n reason?: string\n movetalk?: boolean\n movesubpages?: boolean\n noredirect?: boolean\n}\nexport interface QuickMoveOptions extends Partial<MovePageOptions> {\n lockFromField?: boolean\n lockToField?: boolean\n}\n\n@Inject(['modal', 'sitemeta'])\nexport class PluginQuickMove extends BasePlugin {\n constructor(public ctx: InPageEdit) {\n super(ctx, {}, 'quick-move')\n ctx.set('quickMove', this.quickMove.bind(this))\n ctx.set('movePage', this.movePage.bind(this))\n }\n\n protected start(): Promise<void> | void {\n this.ctx.inject(['toolbox'], (ctx) => {\n this.injectToolbox(ctx)\n })\n }\n\n private injectToolbox(ctx: InPageEdit) {\n const curPageName = window.mw?.config.get('wgPageName') || ''\n const canEdit = window.mw?.config.get('wgIsProbablyEditable')\n ctx.toolbox.addButton({\n id: 'quick-move',\n icon: (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"icon icon-tabler icons-tabler-outline icon-tabler-forms\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3\" />\n <path d=\"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3\" />\n <path d=\"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7\" />\n <path d=\"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1\" />\n <path d=\"M17 12h.01\" />\n <path d=\"M13 12h.01\" />\n </svg>\n ),\n tooltip: 'Quick Move',\n group: 'group2',\n onClick: () => {\n this.quickMove(\n canEdit\n ? {\n lockFromField: true,\n from: curPageName,\n }\n : {}\n )\n },\n })\n }\n\n quickMove(options?: Partial<QuickMoveOptions>) {\n const modal = this.ctx.modal\n .createObject({\n title: 'Quick Move',\n content: (<ProgressBar />) as HTMLElement,\n className: 'quick-move',\n sizeClass: 'medium',\n center: true,\n })\n .init()\n\n let formRef: HTMLFormElement | null = null\n modal.setContent(\n (\n <form\n ref={(el) => (formRef = el)}\n style={{\n display: 'flex',\n flexDirection: 'column',\n gap: '1rem',\n }}\n onSubmit={(e) => {\n e.preventDefault()\n const formData = new FormData(formRef!)\n const options = {\n from: formData.get('from') as string,\n to: formData.get('to') as string,\n reason: (formData.get('reason') as string) || '',\n movetalk: formData.get('movetalk') === 'on',\n movesubpages: formData.get('movesubpages') === 'on',\n noredirect: formData.get('noredirect') === 'on',\n }\n modal.setLoadingState(true)\n this.movePage(options)\n .then(() => {\n location.reload()\n })\n .catch((error) => {\n modal.setLoadingState(false)\n this.ctx.modal.notify('error', {\n title: 'Failed to move',\n content: error instanceof Error ? error.message : String(error),\n })\n })\n }}\n >\n <TwinSwapInput\n inputs={[\n {\n label: 'Move from',\n name: 'from',\n value: options?.from,\n },\n {\n label: 'Move to',\n name: 'to',\n value: options?.to,\n },\n ]}\n />\n <div>\n <CheckBox name=\"movetalk\" id=\"movetalk\" checked={options?.movetalk}>\n Move talk page\n </CheckBox>\n </div>\n <div>\n <CheckBox name=\"movesubpages\" id=\"movesubpages\" checked={options?.movesubpages}>\n Move subpage(s) (up to 100)\n </CheckBox>\n </div>\n {this.ctx.sitemeta.hasRight('suppressredirect') && (\n <div>\n <CheckBox name=\"noredirect\" id=\"noredirect\" checked={options?.noredirect}>\n Move without leaving a redirect\n </CheckBox>\n </div>\n )}\n <InputBox label=\"Reason\" id=\"reason\" name=\"reason\" value={options?.reason} />\n <div>\n <ActionButton\n type=\"primary\"\n buttonProps={{\n style: {\n width: '100%',\n },\n }}\n >\n Move\n </ActionButton>\n </div>\n </form>\n ) as HTMLElement\n )\n\n return modal.show()\n }\n\n async movePage(options: MovePageOptions) {\n const { from, to, reason = '', ...rest } = options\n\n if (!from || !to) {\n throw new Error('From and to titles are required.')\n }\n if (from === to) {\n throw new Error('From and to titles cannot be the same.')\n }\n\n const wikiPage = await this.ctx.wikiPage.newFromTitle(from)\n return wikiPage.moveTo(to, reason, rest)\n }\n}\n"],"names":["_PluginQuickMove_decorators","_init","_a","Inject","PluginQuickMove","BasePlugin","ctx","curPageName","canEdit","jsxs","jsx","options","modal","ProgressBar","formRef","el","e","formData","error","TwinSwapInput","CheckBox","InputBox","ActionButton","from","to","reason","rest","__decoratorStart","__decorateElement","__runInitializers"],"mappings":";;;;;;;;;;;;;;;GAAAA,GAAAC,GAAAC;AAsBAF,IAAA,CAACG,EAAO,CAAC,SAAS,UAAU,CAAC,CAAA;AACtB,MAAMC,WAAwBF,IAAAG,GAAW;AAAA,EAC9C,YAAmBC,GAAiB;AAClC,UAAMA,GAAK,CAAA,GAAI,YAAY,GADV,KAAA,MAAAA,GAEjBA,EAAI,IAAI,aAAa,KAAK,UAAU,KAAK,IAAI,CAAC,GAC9CA,EAAI,IAAI,YAAY,KAAK,SAAS,KAAK,IAAI,CAAC;AAAA,EAC9C;AAAA,EAEU,QAA8B;AACtC,SAAK,IAAI,OAAO,CAAC,SAAS,GAAG,CAACA,MAAQ;AACpC,WAAK,cAAcA,CAAG;AAAA,IACxB,CAAC;AAAA,EACH;AAAA,EAEQ,cAAcA,GAAiB;AACrC,UAAMC,IAAc,OAAO,IAA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.js","sources":["../src/plugins/quick-move/index.tsx"],"sourcesContent":["import { Inject, InPageEdit } from '@/InPageEdit'\n\ndeclare module '@/InPageEdit' {\n interface InPageEdit {\n quickMove: PluginQuickMove['quickMove']\n movePage: PluginQuickMove['movePage']\n }\n}\n\nexport interface MovePageOptions {\n from: string\n to: string\n reason?: string\n movetalk?: boolean\n movesubpages?: boolean\n noredirect?: boolean\n}\nexport interface QuickMoveOptions extends Partial<MovePageOptions> {\n lockFromField?: boolean\n lockToField?: boolean\n}\n\n@Inject(['modal', 'sitemeta'])\nexport class PluginQuickMove extends BasePlugin {\n constructor(public ctx: InPageEdit) {\n super(ctx, {}, 'quick-move')\n ctx.set('quickMove', this.quickMove.bind(this))\n ctx.set('movePage', this.movePage.bind(this))\n }\n\n protected start(): Promise<void> | void {\n this.ctx.inject(['toolbox'], (ctx) => {\n this.injectToolbox(ctx)\n })\n }\n\n private injectToolbox(ctx: InPageEdit) {\n const curPageName = window.mw?.config.get('wgPageName') || ''\n const canEdit = window.mw?.config.get('wgIsProbablyEditable')\n ctx.toolbox.addButton({\n id: 'quick-move',\n icon: (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"icon icon-tabler icons-tabler-outline icon-tabler-forms\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3\" />\n <path d=\"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3\" />\n <path d=\"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7\" />\n <path d=\"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1\" />\n <path d=\"M17 12h.01\" />\n <path d=\"M13 12h.01\" />\n </svg>\n ),\n tooltip: 'Quick Move',\n group: 'group2',\n onClick: () => {\n this.quickMove(\n canEdit\n ? {\n lockFromField: true,\n from: curPageName,\n }\n : {}\n )\n },\n })\n }\n\n quickMove(options?: Partial<QuickMoveOptions>) {\n const modal = this.ctx.modal\n .createObject({\n title: 'Quick Move',\n content: (<ProgressBar />) as HTMLElement,\n className: 'quick-move',\n sizeClass: 'medium',\n center: true,\n })\n .init()\n\n let formRef: HTMLFormElement | null = null\n modal.setContent(\n (\n <form\n ref={(el) => (formRef = el)}\n style={{\n display: 'flex',\n flexDirection: 'column',\n gap: '1rem',\n }}\n onSubmit={(e) => {\n e.preventDefault()\n const formData = new FormData(formRef!)\n const options = {\n from: formData.get('from') as string,\n to: formData.get('to') as string,\n reason: (formData.get('reason') as string) || '',\n movetalk: formData.get('movetalk') === 'on',\n movesubpages: formData.get('movesubpages') === 'on',\n noredirect: formData.get('noredirect') === 'on',\n }\n modal.setLoadingState(true)\n this.movePage(options)\n .then(() => {\n location.reload()\n })\n .catch((error) => {\n modal.setLoadingState(false)\n this.ctx.modal.notify('error', {\n title: 'Failed to move',\n content: error instanceof Error ? error.message : String(error),\n })\n })\n }}\n >\n <TwinSwapInput\n inputs={[\n {\n label: 'Move from',\n name: 'from',\n value: options?.from,\n },\n {\n label: 'Move to',\n name: 'to',\n value: options?.to,\n },\n ]}\n />\n <div>\n <CheckBox name=\"movetalk\" id=\"movetalk\" checked={options?.movetalk}>\n Move talk page\n </CheckBox>\n </div>\n <div>\n <CheckBox name=\"movesubpages\" id=\"movesubpages\" checked={options?.movesubpages}>\n Move subpage(s) (up to 100)\n </CheckBox>\n </div>\n {this.ctx.sitemeta.hasRight('suppressredirect') && (\n <div>\n <CheckBox name=\"noredirect\" id=\"noredirect\" checked={options?.noredirect}>\n Move without leaving a redirect\n </CheckBox>\n </div>\n )}\n <InputBox label=\"Reason\" id=\"reason\" name=\"reason\" value={options?.reason} />\n <div>\n <ActionButton\n type=\"primary\"\n buttonProps={{\n style: {\n width: '100%',\n },\n }}\n >\n Move\n </ActionButton>\n </div>\n </form>\n ) as HTMLElement\n )\n\n return modal.show()\n }\n\n async movePage(options: MovePageOptions) {\n const { from, to, reason = '', ...rest } = options\n\n if (!from || !to) {\n throw new Error('From and to titles are required.')\n }\n if (from === to) {\n throw new Error('From and to titles cannot be the same.')\n }\n\n const wikiPage = await this.ctx.wikiPage.newFromTitle(from)\n return wikiPage.moveTo(to, reason, rest)\n }\n}\n"],"names":["_PluginQuickMove_decorators","_init","_a","Inject","PluginQuickMove","BasePlugin","ctx","curPageName","canEdit","jsxs","jsx","options","modal","ProgressBar","formRef","el","e","formData","error","TwinSwapInput","CheckBox","InputBox","ActionButton","from","to","reason","rest","__decoratorStart","__decorateElement","__runInitializers"],"mappings":";;;;;;;;;;;;;;;GAAAA,GAAAC,GAAAC;AAsBAF,IAAA,CAACG,EAAO,CAAC,SAAS,UAAU,CAAC,CAAA;AACtB,MAAMC,WAAwBF,IAAAG,GAAW;AAAA,EAC9C,YAAmBC,GAAiB;AAClC,UAAMA,GAAK,CAAA,GAAI,YAAY,GADV,KAAA,MAAAA,GAEjBA,EAAI,IAAI,aAAa,KAAK,UAAU,KAAK,IAAI,CAAC,GAC9CA,EAAI,IAAI,YAAY,KAAK,SAAS,KAAK,IAAI,CAAC;AAAA,EAC9C;AAAA,EAEU,QAA8B;AACtC,SAAK,IAAI,OAAO,CAAC,SAAS,GAAG,CAACA,MAAQ;AACpC,WAAK,cAAcA,CAAG;AAAA,IACxB,CAAC;AAAA,EACH;AAAA,EAEQ,cAAcA,GAAiB;AACrC,UAAMC,IAAc,OAAO,IAAI,OAAO,IAAI,YAAY,KAAK,IACrDC,IAAU,OAAO,IAAI,OAAO,IAAI,sBAAsB;AAC5D,IAAAF,EAAI,QAAQ,UAAU;AAAA,MACpB,IAAI;AAAA,MACJ,MACEG,gBAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,OAAM;AAAA,UACN,OAAM;AAAA,UACN,QAAO;AAAA,UACP,SAA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C,KAAK,IAAI,SAAS,SAAS,kBAAkB,uBAC3C,OAAA,EACC,UAAA,gBAAAD,EAACU,GAAA,EAAS,MAAK,cAAa,IAAG,cAAa,SAAST,GAAS,YAAY,6CAE1E,GACF;AAAA,YAEF,gBAAAD,EAACW,GAAA,EAAS,OAAM,UAAS,IAAG,UAAS,MAAK,UAAS,OAAOV,GAAS,OAAA,CAAQ;AAAA,8BAC1E,OAAA,EACC,UAAA,gBAAAD;AAAA,cAACY;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,aAAa;AAAA,kBACX,OAAO;AAAA,oBACL,OAAO;AAAA,kBAAA;AAAA,gBACT;AAAA,gBAEH,UAAA;AAAA,cAAA;AAAA,YAAA,EAED,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,GAIGV,EAAM,KAAA;AAAA,EACf;AAAA,EAEA,MAAM,SAASD,GAA0B;AACvC,UAAM,EAAE,MAAAY,GAAM,IAAAC,GAAI,QAAAC,IAAS,IAAI,GAAGC,MAASf;AAE3C,QAAI,CAACY,KAAQ,CAACC;AACZ,YAAM,IAAI,MAAM,kCAAkC;AAEpD,QAAID,MAASC;AACX,YAAM,IAAI,MAAM,wCAAwC;AAI1D,YADiB,MAAM,KAAK,IAAI,SAAS,aAAaD,CAAI,GAC1C,OAAOC,GAAIC,GAAQC,CAAI;AAAA,EACzC;AACF;AArKOzB,IAAA0B,EAAAzB,CAAA;AAAME,IAANwB,2BADP5B,GACaI,CAAA;AAANyB,EAAA5B,GAAA,GAAMG,CAAA;"}
@@ -1,4 +1,4 @@
1
- import { j as n } from "./index-CuEf9G7f.js";
1
+ import { j as n } from "./index-CGg-JS5d.js";
2
2
  const x = "_twinSwapInput_1gdgl_9", y = "_inputWrapper_1gdgl_23", L = "_inputLeft_1gdgl_27", W = "_inputRight_1gdgl_30", $ = "_swapButton_1gdgl_46", i = {
3
3
  twinSwapInput: x,
4
4
  inputWrapper: y,
@@ -80,4 +80,4 @@ const x = "_twinSwapInput_1gdgl_9", y = "_inputWrapper_1gdgl_23", L = "_inputLef
80
80
  export {
81
81
  C as T
82
82
  };
83
- //# sourceMappingURL=index-Bi1eJIjL.js.map
83
+ //# sourceMappingURL=index-BI0z4WfP.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-Bi1eJIjL.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 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, 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 {...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","inputProps","isLeft","inputId"],"mappings":";;;;;;;GAsBaA,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,IAAIP,EAAU,CAAC,GACfQ,IAAIR,EAAU,CAAC,GACfS,IAAKF,EAAE,OACPG,IAAKF,EAAE;AACb,IAAAD,EAAE,QAAQG,GACVF,EAAE,QAAQC,GAGVF,EAAE,cAAc,IAAI,MAAM,QAAQ,CAAC,GACnCC,EAAE,cAAc,IAAI,MAAM,QAAQ,CAAC,GAEnCP,KACIE,MACFA,EAAO,MAAM,YAAY,WAAWF,IAAY,IAAI,QACpDE,EAAO,MAAM,aAAa;AAAA,EAE9B,GAEMQ,IAAmB,CAACC,MAAqB;AAC7C,QAAI,CAACV,EAAY;AACjB,UAAMW,IAAOD,KAAU,CAACV,EAAW;AACnC,IAAAA,EAAW,WAAW,CAACW,GACnBA,KAEFb,EAAU,QAAQ,CAACK,MAAO;AACxB,MAAIA,QAAO,WAAW;AAAA,IACxB,CAAC;AAAA,EAEL,GAEMS,IACJ,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,cAAW;AAAA,MACX,SAAST;AAAA,MACT,UAAUF,EAAA,KAA0B,CAACP;AAAA,MACrC,KAAK,CAACQ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AAA,gBACC,GAAGC;AAAA,cAAA;AAAA,YAAA;AAAA,UACN;AAAA,QAAA;AAAA,MAAA;AAAA,IAGN,CAAC;AAAA,IAED,gBAAAX,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-BI0z4WfP.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 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, 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 {...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","inputProps","isLeft","inputId"],"mappings":";;;;;;;GAsBaA,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,IAAIP,EAAU,CAAC,GACfQ,IAAIR,EAAU,CAAC,GACfS,IAAKF,EAAE,OACPG,IAAKF,EAAE;AACb,IAAAD,EAAE,QAAQG,GACVF,EAAE,QAAQC,GAGVF,EAAE,cAAc,IAAI,MAAM,QAAQ,CAAC,GACnCC,EAAE,cAAc,IAAI,MAAM,QAAQ,CAAC,GAEnCP,KACIE,MACFA,EAAO,MAAM,YAAY,WAAWF,IAAY,IAAI,QACpDE,EAAO,MAAM,aAAa;AAAA,EAE9B,GAEMQ,IAAmB,CAACC,MAAqB;AAC7C,QAAI,CAACV,EAAY;AACjB,UAAMW,IAAOD,KAAU,CAACV,EAAW;AACnC,IAAAA,EAAW,WAAW,CAACW,GACnBA,KAEFb,EAAU,QAAQ,CAACK,MAAO;AACxB,MAAIA,QAAO,WAAW;AAAA,IACxB,CAAC;AAAA,EAEL,GAEMS,IACJ,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,M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,MAAK;AAAA,gBACL,IAAIuB;AAAA,gBACJ,MAAAL;AAAA,gBACA,OAAAC;AAAA,gBACA,UAAAC;AAAA,gBACC,GAAGC;AAAA,cAAA;AAAA,YAAA;AAAA,UACN;AAAA,QAAA;AAAA,MAAA;AAAA,IAGN,CAAC;AAAA,IAED,gBAAAX,EAAC,OAAA,EAAI,WAAWG,EAAO,YAAa,UAAAJ,EAAA,CAAW;AAAA,EAAA,GACjD;AAGF,SAAAG,EAAU,OAAOX,GACjBW,EAAU,mBAAmBN,GAEtBM;AACT;"}
@@ -1,7 +1,7 @@
1
- import { B as h, j as e, P as m } from "./index-CuEf9G7f.js";
2
- import { T as u } from "./index-Bi1eJIjL.js";
3
- import { I as w, C as g } from "./CheckBox-B7zLOm55.js";
4
- import { A as f } from "./ActionButton-BhcZX7rl.js";
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
5
  const l = class l extends h {
6
6
  constructor(t) {
7
7
  super(t, {}, "quick-redirect"), this.ctx = t;
@@ -137,4 +137,4 @@ let d = l;
137
137
  export {
138
138
  d as PluginQuickRedirect
139
139
  };
140
- //# sourceMappingURL=index-sORwn1Vt.js.map
140
+ //# sourceMappingURL=index-BY3hO6sZ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-sORwn1Vt.js","sources":["../src/plugins/quick-redirect/index.tsx"],"sourcesContent":["import { InPageEdit } from '@/InPageEdit'\n\ndeclare module '@/InPageEdit' {\n interface InPageEdit {\n quickRedirect: PluginQuickRedirect['quickRedirect']\n redirectPage: PluginQuickRedirect['redirectPage']\n }\n}\n\nexport interface RedirectPageOptions {\n from: string\n to: string\n reason?: string\n overwrite?: boolean\n}\nexport interface QuickRedirectOptions extends Partial<RedirectPageOptions> {}\n\nexport class PluginQuickRedirect extends BasePlugin {\n static readonly inject = ['api', 'wikiPage', 'modal']\n\n constructor(public ctx: InPageEdit) {\n super(ctx, {}, 'quick-redirect')\n }\n\n protected start(): Promise<void> | void {\n this.ctx.set('quickRedirect', this.quickRedirect.bind(this))\n this.ctx.set('redirectPage', this.redirectPage.bind(this))\n\n const curPageName = window.mw?.config.get('wgPageName') || ''\n const canEdit = window.mw?.config.get('wgIsProbablyEditable')\n this.ctx.inject(['toolbox'], (ctx) => {\n this.ctx = ctx\n ctx.toolbox.addButton({\n id: 'quick-redirect',\n icon: (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"icon icon-tabler icons-tabler-outline icon-tabler-file-symlink\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M4 21v-4a3 3 0 0 1 3 -3h5\" />\n <path d=\"M9 17l3 -3l-3 -3\" />\n <path d=\"M14 3v4a1 1 0 0 0 1 1h4\" />\n <path d=\"M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5\" />\n </svg>\n ) as HTMLElement,\n tooltip: 'Quick Redirect',\n group: 'group1',\n onClick: () => {\n this.quickRedirect(\n canEdit\n ? {\n to: curPageName,\n }\n : {}\n )\n },\n })\n this.addDisposeHandler((ctx) => {\n ctx.toolbox.removeButton('quick-redirect')\n })\n })\n }\n\n protected stop(): Promise<void> | void {}\n\n quickRedirect(options?: Partial<QuickRedirectOptions>) {\n const modal = this.ctx.modal\n .createObject({\n title: 'Quick Redirect',\n content: (<ProgressBar />) as HTMLElement,\n className: 'quick-redirect',\n sizeClass: 'medium',\n center: true,\n })\n .init()\n\n let formRef: HTMLFormElement | null = null\n modal.setContent(\n (\n <form\n ref={(el) => (formRef = el)}\n style={{\n display: 'flex',\n flexDirection: 'column',\n gap: '1rem',\n }}\n onSubmit={(e) => {\n e.preventDefault()\n const formData = new FormData(formRef!)\n const options = {\n from: formData.get('from') as string,\n to: formData.get('to') as string,\n reason: (formData.get('reason') as string) || '',\n overwrite: formData.get('overwrite') === 'on',\n }\n modal.setLoadingState(true)\n this.redirectPage(options)\n .then((res) => {\n modal.close()\n this.ctx.modal.notify('success', {\n title: 'Redirect successful',\n content: 'The redirect has been created.',\n })\n })\n .catch((error) => {\n modal.setLoadingState(false)\n this.ctx.modal.notify('error', {\n title: 'Failed to redirect',\n content: error instanceof Error ? error.message : String(error),\n })\n })\n }}\n >\n <TwinSwapInput\n inputs={[\n {\n label: 'From',\n name: 'from',\n value: options?.from,\n },\n {\n label: 'To',\n name: 'to',\n value: options?.to,\n },\n ]}\n />\n <InputBox label=\"Reason\" id=\"reason\" name=\"reason\" value={options?.reason} />\n <div>\n <CheckBox name=\"overwrite\" id=\"overwrite\" checked={options?.overwrite}>\n Force create redirect even if the from page already exists\n </CheckBox>\n </div>\n <ActionButton type=\"primary\" buttonProps={{ style: { width: '100%' } }}>\n Create Redirect\n </ActionButton>\n </form>\n ) as HTMLFormElement\n )\n\n return modal.show()\n }\n\n async redirectPage(options: RedirectPageOptions) {\n const { from, to, reason = '', overwrite = false } = options\n const wikiPage = await this.ctx.wikiPage.newBlankPage({\n title: from,\n })\n const content = `#REDIRECT [[:${to}]]`\n const res = await wikiPage.edit(\n {\n text: content,\n summary: reason,\n },\n {\n createonly: !overwrite,\n }\n )\n if (res.data?.errors) {\n throw new Error(res.data.errors[0].text, { cause: res })\n }\n return res\n }\n}\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","PluginQuickRedirect"],"mappings":";;;;AAiBO,MAAMA,IAAN,MAAMA,UAA4BC,EAAW;AAAA,EAGlD,YAAmBC,GAAiB;AAClC,UAAM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Ed,EAAgB,SAAS,CAAC,OAAO,YAAY,OAAO;AAD/C,IAAM0B,IAAN1B;"}
1
+ {"version":3,"file":"index-BY3hO6sZ.js","sources":["../src/plugins/quick-redirect/index.tsx"],"sourcesContent":["import { InPageEdit } from '@/InPageEdit'\n\ndeclare module '@/InPageEdit' {\n interface InPageEdit {\n quickRedirect: PluginQuickRedirect['quickRedirect']\n redirectPage: PluginQuickRedirect['redirectPage']\n }\n}\n\nexport interface RedirectPageOptions {\n from: string\n to: string\n reason?: string\n overwrite?: boolean\n}\nexport interface QuickRedirectOptions extends Partial<RedirectPageOptions> {}\n\nexport class PluginQuickRedirect extends BasePlugin {\n static readonly inject = ['api', 'wikiPage', 'modal']\n\n constructor(public ctx: InPageEdit) {\n super(ctx, {}, 'quick-redirect')\n }\n\n protected start(): Promise<void> | void {\n this.ctx.set('quickRedirect', this.quickRedirect.bind(this))\n this.ctx.set('redirectPage', this.redirectPage.bind(this))\n\n const curPageName = window.mw?.config.get('wgPageName') || ''\n const canEdit = window.mw?.config.get('wgIsProbablyEditable')\n this.ctx.inject(['toolbox'], (ctx) => {\n this.ctx = ctx\n ctx.toolbox.addButton({\n id: 'quick-redirect',\n icon: (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"icon icon-tabler icons-tabler-outline icon-tabler-file-symlink\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M4 21v-4a3 3 0 0 1 3 -3h5\" />\n <path d=\"M9 17l3 -3l-3 -3\" />\n <path d=\"M14 3v4a1 1 0 0 0 1 1h4\" />\n <path d=\"M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5\" />\n </svg>\n ) as HTMLElement,\n tooltip: 'Quick Redirect',\n group: 'group1',\n onClick: () => {\n this.quickRedirect(\n canEdit\n ? {\n to: curPageName,\n }\n : {}\n )\n },\n })\n this.addDisposeHandler((ctx) => {\n ctx.toolbox.removeButton('quick-redirect')\n })\n })\n }\n\n protected stop(): Promise<void> | void {}\n\n quickRedirect(options?: Partial<QuickRedirectOptions>) {\n const modal = this.ctx.modal\n .createObject({\n title: 'Quick Redirect',\n content: (<ProgressBar />) as HTMLElement,\n className: 'quick-redirect',\n sizeClass: 'medium',\n center: true,\n })\n .init()\n\n let formRef: HTMLFormElement | null = null\n modal.setContent(\n (\n <form\n ref={(el) => (formRef = el)}\n style={{\n display: 'flex',\n flexDirection: 'column',\n gap: '1rem',\n }}\n onSubmit={(e) => {\n e.preventDefault()\n const formData = new FormData(formRef!)\n const options = {\n from: formData.get('from') as string,\n to: formData.get('to') as string,\n reason: (formData.get('reason') as string) || '',\n overwrite: formData.get('overwrite') === 'on',\n }\n modal.setLoadingState(true)\n this.redirectPage(options)\n .then((res) => {\n modal.close()\n this.ctx.modal.notify('success', {\n title: 'Redirect successful',\n content: 'The redirect has been created.',\n })\n })\n .catch((error) => {\n modal.setLoadingState(false)\n this.ctx.modal.notify('error', {\n title: 'Failed to redirect',\n content: error instanceof Error ? error.message : String(error),\n })\n })\n }}\n >\n <TwinSwapInput\n inputs={[\n {\n label: 'From',\n name: 'from',\n value: options?.from,\n },\n {\n label: 'To',\n name: 'to',\n value: options?.to,\n },\n ]}\n />\n <InputBox label=\"Reason\" id=\"reason\" name=\"reason\" value={options?.reason} />\n <div>\n <CheckBox name=\"overwrite\" id=\"overwrite\" checked={options?.overwrite}>\n Force create redirect even if the from page already exists\n </CheckBox>\n </div>\n <ActionButton type=\"primary\" buttonProps={{ style: { width: '100%' } }}>\n Create Redirect\n </ActionButton>\n </form>\n ) as HTMLFormElement\n )\n\n return modal.show()\n }\n\n async redirectPage(options: RedirectPageOptions) {\n const { from, to, reason = '', overwrite = false } = options\n const wikiPage = await this.ctx.wikiPage.newBlankPage({\n title: from,\n })\n const content = `#REDIRECT [[:${to}]]`\n const res = await wikiPage.edit(\n {\n text: content,\n summary: reason,\n },\n {\n createonly: !overwrite,\n }\n )\n if (res.data?.errors) {\n throw new Error(res.data.errors[0].text, { cause: res })\n }\n return res\n }\n}\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","PluginQuickRedirect"],"mappings":";;;;AAiBO,MAAMA,IAAN,MAAMA,UAA4BC,EAAW;AAAA,EAGlD,YAAmBC,GAAiB;AAClC,UAAMA,GAAK,CAAA,GAAI,gBAAgB,GADd,KAAA,MAAAA;AAAA,EAEnB;AAAA,EAEU,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,gB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AC,IAAY,OAAUhB,GAC/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;AA1JEd,EAAgB,SAAS,CAAC,OAAO,YAAY,OAAO;AAD/C,IAAM0B,IAAN1B;"}
@@ -1,4 +1,4 @@
1
- import { b as C, j as n, a as A, S as m } from "./index-CuEf9G7f.js";
1
+ import { b as C, j as n, a as A, S as m } from "./index-CGg-JS5d.js";
2
2
  import { R as B } from "./Preferences-Bg3J5Ur9.js";
3
3
  import { s as I } from "./sleep-DpyIipK-.js";
4
4
  var j = Object.create, x = Object.defineProperty, q = Object.getOwnPropertyDescriptor, w = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), _ = (t) => {
@@ -138,4 +138,4 @@ T(v, 1, f);
138
138
  export {
139
139
  f as PluginToolbox
140
140
  };
141
- //# sourceMappingURL=index-DA5i7w02.js.map
141
+ //# sourceMappingURL=index-Bz9ciRCe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-DA5i7w02.js","sources":["../src/plugins/toolbox/index.tsx"],"sourcesContent":["import { Inject, InPageEdit, Schema, Service } from '@/InPageEdit'\nimport { ReactElement } from 'jsx-dom'\n\ndeclare module '@/InPageEdit' {\n interface InPageEdit {\n toolbox: PluginToolbox\n }\n interface Events {\n 'toolbox/button/added'(payload: { ctx: InPageEdit; button: HTMLElement }): void\n 'toolbox/button/removed'(payload: { ctx: InPageEdit; id: string }): void\n }\n}\n\n@RegisterPreferences(\n Schema.object({\n toolboxAlwaysShow: Schema.boolean()\n .description('Make the toolbox opened by default')\n .default(false),\n }),\n {\n toolboxAlwaysShow: false,\n }\n)\n@Inject(['preferences'])\nexport class PluginToolbox extends Service {\n container!: HTMLElement\n private forceShow = false\n\n constructor(public ctx: InPageEdit) {\n super(ctx, 'toolbox', false)\n }\n\n protected async start(): Promise<void> {\n if (mw && mw.config.get('wgIsArticle') === false && !this.forceShow) {\n this.container = this.createIndicatorForNotArticlePage()\n } else {\n this.container = this.createToolbox()\n }\n document.body.appendChild(this.container)\n await sleep(0) // wait nextTick\n this.ctx.preferences.get('toolboxAlwaysShow').then((val) => {\n if (val) {\n this.container.querySelector('#toolbox-toggle')?.classList.add('opened')\n this.container.querySelectorAll('.btn-group').forEach((el) => {\n el.classList.add('opened')\n })\n }\n })\n }\n\n protected stop(): void | Promise<void> {\n this.container?.remove()\n }\n\n private createToolbox() {\n const toggler = (\n <button\n className=\"ipe-toolbox-btn\"\n id=\"toolbox-toggle\"\n onClick={function (e) {\n const isOpened = this.classList.contains('opened')\n this.classList.toggle('opened', !isOpened)\n element.querySelectorAll('.btn-group').forEach((el) => {\n el.classList.toggle('opened', !isOpened)\n })\n }}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"icon icon-tabler icons-tabler-outline icon-tabler-plus\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M12 5l0 14\" />\n <path d=\"M5 12l14 0\" />\n </svg>\n </button>\n )\n const element = (\n <div id=\"ipe-edit-toolbox\">\n <ul className=\"btn-group group1\" style={{ display: 'flex', flexDirection: 'column' }}></ul>\n <ul className=\"btn-group group2\" style={{ display: 'flex', flexDirection: 'row' }}></ul>\n {toggler}\n </div>\n )\n\n return element as HTMLElement\n }\n\n private createIndicatorForNotArticlePage() {\n const indicator = (\n <div id=\"ipe-edit-toolbox\">\n <div\n id=\"ipe-toolbox-placeholder\"\n style=\"width: 0.75rem; height: 0.75rem; border-radius: 50%; background: #3f51b5; color: #fff; pointer-events: none;\"\n >\n <svg\n style=\"width: 0.5em; height: 0.5em; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);\"\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=\"4\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"icon icon-tabler icons-tabler-outline icon-tabler-check\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M5 12l5 5l10 -10\" />\n </svg>\n </div>\n </div>\n )\n return indicator as HTMLElement\n }\n\n private normalizeButtonId(id: string) {\n if (!id) {\n id = Math.random().toString(36).substring(2, 8)\n }\n return `ipe-toolbox__${id.trim()}`.replace(/\\s\\.#/g, '-')\n }\n\n addButton(payload: {\n id: string\n group?: 'auto' | 'group1' | 'group2'\n icon: string | HTMLElement | SVGElement | JQuery | ReactElement\n tooltip?: string | HTMLElement | JQuery\n buttonProps?: Record<string, any>\n onClick?: (event: MouseEvent) => void\n index?: number\n }) {\n let { id, group, icon, tooltip, buttonProps, onClick, index } = payload\n id = this.normalizeButtonId(id)\n\n const existingButton = this.container.querySelector(`#${id}`)\n if (existingButton) {\n this.ctx.logger('toolbox').warn(`Button with id ${id} already exists, replacing it.`)\n existingButton.remove()\n }\n\n let groupEl: HTMLElement | null = null\n if (typeof group === 'undefined' || group === 'auto') {\n // 选择按钮最少的那一组,一样多就选第一组\n const group1 = this.container.querySelector('.btn-group.group1') as HTMLElement\n const group2 = this.container.querySelector('.btn-group.group2') as HTMLElement\n const group1Count = group1?.children.length || 0\n const group2Count = group2?.children.length || 0\n groupEl = group1Count <= group2Count ? group1 : group2\n } else {\n groupEl = this.container.querySelector(`.btn-group.${group}`)\n }\n if (!groupEl) throw new Error(`Button group ${group} not found`)\n\n const button = (\n <li class=\"btn-tip-group\" id={id} onClick={onClick}>\n <div class=\"btn-tip\">{tooltip}</div>\n <button id={`${id}-btn`} class=\"ipe-toolbox-btn\" {...buttonProps}>\n {icon}\n </button>\n </li>\n )\n\n if (typeof index === 'number') {\n if (index <= 0) {\n groupEl.prepend(button)\n } else if (index >= groupEl.children.length) {\n groupEl.appendChild(button)\n } else {\n groupEl.children[index]?.before(button)\n }\n } else {\n groupEl.appendChild(button)\n }\n\n this.ctx.emit('toolbox/button/added', {\n ctx: this.ctx,\n button: button as HTMLElement,\n })\n\n return button as HTMLElement\n }\n\n removeButton(id: string) {\n const button = this.container.querySelector(`.ipe-toolbox-btn#${id}`)\n button?.remove()\n this.ctx.emit('toolbox/button/removed', { ctx: this.ctx, id })\n }\n}\n"],"names":["_PluginToolbox_decorators","_init","_a","RegisterPreferences","Schema","Inject","PluginToolbox","Service","ctx","sleep","val","el","element","jsxs","jsx","e","isOpened","id","payload","group","icon","tooltip","buttonProps","onClick","index","existingButton","groupEl","group1","group2","group1Count","group2Count","button","__decoratorStart","__decorateElement","__runInitializers"],"mappings":";;;;;;;;;;;;;;GAAAA,GAAAC,GAAAC;AAaAF,IAAA,CAACG;AAAA,EACCC,EAAO,OAAO;AAAA,IACZ,mBAAmBA,EAAO,QAAA,EACvB,YAAY,oCAAoC,EAChD,QAAQ,EAAK;AAAA,EAAA,CACjB;AAAA,EACD;AAAA,IACE,mBAAmB;AAAA,EAAA;AAEvB,GACCC,EAAO,CAAC,aAAa,CAAC,CAAA;AAChB,MAAMC,WAAsBJ,IAAAK,GAAQ;AAAA,EAIzC,YAAmBC,GAAiB;AAClC,UAAMA,GAAK,WAAW,EAAK,GADV,KAAA,MAAAA,GAHnB,KAAA,YAAA,QACA,KAAQ,YAAY;AAAA,EAIpB;AAAA,EAEA,MAAgB,QAAuB;AACrC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AM,GAG5B,KAAK,IAAI,KAAK,wBAAwB;AAAA,MACpC,KAAK,KAAK;AAAA,MACV,QAAAA;AAAA,IAAA,CACD,GAEMA;AAAA,EACT;AAAA,EAEA,aAAad,GAAY;AAEvB,IADe,KAAK,UAAU,cAAc,oBAAoBA,CAAE,EAAE,GAC5D,OAAA,GACR,KAAK,IAAI,KAAK,0BAA0B,EAAE,KAAK,KAAK,KAAK,IAAAA,GAAI;AAAA,EAC/D;AACF;AA7KOhB,IAAA+B,EAAA9B,CAAA;AAAMI,IAAN2B,yBAXPjC,GAWaM,CAAA;AAAN4B,EAAAjC,GAAA,GAAMK,CAAA;"}
1
+ {"version":3,"file":"index-Bz9ciRCe.js","sources":["../src/plugins/toolbox/index.tsx"],"sourcesContent":["import { Inject, InPageEdit, Schema, Service } from '@/InPageEdit'\nimport { ReactElement } from 'jsx-dom'\n\ndeclare module '@/InPageEdit' {\n interface InPageEdit {\n toolbox: PluginToolbox\n }\n interface Events {\n 'toolbox/button/added'(payload: { ctx: InPageEdit; button: HTMLElement }): void\n 'toolbox/button/removed'(payload: { ctx: InPageEdit; id: string }): void\n }\n}\n\n@RegisterPreferences(\n Schema.object({\n toolboxAlwaysShow: Schema.boolean()\n .description('Make the toolbox opened by default')\n .default(false),\n }),\n {\n toolboxAlwaysShow: false,\n }\n)\n@Inject(['preferences'])\nexport class PluginToolbox extends Service {\n container!: HTMLElement\n private forceShow = false\n\n constructor(public ctx: InPageEdit) {\n super(ctx, 'toolbox', false)\n }\n\n protected async start(): Promise<void> {\n if (mw && mw.config.get('wgIsArticle') === false && !this.forceShow) {\n this.container = this.createIndicatorForNotArticlePage()\n } else {\n this.container = this.createToolbox()\n }\n document.body.appendChild(this.container)\n await sleep(0) // wait nextTick\n this.ctx.preferences.get('toolboxAlwaysShow').then((val) => {\n if (val) {\n this.container.querySelector('#toolbox-toggle')?.classList.add('opened')\n this.container.querySelectorAll('.btn-group').forEach((el) => {\n el.classList.add('opened')\n })\n }\n })\n }\n\n protected stop(): void | Promise<void> {\n this.container?.remove()\n }\n\n private createToolbox() {\n const toggler = (\n <button\n className=\"ipe-toolbox-btn\"\n id=\"toolbox-toggle\"\n onClick={function (e) {\n const isOpened = this.classList.contains('opened')\n this.classList.toggle('opened', !isOpened)\n element.querySelectorAll('.btn-group').forEach((el) => {\n el.classList.toggle('opened', !isOpened)\n })\n }}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"icon icon-tabler icons-tabler-outline icon-tabler-plus\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M12 5l0 14\" />\n <path d=\"M5 12l14 0\" />\n </svg>\n </button>\n )\n const element = (\n <div id=\"ipe-edit-toolbox\">\n <ul className=\"btn-group group1\" style={{ display: 'flex', flexDirection: 'column' }}></ul>\n <ul className=\"btn-group group2\" style={{ display: 'flex', flexDirection: 'row' }}></ul>\n {toggler}\n </div>\n )\n\n return element as HTMLElement\n }\n\n private createIndicatorForNotArticlePage() {\n const indicator = (\n <div id=\"ipe-edit-toolbox\">\n <div\n id=\"ipe-toolbox-placeholder\"\n style=\"width: 0.75rem; height: 0.75rem; border-radius: 50%; background: #3f51b5; color: #fff; pointer-events: none;\"\n >\n <svg\n style=\"width: 0.5em; height: 0.5em; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);\"\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=\"4\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"icon icon-tabler icons-tabler-outline icon-tabler-check\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M5 12l5 5l10 -10\" />\n </svg>\n </div>\n </div>\n )\n return indicator as HTMLElement\n }\n\n private normalizeButtonId(id: string) {\n if (!id) {\n id = Math.random().toString(36).substring(2, 8)\n }\n return `ipe-toolbox__${id.trim()}`.replace(/\\s\\.#/g, '-')\n }\n\n addButton(payload: {\n id: string\n group?: 'auto' | 'group1' | 'group2'\n icon: string | HTMLElement | SVGElement | JQuery | ReactElement\n tooltip?: string | HTMLElement | JQuery\n buttonProps?: Record<string, any>\n onClick?: (event: MouseEvent) => void\n index?: number\n }) {\n let { id, group, icon, tooltip, buttonProps, onClick, index } = payload\n id = this.normalizeButtonId(id)\n\n const existingButton = this.container.querySelector(`#${id}`)\n if (existingButton) {\n this.ctx.logger('toolbox').warn(`Button with id ${id} already exists, replacing it.`)\n existingButton.remove()\n }\n\n let groupEl: HTMLElement | null = null\n if (typeof group === 'undefined' || group === 'auto') {\n // 选择按钮最少的那一组,一样多就选第一组\n const group1 = this.container.querySelector('.btn-group.group1') as HTMLElement\n const group2 = this.container.querySelector('.btn-group.group2') as HTMLElement\n const group1Count = group1?.children.length || 0\n const group2Count = group2?.children.length || 0\n groupEl = group1Count <= group2Count ? group1 : group2\n } else {\n groupEl = this.container.querySelector(`.btn-group.${group}`)\n }\n if (!groupEl) throw new Error(`Button group ${group} not found`)\n\n const button = (\n <li class=\"btn-tip-group\" id={id} onClick={onClick}>\n <div class=\"btn-tip\">{tooltip}</div>\n <button id={`${id}-btn`} class=\"ipe-toolbox-btn\" {...buttonProps}>\n {icon}\n </button>\n </li>\n )\n\n if (typeof index === 'number') {\n if (index <= 0) {\n groupEl.prepend(button)\n } else if (index >= groupEl.children.length) {\n groupEl.appendChild(button)\n } else {\n groupEl.children[index]?.before(button)\n }\n } else {\n groupEl.appendChild(button)\n }\n\n this.ctx.emit('toolbox/button/added', {\n ctx: this.ctx,\n button: button as HTMLElement,\n })\n\n return button as HTMLElement\n }\n\n removeButton(id: string) {\n const button = this.container.querySelector(`.ipe-toolbox-btn#${id}`)\n button?.remove()\n this.ctx.emit('toolbox/button/removed', { ctx: this.ctx, id })\n }\n}\n"],"names":["_PluginToolbox_decorators","_init","_a","RegisterPreferences","Schema","Inject","PluginToolbox","Service","ctx","sleep","val","el","element","jsxs","jsx","e","isOpened","id","payload","group","icon","tooltip","buttonProps","onClick","index","existingButton","groupEl","group1","group2","group1Count","group2Count","button","__decoratorStart","__decorateElement","__runInitializers"],"mappings":";;;;;;;;;;;;;;GAAAA,GAAAC,GAAAC;AAaAF,IAAA,CAACG;AAAA,EACCC,EAAO,OAAO;AAAA,IACZ,mBAAmBA,EAAO,QAAA,EACvB,YAAY,oCAAoC,EAChD,QAAQ,EAAK;AAAA,EAAA,CACjB;AAAA,EACD;AAAA,IACE,mBAAmB;AAAA,EAAA;AAEvB,GACCC,EAAO,CAAC,aAAa,CAAC,CAAA;AAChB,MAAMC,WAAsBJ,IAAAK,GAAQ;AAAA,EAIzC,YAAmBC,GAAiB;AAClC,UAAMA,GAAK,WAAW,EAAK,GADV,KAAA,MAAAA,GAHnB,KAAA,YAAA,QACA,KAAQ,YAAY;AAAA,EAIpB;AAAA,EAEA,MAAgB,QAAuB;AACrC,IAAI,MAAM,GAAG,OAAO,IAAI,aAAa,MAAM,MAAS,CAAC,KAAK,YACxD,KAAK,YAAY,KAAK,iCAAA,IAEtB,KAAK,YAAY,KAAK,cAAA,GAExB,SAAS,KAAK,YAAY,KAAK,SAAS,GACxC,MAAMC,EAAM,CAAC,GACb,KAAK,IAAI,YAAY,IAAI,mBAAmB,EAAE,KAAK,CAACC,MAAQ;AAC1D,MAAIA,MACF,KAAK,UAAU,cAAc,iBAAiB,GAAG,UAAU,IAAI,QAAQ,GACvE,KAAK,UAAU,iBAAiB,YAAY,EAAE,QAAQ,CAACC,MAAO;AAC5D,QAAAA,EAAG,UAAU,IAAI,QAAQ;AAAA,MAC3B,CAAC;AAAA,IAEL,CAAC;AAAA,EACH;AAAA,EAEU,OAA6B;AACrC,SAAK,WAAW,OAAA;AAAA,EAClB;AAAA,E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`script:${e}`, i = document.querySelector(`[data-ipe="${n}"]`);
2979
2981
  return i ? Promise.resolve(i) : new Promise((a, f) => {
2980
2982
  const y = document.createElement("script");
@@ -2984,6 +2986,8 @@ class Bo extends vr {
2984
2986
  });
2985
2987
  }
2986
2988
  loadStyle(e, t) {
2989
+ if (!e)
2990
+ return Promise.resolve(null);
2987
2991
  const n = `style:${e}`, i = document.querySelector(`[data-ipe="${n}"]`);
2988
2992
  return i ? Promise.resolve(i) : new Promise((a, f) => {
2989
2993
  const y = document.createElement("link");
@@ -2995,6 +2999,9 @@ class Bo extends vr {
2995
2999
  })()).before(y), y.onload = () => a(y), y.onerror = (S) => f(S);
2996
3000
  });
2997
3001
  }
3002
+ resolveImportPath(e) {
3003
+ return e.startsWith("http") || e.startsWith("//") ? e : import.meta.resolve(e);
3004
+ }
2998
3005
  }
2999
3006
  const br = Object.keys;
3000
3007
  function Uo(r) {
@@ -5313,14 +5320,14 @@ let Zr = pn;
5313
5320
  *
5314
5321
  * @author dragon-fish <dragon-fish@qq.com>
5315
5322
  * @license MIT
5316
- * @see https://github.com/Dragon-Fish/InPageEdit-v2
5323
+ * @see https://github.com/inpageedit/inpageedit-next
5317
5324
  */
5318
5325
  var Le, ni, ii, oi;
5319
5326
  const mr = class mr extends Hn {
5320
5327
  constructor(t) {
5321
5328
  super();
5322
5329
  $r(this, Le);
5323
- this.Endpoints = ft, this.Schema = Wn, this.version = "0.1.0-dev.20250924", this.config = {
5330
+ this.Endpoints = ft, this.Schema = Wn, this.version = "0.1.1", this.config = {
5324
5331
  ...mr.DEFAULT_CONFIG,
5325
5332
  ...t
5326
5333
  }, nr(this, Le, ni).call(this), nr(this, Le, ii).call(this), nr(this, Le, oi).call(this);
@@ -5336,23 +5343,23 @@ Le = new WeakSet(), ni = async function() {
5336
5343
  this.plugin($o, { baseURL: this.config.baseURL }), this.plugin(Bo), this.plugin(Qr), this.plugin(as), this.plugin(pr), this.plugin(Zr);
5337
5344
  }, ii = async function() {
5338
5345
  [
5339
- import("./index-CL0NhE5n.js").then(({ PluginPreferences: n }) => n),
5340
- import("./index-LoZLvK3o.js").then(({ PluginQuickEdit: n }) => n),
5341
- import("./index-Hed2P8uH.js").then(({ PluginQuickMove: n }) => n),
5342
- import("./index-BEDkPsz1.js").then(
5346
+ import("./index-DIovbA02.js").then(({ PluginPreferences: n }) => n),
5347
+ import("./index-DPXRKwGM.js").then(({ PluginQuickEdit: n }) => n),
5348
+ import("./index-01GVXg9H.js").then(({ PluginQuickMove: n }) => n),
5349
+ import("./index-jJ3Ut97G.js").then(
5343
5350
  ({ PluginQuickPreview: n }) => n
5344
5351
  ),
5345
- import("./index-Bz4cBa1Z.js").then(({ PluginQuickDiff: n }) => n),
5346
- import("./index-sORwn1Vt.js").then(
5352
+ import("./index-M4USLRId.js").then(({ PluginQuickDiff: n }) => n),
5353
+ import("./index-BY3hO6sZ.js").then(
5347
5354
  ({ PluginQuickRedirect: n }) => n
5348
5355
  ),
5349
- import("./index-DA5i7w02.js").then(({ PluginToolbox: n }) => n)
5356
+ import("./index-Bz9ciRCe.js").then(({ PluginToolbox: n }) => n)
5350
5357
  ].forEach(async (n) => {
5351
5358
  this.plugin(await n);
5352
5359
  });
5353
5360
  }, oi = async function() {
5354
5361
  this.inject(["resourceLoader"], (t) => {
5355
- t.resourceLoader.loadStyle(import.meta.resolve("./style.css")), t.resourceLoader.loadStyle(`${ft.PLUGIN_CDN_BASE}/skins/ipe-default.css`);
5362
+ t.resourceLoader.loadStyle(`${ft.PLUGIN_CDN_BASE}/skins/ipe-default.css`);
5356
5363
  });
5357
5364
  }, mr.DEFAULT_CONFIG = {
5358
5365
  baseURL: "",
@@ -5456,4 +5463,4 @@ export {
5456
5463
  vr as b,
5457
5464
  Xr as j
5458
5465
  };
5459
- //# sourceMappingURL=index-CuEf9G7f.js.map
5466
+ //# sourceMappingURL=index-CGg-JS5d.js.map