@inpageedit/core 0.12.1 → 0.13.0-alpha.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.
- package/dist/BasePlugin-Bf2UuIHF.js +64 -0
- package/dist/BasePlugin-Bf2UuIHF.js.map +1 -0
- package/dist/{PluginPrefSync-Ziogy_o-.js → PluginPrefSync-Dn1Xsiqz.js} +6 -4
- package/dist/PluginPrefSync-Dn1Xsiqz.js.map +1 -0
- package/dist/{PluginStoreApp-Bnvyl-Oc.js → PluginStoreApp-CpOLArL7.js} +2 -2
- package/dist/{PluginStoreApp-Bnvyl-Oc.js.map → PluginStoreApp-CpOLArL7.js.map} +1 -1
- package/dist/WatchlistAction-BbNAyryN.js +5 -0
- package/dist/WatchlistAction-BbNAyryN.js.map +1 -0
- package/dist/endpoints-DgyuoRZd.js +1507 -0
- package/dist/endpoints-DgyuoRZd.js.map +1 -0
- package/dist/{index-BvuaLEFc.js → index-2RfILgXm.js} +11 -10
- package/dist/{index-BvuaLEFc.js.map → index-2RfILgXm.js.map} +1 -1
- package/dist/{index-eARjMi7f.js → index-BCdABp0e.js} +23 -22
- package/dist/{index-eARjMi7f.js.map → index-BCdABp0e.js.map} +1 -1
- package/dist/{index-zHTGCjfF.js → index-BJ7_Q1mB.js} +8 -7
- package/dist/{index-zHTGCjfF.js.map → index-BJ7_Q1mB.js.map} +1 -1
- package/dist/{index-Dnmv-xDn.js → index-BNh95-x2.js} +37 -49
- package/dist/index-BNh95-x2.js.map +1 -0
- package/dist/{index-B3FUDhxl.js → index-BQ-cHWkJ.js} +15 -16
- package/dist/{index-B3FUDhxl.js.map → index-BQ-cHWkJ.js.map} +1 -1
- package/dist/{index-B3YJdjxo.js → index-BwdWyHLe.js} +77 -76
- package/dist/{index-B3YJdjxo.js.map → index-BwdWyHLe.js.map} +1 -1
- package/dist/{index-Ccr3YhkP.js → index-CCRMmnwk.js} +10 -9
- package/dist/{index-Ccr3YhkP.js.map → index-CCRMmnwk.js.map} +1 -1
- package/dist/{index-Bd70aDMT.js → index-CnIpUF9x.js} +7 -6
- package/dist/{index-Bd70aDMT.js.map → index-CnIpUF9x.js.map} +1 -1
- package/dist/{index-D5zX93bn.js → index-CyG7_IYz.js} +47 -45
- package/dist/{index-D5zX93bn.js.map → index-CyG7_IYz.js.map} +1 -1
- package/dist/index-DdTiZqwt.js +3744 -0
- package/dist/index-DdTiZqwt.js.map +1 -0
- package/dist/{index-BRjEc8b8.js → index-eSlbrNqF.js} +6 -6
- package/dist/{index-BRjEc8b8.js.map → index-eSlbrNqF.js.map} +1 -1
- package/dist/index.d.ts +1723 -31
- package/dist/index.js +73 -9
- package/dist/index.js.map +1 -1
- package/dist/models/index.js +486 -0
- package/dist/models/index.js.map +1 -0
- package/dist/plugins/index.js +23 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/services/index.js +16 -0
- package/dist/services/index.js.map +1 -0
- package/dist/style.css +1 -1
- package/lib/index.umd.js +10 -10
- package/lib/index.umd.js.map +1 -1
- package/package.json +22 -25
- package/dist/InPageEdit.d.ts +0 -42
- package/dist/PluginPrefSync-Ziogy_o-.js.map +0 -1
- package/dist/__test__/utils/constants.d.ts +0 -3
- package/dist/components/ActionButton.d.ts +0 -6
- package/dist/components/CheckBox.d.ts +0 -10
- package/dist/components/Icon/IconEdit.d.ts +0 -2
- package/dist/components/Icon/IconQuickEdit.d.ts +0 -2
- package/dist/components/InputBox.d.ts +0 -11
- package/dist/components/MBox/index.d.ts +0 -14
- package/dist/components/MwUserLinks.d.ts +0 -6
- package/dist/components/ProgressBar/index.d.ts +0 -7
- package/dist/components/RadioBox.d.ts +0 -10
- package/dist/components/TabView/index.d.ts +0 -19
- package/dist/components/TwinSwapInput/index.d.ts +0 -19
- package/dist/components/index.d.ts +0 -8
- package/dist/components/utils.d.ts +0 -4
- package/dist/constants/endpoints.d.ts +0 -8
- package/dist/decorators/Preferences.d.ts +0 -35
- package/dist/index-DgQNTfPR.js +0 -5829
- package/dist/index-DgQNTfPR.js.map +0 -1
- package/dist/index-Dnmv-xDn.js.map +0 -1
- package/dist/models/MemoryStorage.d.ts +0 -10
- package/dist/models/WikiPage/index.d.ts +0 -76
- package/dist/models/WikiPage/types/PageInfo.d.ts +0 -58
- package/dist/models/WikiPage/types/PageParseData.d.ts +0 -17
- package/dist/models/WikiPage/types/WatchlistAction.d.ts +0 -6
- package/dist/models/WikiTitle/index.d.ts +0 -89
- package/dist/models/WikiTitle/index.spec.d.ts +0 -1
- package/dist/plugins/BasePlugin.d.ts +0 -25
- package/dist/plugins/_debug/index.d.ts +0 -8
- package/dist/plugins/analytics/index.d.ts +0 -41
- package/dist/plugins/in-article-links/index.d.ts +0 -44
- package/dist/plugins/plugin-store/index.d.ts +0 -56
- package/dist/plugins/plugin-store/schema.d.ts +0 -41
- package/dist/plugins/preferences-ui/PluginPrefSync.d.ts +0 -28
- package/dist/plugins/preferences-ui/index.d.ts +0 -48
- package/dist/plugins/quick-diff/components/DiffTable.d.ts +0 -23
- package/dist/plugins/quick-diff/index.d.ts +0 -85
- package/dist/plugins/quick-edit/index.d.ts +0 -79
- package/dist/plugins/quick-move/index.d.ts +0 -47
- package/dist/plugins/quick-preview/index.d.ts +0 -37
- package/dist/plugins/quick-redirect/index.d.ts +0 -48
- package/dist/plugins/toolbox/index.d.ts +0 -65
- package/dist/polyfills/Promise.withResolvers.d.ts +0 -5
- package/dist/polyfills/index.d.ts +0 -0
- package/dist/services/ApiService.d.ts +0 -14
- package/dist/services/CurrentPageService.d.ts +0 -28
- package/dist/services/ModalService.d.ts +0 -27
- package/dist/services/PreferencesService.d.ts +0 -94
- package/dist/services/ResourceLoaderService.d.ts +0 -17
- package/dist/services/WikiMetadataService.d.ts +0 -108
- package/dist/services/WikiPageService.d.ts +0 -20
- package/dist/services/WikiTitleService.d.ts +0 -70
- package/dist/services/storage/index.d.ts +0 -40
- package/dist/services/storage/managers/IDBStorageManager.d.ts +0 -28
- package/dist/services/storage/managers/LocalStorageManager.d.ts +0 -27
- package/dist/types/WikiMetadata.d.ts +0 -131
- package/dist/utils/computeable.d.ts +0 -2
- package/dist/utils/defineAsyncPlugin.d.ts +0 -2
- package/dist/utils/interpolate.d.ts +0 -20
- package/dist/utils/interpolate.spec.d.ts +0 -1
- package/dist/utils/makeCallable.d.ts +0 -3
- package/dist/utils/noop.d.ts +0 -1
- package/dist/utils/sleep.d.ts +0 -1
- package/dist/utils/string.d.ts +0 -7
- package/dist/utils/url.d.ts +0 -24
- package/dist/utils/vueHooks.d.ts +0 -6
- package/dist/utils/vueReactivity.d.ts +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,38 +1,1730 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Context, Events as Events$1, ForkScope, Inject, Inject as Inject$1, Service } from "@cordisjs/core";
|
|
2
|
+
import * as _inpageedit_logger0 from "@inpageedit/logger";
|
|
3
|
+
import { Logger } from "@inpageedit/logger";
|
|
4
|
+
import * as wiki_saikou0 from "wiki-saikou";
|
|
5
|
+
import { FexiosConfigs, MwApiParams } from "wiki-saikou";
|
|
6
|
+
import { FexiosFinalContext, MediaWikiApi, MwApi, MwApiParams as MwApiParams$1, MwApiResponse } from "wiki-saikou/browser";
|
|
7
|
+
import { IPEModal, IPEModalEvent, IPEModalOptions } from "@inpageedit/modal";
|
|
8
|
+
import "@inpageedit/modal/style.css";
|
|
9
|
+
import { IDBPlus } from "idb-plus";
|
|
10
|
+
import "@/styles/index.scss";
|
|
11
|
+
import Schema, { default as Schema$1 } from "schemastery";
|
|
12
|
+
import * as jsx_dom0 from "jsx-dom";
|
|
13
|
+
import { JSX, ReactElement, ReactNode } from "jsx-dom";
|
|
14
|
+
import { JSX as JSX$1 } from "jsx-dom/jsx-runtime";
|
|
15
|
+
import { JSX as JSX$2 } from "vue/jsx-runtime";
|
|
16
|
+
import PreferencesApp from "./plugins/preferences-ui/components/PreferencesApp.vue";
|
|
17
|
+
import { App } from "vue";
|
|
18
|
+
import "./plugins/toolbox/styles.scss";
|
|
19
|
+
export * from "@inpageedit/logger";
|
|
20
|
+
export * from "wiki-saikou/browser";
|
|
21
|
+
export * from "@inpageedit/modal";
|
|
22
|
+
|
|
23
|
+
//#region rolldown:runtime
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/services/ApiService.d.ts
|
|
26
|
+
declare module '@/InPageEdit' {
|
|
27
|
+
interface InPageEdit {
|
|
28
|
+
api: MwApi;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
interface ApiServiceOptions extends Partial<FexiosConfigs> {}
|
|
32
|
+
declare class ApiService {
|
|
33
|
+
ctx: InPageEdit;
|
|
34
|
+
constructor(ctx: InPageEdit, options?: Partial<ApiServiceOptions>);
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/types/WikiMetadata.d.ts
|
|
38
|
+
interface WikiSiteInfo {
|
|
39
|
+
general: WikiSiteGeneralInfo;
|
|
40
|
+
specialpagealiases: WikiSpecialPageAlias[];
|
|
41
|
+
namespacealiases: WikiNameSpaceAlias[];
|
|
42
|
+
magicwords: WikiMagicWord[];
|
|
43
|
+
namespaces: Record<string, WikiNamespace>;
|
|
44
|
+
}
|
|
45
|
+
interface WikiSiteGeneralInfo {
|
|
46
|
+
mainpage: string;
|
|
47
|
+
base: string;
|
|
48
|
+
sitename: string;
|
|
49
|
+
mainpageisdomainroot: boolean;
|
|
50
|
+
logo: string;
|
|
51
|
+
generator: string;
|
|
52
|
+
phpversion: string;
|
|
53
|
+
phpsapi: string;
|
|
54
|
+
dbtype: string;
|
|
55
|
+
dbversion: string;
|
|
56
|
+
imagewhitelistenabled: boolean;
|
|
57
|
+
langconversion: boolean;
|
|
58
|
+
titleconversion: boolean;
|
|
59
|
+
linkprefixcharset: string;
|
|
60
|
+
linkprefix: string;
|
|
61
|
+
linktrail: string;
|
|
62
|
+
legaltitlechars: string;
|
|
63
|
+
invalidusernamechars: string;
|
|
64
|
+
allunicodefixes: boolean;
|
|
65
|
+
fixarabicunicode: boolean;
|
|
66
|
+
fixmalayalamunicode: boolean;
|
|
67
|
+
'git-hash'?: string;
|
|
68
|
+
'git-branch'?: string;
|
|
69
|
+
case: 'first-letter' | string;
|
|
70
|
+
lang: string;
|
|
71
|
+
fallback?: {
|
|
72
|
+
code: string;
|
|
73
|
+
}[];
|
|
74
|
+
variants: {
|
|
75
|
+
code: string;
|
|
76
|
+
name: string;
|
|
77
|
+
}[];
|
|
78
|
+
rtl: boolean;
|
|
79
|
+
fallback8bitEncoding: string;
|
|
80
|
+
readonly: boolean;
|
|
81
|
+
writeapi: boolean;
|
|
82
|
+
maxarticlesize: number;
|
|
83
|
+
timezone: string;
|
|
84
|
+
timeoffset: number;
|
|
85
|
+
articlepath: string;
|
|
86
|
+
scriptpath: string;
|
|
87
|
+
script: string;
|
|
88
|
+
variantarticlepath: string | false;
|
|
89
|
+
server: string;
|
|
90
|
+
servername: string;
|
|
91
|
+
wikiid: string;
|
|
92
|
+
time: string;
|
|
93
|
+
misermode: boolean;
|
|
94
|
+
uploadsenabled: boolean;
|
|
95
|
+
maxuploadsize: number;
|
|
96
|
+
minuploadchunksize: number;
|
|
97
|
+
galleryoptions: {
|
|
98
|
+
imagesPerRow: number;
|
|
99
|
+
imageWidth: number;
|
|
100
|
+
imageHeight: number;
|
|
101
|
+
captionLength: boolean;
|
|
102
|
+
showBytes: boolean;
|
|
103
|
+
showDimensions: boolean;
|
|
104
|
+
mode: 'traditional' | string;
|
|
105
|
+
};
|
|
106
|
+
thumblimits: Record<`${number}`, number>;
|
|
107
|
+
imagelimits: Record<`${number}`, {
|
|
108
|
+
width: number;
|
|
109
|
+
height: number;
|
|
110
|
+
}>;
|
|
111
|
+
favicon: string;
|
|
112
|
+
centralidlookupprovider: string;
|
|
113
|
+
allcentralidlookupproviders: string[];
|
|
114
|
+
interwikimagic: boolean;
|
|
115
|
+
magiclinks: Record<string, boolean>;
|
|
116
|
+
categorycollation: 'uppercase' | string;
|
|
117
|
+
citeresponsivereferences: boolean;
|
|
118
|
+
}
|
|
119
|
+
interface WikiSpecialPageAlias {
|
|
120
|
+
realname: string;
|
|
121
|
+
aliases: string[];
|
|
122
|
+
}
|
|
123
|
+
interface WikiNameSpaceAlias {
|
|
124
|
+
id: number;
|
|
125
|
+
alias: string;
|
|
126
|
+
}
|
|
127
|
+
interface WikiNamespace {
|
|
128
|
+
canonical?: string;
|
|
129
|
+
case: 'first-letter' | string;
|
|
130
|
+
content: boolean;
|
|
131
|
+
id: number;
|
|
132
|
+
name: string;
|
|
133
|
+
namespaceprotection?: string;
|
|
134
|
+
nonincludable: boolean;
|
|
135
|
+
subpages: boolean;
|
|
136
|
+
}
|
|
137
|
+
interface WikiMagicWord {
|
|
138
|
+
name: string;
|
|
139
|
+
aliases: string[];
|
|
140
|
+
'case-sensitive': boolean;
|
|
141
|
+
}
|
|
142
|
+
interface WikiUserInfo extends Partial<WikiUserBlockInfo> {
|
|
143
|
+
id: number;
|
|
144
|
+
name: string;
|
|
145
|
+
groups: string[];
|
|
146
|
+
rights: string[];
|
|
147
|
+
options: WikiUserOptions;
|
|
148
|
+
}
|
|
149
|
+
interface WikiUserBlockInfo {
|
|
150
|
+
blockid: number;
|
|
151
|
+
blockedby: string;
|
|
152
|
+
blockedbyid: string;
|
|
153
|
+
blockreason: string;
|
|
154
|
+
blockedtimestamp: string;
|
|
155
|
+
blockexpiry: string;
|
|
156
|
+
}
|
|
157
|
+
type IntBool = 0 | 1;
|
|
158
|
+
interface WikiUserOptions {
|
|
159
|
+
minordefault: IntBool;
|
|
160
|
+
watchcreations: IntBool;
|
|
161
|
+
watchdefault: IntBool;
|
|
162
|
+
watchdeletion: IntBool;
|
|
163
|
+
watchuploads: IntBool;
|
|
164
|
+
watchmoves: IntBool;
|
|
165
|
+
language: string;
|
|
166
|
+
[key: string]: unknown;
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/models/WikiTitle/index.d.ts
|
|
170
|
+
interface IWikiTitle {
|
|
171
|
+
/**
|
|
172
|
+
* Get db key without namespace prefix
|
|
173
|
+
* e.g. "template:hello world" -> "Hello_world"
|
|
174
|
+
*/
|
|
175
|
+
getMainDBKey(): string;
|
|
176
|
+
/**
|
|
177
|
+
* Get page name without namespace prefix
|
|
178
|
+
* e.g. "template:hello world" -> "Hello world"
|
|
179
|
+
*/
|
|
180
|
+
getMainText(): string;
|
|
181
|
+
/**
|
|
182
|
+
* Get db key with namespace prefix
|
|
183
|
+
* e.g. "template:hello world" -> "Template:Hello_world"
|
|
184
|
+
*/
|
|
185
|
+
getPrefixedDBKey(): string;
|
|
186
|
+
/**
|
|
187
|
+
* Get page name with namespace prefix
|
|
188
|
+
* e.g. "template:hello world" -> "Template:Hello world"
|
|
189
|
+
*/
|
|
190
|
+
getPrefixedText(): string;
|
|
191
|
+
toText: () => string;
|
|
192
|
+
toString: () => string;
|
|
193
|
+
/**
|
|
194
|
+
* Get namespace ID
|
|
195
|
+
* e.g. "template:hello world" -> 10
|
|
196
|
+
*/
|
|
197
|
+
getNamespaceId(): number;
|
|
198
|
+
/**
|
|
199
|
+
* Get namespace text
|
|
200
|
+
* e.g. "template:hello world" -> "Template"
|
|
201
|
+
*/
|
|
202
|
+
getNamespaceText(): string;
|
|
203
|
+
/**
|
|
204
|
+
* Get namespace db key
|
|
205
|
+
* e.g. "template talk:hello world" -> "Template_talk"
|
|
206
|
+
*/
|
|
207
|
+
getNamespaceDBKey(): string;
|
|
208
|
+
/**
|
|
209
|
+
* Get subject page
|
|
210
|
+
* If current page is subject page, return itself
|
|
211
|
+
* e.g. "template talk:hello world" -> new WikiTitle("Template:Hello world")
|
|
212
|
+
*/
|
|
213
|
+
getSubjectPage(): IWikiTitle;
|
|
214
|
+
/**
|
|
215
|
+
* Get talk page
|
|
216
|
+
* If current page is talk page, return itself
|
|
217
|
+
* If current page cannot have talk page, return null
|
|
218
|
+
* e.g. "template:hello world" -> new WikiTitle("Template talk:Hello world")
|
|
219
|
+
*/
|
|
220
|
+
getTalkPage(): IWikiTitle | null;
|
|
221
|
+
/**
|
|
222
|
+
* Get URL of the page
|
|
223
|
+
* e.g. "template:hello world" -> "https://example.com/wiki/Template:Hello_world"
|
|
224
|
+
*/
|
|
225
|
+
getURL(params?: Record<string, string> | URLSearchParams): URL;
|
|
226
|
+
/**
|
|
227
|
+
* Reset current title with given title string
|
|
228
|
+
*/
|
|
229
|
+
setTitle(title: string): IWikiTitle;
|
|
230
|
+
/**
|
|
231
|
+
* Set main title, keep current ns, update dbkey
|
|
232
|
+
*/
|
|
233
|
+
setMainText(mainTitle: string): IWikiTitle;
|
|
234
|
+
/**
|
|
235
|
+
* Set namespace by text
|
|
236
|
+
*/
|
|
237
|
+
setNamespaceText(namespaceText: string): IWikiTitle;
|
|
238
|
+
/**
|
|
239
|
+
* Set namespace by ID
|
|
240
|
+
*/
|
|
241
|
+
setNamespaceId(namespaceId: number): IWikiTitle;
|
|
242
|
+
/**
|
|
243
|
+
* Check if the title is equal to another title
|
|
244
|
+
*/
|
|
245
|
+
equals(other: IWikiTitle | string): boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Check if the title is specific special page
|
|
248
|
+
* e.g. "Special:Diff" is "差异" or "diff" -> true
|
|
249
|
+
*/
|
|
250
|
+
isSpecial(alia: string): boolean;
|
|
251
|
+
newTitle(title: string, namespace?: number): IWikiTitle;
|
|
252
|
+
}
|
|
253
|
+
interface WikiTitleConstructor {
|
|
254
|
+
new (title: string, namespace?: number): IWikiTitle;
|
|
255
|
+
create(title: string, namespace?: number): IWikiTitle;
|
|
256
|
+
}
|
|
257
|
+
declare function createWikiTitleModel(metadata: WikiSiteInfo): WikiTitleConstructor;
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region src/services/CurrentPageService.d.ts
|
|
260
|
+
declare module '@/InPageEdit.js' {
|
|
261
|
+
interface InPageEdit {
|
|
262
|
+
/**
|
|
263
|
+
* Basic information of the current web page
|
|
264
|
+
*/
|
|
265
|
+
currentPage: CurrentPageService;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
declare class CurrentPageService extends Service {
|
|
269
|
+
#private;
|
|
270
|
+
readonly ctx: InPageEdit;
|
|
271
|
+
constructor(ctx: InPageEdit);
|
|
272
|
+
private get logger();
|
|
273
|
+
protected start(): Promise<void>;
|
|
274
|
+
protected stop(): void | Promise<void>;
|
|
275
|
+
url: URL;
|
|
276
|
+
get params(): URLSearchParams;
|
|
277
|
+
get canonicalUrl(): URL | null;
|
|
278
|
+
readonly isMainPage: boolean;
|
|
279
|
+
/**
|
|
280
|
+
* Get the title of the current page by location URL
|
|
281
|
+
* @returns IWikiTitle or null if cannot be determined
|
|
282
|
+
*/
|
|
283
|
+
wikiTitle: IWikiTitle | null;
|
|
284
|
+
get wikiAction(): string;
|
|
285
|
+
}
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region src/services/ResourceLoaderService.d.ts
|
|
288
|
+
declare module '@/InPageEdit' {
|
|
289
|
+
interface InPageEdit {
|
|
290
|
+
resourceLoader: ResourceLoaderService;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
declare class ResourceLoaderService extends Service {
|
|
294
|
+
ctx: InPageEdit;
|
|
295
|
+
constructor(ctx: InPageEdit);
|
|
296
|
+
protected stop(): void | Promise<void>;
|
|
297
|
+
loadScript(src: string, attrs?: Record<string, any>): Promise<HTMLScriptElement | null>;
|
|
298
|
+
loadStyle(href: string, attrs?: Record<string, any>): Promise<HTMLLinkElement | null>;
|
|
299
|
+
removeStyle(href: string): void;
|
|
300
|
+
removeScript(src: string): void;
|
|
301
|
+
removeAll(): void;
|
|
302
|
+
resolveImportPath(path: string): string;
|
|
303
|
+
}
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region src/services/ModalService.d.ts
|
|
306
|
+
declare module '@/InPageEdit' {
|
|
307
|
+
interface InPageEdit {
|
|
308
|
+
modal: ModalService;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
declare class CustomIPEModal extends IPEModal {
|
|
312
|
+
constructor(options?: Partial<IPEModalOptions>);
|
|
313
|
+
private _tmpDisabledActiveInputs?;
|
|
314
|
+
setLoadingState(state: boolean): void;
|
|
315
|
+
}
|
|
316
|
+
declare class ModalService {
|
|
317
|
+
ctx: InPageEdit;
|
|
318
|
+
constructor(ctx: InPageEdit);
|
|
319
|
+
IPEModal: typeof CustomIPEModal;
|
|
320
|
+
IPEModalEvent: typeof IPEModalEvent;
|
|
321
|
+
show: (...args: Parameters<typeof CustomIPEModal.show>) => CustomIPEModal;
|
|
322
|
+
createObject: (...args: Parameters<typeof CustomIPEModal.createObject>) => CustomIPEModal;
|
|
323
|
+
close: typeof IPEModal.close;
|
|
324
|
+
closeAll: typeof IPEModal.closeAll;
|
|
325
|
+
removeAll: typeof IPEModal.removeAll;
|
|
326
|
+
dialog: (...args: Parameters<typeof CustomIPEModal.dialog>) => CustomIPEModal;
|
|
327
|
+
confirm: (...args: Parameters<typeof CustomIPEModal.confirm>) => CustomIPEModal;
|
|
328
|
+
notify: (...args: Parameters<typeof CustomIPEModal.notify>) => CustomIPEModal;
|
|
329
|
+
}
|
|
330
|
+
//#endregion
|
|
331
|
+
//#region src/services/storage/managers/LocalStorageManager.d.ts
|
|
332
|
+
declare class LocalStorageManager<T = unknown> implements AbstractIPEStorageManager<T> {
|
|
333
|
+
dbName?: string | undefined;
|
|
334
|
+
readonly storeName?: string | undefined;
|
|
335
|
+
ttl: number;
|
|
336
|
+
version?: number | undefined;
|
|
337
|
+
engine: 'localStorage' | 'sessionStorage' | 'memory';
|
|
338
|
+
private db;
|
|
339
|
+
constructor(dbName?: string | undefined, storeName?: string | undefined, ttl?: number, version?: number | undefined, engine?: 'localStorage' | 'sessionStorage' | 'memory');
|
|
340
|
+
private makeKey;
|
|
341
|
+
private load;
|
|
342
|
+
private getRaw;
|
|
343
|
+
private setRaw;
|
|
344
|
+
private deleteSync;
|
|
345
|
+
private isExpired;
|
|
346
|
+
get(key: string, ttl?: number, setter?: () => Promise<T> | T): Promise<T | null>;
|
|
347
|
+
set(key: string, value: null | undefined): Promise<void>;
|
|
348
|
+
set(key: string, value: T): Promise<TypedStorageEntry<T>>;
|
|
349
|
+
set(record: Record<string, T | null | undefined>): Promise<Record<string, TypedStorageEntry<T> | void>>;
|
|
350
|
+
has(key: string, ttl?: number): Promise<boolean>;
|
|
351
|
+
delete(key: string): Promise<void>;
|
|
352
|
+
updatedAt(key: string): Promise<number>;
|
|
353
|
+
clear(): Promise<this>;
|
|
354
|
+
keys(): AsyncIterable<string>;
|
|
355
|
+
values(): AsyncIterable<TypedStorageEntry<T>>;
|
|
356
|
+
entries(): AsyncIterable<[string, TypedStorageEntry<T>]>;
|
|
357
|
+
}
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/services/storage/managers/IDBStorageManager.d.ts
|
|
360
|
+
declare class IDBStorageManager<T = unknown> implements AbstractIPEStorageManager<T> {
|
|
361
|
+
readonly dbName: string;
|
|
362
|
+
readonly storeName: string;
|
|
363
|
+
ttl: number;
|
|
364
|
+
version?: number | undefined;
|
|
365
|
+
readonly db: IDBPlus<string, TypedStorageEntry<T>>;
|
|
366
|
+
keys: () => AsyncIterable<string>;
|
|
367
|
+
values: () => AsyncIterable<TypedStorageEntry<T>>;
|
|
368
|
+
entries: () => AsyncIterable<[string, TypedStorageEntry<T>]>;
|
|
369
|
+
constructor(dbName: string, storeName: string, ttl?: number, version?: number | undefined);
|
|
370
|
+
private _clearExpiredEntries;
|
|
371
|
+
get(key: string, ttl?: number, setter?: () => Promise<T> | T): Promise<T | null>;
|
|
372
|
+
set(key: string, value: null | undefined): Promise<void>;
|
|
373
|
+
set(key: string, value: T): Promise<TypedStorageEntry<T>>;
|
|
374
|
+
set(record: Record<string, T | null | undefined>): Promise<Record<string, TypedStorageEntry<T> | void>>;
|
|
375
|
+
has(key: string, ttl?: number): Promise<boolean>;
|
|
376
|
+
delete(key: string): Promise<void>;
|
|
377
|
+
updatedAt(key: string): Promise<number>;
|
|
378
|
+
private loadFromDB;
|
|
379
|
+
private checkIfExpired;
|
|
380
|
+
/**
|
|
381
|
+
* [DANGER] Use with caution!
|
|
382
|
+
* Delete all data from the database.
|
|
383
|
+
*/
|
|
384
|
+
clear(): Promise<this>;
|
|
385
|
+
}
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region src/services/storage/index.d.ts
|
|
388
|
+
declare module '@/InPageEdit' {
|
|
389
|
+
interface InPageEdit {
|
|
390
|
+
storage: StorageService;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
interface StorageServiceConfig {
|
|
394
|
+
dbName: string;
|
|
395
|
+
}
|
|
396
|
+
declare class StorageService extends Service<StorageServiceConfig> {
|
|
397
|
+
config: StorageServiceConfig;
|
|
398
|
+
readonly kv: IDBStorageManager<any>;
|
|
399
|
+
readonly simpleKV: LocalStorageManager<any>;
|
|
400
|
+
readonly memoryKV: LocalStorageManager<any>;
|
|
401
|
+
constructor(ctx: InPageEdit, config: StorageServiceConfig);
|
|
402
|
+
createDatabase<T = any>(storeName: string, ttl?: number, version?: number, engine?: 'indexedDB' | 'localStorage' | 'sessionStorage' | 'memory'): AbstractIPEStorageManager<T>;
|
|
403
|
+
}
|
|
404
|
+
interface TypedStorageEntry<T = any> {
|
|
405
|
+
/** last update time */
|
|
406
|
+
time: number;
|
|
407
|
+
/** stored value */
|
|
408
|
+
value: T;
|
|
409
|
+
/** version */
|
|
410
|
+
version?: number;
|
|
411
|
+
}
|
|
412
|
+
interface AbstractIPEStorageManager<T = unknown> {
|
|
413
|
+
get(key: string, ttl?: number, setter?: () => Promise<any> | any): Promise<T | null>;
|
|
414
|
+
set(key: string, value: null | undefined): Promise<void>;
|
|
415
|
+
set(record: Record<string, T | null | undefined>): Promise<Record<string, TypedStorageEntry<T> | void>>;
|
|
416
|
+
set(key: string, value: T): Promise<TypedStorageEntry<T>>;
|
|
417
|
+
has(key: string, ttl?: number): Promise<boolean>;
|
|
418
|
+
delete(key: string): Promise<void>;
|
|
419
|
+
keys(): AsyncIterable<string>;
|
|
420
|
+
values(): AsyncIterable<TypedStorageEntry<T>>;
|
|
421
|
+
entries(): AsyncIterable<[string, TypedStorageEntry<T>]>;
|
|
422
|
+
updatedAt(key: string): Promise<number>;
|
|
423
|
+
clear(): Promise<this>;
|
|
424
|
+
}
|
|
425
|
+
//#endregion
|
|
426
|
+
//#region src/services/WikiMetadataService.d.ts
|
|
427
|
+
declare module '@/InPageEdit' {
|
|
428
|
+
interface InPageEdit {
|
|
429
|
+
wiki: WikiMetadataService;
|
|
430
|
+
getUrl: WikiMetadataService['getUrl'];
|
|
431
|
+
getSciprtUrl: WikiMetadataService['getSciprtUrl'];
|
|
432
|
+
getMainpageUrl: WikiMetadataService['getMainpageUrl'];
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
interface WikiMetadataKindMap {
|
|
436
|
+
siteinfo: WikiSiteInfo;
|
|
437
|
+
userinfo: WikiUserInfo;
|
|
438
|
+
}
|
|
439
|
+
declare class WikiMetadataService extends Service {
|
|
440
|
+
ctx: InPageEdit;
|
|
441
|
+
private readonly _data;
|
|
442
|
+
private readonly CACHE_VERSION;
|
|
443
|
+
private readonly CACHE_TTL;
|
|
444
|
+
private readonly QUERY_DATA;
|
|
445
|
+
private readonly CACHE_DB;
|
|
446
|
+
constructor(ctx: InPageEdit);
|
|
447
|
+
private get logger();
|
|
448
|
+
private get api();
|
|
449
|
+
readonly mwConfig: {
|
|
450
|
+
get: typeof mw.config.get;
|
|
451
|
+
has: typeof mw.config.exists;
|
|
452
|
+
readonly values: ReturnType<typeof mw.config.get>;
|
|
453
|
+
};
|
|
454
|
+
protected start(): Promise<void>;
|
|
455
|
+
initData<T extends keyof WikiMetadataKindMap>(kind: T, noCache?: boolean): Promise<WikiMetadataKindMap[T]>;
|
|
456
|
+
private getCacheKey;
|
|
457
|
+
fetchFromApi<T extends keyof WikiMetadataKindMap>(kind: T): Promise<WikiMetadataKindMap[T]>;
|
|
458
|
+
fetchFromCache<T extends keyof WikiMetadataKindMap>(kind: T): Promise<WikiMetadataKindMap[T] | null>;
|
|
459
|
+
saveToCache<T extends keyof WikiMetadataKindMap>(kind: T, data: WikiMetadataKindMap[T]): Promise<TypedStorageEntry<WikiSiteInfo | WikiUserInfo>>;
|
|
460
|
+
invalidateCache<T extends keyof WikiMetadataKindMap>(kind: T): Promise<void>;
|
|
461
|
+
get _raw(): WikiMetadataKindMap;
|
|
462
|
+
get siteInfo(): WikiSiteInfo;
|
|
463
|
+
get general(): WikiSiteGeneralInfo;
|
|
464
|
+
get specialPageAliases(): WikiSpecialPageAlias[];
|
|
465
|
+
get namespaceAliases(): WikiNameSpaceAlias[];
|
|
466
|
+
get namespaces(): Record<string, WikiNamespace>;
|
|
467
|
+
get namespaceMap(): {
|
|
468
|
+
id: number;
|
|
469
|
+
canonical: string | undefined;
|
|
470
|
+
aliases: string[];
|
|
471
|
+
}[];
|
|
472
|
+
get magicWords(): WikiMagicWord[];
|
|
473
|
+
get userInfo(): WikiUserInfo;
|
|
474
|
+
get userOptions(): WikiUserOptions;
|
|
475
|
+
get isUserBlocked(): boolean | "" | undefined;
|
|
476
|
+
get userGroups(): string[];
|
|
477
|
+
get userRights(): string[];
|
|
478
|
+
/**
|
|
479
|
+
* Base URL, without trailing slash
|
|
480
|
+
* @example "https://mediawiki.org"
|
|
481
|
+
*/
|
|
482
|
+
get baseUrl(): string;
|
|
483
|
+
/**
|
|
484
|
+
* Home page URL of this wiki
|
|
485
|
+
* @description Generally same as the Mainpage URL,
|
|
486
|
+
* but after MediaWiki 1.34,
|
|
487
|
+
* it can be set to the website root directory.
|
|
488
|
+
* @example "https://mediawiki.org/wiki/Main_Page" (In most cases)
|
|
489
|
+
* @example "https://mediawiki.org/" ($wgMainPageIsDomainRoot = true)
|
|
490
|
+
*/
|
|
491
|
+
get landingPageUrl(): string;
|
|
492
|
+
get mainPageName(): string;
|
|
493
|
+
/**
|
|
494
|
+
* Exact Mainpage URL of this wiki
|
|
495
|
+
* @example "https://mediawiki.org/wiki/Main_Page"
|
|
496
|
+
*/
|
|
497
|
+
get mainPageUrl(): string;
|
|
498
|
+
/**
|
|
499
|
+
* Article path, with the $1 placeholder
|
|
500
|
+
* @example "/wiki/$1"
|
|
501
|
+
*/
|
|
502
|
+
get articlePath(): string;
|
|
503
|
+
/**
|
|
504
|
+
* Script path, without trailing slash
|
|
505
|
+
* @example "/w"
|
|
506
|
+
*/
|
|
507
|
+
get scriptPath(): string;
|
|
508
|
+
/**
|
|
509
|
+
* Article base URL, with the $1 placeholder
|
|
510
|
+
* @example "https://mediawiki.org/wiki/$1"
|
|
511
|
+
*/
|
|
512
|
+
get articleBaseUrl(): string;
|
|
513
|
+
/**
|
|
514
|
+
* Script base URL, without trailing slash
|
|
515
|
+
* @example "https://mediawiki.org/w"
|
|
516
|
+
*/
|
|
517
|
+
get scriptBaseUrl(): string;
|
|
518
|
+
getSciprtUrl(name?: string): string;
|
|
519
|
+
/** Get mainpage URL */
|
|
520
|
+
getMainpageUrl(params?: Record<string, any>): string;
|
|
521
|
+
/** Get page URL by title */
|
|
522
|
+
getUrl(title: string, params?: Record<string, any>): string;
|
|
523
|
+
/** Get page URL by page ID */
|
|
524
|
+
getUrl(pageId: number, params?: Record<string, any>): string;
|
|
525
|
+
hasRight(right: string): boolean;
|
|
526
|
+
hasAnyRight(...rights: string[]): boolean;
|
|
527
|
+
hasEveryRights(...rights: string[]): boolean;
|
|
528
|
+
inGroup(name: string): boolean;
|
|
529
|
+
inAnyGroup(...names: string[]): boolean;
|
|
530
|
+
getBlockInfo(): WikiUserBlockInfo | null;
|
|
531
|
+
}
|
|
532
|
+
//#endregion
|
|
533
|
+
//#region src/models/WikiPage/types/PageInfo.d.ts
|
|
534
|
+
/**
|
|
535
|
+
* @url https://www.mediawiki.org/wiki/Content_handlers
|
|
536
|
+
*/
|
|
537
|
+
type ContentModelMap = {
|
|
538
|
+
css: 'text/css';
|
|
539
|
+
javascript: 'text/javascript';
|
|
540
|
+
json: 'application/json';
|
|
541
|
+
text: 'text/plain';
|
|
542
|
+
wikitext: 'text/x-wiki';
|
|
543
|
+
GeoJson: 'application/json';
|
|
544
|
+
'sanitized-css': 'text/css';
|
|
545
|
+
Scribunto: 'text/plain';
|
|
546
|
+
'smw/schema': 'application/json';
|
|
547
|
+
};
|
|
548
|
+
interface PageInfo {
|
|
549
|
+
pageid: number;
|
|
550
|
+
ns: number;
|
|
551
|
+
title: string;
|
|
552
|
+
contentmodel: keyof ContentModelMap;
|
|
553
|
+
pagelanguage: string;
|
|
554
|
+
pagelanguagehtmlcode: string;
|
|
555
|
+
pagelanguagedir: 'ltr' | 'rtl';
|
|
556
|
+
touched: string;
|
|
557
|
+
lastrevid: number;
|
|
558
|
+
length: number;
|
|
559
|
+
protection: [];
|
|
560
|
+
restrictiontypes: string[];
|
|
561
|
+
fullurl: string;
|
|
562
|
+
canonicalurl: string;
|
|
563
|
+
editurl?: string;
|
|
564
|
+
varianttitles?: Record<string, string>;
|
|
565
|
+
actions: {
|
|
566
|
+
edit: boolean;
|
|
567
|
+
move: boolean;
|
|
568
|
+
delete: boolean;
|
|
569
|
+
};
|
|
570
|
+
revisions?: {
|
|
571
|
+
revid: number;
|
|
572
|
+
parentid: number;
|
|
573
|
+
minor: boolean;
|
|
574
|
+
user: string;
|
|
575
|
+
timestamp: string;
|
|
576
|
+
comment: string;
|
|
577
|
+
contentformat: ContentModelMap[keyof ContentModelMap];
|
|
578
|
+
contentmodel: keyof ContentModelMap;
|
|
579
|
+
content: string;
|
|
580
|
+
}[];
|
|
581
|
+
templates: {
|
|
582
|
+
ns: number;
|
|
583
|
+
title: string;
|
|
584
|
+
}[];
|
|
585
|
+
images: {
|
|
586
|
+
ns: number;
|
|
587
|
+
title: string;
|
|
588
|
+
}[];
|
|
589
|
+
missing?: boolean;
|
|
590
|
+
special?: boolean;
|
|
591
|
+
}
|
|
592
|
+
//#endregion
|
|
593
|
+
//#region src/models/WikiPage/types/PageParseData.d.ts
|
|
594
|
+
interface PageParseData {
|
|
595
|
+
title: string;
|
|
596
|
+
pageid: number;
|
|
597
|
+
text: string;
|
|
598
|
+
langlinks: any[];
|
|
599
|
+
categories: any[];
|
|
600
|
+
links: any[];
|
|
601
|
+
templates: any[];
|
|
602
|
+
images: any[];
|
|
603
|
+
externallinks: string[];
|
|
604
|
+
sections: any[];
|
|
605
|
+
showtoc: boolean;
|
|
606
|
+
parsewarnings: any[];
|
|
607
|
+
displaytitle: string;
|
|
608
|
+
iwlinks: any[];
|
|
609
|
+
properties: any;
|
|
610
|
+
}
|
|
611
|
+
//#endregion
|
|
612
|
+
//#region src/models/WikiPage/types/WatchlistAction.d.ts
|
|
613
|
+
declare enum WatchlistAction {
|
|
614
|
+
preferences = "preferences",
|
|
615
|
+
watch = "watch",
|
|
616
|
+
unwatch = "unwatch",
|
|
617
|
+
nochange = "nochange",
|
|
618
|
+
}
|
|
619
|
+
//#endregion
|
|
620
|
+
//#region src/models/WikiPage/index.d.ts
|
|
621
|
+
interface WikiPageEditPayload {
|
|
622
|
+
text?: string;
|
|
623
|
+
prependtext?: string;
|
|
624
|
+
appendtext?: string;
|
|
625
|
+
summary?: string;
|
|
626
|
+
watchlist?: WatchlistAction;
|
|
627
|
+
section?: number | 'new' | undefined;
|
|
628
|
+
}
|
|
629
|
+
interface IWikiPage {
|
|
630
|
+
pageInfo: PageInfo;
|
|
631
|
+
parse(params?: MwApiParams$1): Promise<FexiosFinalContext<MwApiResponse<{
|
|
632
|
+
parse: PageParseData;
|
|
633
|
+
}>>>;
|
|
634
|
+
preview(text: string, params?: MwApiParams$1): Promise<FexiosFinalContext<MwApiResponse<{
|
|
635
|
+
parse: PageParseData;
|
|
636
|
+
}>>>;
|
|
637
|
+
edit(payload: WikiPageEditPayload, params?: MwApiParams$1): Promise<FexiosFinalContext<MwApiResponse<{
|
|
638
|
+
success: boolean;
|
|
639
|
+
}>>>;
|
|
640
|
+
createOnly(payload: {
|
|
641
|
+
text: string;
|
|
642
|
+
} & Pick<WikiPageEditPayload, 'summary' | 'watchlist'>, params?: MwApiParams$1): Promise<FexiosFinalContext<MwApiResponse<{
|
|
643
|
+
success: boolean;
|
|
644
|
+
}>>>;
|
|
645
|
+
delete(reason?: string, params?: MwApiParams$1): Promise<FexiosFinalContext<MwApiResponse<{
|
|
646
|
+
delete: {
|
|
647
|
+
title: string;
|
|
648
|
+
reason: string;
|
|
649
|
+
logid: boolean;
|
|
650
|
+
};
|
|
651
|
+
}>>>;
|
|
652
|
+
moveTo(title: string, reason?: string, params?: Partial<MwApiParams$1 & {
|
|
653
|
+
movetalk: boolean;
|
|
654
|
+
movesubpages: boolean;
|
|
655
|
+
}>): Promise<FexiosFinalContext<MwApiResponse<{
|
|
656
|
+
success: boolean;
|
|
657
|
+
}>>>;
|
|
658
|
+
userCan(action: keyof PageInfo['actions']): boolean;
|
|
659
|
+
userCanEdit(): boolean;
|
|
660
|
+
reloadSelfInfo(): Promise<this>;
|
|
661
|
+
readonly pageid: PageInfo['pageid'];
|
|
662
|
+
readonly title: PageInfo['title'];
|
|
663
|
+
readonly ns: PageInfo['ns'];
|
|
664
|
+
readonly contentmodel: PageInfo['contentmodel'];
|
|
665
|
+
readonly fullurl: PageInfo['fullurl'];
|
|
666
|
+
readonly canonicalurl: PageInfo['canonicalurl'];
|
|
667
|
+
readonly editurl: PageInfo['editurl'];
|
|
668
|
+
readonly revisions: NonNullable<PageInfo['revisions']>;
|
|
669
|
+
readonly lastrevid: PageInfo['lastrevid'];
|
|
670
|
+
readonly templates: NonNullable<PageInfo['templates']>;
|
|
671
|
+
readonly images: NonNullable<PageInfo['images']>;
|
|
672
|
+
}
|
|
673
|
+
interface WikiPageConstructor {
|
|
674
|
+
new (pageInfo: Partial<PageInfo>, loaded?: boolean): IWikiPage;
|
|
675
|
+
newFromApi(payload: MwApiParams$1): Promise<IWikiPage>;
|
|
676
|
+
newBlankPage(init?: Partial<PageInfo>): IWikiPage;
|
|
677
|
+
/**
|
|
678
|
+
* Create a new WikiPage instance from any kind of identifier
|
|
679
|
+
* priority: revid > pageid > title
|
|
680
|
+
*/
|
|
681
|
+
newFromAnyKind(payload: {
|
|
682
|
+
title?: string;
|
|
683
|
+
pageid?: number;
|
|
684
|
+
revid?: number;
|
|
685
|
+
}): Promise<IWikiPage | null>;
|
|
686
|
+
newBatchFromApi(params: MwApiParams$1 & {
|
|
687
|
+
titles?: string[];
|
|
688
|
+
pageids?: number[];
|
|
689
|
+
revids?: number[];
|
|
690
|
+
}): Promise<IWikiPage[]>;
|
|
691
|
+
}
|
|
692
|
+
declare function createWikiPageModel(api: MediaWikiApi): WikiPageConstructor;
|
|
693
|
+
//#endregion
|
|
694
|
+
//#region src/services/WikiPageService.d.ts
|
|
695
|
+
declare module '@/InPageEdit' {
|
|
696
|
+
interface InPageEdit {
|
|
697
|
+
wikiPage: WikiPageService;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
declare class WikiPageService extends Service {
|
|
701
|
+
ctx: InPageEdit;
|
|
702
|
+
static readonly inject: Inject;
|
|
703
|
+
WikiPage: WikiPageConstructor;
|
|
704
|
+
constructor(ctx: InPageEdit);
|
|
705
|
+
createInstance(payload: Record<string, any>, noCache?: boolean): Promise<IWikiPage>;
|
|
706
|
+
newFromTitle(title: string | IWikiTitle, converttitles?: boolean, rvsection?: number | string, noCache?: boolean): Promise<IWikiPage>;
|
|
707
|
+
newFromPageId(pageid: number, rvsection?: number | string, noCache?: boolean): Promise<IWikiPage>;
|
|
708
|
+
newFromRevision(revid: number, rvsection?: number | string, noCache?: boolean): Promise<IWikiPage>;
|
|
709
|
+
newBlankPage(init?: Partial<PageInfo>): IWikiPage;
|
|
710
|
+
}
|
|
711
|
+
//#endregion
|
|
712
|
+
//#region src/services/WikiTitleService.d.ts
|
|
713
|
+
declare module '@/InPageEdit' {
|
|
714
|
+
interface InPageEdit {
|
|
715
|
+
wikiTitle: WikiTitleService;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
interface WikiLinkMetadata {
|
|
719
|
+
title?: IWikiTitle;
|
|
720
|
+
pageId?: number;
|
|
721
|
+
revId?: number;
|
|
722
|
+
url: URL;
|
|
723
|
+
params: URLSearchParams;
|
|
724
|
+
hash: string;
|
|
725
|
+
action: 'view' | 'edit' | 'create' | 'diff' | string;
|
|
726
|
+
}
|
|
727
|
+
declare class WikiTitleService extends Service {
|
|
728
|
+
ctx: InPageEdit;
|
|
729
|
+
static readonly inject: Inject;
|
|
730
|
+
readonly Title: WikiTitleConstructor;
|
|
731
|
+
constructor(ctx: InPageEdit);
|
|
732
|
+
private readonly logger;
|
|
733
|
+
newTitle(title: string, namespace?: number): IWikiTitle;
|
|
734
|
+
newMainPageTitle(): IWikiTitle;
|
|
735
|
+
newTitleFromUrl(url: string | URL): Promise<any>;
|
|
736
|
+
private _cachedTitles;
|
|
737
|
+
private newTitleFromAnyId;
|
|
738
|
+
newTitleFromPageId(pageId: number): Promise<any>;
|
|
739
|
+
newTitleFromRevision(revId: number): Promise<any>;
|
|
740
|
+
/**
|
|
741
|
+
* Resolve **special** special pages to it's real target
|
|
742
|
+
*
|
|
743
|
+
* If target is self or cannot be resolved, return null
|
|
744
|
+
* @example
|
|
745
|
+
* ```
|
|
746
|
+
* Special:MyPage -> User:<username>
|
|
747
|
+
* Special:Edit/Page_Title -> Page_Title
|
|
748
|
+
* Special:NewSection/Page_Title -> Page_Title (section=new)
|
|
749
|
+
* ```
|
|
750
|
+
*/
|
|
751
|
+
resolveSpecialPageTarget(input: IWikiTitle | string): {
|
|
752
|
+
title: IWikiTitle;
|
|
753
|
+
action?: string | undefined;
|
|
754
|
+
section?: number | 'new' | undefined;
|
|
755
|
+
} | null;
|
|
756
|
+
private readonly wiki;
|
|
757
|
+
/**
|
|
758
|
+
* @example "https://example.com"
|
|
759
|
+
*/
|
|
760
|
+
private readonly wikiBaseUrl;
|
|
761
|
+
/**
|
|
762
|
+
* Article path, with trailing slash
|
|
763
|
+
* @example "/wiki/" (if wgArticlePath is "/wiki/$1")
|
|
764
|
+
*/
|
|
765
|
+
private readonly wikiArticlePath;
|
|
766
|
+
/**
|
|
767
|
+
* Article base URL, with trailing slash
|
|
768
|
+
* @example "https://example.com/wiki/" (if wgArticlePath is "/wiki/$1")
|
|
769
|
+
*/
|
|
770
|
+
private readonly wikiArticleBaseUrl;
|
|
771
|
+
/**
|
|
772
|
+
* Script base URL, **without** trailing slash
|
|
773
|
+
* @example "https://example.com/w" (if wgScriptPath is "/w")
|
|
774
|
+
*/
|
|
775
|
+
private readonly wikiIndexPhpUrl;
|
|
776
|
+
isWikiLink(url: string): boolean;
|
|
777
|
+
static readonly REG_SKIPPED_HREF: RegExp;
|
|
778
|
+
validateHrefAttr(href: string | null): boolean;
|
|
779
|
+
parseWikiLink(link: string | URL): WikiLinkMetadata | null;
|
|
780
|
+
}
|
|
781
|
+
//#endregion
|
|
782
|
+
//#region src/utils/computeable.d.ts
|
|
783
|
+
type ComputeAble<T> = (() => T | Promise<T>) | T;
|
|
784
|
+
//#endregion
|
|
785
|
+
//#region src/services/PreferencesService.d.ts
|
|
786
|
+
declare module '@/InPageEdit' {
|
|
787
|
+
interface InPageEdit {
|
|
788
|
+
preferences: PreferencesService;
|
|
789
|
+
prefs: PreferencesService;
|
|
790
|
+
}
|
|
791
|
+
interface Events {
|
|
792
|
+
'preferences/changed'(payload: {
|
|
793
|
+
ctx: InPageEdit;
|
|
794
|
+
/** original input */
|
|
795
|
+
input: Record<string, unknown>;
|
|
796
|
+
/** changed settings */
|
|
797
|
+
changes: Record<string, unknown>;
|
|
798
|
+
}): void;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
interface InPageEditPreferenceUICategory {
|
|
802
|
+
name: string;
|
|
803
|
+
label: string;
|
|
804
|
+
description?: string;
|
|
805
|
+
index?: number;
|
|
806
|
+
/**
|
|
807
|
+
* 自定义渲染函数
|
|
808
|
+
* @param ctx - InPageEdit 上下文
|
|
809
|
+
* @param onUnmount - 卸载回调,当偏好设置 UI 被卸载时会被调用
|
|
810
|
+
*/
|
|
811
|
+
customRenderer?: (payload: {
|
|
812
|
+
ctx: InPageEdit;
|
|
813
|
+
onMounted: (callback: (container: HTMLElement) => void) => void;
|
|
814
|
+
onUnmount: (callback: () => void) => void;
|
|
815
|
+
}) => Promise<Node> | Node;
|
|
816
|
+
/**
|
|
817
|
+
* 是否自动生成该分类下的表单
|
|
818
|
+
* @default true
|
|
819
|
+
*/
|
|
820
|
+
autoGenerateForm?: boolean;
|
|
821
|
+
}
|
|
822
|
+
interface InPageEditPreferenceUIRegistryItem {
|
|
823
|
+
name: string;
|
|
824
|
+
schema: Schema;
|
|
825
|
+
category: string;
|
|
826
|
+
}
|
|
827
|
+
declare class PreferencesService extends Service {
|
|
828
|
+
ctx: InPageEdit;
|
|
829
|
+
private db;
|
|
830
|
+
customRegistries: InPageEditPreferenceUIRegistryItem[];
|
|
831
|
+
categoryDefinitions: InPageEditPreferenceUICategory[];
|
|
832
|
+
private _defaultPreferences;
|
|
833
|
+
constructor(ctx: InPageEdit);
|
|
834
|
+
get logger(): _inpageedit_logger0.Logger;
|
|
835
|
+
start(): Promise<void>;
|
|
836
|
+
/**
|
|
837
|
+
* 获取配置项的值
|
|
838
|
+
* @param key 配置项的键名
|
|
839
|
+
* @param fallback 当配置项不存在时的回退值
|
|
840
|
+
* @returns
|
|
841
|
+
* - 未提供 key 时,返回所有配置项的键值对
|
|
842
|
+
* - 提供 key 时,返回对应配置项的值,若不存在则返回回退值或 null
|
|
843
|
+
* @tips 你可以通过重载 PreferencesMap 来定义你的配置项类型,以自动获得类型推导
|
|
844
|
+
*/
|
|
845
|
+
get(): Promise<PreferencesMap>;
|
|
846
|
+
get<K extends keyof PreferencesMap>(key: K, fallback?: ComputeAble<PreferencesMap[K]>): Promise<PreferencesMap[K] | null>;
|
|
847
|
+
get<U = unknown>(key: string, fallback?: ComputeAble<U>): Promise<U | null>;
|
|
848
|
+
/**
|
|
849
|
+
* 获取全部注册的配置项以及最终生效的值
|
|
850
|
+
* 未保存的配置项将使用默认值
|
|
851
|
+
*/
|
|
852
|
+
getAll(): Promise<PreferencesMap>;
|
|
853
|
+
set<K extends keyof PreferencesMap>(key: K, value: PreferencesMap[K] | undefined | null): Promise<PreferencesMap[K] | void>;
|
|
854
|
+
set<U = unknown>(key: string, value: U | undefined | null): Promise<U | void>;
|
|
855
|
+
setMany(input: { [K in keyof PreferencesMap]?: PreferencesMap[K] | undefined | null }): Promise<{ [K in keyof PreferencesMap]?: PreferencesMap[K] | undefined | null }>;
|
|
856
|
+
setMany<U = unknown>(input: Record<string, U | undefined | null>): Promise<Record<string, U | undefined | null>>;
|
|
857
|
+
defaultOf<T extends keyof PreferencesMap>(key: T): PreferencesMap[T] | undefined;
|
|
858
|
+
defaultOf<U = unknown>(key: string): U | undefined;
|
|
859
|
+
/**
|
|
860
|
+
* Get exportable configurations
|
|
861
|
+
* - exclude values that are the same as the default value
|
|
862
|
+
* - exclude invalid or undefined values
|
|
863
|
+
* - sort by keys
|
|
864
|
+
*/
|
|
865
|
+
getExportableRecord(configs?: Record<string, unknown>): Promise<Record<string, any>>;
|
|
866
|
+
private loadDefaultConfigs;
|
|
867
|
+
registerCustomConfig(id: string, schema: Schema, category?: string): this;
|
|
868
|
+
getConfigRegistries(category?: string): InPageEditPreferenceUIRegistryItem[];
|
|
869
|
+
getAllSchema(): Schema<PreferencesMap, PreferencesMap>;
|
|
870
|
+
defineCategory(category: InPageEditPreferenceUICategory): this;
|
|
871
|
+
getConfigCategories(): InPageEditPreferenceUICategory[];
|
|
872
|
+
private _migrageFromLegacyMasterDB;
|
|
873
|
+
}
|
|
874
|
+
//#endregion
|
|
875
|
+
//#region src/InPageEdit.d.ts
|
|
876
|
+
interface InPageEditCoreConfig {
|
|
877
|
+
apiConfigs: Partial<FexiosConfigs>;
|
|
878
|
+
legacyPreferences: Record<string, any>;
|
|
879
|
+
logLevel: number;
|
|
880
|
+
storageNamespace: string;
|
|
881
|
+
autoloadStyles: boolean;
|
|
882
|
+
autoInstallCorePlugins: boolean;
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* ✏️ InPageEdit NEXT
|
|
886
|
+
*
|
|
887
|
+
* 🚀 Modular, Extensible Supercharged Plugin for MediaWiki
|
|
888
|
+
*
|
|
889
|
+
* @author dragon-fish <dragon-fish@qq.com>
|
|
890
|
+
* @license MIT
|
|
891
|
+
* @see https://github.com/inpageedit/inpageedit-next
|
|
892
|
+
* @see https://www.ipe.wiki/
|
|
893
|
+
*/
|
|
894
|
+
declare class InPageEdit extends Context {
|
|
895
|
+
#private;
|
|
896
|
+
readonly version: string;
|
|
897
|
+
config: InPageEditCoreConfig;
|
|
898
|
+
static DEFAULT_CONFIG: InPageEditCoreConfig;
|
|
899
|
+
Endpoints: any;
|
|
900
|
+
readonly schema: Schemastery.Static;
|
|
901
|
+
readonly logger: Logger;
|
|
902
|
+
constructor(config?: Partial<InPageEditCoreConfig>);
|
|
903
|
+
withInject(inject: Inject$1): Promise<any>;
|
|
904
|
+
}
|
|
905
|
+
interface PreferencesMap {}
|
|
906
|
+
interface Events<C extends InPageEdit = InPageEdit> extends Events$1<C> {}
|
|
907
|
+
interface InPageEdit {
|
|
908
|
+
[InPageEdit.events]: Events<this>;
|
|
909
|
+
}
|
|
910
|
+
//#endregion
|
|
911
|
+
//#region src/constants/endpoints.d.ts
|
|
912
|
+
declare enum Endpoints {
|
|
913
|
+
ANALYTICS_API_BASE = "https://analytics.ipe.wiki/api/v6",
|
|
914
|
+
ANALYTICS_DASH_URL = "https://analytics.ipe.wiki",
|
|
915
|
+
GITHUB_URL = "https://github.com/inpageedit/inpageedit-next",
|
|
916
|
+
HOME_URL = "https://www.ipe.wiki/",
|
|
917
|
+
UPDATE_LOGS_URL = "https://www.ipe.wiki/changelogs/",
|
|
918
|
+
PLUGIN_REGISTRY_URL = "https://registry.ipe.wiki/registry.v1.json",
|
|
919
|
+
}
|
|
920
|
+
//#endregion
|
|
921
|
+
//#region src/plugins/BasePlugin.d.ts
|
|
922
|
+
interface DisposeHandler {
|
|
923
|
+
(ctx: InPageEdit): Promise<void> | void;
|
|
924
|
+
}
|
|
925
|
+
declare class BasePlugin$1<ConfigType extends unknown = any> {
|
|
926
|
+
#private;
|
|
927
|
+
ctx: InPageEdit;
|
|
928
|
+
config: ConfigType;
|
|
929
|
+
private disposeHandlers;
|
|
930
|
+
/** 依赖注入 */
|
|
931
|
+
static inject?: Inject;
|
|
932
|
+
/** 可重用? */
|
|
933
|
+
static reusable: boolean;
|
|
934
|
+
/** 插件的偏好设置模式 */
|
|
935
|
+
static PreferencesSchema?: Schema;
|
|
936
|
+
constructor(ctx: InPageEdit, config?: ConfigType, name?: string);
|
|
937
|
+
protected start(): Promise<void> | void;
|
|
938
|
+
protected stop(): Promise<void> | void;
|
|
939
|
+
protected addDisposeHandler(fn: DisposeHandler): void;
|
|
940
|
+
protected removeDisposeHandler(fn: DisposeHandler): void;
|
|
941
|
+
set name(name: string);
|
|
942
|
+
get name(): string;
|
|
943
|
+
get logger(): Logger;
|
|
944
|
+
}
|
|
945
|
+
//#endregion
|
|
946
|
+
//#region src/decorators/Preferences.d.ts
|
|
947
|
+
type AnyConstructor<T = any> = new (...args: any[]) => T;
|
|
948
|
+
type PreferenceAugmented<D, C extends AnyConstructor> = C & {
|
|
949
|
+
PreferencesSchema: Schema$1<D>;
|
|
950
|
+
};
|
|
951
|
+
/**
|
|
952
|
+
* Decorator for registering preferences
|
|
953
|
+
*
|
|
954
|
+
* ```ts
|
|
955
|
+
* @RegisterPreferences(
|
|
956
|
+
* Schema.object({
|
|
957
|
+
* foo: Schema.string().description('Foo description'),
|
|
958
|
+
* }),
|
|
959
|
+
* {
|
|
960
|
+
* foo: 'default foo value',
|
|
961
|
+
* }
|
|
962
|
+
* )
|
|
963
|
+
* class Foo {}
|
|
964
|
+
* ```
|
|
965
|
+
*
|
|
966
|
+
* same as:
|
|
967
|
+
*
|
|
968
|
+
* ```ts
|
|
969
|
+
* class Foo {
|
|
970
|
+
* static ConfigSchema = Schema.object({
|
|
971
|
+
* foo: Schema.string().description('Foo description')
|
|
972
|
+
* })
|
|
973
|
+
* static ConfigDefaults = {
|
|
974
|
+
* foo: 'default foo value'
|
|
975
|
+
* }
|
|
976
|
+
* }
|
|
977
|
+
* ```
|
|
978
|
+
*/
|
|
979
|
+
declare function RegisterPreferences<D extends Record<string, any>>(schema: Schema$1<D>): <T extends AnyConstructor>(target: T) => PreferenceAugmented<D, T>;
|
|
980
|
+
//#endregion
|
|
981
|
+
//#region src/components/MBox/index.d.ts
|
|
982
|
+
type MBoxProps = {
|
|
983
|
+
type?: '' | 'default' | 'note' | 'info' | 'tip' | 'success' | 'important' | 'done' | 'warning' | 'caution' | 'error';
|
|
984
|
+
title?: ReactNode;
|
|
985
|
+
content?: ReactNode;
|
|
986
|
+
closeable?: boolean;
|
|
987
|
+
titleProps?: JSX$1.IntrinsicElements['div'];
|
|
988
|
+
contentProps?: JSX$1.IntrinsicElements['div'];
|
|
989
|
+
} & JSX$1.IntrinsicElements['div'];
|
|
990
|
+
type MBoxElement = HTMLElement & {
|
|
991
|
+
close: () => Promise<void>;
|
|
992
|
+
};
|
|
993
|
+
declare const MBox: (props: MBoxProps) => MBoxElement;
|
|
994
|
+
//#endregion
|
|
995
|
+
//#region src/components/ProgressBar/index.d.ts
|
|
996
|
+
declare const ProgressBar: (attrs: JSX$2.IntrinsicElements["div"] & {
|
|
997
|
+
indeterminate?: boolean;
|
|
998
|
+
progress?: number;
|
|
999
|
+
}) => HTMLElement & {
|
|
1000
|
+
setProgress: (progress: number) => void;
|
|
1001
|
+
};
|
|
1002
|
+
//#endregion
|
|
1003
|
+
//#region src/components/TabView/index.d.ts
|
|
1004
|
+
interface TabViewLabelOptions {
|
|
1005
|
+
name: string;
|
|
1006
|
+
children: ReactNode;
|
|
1007
|
+
}
|
|
1008
|
+
declare function TabView({
|
|
1009
|
+
tabs,
|
|
1010
|
+
defaultActiveIndex
|
|
1011
|
+
}: {
|
|
1012
|
+
tabs: (TabViewLabelOptions & {
|
|
1013
|
+
content: ReactNode;
|
|
1014
|
+
})[];
|
|
1015
|
+
defaultActiveIndex?: number;
|
|
1016
|
+
}): jsx_dom0.ReactElement;
|
|
1017
|
+
declare function TabLabel({
|
|
1018
|
+
name,
|
|
1019
|
+
children
|
|
1020
|
+
}: {
|
|
1021
|
+
name: string;
|
|
1022
|
+
children: ReactNode;
|
|
1023
|
+
}): jsx_dom0.ReactElement;
|
|
1024
|
+
declare function TabContent({
|
|
1025
|
+
name,
|
|
1026
|
+
children
|
|
1027
|
+
}: {
|
|
1028
|
+
name: string;
|
|
1029
|
+
children: ReactNode;
|
|
1030
|
+
}): jsx_dom0.ReactElement;
|
|
1031
|
+
//#endregion
|
|
1032
|
+
//#region src/components/TwinSwapInput/index.d.ts
|
|
1033
|
+
type TwinSwapInputProps = {
|
|
1034
|
+
inputs: [TwinSwapInputInput, TwinSwapInputInput];
|
|
1035
|
+
enableSwap?: boolean;
|
|
1036
|
+
} & JSX$1.IntrinsicElements['div'];
|
|
1037
|
+
interface TwinSwapInputInput {
|
|
1038
|
+
label?: string;
|
|
1039
|
+
id?: string;
|
|
1040
|
+
name: string;
|
|
1041
|
+
value?: string;
|
|
1042
|
+
disabled?: boolean;
|
|
1043
|
+
required?: boolean;
|
|
1044
|
+
inputProps?: Omit<JSX$1.IntrinsicElements['input'], 'name' | 'value'>;
|
|
1045
|
+
}
|
|
1046
|
+
type TwinSwapElement = HTMLDivElement & {
|
|
1047
|
+
swap: () => void;
|
|
1048
|
+
toggleEnableSwap: (enable?: boolean) => void;
|
|
1049
|
+
};
|
|
1050
|
+
declare const TwinSwapInput: (props: TwinSwapInputProps) => TwinSwapElement;
|
|
1051
|
+
//#endregion
|
|
1052
|
+
//#region src/components/ActionButton.d.ts
|
|
1053
|
+
interface ActionButtonProps {
|
|
1054
|
+
type?: 'primary' | 'secondary' | 'danger' | 'default';
|
|
1055
|
+
tag?: 'a' | 'button' | 'div';
|
|
1056
|
+
}
|
|
1057
|
+
declare const ActionButton: ({
|
|
1058
|
+
type,
|
|
1059
|
+
tag,
|
|
1060
|
+
href,
|
|
1061
|
+
target,
|
|
1062
|
+
children,
|
|
1063
|
+
...rest
|
|
1064
|
+
}: ActionButtonProps & Omit<JSX.IntrinsicElements["button"], "type"> & JSX.IntrinsicElements["a"]) => HTMLAnchorElement;
|
|
1065
|
+
//#endregion
|
|
1066
|
+
//#region src/components/CheckBox.d.ts
|
|
1067
|
+
type CheckBoxProps = {
|
|
1068
|
+
id?: string;
|
|
1069
|
+
name: string;
|
|
1070
|
+
label?: string | HTMLElement;
|
|
1071
|
+
checked?: boolean;
|
|
1072
|
+
inputProps?: JSX.IntrinsicElements['input'];
|
|
1073
|
+
labelProps?: JSX.IntrinsicElements['span'];
|
|
1074
|
+
} & JSX.IntrinsicElements['label'];
|
|
1075
|
+
declare const CheckBox: (props: CheckBoxProps) => jsx_dom0.ReactElement;
|
|
1076
|
+
//#endregion
|
|
1077
|
+
//#region src/components/InputBox.d.ts
|
|
1078
|
+
type InputBoxProps = {
|
|
1079
|
+
label: string;
|
|
1080
|
+
id?: string;
|
|
1081
|
+
name: string;
|
|
1082
|
+
value?: string;
|
|
1083
|
+
disabled?: boolean;
|
|
1084
|
+
labelProps?: JSX.IntrinsicElements['label'];
|
|
1085
|
+
inputProps?: JSX.IntrinsicElements['input'];
|
|
1086
|
+
} & JSX.IntrinsicElements['div'];
|
|
1087
|
+
declare const InputBox: (props: InputBoxProps) => jsx_dom0.ReactElement;
|
|
1088
|
+
//#endregion
|
|
1089
|
+
//#region src/components/RadioBox.d.ts
|
|
1090
|
+
type RadioBoxProps = {
|
|
1091
|
+
id?: string;
|
|
1092
|
+
name: string;
|
|
1093
|
+
value: string;
|
|
1094
|
+
label?: string | HTMLElement;
|
|
1095
|
+
inputProps?: JSX.IntrinsicElements['input'];
|
|
1096
|
+
labelProps?: JSX.IntrinsicElements['span'];
|
|
1097
|
+
} & JSX.IntrinsicElements['label'];
|
|
1098
|
+
declare const RadioBox: (props: RadioBoxProps) => jsx_dom0.ReactElement;
|
|
1099
|
+
//#endregion
|
|
1100
|
+
//#region src/models/MemoryStorage.d.ts
|
|
1101
|
+
declare class MemoryStorage implements Storage {
|
|
1102
|
+
private values;
|
|
1103
|
+
get length(): number;
|
|
1104
|
+
clear(): void;
|
|
1105
|
+
getItem(key: string): string | null;
|
|
1106
|
+
setItem(key: string, value: string): void;
|
|
1107
|
+
removeItem(key: string): void;
|
|
1108
|
+
key(index: number): string | null;
|
|
1109
|
+
}
|
|
1110
|
+
declare const useMemoryStorage: () => MemoryStorage;
|
|
1111
|
+
//#endregion
|
|
1112
|
+
//#region src/plugins/analytics/index.d.ts
|
|
1113
|
+
declare module '@/InPageEdit' {
|
|
1114
|
+
interface InPageEdit {
|
|
1115
|
+
analytics: PluginAnalytics;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
interface IPEBeaconPayload {
|
|
1119
|
+
siteApi: string;
|
|
1120
|
+
siteName?: string;
|
|
1121
|
+
userId: number;
|
|
1122
|
+
userName: string;
|
|
1123
|
+
version?: string;
|
|
1124
|
+
usages: IPEBeaconUsage[];
|
|
1125
|
+
}
|
|
1126
|
+
interface IPEBeaconUsage {
|
|
1127
|
+
ts: number;
|
|
1128
|
+
feature: string;
|
|
1129
|
+
subtype?: string;
|
|
1130
|
+
page?: string;
|
|
1131
|
+
}
|
|
1132
|
+
declare class PluginAnalytics extends BasePlugin {
|
|
1133
|
+
ctx: InPageEdit;
|
|
1134
|
+
private _usages;
|
|
1135
|
+
private _timer;
|
|
1136
|
+
private readonly MAX_QUEUE_SIZE;
|
|
1137
|
+
private readonly INTERVAL_MS;
|
|
1138
|
+
constructor(ctx: InPageEdit);
|
|
1139
|
+
protected start(): Promise<void> | void;
|
|
1140
|
+
private get analyticsDashUrl();
|
|
1141
|
+
private get analyticsApiBase();
|
|
1142
|
+
private _setupTimer;
|
|
1143
|
+
private _registerUnloadHandler;
|
|
1144
|
+
private _showConfirmNotify;
|
|
1145
|
+
private _initPluginListeners;
|
|
1146
|
+
addEvent(feature: string, subtype?: string, page?: string): this;
|
|
1147
|
+
private sendBeacon;
|
|
1148
|
+
/**
|
|
1149
|
+
* 清理资源
|
|
1150
|
+
*/
|
|
1151
|
+
protected stop(): void;
|
|
1152
|
+
}
|
|
1153
|
+
//#endregion
|
|
1154
|
+
//#region src/plugins/in-article-links/index.d.ts
|
|
1155
|
+
declare module '@/InPageEdit' {
|
|
1156
|
+
interface InPageEdit {
|
|
1157
|
+
inArticleLinks: PluginInArticleLinks;
|
|
1158
|
+
}
|
|
1159
|
+
interface Events {
|
|
1160
|
+
'in-article-links/anchor-parsed'(payload: {
|
|
1161
|
+
ctx: InPageEdit;
|
|
1162
|
+
anchor: HTMLAnchorElement;
|
|
1163
|
+
info: InArticleWikiAnchorMetadata;
|
|
1164
|
+
}): void;
|
|
1165
|
+
'in-article-links/anchor-clicked'(payload: {
|
|
1166
|
+
ctx: InPageEdit;
|
|
1167
|
+
anchor: HTMLAnchorElement;
|
|
1168
|
+
info: InArticleWikiAnchorMetadata;
|
|
1169
|
+
event: MouseEvent;
|
|
1170
|
+
action: 'quickEdit' | 'quickDiff';
|
|
1171
|
+
}): void;
|
|
1172
|
+
}
|
|
1173
|
+
interface PreferencesMap {
|
|
1174
|
+
'inArticleLinks.quickEdit.enable': boolean;
|
|
1175
|
+
'inArticleLinks.quickDiff.enable': boolean;
|
|
1176
|
+
'inArticleLinks.quickEdit.redlinks': boolean;
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
interface InArticleWikiAnchorMetadata extends WikiLinkMetadata {
|
|
1180
|
+
$el: HTMLAnchorElement;
|
|
1181
|
+
kind: 'normal' | 'mw:File';
|
|
1182
|
+
external: boolean;
|
|
1183
|
+
redlink: boolean;
|
|
1184
|
+
}
|
|
1185
|
+
declare class PluginInArticleLinks extends BasePlugin<{
|
|
1186
|
+
linkClassName: string;
|
|
1187
|
+
}> {
|
|
1188
|
+
constructor(ctx: InPageEdit);
|
|
1189
|
+
protected start(): Promise<void>;
|
|
1190
|
+
protected stop(): Promise<void>;
|
|
1191
|
+
private _cachedAnchorInfo;
|
|
1192
|
+
parseAnchor(anchor: HTMLAnchorElement): InArticleWikiAnchorMetadata | null;
|
|
1193
|
+
scanAnchors(parent: HTMLElement, filter?: (info: InArticleWikiAnchorMetadata) => boolean): InArticleWikiAnchorMetadata[];
|
|
1194
|
+
handleQuickEdit(): Promise<void>;
|
|
1195
|
+
handleQuickDiff(): void;
|
|
1196
|
+
}
|
|
1197
|
+
//#endregion
|
|
1198
|
+
//#region src/plugins/plugin-store/schema.d.ts
|
|
1199
|
+
interface PluginStoreRegistry {
|
|
1200
|
+
manifest_version: number;
|
|
1201
|
+
name: string;
|
|
1202
|
+
base_url: string;
|
|
1203
|
+
homepage?: string;
|
|
1204
|
+
maintainers?: PluginStoreRegistryMaintainer[];
|
|
1205
|
+
repository?: PluginStoreRegistryRepository;
|
|
1206
|
+
packages: PluginStorePackage[];
|
|
1207
|
+
}
|
|
1208
|
+
interface PluginStoreRegistryMaintainer {
|
|
1209
|
+
name: string;
|
|
1210
|
+
email?: string;
|
|
1211
|
+
}
|
|
1212
|
+
interface PluginStoreRegistryRepository {
|
|
1213
|
+
type: 'git';
|
|
1214
|
+
url: string;
|
|
1215
|
+
}
|
|
1216
|
+
interface PluginStorePackage {
|
|
1217
|
+
id: string;
|
|
1218
|
+
name: string;
|
|
1219
|
+
version: string;
|
|
1220
|
+
description?: string;
|
|
1221
|
+
author?: string;
|
|
1222
|
+
license?: string;
|
|
1223
|
+
loader: PluginStorePackageLoader;
|
|
1224
|
+
}
|
|
1225
|
+
interface PluginStorePackageLoader {
|
|
1226
|
+
kind: 'autoload' | 'module' | 'umd' | 'styles';
|
|
1227
|
+
entry?: string;
|
|
1228
|
+
styles?: string[];
|
|
1229
|
+
main_export?: string;
|
|
1230
|
+
}
|
|
1231
|
+
declare namespace PluginStoreSchemas {
|
|
1232
|
+
const PackageLoader: Schema$1<PluginStorePackageLoader, PluginStorePackageLoader>;
|
|
1233
|
+
const Package: Schema$1<PluginStorePackage, PluginStorePackage>;
|
|
1234
|
+
const RegistryMaintainer: Schema$1<PluginStoreRegistryMaintainer, PluginStoreRegistryMaintainer>;
|
|
1235
|
+
const RegistryRepository: Schema$1<PluginStoreRegistryRepository, PluginStoreRegistryRepository>;
|
|
1236
|
+
const Registry: Schema$1<PluginStoreRegistry, PluginStoreRegistry>;
|
|
1237
|
+
}
|
|
1238
|
+
//#endregion
|
|
1239
|
+
//#region src/plugins/plugin-store/index.d.ts
|
|
1240
|
+
declare module '@/InPageEdit' {
|
|
1241
|
+
interface InPageEdit {
|
|
1242
|
+
store: PluginPluginStore;
|
|
1243
|
+
}
|
|
1244
|
+
interface PreferencesMap {
|
|
1245
|
+
'pluginStore.registries': string[];
|
|
1246
|
+
'pluginStore.plugins': {
|
|
1247
|
+
source?: 'online_manifest' | 'npm';
|
|
1248
|
+
registry: string;
|
|
1249
|
+
id: string;
|
|
1250
|
+
}[];
|
|
1251
|
+
'pluginStore.cdnForNpm': string;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
type PluginStoreRegistrySource = 'online_manifest' | 'npm';
|
|
1255
|
+
declare class PluginPluginStore extends BasePlugin {
|
|
1256
|
+
ctx: InPageEdit;
|
|
1257
|
+
static readonly PluginStoreSchemas: typeof PluginStoreSchemas;
|
|
1258
|
+
static REGISTRY_INFO_CACHE_TTL: number;
|
|
1259
|
+
static REGISTRY_INFO_STORAGE_NAME: string;
|
|
1260
|
+
static REGISTRY_ETAG_STORAGE_NAME: string;
|
|
1261
|
+
private regInfoDB;
|
|
1262
|
+
constructor(ctx: InPageEdit);
|
|
1263
|
+
protected start(): Promise<void>;
|
|
1264
|
+
private _installUserPlugins;
|
|
1265
|
+
private _createManagementApp;
|
|
1266
|
+
private _injectPreferenceUI;
|
|
1267
|
+
showModal(): Promise<CustomIPEModal>;
|
|
1268
|
+
private _installedPlugins;
|
|
1269
|
+
install(registry: string, id: string, source?: PluginStoreRegistrySource): Promise<ForkScope<InPageEdit> | null>;
|
|
1270
|
+
uninstall(registry: string, id: string): Promise<boolean>;
|
|
1271
|
+
addToPreferences(registry: string, id: string): Promise<boolean>;
|
|
1272
|
+
removeFromPreferences(registry: string, id: string): Promise<boolean>;
|
|
1273
|
+
installAndSetPreference(registry: string, id: string): Promise<ForkScope<InPageEdit> | null>;
|
|
1274
|
+
uninstallAndRemovePreference(registry: string, id: string): Promise<boolean>;
|
|
1275
|
+
private _installOneByRegistryInfo;
|
|
1276
|
+
validateRegistry(data: any): PluginStoreRegistry;
|
|
1277
|
+
getRegistryInfo(registry: string, source?: PluginStoreRegistrySource, noCache?: boolean): Promise<PluginStoreRegistry>;
|
|
1278
|
+
private _onlineRegistryQueries;
|
|
1279
|
+
private _fetchOnlineRegistryInfo;
|
|
1280
|
+
private getRegistryCache;
|
|
1281
|
+
private setRegistryCache;
|
|
1282
|
+
private deleteRegistryCache;
|
|
1283
|
+
clearAllRegistryCaches(): Promise<void>;
|
|
1284
|
+
/**
|
|
1285
|
+
* 刷新指定 registry 的缓存(重新从网络获取)
|
|
1286
|
+
*/
|
|
1287
|
+
refreshRegistryCache(registry: string): Promise<PluginStoreRegistry>;
|
|
1288
|
+
/**
|
|
1289
|
+
* 刷新所有已配置的 registry 缓存
|
|
1290
|
+
*/
|
|
1291
|
+
refreshAllRegistryCaches(): Promise<Record<string, PluginStoreRegistry | null>>;
|
|
1292
|
+
}
|
|
1293
|
+
//#endregion
|
|
1294
|
+
//#region src/plugins/preferences-ui/index.d.ts
|
|
1295
|
+
declare module '@/InPageEdit' {
|
|
1296
|
+
interface InPageEdit {
|
|
1297
|
+
preferencesUI: PluginPreferencesUI;
|
|
1298
|
+
}
|
|
1299
|
+
interface Events {
|
|
1300
|
+
'preferences-ui/modal-shown'(payload: {
|
|
1301
|
+
ctx: InPageEdit;
|
|
1302
|
+
modal: CustomIPEModal;
|
|
1303
|
+
}): void;
|
|
1304
|
+
'preferences-ui/vue-app-mounted'(payload: {
|
|
1305
|
+
ctx: InPageEdit;
|
|
1306
|
+
app: App;
|
|
1307
|
+
form: InstanceType<typeof PreferencesApp>;
|
|
1308
|
+
}): void;
|
|
1309
|
+
'preferences-ui/modal-tab-changed'(payload: {
|
|
1310
|
+
ctx: InPageEdit;
|
|
1311
|
+
category: string;
|
|
1312
|
+
$tabContent: HTMLElement;
|
|
1313
|
+
}): void;
|
|
1314
|
+
'preferences-ui/form-data-saved'(payload: {
|
|
1315
|
+
ctx: InPageEdit;
|
|
1316
|
+
data: Record<string, unknown>;
|
|
1317
|
+
}): void;
|
|
1318
|
+
'preferences-ui/modal-closed'(payload: {
|
|
1319
|
+
ctx: InPageEdit;
|
|
1320
|
+
modal: CustomIPEModal;
|
|
1321
|
+
}): void;
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
declare class PluginPreferencesUI extends BasePlugin {
|
|
1325
|
+
ctx: InPageEdit;
|
|
1326
|
+
constructor(ctx: InPageEdit);
|
|
1327
|
+
protected start(): Promise<void>;
|
|
1328
|
+
protected stop(): Promise<void> | void;
|
|
1329
|
+
_modal: CustomIPEModal | null;
|
|
1330
|
+
_form: InstanceType<typeof PreferencesApp> | null;
|
|
1331
|
+
showModal(): CustomIPEModal;
|
|
1332
|
+
getCurrentModal(): CustomIPEModal | null;
|
|
1333
|
+
closeCurrentModal(): CustomIPEModal | undefined;
|
|
1334
|
+
dispatchFormSave(form?: InstanceType<typeof PreferencesApp>): Promise<boolean>;
|
|
1335
|
+
getCurrentFormValue(): any;
|
|
1336
|
+
mergeFormValue(value: Record<string, unknown>): boolean;
|
|
1337
|
+
createPreferencesUIApp(): any;
|
|
1338
|
+
}
|
|
1339
|
+
//#endregion
|
|
1340
|
+
//#region src/plugins/quick-diff/index.d.ts
|
|
1341
|
+
declare module '@/InPageEdit' {
|
|
1342
|
+
interface InPageEdit {
|
|
1343
|
+
quickDiff: PluginQuickDiff;
|
|
1344
|
+
}
|
|
1345
|
+
interface Events {
|
|
1346
|
+
'quick-diff/init-options'(payload: {
|
|
1347
|
+
ctx: InPageEdit;
|
|
1348
|
+
options: Partial<CompareApiRequestOptions>;
|
|
1349
|
+
}): void;
|
|
1350
|
+
'quick-diff/loaded'(payload: {
|
|
1351
|
+
ctx: InPageEdit;
|
|
1352
|
+
modal: IPEModal;
|
|
1353
|
+
compare: CompareApiResponse['compare'];
|
|
1354
|
+
}): void;
|
|
1355
|
+
'quick-diff/quick-edit-modal'(payload: {
|
|
1356
|
+
ctx: InPageEdit;
|
|
1357
|
+
modal: IPEModal;
|
|
1358
|
+
wikiPage: IWikiPage;
|
|
1359
|
+
}): void;
|
|
1360
|
+
}
|
|
1361
|
+
interface PreferencesMap {
|
|
1362
|
+
'quickDiff.keyshortcut': string;
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
interface CompareApiRequestOptions {
|
|
1366
|
+
fromtitle: string;
|
|
1367
|
+
fromid: number;
|
|
1368
|
+
fromrev: number;
|
|
1369
|
+
frompst: boolean;
|
|
1370
|
+
totitle: string;
|
|
1371
|
+
toid: number;
|
|
1372
|
+
torev: number;
|
|
1373
|
+
torelative?: 'cur' | 'prev' | 'next';
|
|
1374
|
+
topst: boolean;
|
|
1375
|
+
prop: string;
|
|
1376
|
+
difftype: 'table' | 'unified';
|
|
1377
|
+
fromtext: string;
|
|
1378
|
+
fromsection: string | number;
|
|
1379
|
+
fromcontentmodel: string;
|
|
1380
|
+
totext: string;
|
|
1381
|
+
tosection: string | number;
|
|
1382
|
+
tocontentmodel: string;
|
|
1383
|
+
}
|
|
1384
|
+
interface CompareApiResponse {
|
|
1385
|
+
compare: Partial<{
|
|
1386
|
+
fromid: number;
|
|
1387
|
+
fromrevid: number;
|
|
1388
|
+
fromns: number;
|
|
1389
|
+
fromtitle: string;
|
|
1390
|
+
fromsize: number;
|
|
1391
|
+
fromtimestamp: string;
|
|
1392
|
+
fromuser: string;
|
|
1393
|
+
fromuserid: number;
|
|
1394
|
+
fromcomment: string;
|
|
1395
|
+
fromparsedcomment?: string;
|
|
1396
|
+
toid: number;
|
|
1397
|
+
torevid: number;
|
|
1398
|
+
tons: number;
|
|
1399
|
+
totitle: string;
|
|
1400
|
+
tosize: number;
|
|
1401
|
+
totimestamp: string;
|
|
1402
|
+
touser: string;
|
|
1403
|
+
touserid: number;
|
|
1404
|
+
tocomment: string;
|
|
1405
|
+
toparsedcomment: string;
|
|
1406
|
+
diffsize: number;
|
|
1407
|
+
prev: number;
|
|
1408
|
+
next: number;
|
|
1409
|
+
}> & {
|
|
1410
|
+
body: string;
|
|
1411
|
+
};
|
|
1412
|
+
}
|
|
1413
|
+
declare class PluginQuickDiff extends BasePlugin {
|
|
1414
|
+
ctx: InPageEdit;
|
|
1415
|
+
constructor(ctx: InPageEdit);
|
|
1416
|
+
protected start(): Promise<void> | void;
|
|
1417
|
+
protected stop(): Promise<void> | void;
|
|
1418
|
+
private injectHistoryPage;
|
|
1419
|
+
private injectQuickEdit;
|
|
1420
|
+
readonly COMPARE_API_DEFAULT_OPTIONS: Partial<CompareApiRequestOptions>;
|
|
1421
|
+
comparePages(options: Partial<CompareApiRequestOptions>, modal?: IPEModal, modalOptions?: Partial<IPEModalOptions>): IPEModal;
|
|
1422
|
+
}
|
|
1423
|
+
//#endregion
|
|
1424
|
+
//#region src/plugins/quick-edit/index.d.ts
|
|
1425
|
+
declare module '@/InPageEdit' {
|
|
1426
|
+
interface InPageEdit {
|
|
1427
|
+
quickEdit: PluginQuickEdit & {
|
|
1428
|
+
(...args: Parameters<PluginQuickEdit['showModal']>): ReturnType<PluginQuickEdit['showModal']>;
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1431
|
+
interface Events {
|
|
1432
|
+
'quick-edit/init-options'(payload: Omit<QuickEditEventPayload, 'modal' | 'wikiPage'>): void;
|
|
1433
|
+
'quick-edit/show-modal'(payload: Omit<QuickEditEventPayload, 'wikiPage'>): void;
|
|
1434
|
+
'quick-edit/wiki-page'(payload: QuickEditEventPayload): void;
|
|
1435
|
+
'quick-edit/edit-notice'(payload: QuickEditEventPayload & {
|
|
1436
|
+
editNotices: ReactNode[];
|
|
1437
|
+
}): void;
|
|
1438
|
+
'quick-edit/submit'(payload: QuickEditSubmitPayload & {
|
|
1439
|
+
ctx: InPageEdit;
|
|
1440
|
+
}): void;
|
|
1441
|
+
}
|
|
1442
|
+
interface PreferencesMap {
|
|
1443
|
+
'quickEdit.editSummary': string;
|
|
1444
|
+
'quickEdit.editMinor': boolean;
|
|
1445
|
+
'quickEdit.outSideClose': boolean;
|
|
1446
|
+
'quickEdit.watchList': WatchlistAction;
|
|
1447
|
+
'quickEdit.keyshortcut.save': string;
|
|
1448
|
+
'quickEdit.editFont': string;
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
interface QuickEditOptions {
|
|
1452
|
+
title: string;
|
|
1453
|
+
pageId: number;
|
|
1454
|
+
revision: number;
|
|
1455
|
+
/**
|
|
1456
|
+
* - `undefined` for full article edit
|
|
1457
|
+
* - `0` for the first section
|
|
1458
|
+
* - `"new"` for a new section
|
|
1459
|
+
*/
|
|
1460
|
+
section: number | 'new' | undefined;
|
|
1461
|
+
editMinor: boolean;
|
|
1462
|
+
editSummary: string;
|
|
1463
|
+
createOnly: boolean;
|
|
1464
|
+
reloadAfterSave: boolean;
|
|
1465
|
+
}
|
|
1466
|
+
interface QuickEditEventPayload {
|
|
1467
|
+
ctx: InPageEdit;
|
|
1468
|
+
options: QuickEditOptions;
|
|
1469
|
+
modal: IPEModal;
|
|
1470
|
+
wikiPage: IWikiPage;
|
|
1471
|
+
}
|
|
1472
|
+
interface QuickEditSubmitPayload {
|
|
1473
|
+
wikiPage: IWikiPage;
|
|
1474
|
+
text?: string;
|
|
1475
|
+
summary?: string;
|
|
1476
|
+
section?: number | 'new' | undefined;
|
|
1477
|
+
minor?: boolean;
|
|
1478
|
+
createonly?: boolean;
|
|
1479
|
+
watchlist?: WatchlistAction;
|
|
1480
|
+
}
|
|
1481
|
+
declare class PluginQuickEdit extends BasePlugin {
|
|
1482
|
+
ctx: InPageEdit;
|
|
1483
|
+
private readonly DEFAULT_OPTIONS;
|
|
1484
|
+
constructor(ctx: InPageEdit);
|
|
1485
|
+
protected start(): Promise<void> | void;
|
|
1486
|
+
showModal(payload?: string | Partial<QuickEditOptions>): Promise<void>;
|
|
1487
|
+
handleSubmit(payload: QuickEditSubmitPayload): Promise<Required<wiki_saikou0.FexiosContext<wiki_saikou0.MwApiResponse<{
|
|
1488
|
+
success: boolean;
|
|
1489
|
+
}>>>>;
|
|
1490
|
+
static readonly BUILT_IN_FONT_OPTIONS: string[];
|
|
1491
|
+
getEditFontOptions(): Promise<{
|
|
1492
|
+
className: string;
|
|
1493
|
+
fontFamily: string;
|
|
1494
|
+
}>;
|
|
1495
|
+
getWikiPageFromPayload(payload: Partial<QuickEditOptions>): Promise<IWikiPage>;
|
|
1496
|
+
private injectToolbox;
|
|
1497
|
+
protected removeToolbox(ctx: InPageEdit): void;
|
|
1498
|
+
}
|
|
1499
|
+
//#endregion
|
|
1500
|
+
//#region src/plugins/quick-move/index.d.ts
|
|
1501
|
+
declare module '@/InPageEdit' {
|
|
1502
|
+
interface InPageEdit {
|
|
1503
|
+
quickMove: PluginQuickMove;
|
|
1504
|
+
}
|
|
1505
|
+
interface Events {
|
|
1506
|
+
'quick-move/init-options'(payload: {
|
|
1507
|
+
ctx: InPageEdit;
|
|
1508
|
+
options: Partial<QuickMoveOptions>;
|
|
1509
|
+
}): void;
|
|
1510
|
+
'quick-move/show-modal'(payload: {
|
|
1511
|
+
ctx: InPageEdit;
|
|
1512
|
+
modal: IPEModal;
|
|
1513
|
+
}): void;
|
|
1514
|
+
'quick-move/submit'(payload: {
|
|
1515
|
+
ctx: InPageEdit;
|
|
1516
|
+
modal: IPEModal;
|
|
1517
|
+
payload: MovePageOptions;
|
|
1518
|
+
}): void;
|
|
1519
|
+
}
|
|
1520
|
+
interface PreferencesMap {
|
|
1521
|
+
'quickMove.reason': string;
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
interface MovePageOptions {
|
|
1525
|
+
from: string;
|
|
1526
|
+
to: string;
|
|
1527
|
+
reason?: string;
|
|
1528
|
+
movetalk?: boolean;
|
|
1529
|
+
movesubpages?: boolean;
|
|
1530
|
+
noredirect?: boolean;
|
|
1531
|
+
}
|
|
1532
|
+
interface QuickMoveOptions extends Partial<MovePageOptions> {
|
|
1533
|
+
lockFromField?: boolean;
|
|
1534
|
+
lockToField?: boolean;
|
|
1535
|
+
}
|
|
1536
|
+
declare class PluginQuickMove extends BasePlugin {
|
|
1537
|
+
ctx: InPageEdit;
|
|
1538
|
+
constructor(ctx: InPageEdit);
|
|
1539
|
+
protected start(): Promise<void> | void;
|
|
1540
|
+
private injectToolbox;
|
|
1541
|
+
showModal(options?: Partial<QuickMoveOptions>): Promise<CustomIPEModal>;
|
|
1542
|
+
movePage(options: MovePageOptions): Promise<Required<wiki_saikou0.FexiosContext<wiki_saikou0.MwApiResponse<{
|
|
1543
|
+
success: boolean;
|
|
1544
|
+
}>>>>;
|
|
1545
|
+
}
|
|
1546
|
+
//#endregion
|
|
1547
|
+
//#region src/plugins/quick-preview/index.d.ts
|
|
1548
|
+
interface QuickPreviewEventPayload {
|
|
1549
|
+
ctx: InPageEdit;
|
|
1550
|
+
modal: IPEModal;
|
|
1551
|
+
wikiPage: IWikiPage;
|
|
1552
|
+
text: string;
|
|
1553
|
+
parseData: PageParseData;
|
|
1554
|
+
}
|
|
1555
|
+
declare module '@/InPageEdit' {
|
|
1556
|
+
interface InPageEdit {
|
|
1557
|
+
quickPreview: PluginQuickPreview & {
|
|
1558
|
+
(...args: Parameters<PluginQuickPreview['previewWikitext']>): ReturnType<PluginQuickPreview['previewWikitext']>;
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
interface Events {
|
|
1562
|
+
'quick-preview/show-modal'(payload: Omit<QuickPreviewEventPayload, 'parseData'>): void;
|
|
1563
|
+
'quick-preview/loaded'(payload: QuickPreviewEventPayload): void;
|
|
1564
|
+
}
|
|
1565
|
+
interface PreferencesMap {
|
|
1566
|
+
'quickPreview.keyshortcut.quickEdit': string;
|
|
1567
|
+
'quickPreview.keyshortcut.quickDelete': string;
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
declare class PluginQuickPreview extends BasePlugin {
|
|
1571
|
+
ctx: InPageEdit;
|
|
1572
|
+
constructor(ctx: InPageEdit);
|
|
1573
|
+
protected start(): Promise<void> | void;
|
|
1574
|
+
protected stop(): Promise<void> | void;
|
|
1575
|
+
previewWikitext(text: string, params?: MwApiParams, wikiPage?: IWikiPage, modal?: IPEModal, modalOptions?: Partial<IPEModalOptions>): IPEModal;
|
|
1576
|
+
private injectQuickEdit;
|
|
1577
|
+
}
|
|
1578
|
+
//#endregion
|
|
1579
|
+
//#region src/plugins/quick-redirect/index.d.ts
|
|
1580
|
+
declare module '@/InPageEdit' {
|
|
1581
|
+
interface InPageEdit {
|
|
1582
|
+
quickRedirect: PluginQuickRedirect;
|
|
1583
|
+
}
|
|
1584
|
+
interface Events {
|
|
1585
|
+
'quick-redirect/init-options'(payload: {
|
|
1586
|
+
ctx: InPageEdit;
|
|
1587
|
+
options: Partial<QuickRedirectOptions>;
|
|
1588
|
+
}): void;
|
|
1589
|
+
'quick-redirect/show-modal'(payload: {
|
|
1590
|
+
ctx: InPageEdit;
|
|
1591
|
+
modal: IPEModal;
|
|
1592
|
+
}): void;
|
|
1593
|
+
'quick-redirect/submit'(payload: {
|
|
1594
|
+
ctx: InPageEdit;
|
|
1595
|
+
payload: RedirectPageOptions;
|
|
1596
|
+
}): void;
|
|
1597
|
+
}
|
|
1598
|
+
interface PreferencesMap {
|
|
1599
|
+
'quickRedirect.reason': string;
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
interface RedirectPageOptions {
|
|
1603
|
+
from: string;
|
|
1604
|
+
to: string;
|
|
1605
|
+
reason?: string;
|
|
1606
|
+
overwrite?: boolean;
|
|
1607
|
+
}
|
|
1608
|
+
interface QuickRedirectOptions extends Partial<RedirectPageOptions> {}
|
|
1609
|
+
declare class PluginQuickRedirect extends BasePlugin {
|
|
1610
|
+
ctx: InPageEdit;
|
|
1611
|
+
static readonly inject: string[];
|
|
1612
|
+
static readonly PreferencesSchema: Schema<Schemastery.ObjectS<{
|
|
1613
|
+
'quickRedirect.reason': Schema<string, string>;
|
|
1614
|
+
}>, Schemastery.ObjectT<{
|
|
1615
|
+
'quickRedirect.reason': Schema<string, string>;
|
|
1616
|
+
}>>;
|
|
1617
|
+
constructor(ctx: InPageEdit);
|
|
1618
|
+
protected start(): Promise<void> | void;
|
|
1619
|
+
protected stop(): Promise<void> | void;
|
|
1620
|
+
showModal(options?: Partial<QuickRedirectOptions>): Promise<CustomIPEModal>;
|
|
1621
|
+
redirectPage(options: RedirectPageOptions): Promise<Required<wiki_saikou0.FexiosContext<wiki_saikou0.MwApiResponse<{
|
|
1622
|
+
success: boolean;
|
|
1623
|
+
}>>>>;
|
|
1624
|
+
}
|
|
1625
|
+
//#endregion
|
|
1626
|
+
//#region src/plugins/toolbox/index.d.ts
|
|
1627
|
+
declare module '@/InPageEdit' {
|
|
1628
|
+
interface InPageEdit {
|
|
1629
|
+
toolbox: PluginToolbox;
|
|
1630
|
+
}
|
|
1631
|
+
interface Events {
|
|
1632
|
+
'toolbox/button-added'(payload: {
|
|
1633
|
+
ctx: InPageEdit;
|
|
1634
|
+
button: HTMLElement;
|
|
1635
|
+
}): void;
|
|
1636
|
+
'toolbox/button-removed'(payload: {
|
|
1637
|
+
ctx: InPageEdit;
|
|
1638
|
+
id: string;
|
|
1639
|
+
}): void;
|
|
1640
|
+
'toolbox/button-clicked'(payload: {
|
|
1641
|
+
ctx: InPageEdit;
|
|
1642
|
+
button: HTMLElement;
|
|
1643
|
+
id: string;
|
|
1644
|
+
}): void;
|
|
1645
|
+
'toolbox/toggle'(payload: {
|
|
1646
|
+
ctx: InPageEdit;
|
|
1647
|
+
opened: boolean;
|
|
1648
|
+
}): void;
|
|
1649
|
+
}
|
|
1650
|
+
interface PreferencesMap {
|
|
1651
|
+
toolboxAlwaysShow: boolean;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
declare class PluginToolbox extends Service {
|
|
1655
|
+
ctx: InPageEdit;
|
|
1656
|
+
container: HTMLElement;
|
|
1657
|
+
constructor(ctx: InPageEdit);
|
|
1658
|
+
protected start(): Promise<void>;
|
|
1659
|
+
protected stop(): void | Promise<void>;
|
|
1660
|
+
private get isPersistent();
|
|
1661
|
+
private setupHoverLogic;
|
|
1662
|
+
/**
|
|
1663
|
+
* 计算按钮动画延迟
|
|
1664
|
+
* @param index 按钮索引(从0开始)
|
|
1665
|
+
* @param totalCount 总按钮数量
|
|
1666
|
+
* @returns 延迟时间(秒)
|
|
1667
|
+
*/
|
|
1668
|
+
private calculateButtonDelay;
|
|
1669
|
+
/**
|
|
1670
|
+
* 更新按钮组的动画延迟
|
|
1671
|
+
*/
|
|
1672
|
+
private updateButtonDelays;
|
|
1673
|
+
private createToolbox;
|
|
1674
|
+
private normalizeButtonId;
|
|
1675
|
+
addButton(payload: {
|
|
1676
|
+
id: string;
|
|
1677
|
+
group?: 'auto' | 'group1' | 'group2';
|
|
1678
|
+
icon: string | HTMLElement | SVGElement | ReactElement;
|
|
1679
|
+
tooltip?: string | HTMLElement;
|
|
1680
|
+
itemProps?: JSX.IntrinsicElements['li'];
|
|
1681
|
+
buttonProps?: JSX.IntrinsicElements['button'];
|
|
1682
|
+
onClick?: (event: MouseEvent) => void;
|
|
1683
|
+
index?: number;
|
|
1684
|
+
}): HTMLElement;
|
|
1685
|
+
removeButton(id: string): void;
|
|
1686
|
+
getContainer(): HTMLElement;
|
|
1687
|
+
get isOpened(): boolean;
|
|
1688
|
+
toggle(force?: boolean): void;
|
|
1689
|
+
}
|
|
1690
|
+
declare namespace index_d_exports$1 {
|
|
1691
|
+
export { AbstractIPEStorageManager, ApiService, ApiServiceOptions, CurrentPageService, CustomIPEModal, InPageEditPreferenceUICategory, InPageEditPreferenceUIRegistryItem, ModalService, PreferencesService, ResourceLoaderService, StorageService, StorageServiceConfig, TypedStorageEntry, WikiLinkMetadata, WikiMetadataService, WikiPageService, WikiTitleService };
|
|
1692
|
+
}
|
|
1693
|
+
declare namespace index_d_exports {
|
|
1694
|
+
export { AbstractIPEStorageManager, ActionButton, ActionButtonProps, ApiService, ApiServiceOptions, BasePlugin$1 as BasePlugin, CheckBox, CheckBoxProps, CompareApiRequestOptions, CompareApiResponse, ContentModelMap, CurrentPageService, CustomIPEModal, Endpoints, Events, IPEBeaconPayload, IPEBeaconUsage, IWikiPage, IWikiTitle, InArticleWikiAnchorMetadata, InPageEdit, InPageEditCoreConfig, InPageEditPreferenceUICategory, InPageEditPreferenceUIRegistryItem, Inject, InputBox, InputBoxProps, MBox, MBoxElement, MBoxProps, MemoryStorage, ModalService, MovePageOptions, PageInfo, PageParseData, PluginAnalytics, PluginInArticleLinks, PluginPluginStore, PluginPreferencesUI, PluginQuickDiff, PluginQuickEdit, PluginQuickMove, PluginQuickPreview, PluginQuickRedirect, PluginStoreRegistrySource, PluginToolbox, PreferencesMap, PreferencesService, ProgressBar, QuickEditEventPayload, QuickEditOptions, QuickEditSubmitPayload, QuickMoveOptions, QuickRedirectOptions, RadioBox, RadioBoxProps, RedirectPageOptions, RegisterPreferences, ResourceLoaderService, Schema, Service, StorageService, StorageServiceConfig, TabContent, TabLabel, TabView, TabViewLabelOptions, TwinSwapElement, TwinSwapInput, TwinSwapInputInput, TwinSwapInputProps, TypedStorageEntry, WatchlistAction, WikiLinkMetadata, WikiMagicWord, WikiMetadataService, WikiNameSpaceAlias, WikiNamespace, WikiPageConstructor, WikiPageEditPayload, WikiPageService, WikiSiteGeneralInfo, WikiSiteInfo, WikiSpecialPageAlias, WikiTitleConstructor, WikiTitleService, WikiUserBlockInfo, WikiUserInfo, WikiUserOptions, createWikiPageModel, createWikiTitleModel, useMemoryStorage };
|
|
1695
|
+
}
|
|
4
1696
|
declare global {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
}
|
|
1697
|
+
const ipe: InPageEdit;
|
|
1698
|
+
interface Window {
|
|
1699
|
+
ipe: InPageEdit;
|
|
1700
|
+
__IPE_MODULES__: {
|
|
1701
|
+
push(payload: (ipe: InPageEdit) => void): void;
|
|
1702
|
+
};
|
|
1703
|
+
}
|
|
14
1704
|
}
|
|
15
1705
|
declare global {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1706
|
+
interface Window {
|
|
1707
|
+
RLQ: {
|
|
1708
|
+
push(callback: () => void): void;
|
|
1709
|
+
push(depAndCallback: [string, () => void]): void;
|
|
1710
|
+
push(depsAndCallback: [string[], () => void]): void;
|
|
1711
|
+
};
|
|
1712
|
+
}
|
|
23
1713
|
}
|
|
24
1714
|
declare global {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
function hook(name: 'InPageEdit.ready'): Hook<[IPECore]>;
|
|
1715
|
+
namespace mw {
|
|
1716
|
+
/**
|
|
1717
|
+
* @see https://doc.wikimedia.org/mediawiki-core/master/js/Hook.html
|
|
1718
|
+
* @see https://github.com/wikimedia-gadgets/types-mediawiki/blob/9b4e7c3b9034d64a44a0667229a6d9585fe09b30/mw/hook.d.ts
|
|
1719
|
+
*/
|
|
1720
|
+
interface Hook<T extends any[] = any[]> {
|
|
1721
|
+
add(...handler: Array<(...data: T) => any>): this;
|
|
1722
|
+
deprecate(msg: string): this;
|
|
1723
|
+
fire(...data: T): this;
|
|
1724
|
+
remove(...handler: Array<(...data: T) => any>): this;
|
|
37
1725
|
}
|
|
1726
|
+
function hook(name: 'InPageEdit.ready'): Hook<[InPageEdit]>;
|
|
1727
|
+
}
|
|
38
1728
|
}
|
|
1729
|
+
//#endregion
|
|
1730
|
+
export { AbstractIPEStorageManager, ActionButton, ActionButtonProps, ApiService, ApiServiceOptions, BasePlugin$1 as BasePlugin, CheckBox, CheckBoxProps, CompareApiRequestOptions, CompareApiResponse, ContentModelMap, CurrentPageService, CustomIPEModal, Endpoints, Events, IPEBeaconPayload, IPEBeaconUsage, IWikiPage, IWikiTitle, InArticleWikiAnchorMetadata, InPageEdit, InPageEditCoreConfig, InPageEditPreferenceUICategory, InPageEditPreferenceUIRegistryItem, Inject, InputBox, InputBoxProps, MBox, MBoxElement, MBoxProps, MemoryStorage, ModalService, MovePageOptions, PageInfo, PageParseData, PluginAnalytics, PluginInArticleLinks, PluginPluginStore, PluginPreferencesUI, PluginQuickDiff, PluginQuickEdit, PluginQuickMove, PluginQuickPreview, PluginQuickRedirect, PluginStoreRegistrySource, PluginToolbox, PreferencesMap, PreferencesService, ProgressBar, QuickEditEventPayload, QuickEditOptions, QuickEditSubmitPayload, QuickMoveOptions, QuickRedirectOptions, RadioBox, RadioBoxProps, RedirectPageOptions, RegisterPreferences, ResourceLoaderService, Schema, Service, StorageService, StorageServiceConfig, TabContent, TabLabel, TabView, TabViewLabelOptions, TwinSwapElement, TwinSwapInput, TwinSwapInputInput, TwinSwapInputProps, TypedStorageEntry, WatchlistAction, WikiLinkMetadata, WikiMagicWord, WikiMetadataService, WikiNameSpaceAlias, WikiNamespace, WikiPageConstructor, WikiPageEditPayload, WikiPageService, WikiSiteGeneralInfo, WikiSiteInfo, WikiSpecialPageAlias, WikiTitleConstructor, WikiTitleService, WikiUserBlockInfo, WikiUserInfo, WikiUserOptions, createWikiPageModel, createWikiTitleModel, useMemoryStorage };
|