@inpageedit/core 0.1.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 (86) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +55 -0
  3. package/dist/ActionButton-BhcZX7rl.js +33 -0
  4. package/dist/ActionButton-BhcZX7rl.js.map +1 -0
  5. package/dist/CheckBox-B7zLOm55.js +30 -0
  6. package/dist/CheckBox-B7zLOm55.js.map +1 -0
  7. package/dist/InPageEdit.d.ts +25 -0
  8. package/dist/PluginPreferencesUI-CqQKXQkn.js +33921 -0
  9. package/dist/PluginPreferencesUI-CqQKXQkn.js.map +1 -0
  10. package/dist/Preferences-Bg3J5Ur9.js +9 -0
  11. package/dist/Preferences-Bg3J5Ur9.js.map +1 -0
  12. package/dist/RadioBox-Dl-VRoW0.js +54 -0
  13. package/dist/RadioBox-Dl-VRoW0.js.map +1 -0
  14. package/dist/components/ActionButton.d.ts +9 -0
  15. package/dist/components/CheckBox.d.ts +10 -0
  16. package/dist/components/InputBox.d.ts +11 -0
  17. package/dist/components/MBox/index.d.ts +14 -0
  18. package/dist/components/MwUserLinks.d.ts +4 -0
  19. package/dist/components/ProgressBar/index.d.ts +7 -0
  20. package/dist/components/RadioBox.d.ts +10 -0
  21. package/dist/components/TabView/TabView.d.ts +19 -0
  22. package/dist/components/TwinSwapInput/index.d.ts +18 -0
  23. package/dist/components/utils.d.ts +4 -0
  24. package/dist/constants/endpoints.d.ts +10 -0
  25. package/dist/decorators/Preferences.d.ts +36 -0
  26. package/dist/i18n/languages.json +1527 -0
  27. package/dist/index-BEDkPsz1.js +86 -0
  28. package/dist/index-BEDkPsz1.js.map +1 -0
  29. package/dist/index-Bi1eJIjL.js +83 -0
  30. package/dist/index-Bi1eJIjL.js.map +1 -0
  31. package/dist/index-Bz4cBa1Z.js +1130 -0
  32. package/dist/index-Bz4cBa1Z.js.map +1 -0
  33. package/dist/index-CL0NhE5n.js +155 -0
  34. package/dist/index-CL0NhE5n.js.map +1 -0
  35. package/dist/index-CuEf9G7f.js +5459 -0
  36. package/dist/index-CuEf9G7f.js.map +1 -0
  37. package/dist/index-DA5i7w02.js +141 -0
  38. package/dist/index-DA5i7w02.js.map +1 -0
  39. package/dist/index-Hed2P8uH.js +159 -0
  40. package/dist/index-Hed2P8uH.js.map +1 -0
  41. package/dist/index-LoZLvK3o.js +409 -0
  42. package/dist/index-LoZLvK3o.js.map +1 -0
  43. package/dist/index-sORwn1Vt.js +140 -0
  44. package/dist/index-sORwn1Vt.js.map +1 -0
  45. package/dist/index.d.ts +23 -0
  46. package/dist/index.js +8 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/models/WikiPage/index.d.ts +63 -0
  49. package/dist/models/WikiPage/types/PageInfo.d.ts +56 -0
  50. package/dist/models/WikiPage/types/PageParseData.d.ts +17 -0
  51. package/dist/models/WikiPage/types/WatchlistAction.d.ts +6 -0
  52. package/dist/models/WikiTitle/index.d.ts +12 -0
  53. package/dist/plugins/BasePlugin.d.ts +19 -0
  54. package/dist/plugins/_debug/index.d.ts +8 -0
  55. package/dist/plugins/preferences/PluginPreferencesUI.d.ts +11 -0
  56. package/dist/plugins/preferences/components/hooks.d.ts +5 -0
  57. package/dist/plugins/preferences/index.d.ts +37 -0
  58. package/dist/plugins/quick-diff/JsDiffService.d.ts +23 -0
  59. package/dist/plugins/quick-diff/PluginQuickDiffCore.d.ts +69 -0
  60. package/dist/plugins/quick-diff/components/DiffTable.d.ts +6 -0
  61. package/dist/plugins/quick-diff/index.d.ts +6 -0
  62. package/dist/plugins/quick-edit/PluginQuickEditInArticleLinks.d.ts +14 -0
  63. package/dist/plugins/quick-edit/index.d.ts +52 -0
  64. package/dist/plugins/quick-move/index.d.ts +27 -0
  65. package/dist/plugins/quick-preview/index.d.ts +32 -0
  66. package/dist/plugins/quick-redirect/index.d.ts +24 -0
  67. package/dist/plugins/toolbox/index.d.ts +38 -0
  68. package/dist/polyfills/Promise.withResolvers.d.ts +5 -0
  69. package/dist/polyfills/index.d.ts +0 -0
  70. package/dist/services/ApiService.d.ts +14 -0
  71. package/dist/services/ResourceLoaderService.d.ts +13 -0
  72. package/dist/services/SiteMetadataService.d.ts +53 -0
  73. package/dist/services/SsiModalService.d.ts +35 -0
  74. package/dist/services/StorageService.d.ts +56 -0
  75. package/dist/services/WikiPageService.d.ts +19 -0
  76. package/dist/sleep-DpyIipK-.js +5 -0
  77. package/dist/sleep-DpyIipK-.js.map +1 -0
  78. package/dist/style.css +1 -0
  79. package/dist/types/SiteMetadata.d.ts +133 -0
  80. package/dist/utils/defineAsyncPlugin.d.ts +2 -0
  81. package/dist/utils/noop.d.ts +1 -0
  82. package/dist/utils/schemaValidator.d.ts +12 -0
  83. package/dist/utils/sleep.d.ts +1 -0
  84. package/dist/utils/string.d.ts +7 -0
  85. package/dist/utils/vueReactivity.d.ts +2 -0
  86. package/package.json +81 -0
@@ -0,0 +1,23 @@
1
+ import { InPageEdit as IPECore } from './InPageEdit';
2
+ export { InPageEdit, Service, Schema } from './InPageEdit';
3
+ export { default as BasePlugin } from './plugins/BasePlugin';
4
+ declare global {
5
+ const InPageEdit: typeof IPECore;
6
+ const ipe: IPECore;
7
+ interface Window {
8
+ InPageEdit: typeof IPECore;
9
+ ipe: IPECore;
10
+ __IPE_MODULES__: {
11
+ push(payload: (ipe: IPECore) => void): void;
12
+ };
13
+ }
14
+ }
15
+ declare global {
16
+ interface Window {
17
+ RLQ: {
18
+ push(callback: () => void): void;
19
+ push(depAndCallback: [string, () => void]): void;
20
+ push(depsAndCallback: [string[], () => void]): void;
21
+ };
22
+ }
23
+ }
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ import { B as s, I as i, S as r, b as S } from "./index-CuEf9G7f.js";
2
+ export {
3
+ s as BasePlugin,
4
+ i as InPageEdit,
5
+ r as Schema,
6
+ S as Service
7
+ };
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,63 @@
1
+ import { PageInfo } from './types/PageInfo';
2
+ import { PageParseData } from './types/PageParseData';
3
+ import { WatchlistAction } from './types/WatchlistAction';
4
+ import { MediaWikiApi, MwApiParams } from 'wiki-saikou/browser';
5
+ export declare class WikiPage {
6
+ readonly api: MediaWikiApi;
7
+ pageInfo: PageInfo;
8
+ static readonly DEFAULT_PAGE_INFO: PageInfo;
9
+ constructor(pageInfo: Partial<PageInfo>, api?: MediaWikiApi);
10
+ getPageInfo(payload: MwApiParams): Promise<PageInfo>;
11
+ parse(params?: MwApiParams): Promise<import('fexios').FexiosFinalContext<{
12
+ parse: PageParseData;
13
+ }>>;
14
+ preview(text: string, params?: MwApiParams): Promise<import('fexios').FexiosFinalContext<{
15
+ parse: PageParseData;
16
+ }>>;
17
+ edit(payload: {
18
+ text?: string;
19
+ prependtext?: string;
20
+ appendtext?: string;
21
+ summary?: string;
22
+ watchlist?: WatchlistAction;
23
+ }, params?: MwApiParams): Promise<import('fexios').FexiosFinalContext<any>>;
24
+ createOnly(payload: {
25
+ text: string;
26
+ summary?: string;
27
+ watchlist?: WatchlistAction;
28
+ }, params?: MwApiParams): Promise<import('fexios').FexiosFinalContext<any>>;
29
+ delete(reason?: string, params?: MwApiParams): Promise<import('fexios').FexiosFinalContext<any>>;
30
+ moveTo(title: string, reason?: string, params?: Partial<MwApiParams & {
31
+ movetalk: boolean;
32
+ movesubpages: boolean;
33
+ }>): Promise<import('fexios').FexiosFinalContext<any>>;
34
+ userCan(action: keyof PageInfo['actions']): boolean;
35
+ userCanEdit(): boolean;
36
+ refetch(): Promise<this>;
37
+ get pageid(): number;
38
+ get title(): string;
39
+ get ns(): number;
40
+ get contentmodel(): keyof import('./types/PageInfo').ContentModelMap;
41
+ get fullurl(): string;
42
+ get canonicalurl(): string;
43
+ get editurl(): string | undefined;
44
+ get revisions(): {
45
+ revid: number;
46
+ parentid: number;
47
+ minor: boolean;
48
+ user: string;
49
+ timestamp: string;
50
+ comment: string;
51
+ contentformat: import('./types/PageInfo').ContentModelMap[keyof import('./types/PageInfo').ContentModelMap];
52
+ contentmodel: keyof import('./types/PageInfo').ContentModelMap;
53
+ content: string;
54
+ }[];
55
+ get templates(): {
56
+ ns: number;
57
+ title: string;
58
+ }[];
59
+ get images(): {
60
+ ns: number;
61
+ title: string;
62
+ }[];
63
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @url https://www.mediawiki.org/wiki/Content_handlers
3
+ */
4
+ export type ContentModelMap = {
5
+ css: 'text/css';
6
+ javascript: 'text/javascript';
7
+ json: 'application/json';
8
+ text: 'text/plain';
9
+ wikitext: 'text/x-wiki';
10
+ GeoJson: 'application/json';
11
+ 'sanitized-css': 'text/css';
12
+ Scribunto: 'text/plain';
13
+ 'smw/schema': 'application/json';
14
+ };
15
+ export interface PageInfo {
16
+ pageid: number;
17
+ ns: number;
18
+ title: string;
19
+ contentmodel: keyof ContentModelMap;
20
+ pagelanguage: string;
21
+ pagelanguagehtmlcode: string;
22
+ pagelanguagedir: 'ltr' | 'rtl';
23
+ touched: string;
24
+ lastrevid: number;
25
+ length: number;
26
+ protection: [];
27
+ restrictiontypes: string[];
28
+ fullurl: string;
29
+ canonicalurl: string;
30
+ editurl?: string;
31
+ varianttitles?: Record<string, string>;
32
+ actions: {
33
+ edit: boolean;
34
+ move: boolean;
35
+ delete: boolean;
36
+ };
37
+ revisions?: {
38
+ revid: number;
39
+ parentid: number;
40
+ minor: boolean;
41
+ user: string;
42
+ timestamp: string;
43
+ comment: string;
44
+ contentformat: ContentModelMap[keyof ContentModelMap];
45
+ contentmodel: keyof ContentModelMap;
46
+ content: string;
47
+ }[];
48
+ templates: {
49
+ ns: number;
50
+ title: string;
51
+ }[];
52
+ images: {
53
+ ns: number;
54
+ title: string;
55
+ }[];
56
+ }
@@ -0,0 +1,17 @@
1
+ export interface PageParseData {
2
+ title: string;
3
+ pageid: number;
4
+ text: string;
5
+ langlinks: any[];
6
+ categories: any[];
7
+ links: any[];
8
+ templates: any[];
9
+ images: any[];
10
+ externallinks: string[];
11
+ sections: any[];
12
+ showtoc: boolean;
13
+ parsewarnings: any[];
14
+ displaytitle: string;
15
+ iwlinks: any[];
16
+ properties: any;
17
+ }
@@ -0,0 +1,6 @@
1
+ export declare enum WatchlistAction {
2
+ preferences = "preferences",
3
+ watch = "watch",
4
+ unwatch = "unwatch",
5
+ nochange = "nochange"
6
+ }
@@ -0,0 +1,12 @@
1
+ export declare class WikiTitle {
2
+ readonly namespaceMap: {
3
+ id: number;
4
+ canonical: string;
5
+ aliases: string[];
6
+ };
7
+ constructor(title: string, ns: string | number, namespaceMap: {
8
+ id: number;
9
+ canonical: string;
10
+ aliases: string[];
11
+ });
12
+ }
@@ -0,0 +1,19 @@
1
+ import { InPageEdit, Logger } from '../InPageEdit';
2
+ interface DisposeHandler {
3
+ (ctx: InPageEdit): Promise<void> | void;
4
+ }
5
+ export default class BasePlugin<T extends unknown = any> {
6
+ #private;
7
+ ctx: InPageEdit;
8
+ config: T;
9
+ private disposeHandlers;
10
+ constructor(ctx: InPageEdit, config?: T, name?: string);
11
+ protected start(): Promise<void> | void;
12
+ protected stop(): Promise<void> | void;
13
+ protected addDisposeHandler(fn: DisposeHandler): void;
14
+ protected removeDisposeHandler(fn: DisposeHandler): void;
15
+ set name(name: string);
16
+ get name(): string;
17
+ get logger(): Logger;
18
+ }
19
+ export {};
@@ -0,0 +1,8 @@
1
+ import { InPageEdit } from '../../InPageEdit';
2
+ declare class PluginDebug extends BasePlugin {
3
+ ctx: InPageEdit;
4
+ constructor(ctx: InPageEdit);
5
+ protected start(): Promise<void>;
6
+ showModal(): SsiModal.SsiModal;
7
+ }
8
+ export default PluginDebug;
@@ -0,0 +1,11 @@
1
+ import { InPageEdit } from '../../InPageEdit';
2
+ declare module '../../InPageEdit' {
3
+ interface InPageEdit {
4
+ preferencesUI: PluginPreferencesUI;
5
+ }
6
+ }
7
+ export declare class PluginPreferencesUI extends BasePlugin {
8
+ ctx: InPageEdit;
9
+ constructor(ctx: InPageEdit);
10
+ showModal(): void;
11
+ }
@@ -0,0 +1,5 @@
1
+ import { InPageEdit } from '../../../InPageEdit';
2
+ import { App } from 'vue';
3
+ export declare const IPEInjectKey: unique symbol;
4
+ export declare const injectIPE: (ipe: InPageEdit, app?: App) => InPageEdit;
5
+ export declare const useIPE: () => InPageEdit | undefined;
@@ -0,0 +1,37 @@
1
+ import { InPageEdit, Schema } from '../../InPageEdit';
2
+ import { IPEStorageItem } from '../../services/StorageService';
3
+ declare module '../../InPageEdit' {
4
+ interface InPageEdit {
5
+ preferences: PluginPreferences;
6
+ }
7
+ }
8
+ export interface InPageEditPreferenceUICategory {
9
+ name: string;
10
+ label: string;
11
+ description?: string;
12
+ index?: number;
13
+ }
14
+ export interface InPageEditPreferenceUIRegistryItem {
15
+ name: string;
16
+ schema: Schema;
17
+ defaults: Record<string, any>;
18
+ category: string;
19
+ }
20
+ export declare class PluginPreferences extends BasePlugin {
21
+ ctx: InPageEdit;
22
+ private db;
23
+ customRegistries: InPageEditPreferenceUIRegistryItem[];
24
+ categoryDefinitions: InPageEditPreferenceUICategory[];
25
+ private _defaultPreferences;
26
+ constructor(ctx: InPageEdit);
27
+ start(): Promise<void>;
28
+ get<T = any>(key: string, fallback?: () => T | Promise<T>): Promise<T | null>;
29
+ getDefaultValue(key: string): any;
30
+ set<T = any>(key: string, value: T): Promise<IPEStorageItem<T> | void>;
31
+ getAll(): Promise<Record<string, any>>;
32
+ private loadDefaultConfigs;
33
+ registerCustomConfig(name: string, schema: Schema, category: string, defaults: Record<string, any>): this;
34
+ getConfigRegistries(category?: string): InPageEditPreferenceUIRegistryItem[];
35
+ defineCategory(category: InPageEditPreferenceUICategory): this;
36
+ getConfigCategories(): InPageEditPreferenceUICategory[];
37
+ }
@@ -0,0 +1,23 @@
1
+ import { InPageEdit } from '../../InPageEdit';
2
+ import * as JsDiff from 'diff';
3
+ declare module '../../InPageEdit' {
4
+ interface InPageEdit {
5
+ jsdiff: JsDiffService;
6
+ }
7
+ }
8
+ export type JsDiffDiffType = 'diffChars' | 'diffWords' | 'diffWordsWithSpace' | 'diffLines' | 'diffTrimmedLines' | 'diffSentences' | 'diffCss' | 'diffJson' | 'diffArrays' | 'createTwoFilesPatch';
9
+ export declare class JsDiffService {
10
+ ctx: InPageEdit;
11
+ constructor(ctx: InPageEdit);
12
+ JsDiff: typeof JsDiff;
13
+ diffChars: typeof JsDiff.diffChars;
14
+ diffWords: typeof JsDiff.diffWords;
15
+ diffWordsWithSpace: typeof JsDiff.diffWordsWithSpace;
16
+ diffLines: typeof JsDiff.diffLines;
17
+ diffTrimmedLines: typeof JsDiff.diffTrimmedLines;
18
+ diffSentences: typeof JsDiff.diffSentences;
19
+ diffCss: typeof JsDiff.diffCss;
20
+ diffJson: typeof JsDiff.diffJson;
21
+ diffArrays: typeof JsDiff.diffArrays;
22
+ createTwoFilesPatch: typeof JsDiff.createTwoFilesPatch;
23
+ }
@@ -0,0 +1,69 @@
1
+ import { InPageEdit } from '../../InPageEdit';
2
+ import { JsDiffDiffType } from './JsDiffService';
3
+ declare module '../../InPageEdit' {
4
+ interface InPageEdit {
5
+ quickDiff: PluginQuickDiffCore;
6
+ }
7
+ }
8
+ export interface CompareApiRequestOptions {
9
+ fromtitle: string;
10
+ fromid: number;
11
+ fromrev: number;
12
+ frompst: boolean;
13
+ totitle: string;
14
+ toid: number;
15
+ torev: number;
16
+ torelative?: 'cur' | 'prev' | 'next';
17
+ topst: boolean;
18
+ prop: string;
19
+ difftype: 'table' | 'unified';
20
+ fromtext: string;
21
+ fromsection: string | number;
22
+ fromcontentmodel: string;
23
+ totext: string;
24
+ tosection: string | number;
25
+ tocontentmodel: string;
26
+ }
27
+ export interface CompareApiResponse {
28
+ compare: Partial<{
29
+ fromid: number;
30
+ fromrevid: number;
31
+ fromns: number;
32
+ fromtitle: string;
33
+ fromsize: number;
34
+ fromtimestamp: string;
35
+ fromuser: string;
36
+ fromuserid: number;
37
+ fromcomment: string;
38
+ fromparsedcomment?: string;
39
+ toid: number;
40
+ torevid: number;
41
+ tons: number;
42
+ totitle: string;
43
+ tosize: number;
44
+ totimestamp: string;
45
+ touser: string;
46
+ touserid: number;
47
+ tocomment: string;
48
+ toparsedcomment: string;
49
+ diffsize: number;
50
+ }> & {
51
+ body: string;
52
+ };
53
+ }
54
+ export declare class PluginQuickDiffCore extends BasePlugin {
55
+ ctx: InPageEdit;
56
+ VALID_DIFF_TYPES: JsDiffDiffType[];
57
+ constructor(ctx: InPageEdit);
58
+ protected start(): Promise<void> | void;
59
+ protected stop(): Promise<void> | void;
60
+ private injectHistoryPage;
61
+ private injectQuickEdit;
62
+ simpleTextDiff(oldText: string, newText: string): void;
63
+ /**
64
+ * TODO: 类型体操
65
+ */
66
+ renderJsDiff(oldStr: string, newStr: string, diffType?: JsDiffDiffType): DocumentFragment;
67
+ readonly COMPARE_API_DEFAULT_OPTIONS: Partial<CompareApiRequestOptions>;
68
+ comparePages(options: Partial<CompareApiRequestOptions>): SsiModal.SsiModal;
69
+ }
@@ -0,0 +1,6 @@
1
+ import { JSX } from 'jsx-dom/jsx-runtime';
2
+ import { CompareApiResponse } from '../PluginQuickDiffCore';
3
+ export type DiffTableProps = {
4
+ data: Partial<CompareApiResponse['compare']>;
5
+ } & JSX.IntrinsicElements['table'];
6
+ export declare const DiffTable: (props: DiffTableProps) => import('jsx-dom').ReactElement;
@@ -0,0 +1,6 @@
1
+ import { InPageEdit } from '../../InPageEdit';
2
+ export declare class PluginQuickDiff extends BasePlugin {
3
+ ctx: InPageEdit;
4
+ static readonly inject: string[];
5
+ constructor(ctx: InPageEdit);
6
+ }
@@ -0,0 +1,14 @@
1
+ import { InPageEdit } from '../../InPageEdit';
2
+ import { QuickEditOptions } from '.';
3
+ export declare class PluginQuickEditInArticleLinks extends BasePlugin<{
4
+ wikiBaseUrl: string;
5
+ wikiArticlePath: string;
6
+ wikiArticleBaseUrl: string;
7
+ wikiScriptBaseUrl: string;
8
+ linkClassName: string;
9
+ }> {
10
+ constructor(ctx: InPageEdit);
11
+ protected start(): Promise<void>;
12
+ stop(): void;
13
+ checkEditAnchor(anchor: HTMLAnchorElement): Pick<QuickEditOptions, 'title' | 'section' | 'revision' | 'createOnly'> | null;
14
+ }
@@ -0,0 +1,52 @@
1
+ import { InPageEdit } from '../../InPageEdit';
2
+ import { WikiPage } from '../../models/WikiPage';
3
+ import { WatchlistAction } from '../../models/WikiPage/types/WatchlistAction';
4
+ declare module '../../InPageEdit' {
5
+ interface InPageEdit {
6
+ quickEdit: PluginQuickEdit['quickEdit'];
7
+ }
8
+ interface Events {
9
+ 'quickEdit/initOptions'(payload: Omit<QuickEditInitPayload, 'modal' | 'wikiPage'>): void;
10
+ 'quickEdit/showModal'(payload: Omit<QuickEditInitPayload, 'wikiPage'>): void;
11
+ 'quickEdit/wikiPage'(payload: QuickEditInitPayload): void;
12
+ }
13
+ }
14
+ export interface QuickEditOptions {
15
+ title: string;
16
+ pageId: number;
17
+ revision: number;
18
+ /**
19
+ * - `undefined` for full article edit
20
+ * - `0` for the first section
21
+ * - `"new"` for a new section
22
+ */
23
+ section: number | 'new' | undefined;
24
+ editMinor: boolean;
25
+ editSummary: string;
26
+ createOnly: boolean;
27
+ reloadAfterSave: boolean;
28
+ }
29
+ export interface QuickEditInitPayload {
30
+ ctx: InPageEdit;
31
+ options: QuickEditOptions;
32
+ modal: SsiModal;
33
+ wikiPage: WikiPage;
34
+ }
35
+ export interface QuickEditSubmitPayload {
36
+ text?: string;
37
+ summary?: string;
38
+ minor?: boolean;
39
+ createonly?: boolean;
40
+ watchlist?: WatchlistAction;
41
+ }
42
+ export declare class PluginQuickEdit extends BasePlugin {
43
+ ctx: InPageEdit;
44
+ private readonly DEFAULT_OPTIONS;
45
+ constructor(ctx: InPageEdit);
46
+ protected start(): Promise<void> | void;
47
+ quickEdit(payload?: string | Partial<QuickEditOptions>): Promise<void>;
48
+ private handleSubmit;
49
+ private injectToolbox;
50
+ private getWikiPageFromPayload;
51
+ protected removeToolbox(ctx: InPageEdit): void;
52
+ }
@@ -0,0 +1,27 @@
1
+ import { InPageEdit } from '../../InPageEdit';
2
+ declare module '../../InPageEdit' {
3
+ interface InPageEdit {
4
+ quickMove: PluginQuickMove['quickMove'];
5
+ movePage: PluginQuickMove['movePage'];
6
+ }
7
+ }
8
+ export interface MovePageOptions {
9
+ from: string;
10
+ to: string;
11
+ reason?: string;
12
+ movetalk?: boolean;
13
+ movesubpages?: boolean;
14
+ noredirect?: boolean;
15
+ }
16
+ export interface QuickMoveOptions extends Partial<MovePageOptions> {
17
+ lockFromField?: boolean;
18
+ lockToField?: boolean;
19
+ }
20
+ export declare class PluginQuickMove extends BasePlugin {
21
+ ctx: InPageEdit;
22
+ constructor(ctx: InPageEdit);
23
+ protected start(): Promise<void> | void;
24
+ private injectToolbox;
25
+ quickMove(options?: Partial<QuickMoveOptions>): SsiModal.SsiModal;
26
+ movePage(options: MovePageOptions): Promise<import('fexios').FexiosFinalContext<any>>;
27
+ }
@@ -0,0 +1,32 @@
1
+ import { InPageEdit } from '../../InPageEdit';
2
+ import { WikiPage } from '../../models/WikiPage';
3
+ import { MwApiParams } from 'wiki-saikou';
4
+ import { PageParseData } from '../../models/WikiPage/types/PageParseData';
5
+ declare module '../../InPageEdit' {
6
+ interface InPageEdit {
7
+ quickPreview: PluginQuickPreview['quickPreview'];
8
+ }
9
+ interface Events {
10
+ 'quickPreview/showModal'(payload: {
11
+ ctx: InPageEdit;
12
+ text: string;
13
+ modal: SsiModal;
14
+ wikiPage: WikiPage;
15
+ }): void;
16
+ 'quickPreview/loaded'(payload: {
17
+ ctx: InPageEdit;
18
+ modal: SsiModal;
19
+ wikiPage: WikiPage;
20
+ text: string;
21
+ parseData: PageParseData;
22
+ }): void;
23
+ }
24
+ }
25
+ export declare class PluginQuickPreview extends BasePlugin {
26
+ ctx: InPageEdit;
27
+ constructor(ctx: InPageEdit);
28
+ protected start(): Promise<void> | void;
29
+ protected stop(): Promise<void> | void;
30
+ private injectQuickEdit;
31
+ quickPreview(text: string, params?: MwApiParams, wikiPage?: WikiPage): Promise<void>;
32
+ }
@@ -0,0 +1,24 @@
1
+ import { InPageEdit } from '../../InPageEdit';
2
+ declare module '../../InPageEdit' {
3
+ interface InPageEdit {
4
+ quickRedirect: PluginQuickRedirect['quickRedirect'];
5
+ redirectPage: PluginQuickRedirect['redirectPage'];
6
+ }
7
+ }
8
+ export interface RedirectPageOptions {
9
+ from: string;
10
+ to: string;
11
+ reason?: string;
12
+ overwrite?: boolean;
13
+ }
14
+ export interface QuickRedirectOptions extends Partial<RedirectPageOptions> {
15
+ }
16
+ export declare class PluginQuickRedirect extends BasePlugin {
17
+ ctx: InPageEdit;
18
+ static readonly inject: string[];
19
+ constructor(ctx: InPageEdit);
20
+ protected start(): Promise<void> | void;
21
+ protected stop(): Promise<void> | void;
22
+ quickRedirect(options?: Partial<QuickRedirectOptions>): SsiModal.SsiModal;
23
+ redirectPage(options: RedirectPageOptions): Promise<import('fexios').FexiosFinalContext<any>>;
24
+ }
@@ -0,0 +1,38 @@
1
+ import { InPageEdit, Service } from '../../InPageEdit';
2
+ import { ReactElement } from 'jsx-dom';
3
+ declare module '../../InPageEdit' {
4
+ interface InPageEdit {
5
+ toolbox: PluginToolbox;
6
+ }
7
+ interface Events {
8
+ 'toolbox/button/added'(payload: {
9
+ ctx: InPageEdit;
10
+ button: HTMLElement;
11
+ }): void;
12
+ 'toolbox/button/removed'(payload: {
13
+ ctx: InPageEdit;
14
+ id: string;
15
+ }): void;
16
+ }
17
+ }
18
+ export declare class PluginToolbox extends Service {
19
+ ctx: InPageEdit;
20
+ container: HTMLElement;
21
+ private forceShow;
22
+ constructor(ctx: InPageEdit);
23
+ protected start(): Promise<void>;
24
+ protected stop(): void | Promise<void>;
25
+ private createToolbox;
26
+ private createIndicatorForNotArticlePage;
27
+ private normalizeButtonId;
28
+ addButton(payload: {
29
+ id: string;
30
+ group?: 'auto' | 'group1' | 'group2';
31
+ icon: string | HTMLElement | SVGElement | JQuery | ReactElement;
32
+ tooltip?: string | HTMLElement | JQuery;
33
+ buttonProps?: Record<string, any>;
34
+ onClick?: (event: MouseEvent) => void;
35
+ index?: number;
36
+ }): HTMLElement;
37
+ removeButton(id: string): void;
38
+ }
@@ -0,0 +1,5 @@
1
+ export declare const promiseWithResolvers: <T extends unknown = any>() => {
2
+ promise: Promise<T>;
3
+ resolve: (value: T | PromiseLike<T>) => void;
4
+ reject: (reason?: any) => void;
5
+ };
File without changes
@@ -0,0 +1,14 @@
1
+ import { InPageEdit } from '../InPageEdit';
2
+ import { MwApi } from 'wiki-saikou';
3
+ declare module '../InPageEdit' {
4
+ interface InPageEdit {
5
+ api: MwApi;
6
+ }
7
+ }
8
+ export interface ApiServiceOptions {
9
+ baseURL: string | URL;
10
+ }
11
+ export declare class ApiService {
12
+ ctx: InPageEdit;
13
+ constructor(ctx: InPageEdit, options?: Partial<ApiServiceOptions>);
14
+ }
@@ -0,0 +1,13 @@
1
+ import { InPageEdit, Service } from '../InPageEdit';
2
+ declare module '../InPageEdit' {
3
+ interface InPageEdit {
4
+ resourceLoader: ResourceLoaderService;
5
+ }
6
+ }
7
+ export declare class ResourceLoaderService extends Service {
8
+ ctx: InPageEdit;
9
+ constructor(ctx: InPageEdit);
10
+ protected stop(): void | Promise<void>;
11
+ loadScript(src: string, attrs?: Record<string, any>): Promise<HTMLScriptElement>;
12
+ loadStyle(href: string, attrs?: Record<string, any>): Promise<HTMLLinkElement>;
13
+ }