@mptool/all 0.10.0 → 0.10.2
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/lib/index.d.mts +90 -1
- package/lib/index.d.ts +90 -1
- package/lib/index.js +7 -7
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +7 -7
- package/lib/index.mjs.map +1 -1
- package/package.json +2 -1
package/lib/index.d.mts
CHANGED
|
@@ -1,3 +1,92 @@
|
|
|
1
|
+
declare const writeClipboard: (data?: string) => Promise<void>;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 保存联系人到通讯录
|
|
5
|
+
*
|
|
6
|
+
* @param config 联系人信息
|
|
7
|
+
*/
|
|
8
|
+
declare const addContact: (config: Omit<WechatMiniprogram.AddPhoneContactOption, "success" | "fail" | "complete">) => Promise<void>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 比较版本号
|
|
12
|
+
* @param versionA 版本号A
|
|
13
|
+
* @param versionB 版本号B
|
|
14
|
+
*
|
|
15
|
+
* @returns 1: versionA > versionB, 0: versionA = versionB, -1: versionA < versionB
|
|
16
|
+
*/
|
|
17
|
+
declare const compareVersion: (versionA: string, versionB: string) => number;
|
|
18
|
+
|
|
19
|
+
declare const getCurrentPage: <T extends Record<string, any>>() => (T & WechatMiniprogram.Page.TrivialInstance) | null;
|
|
20
|
+
declare const getCurrentRoute: () => string;
|
|
21
|
+
|
|
22
|
+
declare const openDocument: (url: string) => void;
|
|
23
|
+
declare const saveDocument: (url: string, filename?: string) => void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 保存图片到相册
|
|
27
|
+
*
|
|
28
|
+
* @param imgPath 图片地址
|
|
29
|
+
*/
|
|
30
|
+
declare const savePhoto: (imgPath: string) => Promise<void>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 下载文件
|
|
34
|
+
*
|
|
35
|
+
* @param path 下载路径
|
|
36
|
+
* @param mask 遮罩层
|
|
37
|
+
*/
|
|
38
|
+
declare const download: (url: string, mask?: boolean) => Promise<string>;
|
|
39
|
+
|
|
40
|
+
/** 网络状态汇报 */
|
|
41
|
+
declare const reportNetworkStatus: () => void;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 确认操作
|
|
45
|
+
*
|
|
46
|
+
* @param text 行为文字
|
|
47
|
+
* @param confirmFunc 确定回调函数
|
|
48
|
+
* @param cancelFunc 取消回调函数
|
|
49
|
+
*/
|
|
50
|
+
declare const confirm: (text: string, warning?: string) => Promise<void>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 显示提示窗口
|
|
54
|
+
*
|
|
55
|
+
* @param title 提示文字
|
|
56
|
+
* @param content 提示文字
|
|
57
|
+
* @param confirmAction 点击确定的回调函数
|
|
58
|
+
* @param cancelAction 点击取消的回调函数,不填则不显示取消按钮
|
|
59
|
+
*/
|
|
60
|
+
declare const showModal: (title: string, content: string, confirmAction?: () => void | Promise<void>, cancelAction?: () => void | Promise<void>) => void;
|
|
61
|
+
|
|
62
|
+
declare const retry: (title: string, content: string, navigateBack?: boolean) => Promise<void>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 显示提示文字
|
|
66
|
+
*
|
|
67
|
+
* @param title 提示文字
|
|
68
|
+
* @param duration 提示持续时间,单位 ms,默认为 `1500`
|
|
69
|
+
* @param icon 提示图标,默认为 `'none'`
|
|
70
|
+
*/
|
|
71
|
+
declare const showToast: (title: string, duration?: number, icon?: "success" | "error" | "loading" | "none") => Promise<void>;
|
|
72
|
+
|
|
73
|
+
declare const getWindowInfo: () => WechatMiniprogram.WindowInfo;
|
|
74
|
+
|
|
75
|
+
interface UpdateInfo {
|
|
76
|
+
/** 是否进行强制更新 */
|
|
77
|
+
force: boolean;
|
|
78
|
+
/** 是否进行强制初始化 */
|
|
79
|
+
reset: boolean;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 检查小程序更新
|
|
83
|
+
*
|
|
84
|
+
* 如果检测到小程序更新,获取升级状态 (新版本号,是否立即更新、是否重置小程序) 并做相应处理
|
|
85
|
+
*
|
|
86
|
+
* @param globalData 小程序的全局数据
|
|
87
|
+
*/
|
|
88
|
+
declare const updateApp: (onUpdateReady: (applyUpdate: () => void) => Promise<void> | void) => void;
|
|
89
|
+
|
|
1
90
|
declare const encode: (arraybuffer: ArrayBuffer) => string;
|
|
2
91
|
declare const decode: (base64: string) => ArrayBuffer;
|
|
3
92
|
|
|
@@ -1795,4 +1884,4 @@ declare const getRichTextNodes: (content: string | AnyNode[], { appendClass, tra
|
|
|
1795
1884
|
|
|
1796
1885
|
declare const getText: (content: string | AnyNode[]) => string;
|
|
1797
1886
|
|
|
1798
|
-
export { $App, $Component, $Config, $Page, ALLOWED_TAGS, type AllowTag, type AppConfigCommonOptions, type AppConfigOptions, type AppConstructor, type AppInstance, type AppOptions, type ComponentConstructor, type ComponentInstance, type ComponentLifetimes, type ComponentOptions, type Config, Cookie, type CookieMap, type CookieOptions, CookieStore, type CookieStoreType, type CookieType, type ElementNode, Emitter, type EmitterInstance, type EventHandlerList, type EventHandlerMap, type EventType, type ExtendedAppMethods, type ExtendedComponentMethods, type ExtendedComponentProperty, type ExtendedPageLifeCycles, type ExtendedPageMethods, type ExtendedPageProperties, type ExtendsAppOptions, type Handler, Headers, type HeadersInit, type InferFromType, type InferPropType, type InferPropTypes, MpError$1 as MpError, type MpErrorOptions$1 as MpErrorOptions, type PageConstructor, type PageInstance, type PageOptions, type PageQuery, type PageState, type PropItem, type PropOption, type PropType, type Props, type PropsOptions, Queue, type RefMap, type RequestBody, type RequestFactory, type RequestInitOptions, type RequestOptions, type RequestResponse, type RequestType, type RichTextNode, type RouteCustomConfig, type RoutePathConfig, type SetCookieOptions, type StorageData, type Task, type TextNode, type TrivialComponentInstance, type TrivialComponentOptions, type TrivialPageInstance, type TrivialPageOptions, URLSearchParams, type UrlInfo, type WildCardEventHandlerList, type WildcardHandler, appState, check, checkAsync, createRequest, decode as decodeBase64, dirname, userEmitter as emitter, encode as encodeBase64, exists, funcQueue, get, getAsync, getConfig, getCookieScopeDomain, getDomain, getRef, getRichTextNodes, getText, getUrlInfo, handleProperties, isDir, isFile, isFunction, isMp, isQQ, isWx, lock, logger, ls, mkdir, normalizeDomain, once, parseCookieHeader, parseHTML, parseUrl, put, query, readFile, readJSON, remove, removeAsync, removeRef, request, requestCookieStore, rm, saveFile, saveOnlineFile, set, setAsync, setRef, storage, take, type, unzip, wrapFunction, writeFile, writeJSON };
|
|
1887
|
+
export { $App, $Component, $Config, $Page, ALLOWED_TAGS, type AllowTag, type AppConfigCommonOptions, type AppConfigOptions, type AppConstructor, type AppInstance, type AppOptions, type ComponentConstructor, type ComponentInstance, type ComponentLifetimes, type ComponentOptions, type Config, Cookie, type CookieMap, type CookieOptions, CookieStore, type CookieStoreType, type CookieType, type ElementNode, Emitter, type EmitterInstance, type EventHandlerList, type EventHandlerMap, type EventType, type ExtendedAppMethods, type ExtendedComponentMethods, type ExtendedComponentProperty, type ExtendedPageLifeCycles, type ExtendedPageMethods, type ExtendedPageProperties, type ExtendsAppOptions, type Handler, Headers, type HeadersInit, type InferFromType, type InferPropType, type InferPropTypes, MpError$1 as MpError, type MpErrorOptions$1 as MpErrorOptions, type PageConstructor, type PageInstance, type PageOptions, type PageQuery, type PageState, type PropItem, type PropOption, type PropType, type Props, type PropsOptions, Queue, type RefMap, type RequestBody, type RequestFactory, type RequestInitOptions, type RequestOptions, type RequestResponse, type RequestType, type RichTextNode, type RouteCustomConfig, type RoutePathConfig, type SetCookieOptions, type StorageData, type Task, type TextNode, type TrivialComponentInstance, type TrivialComponentOptions, type TrivialPageInstance, type TrivialPageOptions, URLSearchParams, type UpdateInfo, type UrlInfo, type WildCardEventHandlerList, type WildcardHandler, addContact, appState, check, checkAsync, compareVersion, confirm, createRequest, decode as decodeBase64, dirname, download, userEmitter as emitter, encode as encodeBase64, exists, funcQueue, get, getAsync, getConfig, getCookieScopeDomain, getCurrentPage, getCurrentRoute, getDomain, getRef, getRichTextNodes, getText, getUrlInfo, getWindowInfo, handleProperties, isDir, isFile, isFunction, isMp, isQQ, isWx, lock, logger, ls, mkdir, normalizeDomain, once, openDocument, parseCookieHeader, parseHTML, parseUrl, put, query, readFile, readJSON, remove, removeAsync, removeRef, reportNetworkStatus, request, requestCookieStore, retry, rm, saveDocument, saveFile, saveOnlineFile, savePhoto, set, setAsync, setRef, showModal, showToast, storage, take, type, unzip, updateApp, wrapFunction, writeClipboard, writeFile, writeJSON };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,92 @@
|
|
|
1
|
+
declare const writeClipboard: (data?: string) => Promise<void>;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 保存联系人到通讯录
|
|
5
|
+
*
|
|
6
|
+
* @param config 联系人信息
|
|
7
|
+
*/
|
|
8
|
+
declare const addContact: (config: Omit<WechatMiniprogram.AddPhoneContactOption, "success" | "fail" | "complete">) => Promise<void>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 比较版本号
|
|
12
|
+
* @param versionA 版本号A
|
|
13
|
+
* @param versionB 版本号B
|
|
14
|
+
*
|
|
15
|
+
* @returns 1: versionA > versionB, 0: versionA = versionB, -1: versionA < versionB
|
|
16
|
+
*/
|
|
17
|
+
declare const compareVersion: (versionA: string, versionB: string) => number;
|
|
18
|
+
|
|
19
|
+
declare const getCurrentPage: <T extends Record<string, any>>() => (T & WechatMiniprogram.Page.TrivialInstance) | null;
|
|
20
|
+
declare const getCurrentRoute: () => string;
|
|
21
|
+
|
|
22
|
+
declare const openDocument: (url: string) => void;
|
|
23
|
+
declare const saveDocument: (url: string, filename?: string) => void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 保存图片到相册
|
|
27
|
+
*
|
|
28
|
+
* @param imgPath 图片地址
|
|
29
|
+
*/
|
|
30
|
+
declare const savePhoto: (imgPath: string) => Promise<void>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 下载文件
|
|
34
|
+
*
|
|
35
|
+
* @param path 下载路径
|
|
36
|
+
* @param mask 遮罩层
|
|
37
|
+
*/
|
|
38
|
+
declare const download: (url: string, mask?: boolean) => Promise<string>;
|
|
39
|
+
|
|
40
|
+
/** 网络状态汇报 */
|
|
41
|
+
declare const reportNetworkStatus: () => void;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 确认操作
|
|
45
|
+
*
|
|
46
|
+
* @param text 行为文字
|
|
47
|
+
* @param confirmFunc 确定回调函数
|
|
48
|
+
* @param cancelFunc 取消回调函数
|
|
49
|
+
*/
|
|
50
|
+
declare const confirm: (text: string, warning?: string) => Promise<void>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 显示提示窗口
|
|
54
|
+
*
|
|
55
|
+
* @param title 提示文字
|
|
56
|
+
* @param content 提示文字
|
|
57
|
+
* @param confirmAction 点击确定的回调函数
|
|
58
|
+
* @param cancelAction 点击取消的回调函数,不填则不显示取消按钮
|
|
59
|
+
*/
|
|
60
|
+
declare const showModal: (title: string, content: string, confirmAction?: () => void | Promise<void>, cancelAction?: () => void | Promise<void>) => void;
|
|
61
|
+
|
|
62
|
+
declare const retry: (title: string, content: string, navigateBack?: boolean) => Promise<void>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 显示提示文字
|
|
66
|
+
*
|
|
67
|
+
* @param title 提示文字
|
|
68
|
+
* @param duration 提示持续时间,单位 ms,默认为 `1500`
|
|
69
|
+
* @param icon 提示图标,默认为 `'none'`
|
|
70
|
+
*/
|
|
71
|
+
declare const showToast: (title: string, duration?: number, icon?: "success" | "error" | "loading" | "none") => Promise<void>;
|
|
72
|
+
|
|
73
|
+
declare const getWindowInfo: () => WechatMiniprogram.WindowInfo;
|
|
74
|
+
|
|
75
|
+
interface UpdateInfo {
|
|
76
|
+
/** 是否进行强制更新 */
|
|
77
|
+
force: boolean;
|
|
78
|
+
/** 是否进行强制初始化 */
|
|
79
|
+
reset: boolean;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 检查小程序更新
|
|
83
|
+
*
|
|
84
|
+
* 如果检测到小程序更新,获取升级状态 (新版本号,是否立即更新、是否重置小程序) 并做相应处理
|
|
85
|
+
*
|
|
86
|
+
* @param globalData 小程序的全局数据
|
|
87
|
+
*/
|
|
88
|
+
declare const updateApp: (onUpdateReady: (applyUpdate: () => void) => Promise<void> | void) => void;
|
|
89
|
+
|
|
1
90
|
declare const encode: (arraybuffer: ArrayBuffer) => string;
|
|
2
91
|
declare const decode: (base64: string) => ArrayBuffer;
|
|
3
92
|
|
|
@@ -1795,4 +1884,4 @@ declare const getRichTextNodes: (content: string | AnyNode[], { appendClass, tra
|
|
|
1795
1884
|
|
|
1796
1885
|
declare const getText: (content: string | AnyNode[]) => string;
|
|
1797
1886
|
|
|
1798
|
-
export { $App, $Component, $Config, $Page, ALLOWED_TAGS, type AllowTag, type AppConfigCommonOptions, type AppConfigOptions, type AppConstructor, type AppInstance, type AppOptions, type ComponentConstructor, type ComponentInstance, type ComponentLifetimes, type ComponentOptions, type Config, Cookie, type CookieMap, type CookieOptions, CookieStore, type CookieStoreType, type CookieType, type ElementNode, Emitter, type EmitterInstance, type EventHandlerList, type EventHandlerMap, type EventType, type ExtendedAppMethods, type ExtendedComponentMethods, type ExtendedComponentProperty, type ExtendedPageLifeCycles, type ExtendedPageMethods, type ExtendedPageProperties, type ExtendsAppOptions, type Handler, Headers, type HeadersInit, type InferFromType, type InferPropType, type InferPropTypes, MpError$1 as MpError, type MpErrorOptions$1 as MpErrorOptions, type PageConstructor, type PageInstance, type PageOptions, type PageQuery, type PageState, type PropItem, type PropOption, type PropType, type Props, type PropsOptions, Queue, type RefMap, type RequestBody, type RequestFactory, type RequestInitOptions, type RequestOptions, type RequestResponse, type RequestType, type RichTextNode, type RouteCustomConfig, type RoutePathConfig, type SetCookieOptions, type StorageData, type Task, type TextNode, type TrivialComponentInstance, type TrivialComponentOptions, type TrivialPageInstance, type TrivialPageOptions, URLSearchParams, type UrlInfo, type WildCardEventHandlerList, type WildcardHandler, appState, check, checkAsync, createRequest, decode as decodeBase64, dirname, userEmitter as emitter, encode as encodeBase64, exists, funcQueue, get, getAsync, getConfig, getCookieScopeDomain, getDomain, getRef, getRichTextNodes, getText, getUrlInfo, handleProperties, isDir, isFile, isFunction, isMp, isQQ, isWx, lock, logger, ls, mkdir, normalizeDomain, once, parseCookieHeader, parseHTML, parseUrl, put, query, readFile, readJSON, remove, removeAsync, removeRef, request, requestCookieStore, rm, saveFile, saveOnlineFile, set, setAsync, setRef, storage, take, type, unzip, wrapFunction, writeFile, writeJSON };
|
|
1887
|
+
export { $App, $Component, $Config, $Page, ALLOWED_TAGS, type AllowTag, type AppConfigCommonOptions, type AppConfigOptions, type AppConstructor, type AppInstance, type AppOptions, type ComponentConstructor, type ComponentInstance, type ComponentLifetimes, type ComponentOptions, type Config, Cookie, type CookieMap, type CookieOptions, CookieStore, type CookieStoreType, type CookieType, type ElementNode, Emitter, type EmitterInstance, type EventHandlerList, type EventHandlerMap, type EventType, type ExtendedAppMethods, type ExtendedComponentMethods, type ExtendedComponentProperty, type ExtendedPageLifeCycles, type ExtendedPageMethods, type ExtendedPageProperties, type ExtendsAppOptions, type Handler, Headers, type HeadersInit, type InferFromType, type InferPropType, type InferPropTypes, MpError$1 as MpError, type MpErrorOptions$1 as MpErrorOptions, type PageConstructor, type PageInstance, type PageOptions, type PageQuery, type PageState, type PropItem, type PropOption, type PropType, type Props, type PropsOptions, Queue, type RefMap, type RequestBody, type RequestFactory, type RequestInitOptions, type RequestOptions, type RequestResponse, type RequestType, type RichTextNode, type RouteCustomConfig, type RoutePathConfig, type SetCookieOptions, type StorageData, type Task, type TextNode, type TrivialComponentInstance, type TrivialComponentOptions, type TrivialPageInstance, type TrivialPageOptions, URLSearchParams, type UpdateInfo, type UrlInfo, type WildCardEventHandlerList, type WildcardHandler, addContact, appState, check, checkAsync, compareVersion, confirm, createRequest, decode as decodeBase64, dirname, download, userEmitter as emitter, encode as encodeBase64, exists, funcQueue, get, getAsync, getConfig, getCookieScopeDomain, getCurrentPage, getCurrentRoute, getDomain, getRef, getRichTextNodes, getText, getUrlInfo, getWindowInfo, handleProperties, isDir, isFile, isFunction, isMp, isQQ, isWx, lock, logger, ls, mkdir, normalizeDomain, once, openDocument, parseCookieHeader, parseHTML, parseUrl, put, query, readFile, readJSON, remove, removeAsync, removeRef, reportNetworkStatus, request, requestCookieStore, retry, rm, saveDocument, saveFile, saveOnlineFile, savePhoto, set, setAsync, setRef, showModal, showToast, storage, take, type, unzip, updateApp, wrapFunction, writeClipboard, writeFile, writeJSON };
|