@inpageedit/core 0.12.1 → 0.13.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/dist/BasePlugin-Bf2UuIHF.js +64 -0
- package/dist/BasePlugin-Bf2UuIHF.js.map +1 -0
- package/dist/IconQuickEdit-CMCQncyj.js.map +1 -1
- package/dist/InputBox-nQKtiWtZ.js.map +1 -1
- 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/Preferences-DS4-CFWe.js.map +1 -1
- package/dist/WatchlistAction-BbNAyryN.js +5 -0
- package/dist/WatchlistAction-BbNAyryN.js.map +1 -0
- package/dist/components/index.js.map +1 -1
- 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-B7c6jL9x.js} +25 -23
- package/dist/index-B7c6jL9x.js.map +1 -0
- 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-CCRMmnwk.js.map +1 -0
- package/dist/index-CG38LlAh.js.map +1 -1
- package/dist/index-CM_6yF2v.js.map +1 -1
- package/dist/index-C_BIsubQ.js +3744 -0
- package/dist/index-C_BIsubQ.js.map +1 -0
- 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-CyG7_IYz.js.map +1 -0
- package/dist/index-DD5CVCfD.js.map +1 -1
- 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 +1742 -31
- package/dist/index.js +73 -9
- package/dist/index.js.map +1 -1
- package/dist/makeCallable-LDU0xZMJ.js.map +1 -1
- package/dist/models/index.js +486 -0
- package/dist/models/index.js.map +1 -0
- package/dist/noop-ClDc6zv4.js.map +1 -1
- 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/dist/vueHooks-l04s8cIl.js.map +1 -1
- package/lib/index.umd.js +10 -10
- package/lib/index.umd.js.map +1 -1
- package/package.json +23 -30
- 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-Ccr3YhkP.js.map +0 -1
- package/dist/index-D5zX93bn.js.map +0 -1
- 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/index-eARjMi7f.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
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { InPageEdit, Schema, Service, PreferencesMap } from '../InPageEdit.js';
|
|
2
|
-
import { ComputeAble } from '../utils/computeable.js';
|
|
3
|
-
declare module '../InPageEdit' {
|
|
4
|
-
interface InPageEdit {
|
|
5
|
-
preferences: PreferencesService;
|
|
6
|
-
prefs: PreferencesService;
|
|
7
|
-
}
|
|
8
|
-
interface Events {
|
|
9
|
-
'preferences/changed'(payload: {
|
|
10
|
-
ctx: InPageEdit;
|
|
11
|
-
/** original input */
|
|
12
|
-
input: Record<string, unknown>;
|
|
13
|
-
/** changed settings */
|
|
14
|
-
changes: Record<string, unknown>;
|
|
15
|
-
}): void;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export interface InPageEditPreferenceUICategory {
|
|
19
|
-
name: string;
|
|
20
|
-
label: string;
|
|
21
|
-
description?: string;
|
|
22
|
-
index?: number;
|
|
23
|
-
/**
|
|
24
|
-
* 自定义渲染函数
|
|
25
|
-
* @param ctx - InPageEdit 上下文
|
|
26
|
-
* @param onUnmount - 卸载回调,当偏好设置 UI 被卸载时会被调用
|
|
27
|
-
*/
|
|
28
|
-
customRenderer?: (payload: {
|
|
29
|
-
ctx: InPageEdit;
|
|
30
|
-
onMounted: (callback: (container: HTMLElement) => void) => void;
|
|
31
|
-
onUnmount: (callback: () => void) => void;
|
|
32
|
-
}) => Promise<Node> | Node;
|
|
33
|
-
/**
|
|
34
|
-
* 是否自动生成该分类下的表单
|
|
35
|
-
* @default true
|
|
36
|
-
*/
|
|
37
|
-
autoGenerateForm?: boolean;
|
|
38
|
-
}
|
|
39
|
-
export interface InPageEditPreferenceUIRegistryItem {
|
|
40
|
-
name: string;
|
|
41
|
-
schema: Schema;
|
|
42
|
-
category: string;
|
|
43
|
-
}
|
|
44
|
-
export declare class PreferencesService extends Service {
|
|
45
|
-
ctx: InPageEdit;
|
|
46
|
-
private db;
|
|
47
|
-
customRegistries: InPageEditPreferenceUIRegistryItem[];
|
|
48
|
-
categoryDefinitions: InPageEditPreferenceUICategory[];
|
|
49
|
-
private _defaultPreferences;
|
|
50
|
-
constructor(ctx: InPageEdit);
|
|
51
|
-
get logger(): import('@inpageedit/logger').Logger;
|
|
52
|
-
start(): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* 获取配置项的值
|
|
55
|
-
* @param key 配置项的键名
|
|
56
|
-
* @param fallback 当配置项不存在时的回退值
|
|
57
|
-
* @returns
|
|
58
|
-
* - 未提供 key 时,返回所有配置项的键值对
|
|
59
|
-
* - 提供 key 时,返回对应配置项的值,若不存在则返回回退值或 null
|
|
60
|
-
* @tips 你可以通过重载 PreferencesMap 来定义你的配置项类型,以自动获得类型推导
|
|
61
|
-
*/
|
|
62
|
-
get(): Promise<PreferencesMap>;
|
|
63
|
-
get<K extends keyof PreferencesMap>(key: K, fallback?: ComputeAble<PreferencesMap[K]>): Promise<PreferencesMap[K] | null>;
|
|
64
|
-
get<U = unknown>(key: string, fallback?: ComputeAble<U>): Promise<U | null>;
|
|
65
|
-
/**
|
|
66
|
-
* 获取全部注册的配置项以及最终生效的值
|
|
67
|
-
* 未保存的配置项将使用默认值
|
|
68
|
-
*/
|
|
69
|
-
getAll(): Promise<PreferencesMap>;
|
|
70
|
-
set<K extends keyof PreferencesMap>(key: K, value: PreferencesMap[K] | undefined | null): Promise<PreferencesMap[K] | void>;
|
|
71
|
-
set<U = unknown>(key: string, value: U | undefined | null): Promise<U | void>;
|
|
72
|
-
setMany(input: {
|
|
73
|
-
[K in keyof PreferencesMap]?: PreferencesMap[K] | undefined | null;
|
|
74
|
-
}): Promise<{
|
|
75
|
-
[K in keyof PreferencesMap]?: PreferencesMap[K] | undefined | null;
|
|
76
|
-
}>;
|
|
77
|
-
setMany<U = unknown>(input: Record<string, U | undefined | null>): Promise<Record<string, U | undefined | null>>;
|
|
78
|
-
defaultOf<T extends keyof PreferencesMap>(key: T): PreferencesMap[T] | undefined;
|
|
79
|
-
defaultOf<U = unknown>(key: string): U | undefined;
|
|
80
|
-
/**
|
|
81
|
-
* Get exportable configurations
|
|
82
|
-
* - exclude values that are the same as the default value
|
|
83
|
-
* - exclude invalid or undefined values
|
|
84
|
-
* - sort by keys
|
|
85
|
-
*/
|
|
86
|
-
getExportableRecord(configs?: Record<string, unknown>): Promise<Record<string, any>>;
|
|
87
|
-
private loadDefaultConfigs;
|
|
88
|
-
registerCustomConfig(id: string, schema: Schema, category?: string): this;
|
|
89
|
-
getConfigRegistries(category?: string): InPageEditPreferenceUIRegistryItem[];
|
|
90
|
-
getAllSchema(): Schema<PreferencesMap, PreferencesMap>;
|
|
91
|
-
defineCategory(category: InPageEditPreferenceUICategory): this;
|
|
92
|
-
getConfigCategories(): InPageEditPreferenceUICategory[];
|
|
93
|
-
private _migrageFromLegacyMasterDB;
|
|
94
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
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 | null>;
|
|
12
|
-
loadStyle(href: string, attrs?: Record<string, any>): Promise<HTMLLinkElement | null>;
|
|
13
|
-
removeStyle(href: string): void;
|
|
14
|
-
removeScript(src: string): void;
|
|
15
|
-
removeAll(): void;
|
|
16
|
-
resolveImportPath(path: string): string;
|
|
17
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { InPageEdit, Service } from '../InPageEdit';
|
|
2
|
-
import { WikiSiteInfo, WikiUserBlockInfo, WikiUserInfo } from '../types/WikiMetadata';
|
|
3
|
-
declare module '../InPageEdit' {
|
|
4
|
-
interface InPageEdit {
|
|
5
|
-
wiki: WikiMetadataService;
|
|
6
|
-
getUrl: WikiMetadataService['getUrl'];
|
|
7
|
-
getSciprtUrl: WikiMetadataService['getSciprtUrl'];
|
|
8
|
-
getMainpageUrl: WikiMetadataService['getMainpageUrl'];
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
interface WikiMetadataKindMap {
|
|
12
|
-
siteinfo: WikiSiteInfo;
|
|
13
|
-
userinfo: WikiUserInfo;
|
|
14
|
-
}
|
|
15
|
-
export declare class WikiMetadataService extends Service {
|
|
16
|
-
ctx: InPageEdit;
|
|
17
|
-
private readonly _data;
|
|
18
|
-
private readonly CACHE_VERSION;
|
|
19
|
-
private readonly CACHE_TTL;
|
|
20
|
-
private readonly QUERY_DATA;
|
|
21
|
-
private readonly CACHE_DB;
|
|
22
|
-
constructor(ctx: InPageEdit);
|
|
23
|
-
private get logger();
|
|
24
|
-
private get api();
|
|
25
|
-
readonly mwConfig: {
|
|
26
|
-
get: typeof mw.config.get;
|
|
27
|
-
has: typeof mw.config.exists;
|
|
28
|
-
readonly values: ReturnType<typeof mw.config.get>;
|
|
29
|
-
};
|
|
30
|
-
protected start(): Promise<void>;
|
|
31
|
-
initData<T extends keyof WikiMetadataKindMap>(kind: T, noCache?: boolean): Promise<WikiMetadataKindMap[T]>;
|
|
32
|
-
private getCacheKey;
|
|
33
|
-
fetchFromApi<T extends keyof WikiMetadataKindMap>(kind: T): Promise<WikiMetadataKindMap[T]>;
|
|
34
|
-
fetchFromCache<T extends keyof WikiMetadataKindMap>(kind: T): Promise<WikiMetadataKindMap[T] | null>;
|
|
35
|
-
saveToCache<T extends keyof WikiMetadataKindMap>(kind: T, data: WikiMetadataKindMap[T]): Promise<import('./storage').TypedStorageEntry<WikiSiteInfo | WikiUserInfo>>;
|
|
36
|
-
invalidateCache<T extends keyof WikiMetadataKindMap>(kind: T): Promise<void>;
|
|
37
|
-
get _raw(): WikiMetadataKindMap;
|
|
38
|
-
get siteInfo(): WikiSiteInfo;
|
|
39
|
-
get general(): import('../types/WikiMetadata').WikiSiteGeneralInfo;
|
|
40
|
-
get specialPageAliases(): import('../types/WikiMetadata').WikiSpecialPageAlias[];
|
|
41
|
-
get namespaceAliases(): import('../types/WikiMetadata').WikiNameSpaceAlias[];
|
|
42
|
-
get namespaces(): Record<string, import('../types/WikiMetadata').WikiNamespace>;
|
|
43
|
-
get namespaceMap(): {
|
|
44
|
-
id: number;
|
|
45
|
-
canonical: string | undefined;
|
|
46
|
-
aliases: string[];
|
|
47
|
-
}[];
|
|
48
|
-
get magicWords(): import('../types/WikiMetadata').WikiMagicWord[];
|
|
49
|
-
get userInfo(): WikiUserInfo;
|
|
50
|
-
get userOptions(): import('../types/WikiMetadata').WikiUserOptions;
|
|
51
|
-
get isUserBlocked(): boolean | "" | undefined;
|
|
52
|
-
get userGroups(): string[];
|
|
53
|
-
get userRights(): string[];
|
|
54
|
-
/**
|
|
55
|
-
* Base URL, without trailing slash
|
|
56
|
-
* @example "https://mediawiki.org"
|
|
57
|
-
*/
|
|
58
|
-
get baseUrl(): string;
|
|
59
|
-
/**
|
|
60
|
-
* Home page URL of this wiki
|
|
61
|
-
* @description Generally same as the Mainpage URL,
|
|
62
|
-
* but after MediaWiki 1.34,
|
|
63
|
-
* it can be set to the website root directory.
|
|
64
|
-
* @example "https://mediawiki.org/wiki/Main_Page" (In most cases)
|
|
65
|
-
* @example "https://mediawiki.org/" ($wgMainPageIsDomainRoot = true)
|
|
66
|
-
*/
|
|
67
|
-
get landingPageUrl(): string;
|
|
68
|
-
get mainPageName(): string;
|
|
69
|
-
/**
|
|
70
|
-
* Exact Mainpage URL of this wiki
|
|
71
|
-
* @example "https://mediawiki.org/wiki/Main_Page"
|
|
72
|
-
*/
|
|
73
|
-
get mainPageUrl(): string;
|
|
74
|
-
/**
|
|
75
|
-
* Article path, with the $1 placeholder
|
|
76
|
-
* @example "/wiki/$1"
|
|
77
|
-
*/
|
|
78
|
-
get articlePath(): string;
|
|
79
|
-
/**
|
|
80
|
-
* Script path, without trailing slash
|
|
81
|
-
* @example "/w"
|
|
82
|
-
*/
|
|
83
|
-
get scriptPath(): string;
|
|
84
|
-
/**
|
|
85
|
-
* Article base URL, with the $1 placeholder
|
|
86
|
-
* @example "https://mediawiki.org/wiki/$1"
|
|
87
|
-
*/
|
|
88
|
-
get articleBaseUrl(): string;
|
|
89
|
-
/**
|
|
90
|
-
* Script base URL, without trailing slash
|
|
91
|
-
* @example "https://mediawiki.org/w"
|
|
92
|
-
*/
|
|
93
|
-
get scriptBaseUrl(): string;
|
|
94
|
-
getSciprtUrl(name?: string): string;
|
|
95
|
-
/** Get mainpage URL */
|
|
96
|
-
getMainpageUrl(params?: Record<string, any>): string;
|
|
97
|
-
/** Get page URL by title */
|
|
98
|
-
getUrl(title: string, params?: Record<string, any>): string;
|
|
99
|
-
/** Get page URL by page ID */
|
|
100
|
-
getUrl(pageId: number, params?: Record<string, any>): string;
|
|
101
|
-
hasRight(right: string): boolean;
|
|
102
|
-
hasAnyRight(...rights: string[]): boolean;
|
|
103
|
-
hasEveryRights(...rights: string[]): boolean;
|
|
104
|
-
inGroup(name: string): boolean;
|
|
105
|
-
inAnyGroup(...names: string[]): boolean;
|
|
106
|
-
getBlockInfo(): WikiUserBlockInfo | null;
|
|
107
|
-
}
|
|
108
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Inject, InPageEdit, Service } from '../InPageEdit';
|
|
2
|
-
import { IWikiPage, WikiPageConstructor } from '../models/WikiPage';
|
|
3
|
-
import { PageInfo } from '../models/WikiPage/types/PageInfo';
|
|
4
|
-
import { IWikiTitle } from '../models/WikiTitle/index.js';
|
|
5
|
-
declare module '../InPageEdit' {
|
|
6
|
-
interface InPageEdit {
|
|
7
|
-
wikiPage: WikiPageService;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export declare class WikiPageService extends Service {
|
|
11
|
-
ctx: InPageEdit;
|
|
12
|
-
static readonly inject: Inject;
|
|
13
|
-
WikiPage: WikiPageConstructor;
|
|
14
|
-
constructor(ctx: InPageEdit);
|
|
15
|
-
createInstance(payload: Record<string, any>, noCache?: boolean): Promise<IWikiPage>;
|
|
16
|
-
newFromTitle(title: string | IWikiTitle, converttitles?: boolean, rvsection?: number | string, noCache?: boolean): Promise<IWikiPage>;
|
|
17
|
-
newFromPageId(pageid: number, rvsection?: number | string, noCache?: boolean): Promise<IWikiPage>;
|
|
18
|
-
newFromRevision(revid: number, rvsection?: number | string, noCache?: boolean): Promise<IWikiPage>;
|
|
19
|
-
newBlankPage(init?: Partial<PageInfo>): IWikiPage;
|
|
20
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Inject, InPageEdit, Service } from '../InPageEdit';
|
|
2
|
-
import { IWikiTitle, WikiTitleConstructor } from '../models/WikiTitle/index.js';
|
|
3
|
-
declare module '../InPageEdit' {
|
|
4
|
-
interface InPageEdit {
|
|
5
|
-
wikiTitle: WikiTitleService;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export interface WikiLinkMetadata {
|
|
9
|
-
title?: IWikiTitle;
|
|
10
|
-
pageId?: number;
|
|
11
|
-
revId?: number;
|
|
12
|
-
url: URL;
|
|
13
|
-
params: URLSearchParams;
|
|
14
|
-
hash: string;
|
|
15
|
-
action: 'view' | 'edit' | 'create' | 'diff' | string;
|
|
16
|
-
}
|
|
17
|
-
export declare class WikiTitleService extends Service {
|
|
18
|
-
ctx: InPageEdit;
|
|
19
|
-
static readonly inject: Inject;
|
|
20
|
-
readonly Title: WikiTitleConstructor;
|
|
21
|
-
constructor(ctx: InPageEdit);
|
|
22
|
-
private readonly logger;
|
|
23
|
-
newTitle(title: string, namespace?: number): IWikiTitle;
|
|
24
|
-
newMainPageTitle(): IWikiTitle;
|
|
25
|
-
newTitleFromUrl(url: string | URL): Promise<IWikiTitle | null>;
|
|
26
|
-
private _cachedTitles;
|
|
27
|
-
private newTitleFromAnyId;
|
|
28
|
-
newTitleFromPageId(pageId: number): Promise<IWikiTitle | null>;
|
|
29
|
-
newTitleFromRevision(revId: number): Promise<IWikiTitle | null>;
|
|
30
|
-
/**
|
|
31
|
-
* Resolve **special** special pages to it's real target
|
|
32
|
-
*
|
|
33
|
-
* If target is self or cannot be resolved, return null
|
|
34
|
-
* @example
|
|
35
|
-
* ```
|
|
36
|
-
* Special:MyPage -> User:<username>
|
|
37
|
-
* Special:Edit/Page_Title -> Page_Title
|
|
38
|
-
* Special:NewSection/Page_Title -> Page_Title (section=new)
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
resolveSpecialPageTarget(input: IWikiTitle | string): {
|
|
42
|
-
title: IWikiTitle;
|
|
43
|
-
action?: string | undefined;
|
|
44
|
-
section?: number | 'new' | undefined;
|
|
45
|
-
} | null;
|
|
46
|
-
private readonly wiki;
|
|
47
|
-
/**
|
|
48
|
-
* @example "https://example.com"
|
|
49
|
-
*/
|
|
50
|
-
private readonly wikiBaseUrl;
|
|
51
|
-
/**
|
|
52
|
-
* Article path, with trailing slash
|
|
53
|
-
* @example "/wiki/" (if wgArticlePath is "/wiki/$1")
|
|
54
|
-
*/
|
|
55
|
-
private readonly wikiArticlePath;
|
|
56
|
-
/**
|
|
57
|
-
* Article base URL, with trailing slash
|
|
58
|
-
* @example "https://example.com/wiki/" (if wgArticlePath is "/wiki/$1")
|
|
59
|
-
*/
|
|
60
|
-
private readonly wikiArticleBaseUrl;
|
|
61
|
-
/**
|
|
62
|
-
* Script base URL, **without** trailing slash
|
|
63
|
-
* @example "https://example.com/w" (if wgScriptPath is "/w")
|
|
64
|
-
*/
|
|
65
|
-
private readonly wikiIndexPhpUrl;
|
|
66
|
-
isWikiLink(url: string): boolean;
|
|
67
|
-
static readonly REG_SKIPPED_HREF: RegExp;
|
|
68
|
-
validateHrefAttr(href: string | null): boolean;
|
|
69
|
-
parseWikiLink(link: string | URL): WikiLinkMetadata | null;
|
|
70
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { InPageEdit, Service } from '../../InPageEdit.js';
|
|
2
|
-
import { LocalStorageManager } from './managers/LocalStorageManager.js';
|
|
3
|
-
import { IDBStorageManager } from './managers/IDBStorageManager.js';
|
|
4
|
-
declare module '../../InPageEdit' {
|
|
5
|
-
interface InPageEdit {
|
|
6
|
-
storage: StorageService;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
export interface StorageServiceConfig {
|
|
10
|
-
dbName: string;
|
|
11
|
-
}
|
|
12
|
-
export declare class StorageService extends Service<StorageServiceConfig> {
|
|
13
|
-
config: StorageServiceConfig;
|
|
14
|
-
readonly kv: IDBStorageManager<any>;
|
|
15
|
-
readonly simpleKV: LocalStorageManager<any>;
|
|
16
|
-
readonly memoryKV: LocalStorageManager<any>;
|
|
17
|
-
constructor(ctx: InPageEdit, config: StorageServiceConfig);
|
|
18
|
-
createDatabase<T = any>(storeName: string, ttl?: number, version?: number, engine?: 'indexedDB' | 'localStorage' | 'sessionStorage' | 'memory'): AbstractIPEStorageManager<T>;
|
|
19
|
-
}
|
|
20
|
-
export interface TypedStorageEntry<T = any> {
|
|
21
|
-
/** last update time */
|
|
22
|
-
time: number;
|
|
23
|
-
/** stored value */
|
|
24
|
-
value: T;
|
|
25
|
-
/** version */
|
|
26
|
-
version?: number;
|
|
27
|
-
}
|
|
28
|
-
export interface AbstractIPEStorageManager<T = unknown> {
|
|
29
|
-
get(key: string, ttl?: number, setter?: () => Promise<any> | any): Promise<T | null>;
|
|
30
|
-
set(key: string, value: null | undefined): Promise<void>;
|
|
31
|
-
set(record: Record<string, T | null | undefined>): Promise<Record<string, TypedStorageEntry<T> | void>>;
|
|
32
|
-
set(key: string, value: T): Promise<TypedStorageEntry<T>>;
|
|
33
|
-
has(key: string, ttl?: number): Promise<boolean>;
|
|
34
|
-
delete(key: string): Promise<void>;
|
|
35
|
-
keys(): AsyncIterable<string>;
|
|
36
|
-
values(): AsyncIterable<TypedStorageEntry<T>>;
|
|
37
|
-
entries(): AsyncIterable<[string, TypedStorageEntry<T>]>;
|
|
38
|
-
updatedAt(key: string): Promise<number>;
|
|
39
|
-
clear(): Promise<this>;
|
|
40
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { IDBPlus } from 'idb-plus';
|
|
2
|
-
import { AbstractIPEStorageManager, TypedStorageEntry } from '../index.js';
|
|
3
|
-
export declare class IDBStorageManager<T = unknown> implements AbstractIPEStorageManager<T> {
|
|
4
|
-
readonly dbName: string;
|
|
5
|
-
readonly storeName: string;
|
|
6
|
-
ttl: number;
|
|
7
|
-
version?: number | undefined;
|
|
8
|
-
readonly db: IDBPlus<string, TypedStorageEntry<T>>;
|
|
9
|
-
keys: () => AsyncIterable<string>;
|
|
10
|
-
values: () => AsyncIterable<TypedStorageEntry<T>>;
|
|
11
|
-
entries: () => AsyncIterable<[string, TypedStorageEntry<T>]>;
|
|
12
|
-
constructor(dbName: string, storeName: string, ttl?: number, version?: number | undefined);
|
|
13
|
-
private _clearExpiredEntries;
|
|
14
|
-
get(key: string, ttl?: number, setter?: () => Promise<T> | T): Promise<T | null>;
|
|
15
|
-
set(key: string, value: null | undefined): Promise<void>;
|
|
16
|
-
set(key: string, value: T): Promise<TypedStorageEntry<T>>;
|
|
17
|
-
set(record: Record<string, T | null | undefined>): Promise<Record<string, TypedStorageEntry<T> | void>>;
|
|
18
|
-
has(key: string, ttl?: number): Promise<boolean>;
|
|
19
|
-
delete(key: string): Promise<void>;
|
|
20
|
-
updatedAt(key: string): Promise<number>;
|
|
21
|
-
private loadFromDB;
|
|
22
|
-
private checkIfExpired;
|
|
23
|
-
/**
|
|
24
|
-
* [DANGER] Use with caution!
|
|
25
|
-
* Delete all data from the database.
|
|
26
|
-
*/
|
|
27
|
-
clear(): Promise<this>;
|
|
28
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { AbstractIPEStorageManager, TypedStorageEntry } from '../index.js';
|
|
2
|
-
export declare class LocalStorageManager<T = unknown> implements AbstractIPEStorageManager<T> {
|
|
3
|
-
dbName?: string | undefined;
|
|
4
|
-
readonly storeName?: string | undefined;
|
|
5
|
-
ttl: number;
|
|
6
|
-
version?: number | undefined;
|
|
7
|
-
engine: 'localStorage' | 'sessionStorage' | 'memory';
|
|
8
|
-
private db;
|
|
9
|
-
constructor(dbName?: string | undefined, storeName?: string | undefined, ttl?: number, version?: number | undefined, engine?: 'localStorage' | 'sessionStorage' | 'memory');
|
|
10
|
-
private makeKey;
|
|
11
|
-
private load;
|
|
12
|
-
private getRaw;
|
|
13
|
-
private setRaw;
|
|
14
|
-
private deleteSync;
|
|
15
|
-
private isExpired;
|
|
16
|
-
get(key: string, ttl?: number, setter?: () => Promise<T> | T): Promise<T | null>;
|
|
17
|
-
set(key: string, value: null | undefined): Promise<void>;
|
|
18
|
-
set(key: string, value: T): Promise<TypedStorageEntry<T>>;
|
|
19
|
-
set(record: Record<string, T | null | undefined>): Promise<Record<string, TypedStorageEntry<T> | void>>;
|
|
20
|
-
has(key: string, ttl?: number): Promise<boolean>;
|
|
21
|
-
delete(key: string): Promise<void>;
|
|
22
|
-
updatedAt(key: string): Promise<number>;
|
|
23
|
-
clear(): Promise<this>;
|
|
24
|
-
keys(): AsyncIterable<string>;
|
|
25
|
-
values(): AsyncIterable<TypedStorageEntry<T>>;
|
|
26
|
-
entries(): AsyncIterable<[string, TypedStorageEntry<T>]>;
|
|
27
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
export interface WikiSiteInfo {
|
|
2
|
-
general: WikiSiteGeneralInfo;
|
|
3
|
-
specialpagealiases: WikiSpecialPageAlias[];
|
|
4
|
-
namespacealiases: WikiNameSpaceAlias[];
|
|
5
|
-
magicwords: WikiMagicWord[];
|
|
6
|
-
namespaces: Record<string, WikiNamespace>;
|
|
7
|
-
}
|
|
8
|
-
export interface WikiSiteGeneralInfo {
|
|
9
|
-
mainpage: string;
|
|
10
|
-
base: string;
|
|
11
|
-
sitename: string;
|
|
12
|
-
mainpageisdomainroot: boolean;
|
|
13
|
-
logo: string;
|
|
14
|
-
generator: string;
|
|
15
|
-
phpversion: string;
|
|
16
|
-
phpsapi: string;
|
|
17
|
-
dbtype: string;
|
|
18
|
-
dbversion: string;
|
|
19
|
-
imagewhitelistenabled: boolean;
|
|
20
|
-
langconversion: boolean;
|
|
21
|
-
titleconversion: boolean;
|
|
22
|
-
linkprefixcharset: string;
|
|
23
|
-
linkprefix: string;
|
|
24
|
-
linktrail: string;
|
|
25
|
-
legaltitlechars: string;
|
|
26
|
-
invalidusernamechars: string;
|
|
27
|
-
allunicodefixes: boolean;
|
|
28
|
-
fixarabicunicode: boolean;
|
|
29
|
-
fixmalayalamunicode: boolean;
|
|
30
|
-
'git-hash'?: string;
|
|
31
|
-
'git-branch'?: string;
|
|
32
|
-
case: 'first-letter' | string;
|
|
33
|
-
lang: string;
|
|
34
|
-
fallback?: {
|
|
35
|
-
code: string;
|
|
36
|
-
}[];
|
|
37
|
-
variants: {
|
|
38
|
-
code: string;
|
|
39
|
-
name: string;
|
|
40
|
-
}[];
|
|
41
|
-
rtl: boolean;
|
|
42
|
-
fallback8bitEncoding: string;
|
|
43
|
-
readonly: boolean;
|
|
44
|
-
writeapi: boolean;
|
|
45
|
-
maxarticlesize: number;
|
|
46
|
-
timezone: string;
|
|
47
|
-
timeoffset: number;
|
|
48
|
-
articlepath: string;
|
|
49
|
-
scriptpath: string;
|
|
50
|
-
script: string;
|
|
51
|
-
variantarticlepath: string | false;
|
|
52
|
-
server: string;
|
|
53
|
-
servername: string;
|
|
54
|
-
wikiid: string;
|
|
55
|
-
time: string;
|
|
56
|
-
misermode: boolean;
|
|
57
|
-
uploadsenabled: boolean;
|
|
58
|
-
maxuploadsize: number;
|
|
59
|
-
minuploadchunksize: number;
|
|
60
|
-
galleryoptions: {
|
|
61
|
-
imagesPerRow: number;
|
|
62
|
-
imageWidth: number;
|
|
63
|
-
imageHeight: number;
|
|
64
|
-
captionLength: boolean;
|
|
65
|
-
showBytes: boolean;
|
|
66
|
-
showDimensions: boolean;
|
|
67
|
-
mode: 'traditional' | string;
|
|
68
|
-
};
|
|
69
|
-
thumblimits: Record<`${number}`, number>;
|
|
70
|
-
imagelimits: Record<`${number}`, {
|
|
71
|
-
width: number;
|
|
72
|
-
height: number;
|
|
73
|
-
}>;
|
|
74
|
-
favicon: string;
|
|
75
|
-
centralidlookupprovider: string;
|
|
76
|
-
allcentralidlookupproviders: string[];
|
|
77
|
-
interwikimagic: boolean;
|
|
78
|
-
magiclinks: Record<string, boolean>;
|
|
79
|
-
categorycollation: 'uppercase' | string;
|
|
80
|
-
citeresponsivereferences: boolean;
|
|
81
|
-
}
|
|
82
|
-
export interface WikiSpecialPageAlias {
|
|
83
|
-
realname: string;
|
|
84
|
-
aliases: string[];
|
|
85
|
-
}
|
|
86
|
-
export interface WikiNameSpaceAlias {
|
|
87
|
-
id: number;
|
|
88
|
-
alias: string;
|
|
89
|
-
}
|
|
90
|
-
export interface WikiNamespace {
|
|
91
|
-
canonical?: string;
|
|
92
|
-
case: 'first-letter' | string;
|
|
93
|
-
content: boolean;
|
|
94
|
-
id: number;
|
|
95
|
-
name: string;
|
|
96
|
-
namespaceprotection?: string;
|
|
97
|
-
nonincludable: boolean;
|
|
98
|
-
subpages: boolean;
|
|
99
|
-
}
|
|
100
|
-
export interface WikiMagicWord {
|
|
101
|
-
name: string;
|
|
102
|
-
aliases: string[];
|
|
103
|
-
'case-sensitive': boolean;
|
|
104
|
-
}
|
|
105
|
-
export interface WikiUserInfo extends Partial<WikiUserBlockInfo> {
|
|
106
|
-
id: number;
|
|
107
|
-
name: string;
|
|
108
|
-
groups: string[];
|
|
109
|
-
rights: string[];
|
|
110
|
-
options: WikiUserOptions;
|
|
111
|
-
}
|
|
112
|
-
export interface WikiUserBlockInfo {
|
|
113
|
-
blockid: number;
|
|
114
|
-
blockedby: string;
|
|
115
|
-
blockedbyid: string;
|
|
116
|
-
blockreason: string;
|
|
117
|
-
blockedtimestamp: string;
|
|
118
|
-
blockexpiry: string;
|
|
119
|
-
}
|
|
120
|
-
type IntBool = 0 | 1;
|
|
121
|
-
export interface WikiUserOptions {
|
|
122
|
-
minordefault: IntBool;
|
|
123
|
-
watchcreations: IntBool;
|
|
124
|
-
watchdefault: IntBool;
|
|
125
|
-
watchdeletion: IntBool;
|
|
126
|
-
watchuploads: IntBool;
|
|
127
|
-
watchmoves: IntBool;
|
|
128
|
-
language: string;
|
|
129
|
-
[key: string]: unknown;
|
|
130
|
-
}
|
|
131
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* interpolate
|
|
3
|
-
* - 具名插值:`{{expr}}`,其中 expr 可为标识符或简单表达式(如 `{{ name || "world" }}`、`{{ name ? 'hi ' + name : '' }}`)。
|
|
4
|
-
* - 匿名插值:使用 `{{ $1 }}`、`{{ $2 }}`...,可用可变参数或数组提供位置参数。
|
|
5
|
-
* - 具名与匿名可混用;若缺失值,替换为空字符串。
|
|
6
|
-
*
|
|
7
|
-
* 示例:
|
|
8
|
-
* ```ts
|
|
9
|
-
* interpolate('hello, {{ name }}') // 'hello, '
|
|
10
|
-
* interpolate('hello, {{ name || "world" }}') // 'hello, world'
|
|
11
|
-
* interpolate('hello, {{ name || "world" }}', { name: 'dragon' }) // 'hello, dragon'
|
|
12
|
-
* interpolate('hello, {{ $1 }}. {{ $2 }}', 'dragon', 'yeah') // 'hello, dragon. yeah'
|
|
13
|
-
* interpolate('hello, {{ $1 }}. {{ $2 }}', ['dragon', 'yeah']) // 'hello, dragon. yeah'
|
|
14
|
-
* interpolate('hello, {{ $1 }}. {{ greeting || "" }}', { $1: 'dragon', greeting: 'yeah' }) // 'hello, dragon. yeah'
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export declare function interpolate(template: string): string;
|
|
18
|
-
export declare function interpolate(template: string, context: Record<string, unknown>): string;
|
|
19
|
-
export declare function interpolate(template: string, ...numricContext: string[]): string;
|
|
20
|
-
export declare function interpolate(template: string, numricContext: string[]): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const CALLABLE_APPLY_SYMBOL: unique symbol;
|
|
2
|
-
export declare const CALLABLE_CTOR_SYMBOL: unique symbol;
|
|
3
|
-
export declare function makeCallable<C extends object, M extends keyof C>(instance: C, method: M): C & ((...args: C[M] extends (...a: infer P) => any ? P : never) => C[M] extends (...a: any[]) => infer R ? R : never);
|
package/dist/utils/noop.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const noop: () => void;
|
package/dist/utils/sleep.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const sleep: (ms?: number) => Promise<unknown>;
|
package/dist/utils/string.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare function capitalize(source: string): string;
|
|
2
|
-
export declare function uncapitalize(source: string): string;
|
|
3
|
-
export declare function camelCase(source: string): string;
|
|
4
|
-
export declare function paramCase(source: string): string;
|
|
5
|
-
export declare function snakeCase(source: string): string;
|
|
6
|
-
export declare function trimSlash(source: string): string;
|
|
7
|
-
export declare function ensureSlash(source: string): string;
|
package/dist/utils/url.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transform a plain object into a URL search params string.
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* ```
|
|
6
|
-
* makeURLSearchParams({ str: '123' }) // str=123
|
|
7
|
-
* makeURLSearchParams({ num: 123 }) // num=123
|
|
8
|
-
* makeURLSearchParams({ bool: true }) // bool=true
|
|
9
|
-
* makeURLSearchParams({ arr: [1, 2, 3] }) // arr=1&arr=2&arr=3
|
|
10
|
-
* makeURLSearchParams({ plainObj: { a: 1, b: 2 } }) // plainObj[a]=1&plainObj[b]=2
|
|
11
|
-
* makeURLSearchParams({ obj: <object> }) // obj=<object>.toString() (if object is not a primitive type)
|
|
12
|
-
* makeURLSearchParams({ empty: '' }) // empty=
|
|
13
|
-
* makeURLSearchParams({ null: null, undefined: undefined }) // (ignored)
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export declare const makeSearchParams: (params?: Record<string, any>) => URLSearchParams;
|
|
17
|
-
/**
|
|
18
|
-
* Create a URL object with the given parameters.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```
|
|
22
|
-
* makeURL('https://example.com?existing=1', { foo: 'bar' }, 'baz') // https://example.com?existing=1&foo=bar#baz
|
|
23
|
-
*/
|
|
24
|
-
export declare const makeURL: (url: string | URL, params?: Record<string, any>, hash?: string) => URL;
|
package/dist/utils/vueHooks.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { InPageEdit } from '../InPageEdit';
|
|
2
|
-
import { App, createApp } 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;
|
|
6
|
-
export declare const createVueAppWithIPE: (ipe: InPageEdit, ...args: Parameters<typeof createApp>) => App<Element>;
|